Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs([consolidate-cert-path-constants]): remove from PLAN.md and log to changelog
[._.]/ Adam Eivy2d76de0b640b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8d6cd23be6..5d563bb028 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -6,6 +6,8 @@- **[extract-usependinglistrows-hook] Unify pending-row buffers in `WardrobeSection` + `CharacterDetailEditor` behind a shared hook.** New `client/src/hooks/usePendingListRows.js` collapses the "list-of-rows where a new row is held client-side until a required column fills, then promoted to `onChange`" pattern that was inlined in `CanonCard.jsx#WardrobeSection` and `CharacterDetailEditor.jsx`'s per-LIST_SECTION block (each had grown slightly different id-handling: `wd-<uuid>` ids that round-trip verbatim vs `pending-<key>-<uuid>` client-only ids stripped at promotion). The hook accepts `idPrefix` + `stripIdOnPromote` so both conventions survive intact, and a new `ListSectionEditor` subcomponent inside `CharacterDetailEditor` owns one hook instance per section (hooks can't be called inside `LIST_SECTIONS.map`). Skipping the stale `[route-medialightbox-settings-drawer-through]` PLAN entry along the way — the drawer was removed in commit ed0e4859 so no migration target exists. Net 77 LOC removed across the two call sites; 11 new tests cover add/promote/remove/required-column gating and the `crypto.randomUUID` fallback path. 202/202 client tests pass; lint clean.+- **[consolidate-cert-path-constants] cert/key/meta path constants extracted to `lib/certPaths.js`.** The `data/certs/{cert,key,meta}` path layout had been hand-rebuilt at ten sites — four flagged in PLAN.md (`scripts/setup-cert.js`, `scripts/open-ui-in-browser.js`, `server/services/certProvisioner.js`, `server/services/certRenewer.js`) plus six the audit picked up (`scripts/print-access-url.js`, `server/index.js`, `server/lib/peerSelfHost.js`, `server/lib/networkExposure.js`, `server/routes/apps.js`, `server/services/apps.js`). New zero-dep helper `lib/certPaths.js` exports `certPaths(dataDir) → { dir, cert, key, meta }`; placed at the repo-root `lib/` alongside `lib/tailscale-https.js` so both bootstrap scripts and the server can import it without crossing into `server/lib/`. All ten callsites destructure what they need; `server/vitest.config.js` extended to discover `../lib/**/*.test.js` so the new `certPaths.test.js` runs in the project's single test entrypoint. No behavior change.+- **[apicore-request-arraybuffer-response-type] `apiCore.request()` grows an `arraybuffer` `responseType` escape hatch; two TTS audition helpers stop bypassing the shared client.** `client/src/services/apiCore.js#request` now accepts `{ responseType: 'arraybuffer' }` — when set, the helper returns `response.arrayBuffer()` instead of parsing JSON, while still funneling the error path (server-shaped 4xx/5xx, network-unreachable toast, `err.code` / `err.status` / `err.context` forwarding) through the same code. `apiVoice.js#testTts` and `apiPipeline.js#previewPipelineTtsVoice` dropped their raw `fetch` paths and now call `request()` with `responseType: 'arraybuffer'` + `silent: true` (all three callers — `VoiceTab.handleTest`, `VoiceTab.handlePreviewVoice`, `VoicePicker.handleAudition` — already own their own catch-block toasts, so silent avoids double-toasting per the CLAUDE.md convention). Drops ~25 LOC of duplicated `if (!res.ok) parse + throw` shaping. Also pruned a stale PLAN.md entry ([extract-useswipenav-hook-lib-clipboard-js]) — both halves of that item already shipped (clipboard helpers in `client/src/lib/clipboard.js`, swipe in `client/src/hooks/useSwipeNav.js`; `MediaLightbox.jsx:122` has been calling `useSwipeNav` since PR #261). 163/163 client tests pass; lint clean.- **[extract-mergeexpandintodraft-draft-result-from] `mergeExpandIntoDraft` extracted from `UniverseBuilder.jsx#handleExpand`.** The merge block — lock-honoring scalar pick, locked-variation/sheet preservation, category `kind` precedence, canon dedupe by name/slugline/alias, addedCanonCount + pendingAdditions partitioning — moved to a pure `client/src/lib/universeBuilderExpand.js` so the I/O shell of `handleExpand` (validation, `expandUniverse()` call, `setDraft`, auto-save, toast) is no longer tangled with merge semantics. `handleExpand` shrinks from ~260 lines to ~120; the new module exports `mergeExpandIntoDraft`, `mergeVariations`, `mergeCanonByName`, and `extractPreservedFromDraft` (the locked-items extractor used by both the API-call site and the merge so they can't drift). 27 new unit tests pin the lock semantics (absent vs intentional `""` clear), category-kind precedence ("other" upgradable; user-curated kinds preserved), composite-sheet dedupe, place-slugline normalization, within-batch alias dedupe, and `pendingAdditions` partitioning by trunk. Existing 10-test `UniverseBuilder.test.jsx` still passes; full client suite at 190/190.diff --git a/PLAN.md b/PLAN.mdindex 3360d4f56d..acda551ce4 100644--- a/PLAN.md+++ b/PLAN.md@@ -15,7 +15,6 @@ _Nothing currently parked — pick the next item from the Backlog._- [ ] [route-medialightbox-settings-drawer-through] **Route `MediaLightbox` settings drawer through `components/Drawer.jsx`.** Reconcile `Drawer`'s flat Esc handler with the lightbox's layered Escape cascade.- [ ] [sweep-provider-type-api-inline-checks-in-client] **Sweep `provider.type === 'api'` inline checks in client.** Sibling of `[sweep-provider-type-tui-inline-checks-in-client]` (shipped 2026-05-20). Add `isApiProvider(provider)` to `client/src/utils/providers.js` and adopt at the saved-provider call sites: `client/src/pages/AIProviders.jsx:265` + `:399` (CONFIG-style chips showing the API endpoint), `client/src/components/goals/GoalsTreeView.jsx:14` (`API_PROVIDER_FILTER = p => p.enabled && p.type === 'api'`), `client/src/components/goals/GoalsListView.jsx:13` (same filter), and the `apiProviders` filter in `client/src/components/digital-twin/tabs/TasteTab.jsx`. Skip `formData.type === 'api'` in the AIProviders edit form (same exclusion convention as the TUI sweep — form-draft state, not saved providers). Low priority — visual / filter predicate consolidation.- [ ] [promote-provider-type-constants-to-shared-module] **Promote `'tui'` / `'cli'` / `'api'` literals to a shared `PROVIDER_TYPES` constant.** `server/lib/aiToolkit/constants.js` already exports a partial `PROVIDER_TYPES = { CLI: 'cli', API: 'api' }` (missing `TUI`); the client helpers in `client/src/utils/providers.js` (`isTuiProvider`, `isCliProvider`, `isProcessProvider`) and the server-side `LIGHT_CONTEXT_PROVIDER_TYPES` set in `agentPromptBuilder.js` all re-encode the same string literals. Add `TUI: 'tui'` to the toolkit constants, mirror to client (or move to a neutral location), and migrate helpers + sets to read from the constant. Surfaced by /simplify quality agent during `[sweep-provider-type-tui-inline-checks-in-client]`; deferred to keep that PR scoped.-- [ ] [consolidate-cert-path-constants] **Consolidate `CERT_DIR`/`CERT_PATH`/`KEY_PATH`/`META_PATH` constants.** Re-declared in `scripts/setup-cert.js`, `scripts/open-ui-in-browser.js`, `server/services/certProvisioner.js`, and `server/services/certRenewer.js` (4 sites). Surfaced by `/simplify` during the first-run HTTPS-auto-flip fix (2026-05-19); deferred to keep that PR scoped. Candidate home: `lib/certPaths.js` (alongside `lib/tailscale-https.js` so both runtime + bootstrap can import).- [ ] [imagegen-local-defer-module-load-side-effects] **Defer module-load side effects in `server/services/imageGen/local.js`.** Line 32 runs `IMAGE_MODELS = Object.fromEntries(getImageModels().map(...))` at module evaluation — `getImageModels()` calls `lib/mediaModels.js#loadMediaModels` which `mkdirSync`s `dirname(REGISTRY_FILE)` and `writeFileSync`s a default registry if missing. Any importer that loads via a mocked `PATHS.data` (e.g. `routes/pipeline.test.js` → `routes/pipeline.js` → `routes/universeBuilder.js` → `services/universeBuilderCollectionHook.js` → `services/imageGen/local.js`) fails on `mkdirSync('/mock/data')`. Worked around in 2026-05-19 by lazy-importing `readImageSidecar` in `universeBuilderCollectionHook.js`; real fix is to convert `IMAGE_MODELS` + sibling top-level constants to lazy getters and audit callers. Affects every consumer of `local.js` exports today.- [ ] [cleanplateprompt-migrate-to-rich-canon-fragments] **Migrate `client/src/lib/cleanPlatePrompt.js#composeCleanPlatePrompt` to `richCanonDescriptorFragments('place', setting)`.** Clean-plate prompt builder (Cluster A — A4 setting reference renders) hand-rolls `description + Palette + recurringDetails` extraction at `cleanPlatePrompt.js:26-30` and is missing `era` / `weather` for the same reason `[pipeline-visual-stages-setting-field-injection]` was missing them — both are visual prompts that benefit from period/atmosphere cues. Tightly scoped sibling change (one client file + one test file). Deferred from that PR because the PLAN item targeted storyboard+comic-panel specifically; clean plates are setting-reference renders, adjacent but distinct.- [ ] [extract-readcertmeta-helper] **Extract a shared `readCertMeta()` helper from `data/certs/meta.json` readers.** Three independent readers exist: `server/lib/peerSelfHost.js:13-18` (hostname only), `server/services/certRenewer.js:30-31` (mode + hostname), `server/lib/networkExposure.js:25-29` (mode + hostname + ips). Each does its own `statSync({ throwIfNoEntry: false }) + readFileSync + safeJSONParse`. Consolidate into `server/lib/certMeta.js` exporting `readCertMeta() → { mode, hostname, ips } | null`. Surfaced by /simplify during `[codex5-network-exposure-ui]`; deferred to keep that PR scoped. Note `peerSelfHost.js` is in a hot path — verify perf when consolidating.