claude-code-session-manager 0.142.0 → 0.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +22 -107
  3. package/dist/assets/AppSettings-Z68gQiVE.js +2 -0
  4. package/dist/assets/{History-DpZuJXi1.js → History-C3E6y_7t.js} +2 -2
  5. package/dist/assets/HomeClaudeConfig-Yd1vXzBn.js +5 -0
  6. package/dist/assets/{Panel-BjdJjhqt.js → Panel-CnfWs46Z.js} +1 -1
  7. package/dist/assets/ProjectClaudeConfig-CP0Wsg-H.js +26 -0
  8. package/dist/assets/Scheduler-D8un7N3B.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-Cqyu4mef.js → SkillReferenceGraph-DRtZV1Al.js} +1 -1
  10. package/dist/assets/{Skills-vv0noNVI.js → Skills-Bg5O2Hyn.js} +23 -23
  11. package/dist/assets/{TiptapBody-CXi8Pvut.js → TiptapBody-BdzoBmqu.js} +27 -27
  12. package/dist/assets/{Toggle-CiYCWLjh.js → Toggle-Dt5K1OXt.js} +1 -1
  13. package/dist/assets/{VoiceButton-4NKKd1sC.js → VoiceButton-CTLyRgdF.js} +1 -1
  14. package/dist/assets/{historyTotals-DDunb8Ch.js → historyTotals-B2_KWBga.js} +1 -1
  15. package/dist/assets/{index-Cn5E9958.js → index-446b69rr.js} +715 -714
  16. package/dist/assets/{index-DVHIHoJf.css → index-BJ5TJvmz.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +438 -435
  20. package/package.json +6 -4
  21. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  22. package/plugins/session-manager-dev/skills/builder/SKILL.md +5 -0
  23. package/plugins/session-manager-dev/skills/develop/SKILL.md +23 -16
  24. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +16 -2
  25. package/plugins/session-manager-dev/skills/maintaining-md-network/weekly-consolidation.md +87 -0
  26. package/scripts/README.md +1 -0
  27. package/scripts/scheduler-mcp-server.cjs +381 -6
  28. package/src/main/adminRouteRegistry.cjs +16 -0
  29. package/src/main/agentLibrary.cjs +60 -11
  30. package/src/main/agentsIpc.cjs +19 -0
  31. package/src/main/build-info.json +4 -4
  32. package/src/main/chatRunner.cjs +214 -7
  33. package/src/main/config.cjs +5 -1
  34. package/src/main/health.cjs +92 -14
  35. package/src/main/index.cjs +16 -4
  36. package/src/main/ipcSchemas.cjs +61 -1
  37. package/src/main/lib/claude/agentArmory.cjs +128 -0
  38. package/src/main/lib/claude/agentModelResolve.cjs +3 -2
  39. package/src/main/lib/claude/agentSnapshot.cjs +24 -3
  40. package/src/main/lib/claude/builtinTools.cjs +110 -0
  41. package/src/main/lib/claude/environmentProfiles.cjs +1 -1
  42. package/src/main/lib/claude/headlessMcpServers.cjs +138 -0
  43. package/src/main/lib/claude/jobSandboxPolicy.cjs +8 -2
  44. package/src/main/lib/claude/personaToolScope.cjs +77 -6
  45. package/src/main/lib/demo-video-kit/cast.md +10 -1
  46. package/src/main/lib/demo-video-kit/character.cjs +77 -21
  47. package/src/main/lib/demo-video-kit/kind-tiktok.md +5 -1
  48. package/src/main/lib/demo-video-kit/projectSounds.cjs +191 -0
  49. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  50. package/src/main/lib/demo-video-kit/sound.cjs +166 -9
  51. package/src/main/lib/demo-video-kit/standalone.cjs +231 -0
  52. package/src/main/lib/epic/activeIndexMerge.cjs +5 -0
  53. package/src/main/lib/epic/artifactRetention.cjs +55 -9
  54. package/src/main/lib/epic/artifactStore.cjs +78 -35
  55. package/src/main/lib/epic/delegationReadiness.cjs +10 -3
  56. package/src/main/lib/epic/epicDepsSync.cjs +66 -0
  57. package/src/main/lib/epic/epicEventLog.cjs +45 -1
  58. package/src/main/lib/epic/epicOutsideRead.cjs +38 -1
  59. package/src/main/lib/epic/epicSettle.cjs +48 -4
  60. package/src/main/lib/epic/epicSpawnPlan.cjs +3 -1
  61. package/src/main/lib/epic/epicStateEmitter.cjs +248 -0
  62. package/src/main/lib/epic/epicValidationHook.cjs +22 -3
  63. package/src/main/lib/epic/planReviewInput.cjs +123 -0
  64. package/src/main/lib/epic/restorableSessions.cjs +1 -0
  65. package/src/main/lib/epic/scriptStartedBy.cjs +71 -0
  66. package/src/main/lib/externalContract.cjs +24 -1
  67. package/src/main/lib/feedback-remote/autoStartedSession.cjs +1 -1
  68. package/src/main/lib/feedback-remote/createdProjects.cjs +291 -0
  69. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +24 -2
  70. package/src/main/lib/feedback-remote/crossProjectReply.cjs +96 -8
  71. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +54 -3
  72. package/src/main/lib/feedback-remote/pendingReplies.cjs +22 -0
  73. package/src/main/lib/feedback-remote/projectCreate.cjs +415 -0
  74. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +94 -4
  75. package/src/main/lib/feedback-remote/replyClaims.cjs +168 -0
  76. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +29 -1
  77. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +43 -2
  78. package/src/main/lib/feedback-remote/servicePairLocalRoutes.cjs +91 -0
  79. package/src/main/lib/feedback-remote/servicePairings.cjs +47 -7
  80. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +99 -1
  81. package/src/main/lib/git/gitWorktree.cjs +8 -0
  82. package/src/main/lib/git/runtimeStateUntrack.cjs +15 -1
  83. package/src/main/lib/git/worktreeDeps.cjs +119 -10
  84. package/src/main/lib/mcpToolCatalog.cjs +144 -12
  85. package/src/main/lib/mcpToolsProbe.cjs +19 -2
  86. package/src/main/lib/opsOwnership.cjs +113 -28
  87. package/src/main/lib/packs/packCatalog.cjs +98 -5
  88. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +6 -0
  89. package/src/main/lib/persona-macro/builtinMacros.cjs +6 -4
  90. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +9 -0
  91. package/src/main/lib/persona-macro/personaLoadout.cjs +58 -0
  92. package/src/main/lib/persona-macro/personaMerge.cjs +11 -3
  93. package/src/main/lib/persona-macro/personaUpgrade.cjs +96 -0
  94. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +1 -1
  95. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +140 -0
  96. package/src/main/lib/prd/prdCreate.cjs +395 -229
  97. package/src/main/lib/prd/prdCriteria.cjs +7 -4
  98. package/src/main/lib/prd/prdFrontmatter.cjs +5 -2
  99. package/src/main/lib/prd/prdMcpReachWarnings.cjs +44 -0
  100. package/src/main/lib/prd/prdSandboxWarnings.cjs +49 -0
  101. package/src/main/lib/process/peerChatSession.cjs +165 -0
  102. package/src/main/lib/project-pages/videoPressLines.cjs +145 -0
  103. package/src/main/lib/project-pages/videoScriptPress.cjs +266 -0
  104. package/src/main/lib/project-pages/videoScriptRunRoute.cjs +371 -0
  105. package/src/main/lib/project-pages/videoScriptSwitchIpc.cjs +49 -0
  106. package/src/main/lib/project-pages/videoScriptSwitchRoute.cjs +173 -0
  107. package/src/main/lib/promptSessionSchema.cjs +2 -0
  108. package/src/main/lib/scheduler/baselineGate.cjs +31 -2
  109. package/src/main/lib/scheduler/criteriaChecks.cjs +164 -20
  110. package/src/main/lib/scheduler/heldSchedulerTurns.cjs +238 -0
  111. package/src/main/lib/scheduler/jobMemoryStats.cjs +13 -2
  112. package/src/main/lib/scheduler/planRecordHarvest.cjs +215 -55
  113. package/src/main/lib/scheduler/planReleaseRoute.cjs +110 -0
  114. package/src/main/lib/scheduler/planReviewSchema.cjs +182 -0
  115. package/src/main/lib/scheduler/planReviewStats.cjs +63 -0
  116. package/src/main/lib/scheduler/planReviewStore.cjs +128 -0
  117. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +60 -2
  118. package/src/main/lib/scheduler/queueStore.cjs +16 -0
  119. package/src/main/lib/scheduler/rcaReport.cjs +79 -15
  120. package/src/main/lib/scheduler/sandboxEnvironmentLimit.cjs +141 -0
  121. package/src/main/lib/scheduler/scheduleJobSchema.cjs +15 -0
  122. package/src/main/lib/scheduler/schedulerPaths.cjs +9 -0
  123. package/src/main/lib/scheduler/slotsRoute.cjs +101 -87
  124. package/src/main/lib/scheduler/upgradeDrain.cjs +32 -5
  125. package/src/main/lib/scheduler/usageHoldRoute.cjs +97 -0
  126. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +28 -7
  127. package/src/main/lib/tasks/memoryConsolidation.cjs +123 -39
  128. package/src/main/lib/tasks/mitigationReview.cjs +21 -1
  129. package/src/main/lib/tasks/taskAdminRoutes.cjs +104 -17
  130. package/src/main/lib/tasks/taskLedger.cjs +2 -2
  131. package/src/main/lib/tasks/taskRun.cjs +3 -1
  132. package/src/main/lib/tasks/weeklyConsolidationInputs.cjs +178 -0
  133. package/src/main/lib/telemetry/auditEvents.cjs +21 -24
  134. package/src/main/lib/telemetry/auditLog.cjs +6 -2
  135. package/src/main/lib/util/atomicFs.cjs +2 -2
  136. package/src/main/projectPages.cjs +22 -14
  137. package/src/main/promptSessionEvents.cjs +16 -1
  138. package/src/main/pty.cjs +14 -2
  139. package/src/main/queueOps.cjs +1 -1
  140. package/src/main/runVerify.cjs +4 -3
  141. package/src/main/scheduler/planReviewHold.cjs +140 -0
  142. package/src/main/scheduler/prdParser.cjs +1 -0
  143. package/src/main/scheduler/reviewLadder.cjs +2 -0
  144. package/src/main/scheduler/utilizationHold.cjs +101 -6
  145. package/src/main/scheduler.cjs +1055 -107
  146. package/src/main/seedAgentPersonas.cjs +11 -6
  147. package/src/main/seedStatus.cjs +1 -1
  148. package/src/main/templates/PRD_AUTHORING.md +22 -2
  149. package/src/main/webRemote.cjs +47 -7
  150. package/src/preload/api.d.ts +118 -2
  151. package/src/preload/apiSurface.json +42 -0
  152. package/src/preload/index.cjs +11 -0
  153. package/src/seed/agents/architect.md +28 -43
  154. package/src/seed/agents/demo-video-builder.md +15 -8
  155. package/src/seed/agents/dev-lead.md +3 -1
  156. package/src/seed/agents/md-network-curator.md +27 -0
  157. package/src/seed/agents/plan-reviewer.md +47 -0
  158. package/src/seed/agents/validator.md +21 -19
  159. package/dist/assets/AppSettings-BcZgIvvY.js +0 -2
  160. package/dist/assets/HomeClaudeConfig-D32ZJtU-.js +0 -3
  161. package/dist/assets/ProjectClaudeConfig-BTClYV6i.js +0 -26
  162. package/dist/assets/Scheduler-DPobKx1Z.js +0 -16
@@ -13,8 +13,9 @@
13
13
  * bundled file's own stamp. Same or higher stays untouched. Lower checks
14
14
  * the installed file's body against every body this app has ever shipped
15
15
  * for that persona (`lib/persona-macro/shippedPersonaSeeds.cjs`). No match means a
16
- * person wrote or edited that file; it is left alone and the skip is
17
- * logged. Why: a lower stamp alone does not prove the file is a stale
16
+ * person wrote or edited that file; it is left alone, the skip is
17
+ * logged, and the Agent Library shows it as a newer version available
18
+ * (lib/persona-macro/personaUpgrade.cjs). Why: a lower stamp alone does not prove the file is a stale
18
19
  * shipped copy — only a body match does. A match replaces the installed
19
20
  * file with the bundled one. Frontmatter keys the user changed are kept,
20
21
  * including a `model:` line the user removed entirely; keys the user
@@ -80,7 +81,7 @@ const { writeJsonSync, writeTextAtomic, validatePath, validateWrite } = require(
80
81
  const { splitFrontmatter } = require('./lib/prd/prdFrontmatter.cjs');
81
82
  const { SHIPPED_PERSONA_SEEDS } = require('./lib/persona-macro/shippedPersonaSeeds.cjs');
82
83
 
83
- const PERSONAS = ['architect', 'dev-lead', 'project-home-builder', 'validator', 'demo-video-builder', 'blender-artist', 'competitive-researcher', 'competitive-analyst'];
84
+ const PERSONAS = ['architect', 'dev-lead', 'project-home-builder', 'validator', 'demo-video-builder', 'blender-artist', 'competitive-researcher', 'competitive-analyst', 'plan-reviewer', 'md-network-curator'];
84
85
  // What `{ done: true }` (the pre-seeded-set marker format) meant: only these two personas existed
85
86
  // in PERSONAS at the time. Fixed, not derived from the current PERSONAS array above — otherwise
86
87
  // every future persona added to PERSONAS would retroactively count as already delivered to a
@@ -309,7 +310,8 @@ async function upgradeStalePersonas({ logger = console, writeLog = () => {}, shi
309
310
  if (!fs.existsSync(destPath)) continue; // nothing installed yet — the first-seed pass below owns this name
310
311
  try {
311
312
  const bundledText = fs.readFileSync(path.join(srcDir, `${name}.md`), 'utf8');
312
- const installedText = fs.readFileSync(destPath, 'utf8');
313
+ const installedBytes = fs.readFileSync(destPath);
314
+ const installedText = installedBytes.toString('utf8');
313
315
  const bundledVersion = readSeedVersion(bundledText);
314
316
  const installedVersion = readSeedVersion(installedText);
315
317
  if (installedVersion >= bundledVersion) continue; // same or newer — never touched
@@ -335,10 +337,10 @@ async function upgradeStalePersonas({ logger = console, writeLog = () => {}, shi
335
337
  // catch below on failure.
336
338
  validateWrite(validatePath(destPath));
337
339
 
338
- const backupPath = backupPathFor(name, installedText);
340
+ const backupPath = backupPathFor(name, installedBytes);
339
341
  if (!fs.existsSync(backupPath)) {
340
342
  fs.mkdirSync(path.dirname(backupPath), { recursive: true });
341
- await writeTextAtomic(backupPath, installedText);
343
+ await writeTextAtomic(backupPath, installedBytes);
342
344
  } // same content already backed up by an earlier attempt — never write a second copy
343
345
 
344
346
  const nextText = buildUpgradedPersona(bundledText, installedText, matches);
@@ -404,6 +406,9 @@ module.exports = {
404
406
  personaBodyHash,
405
407
  readSeedVersion,
406
408
  normalizeNewlines,
409
+ backupPathFor,
410
+ bundledSourceDir,
411
+ destAgentsDir,
407
412
  sameFmValue,
408
413
  markerPath,
409
414
  markerStatus,
@@ -47,7 +47,7 @@ const FIXES = {
47
47
  'dev-plugin': 'Open Plugins → Library and click Install next to "session-manager-dev".',
48
48
  'scheduler-mcp': () =>
49
49
  `Run in a terminal: claude mcp add ${seedSchedulerMcp.SERVER_NAME} --scope user -- node ${seedSchedulerMcp.serverScriptPath()}`,
50
- 'agent-personas': `Copy ${seedAgentPersonas.PERSONAS.map((n) => `src/seed/agents/${n}.md`).join(', ')} into ~/.claude/agents/ (skip any that already exist there).`,
50
+ 'agent-personas': `Copy ${seedAgentPersonas.PERSONAS.map((n) => `src/seed/agents/${n}.md`).join(', ')} into ~/.claude/agents/, copying only the ones that are missing. Installed copies you never edited update on their own at app start; a copy you edited is kept, and a newer bundled version is offered in the Agent Library.`,
51
51
  };
52
52
 
53
53
  /** { 'dev-plugin': {status, fix}, 'scheduler-mcp': {status, fix}, 'agent-personas': {status, fix} } */
@@ -1,4 +1,4 @@
1
- <!-- PRD_AUTHORING.md v28 -->
1
+ <!-- PRD_AUTHORING.md v36 -->
2
2
  # PRD Authoring Guide — Scheduler Safety Rules
3
3
 
4
4
  Rule: every PRD you queue follows the rules below.
@@ -143,12 +143,27 @@ A short Epic-context digest is prepended automatically for orientation only —
143
143
 
144
144
  The executor can't ask you anything: no `ScheduleWakeup`, Cron, Monitor, `AskUserQuestion`, plan mode, or worktree tools; background tasks are off (a `timeout` command is always on PATH — the app installs a shim on macOS). It must never stop to ask a question — it makes the safest reasonable call and reports it, so write the PRD so that call is obvious.
145
145
 
146
- Worktree reach: every PRD runs in an isolated git worktree holding tracked files plus `node_modules` and non-uv `.venv`/`venv` symlinked from the main checkout; pnpm projects (pnpm-lock.yaml) get a worktree-local `node_modules` installed offline from the store, and uv projects (uv.lock) get a worktree-local env built by an offline frozen `uv sync`, not a symlink. Why: a pnpm install through the symlink purged the main checkout's node_modules (Bilko-Game-Academy 2026-10-18). A step that needs gitignored runtime state (databases, downloads/, browser profiles, logs) or a live side effect must address the main checkout by absolute path (e.g. `$HOME/Projects/<repo>/...`), be artifact-only (a deliverable artifact + `artifactPaths`, no tracked edits), and `dependsOn` the PRD that lands its tracked edits. A project may declare `worktreeSetup` gate-syntax commands in a tracked `.session-manager.json` at the repo root; they run once per fresh job worktree and baseline scratch worktree, before the executor starts, with cwd = the worktree root (a project in a subfolder names it, e.g. `timeout 600 godot --headless --path game --import`). Setups run one at a time per project and are never skipped; they must write only inside the worktree (node_modules and non-uv venvs are symlinks into the main checkout). The outcome is the `[scheduler] worktree setup:` lines at the top of the run log plus `worktreeSetup` in the run's meta.json. Host crontab installs stay human-only (see §14).
146
+ Worktree reach: every PRD runs in an isolated git worktree holding tracked files plus linked dependencies: `node_modules` (the root and each nested npm package's) is a worktree-local folder whose entries link to the main checkout's, and non-uv `.venv`/`venv` is symlinked whole; pnpm projects (pnpm-lock.yaml) get a worktree-local `node_modules` installed offline from the store, and uv projects (uv.lock) get a worktree-local env built by an offline frozen `uv sync`, not a symlink. Why: a pnpm install through the symlink purged the main checkout's node_modules (Bilko-Game-Academy 2026-10-18). A step that needs gitignored runtime state (databases, downloads/, browser profiles, logs) or a live side effect must address the main checkout by absolute path (e.g. `$HOME/Projects/<repo>/...`), be artifact-only (a deliverable artifact + `artifactPaths`, no tracked edits), and `dependsOn` the PRD that lands its tracked edits. A project may declare `worktreeSetup` gate-syntax commands in a tracked `.session-manager.json` at the repo root; they run once per fresh job worktree and baseline scratch worktree, before the executor starts, with cwd = the worktree root (a project in a subfolder names it, e.g. `timeout 600 godot --headless --path game --import`). Setups run one at a time per project and are never skipped; they must write only inside the worktree (node_modules entries and non-uv venvs link into the main checkout). The outcome is the `[scheduler] worktree setup:` lines at the top of the run log plus `worktreeSetup` in the run's meta.json. Host crontab installs stay human-only (see §14).
147
147
  Why: burrow PRD 1516 halted because its relative `.venv` python against downloads/fb-tracker.db, scripts/install-cron.sh and `pipeline-cron.sh --now` resolved inside the worktree (no runtime state; install-cron would bake a temporary worktree path into crontab), while sibling 1494 succeeded the same day using an absolute main-checkout path and artifact-only output. `scheduler_create_prd` warns on relative gitignored paths.
148
148
 
149
+ Live checks: A check against a running local service is an `http` criterion (loopback only, run by the scheduler outside the sandbox). `http` criteria are GET-only and send no credentials, so a bearer-authed route (Session Manager's own `/admin/*` routes) is never probed from a PRD gate, job step or criterion. The Epic's architect probes it read-only at PLAN SETTLED, publishes the record with `artifact_publish`, and a validator criterion cites the record's `storedPath` and `sha256`; see [Authenticated admin routes](../../../session-manager-operations/architecture/scheduler-operations.md#authenticated-admin-routes).
150
+
151
+ Rule: gates never run `npm ci` or `npm install` — dependencies are already linked, so an install only slows the run.
152
+ Why: `npm --prefix web/feedback-widget ci` through the old whole-folder link emptied the main checkout's web/feedback-widget/node_modules (session-manager, 2026-11-24).
153
+
149
154
  Rule: a job's processes never outlive it — the group sweep at exit, the job scope stop (systemd) and the 5-minute leftover sweep (Linux) stop anything it started, so `nohup` or `&` does not daemonize. Anything that must keep running goes to a service manager (systemd unit, cron), never `nohup` or `&`.
150
155
  Why: finished jobs left dev servers running for days, holding memory and ports.
151
156
 
157
+ ### Job sandbox limits
158
+
159
+ Rule: jobs under the OS sandbox (dev-lead, validator, any `osSandboxRequired` environment) must not depend on any of these:
160
+ - Bash writes under `.claude/` are refused (no `git mv`, `git rm` or `rm` there). **Any** write to `.claude/agents/`, `.claude/commands/`, `.claude/skills/`, `.claude/hooks/` or `.claude/settings*.json` is refused too, including by the Edit and Write tools (CLI mandatory write protections). A PRD must not list those paths in `# Files`; the architect edits them inline, outside the job sandbox. Why: PRD 4704 (2026-11-26) asked for an Edit on `.claude/agents/` and all three calls were denied.
161
+ - AF_UNIX socket bind/connect is refused (`Operation not permitted`).
162
+ - `/tmp` is read-only; only `$TMPDIR` (the job's private dir) is writable.
163
+
164
+ Gates must not run tests that open Unix sockets or hardcode `/tmp` — run those outside the job, or mark them skipped in the gate.
165
+ Why: the CLI sandbox protects `.claude/` config dirs even inside the worktree write root; Self PRDs 1326 and 1313 parked on exactly this.
166
+
152
167
  ---
153
168
 
154
169
  ## §8 Scope sizing — target ≤10 min, ceiling 15
@@ -243,6 +258,9 @@ Before queueing a new PRD, verify each of these:
243
258
  - [ ] **§6 Gate and files:** `gate` follows every rule in §6 (or is `["none"]` alone); `files` is 1–50 repo-relative paths, no overlap with a concurrent PRD.
244
259
  - [ ] **§7 Self-contained:** no reference to "the conversation" or outside context; paths/identifiers inline; clean UTF-8, no NUL bytes (`grep -qP '\x00' file && echo BAD`).
245
260
  - [ ] **§7 Worktree reach:** no relative path to a gitignored file; live-run steps use absolute main-checkout paths in an artifact-only PRD. Why: the job worktree has no gitignored runtime state, so relative paths fail or bake a temporary path into host config (burrow 1516).
261
+ - [ ] **§7 Job sandbox limits:** no gate or step uses Bash writes under `.claude/`, Unix sockets, or hardcoded `/tmp` (see [Job sandbox limits](#job-sandbox-limits)).
262
+ - [ ] **§7 No installs:** no gate runs `npm ci` or `npm install`. Why: dependencies are linked; an install through a link emptied the main checkout's web/feedback-widget/node_modules (2026-11-24).
263
+ - [ ] **No authed loopback probe:** no gate or criterion probes a bearer-authed loopback route (`/admin/*`); `http` criteria are GET-only with no credentials. Why: release checks 4539 and 4337 prescribed one and ended silent_no_op.
246
264
  - [ ] **§8 Scope:** targets ≤10 min, ceiling 15; e2e/publish sharded to one spec per PRD.
247
265
  - [ ] **§9 Failure surfacing:** errors exit 1 with a diagnostic line; no silent `|| true`.
248
266
  - [ ] **§10 Negative assertions:** every "should find nothing" check is inverted to exit 0 on the clean case.
@@ -253,4 +271,6 @@ Before queueing a new PRD, verify each of these:
253
271
  - [ ] **No interactive AC:** no criterion asks to launch the app, click through, capture a screenshot, run under xvfb or open a browser. Why: a headless run stalls on a rendered frame and is SIGTERM'd uncommitted; recommend manual visual confirmation in the report instead.
254
272
  - [ ] **Contract consumers gated:** a PRD that changes a return shape, IPC payload or remote contract greps `tests/` (and `src/**/__tests__`) for every spec using it and puts each in its gate and files. Why: scoped gates let other specs go red unseen until the release gate.
255
273
  - [ ] **Doc links gated:** a PRD that adds, moves or renames a markdown file runs the project's doc-link check in its gate when the project has one (in session-manager: `timeout 120 npm run lint:docs`). Why: PRD kit-cast-playbook added `src/main/lib/demo-video-kit/cast.md` with only the kit tests in its gate, so the orphan doc landed on 2026-11-23 and turned lint:docs red for the next PRD.
274
+ - [ ] **Size budgets gated:** a PRD that edits a file the project caps by size runs that cap's check in its gate when the project has one (in session-manager: README.md gates `timeout 120 npm run lint:readme`). Why: PRD 4105-web-remote-label-leftovers edited README.md with only lint:docs and typecheck in its gate, so README.md reached 24,026 bytes on 2026-11-24, over its cap, and npm run lint turned red for every later PRD.
256
275
  - [ ] **Gate purity:** a gate command must not create or modify tracked files; outputs go to the per-gate TMPDIR or a gitignored path. Why: a dirtied tree fails the clean-tree check.
276
+ - [ ] **Plan-review checklist** (the independent reviewer checks each queued PRD; check them yourself first): every criterion is provable from the tree or a read-only probe; a failure path is covered; one edge case is covered; no criterion is vacuous because a sibling PRD already satisfies it; every `dependsOn` is real (the PRD needs that PRD's output); the gate is green at base; a live-behavior change has an `http` criterion; a doc PRD depends on the code PRD it describes.
@@ -1308,7 +1308,7 @@ async function handleServiceHello(envelope, device, client, peerPubKey) {
1308
1308
  * Owner confirmed a pending service's SAS: check it against that client's own
1309
1309
  * SAS, then pin the key via store.confirmPending. Returns { ok, service } or { ok:false, error }.
1310
1310
  */
1311
- async function confirmServiceSas(pairingId, sas) {
1311
+ async function confirmServiceSas(pairingId, sas, { via } = {}) {
1312
1312
  const target = _clients.values().find((c) => c.role === 'service' && c.pendingPairingId === pairingId) || null;
1313
1313
  if (!target) return { ok: false, error: 'no_pending_service' };
1314
1314
  if (target.e2e.state !== 'pending_sas' || typeof target.e2e.pendingSas !== 'string') return { ok: false, error: 'wrong_state' };
@@ -1330,7 +1330,7 @@ async function confirmServiceSas(pairingId, sas) {
1330
1330
  target.e2e = confirmSasLogic(target.e2e).next;
1331
1331
  target.service = service;
1332
1332
  target.pendingPairingId = null;
1333
- await auditLog(new Date().toISOString(), 'service:confirm-sas', target.deviceId, undefined, `ok:service=${auditToken(service.serviceId)}`, target);
1333
+ await auditLog(new Date().toISOString(), 'service:confirm-sas', target.deviceId, undefined, `${via === 'local' ? 'ok:paired-locally:' : 'ok:'}service=${auditToken(service.serviceId)}`, target);
1334
1334
  finalizeE2eAuthenticated('paired service authenticated — SAS confirmed by owner', target);
1335
1335
  return { ok: true, service };
1336
1336
  }
@@ -1352,7 +1352,23 @@ async function pairedDevice() {
1352
1352
  function redactService(s) {
1353
1353
  if (!s) return s;
1354
1354
  const { pubKey: _omit, ...rest } = s;
1355
- return rest;
1355
+ return { ...rest, projectRoot: typeof rest.projectRoot === 'string' ? rest.projectRoot : null };
1356
+ }
1357
+
1358
+ const PROJECT_ROOT_ERROR = 'projectRoot must be an existing folder in your home folder';
1359
+
1360
+ /** True when p is an absolute path to an existing directory inside the home folder. */
1361
+ function isProjectRootOk(p) {
1362
+ if (typeof p !== 'string' || p.length === 0 || p.includes('\0') || !path.isAbsolute(p)) return false;
1363
+ try {
1364
+ // Resolve symlinks on both sides so a link inside home that points outside is refused.
1365
+ const real = fs.realpathSync(p);
1366
+ const rel = path.relative(fs.realpathSync(os.homedir()), real);
1367
+ if (rel === '' || rel === '..' || rel.startsWith('..' + path.sep) || path.isAbsolute(rel)) return false;
1368
+ return fs.statSync(real).isDirectory();
1369
+ } catch {
1370
+ return false;
1371
+ }
1356
1372
  }
1357
1373
 
1358
1374
  function logRelayFailure(op, r) {
@@ -1362,7 +1378,7 @@ function logRelayFailure(op, r) {
1362
1378
  });
1363
1379
  }
1364
1380
 
1365
- async function servicePairStart({ name, homeCwd, scope }) {
1381
+ async function startPairing({ name, homeCwd, scope, projectRoot }, pairedVia) {
1366
1382
  const device = await pairedDevice();
1367
1383
  if (!device) return { ok: false, error: 'no_paired_device' };
1368
1384
  const { SERVICE_TOOL_NAMES } = require('./lib/feedback-remote/servicePairings.cjs');
@@ -1370,6 +1386,8 @@ async function servicePairStart({ name, homeCwd, scope }) {
1370
1386
  if (!path.isAbsolute(homeCwd)) return { ok: false, error: 'homeCwd must be an absolute path' };
1371
1387
  const unknown = scope.find((t) => !SERVICE_TOOL_NAMES.includes(t));
1372
1388
  if (unknown) return { ok: false, error: `scope names an unknown tool: ${unknown}` };
1389
+ const wantsProjectCreate = scope.includes('project_create');
1390
+ if (wantsProjectCreate && !isProjectRootOk(projectRoot)) return { ok: false, error: PROJECT_ROOT_ERROR };
1373
1391
 
1374
1392
  const r = await relayRequest('POST', `${RELAY_API_BASE}/client-otp`, { body: {}, token: device.deviceToken });
1375
1393
  if (!isOk(r)) {
@@ -1381,18 +1399,38 @@ async function servicePairStart({ name, homeCwd, scope }) {
1381
1399
  const codeExpiresAt = Date.now() + CLIENT_OTP_TTL_MS;
1382
1400
  let pairingId;
1383
1401
  try {
1384
- ({ pairingId } = await getServiceStore().createPending({ name, homeCwd, scope }));
1402
+ ({ pairingId } = await getServiceStore().createPending({
1403
+ name, homeCwd, scope, projectRoot: wantsProjectCreate ? projectRoot : undefined, pairedVia,
1404
+ }));
1385
1405
  } catch (e) {
1386
1406
  return { ok: false, error: e?.message || 'pending pairing failed' };
1387
1407
  }
1388
- await auditLog(new Date().toISOString(), 'service:pair-start', device.deviceId, undefined, 'ok', null);
1408
+ await auditLog(new Date().toISOString(), 'service:pair-start', device.deviceId, undefined, pairedVia === 'local' ? 'ok:paired-locally' : 'ok', null);
1389
1409
  return { ok: true, code, pairingId, codeExpiresAt, deviceId: device.deviceId };
1390
1410
  }
1391
1411
 
1412
+ function servicePairStart(input) {
1413
+ return startPairing(input, 'window');
1414
+ }
1415
+
1416
+ /** Same-machine pairing without the window: refused while Web remote is off. */
1417
+ async function servicePairStartLocal(input) {
1418
+ if ((await loadConfig()).remoteEnabled !== true) return { ok: false, error: 'web_remote_off' };
1419
+ return startPairing(input, 'local');
1420
+ }
1421
+
1422
+ /** Confirms ONLY a 'local' pending pairing; the SAS check in confirmServiceSas still applies. */
1423
+ async function confirmServiceSasLocal(pairingId, sas) {
1424
+ if ((await loadConfig()).remoteEnabled !== true) return { ok: false, error: 'web_remote_off' };
1425
+ const pending = getServiceStore().listPending().find((p) => p.pairingId === pairingId);
1426
+ if (!pending || pending.pairedVia !== 'local') return { ok: false, error: 'not_local_pairing' };
1427
+ return confirmServiceSas(pairingId, sas, { via: 'local' });
1428
+ }
1429
+
1392
1430
  async function servicesList() {
1393
1431
  const store = getServiceStore();
1394
1432
  const services = store.list().map(redactService);
1395
- const pending = store.listPending();
1433
+ const pending = store.listPending().map(redactService);
1396
1434
  const known = new Set(services.map((s) => s.relayClientId).filter(Boolean));
1397
1435
  const device = await pairedDevice();
1398
1436
  if (!device) return { ok: true, services, pending, relayOrphans: [], relayError: 'no_paired_device' };
@@ -2172,6 +2210,8 @@ module.exports = {
2172
2210
  setServiceInvoker,
2173
2211
  getServiceStore,
2174
2212
  confirmServiceSas,
2213
+ servicePairStartLocal,
2214
+ confirmServiceSasLocal,
2175
2215
  servicePairCancel,
2176
2216
  attachWindow,
2177
2217
  registerRemoteHandlers,
@@ -369,7 +369,7 @@ export interface MacroJobDispatchInput {
369
369
  }
370
370
 
371
371
  export type MacroJobDispatchResult =
372
- | { ok: true; slug: string; epicId: string }
372
+ | { ok: true; slug: string; epicId: string; entryId: string | null; stage: 'review' | 'final' | null }
373
373
  | { ok: false; error: string; activeSlug?: string };
374
374
 
375
375
  export type MacroJobState = 'queued' | 'running' | 'done' | 'failed';
@@ -569,11 +569,45 @@ export type PacksListResult =
569
569
  /** `packs.terminalArgs` result — `--plugin-dir`/`--append-system-prompt` args, already composed by main. */
570
570
  export type PacksTerminalArgsResult = { ok: true; args: string[] };
571
571
 
572
+ /** One armory entry (`agentArmory.cjs`). */
573
+ export interface ArmoryItem {
574
+ id: string;
575
+ label: string;
576
+ badges: ('risky' | 'banned' | 'floor')[];
577
+ }
578
+ export interface ArmoryMcpItem extends ArmoryItem {
579
+ tools: ArmoryItem[];
580
+ status: 'not-checked' | 'checked' | 'failing';
581
+ scope: string;
582
+ }
583
+ export interface ArmoryPackItem extends ArmoryItem {
584
+ skills: string[];
585
+ source?: string;
586
+ }
587
+ export interface Armory {
588
+ builtins: ArmoryItem[];
589
+ bundledSkills: ArmoryItem[];
590
+ mcpServers: ArmoryMcpItem[];
591
+ packs: ArmoryPackItem[];
592
+ unpackedSkills: string[];
593
+ /** Sandbox environment profiles (`environmentProfiles.cjs`). */
594
+ environments: { name: string; summary: string }[];
595
+ errors: string[];
596
+ }
597
+
572
598
  /** One global `~/.claude/agents/<name>.md` persona, per the Agent Library nav page. */
573
599
  export interface AgentPersona {
574
600
  name: string;
575
601
  description: string | null;
576
602
  tools: string[];
603
+ /** The `tools:` decision: undecided (no line) / bare (`[]`) / equipped / unbound (`*`). */
604
+ loadout?: 'undecided' | 'bare' | 'equipped' | 'unbound';
605
+ /** Declared MCP servers (`mcpServers:`); [] = none. */
606
+ mcpServers?: string[];
607
+ /** Declared context packs (`packs:`); [] = none. */
608
+ packs?: string[];
609
+ /** Declared environment profile (`environment:`); null = headless-default. */
610
+ environment?: string | null;
577
611
  model: string | null;
578
612
  /** Per-Epic reasoning effort (`effort:` frontmatter; a `models.catalog` effort level). Null = inherit. Passed to the claude spawn as `--effort` (never `auto`). */
579
613
  effort: string | null;
@@ -597,6 +631,8 @@ export interface AgentPersona {
597
631
  title?: string | null;
598
632
  /** Bundled-persona version stamp (seedAgentPersonas.cjs). Null for a persona that was never seeded, or has no stamp. */
599
633
  seedVersion?: number | null;
634
+ /** Set when a newer bundled version exists that was not applied (edited file or unseen). Null/absent otherwise. */
635
+ upgrade?: { installedVersion: number; bundledVersion: number; edited: boolean; bundledBody: string } | null;
600
636
  /** `executorOnly: true` frontmatter — persona only executes a scoped PRD; New Epic warns when it is picked as Actor. */
601
637
  executorOnly?: boolean;
602
638
  path: string;
@@ -617,6 +653,14 @@ export interface AgentPersonaSaveInput {
617
653
  originalName?: string;
618
654
  description: string;
619
655
  tools: string[];
656
+ /** Global save only: the loadout decision encoding `tools:` (omit = derive from `tools`). */
657
+ loadout?: 'bare' | 'unbound' | 'equipped';
658
+ /** Global save: declared MCP servers; omit = keep the file's value, `[]` = none. */
659
+ mcpServers?: string[];
660
+ /** Global save: declared context packs; omit = keep the file's value, `[]` = none. */
661
+ packs?: string[];
662
+ /** Global save: declared environment profile; omit = keep the file's value. */
663
+ environment?: string;
620
664
  model: string;
621
665
  /** Effort level, or `'inherit'`/omitted to write no `effort:` line. */
622
666
  effort?: string;
@@ -1110,11 +1154,15 @@ export interface ScheduleJob {
1110
1154
  macroId?: string | null;
1111
1155
  /** Content id of the AgentSnapshot the first dispatch pinned; a resume re-runs it, never the live persona. */
1112
1156
  agentSnapshotId?: string;
1157
+ /** Validator only: dispatch-time { ids, failedIds } per judged PRD; the verdict is cross-checked against it, never a re-run. */
1158
+ validatorCriteriaExpected?: Record<string, { ids: string[]; failedIds: string[] }>;
1113
1159
  /** PRD frontmatter artifact-only declaration (PRD 3114). */
1114
1160
  deliverable?: 'artifact' | null;
1115
1161
  artifactPaths?: string[] | null;
1116
1162
  /** PRD frontmatter library voice (in-process only); handed to the job as SM_VOICE_ID. */
1117
1163
  voiceId?: string | null;
1164
+ /** PRD frontmatter persona (queue rows carry it; absent = dev-lead). */
1165
+ agentType?: string | null;
1118
1166
  slug: string;
1119
1167
  title: string;
1120
1168
  cwd: string | null;
@@ -1203,6 +1251,16 @@ export interface ScheduleJob {
1203
1251
  * lost — set whenever the commit-guard's worktree or in-place salvage
1204
1252
  * pass produced one (PRD 1098). */
1205
1253
  salvagePatch?: string | null;
1254
+ /** Artifact evidence spawnJob captured for a declared artifact-only PRD
1255
+ * before its job worktree was removed, bound to the capturing run's
1256
+ * `runId`; the stale needs_review rescan reuses it only for that run. */
1257
+ artifactEvidence?: {
1258
+ runId: string;
1259
+ ok: boolean;
1260
+ verified: unknown[];
1261
+ paths: string[];
1262
+ capturedAt: string;
1263
+ } | null;
1206
1264
  /** Commit + ref pinning a reaped run's uncommitted checkout work before the checkout was lost (PRD 2892). */
1207
1265
  uncommittedSnapshot?: { sha: string; ref: string };
1208
1266
  /** Why a pending row is not being dispatched this tick (worktree cap, launch circuit breaker). */
@@ -1455,6 +1513,8 @@ export interface ScheduleStateSnapshot {
1455
1513
  utilizationWindow?: string | null;
1456
1514
  /** Non-null while the when-available gate is holding the queue on utilization: which window, and its reset. */
1457
1515
  utilizationHold?: { window: string | null; percent: number; threshold: number; resetsAt: string | null } | null;
1516
+ /** Pro-rated 'pause above' for the binding window of the last known reading (rises from config.utilizationThreshold to 100 as the window nears reset). null with no known reading. */
1517
+ effectiveUtilizationThreshold?: number | null;
1458
1518
  /** Poll health — last billing poll result; used to detect stale utilization. */
1459
1519
  pollHealth?: SchedulePollHealth;
1460
1520
  /** Effective concurrency cap and whether it's env-pinned or config-driven. */
@@ -2255,6 +2315,26 @@ export type VideoReviewRetryResult =
2255
2315
  | { ok: true; slug: string; epicId: string; entryId?: string | null; stage?: string }
2256
2316
  | { ok: false; error: string; activeSlug?: string };
2257
2317
 
2318
+ // ────────────────────────────────────────────── Project Pages: 'Scripts may run Demo Video' switch
2319
+ // Mirrors src/main/lib/project-pages/videoScriptPress.cjs (getVideoScriptSwitch) and
2320
+ // src/main/lib/project-pages/videoScriptSwitchIpc.cjs (videos:script-switch-get / script-switch-set).
2321
+
2322
+ export interface VideoScriptSwitchGetPayload {
2323
+ cwd: string;
2324
+ }
2325
+
2326
+ export interface VideoScriptSwitchSetPayload {
2327
+ cwd: string;
2328
+ enabled: boolean;
2329
+ }
2330
+
2331
+ /** One project's switch; changedAt/by are null when it was never set. Same attribution shape as TaskSwitchBy. */
2332
+ export interface VideoScriptSwitchState {
2333
+ enabled: boolean;
2334
+ changedAt: string | null;
2335
+ by: TaskSwitchBy | null;
2336
+ }
2337
+
2258
2338
  // ────────────────────────────────────────────── Voices screen
2259
2339
  // Mirrors src/main/lib/demo-video-kit/voiceLibrary.cjs (listVoices) and
2260
2340
  // src/main/lib/project-pages/voicesIpc.cjs (voices:list / preview / approve / unapprove / delete).
@@ -2833,6 +2913,12 @@ export interface ChatExternalNewSessionResult {
2833
2913
  /** The minted Epic's id when `ok`. */
2834
2914
  epicId?: string;
2835
2915
  error?: string;
2916
+ /** Project Home entry id of the background build queued for a scripted job press (Demo Video). */
2917
+ entryId?: string;
2918
+ /** That build's slug. */
2919
+ slug?: string;
2920
+ /** That build's stage; null when it has none. */
2921
+ stage?: 'review' | 'final' | null;
2836
2922
  }
2837
2923
 
2838
2924
  export type CreateProjectFolderResult =
@@ -2890,7 +2976,8 @@ export type WebRemoteServiceTool =
2890
2976
  | 'macro_list'
2891
2977
  | 'macro_run'
2892
2978
  | 'epic_get'
2893
- | 'events_read';
2979
+ | 'events_read'
2980
+ | 'project_create';
2894
2981
 
2895
2982
  /** A paired service as the renderer sees it (its pinned key is never returned). */
2896
2983
  export interface WebRemoteService {
@@ -2898,9 +2985,13 @@ export interface WebRemoteService {
2898
2985
  name: string;
2899
2986
  homeCwd: string;
2900
2987
  scope: WebRemoteServiceTool[];
2988
+ /** Owner-approved projects folder project_create creates into; null without that tool. */
2989
+ projectRoot: string | null;
2901
2990
  relayClientId: string | null;
2902
2991
  pairedAt: number;
2903
2992
  lastSeenAt: number;
2993
+ /** How the pairing was approved: owner window (default) or the loopback admin API. */
2994
+ pairedVia?: 'window' | 'local';
2904
2995
  }
2905
2996
 
2906
2997
  export interface WebRemotePendingService {
@@ -2908,8 +2999,10 @@ export interface WebRemotePendingService {
2908
2999
  name: string;
2909
3000
  homeCwd: string;
2910
3001
  scope: WebRemoteServiceTool[];
3002
+ projectRoot: string | null;
2911
3003
  createdAt: number;
2912
3004
  expiresAt: number;
3005
+ pairedVia?: 'window' | 'local';
2913
3006
  }
2914
3007
 
2915
3008
  /** A relay client no local service owns. */
@@ -2933,6 +3026,8 @@ export interface WebRemoteServicePairStartInput {
2933
3026
  name: string;
2934
3027
  homeCwd: string;
2935
3028
  scope: WebRemoteServiceTool[];
3029
+ /** Required (an existing folder in the home folder) when scope includes project_create. */
3030
+ projectRoot?: string;
2936
3031
  }
2937
3032
 
2938
3033
  export type WebRemoteServicePairStartResult =
@@ -3000,6 +3095,8 @@ export interface SessionManagerAPI {
3000
3095
  onNewSession: (handler: () => void) => () => void;
3001
3096
  onRebootSession: (handler: () => void) => () => void;
3002
3097
  onOpenFreeHour: (handler: () => void) => () => void;
3098
+ /** Fired when POST /admin/projects/create makes a new project; `cwd` is its folder. */
3099
+ onProjectCreated: (handler: (payload: { cwd: string }) => void) => () => void;
3003
3100
  archiveProject: (encoded: string) => Promise<{ ok: boolean; error?: string }>;
3004
3101
  };
3005
3102
  pty: {
@@ -3074,6 +3171,10 @@ export interface SessionManagerAPI {
3074
3171
  listPersonas: () => Promise<AgentPersona[]>;
3075
3172
  savePersona: (payload: AgentPersonaSaveInput) => Promise<{ ok: boolean; path: string }>;
3076
3173
  deletePersona: (payload: { name: string }) => Promise<{ ok: boolean }>;
3174
+ /** Replaces the installed persona with the bundled one (backing the old file up). */
3175
+ takeBundledPersona: (p: { name: string }) => Promise<{ backupPath: string; seedVersion: number }>;
3176
+ /** Hides the upgrade notice for this bundled version. */
3177
+ dismissPersonaUpgrade: (p: { name: string; bundledVersion: number }) => Promise<{ ok: true }>;
3077
3178
  /** Drops the overlay of the OPEN project at `projectCwd` (an `overrideDetails[].cwd`). */
3078
3179
  removeOverride: (payload: { name: string; projectCwd: string }) => Promise<{ ok: boolean }>;
3079
3180
  /** Raw persona `.md` text for the New Epic AIM composer (epicIntake.ts's `agentBody`),
@@ -3116,6 +3217,8 @@ export interface SessionManagerAPI {
3116
3217
  effort: string | null;
3117
3218
  source: 'persona' | 'persona-overlay' | 'inherit' | null;
3118
3219
  }>;
3220
+ /** Gear armory read model (`agentArmory.cjs`): every equippable tool/skill/MCP/pack with badges. Never throws; source failures land in `errors`. */
3221
+ armory: (payload: { cwd?: string }) => Promise<Armory>;
3119
3222
  /** Fires after any save/delete/removeOverride — subscribers should re-fetch listPersonas(). */
3120
3223
  onChanged: (handler: () => void) => () => void;
3121
3224
  };
@@ -3560,6 +3663,10 @@ export interface SessionManagerAPI {
3560
3663
  reviewDecide: (payload: VideoReviewDecidePayload) => Promise<VideoReviewDecideResult>;
3561
3664
  /** Re-dispatch the final stage of an approved entry whose final run failed (canRetry), reusing the recorded approval and inputs. Desktop only (never via the phone relay); one in-flight decide/retry per entry. */
3562
3665
  reviewRetry: (payload: VideoReviewRetryPayload) => Promise<VideoReviewRetryResult>;
3666
+ /** Read this project's 'Scripts may run Demo Video' switch; off with null changedAt/by when never set. Rejects on an invalid cwd. */
3667
+ scriptSwitchGet: (payload: VideoScriptSwitchGetPayload) => Promise<VideoScriptSwitchState>;
3668
+ /** A human click: turn the switch on/off, recorded as by { via: 'ui' } plus one audit event. Desktop only. Rejects on a bad payload. */
3669
+ scriptSwitchSet: (payload: VideoScriptSwitchSetPayload) => Promise<VideoScriptSwitchState>;
3563
3670
  /** Fires whenever a watched cwd's knowledge/videos library is added/changed/removed, carrying the freshly read library result. */
3564
3671
  onChanged: (handler: (payload: { cwd: string } & ProjectPagesGetResult) => void) => () => void;
3565
3672
  };
@@ -3704,7 +3811,16 @@ export interface SessionManagerAPI {
3704
3811
  /** Set when main awaits the result; echo it back via `reportExternalNewSessionResult`. */
3705
3812
  requestId?: string;
3706
3813
  via?: 'script';
3814
+ /** Set by main only for via 'script' (epic/scriptStartedBy.cjs); never on a human press. */
3815
+ startedBy?: {
3816
+ kind: 'script';
3817
+ route: string;
3818
+ caller?: { pipeline?: string; runId?: string; step?: string; attempt?: number };
3819
+ [k: string]: unknown;
3820
+ };
3707
3821
  effort?: string;
3822
+ /** Scripted job press: build a review cut first. */
3823
+ reviewStage?: boolean;
3708
3824
  }) => void,
3709
3825
  ) => () => void;
3710
3826
  /** Classify a queued PromptTicket's text as 'inline' (run through
@@ -199,6 +199,13 @@
199
199
  "kind": "on",
200
200
  "remote": "deny"
201
201
  },
202
+ {
203
+ "ns": "app",
204
+ "method": "onProjectCreated",
205
+ "channel": "projects:created",
206
+ "kind": "on",
207
+ "remote": "deny"
208
+ },
202
209
  {
203
210
  "ns": "pty",
204
211
  "method": "spawn",
@@ -452,6 +459,20 @@
452
459
  "kind": "invoke",
453
460
  "remote": "mutate"
454
461
  },
462
+ {
463
+ "ns": "agents",
464
+ "method": "takeBundledPersona",
465
+ "channel": "agents:take-bundled-persona",
466
+ "kind": "invoke",
467
+ "remote": "mutate"
468
+ },
469
+ {
470
+ "ns": "agents",
471
+ "method": "dismissPersonaUpgrade",
472
+ "channel": "agents:dismiss-persona-upgrade",
473
+ "kind": "invoke",
474
+ "remote": "mutate"
475
+ },
455
476
  {
456
477
  "ns": "agents",
457
478
  "method": "removeOverride",
@@ -487,6 +508,13 @@
487
508
  "kind": "invoke",
488
509
  "remote": "read"
489
510
  },
511
+ {
512
+ "ns": "agents",
513
+ "method": "armory",
514
+ "channel": "agents:armory",
515
+ "kind": "invoke",
516
+ "remote": "read"
517
+ },
490
518
  {
491
519
  "ns": "agents",
492
520
  "method": "onChanged",
@@ -1932,6 +1960,20 @@
1932
1960
  "kind": "invoke",
1933
1961
  "remote": "deny"
1934
1962
  },
1963
+ {
1964
+ "ns": "projectPages",
1965
+ "method": "scriptSwitchGet",
1966
+ "channel": "videos:script-switch-get",
1967
+ "kind": "invoke",
1968
+ "remote": "read"
1969
+ },
1970
+ {
1971
+ "ns": "projectPages",
1972
+ "method": "scriptSwitchSet",
1973
+ "channel": "videos:script-switch-set",
1974
+ "kind": "invoke",
1975
+ "remote": "deny"
1976
+ },
1935
1977
  {
1936
1978
  "ns": "projectPages",
1937
1979
  "method": "onChanged",
@@ -54,6 +54,12 @@ contextBridge.exposeInMainWorld('api', {
54
54
  ipcRenderer.on('app:open-free-hour', listener);
55
55
  return () => ipcRenderer.removeListener('app:open-free-hour', listener);
56
56
  },
57
+ // Fired by POST /admin/projects/create on a fresh create (projectCreate.cjs defaultNotifyRenderer).
58
+ onProjectCreated: (handler) => {
59
+ const listener = (_e, payload) => handler({ cwd: payload?.cwd });
60
+ ipcRenderer.on('projects:created', listener);
61
+ return () => ipcRenderer.removeListener('projects:created', listener);
62
+ },
57
63
  },
58
64
  pty: {
59
65
  spawn: (payload) => ipcRenderer.invoke('pty:spawn', payload),
@@ -136,10 +142,13 @@ contextBridge.exposeInMainWorld('api', {
136
142
  savePersona: (payload) => ipcRenderer.invoke('agents:save-persona', payload),
137
143
  deletePersona: (payload) => ipcRenderer.invoke('agents:delete-persona', payload),
138
144
  removeOverride: (payload) => ipcRenderer.invoke('agents:remove-override', payload),
145
+ takeBundledPersona: (payload) => ipcRenderer.invoke('agents:take-bundled-persona', payload),
146
+ dismissPersonaUpgrade: (payload) => ipcRenderer.invoke('agents:dismiss-persona-upgrade', payload),
139
147
  getPersonaBody: (payload) => ipcRenderer.invoke('agents:get-persona-body', payload),
140
148
  resolveModelInfo: (payload) => ipcRenderer.invoke('agents:resolve-model-info', payload),
141
149
  resolveEpicModel: (payload) => ipcRenderer.invoke('agents:resolve-epic-model', payload),
142
150
  resolveEpicEffort: (payload) => ipcRenderer.invoke('agents:resolve-epic-effort', payload),
151
+ armory: (payload) => ipcRenderer.invoke('agents:armory', payload),
143
152
  // Fired after any save/delete/removeOverride so every mounted
144
153
  // subscriber (Agent Library, Tag Library) re-fetches the same file.
145
154
  onChanged: (handler) => {
@@ -478,6 +487,8 @@ contextBridge.exposeInMainWorld('api', {
478
487
  reviewList: (payload) => ipcRenderer.invoke('project-videos:review-list', payload),
479
488
  reviewDecide: (payload) => ipcRenderer.invoke('project-videos:review-decide', payload),
480
489
  reviewRetry: (payload) => ipcRenderer.invoke('project-videos:review-retry', payload),
490
+ scriptSwitchGet: (payload) => ipcRenderer.invoke('videos:script-switch-get', payload),
491
+ scriptSwitchSet: (payload) => ipcRenderer.invoke('videos:script-switch-set', payload),
481
492
  onChanged: (handler) => {
482
493
  const listener = (_e, payload) => handler(payload);
483
494
  ipcRenderer.on('project-pages:changed', listener);