claude-code-session-manager 0.133.1 → 0.135.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/assets/AgentLibrary-DRlcF1YD.js +2 -0
  2. package/dist/assets/{AppSettings-DwnfV9-4.js → AppSettings-CBhYHKGI.js} +2 -2
  3. package/dist/assets/{Button-CObXxw7b.js → Button-DtBUGvGI.js} +1 -1
  4. package/dist/assets/{DocumentEditorPane-CgB5IuOY.js → DocumentEditorPane-C82c7Qtl.js} +1 -1
  5. package/dist/assets/{Extensions-Fuhshcl6.js → Extensions-Kn-oUD2_.js} +2 -2
  6. package/dist/assets/{History-DbUV4jxK.js → History-B4c3Uz9u.js} +2 -2
  7. package/dist/assets/{Library-COr79GyT.js → Library-1RpLT-aH.js} +1 -1
  8. package/dist/assets/{ListDetail-DY53nXya.js → ListDetail-xr0oxNkv.js} +1 -1
  9. package/dist/assets/{Panel-D7NX5iP8.js → Panel-O8XPrpJu.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-DuWzM8qA.js → ProjectClaudeConfig-DBGhhzg2.js} +5 -5
  11. package/dist/assets/{ProvenanceBadge-AnwE1p5X.js → ProvenanceBadge-DSaizfZL.js} +1 -1
  12. package/dist/assets/Scheduler-D2_5NyiR.js +16 -0
  13. package/dist/assets/{Settings-tt0VZCyz.js → Settings-Clgqb3Lq.js} +2 -2
  14. package/dist/assets/{SkillReferenceGraph-D_rxqWgq.js → SkillReferenceGraph-D80RA7kR.js} +1 -1
  15. package/dist/assets/{Skills-BVQPJZaF.js → Skills-DNG7tHSf.js} +10 -10
  16. package/dist/assets/{SourceChip-DC5XD8KC.js → SourceChip-D-Imzszd.js} +1 -1
  17. package/dist/assets/{SystemPrompt-XnvP0_cS.js → SystemPrompt-CGlOpUQA.js} +1 -1
  18. package/dist/assets/{TiptapBody-B_TNEADm.js → TiptapBody-CJFGfBdz.js} +28 -28
  19. package/dist/assets/{Toggle-CxQO8pGN.js → Toggle-0Ff0bPa_.js} +1 -1
  20. package/dist/assets/{ViewTabs-CEjnWPD9.js → ViewTabs-BCMYQwo_.js} +1 -1
  21. package/dist/assets/{VoiceButton-B-6gdmKe.js → VoiceButton-JzyC6DAB.js} +1 -1
  22. package/dist/assets/geist-sans-latin-300-normal-C3kkMBb6.woff2 +0 -0
  23. package/dist/assets/geist-sans-latin-400-normal-gapTbOY8.woff2 +0 -0
  24. package/dist/assets/geist-sans-latin-500-normal-uokXdC-Q.woff2 +0 -0
  25. package/dist/assets/geist-sans-latin-600-normal-DFOURf8L.woff2 +0 -0
  26. package/dist/assets/geist-sans-latin-700-normal-BmN9tIp5.woff2 +0 -0
  27. package/dist/assets/{historyTotals-dT8vcKzX.js → historyTotals-B01WPBwh.js} +1 -1
  28. package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  29. package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  30. package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  31. package/dist/assets/{index-5QIl5Kcd.css → index-CjQ_p5y7.css} +1 -1
  32. package/dist/assets/index-rt7pTODX.js +3116 -0
  33. package/dist/assets/newsreader-latin-400-italic-CEihAR-f.woff2 +0 -0
  34. package/dist/assets/newsreader-latin-400-normal-BFBkh4jY.woff2 +0 -0
  35. package/dist/assets/newsreader-latin-500-normal-B66TYsaK.woff2 +0 -0
  36. package/dist/assets/newsreader-latin-600-normal-30OJ_TG_.woff2 +0 -0
  37. package/dist/assets/newsreader-latin-700-normal-rIgV_oaK.woff2 +0 -0
  38. package/dist/index.html +2 -5
  39. package/dist-web/app.css +1 -1
  40. package/dist-web/app.js +409 -404
  41. package/dist-web/index.html +0 -3
  42. package/package.json +1 -1
  43. package/plugins/session-manager-dev/skills/develop/standards.md +1 -1
  44. package/scripts/scheduler-mcp-server.cjs +31 -0
  45. package/src/main/agentLibrary.cjs +27 -4
  46. package/src/main/build-info.json +4 -4
  47. package/src/main/chatRunner.cjs +9 -0
  48. package/src/main/config.cjs +22 -0
  49. package/src/main/crashDiagnostics.cjs +10 -2
  50. package/src/main/index.cjs +34 -25
  51. package/src/main/ipcSchemas.cjs +6 -0
  52. package/src/main/lib/agent-cli/agentCliEvents.cjs +8 -0
  53. package/src/main/lib/demo-video-kit/capture.cjs +4 -37
  54. package/src/main/lib/demo-video-kit/character.cjs +20 -2
  55. package/src/main/lib/demo-video-kit/checks.cjs +82 -1
  56. package/src/main/lib/demo-video-kit/frames.cjs +3 -28
  57. package/src/main/lib/demo-video-kit/playwrightLoader.cjs +67 -0
  58. package/src/main/lib/demo-video-kit/seedKit.cjs +2 -2
  59. package/src/main/lib/demo-video-kit/sound.cjs +5 -2
  60. package/src/main/lib/epic/epicMint.cjs +1 -3
  61. package/src/main/lib/epic/promptSessionsCreateEpic.cjs +37 -4
  62. package/src/main/lib/epic/restorableSessions.cjs +88 -0
  63. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +56 -1
  64. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +21 -3
  65. package/src/main/lib/feedback-remote/remoteAssets.cjs +25 -1
  66. package/src/main/lib/mcpToolCatalog.cjs +15 -0
  67. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +10 -1
  68. package/src/main/lib/persona-macro/builtinMacros.cjs +3 -2
  69. package/src/main/lib/persona-macro/macroJobDispatch.cjs +3 -2
  70. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +22 -0
  71. package/src/main/lib/prd/listPrdsSingleFlight.cjs +79 -0
  72. package/src/main/lib/prd/prdAgentType.cjs +17 -7
  73. package/src/main/lib/prd/prdFrontmatter.cjs +25 -1
  74. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  75. package/src/main/lib/telemetry/crashTelemetry.cjs +10 -5
  76. package/src/main/lib/telemetry/telemetryBoot.cjs +77 -4
  77. package/src/main/lib/telemetry/telemetryClient.cjs +54 -9
  78. package/src/main/lib/telemetry/telemetryConsent.cjs +3 -0
  79. package/src/main/lib/telemetry/telemetryCounters.cjs +7 -2
  80. package/src/main/lib/telemetry/telemetrySettings.cjs +5 -0
  81. package/src/main/promptSessionEvents.cjs +7 -1
  82. package/src/main/pty.cjs +2 -2
  83. package/src/main/runVerify.cjs +2 -2
  84. package/src/main/scheduler/prdParser.cjs +18 -2
  85. package/src/main/scheduler.cjs +156 -18
  86. package/src/main/seedAgentPersonas.cjs +24 -0
  87. package/src/main/seedStatus.cjs +5 -2
  88. package/src/main/telemetryIpc.cjs +1 -5
  89. package/src/main/templates/PRD_AUTHORING.md +2 -2
  90. package/src/preload/api.d.ts +37 -16
  91. package/src/preload/apiSurface.json +7 -0
  92. package/src/preload/index.cjs +3 -1
  93. package/src/seed/agents/demo-video-builder.md +7 -2
  94. package/src/seed/agents/project-home-builder.md +4 -2
  95. package/dist/assets/AgentLibrary-BTIBmZkM.js +0 -2
  96. package/dist/assets/Scheduler-BHfx0rXd.js +0 -16
  97. package/dist/assets/index-BLORXCcT.js +0 -3111
  98. package/src/main/lib/telemetry/telemetryBacklog.cjs +0 -607
@@ -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.133.1",
3
+ "version": "0.135.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",
@@ -81,5 +81,5 @@ Long hangs, not bad code, cause most failed runs. The PRD body carries a one-lin
81
81
  - **Never `git stash`, `git reset`, `git checkout -- <path>`, or `git clean` against working-tree state you did not create.** There is no polite version of this. You are normally isolated in your own `git worktree` on branch `sm-job/<slug>` (`src/main/lib/git/gitWorktree.cjs`), and the scheduler salvages any uncommitted diff of yours on teardown — so you never need to touch shared state to protect your own work. Confirm isolation with `git rev-parse --git-common-dir` (a worktree's common-dir differs from its own `.git`) or by checking your cwd; `git diff`/`git status` are always safe. If you land in a SHARED tree with pre-existing dirty tracked files anyway, work around them — scope `git add`/commits to only the paths you touched — or end with `SCHEDULER_VERDICT: FAIL <reason>` (`SCHEDULER_VERDICT: BLOCKED_BY_FOREIGN_WIP` only when your gate failed on those files, as the finish protocol says); never discard, stash, or revert someone else's uncommitted changes to get a clean checkout. A shared tree may be feeding a running service that reads its config straight from the working tree, so reverting it is a production change, not a local inconvenience. The scheduler runs a shared-tree stash guard as a backstop (`scheduler.cjs`'s `checkSharedTreeGuard`/`evaluateSharedTreeGuard`), but that guard exists to catch a mistake, not to license one. (Incidents: PRD 477 stashed a sibling job's WIP to get its own checkout and never restored it. 2026-09-01: a headless executor in the trader repo ran a blanket `git stash` against an operator's uncommitted live trading-config edit and exited without restoring it — the third incident of this class.)
82
82
  - **`gh pr edit --body` can fail on repos with legacy GitHub Projects (classic) boards.** It queries the deprecated `repository.pullRequest.projectCards` field and errors with a `GraphQL: Projects (classic) is being deprecated` message even though the edit itself would otherwise succeed — a known `gh` CLI quirk, not a defect in your work. Prefer `gh api -X PATCH repos/<owner>/<repo>/pulls/<n> -f body="$(cat body.md)"` instead; it skips that field. If `gh pr edit` fails this way anyway retry immediately with the `gh api` form and note the fallback in your report.
83
83
  - **Never `sleep N && <cmd>` to poll remote CI/job status.** The harness hard-blocks a `sleep` chained to another command. Use the tool's own blocking watcher under a hard cap instead: `timeout 600 gh run watch <run-id> --repo <owner>/<repo> --exit-status`. `gh pr checks` exits 8 while checks are pending and 1 on failure — that is not a defect in your work.
84
- - **The verdict line is your authoritative "I passed" signal — emit it truthfully.** The scheduler's finish protocol ends by printing `SCHEDULER_VERDICT: PASS` once the AC gate is green and the commit has landed (or `SCHEDULER_VERDICT: FAIL <reason>` + `exit 1` otherwise). `PASS` plus a landed commit is authoritative: it overrides incidental transcript markers, so a deliberately reproduced red test or a grep result containing "Error" will not false-trip `needs_review`, as long as the run genuinely ends green and committed. Exiting 0 with uncommitted changes, or with no verdict line at all, is the #1 cause of needless `needs_review`. Never print `PASS` when the gate is red — that turns a safety net into a silent-failure machine.
84
+ - **The verdict line is your authoritative "I passed" signal — emit it truthfully.** The scheduler's finish protocol ends by printing `SCHEDULER_VERDICT: PASS` once the AC gate is green and the commit has landed (or `SCHEDULER_VERDICT: FAIL <reason>` + `exit 1` otherwise). `PASS` plus a landed commit is authoritative: it overrides incidental transcript markers, so a deliberately reproduced red test or a grep result containing "Error" will not false-trip `needs_review`, as long as the run genuinely ends green and committed. An artifact-only PRD (`deliverable: artifact` + `artifactPaths`) commits nothing by design: a green gate with a clean tree is a `PASS`, never a `FAIL` for the missing commit. Exiting 0 with uncommitted changes, or with no verdict line at all, is the #1 cause of needless `needs_review`. Never print `PASS` when the gate is red — that turns a safety net into a silent-failure machine.
85
85
  - **If your own AC gate failed on a SIBLING job's in-flight file, say so with the right verdict — don't print a lying FAIL.** If the prompt disclosed a `--- FOREIGN WORKING-TREE STATE ---` section and your gate failure is confined to paths that section named as not your work, print `SCHEDULER_VERDICT: BLOCKED_BY_FOREIGN_WIP` (and `exit 1`) plus a `FOREIGN_WIP_PATHS: <path1>, <path2>, ...` line naming exactly the failing paths. The scheduler validates every listed path against the manifest it disclosed to you — list a path it never named, or claim this verdict for your own regression, and it is rejected back to `FAIL`. This is not an escape hatch: it exists so a correctly-diagnosed "not my regression" gets auto-requeued once the sibling clears its WIP, instead of spawning a fix-plan investigation into someone else's unfinished work.
@@ -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,
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "0.133.1",
3
- "gitSha": "4c74235ec6f1e9687e72c9de96deab9b6287f6d9",
4
- "gitShortSha": "4c74235e",
2
+ "version": "0.135.0",
3
+ "gitSha": "e4f59f3f49bc1a6db03044a33b8c56d52c44247f",
4
+ "gitShortSha": "e4f59f3f",
5
5
  "gitBranch": "HEAD",
6
- "builtAt": "2026-11-14T04:00:21.487Z",
6
+ "builtAt": "2026-11-15T01:31:55.800Z",
7
7
  "dirty": false
8
8
  }
@@ -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 }),
@@ -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: 'unclean-shutdown',
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
  },
@@ -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
- // Native right-click menu — Copy / Paste / Select All everywhere. Roles
512
- // hook into Electron's built-in clipboard/selection plumbing, which xterm.js
513
- // (and Monaco, and Tiptap) all participate in via the standard DOM
514
- // selection API, so this single block covers Terminal + Doc Editor + plain
515
- // text inputs without per-component wiring.
516
- // Release any stale chokidar watchers that were opened by the previous
517
- // renderer frame. Fires on Ctrl+R and HMR full-page reloads — the fresh
518
- // renderer will re-register its own watches, so the old sender's contribution
519
- // must be unwound first to avoid refcount ratcheting.
520
- mainWindow.webContents.on('did-start-navigation', () => {
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
- mainWindow.webContents.on('will-frame-navigate', (details) => {
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
- mainWindow.webContents.on('context-menu', (_e, params) => {
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: mainWindow });
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
@@ -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, then global npm
4
- // root, or an injected loader) and is never installed here. Node builtins only.
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 { spawnSync } = require('child_process');
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
- const { opsPath } = require('../opsOwnership.cjs');
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
- return opsPath(projectRoot, 'project-pages', 'videos', '_character');
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). */