Skip to content

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

docs([promote-provider-type-constants-to-shared-module]): remove from PLAN.md and log to changelog

[._.]/ Adam Eivy9fcb92ca5277
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 3160967973..cbf43aa2a1 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,8 @@
## Changed
+- **[promote-provider-type-constants-to-shared-module] Promote provider-type literals to a shared `PROVIDER_TYPES` enum.** `server/lib/aiToolkit/constants.js#PROVIDER_TYPES` grows `TUI: 'tui'` alongside the existing `CLI`/`API`, and the object is now `Object.freeze`d so callers can't mutate the shared enum. Server-side `LIGHT_CONTEXT_PROVIDER_TYPES` set + the `isTui` / `providerType` default in `server/services/agentPromptBuilder.js` now read from `PROVIDER_TYPES.{CLI,TUI,API}` instead of bare string literals. A mirror `PROVIDER_TYPES` is exported from `client/src/utils/providers.js` (the toolkit dir is intentionally kept self-contained per CLAUDE.md, so the client can't import the server copy directly), and the four client helpers (`isTuiProvider`, `isCliProvider`, `isProcessProvider`, `providerTypeClass`) now read from it. A new `providers.test.js` case statically imports the server enum and asserts the two enums stay in lockstep, so a future divergence fails CI instead of silently drifting. 13/13 provider helper tests pass; 25/25 agentPromptBuilder tests pass.
+
- **[sweep-provider-type-tui-inline-checks-in-client] Adopt `isTuiProvider` + new `isCliProvider` / `isProcessProvider` helpers at the saved-provider chip sites.** Three inline `provider.type === 'tui'` / compound `'cli' || 'tui'` checks in `client/src/pages/AIProviders.jsx` (lines 262, 310, 396) and two in `client/src/components/cos/TaskAddForm.jsx` (lines 86, 88) now flow through `client/src/utils/providers.js`. Two new one-liner exports added there: `isCliProvider(provider)` and `isProcessProvider(provider)` (`isCliProvider || isTuiProvider` — the predicate for "shows a Command + args" config). `formData.type === ...` checks inside the AIProviders provider-edit form intentionally stay inline (PLAN scoped to saved-provider chips). New `client/src/utils/providers.test.js` covers all five helpers (10 assertions, including nullish edge cases). Two deferred follow-ups captured in PLAN.md: `[sweep-provider-type-api-inline-checks-in-client]` (sibling sweep across AIProviders, goals views, digital-twin tabs) and `[promote-provider-type-constants-to-shared-module]` (unify the partial `PROVIDER_TYPES` constant in `server/lib/aiToolkit/constants.js` and have the helpers read from it). 201/201 client tests pass.
- **[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.
diff --git a/PLAN.md b/PLAN.md
index 185f83ad46..f2e0e26640 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -13,7 +13,6 @@ _Nothing currently parked — pick the next item from the Backlog._
### Code quality / dedup (from `/simplify` passes)
- [ ] [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.
- [ ] [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.