claude-code-session-manager 0.137.0 → 0.138.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 (44) hide show
  1. package/dist/assets/{AgentLibrary-DV0DTZDC.js → AgentLibrary-C1d_D7uQ.js} +1 -1
  2. package/dist/assets/{AppSettings-l7NTc0yu.js → AppSettings-CgDhqrsU.js} +1 -1
  3. package/dist/assets/{Button-Cmfkgjfa.js → Button-Bk23rEnZ.js} +1 -1
  4. package/dist/assets/{DocumentEditorPane-MTljV-Uw.js → DocumentEditorPane-BqY5Nq6W.js} +1 -1
  5. package/dist/assets/{Extensions-Cc1Q_8id.js → Extensions-CXem-uwI.js} +2 -2
  6. package/dist/assets/{History-CFo-1DHo.js → History-BwO3coo4.js} +1 -1
  7. package/dist/assets/{Library-C_ibFiOx.js → Library-BDV69fSe.js} +1 -1
  8. package/dist/assets/{ListDetail-ByULG209.js → ListDetail-CD-Fm6mh.js} +1 -1
  9. package/dist/assets/{Panel-BuInRmA0.js → Panel-CeDiyuNn.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-yqqVtHY7.js → ProjectClaudeConfig-NjdKdwe8.js} +1 -1
  11. package/dist/assets/{ProvenanceBadge-CJvnQReI.js → ProvenanceBadge-Bu8NmI_R.js} +1 -1
  12. package/dist/assets/{Scheduler-B7sn2mUw.js → Scheduler-CkhTvG7C.js} +1 -1
  13. package/dist/assets/{Settings-DRRSJksU.js → Settings-COT34hBF.js} +1 -1
  14. package/dist/assets/{SkillReferenceGraph-DwV0Ueyc.js → SkillReferenceGraph-CFMK8NJh.js} +1 -1
  15. package/dist/assets/{Skills-DVYHA9gV.js → Skills-BgexoUkQ.js} +1 -1
  16. package/dist/assets/{SourceChip-DfJ5_5rV.js → SourceChip-BXjcdeb1.js} +1 -1
  17. package/dist/assets/{SystemPrompt-f11wGllK.js → SystemPrompt-CeeH3EeW.js} +1 -1
  18. package/dist/assets/{TiptapBody-Bl8hDhhS.js → TiptapBody-D1kTj-tn.js} +1 -1
  19. package/dist/assets/{Toggle-DaxeFDFp.js → Toggle-CENi19iK.js} +1 -1
  20. package/dist/assets/{ViewTabs-DRtgFKRw.js → ViewTabs-DDBb0x96.js} +1 -1
  21. package/dist/assets/{VoiceButton-DJx-jY4r.js → VoiceButton-CZeyPM31.js} +1 -1
  22. package/dist/assets/{historyTotals-Cgjm5q24.js → historyTotals-B00l64Jw.js} +1 -1
  23. package/dist/assets/index-CgCxpunJ.js +3116 -0
  24. package/dist/index.html +1 -1
  25. package/dist-web/app.js +383 -383
  26. package/package.json +1 -1
  27. package/src/main/build-info.json +4 -4
  28. package/src/main/chatRunner.cjs +51 -0
  29. package/src/main/index.cjs +13 -7
  30. package/src/main/ipcSchemas.cjs +11 -0
  31. package/src/main/lib/demo-video-kit/checks.cjs +16 -0
  32. package/src/main/lib/epic/epicAttachments.cjs +143 -0
  33. package/src/main/lib/epic/epicMint.cjs +4 -0
  34. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +169 -1
  35. package/src/main/lib/feedback-remote/remoteFrameAssembler.cjs +113 -0
  36. package/src/main/lib/persona-macro/macroLibrary.cjs +7 -0
  37. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  38. package/src/main/lib/process/bootStdioGuard.cjs +32 -0
  39. package/src/main/lib/process/stdioGuard.cjs +115 -0
  40. package/src/preload/api.d.ts +27 -1
  41. package/src/preload/apiSurface.json +7 -0
  42. package/src/preload/index.cjs +2 -0
  43. package/src/seed/agents/demo-video-builder.md +10 -7
  44. package/dist/assets/index-iQ6pdyuS.js +0 -3116
@@ -167,6 +167,8 @@ const MacroSchema = z.object({
167
167
  inputs: MacroInputsSchema.optional(),
168
168
  // Projects this macro's session may start work in without approval. Set only by the app's IPC save.
169
169
  autoStartTargets: MacroProjectsSchema.optional(),
170
+ // Human consent that a local script may start this macro (POST /admin/macros/run). Set only by the app's IPC save.
171
+ scriptStart: z.boolean().optional(),
170
172
  }).superRefine(refineInputs);
171
173
 
172
174
  const MacroSaveSchema = z.object({
@@ -184,6 +186,8 @@ const MacroSaveSchema = z.object({
184
186
  inputs: MacroInputsSchema.optional(),
185
187
  // Omitted keeps the stored list on update; `[]` clears it.
186
188
  autoStartTargets: MacroProjectsSchema.optional(),
189
+ // Human consent that a local script may start this macro (POST /admin/macros/run). Set only by the app's IPC save.
190
+ scriptStart: z.boolean().optional(),
187
191
  }).superRefine(refineInputs);
188
192
 
189
193
  const MacroDeleteSchema = z.object({ id: MacroIdSchema });
@@ -617,6 +621,8 @@ async function saveMacro(input, opts = {}) {
617
621
  } else {
618
622
  saved.autoStartTargets = normalizeProjects(parsed.autoStartTargets);
619
623
  }
624
+ if (parsed.scriptStart === true) saved.scriptStart = true;
625
+ else if (parsed.scriptStart === false) delete saved.scriptStart;
620
626
  assertPlaceholdersDeclared(saved);
621
627
  macros[idx] = saved;
622
628
  } else {
@@ -639,6 +645,7 @@ async function saveMacro(input, opts = {}) {
639
645
  if (parsed.autoStartTargets && parsed.autoStartTargets.length > 0) {
640
646
  saved.autoStartTargets = normalizeProjects(parsed.autoStartTargets);
641
647
  }
648
+ if (parsed.scriptStart === true) saved.scriptStart = true;
642
649
  assertPlaceholdersDeclared(saved);
643
650
  macros.push(saved);
644
651
  }
@@ -555,6 +555,17 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
555
555
  effort: "max",
556
556
  },
557
557
  },
558
+ {
559
+ commit: "seed-v14",
560
+ bodySha256: "b65ef654c1ab9671b3781dfe6d70f936b984f226d11a03dd894f1b66993b8b35",
561
+ fm: {
562
+ description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
563
+ tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write, mcp__session-manager-scheduler__project_video_write, mcp__session-manager-scheduler__project_character_write",
564
+ title: "Project Home — Demo Video",
565
+ model: "opus",
566
+ effort: "max",
567
+ },
568
+ },
558
569
  ],
559
570
  "blender-artist": [
560
571
  {
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+ // Boot wiring for the dead-stdio guard, extracted from index.cjs so it is behavior-testable.
3
+ // After the launching terminal closes, writes to the inherited stdout/stderr fail EIO/EPIPE and
4
+ // would surface as one uncaughtException per console line. The notice goes to the file logger
5
+ // (required lazily: logs.cjs pulls in electron's app), never to the dead stream.
6
+ const { guardStdio, createUncaughtReportFilter } = require('./stdioGuard.cjs');
7
+
8
+ function installBootStdioGuard({ streams, requireLogs = () => require('../../logs.cjs') } = {}) {
9
+ try {
10
+ guardStdio({
11
+ streams,
12
+ log: ({ stream, code }) => {
13
+ try {
14
+ requireLogs().writeLine({ scope: 'main', level: 'warn', message: 'stdio stream dead; output to it is dropped', meta: { stream, code } });
15
+ } catch { /* best-effort */ }
16
+ },
17
+ });
18
+ } catch { /* the guard must never stop boot */ }
19
+ }
20
+
21
+ function createUncaughtExceptionHandler({ reportError, writeLine }) {
22
+ const shouldReport = createUncaughtReportFilter();
23
+ return (err) => {
24
+ if (!shouldReport(err)) return;
25
+ try {
26
+ reportError({ name: 'uncaughtException', msg: err?.message, stack: err?.stack });
27
+ } catch { /* telemetry must never break the existing handling below */ }
28
+ writeLine({ scope: 'main', level: 'error', message: 'uncaughtException', meta: { error: err?.message, stack: err?.stack } });
29
+ };
30
+ }
31
+
32
+ module.exports = { installBootStdioGuard, createUncaughtExceptionHandler };
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * stdioGuard.cjs — keep console writes to a dead stdout/stderr from becoming
5
+ * uncaughtExceptions.
6
+ *
7
+ * Incident: bin/cli.cjs spawns Electron with stdio ['inherit','inherit','pipe'],
8
+ * so a terminal launch hands the main process the terminal's tty as stdout.
9
+ * Once that terminal closes every write fails with EIO (tty) or EPIPE (pipe),
10
+ * and every console.log after the first became an uncaughtException
11
+ * "write EIO" — 6,603 telemetry reports from one Mac in 5 days (only ~3/min
12
+ * got through, thanks to telemetryClient's errorDedupAllows).
13
+ *
14
+ * Why Node's console does not save us: getStdout()/getStderr() set
15
+ * stream._destroy = dummyDestroy, which calls cb(err) then this._undestroy().
16
+ * On the FIRST failed write, console's write callback sees
17
+ * _writableState.errorEmitted === false and adds once('error', noop), so it is
18
+ * swallowed; emitErrorNT then sets errorEmitted = true. On the NEXT failed
19
+ * write the callback sees errorEmitted === true and adds no listener;
20
+ * dummyDestroy -> _undestroy resets errorEmitted to false and emitErrorNT
21
+ * emits 'error' with zero listeners -> uncaughtException. Reproduced on Node
22
+ * 22.22.1 and Electron 42.11.10 (Node 24.19.0): 10 console.log after the
23
+ * reader closed -> 9 uncaughtException; with any permanent 'error' listener
24
+ * on process.stdout -> 0.
25
+ *
26
+ * The fix: one permanent 'error' listener per stream. On a dead-stream code
27
+ * the stream's write becomes a no-op so nothing further is attempted. The
28
+ * log callback is injected (the file logger in production) — never console,
29
+ * which would recurse into the dead stream.
30
+ */
31
+
32
+ const DEAD_CODES = new Set(['EIO', 'EPIPE', 'ECONNRESET', 'ENXIO', 'EBADF']);
33
+
34
+ /** @type {WeakMap<object, { dead: boolean, loggedCodes: Set<string> }>} */
35
+ const state = new WeakMap();
36
+
37
+ function defaultStreams() {
38
+ return [{ name: 'stdout', stream: process.stdout }, { name: 'stderr', stream: process.stderr }];
39
+ }
40
+
41
+ function normalize(entry, i) {
42
+ if (!entry || typeof entry !== 'object') return null;
43
+ if (typeof entry.on === 'function') {
44
+ let name = `stream${i}`;
45
+ try {
46
+ if (entry === process.stdout) name = 'stdout';
47
+ else if (entry === process.stderr) name = 'stderr';
48
+ } catch { /* ignore */ }
49
+ return { name, stream: entry };
50
+ }
51
+ const s = entry.stream;
52
+ if (!s || typeof s !== 'object' || typeof s.on !== 'function') return null;
53
+ return { name: typeof entry.name === 'string' ? entry.name : `stream${i}`, stream: s };
54
+ }
55
+
56
+ function noopWrite(chunk, encoding, cb) {
57
+ const fn = typeof encoding === 'function' ? encoding : cb;
58
+ if (typeof fn === 'function') process.nextTick(fn);
59
+ return true;
60
+ }
61
+
62
+ function safeLog(log, info) {
63
+ if (typeof log !== 'function') return;
64
+ try { log(info); } catch { /* logging must never throw */ }
65
+ }
66
+
67
+ /**
68
+ * @param {{ streams?: Array<any>, log?: (info: { stream: string, code: string }) => void }} [opts]
69
+ * @returns {void}
70
+ */
71
+ function guardStdio({ streams, log } = {}) {
72
+ try {
73
+ const list = Array.isArray(streams) ? streams : defaultStreams();
74
+ list.forEach((entry, i) => {
75
+ try {
76
+ const n = normalize(entry, i);
77
+ if (!n || state.has(n.stream)) return;
78
+ const st = { dead: false, loggedCodes: new Set() };
79
+ state.set(n.stream, st);
80
+ n.stream.on('error', (err) => {
81
+ const code = String((err && err.code) || 'UNKNOWN');
82
+ if (DEAD_CODES.has(code)) {
83
+ if (st.dead) return;
84
+ st.dead = true;
85
+ try { n.stream.write = noopWrite; } catch { /* ignore */ }
86
+ safeLog(log, { stream: n.name, code });
87
+ return;
88
+ }
89
+ if (st.loggedCodes.has(code)) return;
90
+ st.loggedCodes.add(code);
91
+ safeLog(log, { stream: n.name, code });
92
+ });
93
+ } catch { /* never throw */ }
94
+ });
95
+ } catch { /* never throw */ }
96
+ }
97
+
98
+ /** @param {any} err */
99
+ function isDeadStdioWriteError(err) {
100
+ if (!err || typeof err !== 'object') return false;
101
+ return err.syscall === 'write' && DEAD_CODES.has(err.code);
102
+ }
103
+
104
+ /** @returns {(err: any) => boolean} true = report this uncaught error */
105
+ function createUncaughtReportFilter() {
106
+ let seenDead = false;
107
+ return (err) => {
108
+ if (!isDeadStdioWriteError(err)) return true;
109
+ if (seenDead) return false;
110
+ seenDead = true;
111
+ return true;
112
+ };
113
+ }
114
+
115
+ module.exports = { guardStdio, isDeadStdioWriteError, createUncaughtReportFilter };
@@ -400,6 +400,8 @@ export interface Macro {
400
400
  inputs?: MacroInput[];
401
401
  /** Projects ('*' or absolute cwds) this macro's session may start work in without approval. */
402
402
  autoStartTargets?: string[];
403
+ /** True lets a script start this macro via POST /admin/macros/run. */
404
+ scriptStart?: boolean;
403
405
  /** Set only on built-ins whose press builds in the background. */
404
406
  job?: MacroJob;
405
407
  }
@@ -429,6 +431,8 @@ export interface MacroSaveInput {
429
431
  inputs?: MacroInput[];
430
432
  /** Same omit/clear semantics as `inputs`. */
431
433
  autoStartTargets?: string[];
434
+ /** True lets a script start this macro via POST /admin/macros/run. */
435
+ scriptStart?: boolean;
432
436
  }
433
437
 
434
438
  /** One `agentCli.detect` row — a non-Claude agent CLI and whether it is installed. */
@@ -2168,6 +2172,15 @@ export interface ChatExternalSendResult {
2168
2172
  reason?: ChatExternalSendRefusalReason;
2169
2173
  }
2170
2174
 
2175
+ /** What the renderer did with a `chat:external-new-session` that carried a requestId (POST /admin/macros/run), reported back to main. */
2176
+ export interface ChatExternalNewSessionResult {
2177
+ requestId: string;
2178
+ ok: boolean;
2179
+ /** The minted Epic's id when `ok`. */
2180
+ epicId?: string;
2181
+ error?: string;
2182
+ }
2183
+
2171
2184
  export type CreateProjectFolderResult =
2172
2185
  | { ok: true; path: string }
2173
2186
  | { ok: false; code: 'invalid-name' | 'invalid-parent' | 'exists' | 'io'; error: string; path?: string };
@@ -2838,9 +2851,22 @@ export interface SessionManagerAPI {
2838
2851
  onExternalSend: (handler: (e: ChatExternalSendEvent) => void) => () => void;
2839
2852
  /** Reports what the renderer did with an external send (echoing its requestId) back to main. */
2840
2853
  reportExternalSendResult: (result: ChatExternalSendResult) => Promise<void>;
2854
+ /** Reports the minted epicId (or an error) for an external new-session that carried a requestId back to main. */
2855
+ reportExternalNewSessionResult: (result: ChatExternalNewSessionResult) => Promise<void>;
2841
2856
  /** Fires when a paired phone asks main to start a new Session (payload pre-validated in main). */
2842
2857
  onExternalNewSession: (
2843
- handler: (e: { cwd: string; agentName: string; tag: AgentPersonaTag; title: string; prompt: string; macroId?: string }) => void,
2858
+ handler: (e: {
2859
+ cwd: string;
2860
+ agentName: string;
2861
+ tag: AgentPersonaTag;
2862
+ title: string;
2863
+ prompt: string;
2864
+ macroId?: string;
2865
+ /** Set when main awaits the result; echo it back via `reportExternalNewSessionResult`. */
2866
+ requestId?: string;
2867
+ via?: 'script';
2868
+ effort?: string;
2869
+ }) => void,
2844
2870
  ) => () => void;
2845
2871
  /** Classify a queued PromptTicket's text as 'inline' (run through
2846
2872
  * chatRunner) or 'develop' (dispatch to /develop for PRD decomposition).
@@ -1784,6 +1784,13 @@
1784
1784
  "kind": "invoke",
1785
1785
  "remote": "mutate"
1786
1786
  },
1787
+ {
1788
+ "ns": "chat",
1789
+ "method": "reportExternalNewSessionResult",
1790
+ "channel": "chat:external-new-session-result",
1791
+ "kind": "invoke",
1792
+ "remote": "mutate"
1793
+ },
1787
1794
  {
1788
1795
  "ns": "chat",
1789
1796
  "method": "onExternalNewSession",
@@ -570,6 +570,8 @@ contextBridge.exposeInMainWorld('api', {
570
570
  },
571
571
  /** Reports the renderer's disposition for an external send back to main. */
572
572
  reportExternalSendResult: (result) => ipcRenderer.invoke('chat:external-send-result', result),
573
+ /** Reports the minted epicId (or an error) for a requestId-carrying external new-session back to main. */
574
+ reportExternalNewSessionResult: (result) => ipcRenderer.invoke('chat:external-new-session-result', result),
573
575
  /** Fires when a paired phone asks main to start a new Session. */
574
576
  onExternalNewSession: (handler) => {
575
577
  const listener = (_e, payload) => handler(payload);
@@ -5,7 +5,7 @@ tools: Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__proj
5
5
  title: 'Project Home — Demo Video'
6
6
  model: opus
7
7
  effort: max
8
- seedVersion: 13
8
+ seedVersion: 14
9
9
  ---
10
10
 
11
11
  You are the demo-video-builder. You make a short animated demo, 30 seconds or 1 minute long per `<length_and_pacing>`, that shows someone what this
@@ -168,15 +168,18 @@ Produce exactly one complete HTML document:
168
168
  - A 16:9 stage, 1280x720 logical pixels, scaled to fit the viewport with letterboxing.
169
169
  - A single clock drives every scene via `requestAnimationFrame` — no per-scene timers of their
170
170
  own, so seeking is exact.
171
- - Expose `window.smDemo = { duration: D, seek(t), play(), pause() }`, where `seek(t)` renders
172
- the exact frame for time `t` in seconds, independent of whatever played before it.
173
- - Autoplays once on load; shows play/pause, restart, and a progress bar.
171
+ - Expose `window.smDemo = { duration: D, seek(t), play(), pause(), scenes }`, where `seek(t)`
172
+ renders the exact frame for time `t` in seconds, independent of whatever played before it, and
173
+ `scenes` is an array of scene start times in seconds, used for the host's scene markers.
174
+ - Autoplays once on load and draws no playback UI at all: no buttons, no progress/scrub bar, no
175
+ time readout, no prev/next, no sound button, and no `controls` attribute on `<audio>`/`<video>`.
176
+ Project Home's player supplies every control through `window.smDemo`.
174
177
  - Narration audio built per `<audio_policy>`; the video must still make sense muted.
175
178
  - No network: no `fetch`, `XMLHttpRequest`, `WebSocket`, `EventSource`, `sendBeacon`, `import()`,
176
179
  `Worker`, `<iframe>`, `<form>`, or outbound `src`/`href`, and no navigating with `window.open` or
177
180
  `location`. No external fonts or images — system font stack only, and any images as `data:` URIs.
178
- - Respects `prefers-reduced-motion` by rendering the scenes as a static, steppable storyboard
179
- instead of animating them.
181
+ - Respects `prefers-reduced-motion` by rendering the scenes as a static storyboard instead of
182
+ animating them, stepped by the host's `seek(t)` — no in-video prev/next buttons.
180
183
  - Under 2 MB total.
181
184
  </output_contract>
182
185
 
@@ -242,7 +245,7 @@ open('demo.html', 'w').write(html)
242
245
  Keep the whole document under the 2 MB cap.
243
246
  - Wire `play()`/`pause()`/`seek(t)` to the `<audio>` element too (`audio.currentTime = t` on
244
247
  seek) so narration never drifts from the visual clock; call `.play()` on load and, on rejection
245
- (autoplay-blocked), show a small "tap for sound" button instead of failing silently.
248
+ (autoplay-blocked), keep playing muted — the host player's sound button unmutes it.
246
249
  - Never write the literal pattern `function (` or `function(` in the inline `<script>` —
247
250
  `project_video_write`'s safety scanner blocks anything matching `/\bFunction\s*\(/i`.
248
251
  Use arrow functions (`() => { ... }`) throughout.