claude-code-session-manager 0.133.1 → 0.134.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/dist/assets/AgentLibrary-C9KFGJQq.js +2 -0
- package/dist/assets/{AppSettings-DwnfV9-4.js → AppSettings-CvVQ6ot5.js} +2 -2
- package/dist/assets/{Button-CObXxw7b.js → Button-BHvploNk.js} +1 -1
- package/dist/assets/{DocumentEditorPane-CgB5IuOY.js → DocumentEditorPane-DaX4xag_.js} +1 -1
- package/dist/assets/{Extensions-Fuhshcl6.js → Extensions-DbRY-KEz.js} +2 -2
- package/dist/assets/{History-DbUV4jxK.js → History-BE_mjM24.js} +2 -2
- package/dist/assets/{Library-COr79GyT.js → Library-I37dQ6pB.js} +1 -1
- package/dist/assets/{ListDetail-DY53nXya.js → ListDetail-DJYMWYQd.js} +1 -1
- package/dist/assets/{Panel-D7NX5iP8.js → Panel-DP8eSKSs.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-DuWzM8qA.js → ProjectClaudeConfig-Cw8lc3Qi.js} +5 -5
- package/dist/assets/{ProvenanceBadge-AnwE1p5X.js → ProvenanceBadge-DUwhsmdA.js} +1 -1
- package/dist/assets/Scheduler-B9D2gZqs.js +16 -0
- package/dist/assets/{Settings-tt0VZCyz.js → Settings-DSk7bn-1.js} +2 -2
- package/dist/assets/{SkillReferenceGraph-D_rxqWgq.js → SkillReferenceGraph-DtJcJJHR.js} +1 -1
- package/dist/assets/{Skills-BVQPJZaF.js → Skills-BPZnSjsB.js} +10 -10
- package/dist/assets/{SourceChip-DC5XD8KC.js → SourceChip-DUxulNOp.js} +1 -1
- package/dist/assets/{SystemPrompt-XnvP0_cS.js → SystemPrompt-BXAugVle.js} +1 -1
- package/dist/assets/{TiptapBody-B_TNEADm.js → TiptapBody-CDC1vrOo.js} +28 -28
- package/dist/assets/{Toggle-CxQO8pGN.js → Toggle-CrgM7OTR.js} +1 -1
- package/dist/assets/{ViewTabs-CEjnWPD9.js → ViewTabs-DLwaU9RB.js} +1 -1
- package/dist/assets/{VoiceButton-B-6gdmKe.js → VoiceButton-C4hIBxIP.js} +1 -1
- package/dist/assets/geist-sans-latin-300-normal-C3kkMBb6.woff2 +0 -0
- package/dist/assets/geist-sans-latin-400-normal-gapTbOY8.woff2 +0 -0
- package/dist/assets/geist-sans-latin-500-normal-uokXdC-Q.woff2 +0 -0
- package/dist/assets/geist-sans-latin-600-normal-DFOURf8L.woff2 +0 -0
- package/dist/assets/geist-sans-latin-700-normal-BmN9tIp5.woff2 +0 -0
- package/dist/assets/{historyTotals-dT8vcKzX.js → historyTotals-itA00dXm.js} +1 -1
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/{index-5QIl5Kcd.css → index-Cjt8B7H9.css} +1 -1
- package/dist/assets/index-Cznhnxhq.js +3116 -0
- package/dist/assets/newsreader-latin-400-italic-CEihAR-f.woff2 +0 -0
- package/dist/assets/newsreader-latin-400-normal-BFBkh4jY.woff2 +0 -0
- package/dist/assets/newsreader-latin-500-normal-B66TYsaK.woff2 +0 -0
- package/dist/assets/newsreader-latin-600-normal-30OJ_TG_.woff2 +0 -0
- package/dist/assets/newsreader-latin-700-normal-rIgV_oaK.woff2 +0 -0
- package/dist/index.html +2 -5
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +407 -402
- package/dist-web/index.html +0 -3
- package/package.json +1 -1
- package/scripts/scheduler-mcp-server.cjs +31 -0
- package/src/main/agentLibrary.cjs +27 -4
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +9 -0
- package/src/main/config.cjs +22 -0
- package/src/main/crashDiagnostics.cjs +10 -2
- package/src/main/index.cjs +34 -25
- package/src/main/ipcSchemas.cjs +6 -0
- package/src/main/lib/agent-cli/agentCliEvents.cjs +8 -0
- package/src/main/lib/demo-video-kit/capture.cjs +4 -37
- package/src/main/lib/demo-video-kit/character.cjs +20 -2
- package/src/main/lib/demo-video-kit/checks.cjs +82 -1
- package/src/main/lib/demo-video-kit/frames.cjs +3 -28
- package/src/main/lib/demo-video-kit/playwrightLoader.cjs +67 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +2 -2
- package/src/main/lib/demo-video-kit/sound.cjs +5 -2
- package/src/main/lib/epic/epicMint.cjs +1 -3
- package/src/main/lib/epic/promptSessionsCreateEpic.cjs +37 -4
- package/src/main/lib/epic/restorableSessions.cjs +88 -0
- package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +56 -1
- package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +21 -3
- package/src/main/lib/feedback-remote/remoteAssets.cjs +25 -1
- package/src/main/lib/mcpToolCatalog.cjs +15 -0
- package/src/main/lib/persona-macro/agentPersonaSchema.cjs +10 -1
- package/src/main/lib/persona-macro/builtinMacros.cjs +3 -2
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/listPrdsSingleFlight.cjs +79 -0
- package/src/main/lib/prd/prdAgentType.cjs +17 -7
- package/src/main/lib/telemetry/crashTelemetry.cjs +10 -5
- package/src/main/lib/telemetry/telemetryBoot.cjs +77 -4
- package/src/main/lib/telemetry/telemetryClient.cjs +54 -9
- package/src/main/lib/telemetry/telemetryConsent.cjs +3 -0
- package/src/main/lib/telemetry/telemetryCounters.cjs +7 -2
- package/src/main/lib/telemetry/telemetrySettings.cjs +5 -0
- package/src/main/pty.cjs +2 -2
- package/src/main/scheduler/prdParser.cjs +1 -1
- package/src/main/scheduler.cjs +19 -3
- package/src/main/seedAgentPersonas.cjs +24 -0
- package/src/main/seedStatus.cjs +5 -2
- package/src/main/telemetryIpc.cjs +1 -5
- package/src/preload/api.d.ts +29 -14
- package/src/preload/apiSurface.json +7 -0
- package/src/preload/index.cjs +3 -1
- package/src/seed/agents/demo-video-builder.md +7 -2
- package/dist/assets/AgentLibrary-BTIBmZkM.js +0 -2
- package/dist/assets/Scheduler-BHfx0rXd.js +0 -16
- package/dist/assets/index-BLORXCcT.js +0 -3111
- package/src/main/lib/telemetry/telemetryBacklog.cjs +0 -607
package/dist-web/index.html
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Claude Session Manager</title>
|
|
7
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
8
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
9
|
-
<link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400&family=Geist:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
|
|
10
7
|
<script type="module" crossorigin src="./app.js"></script>
|
|
11
8
|
<link rel="stylesheet" crossorigin href="./app.css">
|
|
12
9
|
</head>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-session-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.134.0",
|
|
4
4
|
"description": "Local cockpit for the Claude Code CLI — multi-tab terminal, full config surface, scheduler, voice dictation, and live observability.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/main/index.cjs",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* macro_delete({ id }) -> POST /admin/macros/delete
|
|
25
25
|
* customer_feedback_list({ pull?, includeHidden? }) -> GET /admin/customer-feedback/inbox
|
|
26
26
|
* customer_feedback_set_status({ id, status, note? }) -> POST /admin/customer-feedback/status
|
|
27
|
+
* customer_feedback_submit({ title, body, tag }) -> POST /admin/customer-feedback/submit
|
|
27
28
|
*
|
|
28
29
|
* This is a separate process from the Electron app — it only ever reaches
|
|
29
30
|
* it over the token-authed loopback HTTP API in admin-api.json, never by
|
|
@@ -722,6 +723,19 @@ const TOOLS = [
|
|
|
722
723
|
required: ['id', 'status'],
|
|
723
724
|
},
|
|
724
725
|
},
|
|
726
|
+
{
|
|
727
|
+
name: 'customer_feedback_submit',
|
|
728
|
+
description: descriptionFor('customer_feedback_submit'),
|
|
729
|
+
inputSchema: {
|
|
730
|
+
type: 'object',
|
|
731
|
+
properties: {
|
|
732
|
+
title: { type: 'string', description: 'Short title, max 120 chars. Show it to the human before calling.' },
|
|
733
|
+
body: { type: 'string', description: 'Feedback text, max 4000 chars. No secrets, tokens, customer data or private file contents.' },
|
|
734
|
+
tag: { type: 'string', enum: ['bug', 'feature', 'discussion'], description: 'Kind of feedback.' },
|
|
735
|
+
},
|
|
736
|
+
required: ['title', 'body', 'tag'],
|
|
737
|
+
},
|
|
738
|
+
},
|
|
725
739
|
{
|
|
726
740
|
name: 'session_manager_help',
|
|
727
741
|
description: descriptionFor('session_manager_help'),
|
|
@@ -782,6 +796,13 @@ function macroDeleteRefusal() {
|
|
|
782
796
|
);
|
|
783
797
|
}
|
|
784
798
|
|
|
799
|
+
function customerFeedbackSubmitRefusal() {
|
|
800
|
+
return humanSessionRefusal(
|
|
801
|
+
'refused: customer_feedback_submit runs only in a Session Manager chat or terminal session, because feedback is sent only when a human asks. '
|
|
802
|
+
+ 'Say in your final result what the feedback is; the human can send it from the {F} feedback panel.',
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
|
|
785
806
|
// Named + exported (see module.exports below) so mcpToolCatalog.test.cjs's
|
|
786
807
|
// sibling can exercise session_manager_help's argument handling directly —
|
|
787
808
|
// mocking node:fs/promises + global.fetch to drive adminRequest — without
|
|
@@ -1185,6 +1206,16 @@ async function handleCallTool(request) {
|
|
|
1185
1206
|
if (result?.ok === false) return errorResult(result.error ?? 'customer_feedback_set_status failed');
|
|
1186
1207
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1187
1208
|
}
|
|
1209
|
+
if (name === 'customer_feedback_submit') {
|
|
1210
|
+
const refusal = customerFeedbackSubmitRefusal();
|
|
1211
|
+
if (refusal) return refusal;
|
|
1212
|
+
if (!args || typeof args.title !== 'string' || typeof args.body !== 'string' || typeof args.tag !== 'string') {
|
|
1213
|
+
return errorResult('missing or invalid required argument(s): title, body, tag');
|
|
1214
|
+
}
|
|
1215
|
+
const result = await adminRequest('POST', '/admin/customer-feedback/submit', { title: args.title, body: args.body, tag: args.tag });
|
|
1216
|
+
if (result?.ok === false) return errorResult(result.error ?? 'customer_feedback_submit failed');
|
|
1217
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
1218
|
+
}
|
|
1188
1219
|
if (name === 'session_manager_help') {
|
|
1189
1220
|
const toolName = args && typeof args.tool === 'string' ? args.tool : null;
|
|
1190
1221
|
const topic = args && typeof args.topic === 'string' ? args.topic : null;
|
|
@@ -23,6 +23,7 @@ const path = require('node:path');
|
|
|
23
23
|
const os = require('node:os');
|
|
24
24
|
const { splitFrontmatter } = require('./lib/prd/prdFrontmatter.cjs');
|
|
25
25
|
const { resolveMergedPersona, PERSONA_NAME_RE } = require('./lib/persona-macro/personaMerge.cjs');
|
|
26
|
+
const { isNonClaudeAgentCli, isAgentCliModel } = require('./lib/agent-cli/agentCliEvents.cjs');
|
|
26
27
|
const configMgr = require('./config.cjs');
|
|
27
28
|
const sessionsStore = require('./sessionsStore.cjs');
|
|
28
29
|
|
|
@@ -71,8 +72,11 @@ function decodeLine(s) {
|
|
|
71
72
|
* integer, present only on the four bundled personas. Written through
|
|
72
73
|
* unchanged (not Claude-Code-visible either) so a save from the Agent
|
|
73
74
|
* Library editor never erases the stamp a hand-edit should keep intact.
|
|
75
|
+
*
|
|
76
|
+
* `agentCli` / `agentCliModel` are this app's extension too: the persona's
|
|
77
|
+
* default agent CLI (and its model) for New Session — Claude Code ignores them.
|
|
74
78
|
*/
|
|
75
|
-
const MANAGED_PERSONA_KEYS = new Set(['name', 'description', 'tools', 'model', 'effort', 'color', 'tags', 'projects', 'action', 'actionLabel', 'title', 'seedVersion', 'executorOnly']);
|
|
79
|
+
const MANAGED_PERSONA_KEYS = new Set(['name', 'description', 'tools', 'model', 'effort', 'color', 'tags', 'projects', 'action', 'actionLabel', 'title', 'seedVersion', 'executorOnly', 'agentCli', 'agentCliModel']);
|
|
76
80
|
|
|
77
81
|
/**
|
|
78
82
|
* Raw text lines of every top-level frontmatter key block in `raw` whose key
|
|
@@ -93,12 +97,17 @@ function extractUnmanagedLines(raw, managed) {
|
|
|
93
97
|
return out;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
function serializePersona({ name, description, tools, model, effort, color, tags, projects, action, actionLabel, title, seedVersion, executorOnly, body, preservedLines }) {
|
|
100
|
+
function serializePersona({ name, description, tools, model, effort, color, tags, projects, action, actionLabel, title, seedVersion, executorOnly, agentCli, agentCliModel, body, preservedLines }) {
|
|
97
101
|
const lines = ['---', `name: ${name}`];
|
|
98
102
|
if (description) lines.push(`description: ${description}`);
|
|
99
103
|
if (tools && tools.length) lines.push(`tools: ${tools.join(', ')}`);
|
|
100
104
|
if (model && model !== 'inherit') lines.push(`model: ${model}`);
|
|
101
105
|
if (effort && effort !== 'inherit') lines.push(`effort: ${effort}`);
|
|
106
|
+
if (isNonClaudeAgentCli(agentCli)) {
|
|
107
|
+
lines.push(`agentCli: ${agentCli}`);
|
|
108
|
+
// Double-quoted: a YAML plain scalar can't start with '@' or '['; the allowed charset has no quote/backslash.
|
|
109
|
+
if (isAgentCliModel(agentCliModel)) lines.push(`agentCliModel: "${agentCliModel}"`);
|
|
110
|
+
}
|
|
102
111
|
if (color) lines.push(`color: ${color}`);
|
|
103
112
|
if (tags && tags.length) lines.push(`tags: ${tags.join(', ')}`);
|
|
104
113
|
if (projects && projects.length) lines.push(`projects: ${projects.join(', ')}`);
|
|
@@ -213,6 +222,8 @@ async function savePersona({
|
|
|
213
222
|
title,
|
|
214
223
|
seedVersion,
|
|
215
224
|
executorOnly,
|
|
225
|
+
agentCli,
|
|
226
|
+
agentCliModel,
|
|
216
227
|
body,
|
|
217
228
|
projectCwd,
|
|
218
229
|
globalDir = path.join(os.homedir(), '.claude', 'agents'),
|
|
@@ -239,11 +250,14 @@ async function savePersona({
|
|
|
239
250
|
let resolvedAction = action;
|
|
240
251
|
let resolvedActionLabel = actionLabel;
|
|
241
252
|
let resolvedExecutorOnly = executorOnly;
|
|
253
|
+
// agentCli undefined = carry the file's pair over; 'claude' (or any non-CLI value) = write neither line.
|
|
254
|
+
let resolvedAgentCli = agentCli;
|
|
255
|
+
let resolvedAgentCliModel = agentCliModel;
|
|
242
256
|
let preservedLines = [];
|
|
243
257
|
try {
|
|
244
258
|
preservedLines = extractUnmanagedLines(fsSync.readFileSync(target, 'utf8'), MANAGED_PERSONA_KEYS);
|
|
245
259
|
} catch { /* no existing file — nothing to preserve */ }
|
|
246
|
-
if ([seedVersion, title, projects, action, actionLabel, executorOnly].some((v) => v === undefined)) {
|
|
260
|
+
if ([seedVersion, title, projects, action, actionLabel, executorOnly, agentCli].some((v) => v === undefined)) {
|
|
247
261
|
try {
|
|
248
262
|
const { fm } = splitFrontmatter(fsSync.readFileSync(target, 'utf8'));
|
|
249
263
|
if (resolvedSeedVersion === undefined) {
|
|
@@ -252,12 +266,17 @@ async function savePersona({
|
|
|
252
266
|
}
|
|
253
267
|
if (resolvedExecutorOnly === undefined && String(fm.executorOnly).trim() === 'true') resolvedExecutorOnly = true;
|
|
254
268
|
if (resolvedTitle === undefined && fm.title) resolvedTitle = fm.title;
|
|
269
|
+
if (agentCli === undefined) {
|
|
270
|
+
const existingCli = typeof fm.agentCli === 'string' ? fm.agentCli.trim() : '';
|
|
271
|
+
resolvedAgentCli = isNonClaudeAgentCli(existingCli) ? existingCli : undefined;
|
|
272
|
+
resolvedAgentCliModel = resolvedAgentCli && isAgentCliModel(fm.agentCliModel) ? fm.agentCliModel : undefined;
|
|
273
|
+
}
|
|
255
274
|
if (resolvedProjects === undefined && fm.projects) resolvedProjects = parseTools(fm.projects);
|
|
256
275
|
if (resolvedAction === undefined && fm.action) resolvedAction = decodeLine(fm.action);
|
|
257
276
|
if (resolvedActionLabel === undefined && fm.actionLabel) resolvedActionLabel = decodeLine(fm.actionLabel);
|
|
258
277
|
} catch { /* no existing file (or unreadable) — nothing to carry over */ }
|
|
259
278
|
}
|
|
260
|
-
const text = serializePersona({ name, description, tools, model, effort, color, tags, projects: resolvedProjects, action: resolvedAction, actionLabel: resolvedActionLabel, title: resolvedTitle, seedVersion: resolvedSeedVersion, executorOnly: resolvedExecutorOnly, body, preservedLines });
|
|
279
|
+
const text = serializePersona({ name, description, tools, model, effort, color, tags, projects: resolvedProjects, action: resolvedAction, actionLabel: resolvedActionLabel, title: resolvedTitle, seedVersion: resolvedSeedVersion, executorOnly: resolvedExecutorOnly, agentCli: resolvedAgentCli, agentCliModel: resolvedAgentCliModel, body, preservedLines });
|
|
261
280
|
await writeTextAtomic(target, text);
|
|
262
281
|
if (originalName && originalName !== name) {
|
|
263
282
|
const oldReal = validatePath(path.join(globalDir, `${originalName}.md`));
|
|
@@ -401,6 +420,8 @@ async function listPersonas({
|
|
|
401
420
|
});
|
|
402
421
|
}
|
|
403
422
|
|
|
423
|
+
const trimmedCli = typeof fm.agentCli === 'string' ? fm.agentCli.trim() : '';
|
|
424
|
+
const listedCli = isNonClaudeAgentCli(trimmedCli) ? trimmedCli : null;
|
|
404
425
|
personas.push({
|
|
405
426
|
name: fm.name || fallbackName,
|
|
406
427
|
description: fm.description || null,
|
|
@@ -415,6 +436,8 @@ async function listPersonas({
|
|
|
415
436
|
title: fm.title || null,
|
|
416
437
|
seedVersion: fm.seedVersion !== undefined && Number.isFinite(Number(fm.seedVersion)) ? Number(fm.seedVersion) : null,
|
|
417
438
|
executorOnly: String(fm.executorOnly).trim() === 'true',
|
|
439
|
+
agentCli: listedCli,
|
|
440
|
+
agentCliModel: listedCli && isAgentCliModel(fm.agentCliModel) ? fm.agentCliModel : null,
|
|
418
441
|
path: real,
|
|
419
442
|
body: body.trim(),
|
|
420
443
|
overridingProjects,
|
package/src/main/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"gitSha": "
|
|
4
|
-
"gitShortSha": "
|
|
2
|
+
"version": "0.134.0",
|
|
3
|
+
"gitSha": "62fc9a33d5e37168ff9dc09343d06a2f50555b87",
|
|
4
|
+
"gitShortSha": "62fc9a33",
|
|
5
5
|
"gitBranch": "HEAD",
|
|
6
|
-
"builtAt": "2026-11-
|
|
6
|
+
"builtAt": "2026-11-14T22:13:29.629Z",
|
|
7
7
|
"dirty": false
|
|
8
8
|
}
|
package/src/main/chatRunner.cjs
CHANGED
|
@@ -46,6 +46,7 @@ const { extractJson } = require('./lib/util/extractJson.cjs');
|
|
|
46
46
|
const { classifyPromptTicket } = require('./lib/classifyPromptTicket.cjs');
|
|
47
47
|
const sessionSlots = require('./lib/scheduler/sessionSlots.cjs');
|
|
48
48
|
const opsErrorLog = require('./lib/telemetry/opsErrorLog.cjs');
|
|
49
|
+
const telemetryCounters = require('./lib/telemetry/telemetryCounters.cjs');
|
|
49
50
|
const { killTree, detachedSpawnOpts } = require('./lib/process/killTree.cjs');
|
|
50
51
|
const agentModelResolve = require('./lib/claude/agentModelResolve.cjs');
|
|
51
52
|
const { developLoopOffSettingsArgs } = require('./lib/epic/developLoopSpawn.cjs');
|
|
@@ -723,6 +724,10 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
723
724
|
|
|
724
725
|
let killed = false;
|
|
725
726
|
let child = null;
|
|
727
|
+
// session.open (surface 'chat') fires once per turn, only when a spawn
|
|
728
|
+
// actually starts a brand-new CLI session (--session-id) — never for a
|
|
729
|
+
// --resume turn, and never twice if the flag-swap retry re-spawns.
|
|
730
|
+
let sessionOpenTracked = false;
|
|
726
731
|
const doKill = (sig) => {
|
|
727
732
|
if (killed) return;
|
|
728
733
|
killed = true;
|
|
@@ -829,6 +834,10 @@ function executeRun({ tabId, sessionId, prompt, cwd, resume, silent, onSilentRes
|
|
|
829
834
|
return;
|
|
830
835
|
}
|
|
831
836
|
child = thisChild;
|
|
837
|
+
if (!agentPlan && !resumeFlag && !sessionOpenTracked) {
|
|
838
|
+
sessionOpenTracked = true;
|
|
839
|
+
telemetryCounters.trackSessionOpen({ surface: 'chat' });
|
|
840
|
+
}
|
|
832
841
|
chatInflight.begin(sessionId, { tabId, cwd, pid: thisChild.pid, startedAt, resume, silent, promptId, origin, worktreeDirHint }).catch(() => {});
|
|
833
842
|
feedChildStdin(thisChild, agentPlan ? agentPlan.stdin : fullPrompt, {
|
|
834
843
|
log: (m) => logs.writeLine({ scope: 'chatRunner', level: 'warn', message: m }),
|
package/src/main/config.cjs
CHANGED
|
@@ -493,6 +493,26 @@ function releaseWatchesForSender(senderId) {
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
|
|
496
|
+
/**
|
|
497
|
+
* Release a renderer's watches whenever its frame starts navigating (Ctrl+R,
|
|
498
|
+
* HMR full reload) — the fresh renderer re-registers its own. The sender id is
|
|
499
|
+
* captured at registration so the listener never reaches back through a
|
|
500
|
+
* window/webContents reference that may since have been nulled or destroyed.
|
|
501
|
+
* @param {import('node:events').EventEmitter & { id: number }} webContents
|
|
502
|
+
*/
|
|
503
|
+
function bindWatchReleaseOnNavigation(webContents) {
|
|
504
|
+
const senderId = webContents.id;
|
|
505
|
+
webContents.on('did-start-navigation', () => {
|
|
506
|
+
releaseWatchesForSender(senderId);
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/** Watch keys currently registered by `senderId` (test / diagnostics seam). */
|
|
511
|
+
function watchedPathsForSender(senderId) {
|
|
512
|
+
const sm = senderWatches.get(senderId);
|
|
513
|
+
return sm ? [...sm.keys()] : [];
|
|
514
|
+
}
|
|
515
|
+
|
|
496
516
|
function closeAllWatchers() {
|
|
497
517
|
for (const { watcher } of watchers.values()) {
|
|
498
518
|
watcher.close().catch(() => {});
|
|
@@ -531,6 +551,8 @@ module.exports = {
|
|
|
531
551
|
registerConfigHandlers,
|
|
532
552
|
closeAllWatchers,
|
|
533
553
|
releaseWatchesForSender,
|
|
554
|
+
bindWatchReleaseOnNavigation,
|
|
555
|
+
watchedPathsForSender,
|
|
534
556
|
watch,
|
|
535
557
|
unwatch,
|
|
536
558
|
// exported for tests / direct use
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
const { app, powerSaveBlocker, powerMonitor, crashReporter } = require('electron');
|
|
27
27
|
const fs = require('node:fs');
|
|
28
|
+
const os = require('node:os');
|
|
28
29
|
const path = require('node:path');
|
|
29
30
|
const { reportCrash, classifyUncleanShutdown, reportChildProcessGone } = require('./lib/telemetry/crashTelemetry.cjs');
|
|
30
31
|
const { maybeCaptureMainHeap } = require('./lib/telemetry/mainHeapSnapshot.cjs');
|
|
@@ -283,9 +284,13 @@ function checkPreviousRun(deps = {}) {
|
|
|
283
284
|
const lastLoopDelayMaxMs = prev.loop?.loopDelayMaxMs;
|
|
284
285
|
const sampleMs = s?.ts ? Date.parse(s.ts) : NaN;
|
|
285
286
|
const silentGapSec = Number.isFinite(sampleMs) ? Math.round((Date.now() - sampleMs) / 1000) : undefined;
|
|
287
|
+
// Machine uptime vs. last-sample age: booted after the last sample = os-restart.
|
|
288
|
+
let bootUptimeSec;
|
|
289
|
+
try { bootUptimeSec = Math.round((deps.uptime || os.uptime)()); } catch { bootUptimeSec = undefined; }
|
|
290
|
+
const lastSampleAgeSec = silentGapSec;
|
|
286
291
|
const exitRecord = readExitRecord(dir, prev.pid);
|
|
287
292
|
const stderrTail = readStderrTail(dir);
|
|
288
|
-
const likelyCause = classifyUncleanShutdown({ lastLoopDelayMaxMs, lastTotalMb: s?.totalMb, silentGapSec, exitRecord, stderrTail });
|
|
293
|
+
const likelyCause = classifyUncleanShutdown({ lastLoopDelayMaxMs, lastTotalMb: s?.totalMb, silentGapSec, bootUptimeSec, lastSampleAgeSec, exitRecord, stderrTail });
|
|
289
294
|
log?.writeLine({
|
|
290
295
|
scope: 'crash-diag',
|
|
291
296
|
level: 'error',
|
|
@@ -300,6 +305,7 @@ function checkPreviousRun(deps = {}) {
|
|
|
300
305
|
powerBlockerHeldAtDeath: s?.powerBlockerHeld,
|
|
301
306
|
lastLoopDelayMaxMs,
|
|
302
307
|
silentGapSec,
|
|
308
|
+
bootUptimeSec,
|
|
303
309
|
likelyCause,
|
|
304
310
|
exitRecord,
|
|
305
311
|
scopeResult,
|
|
@@ -309,8 +315,9 @@ function checkPreviousRun(deps = {}) {
|
|
|
309
315
|
// The unclean-shutdown postmortem is the report most likely to be the ONLY
|
|
310
316
|
// thing ever received from a machine that just OOM-killed the app — the
|
|
311
317
|
// dying process couldn't write it itself. See crashTelemetry.cjs header.
|
|
318
|
+
// The cause is in the name so the dashboard splits OOM from reboots.
|
|
312
319
|
report({
|
|
313
|
-
reason:
|
|
320
|
+
reason: `unclean-shutdown:${likelyCause}`,
|
|
314
321
|
meta: {
|
|
315
322
|
lastSampleTs: s?.ts,
|
|
316
323
|
lastTotalMb: s?.totalMb,
|
|
@@ -319,6 +326,7 @@ function checkPreviousRun(deps = {}) {
|
|
|
319
326
|
powerBlockerHeldAtDeath: s?.powerBlockerHeld,
|
|
320
327
|
lastLoopDelayMaxMs,
|
|
321
328
|
silentGapSec,
|
|
329
|
+
bootUptimeSec,
|
|
322
330
|
likelyCause,
|
|
323
331
|
exitRecord,
|
|
324
332
|
},
|
package/src/main/index.cjs
CHANGED
|
@@ -493,39 +493,27 @@ function createWindow() {
|
|
|
493
493
|
if (firstPaintTimer) { clearTimeout(firstPaintTimer); firstPaintTimer = null; }
|
|
494
494
|
mainWindow.maximize();
|
|
495
495
|
mainWindow.show();
|
|
496
|
-
|
|
497
|
-
// Backlog drain: ships the pre-existing errors-<date>.jsonl backlog every
|
|
498
|
-
// known project has already accumulated, marking exactly what's
|
|
499
|
-
// CONFIRMED delivered. Fired after the window is shown (never blocks
|
|
500
|
-
// startup) and yields between files internally. See telemetryBacklog.cjs.
|
|
501
|
-
require('./lib/telemetry/telemetryBacklog.cjs')
|
|
502
|
-
.bootDrain({ appVersion: app.getVersion() })
|
|
503
|
-
.catch((e) => {
|
|
504
|
-
logs.writeLine({ scope: 'telemetry', level: 'warn', message: 'telemetryBacklog.bootDrain failed', meta: { error: e?.message } });
|
|
505
|
-
});
|
|
506
496
|
});
|
|
507
497
|
|
|
508
498
|
// Bounded auto-recovery for a crashed / hung / failed-to-load renderer.
|
|
509
499
|
require('./lib/rendererRecovery.cjs').attachRendererRecovery(mainWindow.webContents, { logs });
|
|
510
500
|
|
|
511
|
-
//
|
|
512
|
-
//
|
|
513
|
-
//
|
|
514
|
-
//
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
//
|
|
519
|
-
//
|
|
520
|
-
|
|
521
|
-
configMgr.releaseWatchesForSender(mainWindow.webContents.id);
|
|
522
|
-
});
|
|
501
|
+
// Capture the window + webContents at registration. The module-level
|
|
502
|
+
// `mainWindow` is nulled in 'closed' while the app stays alive (macOS), so a
|
|
503
|
+
// late-firing listener must never dereference it (telemetry: uncaught
|
|
504
|
+
// "Cannot read properties of null (reading 'webContents')", v0.132.0).
|
|
505
|
+
const win = mainWindow;
|
|
506
|
+
const wc = win.webContents;
|
|
507
|
+
|
|
508
|
+
// Release the previous renderer frame's chokidar watches on Ctrl+R / HMR
|
|
509
|
+
// reloads (avoids refcount ratcheting); id captured inside the helper.
|
|
510
|
+
configMgr.bindWatchReleaseOnNavigation(wc);
|
|
523
511
|
|
|
524
512
|
// CSP (frame-src/connect-src) does not govern a subframe navigating itself —
|
|
525
513
|
// a demo-video document could still exfiltrate data via meta refresh or
|
|
526
514
|
// `location.href = 'https://…'`. Block any such navigation out of an
|
|
527
515
|
// smfile:// demo-video subframe.
|
|
528
|
-
|
|
516
|
+
wc.on('will-frame-navigate', (details) => {
|
|
529
517
|
if (shouldBlockFrameNavigation({
|
|
530
518
|
isMainFrame: details.isMainFrame,
|
|
531
519
|
currentUrl: details.frame?.url,
|
|
@@ -536,13 +524,18 @@ function createWindow() {
|
|
|
536
524
|
}
|
|
537
525
|
});
|
|
538
526
|
|
|
539
|
-
|
|
527
|
+
// Native right-click menu — Copy / Paste / Select All everywhere. Roles
|
|
528
|
+
// hook into Electron's built-in clipboard/selection plumbing, which xterm.js
|
|
529
|
+
// (and Monaco, and Tiptap) all participate in via the standard DOM
|
|
530
|
+
// selection API, so this single block covers Terminal + Doc Editor + plain
|
|
531
|
+
// text inputs without per-component wiring.
|
|
532
|
+
wc.on('context-menu', (_e, params) => {
|
|
540
533
|
const items = [];
|
|
541
534
|
if (params.editFlags.canCopy) items.push({ label: 'Copy', role: 'copy' });
|
|
542
535
|
if (params.editFlags.canPaste) items.push({ label: 'Paste', role: 'paste' });
|
|
543
536
|
if (items.length) items.push({ type: 'separator' });
|
|
544
537
|
items.push({ label: 'Select All', role: 'selectAll' });
|
|
545
|
-
Menu.buildFromTemplate(items).popup({ window:
|
|
538
|
+
Menu.buildFromTemplate(items).popup({ window: win });
|
|
546
539
|
});
|
|
547
540
|
|
|
548
541
|
const distIndex = path.join(__dirname, '..', '..', 'dist', 'index.html');
|
|
@@ -1590,6 +1583,22 @@ app.whenReady().then(async () => {
|
|
|
1590
1583
|
]).catch((e) => {
|
|
1591
1584
|
logs.writeLine({ scope: 'seed', level: 'error', message: 'seed chain failed', meta: { error: e?.message } });
|
|
1592
1585
|
});
|
|
1586
|
+
// Telemetry: bootSequence snapshotted seed status before the seeders ran, so
|
|
1587
|
+
// re-send the install record once seeding settles (fulfil OR reject) when the
|
|
1588
|
+
// seeds differ from the last reported ones. Fail-inert — see telemetryBoot.cjs.
|
|
1589
|
+
{
|
|
1590
|
+
const reportSeeds = () => {
|
|
1591
|
+
try {
|
|
1592
|
+
return require('./lib/telemetry/telemetryBoot.cjs')
|
|
1593
|
+
.reportSeedsIfChanged()
|
|
1594
|
+
.catch((e) => {
|
|
1595
|
+
logs.writeLine({ scope: 'telemetry', level: 'warn', message: 'reportSeedsIfChanged failed', meta: { error: e?.message } });
|
|
1596
|
+
});
|
|
1597
|
+
} catch { /* telemetry must never break boot */ }
|
|
1598
|
+
return undefined;
|
|
1599
|
+
};
|
|
1600
|
+
bootSeedingPromise.then(reportSeeds, reportSeeds);
|
|
1601
|
+
}
|
|
1593
1602
|
// Rewrite the stable guard-hook shims (~/.claude/session-manager/hooks/) to
|
|
1594
1603
|
// point at THIS running app's root, on every boot. An already-installed
|
|
1595
1604
|
// project hook resolves through the shim at invocation time, so an app
|
package/src/main/ipcSchemas.cjs
CHANGED
|
@@ -254,6 +254,11 @@ const promptSessionsCreateEpic = z.object({
|
|
|
254
254
|
// `cwd` through config.cjs's validatePath before any transcript dir is read.
|
|
255
255
|
const promptSessionsListRestorable = z.object({ cwd: z.string().min(1).max(4096) }).strict();
|
|
256
256
|
|
|
257
|
+
// Renderer entry point for the cross-project "continue any session" picker
|
|
258
|
+
// (restorableSessions.cjs's listRecentRestorableSessions). No cwd: the project
|
|
259
|
+
// list comes from main's own cached allProjectCwds(), never from the renderer.
|
|
260
|
+
const promptSessionsListRestorableRecent = z.object({ limit: z.number().int().min(1).max(50).optional() }).strict();
|
|
261
|
+
|
|
257
262
|
// Renderer entry point for creating an Epic's isolated git worktree
|
|
258
263
|
// (lib/epic/epicWorktreeMint.cjs) at the proposed->active transition — PRD 1033.
|
|
259
264
|
const promptSessionsCreateWorktree = z.object({
|
|
@@ -1579,6 +1584,7 @@ module.exports = {
|
|
|
1579
1584
|
promptSessionsWriteArchive,
|
|
1580
1585
|
promptSessionsCreateEpic,
|
|
1581
1586
|
promptSessionsListRestorable,
|
|
1587
|
+
promptSessionsListRestorableRecent,
|
|
1582
1588
|
promptSessionsCreateWorktree,
|
|
1583
1589
|
promptSessionsReopen,
|
|
1584
1590
|
promptSessionsCwd,
|
|
@@ -7,6 +7,8 @@ const AGENT_CLI_IDS = Object.freeze(['claude', 'codex', 'gemini', 'antigravity',
|
|
|
7
7
|
const MAX_LINE_CHARS = 8 * 1024 * 1024;
|
|
8
8
|
const MAX_TOOL_RESULT_CHARS = 4000;
|
|
9
9
|
const USAGE_KEYS = ['input_tokens', 'output_tokens', 'cache_read_input_tokens'];
|
|
10
|
+
// Model string handed to a non-Claude CLI — the one rule Epic mint and persona defaults share.
|
|
11
|
+
const AGENT_CLI_MODEL_RE = /^[A-Za-z0-9._:/@+\[\]-]{1,128}$/;
|
|
10
12
|
|
|
11
13
|
function isAgentCliId(x) {
|
|
12
14
|
return typeof x === 'string' && AGENT_CLI_IDS.includes(x);
|
|
@@ -16,6 +18,10 @@ function isNonClaudeAgentCli(x) {
|
|
|
16
18
|
return isAgentCliId(x) && x !== 'claude';
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
function isAgentCliModel(x) {
|
|
22
|
+
return typeof x === 'string' && AGENT_CLI_MODEL_RE.test(x);
|
|
23
|
+
}
|
|
24
|
+
|
|
19
25
|
function initEvent(nativeSessionId, cli) {
|
|
20
26
|
return { type: 'system', subtype: 'init', session_id: nativeSessionId, agent_cli: cli };
|
|
21
27
|
}
|
|
@@ -85,6 +91,8 @@ module.exports = {
|
|
|
85
91
|
AGENT_CLI_IDS,
|
|
86
92
|
isAgentCliId,
|
|
87
93
|
isNonClaudeAgentCli,
|
|
94
|
+
AGENT_CLI_MODEL_RE,
|
|
95
|
+
isAgentCliModel,
|
|
88
96
|
initEvent,
|
|
89
97
|
textEvent,
|
|
90
98
|
toolUseEvent,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
// Demo-video kit capture helper: up to 6 size-budgeted screenshots (and optional short clips)
|
|
3
|
-
// of the live product at one URL. Playwright is resolved at runtime (cwd,
|
|
4
|
-
//
|
|
3
|
+
// of the live product at one URL. Playwright is resolved at runtime via playwrightLoader.cjs (cwd, global npm root,
|
|
4
|
+
// npx cache, or an injected loader) and is never installed here. Node builtins only.
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const path = require('path');
|
|
7
|
-
const {
|
|
7
|
+
const { loadPlaywright: defaultLoader } = require('./playwrightLoader.cjs');
|
|
8
8
|
|
|
9
9
|
const MAX_SHOTS = 6;
|
|
10
10
|
const IMAGE_BUDGET = 120 * 1024;
|
|
@@ -13,39 +13,6 @@ const QUALITY_STEPS = [80, 65, 52, 40, 30, 20]; // at most 6 tries
|
|
|
13
13
|
const NAV_TIMEOUT_MS = 30000;
|
|
14
14
|
const VIEWPORT = { width: 1280, height: 720 };
|
|
15
15
|
|
|
16
|
-
function tryRequire(name, paths) {
|
|
17
|
-
try {
|
|
18
|
-
return require(require.resolve(name, { paths }));
|
|
19
|
-
} catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function globalNpmRoot() {
|
|
25
|
-
try {
|
|
26
|
-
const r = spawnSync('npm', ['root', '-g'], { encoding: 'utf8', timeout: 15000 });
|
|
27
|
-
return r.status === 0 ? String(r.stdout).trim() : '';
|
|
28
|
-
} catch {
|
|
29
|
-
return '';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Default loader: process.cwd() first, then the global npm root. Never installs. */
|
|
34
|
-
function defaultLoader() {
|
|
35
|
-
for (const name of ['playwright', 'playwright-core']) {
|
|
36
|
-
const m = tryRequire(name, [process.cwd()]);
|
|
37
|
-
if (m) return m;
|
|
38
|
-
}
|
|
39
|
-
const root = globalNpmRoot();
|
|
40
|
-
if (root) {
|
|
41
|
-
for (const name of ['playwright', 'playwright-core']) {
|
|
42
|
-
const m = tryRequire(name, [root]);
|
|
43
|
-
if (m) return m;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
16
|
async function defaultEncode(page, { kind, quality }) {
|
|
50
17
|
if (kind !== 'image') return null; // clips need an injected encoder; dropped otherwise
|
|
51
18
|
return page.screenshot({ type: 'jpeg', quality });
|
|
@@ -75,7 +42,7 @@ async function focusFor(page, shot) {
|
|
|
75
42
|
|
|
76
43
|
async function capture({ url, outDir, shots, max = MAX_SHOTS, loadPlaywright, encode, navTimeoutMs } = {}) {
|
|
77
44
|
if (!url || typeof url !== 'string') return { skipped: 'no-url' };
|
|
78
|
-
const pw = (loadPlaywright || defaultLoader)();
|
|
45
|
+
const pw = (loadPlaywright || (() => defaultLoader()))();
|
|
79
46
|
const resolved = pw && typeof pw.then === 'function' ? await pw : pw;
|
|
80
47
|
const chromium = resolved && resolved.chromium;
|
|
81
48
|
if (!chromium) return { skipped: 'no-playwright' };
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
const fs = require('node:fs');
|
|
8
8
|
const path = require('node:path');
|
|
9
9
|
const { spawnSync } = require('node:child_process');
|
|
10
|
-
|
|
10
|
+
// Kit files are seeded to ~/.claude/session-manager/demo-video-kit/ and must
|
|
11
|
+
// load standalone: node built-ins and this folder only (no ../opsOwnership.cjs).
|
|
12
|
+
// Allowlisted for this literal in scripts/check-ops-path-literals.cjs ALLOWLIST.
|
|
13
|
+
const OPS_ROOT_DIR = 'session-manager-operations';
|
|
11
14
|
|
|
12
15
|
const MAX_JS_BYTES = 300 * 1024;
|
|
13
16
|
const MAX_JSON_BYTES = 16 * 1024;
|
|
@@ -50,8 +53,23 @@ function validateCharacterJs(js, networkChecks = []) {
|
|
|
50
53
|
return null;
|
|
51
54
|
}
|
|
52
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Local stand-in for opsOwnership.opsPath(projectRoot, 'project-pages', ...):
|
|
58
|
+
* requires an absolute path and normalizes a path inside the ops root back to
|
|
59
|
+
* its project root, so the result always lands in
|
|
60
|
+
* `<projectRoot>/session-manager-operations/project-pages/videos/_character`.
|
|
61
|
+
* Callers pass an already-resolved project root; writes stay guarded by the
|
|
62
|
+
* caller's writer-checked writeTextAtomic (assertOpsWrite).
|
|
63
|
+
*/
|
|
53
64
|
function characterDir(projectRoot) {
|
|
54
|
-
|
|
65
|
+
if (!projectRoot || typeof projectRoot !== 'string') throw new Error('characterDir: projectRoot is required');
|
|
66
|
+
if (!path.isAbsolute(projectRoot)) {
|
|
67
|
+
throw new Error(`characterDir: projectRoot must be an absolute path, got "${projectRoot}"`);
|
|
68
|
+
}
|
|
69
|
+
const segs = path.resolve(projectRoot).split(path.sep);
|
|
70
|
+
const idx = segs.indexOf(OPS_ROOT_DIR);
|
|
71
|
+
const root = idx === -1 ? segs.join(path.sep) : (segs.slice(0, idx).join(path.sep) || path.sep);
|
|
72
|
+
return path.join(root, OPS_ROOT_DIR, 'project-pages', 'videos', '_character');
|
|
55
73
|
}
|
|
56
74
|
|
|
57
75
|
/** -> {json, js} | null (absent or invalid). */
|