claude-code-session-manager 0.138.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/.claude-plugin/marketplace.json +1 -1
- package/README.md +352 -79
- package/dist/assets/AppSettings-CMFEM68R.js +2 -0
- package/dist/assets/History--JwsFnbn.js +2 -0
- package/dist/assets/HomeClaudeConfig-ijEXs--3.js +3 -0
- package/dist/assets/{Panel-CeDiyuNn.js → Panel-CALyU0pe.js} +1 -1
- package/dist/assets/ProjectClaudeConfig-sdlA-fUb.js +26 -0
- package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
- package/dist/assets/{SkillReferenceGraph-CFMK8NJh.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
- package/dist/assets/Skills-DtRzghn5.js +67 -0
- package/dist/assets/{TiptapBody-D1kTj-tn.js → TiptapBody-DApeu7x8.js} +60 -54
- package/dist/assets/ViewTabs-B7qLXRAH.js +1 -0
- package/dist/assets/{VoiceButton-CZeyPM31.js → VoiceButton-DtStfv1H.js} +1 -1
- package/dist/assets/{historyTotals-B00l64Jw.js → historyTotals-ydfnwepc.js} +1 -1
- package/dist/assets/index-CtxruO1L.js +3121 -0
- package/dist/assets/{index-62tyjEQB.css → index-DKXdXfka.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +467 -451
- package/package.json +17 -6
- package/plugins/AGENTS.md +60 -0
- package/plugins/CLAUDE.md +1 -60
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/skills/builder/SKILL.md +12 -4
- package/plugins/session-manager-dev/skills/builder/scripts/publish-preflight.cjs +255 -0
- package/plugins/session-manager-dev/skills/develop/SKILL.md +36 -22
- 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 +2 -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 +360 -35
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +2 -2
- package/src/main/config.cjs +112 -8
- package/src/main/docEdit.cjs +6 -1
- package/src/main/exchanges.cjs +70 -5
- package/src/main/files.cjs +7 -27
- package/src/main/health.cjs +48 -15
- package/src/main/historyAggregator.cjs +172 -63
- package/src/main/historyDashboard.cjs +87 -17
- package/src/main/index.cjs +78 -4
- package/src/main/ipcSchemas.cjs +233 -20
- 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 +92 -22
- package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
- package/src/main/lib/claude/modelPricing.cjs +148 -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 +121 -0
- package/src/main/lib/epic/epicJobReceipt.cjs +87 -0
- package/src/main/lib/epic/epicOutsideRead.cjs +423 -0
- package/src/main/lib/epic/epicOutsideState.cjs +233 -0
- package/src/main/lib/epic/epicSettle.cjs +1 -1
- package/src/main/lib/epic/epicStateWatcher.cjs +157 -0
- package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
- package/src/main/lib/epic/epicValidationHook.cjs +24 -4
- package/src/main/lib/epic/externalRef.cjs +37 -0
- package/src/main/lib/epic/externalRefIndex.cjs +136 -0
- package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
- package/src/main/lib/epic/restorableSessions.cjs +151 -17
- package/src/main/lib/epic/transcriptUsage.cjs +197 -0
- package/src/main/lib/externalContract.cjs +137 -0
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +176 -5
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +186 -9
- package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -6
- package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +50 -8
- package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +218 -4
- package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +19 -3
- package/src/main/lib/feedback-remote/feedbackImages.cjs +171 -0
- package/src/main/lib/feedback-remote/localAdminHttp.cjs +11 -10
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +167 -21
- package/src/main/lib/feedback-remote/needsYouAdminRoutes.cjs +133 -0
- package/src/main/lib/feedback-remote/needsYouIpc.cjs +50 -0
- package/src/main/lib/feedback-remote/needsYouStore.cjs +285 -0
- 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 +58 -5
- package/src/main/lib/insideHome.cjs +27 -1
- package/src/main/lib/mcpToolCatalog.cjs +232 -25
- 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/agentAdminRoutes.cjs +121 -0
- 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/promptSessionSchema.cjs +4 -0
- package/src/main/lib/remoteTranscriptTail.cjs +32 -1
- 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 +12 -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/lib/telemetry/auditEvents.cjs +176 -0
- package/src/main/lib/telemetry/eventsAdminRoutes.cjs +45 -0
- package/src/main/loginItemIpc.cjs +35 -0
- package/src/main/loopEfficiencyHandlers.cjs +11 -2
- 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 +774 -64
- package/src/main/supervisor.cjs +5 -1
- package/src/main/templates/PRD_AUTHORING.md +7 -1
- package/src/main/transcripts.cjs +62 -7
- package/src/main/validationQualityHandlers.cjs +199 -0
- package/src/main/webRemote.cjs +132 -20
- package/src/preload/api.d.ts +434 -28
- package/src/preload/apiSurface.cjs +7 -0
- package/src/preload/apiSurface.json +485 -81
- package/src/preload/index.cjs +38 -5
- package/src/seed/agents/validator.md +19 -8
- package/dist/assets/AgentLibrary-C1d_D7uQ.js +0 -2
- package/dist/assets/AppSettings-CgDhqrsU.js +0 -2
- package/dist/assets/Button-Bk23rEnZ.js +0 -1
- package/dist/assets/DocumentEditorPane-BqY5Nq6W.js +0 -1
- package/dist/assets/Extensions-CXem-uwI.js +0 -2
- package/dist/assets/History-BwO3coo4.js +0 -2
- package/dist/assets/Library-BDV69fSe.js +0 -32
- package/dist/assets/ListDetail-CD-Fm6mh.js +0 -1
- package/dist/assets/ProjectClaudeConfig-NjdKdwe8.js +0 -25
- package/dist/assets/ProvenanceBadge-Bu8NmI_R.js +0 -1
- package/dist/assets/Scheduler-CkhTvG7C.js +0 -16
- package/dist/assets/Settings-COT34hBF.js +0 -2
- package/dist/assets/Skills-BgexoUkQ.js +0 -29
- package/dist/assets/SourceChip-BXjcdeb1.js +0 -1
- package/dist/assets/SystemPrompt-CeeH3EeW.js +0 -1
- package/dist/assets/Toggle-CENi19iK.js +0 -1
- package/dist/assets/ViewTabs-DDBb0x96.js +0 -1
- package/dist/assets/claude-settings-schema-COigsajx.js +0 -3
- package/dist/assets/index-CgCxpunJ.js +0 -3116
|
@@ -19,13 +19,22 @@
|
|
|
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
|
|
28
|
-
* customer_feedback_submit({
|
|
29
|
+
* customer_feedback_submit({ goal, description, tag, imagePaths? }) -> POST /admin/customer-feedback/submit
|
|
30
|
+
*
|
|
31
|
+
* epic_list({ cwd, state?, limit?, offset? }) -> GET /admin/epics?cwd=<encoded>&...
|
|
32
|
+
* epic_get({ cwd, id? | externalRef?, receipt? }) -> GET /admin/epic?cwd=<encoded>&(id|externalRef)=...[&receipt=1]
|
|
33
|
+
*
|
|
34
|
+
* agent_list({ cwd? }) -> GET /admin/agents[?cwd=<encoded>]
|
|
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>
|
|
29
38
|
*
|
|
30
39
|
* This is a separate process from the Electron app — it only ever reaches
|
|
31
40
|
* it over the token-authed loopback HTTP API in admin-api.json, never by
|
|
@@ -45,7 +54,9 @@ const path = require('node:path');
|
|
|
45
54
|
const fsp = require('node:fs/promises');
|
|
46
55
|
const { createStdioServer } = require('../src/main/lib/mcpStdioServer.cjs');
|
|
47
56
|
const { PRD_WORK_TYPES } = require('../src/main/lib/prd/workTypeLibrary.cjs');
|
|
48
|
-
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');
|
|
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');
|
|
49
60
|
|
|
50
61
|
const CATALOG_BY_NAME = new Map(MCP_TOOL_CATALOG.map((entry) => [entry.name, entry]));
|
|
51
62
|
|
|
@@ -68,6 +79,19 @@ function withPointer(text) {
|
|
|
68
79
|
|
|
69
80
|
const MAX_DEMO_VIDEO_BYTES = 2 * 1024 * 1024;
|
|
70
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
|
+
}
|
|
71
95
|
const MAX_MATRIX_JSON_BYTES = 1048576;
|
|
72
96
|
|
|
73
97
|
/** Reads a local .js file for project_character_write; errors carry only the reason, never file contents. */
|
|
@@ -86,14 +110,21 @@ async function readCharacterJsFile(p) {
|
|
|
86
110
|
}
|
|
87
111
|
}
|
|
88
112
|
|
|
89
|
-
/**
|
|
90
|
-
|
|
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 } = {}) {
|
|
91
119
|
if (typeof p !== 'string' || !path.isAbsolute(p)) return { error: 'htmlPath must be an absolute path' };
|
|
92
120
|
if (!/\.html?$/i.test(p)) return { error: 'htmlPath must end in .html or .htm' };
|
|
93
121
|
try {
|
|
94
122
|
const st = await fsp.stat(p);
|
|
95
123
|
if (!st.isFile()) return { error: 'htmlPath is not a regular file' };
|
|
96
|
-
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
|
+
}
|
|
97
128
|
const html = await fsp.readFile(p, 'utf8');
|
|
98
129
|
if (html.length === 0) return { error: 'htmlPath file is empty' };
|
|
99
130
|
return { html };
|
|
@@ -102,12 +133,39 @@ async function readDemoVideoHtmlFile(p) {
|
|
|
102
133
|
}
|
|
103
134
|
}
|
|
104
135
|
|
|
105
|
-
/**
|
|
106
|
-
|
|
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) {
|
|
107
165
|
const hasHtml = !!args && args.html !== undefined && args.html !== null && args.html !== '';
|
|
108
166
|
const hasPath = !!args && args.htmlPath !== undefined && args.htmlPath !== null && args.htmlPath !== '';
|
|
109
167
|
if (hasHtml === hasPath) return { error: 'provide exactly one of html or htmlPath' };
|
|
110
|
-
if (hasPath) return readDemoVideoHtmlFile(args.htmlPath);
|
|
168
|
+
if (hasPath) return readDemoVideoHtmlFile(args.htmlPath, readOpts);
|
|
111
169
|
if (typeof args.html !== 'string') return { error: 'missing required argument: html' };
|
|
112
170
|
return { html: args.html };
|
|
113
171
|
}
|
|
@@ -168,12 +226,34 @@ function resolveCwdArg(args) {
|
|
|
168
226
|
return process.env.SM_PROJECT_ROOT || process.cwd();
|
|
169
227
|
}
|
|
170
228
|
|
|
171
|
-
// This server
|
|
172
|
-
//
|
|
229
|
+
// This server's package.json version. When it runs from a source checkout
|
|
230
|
+
// that number does not identify the code (the checkout can be far past the
|
|
231
|
+
// release it names), so the unknown-route message below never treats it as
|
|
232
|
+
// proof that a restart helps.
|
|
173
233
|
const MCP_SERVER_VERSION = (() => {
|
|
174
234
|
try { return require('../package.json').version; } catch { return 'unknown'; }
|
|
175
235
|
})();
|
|
176
236
|
|
|
237
|
+
// True when the package root holding this script has a .git entry (a folder
|
|
238
|
+
// in a clone, a file in a git worktree). Existence check only; no git spawn.
|
|
239
|
+
const MCP_SERVER_FROM_CHECKOUT = (() => {
|
|
240
|
+
try { return require('node:fs').existsSync(path.join(__dirname, '..', '.git')); } catch { return false; }
|
|
241
|
+
})();
|
|
242
|
+
|
|
243
|
+
// Numeric compare of dotted versions; anything after a hyphen is ignored.
|
|
244
|
+
// Returns <0, 0 or >0, or NaN when either side has no usable number.
|
|
245
|
+
function compareVersions(a, b) {
|
|
246
|
+
const parse = (v) => String(v).split('-')[0].split('.').map((n) => Number(n));
|
|
247
|
+
const pa = parse(a);
|
|
248
|
+
const pb = parse(b);
|
|
249
|
+
if (pa.some(Number.isNaN) || pb.some(Number.isNaN)) return NaN;
|
|
250
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i += 1) {
|
|
251
|
+
const d = (pa[i] || 0) - (pb[i] || 0);
|
|
252
|
+
if (d !== 0) return d;
|
|
253
|
+
}
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
|
|
177
257
|
// The transport's own unknown-route 404 (localAdminHttp handleRequest). Apps
|
|
178
258
|
// up to v0.136.2 send exactly { ok:false, error:'not found' }; newer ones add
|
|
179
259
|
// unknownRoute. Route handlers' own 'not found' replies use HTTP 200
|
|
@@ -185,15 +265,31 @@ function isUnknownRouteReply(status, body) {
|
|
|
185
265
|
return Object.keys(body).length === 2 && body.error === 'not found';
|
|
186
266
|
}
|
|
187
267
|
|
|
268
|
+
// Pure: states only what is known, and picks the advice from evidence.
|
|
269
|
+
function unknownRouteMessage({ method, pathname, appVersion, serverVersion, fromCheckout }) {
|
|
270
|
+
const appLabel = appVersion ? `v${appVersion}` : 'version not reported';
|
|
271
|
+
const head = `the running Session Manager app (${appLabel}) has no route ${method} ${pathname}. `
|
|
272
|
+
+ `This MCP server is v${serverVersion}.`;
|
|
273
|
+
if (fromCheckout) {
|
|
274
|
+
return `${head} This MCP server runs from a source checkout, so its version number does not say which code it has. `
|
|
275
|
+
+ 'The route may not be in any published release yet. '
|
|
276
|
+
+ 'Restarting the app helps only once a release containing this route is installed.';
|
|
277
|
+
}
|
|
278
|
+
const cmp = appVersion ? compareVersions(appVersion, serverVersion) : -1;
|
|
279
|
+
if (!appVersion || cmp < 0) {
|
|
280
|
+
return `${head} The app is older than this MCP server. `
|
|
281
|
+
+ "Restart Session Manager (Command Palette: 'Reboot app (drain first)') and call again.";
|
|
282
|
+
}
|
|
283
|
+
return `${head} A restart alone will not help. `
|
|
284
|
+
+ 'Session Manager must be updated to a build that has this route.';
|
|
285
|
+
}
|
|
286
|
+
|
|
188
287
|
function unknownRouteError(method, urlPath, body) {
|
|
189
288
|
const pathname = String(urlPath).split('?')[0];
|
|
190
|
-
const appVersion = body && typeof body.appVersion === 'string' && body.appVersion
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
+ `this MCP server (v${MCP_SERVER_VERSION}). Restart Session Manager (Command Palette: 'Reboot app (drain first)') `
|
|
195
|
-
+ 'and call again.',
|
|
196
|
-
);
|
|
289
|
+
const appVersion = body && typeof body.appVersion === 'string' && body.appVersion ? body.appVersion : null;
|
|
290
|
+
const err = new Error(unknownRouteMessage({
|
|
291
|
+
method, pathname, appVersion, serverVersion: MCP_SERVER_VERSION, fromCheckout: MCP_SERVER_FROM_CHECKOUT,
|
|
292
|
+
}));
|
|
197
293
|
// Tagged so callers can add a tool-specific hint (feedback_reply does).
|
|
198
294
|
err.code = 'SM_UNKNOWN_ROUTE';
|
|
199
295
|
return err;
|
|
@@ -288,6 +384,11 @@ const CREATE_PRD_ITEM_SCHEMA = {
|
|
|
288
384
|
slug: { type: 'string', description: 'Optional kebab-case slug; derived from title if omitted' },
|
|
289
385
|
parallelGroup: { type: 'number', description: 'DEPRECATED and ignored (PRD 832): numbers are strictly unique per project; use dependsOn for ordering' },
|
|
290
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,
|
|
291
392
|
disposition: {
|
|
292
393
|
type: 'string',
|
|
293
394
|
enum: ['append', 'new-head'],
|
|
@@ -313,6 +414,10 @@ const CREATE_PRD_ITEM_SCHEMA = {
|
|
|
313
414
|
type: 'array', items: { type: 'string' },
|
|
314
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.',
|
|
315
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
|
+
},
|
|
316
421
|
quietMachine: {
|
|
317
422
|
type: 'boolean',
|
|
318
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.',
|
|
@@ -392,6 +497,77 @@ const TOOLS = [
|
|
|
392
497
|
},
|
|
393
498
|
},
|
|
394
499
|
},
|
|
500
|
+
{
|
|
501
|
+
name: 'epic_list',
|
|
502
|
+
description: descriptionFor('epic_list'),
|
|
503
|
+
inputSchema: {
|
|
504
|
+
type: 'object',
|
|
505
|
+
properties: {
|
|
506
|
+
cwd: { type: 'string', description: 'Absolute path of the project whose open Epics to list' },
|
|
507
|
+
state: { type: 'string', enum: [...EPIC_OUTSIDE_STATES], description: 'Optional: only Epics in this outside-facing state' },
|
|
508
|
+
limit: { type: 'number', description: 'Optional: page size, default 50, max 200' },
|
|
509
|
+
offset: { type: 'number', description: 'Optional: page offset, default 0' },
|
|
510
|
+
},
|
|
511
|
+
required: ['cwd'],
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
name: 'agent_list',
|
|
516
|
+
description: descriptionFor('agent_list'),
|
|
517
|
+
inputSchema: {
|
|
518
|
+
type: 'object',
|
|
519
|
+
properties: {
|
|
520
|
+
cwd: { type: 'string', description: "Optional: absolute project path; when given, each agent also carries the model and effort it resolves to there" },
|
|
521
|
+
},
|
|
522
|
+
},
|
|
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
|
+
},
|
|
557
|
+
{
|
|
558
|
+
name: 'epic_get',
|
|
559
|
+
description: descriptionFor('epic_get'),
|
|
560
|
+
inputSchema: {
|
|
561
|
+
type: 'object',
|
|
562
|
+
properties: {
|
|
563
|
+
cwd: { type: 'string', description: 'Absolute path of the project the Epic belongs to' },
|
|
564
|
+
id: { type: 'string', description: 'The Epic id. Give exactly one of id / externalRef.' },
|
|
565
|
+
externalRef: { type: 'string', description: 'The external reference the Epic was opened with. Give exactly one of id / externalRef.' },
|
|
566
|
+
receipt: { type: 'boolean', description: 'Optional: when true, the answer also carries epic.receipt, what the Epic cost in jobs and chat.' },
|
|
567
|
+
},
|
|
568
|
+
required: ['cwd'],
|
|
569
|
+
},
|
|
570
|
+
},
|
|
395
571
|
{
|
|
396
572
|
name: 'scheduler_get_prd',
|
|
397
573
|
description: descriptionFor('scheduler_get_prd'),
|
|
@@ -427,6 +603,7 @@ const TOOLS = [
|
|
|
427
603
|
quietMachine: { type: 'boolean', description: 'Optional: the exclusive machine-wide quiet lease flag (see scheduler_create_prd) — patchable after creation too' },
|
|
428
604
|
dependsOn: { type: 'array', items: { type: 'string' }, description: 'Optional: replaces the dependsOn list; an explicit empty array CLEARS it — see scheduler_create_prd' },
|
|
429
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.' },
|
|
430
607
|
},
|
|
431
608
|
},
|
|
432
609
|
body: { type: 'string', description: 'Optional: full replacement body (everything after the frontmatter). Cannot be combined with gate/files/acceptanceCriteria.' },
|
|
@@ -457,6 +634,15 @@ const TOOLS = [
|
|
|
457
634
|
properties: {
|
|
458
635
|
slug: { type: 'string', description: 'PRD slug of the job to cancel' },
|
|
459
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
|
+
},
|
|
460
646
|
},
|
|
461
647
|
required: ['slug'],
|
|
462
648
|
},
|
|
@@ -569,6 +755,15 @@ const TOOLS = [
|
|
|
569
755
|
type: 'string',
|
|
570
756
|
description: "Required with autoStart. Copy VERBATIM from the human's own message in this conversation; the quoted words themselves must name the target project. Do not paraphrase or write it yourself.",
|
|
571
757
|
},
|
|
758
|
+
externalRef: {
|
|
759
|
+
type: 'string',
|
|
760
|
+
description: 'Optional: your own id for this handoff, 1 to 200 characters of letters, digits or . _ : / @ - (trimmed). It is stored on the new session and returned. Repeating a call with the same toCwd, fromCwd and externalRef opens nothing new and returns the session that already exists (status "existing", existing: true); the same externalRef already used by a different sender is refused with 409.',
|
|
761
|
+
},
|
|
762
|
+
replyMode: {
|
|
763
|
+
type: 'string',
|
|
764
|
+
enum: ['prompt', 'event'],
|
|
765
|
+
description: "Optional: how a reply comes back — 'prompt' (default) wakes your chat session, 'event' records it as data in the audit log for a caller with no chat.",
|
|
766
|
+
},
|
|
572
767
|
},
|
|
573
768
|
required: ['toCwd', 'fromCwd', 'title', 'motivation', 'acceptanceCriteria', 'body'],
|
|
574
769
|
},
|
|
@@ -688,15 +883,35 @@ const TOOLS = [
|
|
|
688
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." },
|
|
689
884
|
videoId: { type: 'string', description: 'Stable id (kebab-case) of the video; writing the same id replaces that video.' },
|
|
690
885
|
title: { type: 'string', description: 'Human title shown in the video list.' },
|
|
691
|
-
kind: { type: 'string', description: 'What the video is: exactly one of project-demo, blog-post, feature.' },
|
|
692
|
-
lengthS: { type: 'number', description: 'Length of the video in seconds.' },
|
|
693
|
-
html: { type: 'string', description: 'The complete self-contained HTML/JS video document (<=
|
|
694
|
-
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.' },
|
|
695
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.' },
|
|
696
891
|
},
|
|
697
892
|
required: ['videoId', 'title', 'kind', 'lengthS', 'meta'],
|
|
698
893
|
},
|
|
699
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
|
+
},
|
|
700
915
|
{
|
|
701
916
|
name: 'macro_list',
|
|
702
917
|
description: descriptionFor('macro_list'),
|
|
@@ -719,9 +934,19 @@ const TOOLS = [
|
|
|
719
934
|
agentName: { type: 'string', description: 'Persona to run the macro as (e.g. "builder").' },
|
|
720
935
|
tag: { type: 'string', description: 'Mission tag for the macro.' },
|
|
721
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.' },
|
|
722
|
-
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
|
+
},
|
|
723
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.' },
|
|
724
|
-
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." },
|
|
725
950
|
inputs: {
|
|
726
951
|
type: 'array',
|
|
727
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.',
|
|
@@ -781,11 +1006,17 @@ const TOOLS = [
|
|
|
781
1006
|
inputSchema: {
|
|
782
1007
|
type: 'object',
|
|
783
1008
|
properties: {
|
|
784
|
-
|
|
785
|
-
|
|
1009
|
+
goal: { type: 'string', description: 'One line, max 120 chars: what the human wants or what went wrong. Show it to the human before calling.' },
|
|
1010
|
+
description: { type: 'string', description: 'Details, max 4000 chars: what happened, what was expected, steps. No secrets, tokens, customer data or private file contents.' },
|
|
786
1011
|
tag: { type: 'string', enum: ['bug', 'feature', 'discussion'], description: 'Kind of feedback.' },
|
|
1012
|
+
imagePaths: {
|
|
1013
|
+
type: 'array',
|
|
1014
|
+
items: { type: 'string' },
|
|
1015
|
+
maxItems: 5,
|
|
1016
|
+
description: 'Optional: absolute paths of up to 5 PNG, JPEG, WebP or GIF images the human asked to include — for example the Attached: <path> lines of images pasted into this chat. Images are sent as-is; large PNG/JPEG are downscaled; anything that is not an image is refused.',
|
|
1017
|
+
},
|
|
787
1018
|
},
|
|
788
|
-
required: ['
|
|
1019
|
+
required: ['goal', 'description', 'tag'],
|
|
789
1020
|
},
|
|
790
1021
|
},
|
|
791
1022
|
{
|
|
@@ -851,7 +1082,7 @@ function macroDeleteRefusal() {
|
|
|
851
1082
|
function customerFeedbackSubmitRefusal() {
|
|
852
1083
|
return humanSessionRefusal(
|
|
853
1084
|
'refused: customer_feedback_submit runs only in a Session Manager chat or terminal session, because feedback is sent only when a human asks. '
|
|
854
|
-
+ 'Say in your final result what the feedback is; the human can send it from the
|
|
1085
|
+
+ 'Say in your final result what the feedback is; the human can send it from the Feedback panel.',
|
|
855
1086
|
);
|
|
856
1087
|
}
|
|
857
1088
|
|
|
@@ -937,6 +1168,65 @@ async function handleCallTool(request) {
|
|
|
937
1168
|
}
|
|
938
1169
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
939
1170
|
}
|
|
1171
|
+
if (name === 'epic_list') {
|
|
1172
|
+
const qs = new URLSearchParams();
|
|
1173
|
+
if (args?.cwd) qs.set('cwd', args.cwd);
|
|
1174
|
+
if (args?.state) qs.set('state', args.state);
|
|
1175
|
+
if (args?.limit !== undefined) qs.set('limit', String(args.limit));
|
|
1176
|
+
if (args?.offset !== undefined) qs.set('offset', String(args.offset));
|
|
1177
|
+
const result = await adminRequest('GET', `/admin/epics?${qs.toString()}`);
|
|
1178
|
+
// Same partial-page guard as scheduler_list_prds: never let a page pass
|
|
1179
|
+
// for the full list.
|
|
1180
|
+
if (result?.ok && result.hasMore) {
|
|
1181
|
+
result.note = `partial list: returned ${result.epics.length} of ${result.total} Epics (offset ${result.offset}, limit ${result.limit}) — pass a higher offset to see more`;
|
|
1182
|
+
}
|
|
1183
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1184
|
+
}
|
|
1185
|
+
if (name === 'agent_list') {
|
|
1186
|
+
const qs = new URLSearchParams();
|
|
1187
|
+
if (args?.cwd) qs.set('cwd', args.cwd);
|
|
1188
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : '';
|
|
1189
|
+
const result = await adminRequest('GET', `/admin/agents${suffix}`);
|
|
1190
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
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
|
+
}
|
|
1216
|
+
if (name === 'epic_get') {
|
|
1217
|
+
const hasId = typeof args?.id === 'string' && args.id !== '';
|
|
1218
|
+
const hasRef = typeof args?.externalRef === 'string' && args.externalRef !== '';
|
|
1219
|
+
if (hasId === hasRef) {
|
|
1220
|
+
return errorResult('provide exactly one of id or externalRef');
|
|
1221
|
+
}
|
|
1222
|
+
const qs = new URLSearchParams();
|
|
1223
|
+
if (args?.cwd) qs.set('cwd', args.cwd);
|
|
1224
|
+
if (hasId) qs.set('id', args.id);
|
|
1225
|
+
else qs.set('externalRef', args.externalRef);
|
|
1226
|
+
if (args?.receipt === true) qs.set('receipt', '1');
|
|
1227
|
+
const result = await adminRequest('GET', `/admin/epic?${qs.toString()}`);
|
|
1228
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1229
|
+
}
|
|
940
1230
|
if (name === 'scheduler_get_prd') {
|
|
941
1231
|
const slug = args && typeof args.slug === 'string' ? args.slug : null;
|
|
942
1232
|
if (!slug) {
|
|
@@ -970,7 +1260,10 @@ async function handleCallTool(request) {
|
|
|
970
1260
|
return errorResult('missing required argument: slug');
|
|
971
1261
|
}
|
|
972
1262
|
const cwd = args && typeof args.cwd === 'string' ? args.cwd : undefined;
|
|
973
|
-
|
|
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 });
|
|
974
1267
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
975
1268
|
}
|
|
976
1269
|
if (name === 'scheduler_retag_prd') {
|
|
@@ -1129,7 +1422,7 @@ async function handleCallTool(request) {
|
|
|
1129
1422
|
} catch (err) {
|
|
1130
1423
|
if (err && err.code === 'SM_UNKNOWN_ROUTE') {
|
|
1131
1424
|
return errorResult(`${err.message} feedback_reply needs Session Manager v0.136.0 or later. `
|
|
1132
|
-
+ 'Until the app
|
|
1425
|
+
+ 'Until the running app has this route, send your answer with feedback_open_session to the asking project; '
|
|
1133
1426
|
+ 'it opens there as a new proposed session.');
|
|
1134
1427
|
}
|
|
1135
1428
|
throw err;
|
|
@@ -1139,6 +1432,8 @@ async function handleCallTool(request) {
|
|
|
1139
1432
|
if (result?.ok !== false) {
|
|
1140
1433
|
if (result?.delivery === 'delivered') {
|
|
1141
1434
|
note = ' — delivered into the asking session; it has not acted on it yet.';
|
|
1435
|
+
} else if (result?.delivery === 'event-only' && result?.reason === 'asker-requested-event') {
|
|
1436
|
+
note = ' — the answer was recorded as an event for the asking app, as it requested; no chat was prompted.';
|
|
1142
1437
|
} else if (result?.delivery === 'event-only') {
|
|
1143
1438
|
note = " — delivered as an event only on the asking Epic; its session was not prompted"
|
|
1144
1439
|
+ `${result.reason ? ` (${result.reason})` : ''}.`;
|
|
@@ -1238,7 +1533,7 @@ async function handleCallTool(request) {
|
|
|
1238
1533
|
|| typeof args.kind !== 'string' || !args.kind || typeof args.lengthS !== 'number' || !Number.isFinite(args.lengthS)) {
|
|
1239
1534
|
return errorResult('missing required arguments: videoId, title, kind, lengthS');
|
|
1240
1535
|
}
|
|
1241
|
-
const loaded = await resolveHtmlArg(args);
|
|
1536
|
+
const loaded = await resolveHtmlArg(args, { maxBytes: maxVideoBytesFor(args.lengthS), lengthS: args.lengthS });
|
|
1242
1537
|
if (loaded.error) return errorResult(loaded.error);
|
|
1243
1538
|
const cwd = resolveCwdArg(args);
|
|
1244
1539
|
const body = { cwd, videoId: args.videoId, title: args.title, kind: args.kind, lengthS: args.lengthS, html: loaded.html };
|
|
@@ -1246,6 +1541,20 @@ async function handleCallTool(request) {
|
|
|
1246
1541
|
const result = await adminRequest('POST', '/admin/project-home/videos/write', body);
|
|
1247
1542
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1248
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
|
+
}
|
|
1249
1558
|
if (name === 'macro_list') {
|
|
1250
1559
|
const cwd = resolveCwdArg(args);
|
|
1251
1560
|
const result = await adminRequest('GET', `/admin/macros?cwd=${encodeURIComponent(cwd)}`);
|
|
@@ -1266,6 +1575,12 @@ async function handleCallTool(request) {
|
|
|
1266
1575
|
+ 'Say in your final result that the human can add it from Project Home ▸ Tools ▸ Add a tool.',
|
|
1267
1576
|
);
|
|
1268
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;
|
|
1269
1584
|
} else if (args.projects !== undefined) {
|
|
1270
1585
|
const refusal = humanSessionRefusal(
|
|
1271
1586
|
'refused: a macro shown in every project is saved only in a Session Manager chat session where the human asked for it. '
|
|
@@ -1279,6 +1594,7 @@ async function handleCallTool(request) {
|
|
|
1279
1594
|
if (Array.isArray(args.inputs)) payload.inputs = args.inputs;
|
|
1280
1595
|
if (typeof args.surface === 'string') payload.surface = args.surface;
|
|
1281
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;
|
|
1282
1598
|
if (typeof args.humanRequestQuote === 'string') payload.humanRequestQuote = args.humanRequestQuote;
|
|
1283
1599
|
payload.originClaudeSessionId = process.env.SM_CHAT_SESSION_ID;
|
|
1284
1600
|
const result = await adminRequest('POST', '/admin/macros/save', payload);
|
|
@@ -1319,10 +1635,17 @@ async function handleCallTool(request) {
|
|
|
1319
1635
|
if (name === 'customer_feedback_submit') {
|
|
1320
1636
|
const refusal = customerFeedbackSubmitRefusal();
|
|
1321
1637
|
if (refusal) return refusal;
|
|
1322
|
-
if (!args || typeof args.
|
|
1323
|
-
return errorResult('missing or invalid required argument(s):
|
|
1638
|
+
if (!args || typeof args.goal !== 'string' || typeof args.description !== 'string' || typeof args.tag !== 'string') {
|
|
1639
|
+
return errorResult('missing or invalid required argument(s): goal, description, tag');
|
|
1324
1640
|
}
|
|
1325
|
-
const
|
|
1641
|
+
const imagePaths = args.imagePaths;
|
|
1642
|
+
if (imagePaths !== undefined
|
|
1643
|
+
&& (!Array.isArray(imagePaths) || imagePaths.length > 5 || !imagePaths.every((p) => typeof p === 'string'))) {
|
|
1644
|
+
return errorResult('invalid argument: imagePaths must be an array of at most 5 absolute file path strings');
|
|
1645
|
+
}
|
|
1646
|
+
const payload = { title: args.goal, body: args.description, tag: args.tag };
|
|
1647
|
+
if (imagePaths && imagePaths.length > 0) payload.imagePaths = imagePaths;
|
|
1648
|
+
const result = await adminRequest('POST', '/admin/customer-feedback/submit', payload);
|
|
1326
1649
|
if (result?.ok === false) return errorResult(result.error ?? 'customer_feedback_submit failed');
|
|
1327
1650
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1328
1651
|
}
|
|
@@ -1388,4 +1711,6 @@ if (require.main === module) {
|
|
|
1388
1711
|
});
|
|
1389
1712
|
}
|
|
1390
1713
|
|
|
1391
|
-
module.exports = {
|
|
1714
|
+
module.exports = {
|
|
1715
|
+
TOOLS, handleCallTool, HELP_POINTER, maxVideoBytesFor, resolveHtmlArg, NOT_RUNNING_ERROR, busyError, unknownRouteMessage, compareVersions,
|
|
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
|
}
|
package/src/main/chatRunner.cjs
CHANGED
|
@@ -40,7 +40,7 @@ const { spawn } = require('node:child_process');
|
|
|
40
40
|
const { ipcMain } = require('electron');
|
|
41
41
|
const { resolveClaudeBin, claudeSpawnTarget } = require('./lib/claude/claudeBin.cjs');
|
|
42
42
|
const { cleanChildEnv, pathWithUserBins } = require('./lib/process/cleanEnv.cjs');
|
|
43
|
-
const { recordExchange } = require('./exchanges.cjs');
|
|
43
|
+
const { recordExchange, formatAskedResult } = require('./exchanges.cjs');
|
|
44
44
|
const { classifyToolUse } = require('./lib/toolUseClassify.cjs');
|
|
45
45
|
const { extractJson } = require('./lib/util/extractJson.cjs');
|
|
46
46
|
const { classifyPromptTicket } = require('./lib/classifyPromptTicket.cjs');
|
|
@@ -939,7 +939,7 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
939
939
|
sessionId,
|
|
940
940
|
cwd,
|
|
941
941
|
prompt,
|
|
942
|
-
result:
|
|
942
|
+
result: formatAskedResult(signal.answerBody, signal.questions),
|
|
943
943
|
promptId,
|
|
944
944
|
}).catch((err) => {
|
|
945
945
|
console.error('[chatRunner] recordExchange failed:', err?.message ?? err);
|