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
fix: gate Storyboards runs and GitHub inbox writes behind host control, and fail CI on unclassified mutating routes (#12952) (#13056)
[._.]/fdd3353e60d8
diff --git a/docs/API.md b/docs/API.mdindex 3cdae38dc3..bb88e19cf1 100644--- a/docs/API.md+++ b/docs/API.md@@ -808,7 +808,7 @@ Every mounted API prefix (see `server/index.js` for the authoritative list). Dom| `/api/music-video` | Music video projects; [one-prompt autonomous runs](./features/music-video-autonomous.md) at `/api/music-video/autonomous` || `/api/music-video/character-styles` | Built-in character styles a project loads via `concept.characterStyleId`: list with each style's sheet prompt and this install's sheet (`GET /`), full style (`GET /:id`), set or clear the install's character sheet (`PUT /:id/reference` `{ imageId }`) || `/api/mood-boards` | Mood boards; `POST /:id/generate` writes 1–4 prompts with the chosen LLM and queues new image items using saved imagegen settings (1024×576 default). Body: `requestId` (UUID), `providerId`, optional `model`, `effort`, `direction`, `count`, `render` (`mode`, `model`, `width`, `height`), `retry`. `GET /:id/generate` restores transient status; `mood-board:generate` pushes progress. Retry reuses the original batch and only queues unfinished slots. Prompt writing uses stored text, not pixels; saved prompts and references survive navigation and server restart, while transient batch status and recent request receipts reset on restart. |-| `/api/storyboards` | Storyboards (Create › Storyboards): `GET`/`POST /`, `GET`/`PATCH`/`DELETE /:id`; beats at `/:id/beats` (`POST`, `PATCH`/`DELETE /:beatId`, `POST /:beatId/move`); panels at `/:id/beats/:beatId/panels` (`POST`) and `/:id/panels/:panelId` (`PATCH`, `DELETE`, `POST /move` with `{ beatId?, index }`); panel art takes at `/:id/panels/:panelId/takes` (`POST` `{ source, image \| sketchKey }`, `POST /:takeId/select`, `DELETE /:takeId`); the panel maker at `PUT /:id/recipe` (`{ recipe \| null }`, null = default), `GET /:id/panels/:panelId/make` (linked catalog reference images), `PATCH /:id/panels/:panelId/make/:nodeId` (`{ text?, excludedRefs?, extraRefs? }`) and `POST /:id/panels/:panelId/make/:nodeId/run` (an LLM node answers when done; an image node once its frames are queued, with `storyboard:make` socket events after). Beats from a plot summary: `POST /:id/beats/extract` (`{ plot, providerId?, model?, effort? }` → `{ board, beats, sentPrompt, promptAdditions }`: the plot and pick are saved, the beats are a preview) and `POST /:id/beats/add` (`{ beats }`, appended). Make empty panels: `GET /:id/make-empty` (`{ batch, panelCount, steps }`: the panels with no art and each node it runs with its model) and `POST /:id/make-empty` (202, one batch per board, `storyboard:make-batch` progress). The saved recipe library: `GET`/`POST /recipes` (`{ name, recipe }`) and `DELETE /recipes/:recipeId`. The animatic's temp track is `PATCH /:id` `{ tempTrack: { filename, name?, sections?, lines? } \| null }`, naming an audio file already in `/api/uploads`, with its song marks (`sections` `{ id?, label, at }`, lyric `lines` `{ id?, text, at \| null }`); a beat starts at one with `PATCH …/beats/:beatId` `{ pin }`. Make storyboard from a music video: `POST /from-music-video/:projectId` (201 `{ board, project }`: one beat per song section, one panel per shot, and the project's `storyboardId` set; 409 while it links a live board). Fit to song: `POST /fit-music-video/:projectId` (`{ boardUpdatedAt, starts? }`, `starts` = beat id → picked start seconds → `{ project, shots, replaced }`: the linked board's panels written as the video's shots, each with `panelId`/`panelRev`; 409 when the board changed since `boardUpdatedAt`, the song is not analyzed, or a shot is locked). Every write returns the whole board; over-limit text is refused. |+| `/api/storyboards` | Storyboards (Create › Storyboards): `GET`/`POST /`, `GET`/`PATCH`/`DELETE /:id`; beats at `/:id/beats` (`POST`, `PATCH`/`DELETE /:beatId`, `POST /:beatId/move`); panels at `/:id/beats/:beatId/panels` (`POST`) and `/:id/panels/:panelId` (`PATCH`, `DELETE`, `POST /move` with `{ beatId?, index }`); panel art takes at `/:id/panels/:panelId/takes` (`POST` `{ source, image \| sketchKey }`, `POST /:takeId/select`, `DELETE /:takeId`); the panel maker at `PUT /:id/recipe` (`{ recipe \| null }`, null = default), `GET /:id/panels/:panelId/make` (linked catalog reference images), `PATCH /:id/panels/:panelId/make/:nodeId` (`{ text?, excludedRefs?, extraRefs? }`) and `POST /:id/panels/:panelId/make/:nodeId/run` (an LLM node answers when done; an image node once its frames are queued, with `storyboard:make` socket events after). Beats from a plot summary: `POST /:id/beats/extract` (`{ plot, providerId?, model?, effort? }` → `{ board, beats, sentPrompt, promptAdditions }`: the plot and pick are saved, the beats are a preview) and `POST /:id/beats/add` (`{ beats }`, appended). Make empty panels: `GET /:id/make-empty` (`{ batch, panelCount, steps }`: the panels with no art and each node it runs with its model) and `POST /:id/make-empty` (202, one batch per board, `storyboard:make-batch` progress). The saved recipe library: `GET`/`POST /recipes` (`{ name, recipe }`) and `DELETE /recipes/:recipeId`. The animatic's temp track is `PATCH /:id` `{ tempTrack: { filename, name?, sections?, lines? } \| null }`, naming an audio file already in `/api/uploads`, with its song marks (`sections` `{ id?, label, at }`, lyric `lines` `{ id?, text, at \| null }`); a beat starts at one with `PATCH …/beats/:beatId` `{ pin }`. Make storyboard from a music video: `POST /from-music-video/:projectId` (201 `{ board, project }`: one beat per song section, one panel per shot, and the project's `storyboardId` set; 409 while it links a live board). Fit to song: `POST /fit-music-video/:projectId` (`{ boardUpdatedAt, starts? }`, `starts` = beat id → picked start seconds → `{ project, shots, replaced }`: the linked board's panels written as the video's shots, each with `panelId`/`panelRev`; 409 when the board changed since `boardUpdatedAt`, the song is not analyzed, or a shot is locked). Every write returns the whole board; over-limit text is refused. Beat extraction, a node run and `POST /:id/make-empty` are host control (they run a caller-chosen provider or queue renders); the rest store records. || `/api/decks` | Decks (playing-card / tarot designer) || `/api/writers-room` | Writers Room || `/api/universe-builder` | Universe Builder |diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 32824c2860..9e5287e9d1 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -514,6 +514,9 @@ export const ALWAYS_RUN_TESTS = [// Whole-tree scanner (#12048): server/index.js can mount a new router that no// test imports, with no import edge from that router to this guard.'server/routeTestCoverageConventions.test.js',+ // Whole-tree scanner (#12952): server/index.js can mount a mutating route that+ // no host-control classification names, with no import edge to this guard.+ 'server/hostControlCoverage.test.js','server/routeValidationConventions.test.js','server/floatingAsyncConventions.test.js','server/timerCallbackConventions.test.js',diff --git a/server/hostControlCoverage.test.js b/server/hostControlCoverage.test.jsnew file mode 100644index 0000000000..9c32c91023--- /dev/null+++ b/server/hostControlCoverage.test.js@@ -0,0 +1,1460 @@+/**+ * Every mounted mutating route is classified for host control (#12952).+ *+ * `HOST_CONTROL_ROUTES` in lib/hostControlRoutes.js is hand-kept, so a new+ * route family used to be gated only if its author remembered, and the gap was+ * found by audit after it shipped (more than 40 "Require operator authority+ * for …" issues). This guard reads the live mounted route graph+ * (`scanRouteGraph`, sub-routers included) and requires each `POST`/`PUT`/+ * `PATCH`/`DELETE` to be gated by `HOST_CONTROL_ROUTES`, gated per body+ * (`hostControlBodyRouteFor`), or listed below as reviewed-open with a reason.+ * It fails on a mounted mutation in no list, on a stale entry, and on an entry+ * that is also gated.+ *+ * Classifying a new route: read the family notes in the header of+ * lib/hostControlRoutes.js. A route that runs a process, git/npm/gh, a CoS+ * agent, or hands caller text or a caller-chosen provider to a runner that is+ * not tool-free belongs in HOST_CONTROL_ROUTES. Otherwise add it here with the+ * reason constant that matches, or a new one. Never add PRE_GUARD_BASELINE:+ * it is the burn-down of routes that were open when this guard landed (#13055).+ */+import { describe, expect, it } from 'vitest';+import { scanRouteGraph } from './lib/apiRouteGraph.js';+import { hostControlBodyRouteFor, hostControlRouteFor } from './lib/hostControlRoutes.js';++const MUTATING_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);++// Reasons, from the family notes in the lib/hostControlRoutes.js header.+const RECORDS = 'Stores, edits or moves PortOS records; runs nothing on the host.';+const REMOVES_RECORD = 'Removes a record or stored data; never starts host work.';+const REDUCES_EXECUTION = 'Cancels, stops, pauses or unloads work; reducing execution stays open.';+const HANDLER_GATED = 'Checks host control in its handler or router for the requests that need it.';+const PEER_SURFACE = 'Peer endpoint in PEER_API_SURFACE (lib/apiAccessPolicy.js), admitted by scoped peer credentials and its own grant checks.';+const AUTH_SESSION = 'Authentication session lifecycle; auth.js and authGate.js own its policy.';+const READ_ONLY_EXTERNAL = 'Runs a read-only query (a gh GET or repo analysis) and caches the result; changes no external state.';+const CONFIGURED_INFERENCE = 'Runs an already-configured provider or local runtime on a fixed prompt (providers #8721, local-llm #8798).';+const MODEL_DATA = 'Downloads, verifies or removes model weights, or selects a built-in backend; installs no executable (local-llm #8798).';+const MANAGED_INSTALL = 'Installs a fixed, allowlisted package set into a PortOS-managed venv with an interpreter PortOS picks; no caller-chosen executable (#9015).';+const PIPELINE_DETERMINISTIC = 'Deterministic Pipeline route that never reaches the staged runner (#10068).';+const PRE_GUARD_BASELINE = 'Open when this guard landed and not yet re-audited route by route (#13055); do not add new entries.';++// 'METHOD /path' as scanRouteGraph spells it (the declaring module's :param names).+const REVIEWED_OPEN_MUTATIONS = [+ // /api/agent-context+ ['DELETE /api/agent-context/mcp', REMOVES_RECORD],+ ['POST /api/agent-context/mcp', PRE_GUARD_BASELINE],+ // /api/agents/accounts+ ['DELETE /api/agents/accounts/:id', REMOVES_RECORD],+ // /api/agents/activity+ ['POST /api/agents/activity/cleanup', PRE_GUARD_BASELINE],+ ['POST /api/agents/activity/run-events/reconcile', PRE_GUARD_BASELINE],+ // /api/agents/personalities+ ['POST /api/agents/personalities', PRE_GUARD_BASELINE],+ ['DELETE /api/agents/personalities/:id', REMOVES_RECORD],+ ['POST /api/agents/personalities/:id/toggle', HANDLER_GATED],+ // /api/agents/schedules+ ['DELETE /api/agents/schedules/:id', REMOVES_RECORD],+ ['POST /api/agents/schedules/:id/toggle', HANDLER_GATED],+ // /api/agents/tools+ ['POST /api/agents/tools/drafts', PRE_GUARD_BASELINE],+ ['DELETE /api/agents/tools/drafts/:draftId', REMOVES_RECORD],+ ['PUT /api/agents/tools/drafts/:draftId', PRE_GUARD_BASELINE],+ ['POST /api/agents/tools/generate-comment', PRE_GUARD_BASELINE],+ ['POST /api/agents/tools/generate-post', PRE_GUARD_BASELINE],+ // /api/agents/tools/moltworld+ ['DELETE /api/agents/tools/moltworld/queue/:id', REMOVES_RECORD],+ ['POST /api/agents/tools/moltworld/queue/:id/complete', PRE_GUARD_BASELINE],+ ['POST /api/agents/tools/moltworld/queue/:id/fail', PRE_GUARD_BASELINE],+ // /api/agents/tools/moltworld/ws+ ['POST /api/agents/tools/moltworld/ws/disconnect', REDUCES_EXECUTION],+ // /api/albums+ ['POST /api/albums', PRE_GUARD_BASELINE],+ ['DELETE /api/albums/:id', REMOVES_RECORD],+ ['PATCH /api/albums/:id', PRE_GUARD_BASELINE],+ // /api/apps+ ['DELETE /api/apps/:id', REMOVES_RECORD],+ ['POST /api/apps/:id/archive', RECORDS],+ ['POST /api/apps/:id/detect-icon', PRE_GUARD_BASELINE],+ ['POST /api/apps/:id/quality-schedule/preview', PRE_GUARD_BASELINE],+ ['POST /api/apps/:id/scope-adherence', RECORDS],+ ['POST /api/apps/:id/unarchive', RECORDS],+ // /api/apps/:appId/reference-repos+ ['DELETE /api/apps/:appId/reference-repos/:refId', REMOVES_RECORD],+ ['POST /api/apps/:appId/reference-repos/:refId/reviewed', RECORDS],+ // /api/artists+ ['POST /api/artists', PRE_GUARD_BASELINE],+ ['DELETE /api/artists/:id', REMOVES_RECORD],+ ['PATCH /api/artists/:id', PRE_GUARD_BASELINE],+ // /api/ask+ ['POST /api/ask', HANDLER_GATED],+ ['DELETE /api/ask/:id', REMOVES_RECORD],+ ['POST /api/ask/:id/promote', HANDLER_GATED],+ // /api/attachments+ ['POST /api/attachments', PRE_GUARD_BASELINE],+ ['DELETE /api/attachments/:filename', REMOVES_RECORD],+ // /api/auth+ ['POST /api/auth/login', AUTH_SESSION],+ ['POST /api/auth/logout', AUTH_SESSION],+ ['DELETE /api/auth/password', AUTH_SESSION],+ ['DELETE /api/auth/sessions', AUTH_SESSION],+ ['DELETE /api/auth/sessions/:id', AUTH_SESSION],+ // /api/authors+ ['POST /api/authors', PRE_GUARD_BASELINE],+ ['DELETE /api/authors/:id', REMOVES_RECORD],+ ['PATCH /api/authors/:id', PRE_GUARD_BASELINE],+ // /api/beeper+ ['PATCH /api/beeper/attachments/:messageId/:idx', PRE_GUARD_BASELINE],+ ['POST /api/beeper/attachments/:messageId/:idx/fetch', PRE_GUARD_BASELINE],+ ['POST /api/beeper/attachments/backfill', PRE_GUARD_BASELINE],+ ['POST /api/beeper/conversations', PRE_GUARD_BASELINE],+ ['DELETE /api/beeper/conversations/:id', REMOVES_RECORD],+ ['POST /api/beeper/conversations/:id/archive', PRE_GUARD_BASELINE],+ ['POST /api/beeper/conversations/:id/low-priority', PRE_GUARD_BASELINE],+ ['POST /api/beeper/conversations/:id/seen', PRE_GUARD_BASELINE],+ ['POST /api/beeper/oauth/start', PRE_GUARD_BASELINE],+ ['DELETE /api/beeper/outbox/:id', REMOVES_RECORD],+ ['POST /api/beeper/outbox/:id/reconcile', PRE_GUARD_BASELINE],+ ['POST /api/beeper/scopes', PRE_GUARD_BASELINE],+ ['DELETE /api/beeper/scopes/:id', REMOVES_RECORD],+ ['PATCH /api/beeper/scopes/:id', PRE_GUARD_BASELINE],+ ['POST /api/beeper/status/check', PRE_GUARD_BASELINE],+ ['POST /api/beeper/sync', PRE_GUARD_BASELINE],+ ['DELETE /api/beeper/token', REMOVES_RECORD],+ ['POST /api/beeper/token', PRE_GUARD_BASELINE],+ // /api/brain+ ['POST /api/brain/admin', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/admin/:id', REMOVES_RECORD],+ ['PUT /api/brain/admin/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/bridge-sync', PRE_GUARD_BASELINE],+ ['POST /api/brain/buckets', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/buckets/:id', REMOVES_RECORD],+ ['PUT /api/brain/buckets/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/buckets/reorder', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/daily-log/:date', REMOVES_RECORD],+ ['PUT /api/brain/daily-log/:date', PRE_GUARD_BASELINE],+ ['POST /api/brain/daily-log/:date/append', PRE_GUARD_BASELINE],+ ['PUT /api/brain/daily-log/settings', PRE_GUARD_BASELINE],+ ['POST /api/brain/daily-log/sync-obsidian', PRE_GUARD_BASELINE],+ ['POST /api/brain/fix', PRE_GUARD_BASELINE],+ ['POST /api/brain/ideas', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/ideas/:id', REMOVES_RECORD],+ ['PUT /api/brain/ideas/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/ideas/idealoom/import', PRE_GUARD_BASELINE],+ ['POST /api/brain/ideas/idealoom/lists', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/ideas/idealoom/lists/:id', REMOVES_RECORD],+ ['PUT /api/brain/ideas/idealoom/lists/:id', PRE_GUARD_BASELINE],+ ['PUT /api/brain/ideas/idealoom/settings', PRE_GUARD_BASELINE],+ ['POST /api/brain/ideas/idealoom/sync', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/inbox/:id', REMOVES_RECORD],+ ['PUT /api/brain/inbox/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/inbox/:id/done', PRE_GUARD_BASELINE],+ ['POST /api/brain/inbox/sent-to-catalog', PRE_GUARD_BASELINE],+ ['POST /api/brain/links', HANDLER_GATED],+ ['DELETE /api/brain/links/:id', REMOVES_RECORD],+ ['PUT /api/brain/links/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/links/reorder', PRE_GUARD_BASELINE],+ ['POST /api/brain/memories', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/memories/:id', REMOVES_RECORD],+ ['PUT /api/brain/memories/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/people', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/people/:id', REMOVES_RECORD],+ ['PUT /api/brain/people/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/projects', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/projects/:id', REMOVES_RECORD],+ ['PUT /api/brain/projects/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/reconcile/parity', PRE_GUARD_BASELINE],+ ['POST /api/brain/review/resolve', PRE_GUARD_BASELINE],+ ['PUT /api/brain/settings', PRE_GUARD_BASELINE],+ ['POST /api/brain/songbook', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/songbook/:id', REMOVES_RECORD],+ ['PATCH /api/brain/songbook/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/songbook/:id/attachments', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/songbook/:id/attachments/:filename', REMOVES_RECORD],+ ['POST /api/brain/songbook/:id/practice', PRE_GUARD_BASELINE],+ ['POST /api/brain/songbook/import/url', PRE_GUARD_BASELINE],+ ['POST /api/brain/sync', PRE_GUARD_BASELINE],+ ['POST /api/brain/threads', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/threads/:id', REMOVES_RECORD],+ ['PUT /api/brain/threads/:id', PRE_GUARD_BASELINE],+ ['POST /api/brain/threads/:id/refs', PRE_GUARD_BASELINE],+ ['DELETE /api/brain/threads/:id/refs/:kind/:refId', REMOVES_RECORD],+ ['POST /api/brain/threads/attach', PRE_GUARD_BASELINE],+ ['POST /api/brain/threads/sync', PRE_GUARD_BASELINE],+ ['POST /api/brain/youtube/ingest/:jobId/cancel', REDUCES_EXECUTION],+ ['DELETE /api/brain/youtube/ingests/:videoId', REMOVES_RECORD],+ ['PUT /api/brain/youtube/settings', PRE_GUARD_BASELINE],+ // /api/brain/import+ ['POST /api/brain/import/chatgpt', PRE_GUARD_BASELINE],+ ['POST /api/brain/import/chatgpt/preview', PRE_GUARD_BASELINE],+ ['POST /api/brain/import/chatgpt/zip', PRE_GUARD_BASELINE],+ // /api/browser+ ['DELETE /api/browser/downloads/:name', REMOVES_RECORD],+ // /api/calendar+ ['POST /api/calendar/accounts', PRE_GUARD_BASELINE],+ ['DELETE /api/calendar/accounts/:id', REMOVES_RECORD],+ ['PUT /api/calendar/accounts/:id', PRE_GUARD_BASELINE],+ ['PUT /api/calendar/accounts/:id/subcalendars', PRE_GUARD_BASELINE],+ ['POST /api/calendar/debug/clear-token', PRE_GUARD_BASELINE],+ ['POST /api/calendar/google/auth/clear', PRE_GUARD_BASELINE],+ ['POST /api/calendar/google/auth/credentials', PRE_GUARD_BASELINE],+ ['POST /api/calendar/review/:date/confirm', PRE_GUARD_BASELINE],+ ['POST /api/calendar/sync/:accountId', PRE_GUARD_BASELINE],+ ['POST /api/calendar/sync/:accountId/api', PRE_GUARD_BASELINE],+ ['POST /api/calendar/sync/:accountId/discover-api', PRE_GUARD_BASELINE],+ ['POST /api/calendar/sync/:accountId/push', PRE_GUARD_BASELINE],+ // /api/catalog+ ['POST /api/catalog/bulk-import', PRE_GUARD_BASELINE],+ ['POST /api/catalog/embeddings/backfill', PRE_GUARD_BASELINE],+ ['POST /api/catalog/identity/:id/abort', HANDLER_GATED],+ ['POST /api/catalog/identity/:id/accept', HANDLER_GATED],+ ['POST /api/catalog/identity/:id/advance', HANDLER_GATED],+ ['POST /api/catalog/identity/:id/recover', HANDLER_GATED],+ ['POST /api/catalog/identity/create', HANDLER_GATED],+ ['POST /api/catalog/identity/import', HANDLER_GATED],+ ['POST /api/catalog/identity/preview', HANDLER_GATED],+ ['POST /api/catalog/import/music-videos', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredient-merges/:id/recover', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients', PRE_GUARD_BASELINE],+ ['DELETE /api/catalog/ingredients/:id', REMOVES_RECORD],+ ['PATCH /api/catalog/ingredients/:id', PRE_GUARD_BASELINE],+ ['DELETE /api/catalog/ingredients/:id/link', REMOVES_RECORD],+ ['POST /api/catalog/ingredients/:id/link', PRE_GUARD_BASELINE],+ ['DELETE /api/catalog/ingredients/:id/media', REMOVES_RECORD],+ ['POST /api/catalog/ingredients/:id/media', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/:id/media/from-mood-board', PRE_GUARD_BASELINE],+ ['PATCH /api/catalog/ingredients/:id/media/library', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/:id/media/portrait', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/:id/media/upload', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/:id/media/voice', PRE_GUARD_BASELINE],+ ['DELETE /api/catalog/ingredients/:id/relations', REMOVES_RECORD],+ ['POST /api/catalog/ingredients/:id/relations', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/:id/revisions/:revisionId/restore', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/:id/sheets/preview', PRE_GUARD_BASELINE],+ ['POST /api/catalog/ingredients/merge', PRE_GUARD_BASELINE],+ ['POST /api/catalog/migration/rerun', PRE_GUARD_BASELINE],+ ['POST /api/catalog/scraps', PRE_GUARD_BASELINE],+ ['DELETE /api/catalog/scraps/:id', REMOVES_RECORD],+ ['PATCH /api/catalog/scraps/:id', PRE_GUARD_BASELINE],+ ['POST /api/catalog/scraps/:id/commit', PRE_GUARD_BASELINE],+ ['POST /api/catalog/sync/apply', PRE_GUARD_BASELINE],+ ['POST /api/catalog/types', PRE_GUARD_BASELINE],+ ['DELETE /api/catalog/types/:id', REMOVES_RECORD],+ ['PATCH /api/catalog/types/:id', PRE_GUARD_BASELINE],+ // /api/character+ ['PUT /api/character', PRE_GUARD_BASELINE],+ ['POST /api/character/damage', PRE_GUARD_BASELINE],+ ['POST /api/character/event', PRE_GUARD_BASELINE],+ ['POST /api/character/reset', PRE_GUARD_BASELINE],+ ['POST /api/character/rest', PRE_GUARD_BASELINE],+ ['POST /api/character/sync/jira', PRE_GUARD_BASELINE],+ ['POST /api/character/sync/tasks', PRE_GUARD_BASELINE],+ ['POST /api/character/xp', PRE_GUARD_BASELINE],+ // /api/client-errors+ ['POST /api/client-errors', PRE_GUARD_BASELINE],+ // /api/code-animation+ ['POST /api/code-animation/:id/export', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/:id/soundtrack/track', PRE_GUARD_BASELINE],+ ['DELETE /api/code-animation/jobs/:id', REMOVES_RECORD],+ ['POST /api/code-animation/jobs/:id/poster', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/packages/validate', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/projects', PRE_GUARD_BASELINE],+ ['PATCH /api/code-animation/projects/:id', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/projects/:id/accept', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/projects/:id/accepted-output', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/projects/:id/import', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/projects/:id/sound-assets', PRE_GUARD_BASELINE],+ ['POST /api/code-animation/projects/:id/stage-runs/:runId/cancel', REDUCES_EXECUTION],+ ['POST /api/code-animation/prompt', PRE_GUARD_BASELINE],+ // /api/code-review+ ['POST /api/code-review/cli-outcome', RECORDS],+ ['POST /api/code-review/report-failure', PRE_GUARD_BASELINE],+ // /api/commands+ ['POST /api/commands/:id/stop', HANDLER_GATED],+ ['POST /api/commands/execute', HANDLER_GATED],+ ['POST /api/commands/processes/:name/action', HANDLER_GATED],+ // /api/conflict-journal+ ['DELETE /api/conflict-journal/:id', REMOVES_RECORD],+ ['POST /api/conflict-journal/:id/resolve', PRE_GUARD_BASELINE],+ // /api/contacts+ ['POST /api/contacts/enrich-tribe', PRE_GUARD_BASELINE],+ ['POST /api/contacts/import-to-tribe', PRE_GUARD_BASELINE],+ ['POST /api/contacts/sync', PRE_GUARD_BASELINE],+ // /api/continuous-video+ ['POST /api/continuous-video', PRE_GUARD_BASELINE],+ ['POST /api/continuous-video/lint', PRE_GUARD_BASELINE],+ // /api/cos+ ['DELETE /api/cos/agents/:id', REMOVES_RECORD],+ ['POST /api/cos/agents/:id/feedback', RECORDS],+ ['POST /api/cos/agents/:id/kill', REDUCES_EXECUTION],+ ['POST /api/cos/agents/:id/pause', REDUCES_EXECUTION],+ ['POST /api/cos/agents/:id/terminate', REDUCES_EXECUTION],+ ['DELETE /api/cos/agents/completed', REMOVES_RECORD],+ ['POST /api/cos/app-activity/:appId/clear-cooldown', PRE_GUARD_BASELINE],+ ['POST /api/cos/digest/generate', PRE_GUARD_BASELINE],+ ['POST /api/cos/health/check', PRE_GUARD_BASELINE],+ ['DELETE /api/cos/jobs/:id', REMOVES_RECORD],+ ['POST /api/cos/jobs/:id/gate-check', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/backfill', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/insights', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/recalculate-durations', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/recommendations/clear-dismissed', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/recommendations/dismiss', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/recommendations/restore', PRE_GUARD_BASELINE],+ ['POST /api/cos/learning/reset/:taskType', PRE_GUARD_BASELINE],+ ['DELETE /api/cos/mind/attachments/:attachmentId', REMOVES_RECORD],+ ['POST /api/cos/mind/bundle/export', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/bundle/preview', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/cleanup', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/events/:eventId/acknowledge', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/events/:eventId/promote', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/memories', PRE_GUARD_BASELINE],+ ['PUT /api/cos/mind/memories/:memoryId', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/pause', REDUCES_EXECUTION],+ ['POST /api/cos/mind/recipes/:recipeId/archive', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/recipes/validate', PRE_GUARD_BASELINE],+ ['POST /api/cos/mind/stop', REDUCES_EXECUTION],+ ['DELETE /api/cos/mind/thinking-request', REMOVES_RECORD],+ ['POST /api/cos/pause', REDUCES_EXECUTION],+ ['POST /api/cos/reports/generate', PRE_GUARD_BASELINE],+ ['PATCH /api/cos/schedule/maintenance-runs/:id/archive', PRE_GUARD_BASELINE],+ ['POST /api/cos/schedule/maintenance-runs/:id/stop', REDUCES_EXECUTION],+ ['DELETE /api/cos/schedule/on-demand/:requestId', REMOVES_RECORD],+ ['POST /api/cos/schedule/reset', PRE_GUARD_BASELINE],+ ['POST /api/cos/schedule/templates', PRE_GUARD_BASELINE],+ ['DELETE /api/cos/schedule/templates/:templateId', REMOVES_RECORD],+ ['POST /api/cos/stop', REDUCES_EXECUTION],+ ['DELETE /api/cos/tasks/:id', REMOVES_RECORD],+ ['POST /api/cos/tasks/:id/challenge', RECORDS],+ ['POST /api/cos/tasks/:id/challenge/resolve', RECORDS],+ ['POST /api/cos/tasks/reorder', RECORDS],+ ['POST /api/cos/templates', RECORDS],+ ['DELETE /api/cos/templates/:id', REMOVES_RECORD],+ ['PUT /api/cos/templates/:id', RECORDS],+ ['POST /api/cos/templates/:id/use', RECORDS],+ ['POST /api/cos/templates/from-task', RECORDS],+ // /api/creative-commission+ ['DELETE /api/creative-commission/:id', REMOVES_RECORD],+ // /api/creative-director+ ['DELETE /api/creative-director/:id', REMOVES_RECORD],+ ['POST /api/creative-director/:id/pause', REDUCES_EXECUTION],+ ['POST /api/creative-director/:id/stop', REDUCES_EXECUTION],+ ['POST /api/creative-director/auto-cast/suggest', RECORDS],+ // /api/daily-driver+ ['POST /api/daily-driver/handled', PRE_GUARD_BASELINE],+ // /api/dashboard/layouts+ ['DELETE /api/dashboard/layouts/:id', REMOVES_RECORD],+ ['PUT /api/dashboard/layouts/:id', PRE_GUARD_BASELINE],+ ['PUT /api/dashboard/layouts/active', PRE_GUARD_BASELINE],+ // /api/data+ ['DELETE /api/data/:category', REMOVES_RECORD],+ ['POST /api/data/:category/archive', PRE_GUARD_BASELINE],+ ['DELETE /api/data/backups/:filename', REMOVES_RECORD],+ ['POST /api/data/cos/storage/cancel', REDUCES_EXECUTION],+ ['PUT /api/data/cos/storage/pin', PRE_GUARD_BASELINE],+ ['PUT /api/data/cos/storage/policy', PRE_GUARD_BASELINE],+ ['POST /api/data/cos/storage/preview', PRE_GUARD_BASELINE],+ ['POST /api/data/cos/storage/run', PRE_GUARD_BASELINE],+ // /api/database+ ['POST /api/database/maintenance/preflight', PRE_GUARD_BASELINE],+ // /api/datadog+ ['DELETE /api/datadog/instances/:id', REMOVES_RECORD],+ ['POST /api/datadog/instances/:id/search-errors', PRE_GUARD_BASELINE],+ ['POST /api/datadog/instances/:id/test', PRE_GUARD_BASELINE],+ // /api/decks+ ['POST /api/decks', PRE_GUARD_BASELINE],+ ['DELETE /api/decks/:id', REMOVES_RECORD],+ ['PATCH /api/decks/:id', PRE_GUARD_BASELINE],+ ['PATCH /api/decks/:id/cards/:cardId', PRE_GUARD_BASELINE],+ ['POST /api/decks/:id/samples', PRE_GUARD_BASELINE],+ ['DELETE /api/decks/:id/samples/:sampleId', REMOVES_RECORD],+ // /api/detect+ ['POST /api/detect/ai', HANDLER_GATED],+ ['POST /api/detect/pm2', PRE_GUARD_BASELINE],+ ['POST /api/detect/port', PRE_GUARD_BASELINE],+ ['POST /api/detect/repo', PRE_GUARD_BASELINE],+ // /api/devtools/video-download+ ['POST /api/devtools/video-download/:jobId/cancel', REDUCES_EXECUTION],+ ['DELETE /api/devtools/video-download/downloads/:id', REMOVES_RECORD],+ // /api/digital-twin+ ['POST /api/digital-twin/documents', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/documents/:id', REMOVES_RECORD],+ ['PUT /api/digital-twin/documents/:id', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/enrich/save-list', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/export', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/feedback', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/feedback/recalculate', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/image', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/image/save', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/import/save', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/import/spotify/browser/open', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/personas/:id', REMOVES_RECORD],+ ['PUT /api/digital-twin/settings', HANDLER_GATED],+ ['POST /api/digital-twin/snapshots', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/snapshots/:id', REMOVES_RECORD],+ ['POST /api/digital-twin/snapshots/compare', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/taste/:section', REMOVES_RECORD],+ ['POST /api/digital-twin/taste/:section/personalized-question', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/taste/answer', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/taste/summary', PRE_GUARD_BASELINE],+ ['PUT /api/digital-twin/traits', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/twin-evidence/recompute', PRE_GUARD_BASELINE],+ // /api/digital-twin/autobiography+ ['PUT /api/digital-twin/autobiography/config', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/autobiography/stories', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/autobiography/stories/:id', REMOVES_RECORD],+ ['PUT /api/digital-twin/autobiography/stories/:id', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/autobiography/stories/:id/evaluate', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/autobiography/stories/:id/follow-ups', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/autobiography/stories/:id/weave', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/autobiography/trigger', PRE_GUARD_BASELINE],+ // /api/digital-twin/identity+ ['PUT /api/digital-twin/identity/chronotype', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/chronotype/derive', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/identity/goals/:id', REMOVES_RECORD],+ ['PUT /api/digital-twin/identity/goals/:id', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/accept-decomposition', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/accept-phases', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/activities', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/identity/goals/:id/activities/:activityName', REMOVES_RECORD],+ ['POST /api/digital-twin/identity/goals/:id/calendars', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/identity/goals/:id/calendars/:subcalendarId', REMOVES_RECORD],+ ['POST /api/digital-twin/identity/goals/:id/check-in', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/decompose', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/generate-phases', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/milestones', PRE_GUARD_BASELINE],+ ['PUT /api/digital-twin/identity/goals/:id/milestones/:milestoneId/complete', PRE_GUARD_BASELINE],+ ['PUT /api/digital-twin/identity/goals/:id/milestones/:milestoneId/tasks/:taskId/complete', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/progress', PRE_GUARD_BASELINE],+ ['PUT /api/digital-twin/identity/goals/:id/progress', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/identity/goals/:id/progress/:entryId', REMOVES_RECORD],+ ['POST /api/digital-twin/identity/goals/:id/reschedule', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/identity/goals/:id/schedule', REMOVES_RECORD],+ ['POST /api/digital-twin/identity/goals/:id/schedule', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/:id/todos', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/identity/goals/:id/todos/:todoId', REMOVES_RECORD],+ ['PUT /api/digital-twin/identity/goals/:id/todos/:todoId', PRE_GUARD_BASELINE],+ ['PUT /api/digital-twin/identity/goals/birth-date', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/organize', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/goals/organize/apply', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/identity/longevity/derive', PRE_GUARD_BASELINE],+ // /api/digital-twin/social-accounts+ ['POST /api/digital-twin/social-accounts', PRE_GUARD_BASELINE],+ ['DELETE /api/digital-twin/social-accounts/:id', REMOVES_RECORD],+ ['PUT /api/digital-twin/social-accounts/:id', PRE_GUARD_BASELINE],+ ['POST /api/digital-twin/social-accounts/bulk', PRE_GUARD_BASELINE],+ // /api/eidoverse/travel+ ['POST /api/eidoverse/travel/depart', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/travel/federation/chat', PEER_SURFACE],+ ['POST /api/eidoverse/travel/federation/leave', PEER_SURFACE],+ ['POST /api/eidoverse/travel/federation/visit', PEER_SURFACE],+ // /api/eidoverse/world+ ['POST /api/eidoverse/world/augment', PRE_GUARD_BASELINE],+ ['PUT /api/eidoverse/world/config', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/controllers', PRE_GUARD_BASELINE],+ ['DELETE /api/eidoverse/world/controllers/:id', REMOVES_RECORD],+ ['PATCH /api/eidoverse/world/controllers/:id', PRE_GUARD_BASELINE],+ ['PATCH /api/eidoverse/world/controllers/:id/config', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/foundations', PRE_GUARD_BASELINE],+ ['DELETE /api/eidoverse/world/foundations/:id', REMOVES_RECORD],+ ['POST /api/eidoverse/world/foundations/:id/adopt', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/foundations/:id/candidate', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/foundations/:id/promote', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/foundations/:id/withdraw', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/presence', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/project', PRE_GUARD_BASELINE],+ ['POST /api/eidoverse/world/say', PRE_GUARD_BASELINE],+ // /api/fableloom+ ['POST /api/fableloom', PRE_GUARD_BASELINE],+ ['DELETE /api/fableloom/:id', REMOVES_RECORD],+ ['PATCH /api/fableloom/:id', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/editorial/autopilot/:runId/cancel', REDUCES_EXECUTION],+ ['POST /api/fableloom/:id/episodes', PRE_GUARD_BASELINE],+ ['DELETE /api/fableloom/:id/episodes/:episodeId', REMOVES_RECORD],+ ['PATCH /api/fableloom/:id/episodes/:episodeId', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/continuity/review', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/nodes', PRE_GUARD_BASELINE],+ ['DELETE /api/fableloom/:id/episodes/:episodeId/nodes/:nodeId', REMOVES_RECORD],+ ['PATCH /api/fableloom/:id/episodes/:episodeId/nodes/:nodeId', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/nodes/:nodeId/fal-video', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/nodes/:nodeId/transitions', PRE_GUARD_BASELINE],+ ['DELETE /api/fableloom/:id/episodes/:episodeId/nodes/:nodeId/transitions/:transitionId', REMOVES_RECORD],+ ['PATCH /api/fableloom/:id/episodes/:episodeId/nodes/:nodeId/transitions/:transitionId', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/outline/validate', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/production/batch/:runId/cancel', REDUCES_EXECUTION],+ ['POST /api/fableloom/:id/episodes/:episodeId/production/plan', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/sessions/host', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/sessions/preflight', PRE_GUARD_BASELINE],+ ['POST /api/fableloom/:id/episodes/:episodeId/shots/apply', PRE_GUARD_BASELINE],+ ['DELETE /api/fableloom/sessions/:sessionId', REMOVES_RECORD],+ ['PATCH /api/fableloom/sessions/:sessionId', PRE_GUARD_BASELINE],+ // /api/feature-agents+ ['DELETE /api/feature-agents/:id', REMOVES_RECORD],+ ['POST /api/feature-agents/:id/pause', REDUCES_EXECUTION],+ ['POST /api/feature-agents/:id/stop', REDUCES_EXECUTION],+ // /api/federation/admin/v1+ ['POST /api/federation/admin/v1/execute', PEER_SURFACE],+ ['POST /api/federation/admin/v1/execution/dispatch', PEER_SURFACE],+ ['POST /api/federation/admin/v1/execution/preflight', PEER_SURFACE],+ ['POST /api/federation/admin/v1/execution/status', PEER_SURFACE],+ ['POST /api/federation/admin/v1/plans', PEER_SURFACE],+ ['POST /api/federation/admin/v1/preflight', PEER_SURFACE],+ ['POST /api/federation/admin/v1/receipt', PEER_SURFACE],+ // /api/federation/media/v1+ ['POST /api/federation/media/v1/assets', PEER_SURFACE],+ ['POST /api/federation/media/v1/jobs', PEER_SURFACE],+ ['POST /api/federation/media/v1/jobs/:id/cancel', PEER_SURFACE],+ // /api/feeds+ ['POST /api/feeds', PRE_GUARD_BASELINE],+ ['DELETE /api/feeds/:id', REMOVES_RECORD],+ ['POST /api/feeds/:id/refresh', PRE_GUARD_BASELINE],+ ['POST /api/feeds/items/:id/read', PRE_GUARD_BASELINE],+ ['POST /api/feeds/items/read-all', PRE_GUARD_BASELINE],+ ['POST /api/feeds/refresh-all', PRE_GUARD_BASELINE],+ // /api/games+ ['POST /api/games', PRE_GUARD_BASELINE],+ ['DELETE /api/games/:id', REMOVES_RECORD],+ ['PATCH /api/games/:id', PRE_GUARD_BASELINE],+ ['POST /api/games/:id/artwork', PRE_GUARD_BASELINE],+ ['DELETE /api/games/:id/artwork/:bindingId', REMOVES_RECORD],+ ['PATCH /api/games/:id/artwork/:bindingId', PRE_GUARD_BASELINE],+ ['POST /api/games/:id/artwork/:bindingId/publish', PRE_GUARD_BASELINE],+ ['POST /api/games/:id/compile', PRE_GUARD_BASELINE],+ ['POST /api/games/:id/music', PRE_GUARD_BASELINE],+ ['DELETE /api/games/:id/music/:bindingId', REMOVES_RECORD],+ ['PATCH /api/games/:id/music/:bindingId', PRE_GUARD_BASELINE],+ ['POST /api/games/:id/music/:bindingId/publish', PRE_GUARD_BASELINE],+ ['POST /api/games/:id/sprites', PRE_GUARD_BASELINE],+ ['DELETE /api/games/:id/sprites/:spriteId', REMOVES_RECORD],+ // /api/github+ ['DELETE /api/github/accounts/:id', REMOVES_RECORD],+ ['POST /api/github/audit/:accountId', READ_ONLY_EXTERNAL],+ ['DELETE /api/github/automations/rules/:id', REMOVES_RECORD],+ ['POST /api/github/notifications/sync', HANDLER_GATED],+ ['POST /api/github/repos/sync', READ_ONLY_EXTERNAL],+ // /api/harnesses+ ['POST /api/harnesses/models/refresh', CONFIGURED_INFERENCE],+ // /api/health+ ['POST /api/health/import/xml', PRE_GUARD_BASELINE],+ ['POST /api/health/ingest', PRE_GUARD_BASELINE],+ // /api/history+ ['DELETE /api/history', REMOVES_RECORD],+ ['DELETE /api/history/:id', REMOVES_RECORD],+ // /api/html-composition+ ['POST /api/html-composition/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/html-composition/render', PRE_GUARD_BASELINE],+ // /api/human-actions+ ['POST /api/human-actions/plans', PRE_GUARD_BASELINE],+ // /api/image-clean+ ['POST /api/image-clean', PRE_GUARD_BASELINE],+ ['POST /api/image-clean/result/:jobId/save', PRE_GUARD_BASELINE],+ // /api/image-gen+ ['DELETE /api/image-gen/:filename', REMOVES_RECORD],+ ['POST /api/image-gen/:filename/clean', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/:filename/film-look', PRE_GUARD_BASELINE],+ ['PATCH /api/image-gen/:filename/prompt', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/:filename/regenerate', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/:filename/remove-watermark', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/:filename/visibility', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/cancel', REDUCES_EXECUTION],+ ['POST /api/image-gen/gallery/lookup', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/models/:modelId/download', MODEL_DATA],+ ['POST /api/image-gen/models/:modelId/repair', MODEL_DATA],+ ['POST /api/image-gen/models/verify', MODEL_DATA],+ ['POST /api/image-gen/prompt-preview', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/setup/create-venv', HANDLER_GATED],+ ['POST /api/image-gen/setup/flux2-install', MANAGED_INSTALL],+ ['DELETE /api/image-gen/setup/hf-token', REMOVES_RECORD],+ ['POST /api/image-gen/setup/hf-token', PRE_GUARD_BASELINE],+ ['POST /api/image-gen/setup/install', HANDLER_GATED],+ ['POST /api/image-gen/setup/moss-install', HANDLER_GATED],+ ['POST /api/image-gen/setup/moss-weights', HANDLER_GATED],+ ['POST /api/image-gen/upload', PRE_GUARD_BASELINE],+ // /api/image-to-3d+ ['DELETE /api/image-to-3d/models/:id', REMOVES_RECORD],+ ['POST /api/image-to-3d/models/:id/usdz', PRE_GUARD_BASELINE],+ // /api/image-video/models+ ['DELETE /api/image-video/models/custom/:id', REMOVES_RECORD],+ ['PATCH /api/image-video/models/custom/:id', PRE_GUARD_BASELINE],+ ['DELETE /api/image-video/models/hf/:dirName', REMOVES_RECORD],+ ['POST /api/image-video/models/install/huggingface', MODEL_DATA],+ ['DELETE /api/image-video/models/lora/:filename', REMOVES_RECORD],+ ['PATCH /api/image-video/models/registry/:id/availability', PRE_GUARD_BASELINE],+ ['DELETE /api/image-video/models/store/:backend/:key', REMOVES_RECORD],+ // /api/imessage+ ['POST /api/imessage/blocklist', PRE_GUARD_BASELINE],+ ['PUT /api/imessage/blocklist', PRE_GUARD_BASELINE],+ ['DELETE /api/imessage/blocklist/:handle', REMOVES_RECORD],+ ['DELETE /api/imessage/conversations/:chatKey', REMOVES_RECORD],+ ['DELETE /api/imessage/events/:id', REMOVES_RECORD],+ ['POST /api/imessage/sync', PRE_GUARD_BASELINE],+ // /api/insights+ ['POST /api/insights/goal-scorecard/compute', PRE_GUARD_BASELINE],+ ['PUT /api/insights/goal-scorecard/rules', PRE_GUARD_BASELINE],+ ['PUT /api/insights/goal-scorecard/settings', PRE_GUARD_BASELINE],+ ['POST /api/insights/narrative/refresh', PRE_GUARD_BASELINE],+ ['POST /api/insights/themes/refresh', PRE_GUARD_BASELINE],+ // /api/instances+ ['POST /api/instances/peers', PRE_GUARD_BASELINE],+ ['DELETE /api/instances/peers/:id', REMOVES_RECORD],+ ['PUT /api/instances/peers/:id', PRE_GUARD_BASELINE],+ ['POST /api/instances/peers/:id/connect', PRE_GUARD_BASELINE],+ ['POST /api/instances/peers/:id/pair-secret', PRE_GUARD_BASELINE],+ ['POST /api/instances/peers/:id/probe', PRE_GUARD_BASELINE],+ ['POST /api/instances/peers/:id/reciprocate', PRE_GUARD_BASELINE],+ ['POST /api/instances/peers/:id/sync', PRE_GUARD_BASELINE],+ ['POST /api/instances/peers/announce', PEER_SURFACE],+ ['POST /api/instances/peers/pair-secret', PEER_SURFACE],+ ['POST /api/instances/peers/sync-categories', PEER_SURFACE],+ ['DELETE /api/instances/peers/tailcat/forwards/:id', REMOVES_RECORD],+ ['DELETE /api/instances/peers/tailcat/serve', REMOVES_RECORD],+ ['PUT /api/instances/self', PRE_GUARD_BASELINE],+ // /api/jira+ ['DELETE /api/jira/instances/:id', REMOVES_RECORD],+ ['POST /api/jira/instances/:id/test', PRE_GUARD_BASELINE],+ ['POST /api/jira/reports/generate', PRE_GUARD_BASELINE],+ // /api/legacy-export+ ['POST /api/legacy-export', PRE_GUARD_BASELINE],+ // /api/lmstudio+ ['POST /api/lmstudio/analyze-task', PRE_GUARD_BASELINE],+ ['POST /api/lmstudio/classify-memory', PRE_GUARD_BASELINE],+ ['POST /api/lmstudio/completion', PRE_GUARD_BASELINE],+ ['POST /api/lmstudio/download', MODEL_DATA],+ ['POST /api/lmstudio/embeddings', PRE_GUARD_BASELINE],+ ['POST /api/lmstudio/load', PRE_GUARD_BASELINE],+ ['POST /api/lmstudio/unload', REDUCES_EXECUTION],+ // /api/local-llm+ ['POST /api/local-llm/assessments/delete', MODEL_DATA],+ ['POST /api/local-llm/assessments/run', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/assessments/sweep', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/assessments/sweep/cancel', REDUCES_EXECUTION],+ ['POST /api/local-llm/capability-tests/delete', MODEL_DATA],+ ['POST /api/local-llm/compare', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/delete', MODEL_DATA],+ ['POST /api/local-llm/download-preflight', MODEL_DATA],+ ['POST /api/local-llm/install', MODEL_DATA],+ ['POST /api/local-llm/jev/install/cancel', REDUCES_EXECUTION],+ ['POST /api/local-llm/jev/score', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/jev/unload', REDUCES_EXECUTION],+ ['POST /api/local-llm/laya-mlx/score', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/llama-server/download-model', MODEL_DATA],+ ['POST /api/local-llm/llama-server/download-model/cancel', REDUCES_EXECUTION],+ ['POST /api/local-llm/llama-server/download-model/remove', MODEL_DATA],+ ['POST /api/local-llm/migrate', MODEL_DATA],+ ['POST /api/local-llm/mtplx/models/pull', MODEL_DATA],+ ['POST /api/local-llm/mtplx/models/remove', MODEL_DATA],+ ['POST /api/local-llm/security-guard/install/cancel', REDUCES_EXECUTION],+ ['POST /api/local-llm/slotstream/models/download', MODEL_DATA],+ ['POST /api/local-llm/slotstream/models/download/cancel', REDUCES_EXECUTION],+ ['POST /api/local-llm/switch', MODEL_DATA],+ ['POST /api/local-llm/test', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/test/stream', CONFIGURED_INFERENCE],+ ['POST /api/local-llm/unload', REDUCES_EXECUTION],+ // /api/loops+ ['DELETE /api/loops/:id', REMOVES_RECORD],+ ['POST /api/loops/:id/stop', REDUCES_EXECUTION],+ // /api/lora-datasets+ ['POST /api/lora-datasets', PRE_GUARD_BASELINE],+ ['DELETE /api/lora-datasets/:id', REMOVES_RECORD],+ ['PATCH /api/lora-datasets/:id', PRE_GUARD_BASELINE],+ ['POST /api/lora-datasets/:id/caption-runs/:runId/cancel', REDUCES_EXECUTION],+ ['POST /api/lora-datasets/:id/images', PRE_GUARD_BASELINE],+ ['DELETE /api/lora-datasets/:id/images/:imageId', REMOVES_RECORD],+ ['PATCH /api/lora-datasets/:id/images/:imageId', PRE_GUARD_BASELINE],+ ['POST /api/lora-datasets/:id/import-gallery', PRE_GUARD_BASELINE],+ ['POST /api/lora-datasets/:id/strip-shared-fragments', PRE_GUARD_BASELINE],+ // /api/lora-training+ ['DELETE /api/lora-training/runs/:id', REMOVES_RECORD],+ ['POST /api/lora-training/runs/:id/cancel', REDUCES_EXECUTION],+ ['POST /api/lora-training/runs/:id/promote-checkpoint', PRE_GUARD_BASELINE],+ // /api/loras+ ['DELETE /api/loras/:filename', REMOVES_RECORD],+ ['PATCH /api/loras/:filename', PRE_GUARD_BASELINE],+ ['DELETE /api/loras/auth/civitai', REMOVES_RECORD],+ ['POST /api/loras/auth/civitai', PRE_GUARD_BASELINE],+ ['POST /api/loras/install', MODEL_DATA],+ ['POST /api/loras/install/huggingface', MODEL_DATA],+ ['POST /api/loras/install/huggingface/stream', MODEL_DATA],+ ['POST /api/loras/install/preflight', MODEL_DATA],+ // /api/managed-visitor-admin+ ['DELETE /api/managed-visitor-admin/:appId/credential', REMOVES_RECORD],+ ['POST /api/managed-visitor-admin/:appId/credential', PRE_GUARD_BASELINE],+ ['POST /api/managed-visitor-admin/admissions', PRE_GUARD_BASELINE],+ ['POST /api/managed-visitor-admin/admissions/cancel', REDUCES_EXECUTION],+ ['POST /api/managed-visitor-admin/sessions/:id/actions', PRE_GUARD_BASELINE],+ ['POST /api/managed-visitor-admin/sessions/:id/leave', REDUCES_EXECUTION],+ ['POST /api/managed-visitor-admin/sessions/:id/observations', PRE_GUARD_BASELINE],+ // /api/managed-visitors/v1+ ['DELETE /api/managed-visitors/v1/:appId/credential', REMOVES_RECORD],+ ['POST /api/managed-visitors/v1/:appId/credential', PRE_GUARD_BASELINE],+ ['POST /api/managed-visitors/v1/admissions', PRE_GUARD_BASELINE],+ ['POST /api/managed-visitors/v1/admissions/cancel', REDUCES_EXECUTION],+ ['POST /api/managed-visitors/v1/sessions/:id/actions', PRE_GUARD_BASELINE],+ ['POST /api/managed-visitors/v1/sessions/:id/leave', REDUCES_EXECUTION],+ ['POST /api/managed-visitors/v1/sessions/:id/observations', PRE_GUARD_BASELINE],+ // /api/meatspace+ ['POST /api/meatspace/activities', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/activities/:index', REMOVES_RECORD],+ ['PUT /api/meatspace/activities/:index', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/alcohol/custom-drinks', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/alcohol/custom-drinks/:index', REMOVES_RECORD],+ ['PUT /api/meatspace/alcohol/custom-drinks/:index', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/alcohol/log', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/alcohol/log/:date/:index', REMOVES_RECORD],+ ['PUT /api/meatspace/alcohol/log/:date/:index', PRE_GUARD_BASELINE],+ ['PUT /api/meatspace/birth-date', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/blood', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/blood-pressure', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/body', PRE_GUARD_BASELINE],+ ['PUT /api/meatspace/config', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/epigenetic', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/eyes', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/eyes/:id', REMOVES_RECORD],+ ['PUT /api/meatspace/eyes/:id', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/life-events', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/life-events/:id', REMOVES_RECORD],+ ['PUT /api/meatspace/life-events/:id', PRE_GUARD_BASELINE],+ ['PUT /api/meatspace/lifestyle', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/nicotine/custom-products', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/nicotine/custom-products/:index', REMOVES_RECORD],+ ['PUT /api/meatspace/nicotine/custom-products/:index', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/nicotine/log', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/nicotine/log/:date/:index', REMOVES_RECORD],+ ['PUT /api/meatspace/nicotine/log/:date/:index', PRE_GUARD_BASELINE],+ ['PUT /api/meatspace/post/config', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/memory-drill', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/memory-items', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/post/memory-items/:id', REMOVES_RECORD],+ ['PUT /api/meatspace/post/memory-items/:id', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/memory-items/:id/attest-mastery', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/memory-items/:id/practice', PRE_GUARD_BASELINE],+ ['PUT /api/meatspace/post/morse/level', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/morse/rounds', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/sessions', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/training', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/post/training/runs', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/workouts', PRE_GUARD_BASELINE],+ // /api/meatspace/genome+ ['DELETE /api/meatspace/genome', REMOVES_RECORD],+ ['DELETE /api/meatspace/genome/clinvar', REMOVES_RECORD],+ ['POST /api/meatspace/genome/clinvar/scan', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/clinvar/sync', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/epigenetic', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/genome/epigenetic/:id', REMOVES_RECORD],+ ['PUT /api/meatspace/genome/epigenetic/:id', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/epigenetic/:id/log', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/markers', PRE_GUARD_BASELINE],+ ['DELETE /api/meatspace/genome/markers/:id', REMOVES_RECORD],+ ['PUT /api/meatspace/genome/markers/:id/notes', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/scan', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/search', PRE_GUARD_BASELINE],+ ['POST /api/meatspace/genome/upload', PRE_GUARD_BASELINE],+ // /api/media+ ['POST /api/media/stop', REDUCES_EXECUTION],+ // /api/media-jobs+ ['DELETE /api/media-jobs/:id', REMOVES_RECORD],+ ['POST /api/media-jobs/:id/cancel', REDUCES_EXECUTION],+ ['POST /api/media-jobs/cancel-queued', REDUCES_EXECUTION],+ ['POST /api/media-jobs/holds/:holdId/resume', PRE_GUARD_BASELINE],+ // /api/media/annotations+ ['PATCH /api/media/annotations/:key', PRE_GUARD_BASELINE],+ // /api/media/collections+ ['POST /api/media/collections', PRE_GUARD_BASELINE],+ ['DELETE /api/media/collections/:id', REMOVES_RECORD],+ ['PATCH /api/media/collections/:id', PRE_GUARD_BASELINE],+ ['POST /api/media/collections/:id/items', PRE_GUARD_BASELINE],+ ['DELETE /api/media/collections/:id/items/:key', REMOVES_RECORD],+ ['POST /api/media/collections/:id/items/bulk', PRE_GUARD_BASELINE],+ ['POST /api/media/collections/:id/localize', PRE_GUARD_BASELINE],+ // /api/media/sketches+ ['POST /api/media/sketches', PRE_GUARD_BASELINE],+ ['PUT /api/media/sketches/:key', PRE_GUARD_BASELINE],+ // /api/memory+ ['POST /api/memory', PRE_GUARD_BASELINE],+ ['DELETE /api/memory/:id', REMOVES_RECORD],+ ['PUT /api/memory/:id', PRE_GUARD_BASELINE],+ ['POST /api/memory/:id/approve', PRE_GUARD_BASELINE],+ ['POST /api/memory/:id/reject', PRE_GUARD_BASELINE],+ ['POST /api/memory/consolidate', PRE_GUARD_BASELINE],+ ['POST /api/memory/decay', PRE_GUARD_BASELINE],+ ['DELETE /api/memory/expired', REMOVES_RECORD],+ ['POST /api/memory/link', PRE_GUARD_BASELINE],+ ['POST /api/memory/search', PRE_GUARD_BASELINE],+ ['POST /api/memory/sync', PRE_GUARD_BASELINE],+ // /api/messages+ ['POST /api/messages/:accountId/:messageId/refresh', PRE_GUARD_BASELINE],+ ['POST /api/messages/accounts', PRE_GUARD_BASELINE],+ ['DELETE /api/messages/accounts/:id', REMOVES_RECORD],+ ['PUT /api/messages/accounts/:id', PRE_GUARD_BASELINE],+ ['POST /api/messages/accounts/:id/cache/clear', PRE_GUARD_BASELINE],+ ['POST /api/messages/debug/clear-token', PRE_GUARD_BASELINE],+ ['POST /api/messages/drafts', PRE_GUARD_BASELINE],+ ['DELETE /api/messages/drafts/:id', REMOVES_RECORD],+ ['PUT /api/messages/drafts/:id', PRE_GUARD_BASELINE],+ ['POST /api/messages/drafts/:id/approve', PRE_GUARD_BASELINE],+ ['POST /api/messages/drafts/:id/reconcile', PRE_GUARD_BASELINE],+ ['POST /api/messages/drafts/generate', PRE_GUARD_BASELINE],+ ['POST /api/messages/evaluate', PRE_GUARD_BASELINE],+ ['POST /api/messages/fetch-full/:accountId', PRE_GUARD_BASELINE],+ ['POST /api/messages/sync/:accountId', PRE_GUARD_BASELINE],+ ['DELETE /api/messages/triage-rules/:index', REMOVES_RECORD],+ // /api/model-personality+ ['DELETE /api/model-personality/history/:runId', REMOVES_RECORD],+ ['PUT /api/model-personality/settings', PRE_GUARD_BASELINE],+ // /api/models/performance/task-benchmark+ ['POST /api/models/performance/task-benchmark/discover', PRE_GUARD_BASELINE],+ ['POST /api/models/performance/task-benchmark/run', PRE_GUARD_BASELINE],+ // /api/mood-boards+ ['POST /api/mood-boards', PRE_GUARD_BASELINE],+ ['DELETE /api/mood-boards/:id', REMOVES_RECORD],+ ['PATCH /api/mood-boards/:id', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/backfill-prompts', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/collage', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/items', PRE_GUARD_BASELINE],+ ['DELETE /api/mood-boards/:id/items/:itemId', REMOVES_RECORD],+ ['PATCH /api/mood-boards/:id/items/:itemId', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/items/:itemId/extract-frames', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/items/:itemId/render', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/localize-media', PRE_GUARD_BASELINE],+ ['DELETE /api/mood-boards/:id/pinterest', REMOVES_RECORD],+ ['PUT /api/mood-boards/:id/pinterest', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/pinterest/import', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/pinterest/sync', PRE_GUARD_BASELINE],+ ['POST /api/mood-boards/:id/x-post', PRE_GUARD_BASELINE],+ // /api/mortalloom+ ['POST /api/mortalloom/import', PRE_GUARD_BASELINE],+ // /api/music+ ['POST /api/music/code/preview', PRE_GUARD_BASELINE],+ ['POST /api/music/models', PRE_GUARD_BASELINE],+ ['DELETE /api/music/models/:engine/*id', REMOVES_RECORD],+ ['POST /api/music/prompt-preview', PRE_GUARD_BASELINE],+ // /api/music-video+ ['POST /api/music-video', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id', REMOVES_RECORD],+ ['PATCH /api/music-video/:id', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/analyze', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/analyze/manual', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/audio-timing/apply', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/audio-timing/preview', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/auto-reviews/:runId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/auto-reviews/:runId/stop', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/autonomous/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/autonomous/stop', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/cast-and-sets/approve', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/cast-and-sets/feedback/:feedbackId', REMOVES_RECORD],+ ['POST /api/music-video/:id/cast-and-sets/reconfirm', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/cast-and-sets/skip', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/clone', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/composition/document', REMOVES_RECORD],+ ['POST /api/music-video/:id/composition/document/accept', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/composition/document/candidate', REMOVES_RECORD],+ ['POST /api/music-video/:id/composition/document/engine/upgrade', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/composition/document/template', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/composition/document/zip', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/dependency-repairs', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/dev-artifacts', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/dev-artifacts/:artifactId', REMOVES_RECORD],+ ['POST /api/music-video/:id/dev-artifacts/:artifactId/notes', PRE_GUARD_BASELINE],+ ['PATCH /api/music-video/:id/dev-artifacts/:artifactId/notes/:noteId', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/dev-artifacts/:artifactId/review', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/excerpt/:excerptId', REMOVES_RECORD],+ ['POST /api/music-video/:id/excerpt/:excerptId/notes', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/excerpt/:excerptId/notes/:noteId', REMOVES_RECORD],+ ['PATCH /api/music-video/:id/excerpt/:excerptId/notes/:noteId', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/excerpt/:excerptId/revisions', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/film-looks/:lookId', REMOVES_RECORD],+ ['PUT /api/music-video/:id/finished-outside', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/handoff/import', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/lyrics/import', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/lyrics/import-track', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/media-pool/add', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/media-pool/delete', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/media-pool/import', PRE_GUARD_BASELINE],+ ['PATCH /api/music-video/:id/media-pool/marks', PRE_GUARD_BASELINE],+ ['PUT /api/music-video/:id/production-review', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/alignment', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/approve', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/document-shots', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/feedback', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/feedback/resolve', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/import', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/lyric-anchors', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/prepare', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/proof', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/revert', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/shots', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-review/shots/:shotId/bind', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/production-review/stale-rows', REMOVES_RECORD],+ ['POST /api/music-video/:id/production-review/text-check', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/production-runs/:runId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/production-runs/:runId/stop', REDUCES_EXECUTION],+ ['PATCH /api/music-video/:id/publish-kit/copy', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/publish-kit/cover-art', PRE_GUARD_BASELINE],+ ['PUT /api/music-video/:id/publish-kit/cover-art/design', PRE_GUARD_BASELINE],+ ['PUT /api/music-video/:id/publish-kit/thumbnail', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/publish-kit/youtube-thumbnail', REMOVES_RECORD],+ ['POST /api/music-video/:id/publish-kit/youtube-thumbnail', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/publish-kit/youtube-thumbnail/paint', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/publish-kit/youtube-thumbnail/paint/preview', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/publish-kit/youtube-thumbnail/tests', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/publish-kit/youtube-thumbnail/tests/:filename', REMOVES_RECORD],+ ['POST /api/music-video/:id/publish/:target/cross-links', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/publish/:target/prepare', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/publish/:target/preview', PRE_GUARD_BASELINE],+ ['PUT /api/music-video/:id/publish/cross-links', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/publish/drafts/:draftId', REMOVES_RECORD],+ ['DELETE /api/music-video/:id/publish/posts/:target', REMOVES_RECORD],+ ['PUT /api/music-video/:id/publish/posts/:target', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/render-cleanup', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/revisions/:revisionId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/revisions/:revisionId/release', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/revisions/:revisionId/resume', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/scenes/:sceneId', REMOVES_RECORD],+ ['PATCH /api/music-video/:id/scenes/:sceneId', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/continue-from-previous', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/merge-next', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/merge-previous', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/performance-repair', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/split', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/start', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/swap-frames', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/takes', PRE_GUARD_BASELINE],+ ['PATCH /api/music-video/:id/scenes/:sceneId/takes/:takeId', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/takes/:takeId/select', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/takes/reject-unused', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/:sceneId/takes/use', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/scenes/reorder', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/sharing-copy', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/shots/:sceneId/render/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/song-revision', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/song-revision/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/:id/song-revision/generate', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/song-revision/select', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/song-revision/track', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/song-style/suno', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/song/prepare', PRE_GUARD_BASELINE],+ ['PATCH /api/music-video/:id/treatment', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/treatment/apply', PRE_GUARD_BASELINE],+ ['POST /api/music-video/:id/treatment/proofs/:proofId/review', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/:id/vocal-stem', REMOVES_RECORD],+ ['POST /api/music-video/:id/vocal-stem', PRE_GUARD_BASELINE],+ ['POST /api/music-video/excerpt/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/lyrics/align/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/making-of/export', PRE_GUARD_BASELINE],+ ['POST /api/music-video/making-of/preview', PRE_GUARD_BASELINE],+ ['POST /api/music-video/publish-kit/:jobId/cancel', REDUCES_EXECUTION],+ ['DELETE /api/music-video/publish/artist-styles', REMOVES_RECORD],+ ['PUT /api/music-video/publish/artist-styles', PRE_GUARD_BASELINE],+ ['DELETE /api/music-video/publish/cover-fonts/:fontId', REMOVES_RECORD],+ ['PUT /api/music-video/publish/platforms', PRE_GUARD_BASELINE],+ ['POST /api/music-video/render/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/transcribe-midi/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/music-video/vocal-stem/separate/:jobId/cancel', REDUCES_EXECUTION],+ // /api/music-video/character-styles+ ['PUT /api/music-video/character-styles/:id/reference', PRE_GUARD_BASELINE],+ // /api/music/supercollider+ ['POST /api/music/supercollider/render', PRE_GUARD_BASELINE],+ ['POST /api/music/supercollider/renders/:jobId/cancel', REDUCES_EXECUTION],+ // /api/notes+ ['DELETE /api/notes/vaults/:id', REMOVES_RECORD],+ ['DELETE /api/notes/vaults/:id/note', REMOVES_RECORD],+ ['POST /api/notes/vaults/:id/note', RECORDS],+ ['PUT /api/notes/vaults/:id/note', RECORDS],+ // /api/notifications+ ['DELETE /api/notifications', REMOVES_RECORD],+ ['DELETE /api/notifications/:id', REMOVES_RECORD],+ ['POST /api/notifications/:id/read', PRE_GUARD_BASELINE],+ ['POST /api/notifications/read-all', PRE_GUARD_BASELINE],+ // /api/palette+ ['POST /api/palette/action/:id', HANDLER_GATED],+ // /api/peer-administration+ ['PUT /api/peer-administration/catalog-review', HANDLER_GATED],+ ['POST /api/peer-administration/execution-dispatch', HANDLER_GATED],+ ['POST /api/peer-administration/execution-grants', HANDLER_GATED],+ ['POST /api/peer-administration/execution-preview', HANDLER_GATED],+ ['POST /api/peer-administration/execution-status', HANDLER_GATED],+ ['POST /api/peer-administration/grants', HANDLER_GATED],+ ['POST /api/peer-administration/preview', HANDLER_GATED],+ // /api/peer-sync+ ['POST /api/peer-sync/pull-metadata', PRE_GUARD_BASELINE],+ ['POST /api/peer-sync/pull-record', PRE_GUARD_BASELINE],+ ['POST /api/peer-sync/push', PEER_SURFACE],+ ['POST /api/peer-sync/subscriptions', PRE_GUARD_BASELINE],+ ['DELETE /api/peer-sync/subscriptions/:id', REMOVES_RECORD],+ ['POST /api/peer-sync/sync-now', PRE_GUARD_BASELINE],+ ['POST /api/peer-sync/sync-record', PRE_GUARD_BASELINE],+ // /api/pipeline+ ['DELETE /api/pipeline/audio/music-library/:filename', REMOVES_RECORD],+ ['PATCH /api/pipeline/editorial/checks/:id', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/editorial/custom-checks', PRE_GUARD_BASELINE],+ ['DELETE /api/pipeline/editorial/custom-checks/:id', REMOVES_RECORD],+ ['PATCH /api/pipeline/editorial/custom-checks/:id', PRE_GUARD_BASELINE],+ ['PATCH /api/pipeline/editorial/readiness-gate', PRE_GUARD_BASELINE],+ ['DELETE /api/pipeline/issues/:id', REMOVES_RECORD],+ ['PATCH /api/pipeline/issues/:id', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/auto-run-text/cancel', REDUCES_EXECUTION],+ ['DELETE /api/pipeline/issues/:id/pov-rewrites/:rewriteId', REMOVES_RECORD],+ ['POST /api/pipeline/issues/:id/stages/:stageId/recover', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/stages/:stageId/restore', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/stages/audio/cues/:cueIdx/render', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/issues/:id/stages/audio/extract-lines', PIPELINE_DETERMINISTIC],+ ['PATCH /api/pipeline/issues/:id/stages/audio/lines/:lineIdx', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/stages/audio/lines/:lineIdx/render', PIPELINE_DETERMINISTIC],+ ['DELETE /api/pipeline/issues/:id/stages/audio/music', REMOVES_RECORD],+ ['POST /api/pipeline/issues/:id/stages/audio/music/attach', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/stages/audio/music/generate', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/issues/:id/stages/audio/music/upload', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/stages/comicPages/extract-pages', PIPELINE_DETERMINISTIC],+ ['PATCH /api/pipeline/issues/:id/stages/comicPages/pages/:pageIndex', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/issues/:id/stages/storyboards/scenes/:index/video', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/series', PRE_GUARD_BASELINE],+ ['DELETE /api/pipeline/series/:id', REMOVES_RECORD],+ ['PATCH /api/pipeline/series/:id', PRE_GUARD_BASELINE],+ ['PATCH /api/pipeline/series/:id/arc-fields/:field/lock', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/arc/derive-from-manuscript/commit', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/series/:id/autopilot/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/autopilot/model-outcomes', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/autopilot/pause', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/continuity-bible/generate/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/editorial/analyze/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/editorial/checks/run/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/editorial/panel/run/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/issues', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/manuscript/completeness/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/manuscript/cuts/apply', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/series/:id/manuscript/cuts/preview', PIPELINE_DETERMINISTIC],+ ['PATCH /api/pipeline/series/:id/manuscript/review/comments/:commentId', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/manuscript/review/comments/:commentId/accept', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/manuscript/review/comments/:commentId/undo', PRE_GUARD_BASELINE],+ ['PUT /api/pipeline/series/:id/manuscript/sections/:issueId', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/reverse-outline/generate/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/review/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/review/fix/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/:id/seasons', PRE_GUARD_BASELINE],+ ['DELETE /api/pipeline/series/:id/seasons/:seasonId', REMOVES_RECORD],+ ['PATCH /api/pipeline/series/:id/seasons/:seasonId', PRE_GUARD_BASELINE],+ ['POST /api/pipeline/series/:id/seasons/:seasonId/generate-beats/cancel', REDUCES_EXECUTION],+ ['POST /api/pipeline/series/merge', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/series/merge/preview', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/tts/narrate', PIPELINE_DETERMINISTIC],+ ['PATCH /api/pipeline/tts/narrate/segment', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/tts/narrate/segment', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/tts/preview', PIPELINE_DETERMINISTIC],+ ['POST /api/pipeline/tts/synthesize', PIPELINE_DETERMINISTIC],+ // /api/ports+ ['POST /api/ports/allocate', PRE_GUARD_BASELINE],+ ['POST /api/ports/check', PRE_GUARD_BASELINE],+ // /api/privacy+ ['DELETE /api/privacy/broker-cases/:id/evidence', REMOVES_RECORD],+ ['POST /api/privacy/broker-cases/:id/recheck', PRE_GUARD_BASELINE],+ ['POST /api/privacy/broker-cases/:id/transition', PRE_GUARD_BASELINE],+ ['PUT /api/privacy/brokers/:id', PRE_GUARD_BASELINE],+ ['POST /api/privacy/brokers/refresh', PRE_GUARD_BASELINE],+ ['POST /api/privacy/changes', PRE_GUARD_BASELINE],+ ['POST /api/privacy/changes/:id/orgs/:orgId/draft-email', PRE_GUARD_BASELINE],+ ['POST /api/privacy/changes/:id/orgs/:orgId/removed', PRE_GUARD_BASELINE],+ ['POST /api/privacy/changes/:id/orgs/:orgId/updated', PRE_GUARD_BASELINE],+ ['POST /api/privacy/optout', PRE_GUARD_BASELINE],+ ['PUT /api/privacy/optout/schedule', PRE_GUARD_BASELINE],+ ['POST /api/privacy/optout/verify', PRE_GUARD_BASELINE],+ ['POST /api/privacy/orgs', PRE_GUARD_BASELINE],+ ['DELETE /api/privacy/orgs/:id', REMOVES_RECORD],+ ['PUT /api/privacy/orgs/:id', PRE_GUARD_BASELINE],+ ['PUT /api/privacy/orgs/:id/holdings', PRE_GUARD_BASELINE],+ ['POST /api/privacy/scan', PRE_GUARD_BASELINE],+ ['POST /api/privacy/subjects', PRE_GUARD_BASELINE],+ ['DELETE /api/privacy/subjects/:id', REMOVES_RECORD],+ ['PUT /api/privacy/subjects/:id', PRE_GUARD_BASELINE],+ ['POST /api/privacy/subjects/:id/consents', PRE_GUARD_BASELINE],+ ['POST /api/privacy/subjects/:id/consents/revoke', PRE_GUARD_BASELINE],+ ['POST /api/privacy/vault', PRE_GUARD_BASELINE],+ ['DELETE /api/privacy/vault/:id', REMOVES_RECORD],+ ['PUT /api/privacy/vault/:id', PRE_GUARD_BASELINE],+ ['POST /api/privacy/vault/:id/reveal', PRE_GUARD_BASELINE],+ // /api/prompts+ ['DELETE /api/prompts/:stage', REMOVES_RECORD],+ ['POST /api/prompts/:stage/preview', PRE_GUARD_BASELINE],+ ['POST /api/prompts/reload', PRE_GUARD_BASELINE],+ ['DELETE /api/prompts/variables/:key', REMOVES_RECORD],+ // /api/provider-fallbacks+ ['PUT /api/provider-fallbacks', PRE_GUARD_BASELINE],+ // /api/providers+ ['DELETE /api/providers/:id', REMOVES_RECORD],+ ['POST /api/providers/:id/derive', RECORDS],+ ['POST /api/providers/:id/refresh-models', CONFIGURED_INFERENCE],+ ['POST /api/providers/:id/status/recover', RECORDS],+ ['POST /api/providers/:id/test', CONFIGURED_INFERENCE],+ ['POST /api/providers/:id/test-vision', CONFIGURED_INFERENCE],+ ['POST /api/providers/:id/vision-suite', CONFIGURED_INFERENCE],+ ['POST /api/providers/bindings', RECORDS],+ ['PATCH /api/providers/bindings/:id', RECORDS],+ ['POST /api/providers/bindings/:id/link/preview', RECORDS],+ ['POST /api/providers/bindings/:id/unlink', RECORDS],+ ['POST /api/providers/codex/account/login/cancel', REDUCES_EXECUTION],+ ['DELETE /api/providers/connections/:id', REMOVES_RECORD],+ ['POST /api/providers/connections/:id/refresh-models', CONFIGURED_INFERENCE],+ ['POST /api/providers/fleet-host/key', PEER_SURFACE],+ ['POST /api/providers/fleet-host/stop', REDUCES_EXECUTION],+ ['POST /api/providers/fleet-peer-hosts/:peerId/key', RECORDS],+ ['POST /api/providers/model-pins/clear', RECORDS],+ ['PATCH /api/providers/routes/:providerId/model-aliases', RECORDS],+ ['DELETE /api/providers/services/:slug', REMOVES_RECORD],+ ['POST /api/providers/services/:slug/refresh-catalog', CONFIGURED_INFERENCE],+ // /api/providers/comparison+ ['POST /api/providers/comparison/import', RECORDS],+ // /api/rapid-reader+ ['POST /api/rapid-reader/library', PRE_GUARD_BASELINE],+ ['DELETE /api/rapid-reader/library/:id', REMOVES_RECORD],+ ['POST /api/rapid-reader/library/fetch', PRE_GUARD_BASELINE],+ // /api/review+ ['DELETE /api/review/items/:id', REMOVES_RECORD],+ ['PATCH /api/review/items/:id', PRE_GUARD_BASELINE],+ ['POST /api/review/items/:id/complete', PRE_GUARD_BASELINE],+ ['POST /api/review/items/:id/dismiss', PRE_GUARD_BASELINE],+ ['POST /api/review/items/bulk-status', PRE_GUARD_BASELINE],+ ['POST /api/review/queue/delivery', PRE_GUARD_BASELINE],+ ['POST /api/review/queue/triage', PRE_GUARD_BASELINE],+ ['POST /api/review/todo', PRE_GUARD_BASELINE],+ // /api/rounds+ ['POST /api/rounds', PRE_GUARD_BASELINE],+ ['DELETE /api/rounds/:id', REMOVES_RECORD],+ ['PATCH /api/rounds/:id', PRE_GUARD_BASELINE],+ ['POST /api/rounds/:id/refresh-template', PRE_GUARD_BASELINE],+ ['POST /api/rounds/reference-audio/import/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/rounds/reference-audio/transcribe-midi/:jobId/cancel', REDUCES_EXECUTION],+ // /api/runs+ ['DELETE /api/runs', REMOVES_RECORD],+ ['DELETE /api/runs/:id', REMOVES_RECORD],+ ['POST /api/runs/:id/stop', REDUCES_EXECUTION],+ // /api/screenshots+ ['POST /api/screenshots', PRE_GUARD_BASELINE],+ // /api/settings+ ['PUT /api/settings/ai-assignments/:id', HANDLER_GATED],+ ['PUT /api/settings/credentials/:id', PRE_GUARD_BASELINE],+ ['PUT /api/settings/features/:featureId', PRE_GUARD_BASELINE],+ ['POST /api/settings/features/eidoverse/host', PRE_GUARD_BASELINE],+ ['PUT /api/settings/features/groups/:groupId', PRE_GUARD_BASELINE],+ ['POST /api/settings/orchestration-profiles', PRE_GUARD_BASELINE],+ ['DELETE /api/settings/orchestration-profiles/:id', REMOVES_RECORD],+ ['PUT /api/settings/orchestration-profiles/:id', PRE_GUARD_BASELINE],+ // /api/sharing+ ['DELETE /api/sharing/buckets/:id', REMOVES_RECORD],+ ['PUT /api/sharing/buckets/:id', PRE_GUARD_BASELINE],+ ['POST /api/sharing/buckets/:id/export', PRE_GUARD_BASELINE],+ ['POST /api/sharing/buckets/:id/inbox/:manifestId/dismiss', PRE_GUARD_BASELINE],+ ['POST /api/sharing/buckets/:id/inbox/:manifestId/promote', PRE_GUARD_BASELINE],+ ['POST /api/sharing/subscriptions', PRE_GUARD_BASELINE],+ ['DELETE /api/sharing/subscriptions/:id', REMOVES_RECORD],+ // /api/signal+ ['POST /api/signal/sync', PRE_GUARD_BASELINE],+ // /api/spotify+ ['POST /api/spotify/auth/clear', PRE_GUARD_BASELINE],+ ['POST /api/spotify/auth/credentials', PRE_GUARD_BASELINE],+ ['POST /api/spotify/playlists/sync', PRE_GUARD_BASELINE],+ ['POST /api/spotify/sync', PRE_GUARD_BASELINE],+ // /api/sprites+ ['POST /api/sprites', PRE_GUARD_BASELINE],+ ['DELETE /api/sprites/:id', REMOVES_RECORD],+ ['PATCH /api/sprites/:id', PRE_GUARD_BASELINE],+ ['DELETE /api/sprites/:id/assets', REMOVES_RECORD],+ ['POST /api/sprites/:id/atlas/compile', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/reference/lock', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/reference/main/unlock', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/reference/turnaround/unlock', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/reference/unlock', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/tracks/:trackId/approve', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/tracks/:trackId/reopen', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/walk/approve', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/walk/postprocess', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/walk/reopen', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/walk/runs/:runId/source-frames/extract', PRE_GUARD_BASELINE],+ ['PUT /api/sprites/:id/walk/target', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/walk/trim', PRE_GUARD_BASELINE],+ ['POST /api/sprites/:id/walk/unlock', PRE_GUARD_BASELINE],+ ['POST /api/sprites/animation-tracks', PRE_GUARD_BASELINE],+ ['DELETE /api/sprites/animation-tracks/:trackId', REMOVES_RECORD],+ ['PUT /api/sprites/animation-tracks/:trackId', PRE_GUARD_BASELINE],+ // /api/stacker-news+ ['POST /api/stacker-news/accounts', HANDLER_GATED],+ ['DELETE /api/stacker-news/accounts/:id', REMOVES_RECORD],+ ['PATCH /api/stacker-news/accounts/:id', HANDLER_GATED],+ ['POST /api/stacker-news/actions', PRE_GUARD_BASELINE],+ ['POST /api/stacker-news/analyses/:id/feedback', PRE_GUARD_BASELINE],+ ['POST /api/stacker-news/items', PRE_GUARD_BASELINE],+ ['POST /api/stacker-news/items/:id/analyze', PRE_GUARD_BASELINE],+ ['POST /api/stacker-news/territories', HANDLER_GATED],+ ['DELETE /api/stacker-news/territories/:id', REMOVES_RECORD],+ ['PATCH /api/stacker-news/territories/:id', HANDLER_GATED],+ // /api/standardize+ ['POST /api/standardize/analyze', READ_ONLY_EXTERNAL],+ // /api/story-builder+ ['POST /api/story-builder', PRE_GUARD_BASELINE],+ ['DELETE /api/story-builder/:id', REMOVES_RECORD],+ ['PATCH /api/story-builder/:id', PRE_GUARD_BASELINE],+ ['POST /api/story-builder/:id/current-step/:stepId', PRE_GUARD_BASELINE],+ ['POST /api/story-builder/:id/issues/:issueId/lock', PRE_GUARD_BASELINE],+ ['POST /api/story-builder/:id/reconcile', PRE_GUARD_BASELINE],+ ['POST /api/story-builder/:id/steps/:stepId/lock', PRE_GUARD_BASELINE],+ ['POST /api/story-builder/:id/steps/:stepId/unlock', PRE_GUARD_BASELINE],+ ['POST /api/story-builder/:id/sync', PRE_GUARD_BASELINE],+ // /api/storyboards+ ['POST /api/storyboards', RECORDS],+ ['DELETE /api/storyboards/:id', REMOVES_RECORD],+ ['PATCH /api/storyboards/:id', RECORDS],+ ['POST /api/storyboards/:id/beats', RECORDS],+ ['DELETE /api/storyboards/:id/beats/:beatId', REMOVES_RECORD],+ ['PATCH /api/storyboards/:id/beats/:beatId', RECORDS],+ ['POST /api/storyboards/:id/beats/:beatId/move', RECORDS],+ ['POST /api/storyboards/:id/beats/:beatId/panels', RECORDS],+ ['POST /api/storyboards/:id/beats/add', RECORDS],+ ['DELETE /api/storyboards/:id/panels/:panelId', REMOVES_RECORD],+ ['PATCH /api/storyboards/:id/panels/:panelId', RECORDS],+ ['PATCH /api/storyboards/:id/panels/:panelId/make/:nodeId', RECORDS],+ ['POST /api/storyboards/:id/panels/:panelId/move', RECORDS],+ ['POST /api/storyboards/:id/panels/:panelId/takes', RECORDS],+ ['DELETE /api/storyboards/:id/panels/:panelId/takes/:takeId', REMOVES_RECORD],+ ['POST /api/storyboards/:id/panels/:panelId/takes/:takeId/select', RECORDS],+ ['PUT /api/storyboards/:id/recipe', RECORDS],+ ['POST /api/storyboards/fit-music-video/:projectId', RECORDS],+ ['POST /api/storyboards/from-music-video/:projectId', RECORDS],+ ['POST /api/storyboards/recipes', RECORDS],+ ['DELETE /api/storyboards/recipes/:recipeId', REMOVES_RECORD],+ // /api/sync+ ['POST /api/sync/:category/apply', PRE_GUARD_BASELINE],+ ['POST /api/sync/tombstones/sweep', PRE_GUARD_BASELINE],+ // /api/system+ ['PUT /api/system/health/thresholds', PRE_GUARD_BASELINE],+ ['DELETE /api/system/health/warnings/:type/dismiss', REMOVES_RECORD],+ ['POST /api/system/health/warnings/:type/dismiss', PRE_GUARD_BASELINE],+ // /api/system-resources+ ['POST /api/system-resources/duplicates/rectify', PRE_GUARD_BASELINE],+ ['POST /api/system-resources/report', PRE_GUARD_BASELINE],+ // /api/threejs-models+ ['DELETE /api/threejs-models/:id', REMOVES_RECORD],+ // /api/timeline+ ['POST /api/timeline/import/browser', PRE_GUARD_BASELINE],+ ['POST /api/timeline/import/discord', PRE_GUARD_BASELINE],+ ['POST /api/timeline/import/spotify', PRE_GUARD_BASELINE],+ ['POST /api/timeline/import/takeout-location', PRE_GUARD_BASELINE],+ ['POST /api/timeline/import/whatsapp', PRE_GUARD_BASELINE],+ ['POST /api/timeline/import/youtube', PRE_GUARD_BASELINE],+ // /api/tools+ ['DELETE /api/tools/:id', REMOVES_RECORD],+ // /api/tracks+ ['POST /api/tracks', PRE_GUARD_BASELINE],+ ['DELETE /api/tracks/:id', REMOVES_RECORD],+ ['PATCH /api/tracks/:id', PRE_GUARD_BASELINE],+ ['DELETE /api/tracks/:id/audio', REMOVES_RECORD],+ ['POST /api/tracks/:id/audio/attach', PRE_GUARD_BASELINE],+ ['POST /api/tracks/:id/audio/upload', PRE_GUARD_BASELINE],+ ['POST /api/tracks/:id/chiptune/render', PRE_GUARD_BASELINE],+ ['POST /api/tracks/:id/code/render', PRE_GUARD_BASELINE],+ ['DELETE /api/tracks/:id/renders/:renderId', REMOVES_RECORD],+ ['POST /api/tracks/:id/renders/:renderId/select', PRE_GUARD_BASELINE],+ ['POST /api/tracks/:id/supercollider/take', PRE_GUARD_BASELINE],+ ['POST /api/tracks/:id/waveform/render', PRE_GUARD_BASELINE],+ ['POST /api/tracks/import/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/tracks/import/suno', PRE_GUARD_BASELINE],+ // /api/tribe+ ['DELETE /api/tribe/beeper/identities/:identityId', REMOVES_RECORD],+ ['DELETE /api/tribe/beeper/link', REMOVES_RECORD],+ ['POST /api/tribe/beeper/link', PRE_GUARD_BASELINE],+ ['POST /api/tribe/beeper/link-new', PRE_GUARD_BASELINE],+ ['POST /api/tribe/outreach/draft', PRE_GUARD_BASELINE],+ ['POST /api/tribe/people', PRE_GUARD_BASELINE],+ ['DELETE /api/tribe/people/:id', REMOVES_RECORD],+ ['PUT /api/tribe/people/:id', PRE_GUARD_BASELINE],+ ['POST /api/tribe/people/:id/memories', PRE_GUARD_BASELINE],+ ['DELETE /api/tribe/people/:id/memories/:memoryId', REMOVES_RECORD],+ ['POST /api/tribe/people/:id/touchpoints', PRE_GUARD_BASELINE],+ ['POST /api/tribe/people/:id/touchpoints/calendar', PRE_GUARD_BASELINE],+ // /api/universe-builder+ ['POST /api/universe-builder', PRE_GUARD_BASELINE],+ ['DELETE /api/universe-builder/:id', REMOVES_RECORD],+ ['PATCH /api/universe-builder/:id', PRE_GUARD_BASELINE],+ ['POST /api/universe-builder/:id/adopt-style', PRE_GUARD_BASELINE],+ ['DELETE /api/universe-builder/:id/canon/:kind/:entryId', REMOVES_RECORD],+ ['POST /api/universe-builder/:id/canon/:kind/:entryId/apply-image-correction', PRE_GUARD_BASELINE],+ ['PATCH /api/universe-builder/:id/canon/:kind/:entryId/lock', PRE_GUARD_BASELINE],+ ['PATCH /api/universe-builder/:id/canon/:kind/lock-all', PRE_GUARD_BASELINE],+ ['POST /api/universe-builder/:id/canon/backfill-descriptions', PRE_GUARD_BASELINE],+ ['POST /api/universe-builder/:id/characters/:entryId/augment/apply', PRE_GUARD_BASELINE],+ ['DELETE /api/universe-builder/:id/characters/:entryId/reference-sheet', REMOVES_RECORD],+ ['POST /api/universe-builder/:id/import/markdown', PRE_GUARD_BASELINE],+ ['POST /api/universe-builder/:id/style-references', PRE_GUARD_BASELINE],+ ['DELETE /api/universe-builder/:id/style-references/:referenceId', REMOVES_RECORD],+ ['PATCH /api/universe-builder/:id/variations/lock-all', PRE_GUARD_BASELINE],+ ['POST /api/universe-builder/merge', PRE_GUARD_BASELINE],+ ['POST /api/universe-builder/merge/preview', PRE_GUARD_BASELINE],+ // /api/update+ ['POST /api/update/check', PRE_GUARD_BASELINE],+ ['DELETE /api/update/ignore', REMOVES_RECORD],+ ['POST /api/update/ignore', PRE_GUARD_BASELINE],+ // /api/uploads+ ['DELETE /api/uploads', REMOVES_RECORD],+ ['POST /api/uploads', PRE_GUARD_BASELINE],+ ['DELETE /api/uploads/:filename', REMOVES_RECORD],+ // /api/usage+ ['DELETE /api/usage', REMOVES_RECORD],+ ['POST /api/usage/backfill', PRE_GUARD_BASELINE],+ ['PUT /api/usage/fleet-billing', PRE_GUARD_BASELINE],+ ['POST /api/usage/messages', PRE_GUARD_BASELINE],+ ['POST /api/usage/session', PRE_GUARD_BASELINE],+ ['PUT /api/usage/subscriptions', PRE_GUARD_BASELINE],+ ['PUT /api/usage/subscriptions/enabled', PRE_GUARD_BASELINE],+ ['POST /api/usage/tokens', PRE_GUARD_BASELINE],+ // /api/video-gen+ ['POST /api/video-gen/cancel', REDUCES_EXECUTION],+ ['DELETE /api/video-gen/history/:id', REMOVES_RECORD],+ ['PATCH /api/video-gen/history/:id/poster', PRE_GUARD_BASELINE],+ ['PATCH /api/video-gen/history/:id/prompt', PRE_GUARD_BASELINE],+ ['POST /api/video-gen/history/:id/visibility', PRE_GUARD_BASELINE],+ ['POST /api/video-gen/ic-loras/:mode/download', MODEL_DATA],+ ['POST /api/video-gen/ic-loras/:mode/repair', MODEL_DATA],+ ['POST /api/video-gen/last-frame/:id', PRE_GUARD_BASELINE],+ ['POST /api/video-gen/model-terms', PRE_GUARD_BASELINE],+ ['POST /api/video-gen/models/:modelId/download', MODEL_DATA],+ ['POST /api/video-gen/models/:modelId/repair', MODEL_DATA],+ ['POST /api/video-gen/models/verify', MODEL_DATA],+ ['POST /api/video-gen/prompt-preview', PRE_GUARD_BASELINE],+ ['POST /api/video-gen/text-encoder/download', MODEL_DATA],+ ['POST /api/video-gen/text-encoder/repair', MODEL_DATA],+ ['POST /api/video-gen/text-encoders/:id/download', MODEL_DATA],+ ['POST /api/video-gen/text-encoders/:id/repair', MODEL_DATA],+ ['POST /api/video-gen/upload', PRE_GUARD_BASELINE],+ // /api/video-timeline+ ['POST /api/video-timeline/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/video-timeline/projects', PRE_GUARD_BASELINE],+ ['DELETE /api/video-timeline/projects/:id', REMOVES_RECORD],+ ['PATCH /api/video-timeline/projects/:id', PRE_GUARD_BASELINE],+ // /api/voice+ ['PUT /api/voice/config', PRE_GUARD_BASELINE],+ ['POST /api/voice/piper/fetch', MODEL_DATA],+ ['POST /api/voice/profiles/:id/assign', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/:id/benchmark', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/:id/benchmark-interactive', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/:id/benchmark-interactive/complete', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/:id/fine-tune/:jobId/cancel', REDUCES_EXECUTION],+ ['POST /api/voice/profiles/:id/fine-tune/:jobId/promote', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/:id/promote', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/clone', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/design', PRE_GUARD_BASELINE],+ ['POST /api/voice/profiles/preset', PRE_GUARD_BASELINE],+ ['POST /api/voice/qwen3/download-model', MODEL_DATA],+ ['POST /api/voice/speak', PRE_GUARD_BASELINE],+ ['POST /api/voice/studio/design', PRE_GUARD_BASELINE],+ ['POST /api/voice/studio/unload', REDUCES_EXECUTION],+ ['POST /api/voice/test', PRE_GUARD_BASELINE],+ ['POST /api/voice/tts/unload', REDUCES_EXECUTION],+ ['POST /api/voice/whisper', PRE_GUARD_BASELINE],+ // /api/voice/public+ ['POST /api/voice/public/synthesize', PRE_GUARD_BASELINE],+ // /api/workspace-contexts+ ['DELETE /api/workspace-contexts/:appId', REMOVES_RECORD],+ ['POST /api/workspace-contexts/:appId/restore', PRE_GUARD_BASELINE],+ ['POST /api/workspace-contexts/:appId/save', PRE_GUARD_BASELINE],+ // /api/writers-room+ ['POST /api/writers-room/exercises', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/exercises/:id/discard', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/exercises/:id/finish', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/exercises/:id/promote', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/folders', PRE_GUARD_BASELINE],+ ['DELETE /api/writers-room/folders/:id', REMOVES_RECORD],+ ['POST /api/writers-room/works', PRE_GUARD_BASELINE],+ ['DELETE /api/writers-room/works/:id', REMOVES_RECORD],+ ['PATCH /api/writers-room/works/:id', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/analysis/:analysisId/scene-image', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/cd-bridge/send', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/characters', PRE_GUARD_BASELINE],+ ['DELETE /api/writers-room/works/:id/characters/:characterId', REMOVES_RECORD],+ ['PATCH /api/writers-room/works/:id/characters/:characterId', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/characters/:characterId/augment/apply', PRE_GUARD_BASELINE],+ ['PUT /api/writers-room/works/:id/draft', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/live-render-preview', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/objects', PRE_GUARD_BASELINE],+ ['DELETE /api/writers-room/works/:id/objects/:objectId', REMOVES_RECORD],+ ['PATCH /api/writers-room/works/:id/objects/:objectId', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/places', PRE_GUARD_BASELINE],+ ['DELETE /api/writers-room/works/:id/places/:placeId', REMOVES_RECORD],+ ['PATCH /api/writers-room/works/:id/places/:placeId', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/polish/cancel', REDUCES_EXECUTION],+ ['POST /api/writers-room/works/:id/polish/revert', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/promote-to-pipeline', PRE_GUARD_BASELINE],+ ['POST /api/writers-room/works/:id/versions', PRE_GUARD_BASELINE],+ ['PATCH /api/writers-room/works/:id/versions/:draftId', PRE_GUARD_BASELINE],+ // /api/x+ ['POST /api/x/accounts', PRE_GUARD_BASELINE],+ ['DELETE /api/x/accounts/:id', REMOVES_RECORD],+ ['PATCH /api/x/accounts/:id', PRE_GUARD_BASELINE],+ ['POST /api/x/drafts', PRE_GUARD_BASELINE],+ // /api/youtube+ ['POST /api/youtube/playlists/sync', PRE_GUARD_BASELINE],+ ['POST /api/youtube/sync', PRE_GUARD_BASELINE],+ // /sdapi/v1+ ['POST /sdapi/v1/options', PRE_GUARD_BASELINE],+ ['POST /sdapi/v1/txt2img', HANDLER_GATED],+];++const routeKey = ({ method, path }) => `${method} ${path}`;+const isGated = (method, path) => hostControlRouteFor(method, path) !== null || hostControlBodyRouteFor(method, path) !== null;++/** The classification problems of `routes` (scanRouteGraph rows) against reviewed-open `entries`. */+const classify = (routes, entries) => {+ const mutations = new Set(routes.filter((route) => MUTATING_METHODS.has(route.method)).map(routeKey));+ const seen = new Set();+ const duplicated = [];+ for (const [key] of entries) {+ if (seen.has(key)) duplicated.push(key);+ seen.add(key);+ }+ const alsoGated = [...seen].filter((key) => isGated(...key.split(' ')));+ return {+ unclassified: [...mutations].filter((key) => !seen.has(key) && !isGated(...key.split(' '))),+ stale: [...seen].filter((key) => !mutations.has(key) && !alsoGated.includes(key)),+ alsoGated,+ duplicated,+ };+};++const RULES = 'Classify each route by the family notes in the header of server/lib/hostControlRoutes.js: '+ + 'gate it in HOST_CONTROL_ROUTES, or list it in REVIEWED_OPEN_MUTATIONS (server/hostControlCoverage.test.js) with a reason.';++describe('host-control coverage of mounted mutating routes (#12952)', () => {+ const { routes } = scanRouteGraph();++ it('classifies every mounted mutation exactly once, with no stale or gated entries', () => {+ const problems = classify(routes, REVIEWED_OPEN_MUTATIONS);+ expect(problems.unclassified, `Unclassified mutating routes. ${RULES}`).toEqual([]);+ expect(problems.stale, 'Reviewed-open entries that no mounted route matches; delete them.').toEqual([]);+ expect(problems.alsoGated, 'Reviewed-open entries that are also gated; delete them from REVIEWED_OPEN_MUTATIONS.').toEqual([]);+ expect(problems.duplicated, 'Reviewed-open entries listed twice.').toEqual([]);+ });++ it('gives every reviewed-open entry a reason', () => {+ expect(REVIEWED_OPEN_MUTATIONS.filter(([, reason]) => typeof reason !== 'string' || !reason.trim())).toEqual([]);+ });++ it('fails on a new unclassified mutation, a stale entry, a gated entry and a double listing', () => {+ const problems = classify(+ [...routes, { method: 'POST', path: '/api/example-feature/:id/run' }, { method: 'GET', path: '/api/example-feature' }],+ [+ ...REVIEWED_OPEN_MUTATIONS,+ ['DELETE /api/example-retired/:id', REMOVES_RECORD],+ ['POST /api/apps/:id/start', RECORDS],+ REVIEWED_OPEN_MUTATIONS[0],+ ],+ );+ expect(problems).toEqual({+ unclassified: ['POST /api/example-feature/:id/run'],+ stale: ['DELETE /api/example-retired/:id'],+ alsoGated: ['POST /api/apps/:id/start'],+ duplicated: [REVIEWED_OPEN_MUTATIONS[0][0]],+ });+ });++ it('counts body-gated routes as covered', () => {+ expect(routes.some(({ method, path }) => method === 'PUT' && path === '/api/settings')).toBe(true);+ expect(classify([{ method: 'PUT', path: '/api/settings' }], []).unclassified).toEqual([]);+ });+});diff --git a/server/lib/README.md b/server/lib/README.mdindex 70fe5a73dc..b1f7f6817d 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -723,7 +723,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub|---|---|| `apiAccessPolicy.js` | Shared always-public path, gated non-`/api` prefix, and peer-credential federation surface (`PEER_API_SURFACE`, `isPeerApiRequestAllowed`) policy consumed by `authGate` and API discovery. || `apiCatalog.js` | Searchable projection of the Express route inventory (`getApiRouteCatalog()` from `apiRouteGraph.js`): domain, access, side-effect, contract coverage, summaries, and Express-to-OpenAPI path conversion. |-| `hostControlRoutes.js` | The audited `HOST_CONTROL_ROUTES` list of HTTP routes that execute on the host (app lifecycle, CoS agent queueing, git, scaffold, standardize, feature agents, loops, GSD, local review, provider execution config, autopilot start) plus `hostControlRouteFor` / `isHostControlRoute`; `authGate.js#hostControlRouteGate` applies `requireHostControl` to every entry. `hostControlBodyKeys` names the execution-policy keys of a `PUT /api/settings`, `PATCH /api/settings/slice`, or `PUT /api/cos/config` body (`HOST_CONTROL_SETTINGS_SLICES`, `HOST_CONTROL_OPEN_COS_CONFIG_KEYS`), and `hostControlSettingsPathsIn` / `changedHostControlSettingsPaths` the nested settings keys that pick an executable, an outbound endpoint or a host data file (`HOST_CONTROL_SETTINGS_PATHS`, gated only when the value changes). `voiceConfigHostControlPathsIn` / `changedVoiceConfigHostControlPaths` do the same for the voice agent's instructions, coding-agent switch and STT endpoint (`HOST_CONTROL_VOICE_CONFIG_PATHS` on `PUT /api/voice/config`). All of these are gated by `authGate.js#hostControlBodyGate`. The socket twin is `HOST_CONTROL_SOCKET_EVENTS` in `services/socket.js`. |+| `hostControlRoutes.js` | The audited `HOST_CONTROL_ROUTES` list of HTTP routes that execute on the host (app lifecycle, CoS agent queueing, git, scaffold, standardize, feature agents, loops, GSD, local review, provider execution config, autopilot start) plus `hostControlRouteFor` / `isHostControlRoute`; `authGate.js#hostControlRouteGate` applies `requireHostControl` to every entry. `hostControlBodyRouteFor` names the per-body gated route a request matches; `server/hostControlCoverage.test.js` requires every mounted mutating route to be gated or reviewed-open. `hostControlBodyKeys` names the execution-policy keys of a `PUT /api/settings`, `PATCH /api/settings/slice`, or `PUT /api/cos/config` body (`HOST_CONTROL_SETTINGS_SLICES`, `HOST_CONTROL_OPEN_COS_CONFIG_KEYS`), and `hostControlSettingsPathsIn` / `changedHostControlSettingsPaths` the nested settings keys that pick an executable, an outbound endpoint or a host data file (`HOST_CONTROL_SETTINGS_PATHS`, gated only when the value changes). `voiceConfigHostControlPathsIn` / `changedVoiceConfigHostControlPaths` do the same for the voice agent's instructions, coding-agent switch and STT endpoint (`HOST_CONTROL_VOICE_CONFIG_PATHS` on `PUT /api/voice/config`). All of these are gated by `authGate.js#hostControlBodyGate`. The socket twin is `HOST_CONTROL_SOCKET_EVENTS` in `services/socket.js`. || `apiRouteGraph.js` | Static scan of the mounted HTTP route graph — `server/index.js` `app.use('/api/…', router)` mounts → route-module imports → `router.use(prefix, child)` → `router.<method>('<path>')`, including aliased mounts, local subrouters, factory returns and composed `toolkit.routes.<x>` routers. `buildApiRouteCatalog({ repoRoot? })` → `{ derivedFrom, mounts, routes: [{ method, path, mountPath, sources }], stats }`; `getApiRouteCatalog()` derives it on first use and caches it for the process (read by the API Explorer, the internal OpenAPI document and `apiRouteParity.test.js`); `scanRouteGraph()` adds `declarationKeys` / `duplicateDeclarationKeys` (`routeDeclarationKey`) for the coverage guard in `apiRouteGraph.test.js`. Never committed — see "Generated manifests" in `server/AGENTS.md`. || `socketEventCatalog.js` | Searchable projection of the cached Socket.IO inventory: direction, domain, and runtime-schema coverage. || `sourceScan.js` | Lexer-assisted primitives shared by the whole-tree source-scan guard suites, so the timer rule and the socket rule cannot drift on what "owns its rejection" means. `blankLiterals(src)` blanks comment/string/template/regex CONTENT to spaces while preserving length, so a brace inside a literal cannot skew a bracket walk and a caller can still read a literal (a socket event name) out of the original string at the same offset; `matchBracket(src, open)` returns the index past the matching `)`/`]`/`}`; `parseCallbackAt(blanked, from, limit)` parses the function expression at `from` (`async`/`function`/either arrow spelling, skipping the parameter list as a unit so a `= {}` default is not mistaken for the body) and returns `{isAsync, start, text}`; `unguardedAwaits(body)` returns the awaited chains that neither sit inside a `try`/`catch` nor END in `.catch(…)`. `blankComments(src)` is the weaker LINE-based stripper the per-line `child_process` rule needs. `blankLiterals(src, { includeCommentOnly: true })` returns `{ code, blanked }` (the comment-only and fully blanked views) in one lexer traversal for guards needing both. `blankCommentBodies(src)` is the complement — comments blanked, literal TEXT kept — for a caller that reads a message string and must not see a marker written in a comment beside it. Callers: `childProcess.guards.test.js`, `server/timerCallbackConventions.test.js`, `server/logLevelConventions.test.js`, `server/sockets/asyncHandlerGuard.test.js`, `server/process-safety-net.test.js`. |diff --git a/server/lib/hostControlRoutes.js b/server/lib/hostControlRoutes.jsindex 76e208653e..be2b7697af 100644--- a/server/lib/hostControlRoutes.js+++ b/server/lib/hostControlRoutes.js@@ -75,6 +75,13 @@* POST /api/meatspace/post/drill is gated only when `type` is an LLM* drill; math, memory and cognitive drills stay open. Cover compose,* lettering saves and promotion reads stay open.+ * - Storyboards (#12952): plot beat extraction, a panel node run and the+ * make-empty batch hand caller text (the plot, or node prompts saved+ * through the open recipe/node writes) to a caller-chosen provider that is+ * not tool-free, or queue image renders; gated whole-operation like+ * mood-board generate. Board, beat, panel and take CRUD, the recipe and+ * node PATCH, beats/add, the recipe library and the plan/make reads only+ * store or read records and stay open.* - Importer, Brain and analytics AI (#11036): classify/analyze/retry-issues,* model-personality run, goal-scorecard narrative, Brain capture (it can* dispatch classification or repository intake), inbox retry, digest/review@@ -188,6 +195,22 @@* other read-only GET route. Mutable routes (`PUT` flags/secrets, `POST`* archive/unarchive, `POST` secret sync) execute `gh` with the user's GitHub* account and change external state; they require operator authority.+ * The notifications inbox (#12952) follows the same rule: thread actions,+ * audit apply and both undo routes write to the account with `gh`; the+ * automation schedule arms a CoS System task (the same change as the gated+ * CoS job routes); account create/edit choose the identity `gh` acts as, arm+ * Assist/Autopilot, or widen provider exposure, so they are gated whole.+ * `POST /api/github/notifications/sync` stays open as a refresh, but a caller+ * without host control gets fetch and metadata triage only — the handler+ * skips Assist/Autopilot for that request. Account and learned-rule DELETEs,+ * the read-only audit run (`POST /api/github/audit/:accountId`, a `gh` GET)+ * and every GET stay open.+ *+ * Every mounted mutating route is classified: it is in HOST_CONTROL_ROUTES,+ * gated per body (COMPILED_BODY_ROUTES), or recorded with a reason in REVIEWED_OPEN_MUTATIONS+ * (server/hostControlCoverage.test.js), which fails CI on a new, stale or+ * double-listed route. Classify a new route when you add it, using the+ * family notes above.*/import { canonicalStringify, isPlainObject, POLLUTING_KEYS } from './objects.js';@@ -875,6 +898,12 @@ export const HOST_CONTROL_ROUTES = Object.freeze(['POST /api/mood-boards/:id/compose-prompt','POST /api/mood-boards/:id/analyze','POST /api/mood-boards/:id/generate',+ // Storyboards (#12952): the plot and saved node prompts reach a+ // caller-chosen, non-tool-free provider; node runs and make-empty also+ // queue image renders.+ 'POST /api/storyboards/:id/beats/extract',+ 'POST /api/storyboards/:id/panels/:panelId/make/:nodeId/run',+ 'POST /api/storyboards/:id/make-empty','POST /api/cos/tasks/enhance',// Music Video cover design/generation and promotion planning, and POST LLM// drills (#10989). Each hands free text and/or a caller-chosen provider to@@ -898,6 +927,14 @@ export const HOST_CONTROL_ROUTES = Object.freeze([// network caller to run it. Direct API sync, push ingestion and CRUD stay open.'POST /api/calendar/sync/:accountId/google','POST /api/calendar/sync/:accountId/discover',+ // Google OAuth auto-configure drives the operator's signed-in host browser+ // through Google Cloud Console and captures the client secret it creates;+ // the token test intercepts an Outlook bearer token. Same class as the gated+ // Messages Gmail enable helper and token test (#11433, #11449; #12952).+ 'POST /api/calendar/google/auto-configure/start',+ 'POST /api/calendar/google/auto-configure/capture',+ 'POST /api/calendar/google/auto-configure/run',+ 'POST /api/calendar/debug/test-token',// Writers Room authoring reaches the staged runner, including CLI/TUI// fallback. Stored prose and live cursor text are caller-controlled; a@@ -984,6 +1021,17 @@ export const HOST_CONTROL_ROUTES = Object.freeze(['POST /api/github/secrets/:name/sync',// Resolve with agent queues CoS agent work against the thread's app.'POST /api/github/notifications/:accountId/:threadId/agent',+ // Notifications inbox (#12952): thread actions (and the learned rules an+ // operator action trains), audit apply and the undo routes write to the+ // account with `gh`; the schedule arms a CoS System task; account+ // create/edit pick the `gh` identity, mode, trust and allowed providers.+ 'POST /api/github/notifications/:accountId/:threadId',+ 'POST /api/github/audit/:accountId/apply',+ 'POST /api/github/audit-changes/:id/undo',+ 'POST /api/github/automations/activity/:id/undo',+ 'PUT /api/github/automations/schedule',+ 'POST /api/github/accounts',+ 'PUT /api/github/accounts/:id',// Beeper outbox creation records approved send intent; send spends the// operator's saved connection, and breaker reset re-arms that capability.@@ -1205,12 +1253,17 @@ const COMPILED_BODY_ROUTES = [['PATCH /api/apps/:appId/reference-repos/:refId', (body) => ['repoUrl', 'branch'].filter((key) => body?.[key] !== undefined)],].map(([route, pick]) => ({ ...compileRoute(route), pick }));+const bodyRouteEntry = (method, path) => (+ typeof method === 'string' && typeof path === 'string'+ ? COMPILED_BODY_ROUTES.find((entry) => entry.method === method.toUpperCase() && entry.pattern.test(path))+ : undefined+);++/** The per-body gated route that `method path` matches, or null. */+export const hostControlBodyRouteFor = (method, path) => bodyRouteEntry(method, path)?.route ?? null;+/** The host-control keys a request body names, for `method path` of a policy store; [] elsewhere. */-export const hostControlBodyKeys = (method, path, body) => {- if (typeof method !== 'string' || typeof path !== 'string') return [];- const verb = method.toUpperCase();- return COMPILED_BODY_ROUTES.find((entry) => entry.method === verb && entry.pattern.test(path))?.pick(body) ?? [];-};+export const hostControlBodyKeys = (method, path, body) => bodyRouteEntry(method, path)?.pick(body) ?? [];const valueAt = (object, path) => path.split('.').reduce((node, key) => (isPlainObject(node) && Object.hasOwn(node, key) ? node[key] : undefined),diff --git a/server/routes/github.js b/server/routes/github.jsindex aac6512cd6..aac02a9a8f 100644--- a/server/routes/github.js+++ b/server/routes/github.js@@ -7,6 +7,7 @@ import * as githubService from '../services/github.js';import * as githubAccounts from '../services/githubAccounts.js';import * as githubNotifications from '../services/githubNotifications.js';import * as githubAudit from '../services/githubNotificationAudit.js';+import { requestHasHostControl } from '../services/authGate.js';const router = express.Router();@@ -137,13 +138,16 @@ router.get('/notifications', asyncHandler(async (req, res) => {}));/**- * POST /api/github/notifications/sync — fetch unread notifications from GitHub+ * POST /api/github/notifications/sync — fetch unread notifications from GitHub.+ * Open as a refresh; Assist/Autopilot run only for a caller with host control+ * (lib/hostControlRoutes.js, #12952).*/router.post('/notifications/sync', asyncHandler(async (req, res) => {const { accountId } = validateRequest(githubNotificationsSyncSchema, req.body ?? {});+ const options = { automate: requestHasHostControl(req) };const results = accountId- ? [{ ...(await githubNotifications.syncAccountNotifications(accountId)), ok: true }]- : await githubNotifications.syncAllNotifications();+ ? [{ ...(await githubNotifications.syncAccountNotifications(accountId, options)), ok: true }]+ : await githubNotifications.syncAllNotifications(options);res.json({ results });}));diff --git a/server/routes/hostControlCalendarMcp.test.js b/server/routes/hostControlCalendarMcp.test.jsindex 332433af46..cafa543008 100644--- a/server/routes/hostControlCalendarMcp.test.js+++ b/server/routes/hostControlCalendarMcp.test.js@@ -79,9 +79,13 @@ vi.mock('../services/calendarGoogleApiSync.js', () => ({}));vi.mock('../services/dailyReview.js', () => ({}));vi.mock('../services/googleAuth.js', () => ({}));-vi.mock('../services/googleOAuthAutoConfig.js', () => ({}));+vi.mock('../services/googleOAuthAutoConfig.js', () => ({+ startAutoConfig: vi.fn(async () => ({ status: 'opened' })),+ captureCredentials: vi.fn(async () => ({ status: 'captured' })),+ runAutomatedSetup: vi.fn(async () => ({ status: 'configured' })),+}));vi.mock('../services/messageTokenExtractor.js', () => ({- getToken: vi.fn(), getTokenStatus: vi.fn(), clearTokenCache: vi.fn(),+ getToken: vi.fn(async () => ({ token: 'example-token', fresh: true, decoded: {} })), getTokenStatus: vi.fn(), clearTokenCache: vi.fn(),}));import { authGate, hostControlRouteGate, hostControlBodyGate } from '../services/authGate.js';@@ -91,6 +95,8 @@ import { runCliProviderPrompt } from '../lib/cliProviderRun.js';import { getAccount, updateSyncStatus, updateSubcalendars } from '../services/calendarAccounts.js';import { mutateCache } from '../services/calendarSync.js';import { apiSyncAccount, apiDiscoverCalendars } from '../services/calendarGoogleApiSync.js';+import { startAutoConfig, captureCredentials, runAutomatedSetup } from '../services/googleOAuthAutoConfig.js';+import { getToken } from '../services/messageTokenExtractor.js';import calendarRoutes from './calendar.js';const appFor = (address = '192.0.2.10') => {@@ -212,3 +218,43 @@ describe('Calendar MCP operator authority (#11051)', () => {expect(runCliProviderPrompt).not.toHaveBeenCalled();});});++describe('Calendar host-browser automation operator authority (#12952)', () => {+ const browserActions = [+ ['/api/calendar/google/auto-configure/start', startAutoConfig],+ ['/api/calendar/google/auto-configure/capture', captureCredentials],+ ['/api/calendar/google/auto-configure/run', runAutomatedSetup],+ ['/api/calendar/debug/test-token', getToken],+ ];++ it('refuses a remote password-free caller, direct or proxied, before the host browser is driven', async () => {+ for (const [path, effect] of browserActions) {+ for (const [address, headers] of [['192.0.2.10', {}], ['127.0.0.1', { [DEV_PROXY_CLIENT_ADDRESS_HEADER]: '192.0.2.10' }]]) {+ const pending = request(appFor(address)).post(path);+ for (const [name, value] of Object.entries(headers)) pending.set(name, value);+ const response = await pending.send({});+ expect([response.status, response.body.code], path).toEqual([403, 'HOST_CONTROL_FORBIDDEN']);+ }+ expect(effect, path).not.toHaveBeenCalled();+ }+ });++ it('keeps local, operator-session and delegated-agent callers able to run it', async () => {+ const operator = await createSession();+ const agent = await createSession({ label: 'agent' });+ for (const [enabled, address, headers] of [+ [false, '127.0.0.1', {}],+ [true, '192.0.2.10', { Authorization: `Bearer ${operator.token}` }],+ [true, '192.0.2.10', { Authorization: `Bearer ${agent.token}` }],+ ]) {+ auth.enabled = enabled;+ for (const [path] of browserActions) {+ const pending = request(appFor(address)).post(path);+ for (const [name, value] of Object.entries(headers)) pending.set(name, value);+ const response = await pending.send({});+ expect(response.status, `${path}: ${JSON.stringify(response.body)}`).toBe(200);+ }+ }+ for (const [path, effect] of browserActions) expect(effect, path).toHaveBeenCalledTimes(3);+ });+});diff --git a/server/routes/hostControlGitHubInbox.test.js b/server/routes/hostControlGitHubInbox.test.jsnew file mode 100644index 0000000000..bccf6ad88c--- /dev/null+++ b/server/routes/hostControlGitHubInbox.test.js@@ -0,0 +1,149 @@+import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';+import express from 'express';+import { request } from '../lib/testHelper.js';+import { errorMiddleware } from '../lib/errorHandler.js';+import { DEV_PROXY_CLIENT_ADDRESS_HEADER } from '../../lib/portosAuthCore.js';+import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../lib/mockPathsDataRoot.js';++vi.mock('../lib/fileUtils.js', async (importOriginal) =>+ makePathsProxy(await importOriginal(), { dataRoot: () => lazyTempDataRoot('portos-github-inbox-host-control-') }));+afterAll(cleanupTempDataRoots);++// GitHub notifications inbox writes (#12952). Real router behind the real auth+// and host-control gates; the inbox, account and audit services are doubled,+// so a refused request provably reaches no `gh` write, CoS job or account store.+const auth = vi.hoisted(() => ({ enabled: false }));+const accounts = vi.hoisted(() => ({+ listAccounts: vi.fn(async () => []),+ createAccount: vi.fn(async (body) => ({ id: 'acct-example', ...body })),+ updateAccount: vi.fn(async (id, body) => ({ id, ...body })),+ deleteAccount: vi.fn(async () => ({ deleted: true })),+ getAccountStatus: vi.fn(async () => ({ ok: true })),+}));+const inbox = vi.hoisted(() => ({+ listNotifications: vi.fn(async () => ({ notifications: [] })),+ syncAccountNotifications: vi.fn(async (accountId) => ({ accountId })),+ syncAllNotifications: vi.fn(async () => []),+ getNotification: vi.fn(async () => ({})),+ applyNotificationAction: vi.fn(async () => ({ state: 'done' })),+ resolveWithAgent: vi.fn(async () => ({})),+ getAutomationsOverview: vi.fn(async () => ({})),+ setNotificationCadence: vi.fn(async (cadence) => ({ cadence })),+ listAutomationActivity: vi.fn(async () => []),+ undoAutomationAction: vi.fn(async () => ({ undone: true })),+ listLearnedRules: vi.fn(async () => []),+ deleteLearnedRule: vi.fn(async () => ({ deleted: true })),+}));+const audit = vi.hoisted(() => ({+ listAuditChanges: vi.fn(async () => []),+ undoAuditChange: vi.fn(async () => ({ undone: true })),+ getLastAudit: vi.fn(async () => null),+ runAccountAudit: vi.fn(async () => ({ suggestions: [] })),+ applyAuditSuggestion: vi.fn(async () => ({ applied: true })),+}));++vi.mock('../services/auth.js', async (importOriginal) => ({+ ...await importOriginal(),+ isAuthEnabled: vi.fn(async () => auth.enabled),+ verifyPassword: vi.fn(async () => true),+}));+vi.mock('../services/settings.js', () => ({+ settingsEvents: { on: vi.fn(), off: vi.fn(), emit: vi.fn() },+ getSettings: vi.fn(async () => ({})),+}));+vi.mock('../services/githubAccounts.js', () => accounts);+vi.mock('../services/githubNotifications.js', () => inbox);+vi.mock('../services/githubNotificationAudit.js', () => audit);++const { authGate, hostControlRouteGate } = await import('../services/authGate.js');+const { createSession } = await import('../services/auth.js');+const { default: githubRoutes } = await import('./github.js');++// [method, path, body, the service the request must not reach when refused]+const writes = [+ ['post', '/api/github/notifications/example-account/123', { action: 'unsubscribe' }, inbox.applyNotificationAction],+ ['post', '/api/github/audit/example-account/apply', { suggestionId: 'unwatch:example/repo' }, audit.applyAuditSuggestion],+ ['post', '/api/github/audit-changes/7/undo', {}, audit.undoAuditChange],+ ['post', '/api/github/automations/activity/7/undo', {}, inbox.undoAutomationAction],+ ['put', '/api/github/automations/schedule', { cadence: 'weekdays-15m' }, inbox.setNotificationCadence],+ ['post', '/api/github/accounts', { host: 'github.com', login: 'octocat', label: 'Example' }, accounts.createAccount],+ ['put', '/api/github/accounts/acct-example', { mode: 'autopilot' }, accounts.updateAccount],+];++const appFor = (address = '192.0.2.10') => {+ const app = express();+ app.use((req, _res, next) => {+ Object.defineProperty(req.socket, 'remoteAddress', { value: address });+ next();+ });+ app.use(authGate, hostControlRouteGate, express.json());+ app.use('/api/github', githubRoutes);+ app.use(errorMiddleware);+ return app;+};+const send = (app, [method, path, body], headers = {}) => {+ const pending = request(app)[method](path);+ for (const [name, value] of Object.entries(headers)) pending.set(name, value);+ return pending.send(body);+};++beforeEach(() => {+ vi.clearAllMocks();+ auth.enabled = false;+});++describe('GitHub inbox writes require operator authority (#12952)', () => {+ it('refuses a remote password-free caller, direct or proxied, before any gh write, CoS job or account change', async () => {+ for (const write of writes) {+ for (const [address, headers] of [+ ['192.0.2.10', {}],+ ['127.0.0.1', { [DEV_PROXY_CLIENT_ADDRESS_HEADER]: '192.0.2.10' }],+ ]) {+ const response = await send(appFor(address), write, headers);+ expect([response.status, response.body.code], write[1]).toEqual([403, 'HOST_CONTROL_FORBIDDEN']);+ }+ expect(write[3], write[1]).not.toHaveBeenCalled();+ }+ });++ it('keeps every write working for local callers, operator sessions and delegated agent sessions', async () => {+ const operator = await createSession();+ const agent = await createSession({ label: 'agent' });+ for (const [enabled, address, headers] of [+ [false, '127.0.0.1', {}],+ [true, '192.0.2.10', { Authorization: `Bearer ${operator.token}` }],+ [true, '192.0.2.10', { Authorization: `Bearer ${agent.token}` }],+ ]) {+ auth.enabled = enabled;+ for (const write of writes) {+ const response = await send(appFor(address), write, headers);+ expect(response.status, `${write[1]}: ${JSON.stringify(response.body)}`).toBeLessThan(300);+ }+ }+ for (const write of writes) expect(write[3], write[1]).toHaveBeenCalledTimes(3);+ });++ it('leaves the refresh, deletions and the read-only audit run open, with automation only for host control', async () => {+ for (const write of [+ ['delete', '/api/github/accounts/acct-example', undefined, accounts.deleteAccount],+ ['delete', '/api/github/automations/rules/7', undefined, inbox.deleteLearnedRule],+ ['post', '/api/github/audit/example-account', {}, audit.runAccountAudit],+ ]) {+ expect((await send(appFor(), write)).status, write[1]).toBe(200);+ expect(write[3]).toHaveBeenCalledTimes(1);+ }++ const remote = await send(appFor(), ['post', '/api/github/notifications/sync', { accountId: 'example-account' }]);+ expect(remote.status).toBe(200);+ expect(inbox.syncAccountNotifications).toHaveBeenLastCalledWith('example-account', { automate: false });+ await send(appFor(), ['post', '/api/github/notifications/sync', {}]);+ expect(inbox.syncAllNotifications).toHaveBeenLastCalledWith({ automate: false });++ await send(appFor('127.0.0.1'), ['post', '/api/github/notifications/sync', { accountId: 'example-account' }]);+ expect(inbox.syncAccountNotifications).toHaveBeenLastCalledWith('example-account', { automate: true });+ auth.enabled = true;+ const agent = await createSession({ label: 'agent' });+ await send(appFor(), ['post', '/api/github/notifications/sync', {}], { Authorization: `Bearer ${agent.token}` });+ expect(inbox.syncAllNotifications).toHaveBeenLastCalledWith({ automate: true });+ });+});diff --git a/server/routes/hostControlStoryboards.test.js b/server/routes/hostControlStoryboards.test.jsnew file mode 100644index 0000000000..e50307c247--- /dev/null+++ b/server/routes/hostControlStoryboards.test.js@@ -0,0 +1,170 @@+import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';+import express from 'express';+import { request } from '../lib/testHelper.js';+import { errorMiddleware } from '../lib/errorHandler.js';+import { DEV_PROXY_CLIENT_ADDRESS_HEADER } from '../../lib/portosAuthCore.js';+import { cleanupTempDataRoots, lazyTempDataRoot, makePathsProxy } from '../lib/mockPathsDataRoot.js';+import { scanRouteGraph } from '../lib/apiRouteGraph.js';+import { isHostControlRoute } from '../lib/hostControlRoutes.js';++vi.mock('../lib/fileUtils.js', async (importOriginal) =>+ makePathsProxy(await importOriginal(), { dataRoot: () => lazyTempDataRoot('portos-storyboards-host-control-') }));+afterAll(cleanupTempDataRoots);++// Storyboards agent runs (#12952). Real router behind the real auth and+// host-control gates. Beat extraction runs for real up to the provider sink,+// so a synthetic CLI provider proves the gate stands before+// `runPromptThroughProvider`; the panel maker's run and make-empty services are+// doubled, so neither a provider call nor an image job can start.+const auth = vi.hoisted(() => ({ enabled: false }));+const cliProvider = vi.hoisted(() => ({+ id: 'example-cli', name: 'Example CLI', type: 'cli', enabled: true, command: 'example-agent', args: [], defaultModel: 'example-model',+}));+const sink = vi.hoisted(() => ({+ runPromptThroughProvider: vi.fn(async () => ({ text: '{"beats":[{"title":"Arrival","panels":[{"action":"Wide of the doors"}]}]}' })),+ enqueueJob: vi.fn(async () => ({ jobId: 'job-example' })),+}));++vi.mock('../services/auth.js', async (importOriginal) => ({+ ...await importOriginal(),+ isAuthEnabled: vi.fn(async () => auth.enabled),+ verifyPassword: vi.fn(async () => true),+}));+vi.mock('../services/settings.js', () => ({+ settingsEvents: { on: vi.fn(), off: vi.fn(), emit: vi.fn() },+ getSettings: vi.fn(async () => ({})),+}));+vi.mock('../services/promptRunner.js', async (importOriginal) => ({+ ...await importOriginal(),+ resolveProviderAndModel: vi.fn(async () => ({ provider: cliProvider, selectedModel: 'example-model' })),+ runPromptThroughProvider: sink.runPromptThroughProvider,+}));+vi.mock('../services/mediaJobQueue/index.js', async (importOriginal) => ({+ ...await importOriginal(),+ enqueueJob: sink.enqueueJob,+}));+vi.mock('../services/storyboards/make.js', async (importOriginal) => ({+ ...await importOriginal(),+ runPanelNode: vi.fn(async () => ({ ok: true })),+ startMakeEmpty: vi.fn(async () => ({ status: 'running' })),+}));++const { authGate, hostControlRouteGate } = await import('../services/authGate.js');+const { createSession } = await import('../services/auth.js');+const { runPanelNode, startMakeEmpty } = await import('../services/storyboards/make.js');+const { default: storyboardRoutes } = await import('./storyboards.js');++const GATED = [+ 'POST /api/storyboards/:id/beats/extract',+ 'POST /api/storyboards/:id/make-empty',+ 'POST /api/storyboards/:id/panels/:panelId/make/:nodeId/run',+];+const effects = [sink.runPromptThroughProvider, sink.enqueueJob, runPanelNode, startMakeEmpty];++const appFor = (address = '192.0.2.10') => {+ const app = express();+ app.use((req, _res, next) => {+ Object.defineProperty(req.socket, 'remoteAddress', { value: address });+ next();+ });+ app.use(authGate, hostControlRouteGate, express.json());+ app.use('/api/storyboards', storyboardRoutes);+ app.use(errorMiddleware);+ return app;+};+const post = (app, path, body = {}, headers = {}) => {+ const pending = request(app).post(path);+ for (const [name, value] of Object.entries(headers)) pending.set(name, value);+ return pending.send(body);+};++// A remote password-free caller can still create the board the runs act on.+const newBoard = async () => {+ const created = await post(appFor(), '/api/storyboards', { name: 'Example Story' });+ expect(created.status).toBe(201);+ return created.body.id;+};+const operations = (id) => [+ [`/api/storyboards/${id}/beats/extract`, { plot: 'Example plot', providerId: cliProvider.id }, 200],+ [`/api/storyboards/${id}/panels/panel-example/make/node-example/run`, {}, 200],+ [`/api/storyboards/${id}/make-empty`, {}, 202],+];+const expectNoEffects = () => {+ for (const effect of effects) expect(effect).not.toHaveBeenCalled();+};++beforeEach(() => {+ vi.clearAllMocks();+ auth.enabled = false;+});++describe('Storyboards agent runs require operator authority (#12952)', () => {+ it('gates exactly the three runs; every other Storyboards mutation stores records and stays open', () => {+ const mutations = scanRouteGraph().routes+ .filter((route) => route.mountPath === '/api/storyboards' && route.method !== 'GET')+ .map(({ method, path }) => `${method} ${path}`);+ expect(mutations.filter((route) => isHostControlRoute(...route.split(' '))).sort()).toEqual(GATED);+ expect(mutations.filter((route) => !isHostControlRoute(...route.split(' '))).sort()).toEqual([+ 'DELETE /api/storyboards/:id',+ 'DELETE /api/storyboards/:id/beats/:beatId',+ 'DELETE /api/storyboards/:id/panels/:panelId',+ 'DELETE /api/storyboards/:id/panels/:panelId/takes/:takeId',+ 'DELETE /api/storyboards/recipes/:recipeId',+ 'PATCH /api/storyboards/:id',+ 'PATCH /api/storyboards/:id/beats/:beatId',+ 'PATCH /api/storyboards/:id/panels/:panelId',+ 'PATCH /api/storyboards/:id/panels/:panelId/make/:nodeId',+ 'POST /api/storyboards',+ 'POST /api/storyboards/:id/beats',+ 'POST /api/storyboards/:id/beats/:beatId/move',+ 'POST /api/storyboards/:id/beats/:beatId/panels',+ 'POST /api/storyboards/:id/beats/add',+ 'POST /api/storyboards/:id/panels/:panelId/move',+ 'POST /api/storyboards/:id/panels/:panelId/takes',+ 'POST /api/storyboards/:id/panels/:panelId/takes/:takeId/select',+ 'POST /api/storyboards/fit-music-video/:projectId',+ 'POST /api/storyboards/from-music-video/:projectId',+ 'POST /api/storyboards/recipes',+ 'PUT /api/storyboards/:id/recipe',+ ]);+ });++ it('refuses a remote password-free caller, including spoofed-proxy variants and path spellings, before any provider call or render', async () => {+ const id = await newBoard();+ for (const [path, body] of operations(id)) {+ for (const [address, headers, spelling] of [+ ['192.0.2.10', {}, path],+ ['127.0.0.1', { [DEV_PROXY_CLIENT_ADDRESS_HEADER]: '192.0.2.10' }, path],+ ['192.0.2.10', { [DEV_PROXY_CLIENT_ADDRESS_HEADER]: '127.0.0.1' }, path],+ ['192.0.2.10', {}, `${path.toUpperCase()}/`],+ ]) {+ const response = await post(appFor(address), spelling, body, headers);+ expect([response.status, response.body.code], spelling).toEqual([403, 'HOST_CONTROL_FORBIDDEN']);+ }+ }+ expectNoEffects();+ });++ it('keeps working for local callers, operator sessions and delegated agent sessions', async () => {+ const id = await newBoard();+ const operator = await createSession();+ const agent = await createSession({ label: 'agent' });+ for (const [enabled, address, headers] of [+ [false, '127.0.0.1', {}],+ [true, '192.0.2.10', { Authorization: `Bearer ${operator.token}` }],+ [true, '192.0.2.10', { Authorization: `Bearer ${agent.token}` }],+ ]) {+ auth.enabled = enabled;+ for (const [path, body, status] of operations(id)) {+ const response = await post(appFor(address), path, body, headers);+ expect(response.status, `${path}: ${JSON.stringify(response.body)}`).toBe(status);+ }+ }+ expect(sink.runPromptThroughProvider).toHaveBeenCalledTimes(3);+ expect(sink.runPromptThroughProvider.mock.calls[0][0]).toEqual(expect.objectContaining({+ provider: cliProvider, source: 'storyboard-plot-beats',+ }));+ expect(runPanelNode).toHaveBeenCalledTimes(3);+ expect(startMakeEmpty).toHaveBeenCalledTimes(3);+ });+});diff --git a/server/services/githubNotifications.db.test.js b/server/services/githubNotifications.db.test.jsindex dd5d5a12d1..c5b095e9ee 100644--- a/server/services/githubNotifications.db.test.js+++ b/server/services/githubNotifications.db.test.js@@ -583,6 +583,35 @@ describe.skipIf(!runDb)('GitHub notifications inbox against Postgres', () => {expect(await setNotificationCadence('off')).toMatchObject({ cadence: 'off', cronExpression: '*/15 * * * 1-5' });});+ it('fetches and triages without Assist or Autopilot when the sync caller lacks host control (#12952)', async () => {+ await updateAccount(account.id, { mode: 'autopilot' });+ vi.mocked(getAllApps).mockResolvedValue([{ id: 'app-acme', name: 'Acme App', repoPath: '/example/acme-app' }]);+ vi.mocked(listExternalOpenPullRequests).mockResolvedValue({ ok: true, prs: [{ number: 1201, headRefOid: 'b'.repeat(40) }] });+ vi.mocked(triggerOnDemandTask).mockReset().mockImplementation(async (taskType) => ({ id: `demand-${taskType}` }));+ vi.mocked(runUntrustedContentAnalysis).mockResolvedValue({ ok: true, value: { verdict: 'done' } });+ const actions = mockGh(() => listing([+ thread('1201', { owner: 'acme', repo: 'app', reason: 'review_requested' }),+ thread('1202', { owner: account.login }),+ ]), {+ 'repos/acme/app/pulls/1201': { author: 'mallory', association: 'NONE', state: 'open', merged: false },+ 'repos/acme/app/collaborators/mallory/permission': { user: { login: 'mallory' }, permission: 'read' },+ [`repos/${account.login}/hello/pulls/1202`]: { author: account.login, association: 'OWNER', state: 'closed', merged: true },+ });++ const refresh = await syncAccountNotifications(account.id, { automate: false });+ expect(refresh).toMatchObject({ fetched: 2, triage: expect.objectContaining({ triaged: 2 }), assist: { skipped: 'no-host-control', handedOff: 0 } });+ expect(await getNotification(account.id, '1201')).toMatchObject({ state: 'open' });+ expect(triggerOnDemandTask).not.toHaveBeenCalled();+ expect(runUntrustedContentAnalysis).not.toHaveBeenCalled();+ expect(actions).toEqual([]);++ // An operator/agent refresh (and the scheduled check) keeps the full run.+ expect((await syncAccountNotifications(account.id)).assist).toMatchObject({ handedOff: 1 });+ expect(triggerOnDemandTask).toHaveBeenCalledWith('pr-reviewer', 'app-acme', expect.objectContaining({ targetPullRequest: 1201 }));+ expect(actions).toEqual([['DELETE', 'notifications/threads/1202']]);+ vi.mocked(getAllApps).mockResolvedValue([]);+ });+it('runs the scheduled pass without any model call, respecting the poll interval', async () => {mockGh(() => listing([thread('801')]));const fetchSpy = vi.spyOn(globalThis, 'fetch').mockRejectedValue(new Error('no network in this test'));diff --git a/server/services/githubNotifications.js b/server/services/githubNotifications.jsindex 87b12400a8..40aadbafa1 100644--- a/server/services/githubNotifications.js+++ b/server/services/githubNotifications.js@@ -51,7 +51,13 @@ const ACTION_SPECS = {resubscribe: { method: 'PUT', path: '/subscription', fields: ['-F', 'ignored=false'], state: 'open' },};-const syncFlight = createSingleFlight();+// One flight per account, exclusive across its keys: a sync that may run+// Assist/Autopilot never joins (or overlaps) a fetch-only one, and vice versa.+const syncFlights = new Map();+const syncFlightFor = (accountId) => {+ if (!syncFlights.has(accountId)) syncFlights.set(accountId, createSingleFlight({ exclusive: true }));+ return syncFlights.get(accountId);+};const isNotModified = (error) => /\bHTTP 304\b/.test(String(error?.ghStderr || error?.message || ''));@@ -117,10 +123,14 @@ async function recordSyncError(accountId, message) {);}+// A sync requested without host control (#12952) fetches and triages only.+const SKIPPED_AUTOMATION = Object.freeze({ sorted: 0, acted: 0, handedOff: 0, agentRuns: 0, skipped: 'no-host-control' });+// Autopilot hands threads to their lanes first, so a thread a lane now owns// is not also sorted by Assist. Loaded lazily: the hand-off reaches the CoS// task schedule, which itself registers this module's scheduled check.-async function runAutomation(account, env) {+async function runAutomation(account, env, automate) {+ if (!automate) return SKIPPED_AUTOMATION;const autopilot = account.mode === 'autopilot'? await (await import('./githubNotificationAutopilot.js')).autopilotAccountNotifications(account): { handedOff: 0, agentRuns: 0 };@@ -130,7 +140,7 @@ async function runAutomation(account, env) {return { ...assist, handedOff: autopilot.handedOff, agentRuns: autopilot.agentRuns };}-async function syncAccountNow(account) {+async function syncAccountNow(account, automate) {const env = await requireAccountEnv(account);const cursor = (await query('SELECT last_modified FROM github_notification_sync WHERE account_id = $1', [account.id])).rows[0];const first = await fetchPage(account, env, 1, cursor?.last_modified || null);@@ -138,7 +148,7 @@ async function syncAccountNow(account) {await query('UPDATE github_notification_sync SET last_sync_at = NOW(), last_error = \'\', updated_at = NOW() WHERE account_id = $1', [account.id]);// Threads past the last run's triage cap still need a decision.const triage = await triageAccountNotifications(account, env);- const assist = await runAutomation(account, env);+ const assist = await runAutomation(account, env, automate);if (triage.triaged || assist.sorted || assist.acted || assist.handedOff) githubNotificationEvents.emit('changed', { accountId: account.id });return { accountId: account.id, changed: false, fetched: 0, triage, assist };}@@ -177,27 +187,30 @@ async function syncAccountNow(account) {);});const triage = await triageAccountNotifications(account, env);- const assist = await runAutomation(account, env);+ const assist = await runAutomation(account, env, automate);githubNotificationEvents.emit('changed', { accountId: account.id });console.log(`📬 Synced ${records.length} GitHub notifications for ${account.host}${truncated ? ' (listing truncated)' : ''}, triaged ${triage.triaged}, sorted ${assist.sorted}, acted on ${assist.acted}, handed off ${assist.handedOff}`);return { accountId: account.id, changed: true, fetched: records.length, truncated, triage, assist };}-/** Fetch one account's unread notifications, coalescing concurrent requests. */-export async function syncAccountNotifications(accountId) {+/**+ * Fetch one account's unread notifications, coalescing concurrent requests.+ * `automate: false` (a caller without host control) skips Assist/Autopilot.+ */+export async function syncAccountNotifications(accountId, { automate = true } = {}) {const account = await getAccount(accountId);- return syncFlight.run(account.id, () => syncAccountNow(account).catch(async (error) => {+ return syncFlightFor(account.id).run(automate, () => syncAccountNow(account, automate).catch(async (error) => {await recordSyncError(account.id, error.message).catch(() => {});throw error;}));}/** Sync every enabled account; one account's failure never hides another's result. */-export async function syncAllNotifications() {+export async function syncAllNotifications(options = {}) {const accounts = (await listAccounts()).filter((account) => account.enabled);const results = [];for (const account of accounts) {- results.push(await syncAccountNotifications(account.id)+ results.push(await syncAccountNotifications(account.id, options).then((result) => ({ ...result, ok: true })).catch((error) => ({ accountId: account.id, ok: false, error: error.message })));}