claude-code-session-manager 0.139.0 → 0.140.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.
- package/README.md +20 -4
- package/dist/assets/AppSettings-CMFEM68R.js +2 -0
- package/dist/assets/History--JwsFnbn.js +2 -0
- package/dist/assets/{HomeClaudeConfig-CGD2Onjv.js → HomeClaudeConfig-ijEXs--3.js} +2 -2
- package/dist/assets/{Panel-Csyd9HbD.js → Panel-CALyU0pe.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-C-jlYpC_.js → ProjectClaudeConfig-sdlA-fUb.js} +1 -1
- package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
- package/dist/assets/{SkillReferenceGraph-DcscPXAG.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
- package/dist/assets/{Skills-BpGRKOcY.js → Skills-DtRzghn5.js} +26 -26
- package/dist/assets/{TiptapBody-DSU3769X.js → TiptapBody-DApeu7x8.js} +1 -1
- package/dist/assets/{ViewTabs-C0PRZx4_.js → ViewTabs-B7qLXRAH.js} +1 -1
- package/dist/assets/{VoiceButton-D2rMurNg.js → VoiceButton-DtStfv1H.js} +1 -1
- package/dist/assets/{historyTotals-TcIQs2sh.js → historyTotals-ydfnwepc.js} +1 -1
- package/dist/assets/index-CtxruO1L.js +3121 -0
- package/dist/assets/{index-BCySPdtU.css → index-DKXdXfka.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +423 -426
- package/package.json +5 -2
- package/plugins/AGENTS.md +60 -0
- package/plugins/CLAUDE.md +1 -60
- package/plugins/session-manager-dev/skills/develop/SKILL.md +26 -19
- package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
- package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
- package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
- package/scripts/README.md +1 -0
- package/scripts/hooks/guard-tool-risk.cjs +91 -0
- package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
- package/scripts/ops-sweep.cjs +53 -23
- package/scripts/scheduler-mcp-server.cjs +200 -18
- package/src/main/build-info.json +4 -4
- package/src/main/config.cjs +112 -8
- package/src/main/docEdit.cjs +6 -1
- package/src/main/files.cjs +7 -27
- package/src/main/health.cjs +48 -15
- package/src/main/historyAggregator.cjs +88 -5
- package/src/main/historyDashboard.cjs +69 -4
- package/src/main/index.cjs +56 -2
- package/src/main/ipcSchemas.cjs +112 -16
- package/src/main/lib/AGENTS.md +54 -0
- package/src/main/lib/CLAUDE.md +1 -54
- package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
- package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
- package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
- package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
- package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
- package/src/main/lib/claude/effectiveModelInfo.cjs +90 -20
- package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
- package/src/main/lib/claude/personaToolScope.cjs +12 -6
- package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
- package/src/main/lib/claude/runClaudeP.cjs +6 -1
- package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
- package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
- package/src/main/lib/ephemeralCwd.cjs +37 -2
- package/src/main/lib/epic/delegationReadiness.cjs +42 -9
- package/src/main/lib/epic/epicAdminRoutes.cjs +25 -5
- package/src/main/lib/epic/epicOutsideRead.cjs +118 -1
- package/src/main/lib/epic/epicOutsideState.cjs +2 -2
- package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
- package/src/main/lib/epic/epicValidationHook.cjs +24 -4
- package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
- package/src/main/lib/externalContract.cjs +31 -5
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +55 -1
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +106 -11
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +47 -19
- package/src/main/lib/feedback-remote/needsYouStore.cjs +6 -2
- package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
- package/src/main/lib/git/branchSweep.cjs +209 -4
- package/src/main/lib/git/gitWorktree.cjs +41 -5
- package/src/main/lib/guardShims.cjs +1 -1
- package/src/main/lib/historyRollup.cjs +26 -0
- package/src/main/lib/insideHome.cjs +27 -1
- package/src/main/lib/mcpToolCatalog.cjs +122 -12
- package/src/main/lib/mdDocCensus.cjs +59 -78
- package/src/main/lib/mdDocRefs.cjs +71 -93
- package/src/main/lib/mdNetworkScan.cjs +245 -250
- package/src/main/lib/mdReviewRecord.cjs +22 -9
- package/src/main/lib/memoryMdNetwork.cjs +5 -12
- package/src/main/lib/opsOwnership.cjs +18 -2
- package/src/main/lib/opsRetentionSettings.cjs +28 -4
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
- package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
- package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
- package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
- package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
- package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/depSlugResolve.cjs +104 -4
- package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
- package/src/main/lib/prd/prdCreate.cjs +351 -23
- package/src/main/lib/prd/prdDisposition.cjs +11 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
- package/src/main/lib/process/loginItem.cjs +171 -0
- package/src/main/lib/process/loginItemPlan.cjs +193 -0
- package/src/main/lib/project-pages/playerBridge.cjs +4 -0
- package/src/main/lib/project-pages/videoReview.cjs +268 -0
- package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
- package/src/main/lib/scheduler/cpuSample.cjs +131 -4
- package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
- package/src/main/lib/scheduler/loadGate.cjs +24 -6
- package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
- package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
- package/src/main/lib/scheduler/queueStore.cjs +7 -0
- package/src/main/lib/scheduler/rcaReport.cjs +21 -1
- package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
- package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
- package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
- package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
- package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
- package/src/main/lib/scheduler/validationQuality.cjs +282 -0
- package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
- package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
- package/src/main/lib/tasks/taskIpc.cjs +80 -0
- package/src/main/lib/tasks/taskLedger.cjs +502 -0
- package/src/main/lib/tasks/taskRun.cjs +313 -0
- package/src/main/lib/tasks/taskSwitch.cjs +120 -0
- package/src/main/loginItemIpc.cjs +35 -0
- package/src/main/loopEfficiencyHandlers.cjs +10 -1
- package/src/main/projectPages.cjs +6 -15
- package/src/main/promptSessionEvents.cjs +9 -1
- package/src/main/queueOps.cjs +260 -3
- package/src/main/runVerify.cjs +53 -25
- package/src/main/scheduler/AGENTS.md +26 -0
- package/src/main/scheduler/CLAUDE.md +1 -26
- package/src/main/scheduler/budget.cjs +239 -9
- package/src/main/scheduler/cancelDependents.cjs +154 -0
- package/src/main/scheduler/prdParser.cjs +4 -1
- package/src/main/scheduler/starvation.cjs +20 -18
- package/src/main/scheduler.cjs +745 -64
- package/src/main/supervisor.cjs +5 -1
- package/src/main/templates/PRD_AUTHORING.md +6 -1
- package/src/main/validationQualityHandlers.cjs +199 -0
- package/src/main/webRemote.cjs +10 -2
- package/src/preload/api.d.ts +364 -21
- package/src/preload/apiSurface.json +89 -10
- package/src/preload/index.cjs +23 -2
- package/src/seed/agents/validator.md +19 -8
- package/dist/assets/AppSettings-CUfWY9vN.js +0 -2
- package/dist/assets/History-DDnqaLyw.js +0 -2
- package/dist/assets/Scheduler-NLs08fx7.js +0 -16
- package/dist/assets/index-C-d0DCre.js +0 -3124
package/scripts/ops-sweep.cjs
CHANGED
|
@@ -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
|
|
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
|
|
28
|
-
* (excluding node_modules)
|
|
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/
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
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
|
-
|
|
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
|
|
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(
|
|
178
|
-
const ownershipDoc = 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:
|
|
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
|
|
306
|
-
// (excluding node_modules and .git) gets a fixed 4000-byte cap
|
|
307
|
-
//
|
|
308
|
-
//
|
|
309
|
-
//
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
334
|
-
|
|
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
|
-
/**
|
|
96
|
-
|
|
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 >
|
|
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
|
-
/**
|
|
112
|
-
|
|
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,10 @@ 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
|
+
},
|
|
360
421
|
quietMachine: {
|
|
361
422
|
type: 'boolean',
|
|
362
423
|
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 +521,39 @@ const TOOLS = [
|
|
|
460
521
|
},
|
|
461
522
|
},
|
|
462
523
|
},
|
|
524
|
+
{
|
|
525
|
+
name: 'task_list',
|
|
526
|
+
description: descriptionFor('task_list'),
|
|
527
|
+
inputSchema: {
|
|
528
|
+
type: 'object',
|
|
529
|
+
properties: {
|
|
530
|
+
cwd: { type: 'string', description: 'Absolute path of the project root whose Task ledger to list' },
|
|
531
|
+
since: { type: 'string', description: 'Optional: ISO timestamp; only Tasks started at or after it' },
|
|
532
|
+
until: { type: 'string', description: 'Optional: ISO timestamp; only Tasks started at or before it' },
|
|
533
|
+
pipeline: { type: 'string', description: "Optional: only Tasks whose caller.pipeline equals this" },
|
|
534
|
+
runId: { type: 'string', description: "Optional: only Tasks whose caller.runId equals this" },
|
|
535
|
+
step: { type: 'string', description: "Optional: only Tasks whose caller.step equals this" },
|
|
536
|
+
agent: { type: 'string', description: 'Optional: only Tasks run as this agent persona' },
|
|
537
|
+
status: { type: 'string', description: 'Optional: only Tasks with this status (ok, error, timeout, ...)' },
|
|
538
|
+
source: { type: 'string', enum: ['sm', 'direct'], description: 'Optional: "sm" = run by Session Manager, "direct" = imported call that ran without it' },
|
|
539
|
+
limit: { type: 'number', description: 'Optional: page size, default 50, max 200' },
|
|
540
|
+
offset: { type: 'number', description: 'Optional: page offset, default 0' },
|
|
541
|
+
},
|
|
542
|
+
required: ['cwd'],
|
|
543
|
+
},
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: 'task_get',
|
|
547
|
+
description: descriptionFor('task_get'),
|
|
548
|
+
inputSchema: {
|
|
549
|
+
type: 'object',
|
|
550
|
+
properties: {
|
|
551
|
+
cwd: { type: 'string', description: 'Absolute path of the project root the Task belongs to' },
|
|
552
|
+
id: { type: 'string', description: 'The taskId, from task_list' },
|
|
553
|
+
},
|
|
554
|
+
required: ['cwd', 'id'],
|
|
555
|
+
},
|
|
556
|
+
},
|
|
463
557
|
{
|
|
464
558
|
name: 'epic_get',
|
|
465
559
|
description: descriptionFor('epic_get'),
|
|
@@ -509,6 +603,7 @@ const TOOLS = [
|
|
|
509
603
|
quietMachine: { type: 'boolean', description: 'Optional: the exclusive machine-wide quiet lease flag (see scheduler_create_prd) — patchable after creation too' },
|
|
510
604
|
dependsOn: { type: 'array', items: { type: 'string' }, description: 'Optional: replaces the dependsOn list; an explicit empty array CLEARS it — see scheduler_create_prd' },
|
|
511
605
|
disposition: { type: 'string', enum: ['append', 'new-head'], description: 'Optional: patches the recorded wave-authoring decision — see scheduler_create_prd' },
|
|
606
|
+
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.' },
|
|
512
607
|
},
|
|
513
608
|
},
|
|
514
609
|
body: { type: 'string', description: 'Optional: full replacement body (everything after the frontmatter). Cannot be combined with gate/files/acceptanceCriteria.' },
|
|
@@ -539,6 +634,15 @@ const TOOLS = [
|
|
|
539
634
|
properties: {
|
|
540
635
|
slug: { type: 'string', description: 'PRD slug of the job to cancel' },
|
|
541
636
|
cwd: { type: 'string', description: 'Optional: the PRD project cwd, narrows/speeds the search' },
|
|
637
|
+
dependents: {
|
|
638
|
+
type: 'object',
|
|
639
|
+
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.',
|
|
640
|
+
properties: {
|
|
641
|
+
action: { type: 'string', enum: ['cascade', 'repoint', 'clear'] },
|
|
642
|
+
to: { type: 'string', description: 'PRD slug the dependents should depend on instead — required for action "repoint"' },
|
|
643
|
+
},
|
|
644
|
+
required: ['action'],
|
|
645
|
+
},
|
|
542
646
|
},
|
|
543
647
|
required: ['slug'],
|
|
544
648
|
},
|
|
@@ -779,15 +883,35 @@ const TOOLS = [
|
|
|
779
883
|
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
884
|
videoId: { type: 'string', description: 'Stable id (kebab-case) of the video; writing the same id replaces that video.' },
|
|
781
885
|
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 (<=
|
|
785
|
-
htmlPath: { type: 'string', description: 'Absolute path to a local .html/.htm file holding the document (<=
|
|
886
|
+
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).' },
|
|
887
|
+
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).' },
|
|
888
|
+
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).' },
|
|
889
|
+
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
890
|
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
891
|
},
|
|
788
892
|
required: ['videoId', 'title', 'kind', 'lengthS', 'meta'],
|
|
789
893
|
},
|
|
790
894
|
},
|
|
895
|
+
{
|
|
896
|
+
name: 'project_video_review_write',
|
|
897
|
+
description: descriptionFor('project_video_review_write'),
|
|
898
|
+
inputSchema: {
|
|
899
|
+
type: 'object',
|
|
900
|
+
properties: {
|
|
901
|
+
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." },
|
|
902
|
+
videoId: { type: 'string', description: 'Id of the review-stage video entry this run was dispatched for.' },
|
|
903
|
+
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.` },
|
|
904
|
+
imagePaths: {
|
|
905
|
+
type: 'array',
|
|
906
|
+
minItems: 1,
|
|
907
|
+
maxItems: REVIEW_IMAGES_MAX,
|
|
908
|
+
items: { type: 'string' },
|
|
909
|
+
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.`,
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
required: ['videoId', 'text', 'imagePaths'],
|
|
913
|
+
},
|
|
914
|
+
},
|
|
791
915
|
{
|
|
792
916
|
name: 'macro_list',
|
|
793
917
|
description: descriptionFor('macro_list'),
|
|
@@ -810,9 +934,19 @@ const TOOLS = [
|
|
|
810
934
|
agentName: { type: 'string', description: 'Persona to run the macro as (e.g. "builder").' },
|
|
811
935
|
tag: { type: 'string', description: 'Mission tag for the macro.' },
|
|
812
936
|
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." },
|
|
937
|
+
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." },
|
|
938
|
+
job: {
|
|
939
|
+
type: 'object',
|
|
940
|
+
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.",
|
|
941
|
+
properties: {
|
|
942
|
+
estimateMinutes: { type: 'integer', minimum: 5, maximum: 60, description: 'Expected run time in minutes (5-60).' },
|
|
943
|
+
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).' },
|
|
944
|
+
review: { type: 'boolean', description: 'Optional: true = the result waits for a human review step.' },
|
|
945
|
+
},
|
|
946
|
+
required: ['estimateMinutes'],
|
|
947
|
+
},
|
|
814
948
|
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
|
|
949
|
+
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
950
|
inputs: {
|
|
817
951
|
type: 'array',
|
|
818
952
|
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 +1189,30 @@ async function handleCallTool(request) {
|
|
|
1055
1189
|
const result = await adminRequest('GET', `/admin/agents${suffix}`);
|
|
1056
1190
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1057
1191
|
}
|
|
1192
|
+
if (name === 'task_list') {
|
|
1193
|
+
// URLSearchParams percent-encodes every value.
|
|
1194
|
+
const qs = new URLSearchParams();
|
|
1195
|
+
if (args?.cwd) qs.set('cwd', args.cwd);
|
|
1196
|
+
for (const key of ['since', 'until', 'pipeline', 'runId', 'step', 'agent', 'status', 'source']) {
|
|
1197
|
+
if (typeof args?.[key] === 'string' && args[key] !== '') qs.set(key, args[key]);
|
|
1198
|
+
}
|
|
1199
|
+
if (args?.limit !== undefined) qs.set('limit', String(args.limit));
|
|
1200
|
+
if (args?.offset !== undefined) qs.set('offset', String(args.offset));
|
|
1201
|
+
const result = await adminRequest('GET', `/admin/tasks?${qs.toString()}`);
|
|
1202
|
+
// Same partial-page guard as epic_list.
|
|
1203
|
+
if (result?.ok && result.hasMore) {
|
|
1204
|
+
result.note = `partial list: returned ${result.tasks.length} of ${result.total} Tasks — pass a higher offset to see more`;
|
|
1205
|
+
}
|
|
1206
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1207
|
+
}
|
|
1208
|
+
if (name === 'task_get') {
|
|
1209
|
+
if (typeof args?.id !== 'string' || args.id === '') return errorResult('missing required argument: id');
|
|
1210
|
+
const qs = new URLSearchParams();
|
|
1211
|
+
if (args?.cwd) qs.set('cwd', args.cwd);
|
|
1212
|
+
qs.set('id', args.id);
|
|
1213
|
+
const result = await adminRequest('GET', `/admin/task?${qs.toString()}`);
|
|
1214
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1215
|
+
}
|
|
1058
1216
|
if (name === 'epic_get') {
|
|
1059
1217
|
const hasId = typeof args?.id === 'string' && args.id !== '';
|
|
1060
1218
|
const hasRef = typeof args?.externalRef === 'string' && args.externalRef !== '';
|
|
@@ -1102,7 +1260,10 @@ async function handleCallTool(request) {
|
|
|
1102
1260
|
return errorResult('missing required argument: slug');
|
|
1103
1261
|
}
|
|
1104
1262
|
const cwd = args && typeof args.cwd === 'string' ? args.cwd : undefined;
|
|
1105
|
-
|
|
1263
|
+
// dependents (PRD 3499): forwarded as-is; the admin route validates the
|
|
1264
|
+
// shape and refuses a cancel with pending dependents when it is absent.
|
|
1265
|
+
const dependents = args && args.dependents && typeof args.dependents === 'object' ? args.dependents : undefined;
|
|
1266
|
+
const result = await adminRequest('POST', '/admin/scheduler/cancel-job', { slug, cwd, dependents });
|
|
1106
1267
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1107
1268
|
}
|
|
1108
1269
|
if (name === 'scheduler_retag_prd') {
|
|
@@ -1261,7 +1422,7 @@ async function handleCallTool(request) {
|
|
|
1261
1422
|
} catch (err) {
|
|
1262
1423
|
if (err && err.code === 'SM_UNKNOWN_ROUTE') {
|
|
1263
1424
|
return errorResult(`${err.message} feedback_reply needs Session Manager v0.136.0 or later. `
|
|
1264
|
-
+ 'Until the app
|
|
1425
|
+
+ 'Until the running app has this route, send your answer with feedback_open_session to the asking project; '
|
|
1265
1426
|
+ 'it opens there as a new proposed session.');
|
|
1266
1427
|
}
|
|
1267
1428
|
throw err;
|
|
@@ -1372,7 +1533,7 @@ async function handleCallTool(request) {
|
|
|
1372
1533
|
|| typeof args.kind !== 'string' || !args.kind || typeof args.lengthS !== 'number' || !Number.isFinite(args.lengthS)) {
|
|
1373
1534
|
return errorResult('missing required arguments: videoId, title, kind, lengthS');
|
|
1374
1535
|
}
|
|
1375
|
-
const loaded = await resolveHtmlArg(args);
|
|
1536
|
+
const loaded = await resolveHtmlArg(args, { maxBytes: maxVideoBytesFor(args.lengthS), lengthS: args.lengthS });
|
|
1376
1537
|
if (loaded.error) return errorResult(loaded.error);
|
|
1377
1538
|
const cwd = resolveCwdArg(args);
|
|
1378
1539
|
const body = { cwd, videoId: args.videoId, title: args.title, kind: args.kind, lengthS: args.lengthS, html: loaded.html };
|
|
@@ -1380,6 +1541,20 @@ async function handleCallTool(request) {
|
|
|
1380
1541
|
const result = await adminRequest('POST', '/admin/project-home/videos/write', body);
|
|
1381
1542
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1382
1543
|
}
|
|
1544
|
+
if (name === 'project_video_review_write') {
|
|
1545
|
+
if (!args || typeof args.videoId !== 'string' || !args.videoId) return errorResult('missing required argument: videoId');
|
|
1546
|
+
if (typeof args.text !== 'string' || args.text.length < 1 || args.text.length > REVIEW_TEXT_MAX) {
|
|
1547
|
+
return errorResult(`text must be 1-${REVIEW_TEXT_MAX} characters`);
|
|
1548
|
+
}
|
|
1549
|
+
const loaded = await readReviewImages(args.imagePaths);
|
|
1550
|
+
if (loaded.error) return errorResult(loaded.error);
|
|
1551
|
+
const cwd = resolveCwdArg(args);
|
|
1552
|
+
const result = await adminRequest('POST', '/admin/project-home/videos/review/write', {
|
|
1553
|
+
cwd, videoId: args.videoId, text: args.text, images: loaded.images,
|
|
1554
|
+
});
|
|
1555
|
+
if (result?.ok === false) return errorResult(result.error ?? 'project_video_review_write failed');
|
|
1556
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1557
|
+
}
|
|
1383
1558
|
if (name === 'macro_list') {
|
|
1384
1559
|
const cwd = resolveCwdArg(args);
|
|
1385
1560
|
const result = await adminRequest('GET', `/admin/macros?cwd=${encodeURIComponent(cwd)}`);
|
|
@@ -1400,6 +1575,12 @@ async function handleCallTool(request) {
|
|
|
1400
1575
|
+ 'Say in your final result that the human can add it from Project Home ▸ Tools ▸ Add a tool.',
|
|
1401
1576
|
);
|
|
1402
1577
|
if (refusal) return refusal;
|
|
1578
|
+
} else if (args.surface === 'project-video') {
|
|
1579
|
+
const refusal = humanSessionRefusal(
|
|
1580
|
+
"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. "
|
|
1581
|
+
+ 'Say in your final result that the human can add it from Project Home ▸ Video.',
|
|
1582
|
+
);
|
|
1583
|
+
if (refusal) return refusal;
|
|
1403
1584
|
} else if (args.projects !== undefined) {
|
|
1404
1585
|
const refusal = humanSessionRefusal(
|
|
1405
1586
|
'refused: a macro shown in every project is saved only in a Session Manager chat session where the human asked for it. '
|
|
@@ -1413,6 +1594,7 @@ async function handleCallTool(request) {
|
|
|
1413
1594
|
if (Array.isArray(args.inputs)) payload.inputs = args.inputs;
|
|
1414
1595
|
if (typeof args.surface === 'string') payload.surface = args.surface;
|
|
1415
1596
|
if (Array.isArray(args.projects)) payload.projects = args.projects;
|
|
1597
|
+
if (args.job === null || (args.job && typeof args.job === 'object' && !Array.isArray(args.job))) payload.job = args.job;
|
|
1416
1598
|
if (typeof args.humanRequestQuote === 'string') payload.humanRequestQuote = args.humanRequestQuote;
|
|
1417
1599
|
payload.originClaudeSessionId = process.env.SM_CHAT_SESSION_ID;
|
|
1418
1600
|
const result = await adminRequest('POST', '/admin/macros/save', payload);
|
|
@@ -1530,5 +1712,5 @@ if (require.main === module) {
|
|
|
1530
1712
|
}
|
|
1531
1713
|
|
|
1532
1714
|
module.exports = {
|
|
1533
|
-
TOOLS, handleCallTool, HELP_POINTER, NOT_RUNNING_ERROR, busyError, unknownRouteMessage, compareVersions,
|
|
1715
|
+
TOOLS, handleCallTool, HELP_POINTER, maxVideoBytesFor, resolveHtmlArg, NOT_RUNNING_ERROR, busyError, unknownRouteMessage, compareVersions,
|
|
1534
1716
|
};
|
package/src/main/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"gitSha": "
|
|
4
|
-
"gitShortSha": "
|
|
2
|
+
"version": "0.140.0",
|
|
3
|
+
"gitSha": "ed067977a72d554bc895a39e8082b841cb24faa0",
|
|
4
|
+
"gitShortSha": "ed067977",
|
|
5
5
|
"gitBranch": "HEAD",
|
|
6
|
-
"builtAt": "2026-11-
|
|
6
|
+
"builtAt": "2026-11-23T01:17:06.719Z",
|
|
7
7
|
"dirty": false
|
|
8
8
|
}
|