claude-code-session-manager 0.139.0 → 0.141.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 (154) hide show
  1. package/README.md +20 -4
  2. package/dist/assets/AppSettings-DExeJhqQ.js +2 -0
  3. package/dist/assets/History-DJMiuXyK.js +2 -0
  4. package/dist/assets/{HomeClaudeConfig-CGD2Onjv.js → HomeClaudeConfig-CTp2tkZ4.js} +2 -2
  5. package/dist/assets/{Panel-Csyd9HbD.js → Panel-Bf1Cf8UL.js} +1 -1
  6. package/dist/assets/{ProjectClaudeConfig-C-jlYpC_.js → ProjectClaudeConfig-BWPpypf9.js} +1 -1
  7. package/dist/assets/Scheduler-cyr61UAC.js +16 -0
  8. package/dist/assets/{SkillReferenceGraph-DcscPXAG.js → SkillReferenceGraph-Ba4TkX2C.js} +1 -1
  9. package/dist/assets/{Skills-BpGRKOcY.js → Skills-C1v91GEO.js} +26 -26
  10. package/dist/assets/{TiptapBody-DSU3769X.js → TiptapBody-BrcWVpiW.js} +1 -1
  11. package/dist/assets/{ViewTabs-C0PRZx4_.js → ViewTabs-DXhOWFG0.js} +1 -1
  12. package/dist/assets/{VoiceButton-D2rMurNg.js → VoiceButton-qivnDV6K.js} +1 -1
  13. package/dist/assets/{historyTotals-TcIQs2sh.js → historyTotals-CMCPTKqC.js} +1 -1
  14. package/dist/assets/index-B2TQz3nd.js +3121 -0
  15. package/dist/assets/{index-BCySPdtU.css → index-DKXdXfka.css} +1 -1
  16. package/dist/index.html +2 -2
  17. package/dist-web/app.css +1 -1
  18. package/dist-web/app.js +423 -426
  19. package/package.json +5 -2
  20. package/plugins/AGENTS.md +60 -0
  21. package/plugins/CLAUDE.md +1 -60
  22. package/plugins/session-manager-dev/skills/builder/SKILL.md +4 -2
  23. package/plugins/session-manager-dev/skills/develop/SKILL.md +29 -19
  24. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
  25. package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
  26. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
  27. package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
  28. package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
  29. package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
  30. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
  31. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
  33. package/scripts/README.md +1 -0
  34. package/scripts/hooks/guard-tool-risk.cjs +91 -0
  35. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
  36. package/scripts/ops-sweep.cjs +53 -23
  37. package/scripts/scheduler-mcp-server.cjs +205 -18
  38. package/src/main/build-info.json +4 -4
  39. package/src/main/config.cjs +112 -8
  40. package/src/main/docEdit.cjs +6 -1
  41. package/src/main/files.cjs +7 -27
  42. package/src/main/health.cjs +48 -15
  43. package/src/main/historyAggregator.cjs +88 -5
  44. package/src/main/historyDashboard.cjs +69 -4
  45. package/src/main/index.cjs +56 -2
  46. package/src/main/ipcSchemas.cjs +122 -16
  47. package/src/main/lib/AGENTS.md +54 -0
  48. package/src/main/lib/CLAUDE.md +1 -54
  49. package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
  50. package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
  51. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
  52. package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
  53. package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
  54. package/src/main/lib/claude/effectiveModelInfo.cjs +90 -20
  55. package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
  56. package/src/main/lib/claude/personaToolScope.cjs +12 -6
  57. package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
  58. package/src/main/lib/claude/runClaudeP.cjs +6 -1
  59. package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
  60. package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
  61. package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
  62. package/src/main/lib/ephemeralCwd.cjs +37 -2
  63. package/src/main/lib/epic/delegationReadiness.cjs +42 -9
  64. package/src/main/lib/epic/epicAdminRoutes.cjs +25 -5
  65. package/src/main/lib/epic/epicOutsideRead.cjs +118 -1
  66. package/src/main/lib/epic/epicOutsideState.cjs +2 -2
  67. package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
  68. package/src/main/lib/epic/epicValidationHook.cjs +24 -4
  69. package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
  70. package/src/main/lib/externalContract.cjs +31 -5
  71. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +55 -1
  72. package/src/main/lib/feedback-remote/crossProjectReply.cjs +106 -11
  73. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +47 -19
  74. package/src/main/lib/feedback-remote/needsYouStore.cjs +6 -2
  75. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
  76. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
  77. package/src/main/lib/git/branchSweep.cjs +209 -4
  78. package/src/main/lib/git/gitWorktree.cjs +41 -5
  79. package/src/main/lib/guardShims.cjs +1 -1
  80. package/src/main/lib/historyRollup.cjs +26 -0
  81. package/src/main/lib/insideHome.cjs +27 -1
  82. package/src/main/lib/mcpToolCatalog.cjs +132 -13
  83. package/src/main/lib/mdDocCensus.cjs +59 -78
  84. package/src/main/lib/mdDocRefs.cjs +71 -93
  85. package/src/main/lib/mdNetworkScan.cjs +245 -250
  86. package/src/main/lib/mdReviewRecord.cjs +22 -9
  87. package/src/main/lib/memoryMdNetwork.cjs +5 -12
  88. package/src/main/lib/opsOwnership.cjs +18 -2
  89. package/src/main/lib/opsRetentionSettings.cjs +28 -4
  90. package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
  91. package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
  92. package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
  93. package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
  94. package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
  95. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
  96. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  97. package/src/main/lib/prd/depSlugResolve.cjs +104 -4
  98. package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
  99. package/src/main/lib/prd/prdCreate.cjs +377 -23
  100. package/src/main/lib/prd/prdDisposition.cjs +11 -2
  101. package/src/main/lib/prd/prdFrontmatter.cjs +121 -3
  102. package/src/main/lib/process/loginItem.cjs +171 -0
  103. package/src/main/lib/process/loginItemPlan.cjs +193 -0
  104. package/src/main/lib/project-pages/playerBridge.cjs +4 -0
  105. package/src/main/lib/project-pages/videoReview.cjs +268 -0
  106. package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
  107. package/src/main/lib/scheduler/cpuSample.cjs +131 -4
  108. package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
  109. package/src/main/lib/scheduler/loadGate.cjs +24 -6
  110. package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
  111. package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
  112. package/src/main/lib/scheduler/preflightCheck.cjs +97 -0
  113. package/src/main/lib/scheduler/queueStore.cjs +7 -0
  114. package/src/main/lib/scheduler/rcaReport.cjs +21 -1
  115. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
  116. package/src/main/lib/scheduler/reviewNotice.cjs +39 -0
  117. package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
  118. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  119. package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
  120. package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
  121. package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
  122. package/src/main/lib/scheduler/validationQuality.cjs +282 -0
  123. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
  124. package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
  125. package/src/main/lib/tasks/taskIpc.cjs +80 -0
  126. package/src/main/lib/tasks/taskLedger.cjs +502 -0
  127. package/src/main/lib/tasks/taskRun.cjs +313 -0
  128. package/src/main/lib/tasks/taskSwitch.cjs +120 -0
  129. package/src/main/loginItemIpc.cjs +35 -0
  130. package/src/main/loopEfficiencyHandlers.cjs +10 -1
  131. package/src/main/projectPages.cjs +6 -15
  132. package/src/main/promptSessionEvents.cjs +9 -1
  133. package/src/main/queueOps.cjs +260 -3
  134. package/src/main/runVerify.cjs +53 -25
  135. package/src/main/scheduler/AGENTS.md +26 -0
  136. package/src/main/scheduler/CLAUDE.md +1 -26
  137. package/src/main/scheduler/budget.cjs +239 -9
  138. package/src/main/scheduler/cancelDependents.cjs +154 -0
  139. package/src/main/scheduler/prdParser.cjs +19 -1
  140. package/src/main/scheduler/reviewLadder.cjs +36 -3
  141. package/src/main/scheduler/starvation.cjs +89 -18
  142. package/src/main/scheduler.cjs +1080 -89
  143. package/src/main/supervisor.cjs +5 -1
  144. package/src/main/templates/PRD_AUTHORING.md +14 -1
  145. package/src/main/validationQualityHandlers.cjs +199 -0
  146. package/src/main/webRemote.cjs +10 -2
  147. package/src/preload/api.d.ts +364 -21
  148. package/src/preload/apiSurface.json +89 -10
  149. package/src/preload/index.cjs +23 -2
  150. package/src/seed/agents/validator.md +19 -8
  151. package/dist/assets/AppSettings-CUfWY9vN.js +0 -2
  152. package/dist/assets/History-DDnqaLyw.js +0 -2
  153. package/dist/assets/Scheduler-NLs08fx7.js +0 -16
  154. package/dist/assets/index-C-d0DCre.js +0 -3124
@@ -9,7 +9,10 @@
9
9
  * session-manager's own OWNERS vocabulary), this script does not assume any
10
10
  * particular namespace list. It re-derives the source-of-truth hierarchy for
11
11
  * the TARGET project from what's actually on disk there:
12
- * 1. That project's own CLAUDE.md (if present) — the declared architecture.
12
+ * 1. That project's own root AGENTS.md if present, else its root CLAUDE.md —
13
+ * the declared architecture. Projects migrating to AGENTS.md keep the text
14
+ * there and leave CLAUDE.md as a one-line `@AGENTS.md` import stub, so
15
+ * reading CLAUDE.md alone would see only the import line.
13
16
  * 2. Each namespace's own README.md under its ops root.
14
17
  * 3. On-disk content — folder names, and archived/processed subfolders.
15
18
  *
@@ -24,8 +27,9 @@
24
27
  * - NO_RETENTION_POLICY — namespace has an archived/processed subfolder with
25
28
  * files but no retention/prune/expire language in its
26
29
  * README (or no README at all)
27
- * - NESTED_CLAUDE_MD_OVER_BUDGET — any CLAUDE.md strictly below the repo root
28
- * (excluding node_modules) exceeds 4000 bytes. Nested
30
+ * - NESTED_CLAUDE_MD_OVER_BUDGET — any folder strictly below the repo root
31
+ * (excluding node_modules) whose CLAUDE.md + AGENTS.md
32
+ * bytes, counted together, exceed 4000. Nested
29
33
  * CLAUDE.md files are scoped-context notes, not the
30
34
  * root law file, so they get a fixed 4000-byte cap
31
35
  * rather than the root's self-declared SIZE BUDGET.
@@ -34,11 +38,12 @@
34
38
  * feed CONTRADICTION): the single-writer OWNERS enumeration used to live only in
35
39
  * the target project's root CLAUDE.md. It can now instead live in a scoped
36
40
  * `session-manager-operations/CLAUDE.md`, so these checks read
37
- * `<targetCwd>/session-manager-operations/CLAUDE.md` when that file exists and
38
- * fall back to `<targetCwd>/CLAUDE.md` otherwise — so a project that hasn't
39
- * split its ops docs out yet keeps working unchanged. The root CLAUDE.md's own
40
- * CLAUDE_MD_OVER_BUDGET check (against its self-declared SIZE BUDGET header) is
41
- * unaffected by this fallback and always reads the root file.
41
+ * `<targetCwd>/session-manager-operations/AGENTS.md` or `CLAUDE.md` (AGENTS.md
42
+ * first) when one exists and fall back to the root declared-architecture doc
43
+ * (root AGENTS.md, else root CLAUDE.md) otherwise — so a project that hasn't
44
+ * split its ops docs out yet keeps working unchanged. The CLAUDE_MD_OVER_BUDGET
45
+ * check (against the self-declared SIZE BUDGET header) is unaffected by this
46
+ * fallback and always reads the root declared-architecture doc.
42
47
  *
43
48
  * Never deletes/migrates/archives anything and never files Epics itself — it
44
49
  * only prints a JSON report. Routing findings into proposed Epics is the
@@ -61,7 +66,13 @@ if (!targetCwd) {
61
66
 
62
67
  const OPS_ROOT = path.join(targetCwd, 'session-manager-operations');
63
68
  const CLAUDE_MD_PATH = path.join(targetCwd, 'CLAUDE.md');
69
+ const AGENTS_MD_PATH = path.join(targetCwd, 'AGENTS.md');
70
+ // Root declared architecture: AGENTS.md when present (CLAUDE.md is then a
71
+ // `@AGENTS.md` stub or absent), else CLAUDE.md as before.
72
+ const ROOT_DOC_PATH = fs.existsSync(AGENTS_MD_PATH) ? AGENTS_MD_PATH : CLAUDE_MD_PATH;
73
+ const OPS_AGENTS_MD_PATH = path.join(OPS_ROOT, 'AGENTS.md');
64
74
  const OPS_CLAUDE_MD_PATH = path.join(OPS_ROOT, 'CLAUDE.md');
75
+ const NESTED_DOC_NAMES = ['CLAUDE.md', 'AGENTS.md'];
65
76
  const NESTED_CLAUDE_MD_BUDGET_BYTES = 4000;
66
77
 
67
78
  // computeClaudeMdSize(claudeMdText) -> { chars, budget, withinBudget } | null
@@ -162,7 +173,9 @@ if (!fs.existsSync(OPS_ROOT) || !fs.statSync(OPS_ROOT).isDirectory()) {
162
173
  opsRoot: OPS_ROOT,
163
174
  error: 'no session-manager-operations/ folder found at target cwd',
164
175
  hasClaudeMd: fs.existsSync(CLAUDE_MD_PATH),
165
- claudeMdSize: computeClaudeMdSize(readText(CLAUDE_MD_PATH)),
176
+ hasAgentsMd: fs.existsSync(AGENTS_MD_PATH),
177
+ declaredArchitecturePath: path.relative(targetCwd, ROOT_DOC_PATH),
178
+ claudeMdSize: computeClaudeMdSize(readText(ROOT_DOC_PATH)),
166
179
  namespaces: [],
167
180
  findings: [],
168
181
  }, null, 2) + '\n');
@@ -170,12 +183,13 @@ if (!fs.existsSync(OPS_ROOT) || !fs.statSync(OPS_ROOT).isDirectory()) {
170
183
  }
171
184
 
172
185
  const claudeMd = readText(CLAUDE_MD_PATH);
173
- const claudeMdSize = computeClaudeMdSize(claudeMd);
186
+ const rootDoc = ROOT_DOC_PATH === CLAUDE_MD_PATH ? claudeMd : readText(ROOT_DOC_PATH);
187
+ const claudeMdSize = computeClaudeMdSize(rootDoc);
174
188
  // The OWNERS enumeration may now live in a scoped session-manager-operations/
175
189
  // CLAUDE.md instead of the root one — see the header comment. Namespace-level
176
190
  // UNDOCUMENTED/retired/owner-signal checks read that file when it exists.
177
- const ownershipDocPath = fs.existsSync(OPS_CLAUDE_MD_PATH) ? OPS_CLAUDE_MD_PATH : CLAUDE_MD_PATH;
178
- const ownershipDoc = ownershipDocPath === CLAUDE_MD_PATH ? claudeMd : readText(ownershipDocPath);
191
+ const ownershipDocPath = [OPS_AGENTS_MD_PATH, OPS_CLAUDE_MD_PATH].find((p) => fs.existsSync(p)) || ROOT_DOC_PATH;
192
+ const ownershipDoc = ownershipDocPath === ROOT_DOC_PATH ? rootDoc : readText(ownershipDocPath);
179
193
  const namespaceDirs = listDirEntries(OPS_ROOT).filter((e) => e.isDirectory());
180
194
 
181
195
  const namespaces = [];
@@ -196,7 +210,7 @@ if (epicIndexDrift.orphan_rows > 0) {
196
210
  if (claudeMdSize && !claudeMdSize.withinBudget) {
197
211
  findings.push({
198
212
  type: 'CLAUDE_MD_OVER_BUDGET',
199
- detail: `CLAUDE.md is ${claudeMdSize.chars} chars, over its ${claudeMdSize.budget}-char budget by ${claudeMdSize.chars - claudeMdSize.budget}`,
213
+ detail: `${path.relative(targetCwd, ROOT_DOC_PATH)} is ${claudeMdSize.chars} chars, over its ${claudeMdSize.budget}-char budget by ${claudeMdSize.chars - claudeMdSize.budget}`,
200
214
  });
201
215
  }
202
216
 
@@ -302,14 +316,17 @@ for (const v of opsPathLint.violations) {
302
316
  });
303
317
  }
304
318
 
305
- // Nested-CLAUDE.md budget lint: every CLAUDE.md strictly below the repo root
306
- // (excluding node_modules and .git) gets a fixed 4000-byte cap — these are
307
- // scoped-context notes (house style: H1 + "What's here"/"Who consumes
308
- // this"/"What must NOT be assumed"), not the root law file, so they don't
309
- // carry a self-declared SIZE BUDGET header the way root CLAUDE.md does.
319
+ // Nested-CLAUDE.md budget lint: every folder strictly below the repo root
320
+ // (excluding node_modules and .git) gets a fixed 4000-byte cap on its
321
+ // CLAUDE.md + AGENTS.md bytes counted together — a migrated folder keeps its
322
+ // text in AGENTS.md behind a CLAUDE.md `@AGENTS.md` stub, and both load into
323
+ // context, so the pair is one budget. These are scoped-context notes (house
324
+ // style: H1 + "What's here"/"Who consumes this"/"What must NOT be assumed"),
325
+ // not the root law file, so they don't carry a self-declared SIZE BUDGET
326
+ // header the way the root doc does.
310
327
  const NESTED_CLAUDE_MD_EXCLUDE_DIRS = new Set(['node_modules', '.git']);
311
328
  function findNestedClaudeMdFiles(root) {
312
- const rootClaudeMdPath = path.join(root, 'CLAUDE.md');
329
+ const rootDir = path.resolve(root);
313
330
  const found = [];
314
331
  const walk = (dir) => {
315
332
  let entries;
@@ -318,20 +335,31 @@ function findNestedClaudeMdFiles(root) {
318
335
  if (NESTED_CLAUDE_MD_EXCLUDE_DIRS.has(e.name)) continue;
319
336
  const full = path.join(dir, e.name);
320
337
  if (e.isDirectory()) { walk(full); continue; }
321
- if (e.name === 'CLAUDE.md' && full !== rootClaudeMdPath) found.push(full);
338
+ if (NESTED_DOC_NAMES.includes(e.name) && path.resolve(dir) !== rootDir) found.push(full);
322
339
  }
323
340
  };
324
341
  walk(root);
325
342
  return found;
326
343
  }
327
344
  const nestedClaudeMdFiles = findNestedClaudeMdFiles(targetCwd);
345
+ const nestedDocsByDir = new Map();
328
346
  for (const p of nestedClaudeMdFiles) {
329
- const bytes = Buffer.byteLength(fs.readFileSync(p, 'utf8'), 'utf8');
347
+ const dir = path.dirname(p);
348
+ if (!nestedDocsByDir.has(dir)) nestedDocsByDir.set(dir, []);
349
+ nestedDocsByDir.get(dir).push(p);
350
+ }
351
+ for (const files of nestedDocsByDir.values()) {
352
+ // CLAUDE.md first so a pair's finding keeps pointing at the CLAUDE.md path.
353
+ files.sort((a, b) => NESTED_DOC_NAMES.indexOf(path.basename(a)) - NESTED_DOC_NAMES.indexOf(path.basename(b)));
354
+ const bytes = files.reduce((sum, p) => sum + fs.statSync(p).size, 0);
330
355
  if (bytes > NESTED_CLAUDE_MD_BUDGET_BYTES) {
356
+ const rel = files.map((p) => path.relative(targetCwd, p));
331
357
  findings.push({
332
358
  type: 'NESTED_CLAUDE_MD_OVER_BUDGET',
333
- file: path.relative(targetCwd, p),
334
- detail: `${path.relative(targetCwd, p)} is ${bytes} bytes, over the ${NESTED_CLAUDE_MD_BUDGET_BYTES}-byte nested-CLAUDE.md cap by ${bytes - NESTED_CLAUDE_MD_BUDGET_BYTES}`,
359
+ file: rel[0],
360
+ files: rel,
361
+ bytes,
362
+ detail: `${rel.join(' + ')} ${rel.length > 1 ? 'are' : 'is'} ${bytes} bytes, over the ${NESTED_CLAUDE_MD_BUDGET_BYTES}-byte nested-CLAUDE.md cap by ${bytes - NESTED_CLAUDE_MD_BUDGET_BYTES}`,
335
363
  });
336
364
  }
337
365
  }
@@ -340,6 +368,8 @@ process.stdout.write(JSON.stringify({
340
368
  targetCwd,
341
369
  opsRoot: OPS_ROOT,
342
370
  hasClaudeMd: !!claudeMd,
371
+ hasAgentsMd: fs.existsSync(AGENTS_MD_PATH),
372
+ declaredArchitecturePath: path.relative(targetCwd, ROOT_DOC_PATH),
343
373
  claudeMdSize,
344
374
  ownershipDocPath: path.relative(targetCwd, ownershipDocPath),
345
375
  opsPathLint,
@@ -19,9 +19,10 @@
19
19
  * project_matrix_write({ cwd?, matrix? | matrixPath?, model? }) -> POST /admin/project-home/matrix/write
20
20
  * project_character_write({ cwd?, json, js? | jsPath?, replace? }) -> POST /admin/project-home/character/write
21
21
  * project_video_write({ cwd?, videoId, title, kind, lengthS, html? | htmlPath?, meta? }) -> POST /admin/project-home/videos/write
22
+ * project_video_review_write({ cwd?, videoId, text, imagePaths }) -> POST /admin/project-home/videos/review/write
22
23
  *
23
24
  * macro_list({ cwd? }) -> GET /admin/macros?cwd=<encoded>
24
- * macro_save({ cwd?, id?, label, agentName, tag, prompt, inputs?, surface?, projects?, humanRequestQuote? }) -> POST /admin/macros/save
25
+ * macro_save({ cwd?, id?, label, agentName, tag, prompt, inputs?, surface?, job?, projects?, humanRequestQuote? }) -> POST /admin/macros/save
25
26
  * macro_delete({ id }) -> POST /admin/macros/delete
26
27
  * customer_feedback_list({ pull?, includeHidden? }) -> GET /admin/customer-feedback/inbox
27
28
  * customer_feedback_set_status({ id, status, note? }) -> POST /admin/customer-feedback/status
@@ -32,6 +33,9 @@
32
33
  *
33
34
  * agent_list({ cwd? }) -> GET /admin/agents[?cwd=<encoded>]
34
35
  *
36
+ * task_list({ cwd, since?, until?, pipeline?, runId?, step?, agent?, status?, source?, limit?, offset? }) -> GET /admin/tasks?cwd=<encoded>&...
37
+ * task_get({ cwd, id }) -> GET /admin/task?cwd=<encoded>&id=<encoded>
38
+ *
35
39
  * This is a separate process from the Electron app — it only ever reaches
36
40
  * it over the token-authed loopback HTTP API in admin-api.json, never by
37
41
  * requiring scheduler.cjs/localAdminHttp.cjs directly. The admin API (loopback +
@@ -50,8 +54,9 @@ const path = require('node:path');
50
54
  const fsp = require('node:fs/promises');
51
55
  const { createStdioServer } = require('../src/main/lib/mcpStdioServer.cjs');
52
56
  const { PRD_WORK_TYPES } = require('../src/main/lib/prd/workTypeLibrary.cjs');
53
- const { MCP_TOOL_CATALOG, MCP_RECIPES, composeDescription } = require('../src/main/lib/mcpToolCatalog.cjs');
57
+ const { MCP_TOOL_CATALOG, MCP_RECIPES, composeDescription, FIXES_INPUT_SCHEMA } = require('../src/main/lib/mcpToolCatalog.cjs');
54
58
  const { EPIC_OUTSIDE_STATES } = require('../src/main/lib/epic/epicOutsideState.cjs');
59
+ const { REVIEW_TEXT_MAX, REVIEW_IMAGES_MAX, REVIEW_IMAGE_BYTES_MAX } = require('../src/main/lib/project-pages/videoReview.cjs');
55
60
 
56
61
  const CATALOG_BY_NAME = new Map(MCP_TOOL_CATALOG.map((entry) => [entry.name, entry]));
57
62
 
@@ -74,6 +79,19 @@ function withPointer(text) {
74
79
 
75
80
  const MAX_DEMO_VIDEO_BYTES = 2 * 1024 * 1024;
76
81
  const MAX_CHARACTER_JS_BYTES = 300 * 1024;
82
+
83
+ /**
84
+ * htmlPath cap for project_video_write: 2 MiB per started 30 s of lengthS.
85
+ * Mirrors maxVideoBytes in src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs
86
+ * (not required here: this is a standalone process and that module pulls app
87
+ * config); scheduler-mcp-server-htmlPath.test.cjs asserts the two agree. A
88
+ * missing, non-numeric or non-positive lengthS keeps the 2 MiB cap — the
89
+ * route validates lengthS itself.
90
+ */
91
+ function maxVideoBytesFor(lengthS) {
92
+ if (typeof lengthS !== 'number' || !Number.isFinite(lengthS) || lengthS <= 0) return MAX_DEMO_VIDEO_BYTES;
93
+ return Math.ceil(lengthS / 30) * MAX_DEMO_VIDEO_BYTES;
94
+ }
77
95
  const MAX_MATRIX_JSON_BYTES = 1048576;
78
96
 
79
97
  /** Reads a local .js file for project_character_write; errors carry only the reason, never file contents. */
@@ -92,14 +110,21 @@ async function readCharacterJsFile(p) {
92
110
  }
93
111
  }
94
112
 
95
- /** Reads a local .html/.htm file for project_demo_video_write; errors carry only the reason, never file contents. */
96
- async function readDemoVideoHtmlFile(p) {
113
+ /**
114
+ * Reads a local .html/.htm file for an html/htmlPath tool; errors carry only the
115
+ * reason, never file contents. `maxBytes` defaults to 2 MiB; `lengthS`, when
116
+ * given, is named in the too-large error (project_video_write's scaled cap).
117
+ */
118
+ async function readDemoVideoHtmlFile(p, { maxBytes = MAX_DEMO_VIDEO_BYTES, lengthS } = {}) {
97
119
  if (typeof p !== 'string' || !path.isAbsolute(p)) return { error: 'htmlPath must be an absolute path' };
98
120
  if (!/\.html?$/i.test(p)) return { error: 'htmlPath must end in .html or .htm' };
99
121
  try {
100
122
  const st = await fsp.stat(p);
101
123
  if (!st.isFile()) return { error: 'htmlPath is not a regular file' };
102
- if (st.size > MAX_DEMO_VIDEO_BYTES) return { error: `htmlPath file exceeds ${MAX_DEMO_VIDEO_BYTES} bytes` };
124
+ if (st.size > maxBytes) {
125
+ const forLength = lengthS === undefined ? '' : ` (the cap for lengthS ${lengthS})`;
126
+ return { error: `htmlPath file exceeds ${maxBytes} bytes${forLength}` };
127
+ }
103
128
  const html = await fsp.readFile(p, 'utf8');
104
129
  if (html.length === 0) return { error: 'htmlPath file is empty' };
105
130
  return { html };
@@ -108,12 +133,39 @@ async function readDemoVideoHtmlFile(p) {
108
133
  }
109
134
  }
110
135
 
111
- /** Resolves exactly one of html / htmlPath into { html } or { error }. */
112
- async function resolveHtmlArg(args) {
136
+ /**
137
+ * Reads project_video_review_write's imagePaths into [{ base64 }] or { error }.
138
+ * Errors carry only the reason and the 1-based index, never file contents.
139
+ */
140
+ async function readReviewImages(imagePaths) {
141
+ if (!Array.isArray(imagePaths) || imagePaths.length < 1 || imagePaths.length > REVIEW_IMAGES_MAX) {
142
+ return { error: `imagePaths must be an array of 1-${REVIEW_IMAGES_MAX} absolute paths` };
143
+ }
144
+ const images = [];
145
+ for (let i = 0; i < imagePaths.length; i++) {
146
+ const p = imagePaths[i];
147
+ const n = i + 1;
148
+ if (typeof p !== 'string' || !path.isAbsolute(p)) return { error: `imagePaths[${n}] must be an absolute path` };
149
+ if (!/\.(png|jpe?g|webp)$/i.test(p)) return { error: `imagePaths[${n}] must end in .png, .jpg, .jpeg or .webp` };
150
+ try {
151
+ const st = await fsp.stat(p);
152
+ if (!st.isFile()) return { error: `imagePaths[${n}] is not a regular file` };
153
+ if (st.size > REVIEW_IMAGE_BYTES_MAX) return { error: `imagePaths[${n}] exceeds ${REVIEW_IMAGE_BYTES_MAX} bytes (2 MiB)` };
154
+ if (st.size === 0) return { error: `imagePaths[${n}] is empty` };
155
+ images.push({ base64: (await fsp.readFile(p)).toString('base64') });
156
+ } catch (err) {
157
+ return { error: `cannot read imagePaths[${n}]: ${err && err.code ? err.code : 'read failed'}` };
158
+ }
159
+ }
160
+ return { images };
161
+ }
162
+
163
+ /** Resolves exactly one of html / htmlPath into { html } or { error }; `readOpts` goes to readDemoVideoHtmlFile. */
164
+ async function resolveHtmlArg(args, readOpts) {
113
165
  const hasHtml = !!args && args.html !== undefined && args.html !== null && args.html !== '';
114
166
  const hasPath = !!args && args.htmlPath !== undefined && args.htmlPath !== null && args.htmlPath !== '';
115
167
  if (hasHtml === hasPath) return { error: 'provide exactly one of html or htmlPath' };
116
- if (hasPath) return readDemoVideoHtmlFile(args.htmlPath);
168
+ if (hasPath) return readDemoVideoHtmlFile(args.htmlPath, readOpts);
117
169
  if (typeof args.html !== 'string') return { error: 'missing required argument: html' };
118
170
  return { html: args.html };
119
171
  }
@@ -332,6 +384,11 @@ const CREATE_PRD_ITEM_SCHEMA = {
332
384
  slug: { type: 'string', description: 'Optional kebab-case slug; derived from title if omitted' },
333
385
  parallelGroup: { type: 'number', description: 'DEPRECATED and ignored (PRD 832): numbers are strictly unique per project; use dependsOn for ordering' },
334
386
  dependsOn: { type: 'array', items: { type: 'string' }, description: 'Optional: PRD slugs that must complete before this one becomes eligible (replaces the retired shared-NN-parallel convention)' },
387
+ allowDuplicateOf: {
388
+ type: 'array', items: { type: 'string' },
389
+ description: 'Optional: exact NN-prefixed slugs (e.g. "3412-fix-x") of other Epics\' PRDs that share this PRD\'s bare slug. The write is refused as a cross-Epic duplicate unless every one is listed here; list them only for a deliberate duplicate — otherwise add them to dependsOn instead.',
390
+ },
391
+ fixes: FIXES_INPUT_SCHEMA,
335
392
  disposition: {
336
393
  type: 'string',
337
394
  enum: ['append', 'new-head'],
@@ -357,6 +414,14 @@ const CREATE_PRD_ITEM_SCHEMA = {
357
414
  type: 'array', items: { type: 'string' },
358
415
  description: 'Required with deliverable: "artifact" (and refused without it): every git-excluded file this PRD writes during the run, e.g. a built file in a gitignored folder. Relative paths, never containing "..", no commas or brackets. Each must be non-empty and freshly written.',
359
416
  },
417
+ riskTools: {
418
+ type: 'array', items: { type: 'string' }, maxItems: 20,
419
+ description: 'Optional: the tool-risk rules this PRD is cleared to call although they are marked irreversible, money or public in ~/.claude/tool-risk.json or <project>/.claude/tool-risk.json. Same syntax as the marks (mcp__server__tool, mcp__server__*, Bash(prefix:*)). At most 20.',
420
+ },
421
+ preflight: {
422
+ type: 'string', maxLength: 500,
423
+ description: 'Optional: a read-only, shell-free command in gate syntax, at most 60 s, that must exit 0 before the PRD runs; the scheduler holds the PRD and re-checks it on a backoff while it fails.',
424
+ },
360
425
  quietMachine: {
361
426
  type: 'boolean',
362
427
  description: 'Optional: set true only when this PRD\'s acceptance criteria are wall-clock/timing measurements (frame time, performance fences) that CPU contention from concurrent jobs would invalidate. The scheduler dispatches it only once zero other jobs are running machine-wide, and holds every other job off the whole slot pool for its run — a whole-machine exclusive lease, not a per-project one. If the machine never goes quiet within the configured wait window (default 30 minutes), it dispatches anyway and is marked degraded. Opt-in only; omit for ordinary PRDs.',
@@ -460,6 +525,39 @@ const TOOLS = [
460
525
  },
461
526
  },
462
527
  },
528
+ {
529
+ name: 'task_list',
530
+ description: descriptionFor('task_list'),
531
+ inputSchema: {
532
+ type: 'object',
533
+ properties: {
534
+ cwd: { type: 'string', description: 'Absolute path of the project root whose Task ledger to list' },
535
+ since: { type: 'string', description: 'Optional: ISO timestamp; only Tasks started at or after it' },
536
+ until: { type: 'string', description: 'Optional: ISO timestamp; only Tasks started at or before it' },
537
+ pipeline: { type: 'string', description: "Optional: only Tasks whose caller.pipeline equals this" },
538
+ runId: { type: 'string', description: "Optional: only Tasks whose caller.runId equals this" },
539
+ step: { type: 'string', description: "Optional: only Tasks whose caller.step equals this" },
540
+ agent: { type: 'string', description: 'Optional: only Tasks run as this agent persona' },
541
+ status: { type: 'string', description: 'Optional: only Tasks with this status (ok, error, timeout, ...)' },
542
+ source: { type: 'string', enum: ['sm', 'direct'], description: 'Optional: "sm" = run by Session Manager, "direct" = imported call that ran without it' },
543
+ limit: { type: 'number', description: 'Optional: page size, default 50, max 200' },
544
+ offset: { type: 'number', description: 'Optional: page offset, default 0' },
545
+ },
546
+ required: ['cwd'],
547
+ },
548
+ },
549
+ {
550
+ name: 'task_get',
551
+ description: descriptionFor('task_get'),
552
+ inputSchema: {
553
+ type: 'object',
554
+ properties: {
555
+ cwd: { type: 'string', description: 'Absolute path of the project root the Task belongs to' },
556
+ id: { type: 'string', description: 'The taskId, from task_list' },
557
+ },
558
+ required: ['cwd', 'id'],
559
+ },
560
+ },
463
561
  {
464
562
  name: 'epic_get',
465
563
  description: descriptionFor('epic_get'),
@@ -509,6 +607,8 @@ const TOOLS = [
509
607
  quietMachine: { type: 'boolean', description: 'Optional: the exclusive machine-wide quiet lease flag (see scheduler_create_prd) — patchable after creation too' },
510
608
  dependsOn: { type: 'array', items: { type: 'string' }, description: 'Optional: replaces the dependsOn list; an explicit empty array CLEARS it — see scheduler_create_prd' },
511
609
  disposition: { type: 'string', enum: ['append', 'new-head'], description: 'Optional: patches the recorded wave-authoring decision — see scheduler_create_prd' },
610
+ riskTools: { type: 'array', items: { type: 'string' }, maxItems: 20, description: 'Optional: replaces the PRD\'s riskTools — the tool-risk rules it is cleared to call although marked in tool-risk.json. Same rule syntax as scheduler_create_prd\'s riskTools (mcp__server__tool, mcp__server__*, Bash(prefix:*)). At most 20; an explicit empty array clears it.' },
611
+ preflight: { type: 'string', maxLength: 500, description: 'Optional: replaces the PRD\'s preflight — a read-only, shell-free command in gate syntax, at most 60 s, that must exit 0 before the PRD runs; the scheduler holds the PRD and re-checks it on a backoff while it fails.' },
512
612
  },
513
613
  },
514
614
  body: { type: 'string', description: 'Optional: full replacement body (everything after the frontmatter). Cannot be combined with gate/files/acceptanceCriteria.' },
@@ -539,6 +639,15 @@ const TOOLS = [
539
639
  properties: {
540
640
  slug: { type: 'string', description: 'PRD slug of the job to cancel' },
541
641
  cwd: { type: 'string', description: 'Optional: the PRD project cwd, narrows/speeds the search' },
642
+ dependents: {
643
+ type: 'object',
644
+ description: 'Required when the job has pending dependents (the cancel is refused and lists them otherwise): "cascade" cancels them too, "repoint" makes them depend on `to` instead, "clear" drops the dependency.',
645
+ properties: {
646
+ action: { type: 'string', enum: ['cascade', 'repoint', 'clear'] },
647
+ to: { type: 'string', description: 'PRD slug the dependents should depend on instead — required for action "repoint"' },
648
+ },
649
+ required: ['action'],
650
+ },
542
651
  },
543
652
  required: ['slug'],
544
653
  },
@@ -779,15 +888,35 @@ const TOOLS = [
779
888
  cwd: { type: 'string', description: "Optional: absolute path to the target project. Defaults to the calling session's own project root (SM_PROJECT_ROOT or process.cwd()) when omitted." },
780
889
  videoId: { type: 'string', description: 'Stable id (kebab-case) of the video; writing the same id replaces that video.' },
781
890
  title: { type: 'string', description: 'Human title shown in the video list.' },
782
- kind: { type: 'string', description: 'What the video is: exactly one of project-demo, blog-post, feature.' },
783
- lengthS: { type: 'number', description: 'Length of the video in seconds.' },
784
- html: { type: 'string', description: 'The complete self-contained HTML/JS video document (<= 2MB; no remote references or network-capable APIs).' },
785
- htmlPath: { type: 'string', description: 'Absolute path to a local .html/.htm file holding the document (<= 2MB). Prefer this for base64 data URIs. Give exactly one of html / htmlPath.' },
891
+ kind: { type: 'string', enum: ['project-demo', 'blog-post', 'feature', 'episode'], description: 'What the video is: exactly one of project-demo, blog-post, feature, episode (one episode of a series, such as a TikTok short). The aspect comes from the document\'s <meta name="sm-demo-aspect" content="16:9|9:16"> tag (default 16:9).' },
892
+ lengthS: { type: 'number', description: 'Length of the video in seconds. Also sets the size cap: 2 MiB per started 30 s (30 s = 2 MiB, 60 s = 4 MiB).' },
893
+ html: { type: 'string', description: 'The complete self-contained HTML/JS video document (<= 2 MiB per started 30 s of lengthS, e.g. 4 MiB for 60 s; no remote references or network-capable APIs).' },
894
+ htmlPath: { type: 'string', description: 'Absolute path to a local .html/.htm file holding the document (<= 2 MiB per started 30 s of lengthS, e.g. 4 MiB for 60 s). Prefer this for base64 data URIs. Give exactly one of html / htmlPath.' },
786
895
  meta: { type: 'object', description: 'Required by the save route, which rejects any other key. Keys: title, kind, target (optional), style, lengthS, character (null when there is no mascot), sources [{claim, source, ref}], report {lufs, truePeakDb, speechS, readingGrade, checks [{id, ok, detail}]}, macroVersion, seedVersion, model, effort.' },
787
896
  },
788
897
  required: ['videoId', 'title', 'kind', 'lengthS', 'meta'],
789
898
  },
790
899
  },
900
+ {
901
+ name: 'project_video_review_write',
902
+ description: descriptionFor('project_video_review_write'),
903
+ inputSchema: {
904
+ type: 'object',
905
+ properties: {
906
+ cwd: { type: 'string', description: "Optional: absolute path to the target project. Defaults to the calling session's own project root (SM_PROJECT_ROOT or process.cwd()) when omitted." },
907
+ videoId: { type: 'string', description: 'Id of the review-stage video entry this run was dispatched for.' },
908
+ text: { type: 'string', minLength: 1, maxLength: REVIEW_TEXT_MAX, description: `The review text the human reads (1-${REVIEW_TEXT_MAX} characters), such as a whole episode script.` },
909
+ imagePaths: {
910
+ type: 'array',
911
+ minItems: 1,
912
+ maxItems: REVIEW_IMAGES_MAX,
913
+ items: { type: 'string' },
914
+ description: `1-${REVIEW_IMAGES_MAX} absolute paths to local .png/.jpg/.jpeg/.webp files, each at most 2 MiB, such as a storyboard contact sheet. Read and sent by this server.`,
915
+ },
916
+ },
917
+ required: ['videoId', 'text', 'imagePaths'],
918
+ },
919
+ },
791
920
  {
792
921
  name: 'macro_list',
793
922
  description: descriptionFor('macro_list'),
@@ -810,9 +939,19 @@ const TOOLS = [
810
939
  agentName: { type: 'string', description: 'Persona to run the macro as (e.g. "builder").' },
811
940
  tag: { type: 'string', description: 'Mission tag for the macro.' },
812
941
  prompt: { type: 'string', description: 'The opening prompt the macro sends. Write input placeholders as {{name}}; each is filled from the matching entry in `inputs` when the macro is pressed.' },
813
- surface: { type: 'string', enum: ['sessions', 'project-home'], description: "Where the macro shows: 'sessions' = Sessions HOT KEYS strip; 'project-home' = a tool in Project Home ▸ Tools, shown in every project (only what it generates is per project). A 'project-home' save needs humanRequestQuote and a Session Manager chat session." },
942
+ surface: { type: 'string', enum: ['sessions', 'project-home', 'project-video'], description: "Where the macro shows: 'sessions' = Sessions HOT KEYS strip; 'project-home' = a tool in Project Home ▸ Tools, shown in every project (only what it generates is per project); 'project-video' = a tool in THIS project's Project Home ▸ Video only, beside Demo Video, that may carry job. A 'project-home' or 'project-video' save needs humanRequestQuote naming Project Home and a Session Manager chat session." },
943
+ job: {
944
+ type: 'object',
945
+ description: "Only with surface 'project-video': the tool runs as a background job. Omit on update to keep the stored job; pass null to remove it.",
946
+ properties: {
947
+ estimateMinutes: { type: 'integer', minimum: 5, maximum: 60, description: 'Expected run time in minutes (5-60).' },
948
+ repoPaths: { type: 'array', items: { type: 'string' }, description: 'Optional: repo-relative paths the job may write (1-20, "/"-separated, not under session-manager-operations/ or .git).' },
949
+ review: { type: 'boolean', description: 'Optional: true = the result waits for a human review step.' },
950
+ },
951
+ required: ['estimateMinutes'],
952
+ },
814
953
  projects: { type: 'array', items: { type: 'string' }, description: 'Optional: only ["*"] is accepted, to show the macro in every project. Needs humanRequestQuote and a Session Manager chat session.' },
815
- humanRequestQuote: { type: 'string', description: "With projects [\"*\"] or surface 'project-home': the exact words the human typed in this chat asking for every project or for a Project Home tool." },
954
+ humanRequestQuote: { type: 'string', description: "With projects [\"*\"] or surface 'project-home' / 'project-video': the exact words the human typed in this chat asking for every project or naming Project Home." },
816
955
  inputs: {
817
956
  type: 'array',
818
957
  description: 'Optional input fields the human fills in before the macro runs. Prompt placeholders are written as {{name}}. Omit on update to keep the existing inputs; pass [] to clear them.',
@@ -1055,6 +1194,30 @@ async function handleCallTool(request) {
1055
1194
  const result = await adminRequest('GET', `/admin/agents${suffix}`);
1056
1195
  return { content: [{ type: 'text', text: JSON.stringify(result) }] };
1057
1196
  }
1197
+ if (name === 'task_list') {
1198
+ // URLSearchParams percent-encodes every value.
1199
+ const qs = new URLSearchParams();
1200
+ if (args?.cwd) qs.set('cwd', args.cwd);
1201
+ for (const key of ['since', 'until', 'pipeline', 'runId', 'step', 'agent', 'status', 'source']) {
1202
+ if (typeof args?.[key] === 'string' && args[key] !== '') qs.set(key, args[key]);
1203
+ }
1204
+ if (args?.limit !== undefined) qs.set('limit', String(args.limit));
1205
+ if (args?.offset !== undefined) qs.set('offset', String(args.offset));
1206
+ const result = await adminRequest('GET', `/admin/tasks?${qs.toString()}`);
1207
+ // Same partial-page guard as epic_list.
1208
+ if (result?.ok && result.hasMore) {
1209
+ result.note = `partial list: returned ${result.tasks.length} of ${result.total} Tasks — pass a higher offset to see more`;
1210
+ }
1211
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
1212
+ }
1213
+ if (name === 'task_get') {
1214
+ if (typeof args?.id !== 'string' || args.id === '') return errorResult('missing required argument: id');
1215
+ const qs = new URLSearchParams();
1216
+ if (args?.cwd) qs.set('cwd', args.cwd);
1217
+ qs.set('id', args.id);
1218
+ const result = await adminRequest('GET', `/admin/task?${qs.toString()}`);
1219
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
1220
+ }
1058
1221
  if (name === 'epic_get') {
1059
1222
  const hasId = typeof args?.id === 'string' && args.id !== '';
1060
1223
  const hasRef = typeof args?.externalRef === 'string' && args.externalRef !== '';
@@ -1102,7 +1265,10 @@ async function handleCallTool(request) {
1102
1265
  return errorResult('missing required argument: slug');
1103
1266
  }
1104
1267
  const cwd = args && typeof args.cwd === 'string' ? args.cwd : undefined;
1105
- const result = await adminRequest('POST', '/admin/scheduler/cancel-job', { slug, cwd });
1268
+ // dependents (PRD 3499): forwarded as-is; the admin route validates the
1269
+ // shape and refuses a cancel with pending dependents when it is absent.
1270
+ const dependents = args && args.dependents && typeof args.dependents === 'object' ? args.dependents : undefined;
1271
+ const result = await adminRequest('POST', '/admin/scheduler/cancel-job', { slug, cwd, dependents });
1106
1272
  return { content: [{ type: 'text', text: JSON.stringify(result) }] };
1107
1273
  }
1108
1274
  if (name === 'scheduler_retag_prd') {
@@ -1261,7 +1427,7 @@ async function handleCallTool(request) {
1261
1427
  } catch (err) {
1262
1428
  if (err && err.code === 'SM_UNKNOWN_ROUTE') {
1263
1429
  return errorResult(`${err.message} feedback_reply needs Session Manager v0.136.0 or later. `
1264
- + 'Until the app is restarted, send your answer with feedback_open_session to the asking project; '
1430
+ + 'Until the running app has this route, send your answer with feedback_open_session to the asking project; '
1265
1431
  + 'it opens there as a new proposed session.');
1266
1432
  }
1267
1433
  throw err;
@@ -1372,7 +1538,7 @@ async function handleCallTool(request) {
1372
1538
  || typeof args.kind !== 'string' || !args.kind || typeof args.lengthS !== 'number' || !Number.isFinite(args.lengthS)) {
1373
1539
  return errorResult('missing required arguments: videoId, title, kind, lengthS');
1374
1540
  }
1375
- const loaded = await resolveHtmlArg(args);
1541
+ const loaded = await resolveHtmlArg(args, { maxBytes: maxVideoBytesFor(args.lengthS), lengthS: args.lengthS });
1376
1542
  if (loaded.error) return errorResult(loaded.error);
1377
1543
  const cwd = resolveCwdArg(args);
1378
1544
  const body = { cwd, videoId: args.videoId, title: args.title, kind: args.kind, lengthS: args.lengthS, html: loaded.html };
@@ -1380,6 +1546,20 @@ async function handleCallTool(request) {
1380
1546
  const result = await adminRequest('POST', '/admin/project-home/videos/write', body);
1381
1547
  return { content: [{ type: 'text', text: JSON.stringify(result) }] };
1382
1548
  }
1549
+ if (name === 'project_video_review_write') {
1550
+ if (!args || typeof args.videoId !== 'string' || !args.videoId) return errorResult('missing required argument: videoId');
1551
+ if (typeof args.text !== 'string' || args.text.length < 1 || args.text.length > REVIEW_TEXT_MAX) {
1552
+ return errorResult(`text must be 1-${REVIEW_TEXT_MAX} characters`);
1553
+ }
1554
+ const loaded = await readReviewImages(args.imagePaths);
1555
+ if (loaded.error) return errorResult(loaded.error);
1556
+ const cwd = resolveCwdArg(args);
1557
+ const result = await adminRequest('POST', '/admin/project-home/videos/review/write', {
1558
+ cwd, videoId: args.videoId, text: args.text, images: loaded.images,
1559
+ });
1560
+ if (result?.ok === false) return errorResult(result.error ?? 'project_video_review_write failed');
1561
+ return { content: [{ type: 'text', text: JSON.stringify(result) }] };
1562
+ }
1383
1563
  if (name === 'macro_list') {
1384
1564
  const cwd = resolveCwdArg(args);
1385
1565
  const result = await adminRequest('GET', `/admin/macros?cwd=${encodeURIComponent(cwd)}`);
@@ -1400,6 +1580,12 @@ async function handleCallTool(request) {
1400
1580
  + 'Say in your final result that the human can add it from Project Home ▸ Tools ▸ Add a tool.',
1401
1581
  );
1402
1582
  if (refusal) return refusal;
1583
+ } else if (args.surface === 'project-video') {
1584
+ const refusal = humanSessionRefusal(
1585
+ "refused: a Project Video tool (this project's Project Home ▸ Video) is saved only in a Session Manager chat session where the human asked for it. "
1586
+ + 'Say in your final result that the human can add it from Project Home ▸ Video.',
1587
+ );
1588
+ if (refusal) return refusal;
1403
1589
  } else if (args.projects !== undefined) {
1404
1590
  const refusal = humanSessionRefusal(
1405
1591
  'refused: a macro shown in every project is saved only in a Session Manager chat session where the human asked for it. '
@@ -1413,6 +1599,7 @@ async function handleCallTool(request) {
1413
1599
  if (Array.isArray(args.inputs)) payload.inputs = args.inputs;
1414
1600
  if (typeof args.surface === 'string') payload.surface = args.surface;
1415
1601
  if (Array.isArray(args.projects)) payload.projects = args.projects;
1602
+ if (args.job === null || (args.job && typeof args.job === 'object' && !Array.isArray(args.job))) payload.job = args.job;
1416
1603
  if (typeof args.humanRequestQuote === 'string') payload.humanRequestQuote = args.humanRequestQuote;
1417
1604
  payload.originClaudeSessionId = process.env.SM_CHAT_SESSION_ID;
1418
1605
  const result = await adminRequest('POST', '/admin/macros/save', payload);
@@ -1530,5 +1717,5 @@ if (require.main === module) {
1530
1717
  }
1531
1718
 
1532
1719
  module.exports = {
1533
- TOOLS, handleCallTool, HELP_POINTER, NOT_RUNNING_ERROR, busyError, unknownRouteMessage, compareVersions,
1720
+ TOOLS, handleCallTool, HELP_POINTER, maxVideoBytesFor, resolveHtmlArg, NOT_RUNNING_ERROR, busyError, unknownRouteMessage, compareVersions,
1534
1721
  };
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.139.0",
3
- "gitSha": "ca86eb20ac810d686da85bf23356b2e8a9ae86a8",
4
- "gitShortSha": "ca86eb20",
2
+ "version": "0.141.0",
3
+ "gitSha": "0db73892da43176f003e4495092dfb8283045331",
4
+ "gitShortSha": "0db73892",
5
5
  "gitBranch": "HEAD",
6
- "builtAt": "2026-11-22T16:17:18.856Z",
6
+ "builtAt": "2026-11-23T02:26:13.633Z",
7
7
  "dirty": false
8
8
  }