claude-code-session-manager 0.136.2 → 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 (60) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/assets/{AgentLibrary-CbvVbzm2.js → AgentLibrary-C1d_D7uQ.js} +1 -1
  3. package/dist/assets/{AppSettings-Blks3xh_.js → AppSettings-CgDhqrsU.js} +1 -1
  4. package/dist/assets/{Button-hPwe-y_4.js → Button-Bk23rEnZ.js} +1 -1
  5. package/dist/assets/{DocumentEditorPane-C_fgkNoa.js → DocumentEditorPane-BqY5Nq6W.js} +1 -1
  6. package/dist/assets/{Extensions-CcDjNq7W.js → Extensions-CXem-uwI.js} +2 -2
  7. package/dist/assets/{History-D4s5ykcm.js → History-BwO3coo4.js} +1 -1
  8. package/dist/assets/{Library-BtJ7gnDM.js → Library-BDV69fSe.js} +1 -1
  9. package/dist/assets/{ListDetail-Bbwwd-HR.js → ListDetail-CD-Fm6mh.js} +1 -1
  10. package/dist/assets/{Panel-8xYPYH7R.js → Panel-CeDiyuNn.js} +1 -1
  11. package/dist/assets/ProjectClaudeConfig-NjdKdwe8.js +25 -0
  12. package/dist/assets/{ProvenanceBadge-COnyY49b.js → ProvenanceBadge-Bu8NmI_R.js} +1 -1
  13. package/dist/assets/{Scheduler-CpmSitKx.js → Scheduler-CkhTvG7C.js} +1 -1
  14. package/dist/assets/{Settings-Blfjp8Bp.js → Settings-COT34hBF.js} +1 -1
  15. package/dist/assets/{SkillReferenceGraph-pYSyx841.js → SkillReferenceGraph-CFMK8NJh.js} +1 -1
  16. package/dist/assets/{Skills-C4fV80-T.js → Skills-BgexoUkQ.js} +1 -1
  17. package/dist/assets/{SourceChip-Bx9marLv.js → SourceChip-BXjcdeb1.js} +1 -1
  18. package/dist/assets/{SystemPrompt-CBvedERn.js → SystemPrompt-CeeH3EeW.js} +1 -1
  19. package/dist/assets/{TiptapBody-BV7WhKYF.js → TiptapBody-D1kTj-tn.js} +1 -1
  20. package/dist/assets/{Toggle-BUPbeHTj.js → Toggle-CENi19iK.js} +1 -1
  21. package/dist/assets/{ViewTabs-oXSVRUrm.js → ViewTabs-DDBb0x96.js} +1 -1
  22. package/dist/assets/{VoiceButton-Ca6X_WNA.js → VoiceButton-CZeyPM31.js} +1 -1
  23. package/dist/assets/{historyTotals-BcJ7QH96.js → historyTotals-B00l64Jw.js} +1 -1
  24. package/dist/assets/index-CgCxpunJ.js +3116 -0
  25. package/dist/index.html +1 -1
  26. package/dist-web/app.js +384 -384
  27. package/package.json +1 -1
  28. package/plugins/CLAUDE.md +1 -0
  29. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  30. package/plugins/session-manager-dev/skills/builder/SKILL.md +1 -0
  31. package/plugins/session-manager-dev/skills/send-feedback/SKILL.md +2 -0
  32. package/scripts/scheduler-mcp-server.cjs +46 -2
  33. package/src/main/build-info.json +4 -4
  34. package/src/main/chatRunner.cjs +51 -0
  35. package/src/main/index.cjs +13 -7
  36. package/src/main/ipcSchemas.cjs +11 -0
  37. package/src/main/lib/CLAUDE.md +2 -0
  38. package/src/main/lib/demo-video-kit/checks.cjs +16 -0
  39. package/src/main/lib/epic/epicAttachments.cjs +143 -0
  40. package/src/main/lib/epic/epicMint.cjs +4 -0
  41. package/src/main/lib/feedback-remote/crossProjectReply.cjs +58 -12
  42. package/src/main/lib/feedback-remote/localAdminHttp.cjs +14 -1
  43. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +169 -1
  44. package/src/main/lib/feedback-remote/remoteFrameAssembler.cjs +113 -0
  45. package/src/main/lib/memoryRefResolve.cjs +64 -2
  46. package/src/main/lib/memoryStale.cjs +111 -18
  47. package/src/main/lib/persona-macro/macroLibrary.cjs +7 -0
  48. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  49. package/src/main/lib/process/bootStdioGuard.cjs +32 -0
  50. package/src/main/lib/process/stdioGuard.cjs +115 -0
  51. package/src/main/memoryAssist.cjs +23 -7
  52. package/src/main/memoryTool.cjs +58 -5
  53. package/src/main/promptSessionsIpc.cjs +1 -1
  54. package/src/main/templates/PRD_AUTHORING.md +3 -1
  55. package/src/preload/api.d.ts +29 -1
  56. package/src/preload/apiSurface.json +7 -0
  57. package/src/preload/index.cjs +2 -0
  58. package/src/seed/agents/demo-video-builder.md +10 -7
  59. package/dist/assets/ProjectClaudeConfig-B9PlbaSV.js +0 -25
  60. package/dist/assets/index-h8BmSc_8.js +0 -3116
@@ -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 };
@@ -13,8 +13,8 @@ const path = require('node:path');
13
13
  const { extractJson } = require('./lib/util/extractJson.cjs');
14
14
  const { runClaudeP: realRunClaudeP } = require('./lib/claude/runClaudeP.cjs');
15
15
  const realSessionSlots = require('./lib/scheduler/sessionSlots.cjs');
16
- const { scoreMemories } = require('./lib/memoryStale.cjs');
17
- const { makeRefResolver, listTrackedFiles } = require('./lib/memoryRefResolve.cjs');
16
+ const { scoreMemories, makeLinkResolver } = require('./lib/memoryStale.cjs');
17
+ const { makeRefResolver, listTrackedFiles, listRenames } = require('./lib/memoryRefResolve.cjs');
18
18
  const { collectMdNetwork } = require('./lib/memoryMdNetwork.cjs');
19
19
 
20
20
  const MODEL = 'sonnet';
@@ -51,10 +51,16 @@ function selectAskFiles(files, contextName) {
51
51
  const ctxName = withMd(contextName);
52
52
  const ctx = pool.find((f) => f.name === ctxName);
53
53
  if (ctx) {
54
+ // Follow [[links]] by filename stem or frontmatter name, as scoreMemories does.
55
+ const resolveLink = makeLinkResolver(pool);
54
56
  const linked = new Set([ctxName]);
55
57
  let m;
56
58
  WIKILINK_RE.lastIndex = 0;
57
- while ((m = WIKILINK_RE.exec(ctx.body)) !== null) linked.add(withMd(m[1].trim()));
59
+ while ((m = WIKILINK_RE.exec(ctx.body)) !== null) {
60
+ const target = m[1].trim();
61
+ const stem = resolveLink(target);
62
+ linked.add(withMd(stem === null ? target : stem));
63
+ }
58
64
  pool = pool.filter((f) => linked.has(f.name));
59
65
  }
60
66
  }
@@ -143,7 +149,12 @@ const ACTIONS = new Set(['update', 'delete', 'fold', 'keep']);
143
149
  const FOLD_MAX_LINES = 3;
144
150
  const FOLD_MAX_CHARS = 600;
145
151
 
146
- async function proposeFix({ name, dir, cwd } = {}, deps = {}) {
152
+ /**
153
+ * extraBases / projectRoots / renames are the resolution inputs memoryTool
154
+ * derives for the project (ops root, registered roots, git rename map); a
155
+ * missing `renames` is read from git here, once.
156
+ */
157
+ async function proposeFix({ name, dir, cwd, extraBases = [], projectRoots = [], renames } = {}, deps = {}) {
147
158
  const fail = (error) => ({ ok: false, action: 'keep', summary: '', reason: '', content: '', fold: null, error });
148
159
  if (typeof name !== 'string' || !name || name !== path.basename(name) || !name.endsWith('.md')) return fail('invalid memory name');
149
160
  const files = await (deps.readDir || defaultReadDir)(dir);
@@ -152,12 +163,17 @@ async function proposeFix({ name, dir, cwd } = {}, deps = {}) {
152
163
 
153
164
  const tracked = Array.isArray(deps.trackedFiles) ? deps.trackedFiles : await listTrackedFiles(cwd);
154
165
  const readFile = deps.readFile || ((p) => fs.readFileSync(p, 'utf8'));
155
- const resolver = makeRefResolver({ cwd, trackedFiles: tracked, ...(deps.exists ? { exists: deps.exists } : {}) });
156
- const [scored] = scoreMemories({ entries: [entry], now: Date.now(), existsPath: resolver });
166
+ const resolver = makeRefResolver({ cwd, trackedFiles: tracked, extraBases, ...(deps.exists ? { exists: deps.exists } : {}) });
167
+ const renameMap = renames instanceof Map ? renames : await (deps.listRenames || listRenames)(cwd);
168
+ const renamedTo = (rel) => renameMap.get(rel) || null;
169
+ // Moved refs land in scored.movedRefs, never deadRefs, so they are not reported as unresolved.
170
+ const [scored] = scoreMemories({ entries: [entry], now: Date.now(), existsPath: resolver, projectRoots, renamedTo });
157
171
  const unresolved = {};
158
172
  for (const dead of scored.deadRefs) {
159
173
  const base = path.posix.basename(dead);
160
- unresolved[dead] = tracked.filter((p) => path.posix.basename(p) === base).slice(0, MAX_SUGGESTIONS);
174
+ const target = renamedTo(dead);
175
+ const byBase = tracked.filter((p) => path.posix.basename(p) === base && p !== target);
176
+ unresolved[dead] = (target ? [target, ...byBase] : byBase).slice(0, MAX_SUGGESTIONS);
161
177
  }
162
178
  const network = collectMdNetwork({ cwd, memoryBody: entry.body, trackedFiles: tracked, readFile });
163
179
 
@@ -32,7 +32,7 @@ const config = require('./config.cjs');
32
32
 
33
33
  const { MEMORY_SLUG_RE: SLUG_RE } = require('./lib/memorySlug.cjs');
34
34
  const { scoreMemories } = require('./lib/memoryStale.cjs');
35
- const { makeRefResolver, listTrackedFiles } = require('./lib/memoryRefResolve.cjs');
35
+ const { makeRefResolver, listTrackedFiles, listRenames } = require('./lib/memoryRefResolve.cjs');
36
36
  const { addIndexLine, removeIndexLines, indexHealth } = require('./lib/memoryIndex.cjs');
37
37
  const {
38
38
  resolveWorkspaceMemoryDir,
@@ -297,7 +297,50 @@ async function create({ workspace, name, description, cwd, agent }) {
297
297
  * the dead-ref existence check. Absent/invalid cwd disables dead-ref
298
298
  * detection entirely rather than mass-flagging memories.
299
299
  */
300
- async function stale({ workspace, cwd, agent }) {
300
+ /**
301
+ * Registered project roots as scoreMemories projectRoots ({name: basename, root}).
302
+ * Source is promptSessionsIpc.defaultProjectRoots (persisted tabs + every
303
+ * project Claude has seen) — the one registry; each normalized to its project
304
+ * root, home-validated, deduped.
305
+ */
306
+ function registeredProjectRoots(source) {
307
+ const { projectRootOf } = require('./lib/activeSessions.cjs');
308
+ const seen = new Set();
309
+ const out = [];
310
+ let raw = [];
311
+ try { raw = source() || []; } catch { raw = []; }
312
+ for (const r of raw) {
313
+ if (typeof r !== 'string' || !r || !path.isAbsolute(r)) continue;
314
+ let root;
315
+ try { root = config.validatePath(projectRootOf(r) || r); } catch { continue; }
316
+ if (seen.has(root)) continue;
317
+ seen.add(root);
318
+ const name = path.basename(root);
319
+ if (name) out.push({ name, root });
320
+ }
321
+ return out;
322
+ }
323
+
324
+ /**
325
+ * The resolution inputs every memory ref check shares for one validated
326
+ * project dir: the project's ops root (via opsOwnership, skipped when it
327
+ * cannot be derived or fails the home boundary), the registered project
328
+ * roots, and the git rename map. `deps.projectRoots` overrides the registry
329
+ * source (tests).
330
+ */
331
+ async function resolutionInputs(baseDir, deps = {}) {
332
+ const extraBases = [];
333
+ try {
334
+ const opsRoot = config.validatePath(require('./lib/opsOwnership.cjs').resolveOpsRoot(baseDir));
335
+ extraBases.push(opsRoot);
336
+ } catch { /* no ops root for this cwd: skip */ }
337
+ const source = deps.projectRoots || require('./promptSessionsIpc.cjs').defaultProjectRoots;
338
+ const projectRoots = registeredProjectRoots(source);
339
+ const renames = await listRenames(baseDir);
340
+ return { extraBases, projectRoots, renames };
341
+ }
342
+
343
+ async function stale({ workspace, cwd, agent }, deps = {}) {
301
344
  const ws = validWorkspaceName(workspace) ? workspace : 'default';
302
345
  let dir;
303
346
  try { dir = (await resolveDir({ workspace: ws, cwd, agent })).dir; }
@@ -320,8 +363,17 @@ async function stale({ workspace, cwd, agent }) {
320
363
  }
321
364
  }
322
365
  let existsPath = () => true;
366
+ let projectRoots = [];
367
+ let renamedTo = () => null;
323
368
  if (baseDir) {
324
- const resolveRef = makeRefResolver({ cwd: baseDir, trackedFiles: await listTrackedFiles(baseDir) });
369
+ const inputs = await resolutionInputs(baseDir, deps);
370
+ projectRoots = inputs.projectRoots;
371
+ renamedTo = (rel) => inputs.renames.get(rel) || null;
372
+ const resolveRef = makeRefResolver({
373
+ cwd: baseDir,
374
+ trackedFiles: await listTrackedFiles(baseDir),
375
+ extraBases: inputs.extraBases,
376
+ });
325
377
  existsPath = (relPath, roots = []) => {
326
378
  const full = path.resolve(baseDir, relPath);
327
379
  if (full !== baseDir && !full.startsWith(baseDir + path.sep)) return false;
@@ -347,7 +399,7 @@ async function stale({ workspace, cwd, agent }) {
347
399
  }
348
400
 
349
401
  const index = indexHealth({ indexText: await readIndexText(dir), files: r.entries.map((e) => e.name).filter((n) => n.endsWith('.md')) });
350
- return { entries: scoreMemories({ entries, now: Date.now(), existsPath }), workspace: ws, error: null, index };
402
+ return { entries: scoreMemories({ entries, now: Date.now(), existsPath, projectRoots, renamedTo }), workspace: ws, error: null, index };
351
403
  }
352
404
 
353
405
  /** Agents (user + project) with their `memory:` frontmatter scope. */
@@ -397,7 +449,8 @@ async function proposeFix({ name, ...t }) {
397
449
  cwd = config.validatePath(t.cwd);
398
450
  dir = (await resolveDir(t)).dir;
399
451
  } catch (e) { return fail(e.message); }
400
- return require('./memoryAssist.cjs').proposeFix({ name, dir, cwd });
452
+ const { extraBases, projectRoots, renames } = await resolutionInputs(cwd);
453
+ return require('./memoryAssist.cjs').proposeFix({ name, dir, cwd, extraBases, projectRoots, renames });
401
454
  }
402
455
 
403
456
  function registerMemoryHandlers() {
@@ -166,4 +166,4 @@ function registerPromptSessionsReadHandlers() {
166
166
  ipcMain.handle('promptSessions:read-session-transcript', v(s.promptSessionsReadSessionTranscript, ({ cwd, sessionId }) => readSessionTranscript(cwd, sessionId)));
167
167
  }
168
168
 
169
- module.exports = { makeRegisteredRootsCache, __resetRegisteredRootsCacheForTests, loadActiveIndex, listArchived, readArchived, readSessionTranscript, writeArchive, registerPromptSessionsReadHandlers };
169
+ module.exports = { defaultProjectRoots, makeRegisteredRootsCache, __resetRegisteredRootsCacheForTests, loadActiveIndex, listArchived, readArchived, readSessionTranscript, writeArchive, registerPromptSessionsReadHandlers };
@@ -1,4 +1,4 @@
1
- <!-- PRD_AUTHORING.md v20 -->
1
+ <!-- PRD_AUTHORING.md v21 -->
2
2
  # PRD Authoring Guide — Scheduler Safety Rules
3
3
 
4
4
  Rule: every PRD you queue follows the rules below.
@@ -234,4 +234,6 @@ Before queueing a new PRD, verify each of these:
234
234
  - [ ] **§11 End green:** the gate runs last; any intentional failure runs early and is captured.
235
235
  - [ ] **Gate baseline:** every gate command ran green once at HEAD in the main checkout; a red suite is scoped to the PRD's own test files and the PRD notes say why. Why: a gate already red on base parks as `sentinel_fail`.
236
236
  - [ ] **No human-only gates:** no gate or criterion needs a human or the passage of time (cron install, live post wait, live payment, dashboard action); keep them out of the PRD at authoring time; an executor that meets one ends `SCHEDULER_VERDICT: FAIL` naming what is missing. Why: no executor can pass them.
237
+ - [ ] **No interactive AC:** no criterion asks to launch the app, click through, capture a screenshot, run under xvfb or open a browser. Why: a headless run stalls on a rendered frame and is SIGTERM'd uncommitted; recommend manual visual confirmation in the report instead.
238
+ - [ ] **Contract consumers gated:** a PRD that changes a return shape, IPC payload or remote contract greps `tests/` (and `src/**/__tests__`) for every spec using it and puts each in its gate and files. Why: scoped gates let other specs go red unseen until the release gate.
237
239
  - [ ] **Gate purity:** a gate command must not create or modify tracked files; outputs go to the per-gate TMPDIR or a gitignored path. Why: a dirtied tree fails the clean-tree check.
@@ -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. */
@@ -1535,6 +1539,8 @@ export interface MemoryStaleEntry {
1535
1539
  ageDays: number;
1536
1540
  inboundLinks: number;
1537
1541
  deadRefs: string[];
1542
+ /** Refs whose path was git-renamed to an existing target — not dead. */
1543
+ movedRefs: { from: string; to: string }[];
1538
1544
  stale: boolean;
1539
1545
  reasons: string[];
1540
1546
  description: string | null;
@@ -2166,6 +2172,15 @@ export interface ChatExternalSendResult {
2166
2172
  reason?: ChatExternalSendRefusalReason;
2167
2173
  }
2168
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
+
2169
2184
  export type CreateProjectFolderResult =
2170
2185
  | { ok: true; path: string }
2171
2186
  | { ok: false; code: 'invalid-name' | 'invalid-parent' | 'exists' | 'io'; error: string; path?: string };
@@ -2836,9 +2851,22 @@ export interface SessionManagerAPI {
2836
2851
  onExternalSend: (handler: (e: ChatExternalSendEvent) => void) => () => void;
2837
2852
  /** Reports what the renderer did with an external send (echoing its requestId) back to main. */
2838
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>;
2839
2856
  /** Fires when a paired phone asks main to start a new Session (payload pre-validated in main). */
2840
2857
  onExternalNewSession: (
2841
- 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,
2842
2870
  ) => () => void;
2843
2871
  /** Classify a queued PromptTicket's text as 'inline' (run through
2844
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.