claude-code-session-manager 0.142.0 → 0.144.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 (162) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +22 -107
  3. package/dist/assets/AppSettings-Z68gQiVE.js +2 -0
  4. package/dist/assets/{History-DpZuJXi1.js → History-C3E6y_7t.js} +2 -2
  5. package/dist/assets/HomeClaudeConfig-Yd1vXzBn.js +5 -0
  6. package/dist/assets/{Panel-BjdJjhqt.js → Panel-CnfWs46Z.js} +1 -1
  7. package/dist/assets/ProjectClaudeConfig-CP0Wsg-H.js +26 -0
  8. package/dist/assets/Scheduler-D8un7N3B.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-Cqyu4mef.js → SkillReferenceGraph-DRtZV1Al.js} +1 -1
  10. package/dist/assets/{Skills-vv0noNVI.js → Skills-Bg5O2Hyn.js} +23 -23
  11. package/dist/assets/{TiptapBody-CXi8Pvut.js → TiptapBody-BdzoBmqu.js} +27 -27
  12. package/dist/assets/{Toggle-CiYCWLjh.js → Toggle-Dt5K1OXt.js} +1 -1
  13. package/dist/assets/{VoiceButton-4NKKd1sC.js → VoiceButton-CTLyRgdF.js} +1 -1
  14. package/dist/assets/{historyTotals-DDunb8Ch.js → historyTotals-B2_KWBga.js} +1 -1
  15. package/dist/assets/{index-Cn5E9958.js → index-446b69rr.js} +715 -714
  16. package/dist/assets/{index-DVHIHoJf.css → index-BJ5TJvmz.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +438 -435
  20. package/package.json +6 -4
  21. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  22. package/plugins/session-manager-dev/skills/builder/SKILL.md +5 -0
  23. package/plugins/session-manager-dev/skills/develop/SKILL.md +23 -16
  24. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +16 -2
  25. package/plugins/session-manager-dev/skills/maintaining-md-network/weekly-consolidation.md +87 -0
  26. package/scripts/README.md +1 -0
  27. package/scripts/scheduler-mcp-server.cjs +381 -6
  28. package/src/main/adminRouteRegistry.cjs +16 -0
  29. package/src/main/agentLibrary.cjs +60 -11
  30. package/src/main/agentsIpc.cjs +19 -0
  31. package/src/main/build-info.json +4 -4
  32. package/src/main/chatRunner.cjs +214 -7
  33. package/src/main/config.cjs +5 -1
  34. package/src/main/health.cjs +92 -14
  35. package/src/main/index.cjs +16 -4
  36. package/src/main/ipcSchemas.cjs +61 -1
  37. package/src/main/lib/claude/agentArmory.cjs +128 -0
  38. package/src/main/lib/claude/agentModelResolve.cjs +3 -2
  39. package/src/main/lib/claude/agentSnapshot.cjs +24 -3
  40. package/src/main/lib/claude/builtinTools.cjs +110 -0
  41. package/src/main/lib/claude/environmentProfiles.cjs +1 -1
  42. package/src/main/lib/claude/headlessMcpServers.cjs +138 -0
  43. package/src/main/lib/claude/jobSandboxPolicy.cjs +8 -2
  44. package/src/main/lib/claude/personaToolScope.cjs +77 -6
  45. package/src/main/lib/demo-video-kit/cast.md +10 -1
  46. package/src/main/lib/demo-video-kit/character.cjs +77 -21
  47. package/src/main/lib/demo-video-kit/kind-tiktok.md +5 -1
  48. package/src/main/lib/demo-video-kit/projectSounds.cjs +191 -0
  49. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  50. package/src/main/lib/demo-video-kit/sound.cjs +166 -9
  51. package/src/main/lib/demo-video-kit/standalone.cjs +231 -0
  52. package/src/main/lib/epic/activeIndexMerge.cjs +5 -0
  53. package/src/main/lib/epic/artifactRetention.cjs +55 -9
  54. package/src/main/lib/epic/artifactStore.cjs +78 -35
  55. package/src/main/lib/epic/delegationReadiness.cjs +10 -3
  56. package/src/main/lib/epic/epicDepsSync.cjs +66 -0
  57. package/src/main/lib/epic/epicEventLog.cjs +45 -1
  58. package/src/main/lib/epic/epicOutsideRead.cjs +38 -1
  59. package/src/main/lib/epic/epicSettle.cjs +48 -4
  60. package/src/main/lib/epic/epicSpawnPlan.cjs +3 -1
  61. package/src/main/lib/epic/epicStateEmitter.cjs +248 -0
  62. package/src/main/lib/epic/epicValidationHook.cjs +22 -3
  63. package/src/main/lib/epic/planReviewInput.cjs +123 -0
  64. package/src/main/lib/epic/restorableSessions.cjs +1 -0
  65. package/src/main/lib/epic/scriptStartedBy.cjs +71 -0
  66. package/src/main/lib/externalContract.cjs +24 -1
  67. package/src/main/lib/feedback-remote/autoStartedSession.cjs +1 -1
  68. package/src/main/lib/feedback-remote/createdProjects.cjs +291 -0
  69. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +24 -2
  70. package/src/main/lib/feedback-remote/crossProjectReply.cjs +96 -8
  71. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +54 -3
  72. package/src/main/lib/feedback-remote/pendingReplies.cjs +22 -0
  73. package/src/main/lib/feedback-remote/projectCreate.cjs +415 -0
  74. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +94 -4
  75. package/src/main/lib/feedback-remote/replyClaims.cjs +168 -0
  76. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +29 -1
  77. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +43 -2
  78. package/src/main/lib/feedback-remote/servicePairLocalRoutes.cjs +91 -0
  79. package/src/main/lib/feedback-remote/servicePairings.cjs +47 -7
  80. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +99 -1
  81. package/src/main/lib/git/gitWorktree.cjs +8 -0
  82. package/src/main/lib/git/runtimeStateUntrack.cjs +15 -1
  83. package/src/main/lib/git/worktreeDeps.cjs +119 -10
  84. package/src/main/lib/mcpToolCatalog.cjs +144 -12
  85. package/src/main/lib/mcpToolsProbe.cjs +19 -2
  86. package/src/main/lib/opsOwnership.cjs +113 -28
  87. package/src/main/lib/packs/packCatalog.cjs +98 -5
  88. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +6 -0
  89. package/src/main/lib/persona-macro/builtinMacros.cjs +6 -4
  90. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +9 -0
  91. package/src/main/lib/persona-macro/personaLoadout.cjs +58 -0
  92. package/src/main/lib/persona-macro/personaMerge.cjs +11 -3
  93. package/src/main/lib/persona-macro/personaUpgrade.cjs +96 -0
  94. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +1 -1
  95. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +140 -0
  96. package/src/main/lib/prd/prdCreate.cjs +395 -229
  97. package/src/main/lib/prd/prdCriteria.cjs +7 -4
  98. package/src/main/lib/prd/prdFrontmatter.cjs +5 -2
  99. package/src/main/lib/prd/prdMcpReachWarnings.cjs +44 -0
  100. package/src/main/lib/prd/prdSandboxWarnings.cjs +49 -0
  101. package/src/main/lib/process/peerChatSession.cjs +165 -0
  102. package/src/main/lib/project-pages/videoPressLines.cjs +145 -0
  103. package/src/main/lib/project-pages/videoScriptPress.cjs +266 -0
  104. package/src/main/lib/project-pages/videoScriptRunRoute.cjs +371 -0
  105. package/src/main/lib/project-pages/videoScriptSwitchIpc.cjs +49 -0
  106. package/src/main/lib/project-pages/videoScriptSwitchRoute.cjs +173 -0
  107. package/src/main/lib/promptSessionSchema.cjs +2 -0
  108. package/src/main/lib/scheduler/baselineGate.cjs +31 -2
  109. package/src/main/lib/scheduler/criteriaChecks.cjs +164 -20
  110. package/src/main/lib/scheduler/heldSchedulerTurns.cjs +238 -0
  111. package/src/main/lib/scheduler/jobMemoryStats.cjs +13 -2
  112. package/src/main/lib/scheduler/planRecordHarvest.cjs +215 -55
  113. package/src/main/lib/scheduler/planReleaseRoute.cjs +110 -0
  114. package/src/main/lib/scheduler/planReviewSchema.cjs +182 -0
  115. package/src/main/lib/scheduler/planReviewStats.cjs +63 -0
  116. package/src/main/lib/scheduler/planReviewStore.cjs +128 -0
  117. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +60 -2
  118. package/src/main/lib/scheduler/queueStore.cjs +16 -0
  119. package/src/main/lib/scheduler/rcaReport.cjs +79 -15
  120. package/src/main/lib/scheduler/sandboxEnvironmentLimit.cjs +141 -0
  121. package/src/main/lib/scheduler/scheduleJobSchema.cjs +15 -0
  122. package/src/main/lib/scheduler/schedulerPaths.cjs +9 -0
  123. package/src/main/lib/scheduler/slotsRoute.cjs +101 -87
  124. package/src/main/lib/scheduler/upgradeDrain.cjs +32 -5
  125. package/src/main/lib/scheduler/usageHoldRoute.cjs +97 -0
  126. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +28 -7
  127. package/src/main/lib/tasks/memoryConsolidation.cjs +123 -39
  128. package/src/main/lib/tasks/mitigationReview.cjs +21 -1
  129. package/src/main/lib/tasks/taskAdminRoutes.cjs +104 -17
  130. package/src/main/lib/tasks/taskLedger.cjs +2 -2
  131. package/src/main/lib/tasks/taskRun.cjs +3 -1
  132. package/src/main/lib/tasks/weeklyConsolidationInputs.cjs +178 -0
  133. package/src/main/lib/telemetry/auditEvents.cjs +21 -24
  134. package/src/main/lib/telemetry/auditLog.cjs +6 -2
  135. package/src/main/lib/util/atomicFs.cjs +2 -2
  136. package/src/main/projectPages.cjs +22 -14
  137. package/src/main/promptSessionEvents.cjs +16 -1
  138. package/src/main/pty.cjs +14 -2
  139. package/src/main/queueOps.cjs +1 -1
  140. package/src/main/runVerify.cjs +4 -3
  141. package/src/main/scheduler/planReviewHold.cjs +140 -0
  142. package/src/main/scheduler/prdParser.cjs +1 -0
  143. package/src/main/scheduler/reviewLadder.cjs +2 -0
  144. package/src/main/scheduler/utilizationHold.cjs +101 -6
  145. package/src/main/scheduler.cjs +1055 -107
  146. package/src/main/seedAgentPersonas.cjs +11 -6
  147. package/src/main/seedStatus.cjs +1 -1
  148. package/src/main/templates/PRD_AUTHORING.md +22 -2
  149. package/src/main/webRemote.cjs +47 -7
  150. package/src/preload/api.d.ts +118 -2
  151. package/src/preload/apiSurface.json +42 -0
  152. package/src/preload/index.cjs +11 -0
  153. package/src/seed/agents/architect.md +28 -43
  154. package/src/seed/agents/demo-video-builder.md +15 -8
  155. package/src/seed/agents/dev-lead.md +3 -1
  156. package/src/seed/agents/md-network-curator.md +27 -0
  157. package/src/seed/agents/plan-reviewer.md +47 -0
  158. package/src/seed/agents/validator.md +21 -19
  159. package/dist/assets/AppSettings-BcZgIvvY.js +0 -2
  160. package/dist/assets/HomeClaudeConfig-D32ZJtU-.js +0 -3
  161. package/dist/assets/ProjectClaudeConfig-BTClYV6i.js +0 -26
  162. package/dist/assets/Scheduler-DPobKx1Z.js +0 -16
@@ -4,7 +4,8 @@
4
4
  * epicSettle.cjs — pure settle evaluator for one Epic.
5
5
  *
6
6
  * Given the Epic's event chain and the scheduler queue rows, says whether the
7
- * Epic has settled (no pending/running PRD) and which finished PRDs no
7
+ * Epic has settled (no running PRD, and no pending PRD other than ones held
8
+ * on a preflight precondition or waiting only on such held rows) and which finished PRDs no
8
9
  * validator has checked yet. No fs; only the pure lib/scheduler/cancelledRow
9
10
  * predicate, never the scheduler itself.
10
11
  */
@@ -35,7 +36,50 @@ function evaluateEpicSettle({ epicId, cwd, events, jobs, now, horizonMs } = {})
35
36
  const epicRows = rows.filter(
36
37
  (r) => r && (r.epicId === epicId || r.sourcePromptId === epicId) && (r.cwd == null || cwd == null || r.cwd === cwd),
37
38
  );
38
- const settled = !epicRows.some((r) => r.status === 'pending' || r.status === 'running');
39
+ // A pending row is held when its preflight parked it, or when every one of its
40
+ // unfinished dependencies is itself held. Held rows run on their own later, so
41
+ // they do not hold back the settle digest; the digest names them instead.
42
+ const byBare = new Map();
43
+ for (const r of epicRows) if (r && r.slug != null) byBare.set(bareSlug(String(r.slug)), r);
44
+ const isFinished = (r) => r.status === 'completed' || r.status === 'skipped';
45
+ const heldMemo = new Map(); // row -> reason string | null
46
+ /** @returns {string|null} the held reason, or null when the row is not held */
47
+ const heldReasonOf = (row, seen) => {
48
+ if (!row || row.status !== 'pending') return null;
49
+ if (heldMemo.has(row)) return heldMemo.get(row);
50
+ if (row.preflightHold || (typeof row.heldReason === 'string' && row.heldReason.startsWith('held: plan-review'))) {
51
+ const reason = typeof row.heldReason === 'string' && row.heldReason ? row.heldReason : 'waiting on precondition';
52
+ heldMemo.set(row, reason);
53
+ return reason;
54
+ }
55
+ if (seen.has(row)) return null;
56
+ seen.add(row);
57
+ const deps = Array.isArray(row.dependsOn) ? row.dependsOn : [];
58
+ let firstHeld = null;
59
+ let result = null;
60
+ let anyUnfinished = false;
61
+ let allHeld = true;
62
+ for (const d of deps) {
63
+ const dep = byBare.get(bareSlug(String(d)));
64
+ if (!dep || isFinished(dep)) continue;
65
+ anyUnfinished = true;
66
+ if (heldReasonOf(dep, seen) == null) { allHeld = false; break; }
67
+ if (firstHeld == null) firstHeld = String(dep.slug);
68
+ }
69
+ if (anyUnfinished && allHeld) result = `waiting on ${firstHeld}`;
70
+ seen.delete(row);
71
+ heldMemo.set(row, result);
72
+ return result;
73
+ };
74
+ const held = epicRows
75
+ .filter((r) => r.status === 'pending')
76
+ .map((r) => ({ slug: String(r.slug), reason: heldReasonOf(r, new Set()) }))
77
+ .filter((h) => h.reason != null)
78
+ .sort((a, b) => (a.slug < b.slug ? -1 : a.slug > b.slug ? 1 : 0));
79
+ const heldSet = new Set(held.map((h) => h.slug));
80
+ const settled = !epicRows.some(
81
+ (r) => r.status === 'running' || (r.status === 'pending' && !heldSet.has(String(r.slug))),
82
+ );
39
83
  const cancelled = epicRows
40
84
  .filter(isCancelledRow)
41
85
  .map((r) => String(r.slug))
@@ -101,12 +145,12 @@ function evaluateEpicSettle({ epicId, cwd, events, jobs, now, horizonMs } = {})
101
145
  failed.sort();
102
146
 
103
147
  const digestKey = createHash('sha1')
104
- .update(JSON.stringify({ verified, refuted, failed, parked, cancelled, uncovered: uncovered.map((u) => u.slug) }))
148
+ .update(JSON.stringify({ verified, refuted, failed, parked, cancelled, uncovered: uncovered.map((u) => u.slug), held: held.map((h) => h.slug) }))
105
149
  .digest('hex')
106
150
  .slice(0, 16);
107
151
  const hasContent = [uncovered, verified, refuted, failed, parked, cancelled].some((l) => l.length > 0);
108
152
 
109
- return { settled, uncovered, verified, refuted, failed, parked, cancelled, digestKey, hasContent };
153
+ return { settled, held, uncovered, verified, refuted, failed, parked, cancelled, digestKey, hasContent };
110
154
  }
111
155
 
112
156
  module.exports = { evaluateEpicSettle, DEFAULT_SETTLE_HORIZON_MS };
@@ -47,7 +47,7 @@ const { isNonClaudeAgentCli } = require('../agent-cli/agentCliEvents.cjs');
47
47
 
48
48
  /**
49
49
  * The persona (body + model) this turn runs with — see the header's "Persona pin".
50
- * @returns {{ source: 'snapshot'|'live', agentSnapshotId: string|null, body: string|null, model: string, snapshotMissing?: true } | null}
50
+ * @returns {{ source: 'snapshot'|'live', agentSnapshotId: string|null, body: string|null, model: string, snapshot?: any, snapshotMissing?: true } | null}
51
51
  */
52
52
  function resolveTurnPersona(cwd, claudeSessionId, epic, deps) {
53
53
  if (epic && isNonClaudeAgentCli(epic.agentCli)) return null;
@@ -70,6 +70,8 @@ function resolveTurnPersona(cwd, claudeSessionId, epic, deps) {
70
70
  agentSnapshotId: id,
71
71
  body: typeof snap.body === 'string' && snap.body ? snap.body : null,
72
72
  model: model || modelResolve.FALLBACK_MODEL,
73
+ // The pinned snapshot itself: chatRunner reads gearBindsChat/loadout/tools/mcpServers/packs from it.
74
+ snapshot: snap,
73
75
  };
74
76
  }
75
77
 
@@ -0,0 +1,248 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * epicStateEmitter.cjs — event-driven Epic outside-state changes.
5
+ *
6
+ * Replaces the deleted tick watcher (epicStateWatcher.cjs, removed in
7
+ * 909f6e47). pokeEpicState(cwd, epicId) debounces per Epic, then recomputes
8
+ * the Epic's outside state through the same epicOutsideRead.getEpicRecord that
9
+ * GET /admin/epic uses, and appends one `epic.state_changed` event
10
+ * { kind, from, to, blockedKind?, externalRef? }
11
+ * to the Epic's own event log whenever (to, blockedKind) differs from the last
12
+ * recorded one. The last state is recovered from that log on first use, so a
13
+ * restart never repeats a row.
14
+ *
15
+ * Lifecycle shortcuts: lifecycleTo 'completed' → 'closed', 'proposed' →
16
+ * 'awaiting_approval' (no recompute). lifecycleTo 'active' retries while the
17
+ * record still reads another status (at most MAX_ACTIVE_RETRIES). A null
18
+ * record → 'gone', only when a last state is set and is not closed/gone.
19
+ *
20
+ * At most one recompute per Epic runs at a time; a poke during one schedules
21
+ * exactly one more. Nothing here throws or rejects.
22
+ *
23
+ * startEpicStateEmitter() subscribes to epicEventLog appends and pokes for
24
+ * POKE_KINDS (never for epic.state_changed itself).
25
+ */
26
+
27
+ const epicEventLog = require('./epicEventLog.cjs');
28
+ const { EPIC_OUTSIDE_STATES } = require('./epicOutsideState.cjs');
29
+
30
+ const KIND = 'epic.state_changed';
31
+ const EPIC_STATE_CHANGED_TO = Object.freeze([...EPIC_OUTSIDE_STATES, 'gone']);
32
+ const TO_SET = new Set(EPIC_STATE_CHANGED_TO);
33
+ const MAX_ACTIVE_RETRIES = 5;
34
+ const RECOVER_PAGE = 1000;
35
+ const RECOVER_MAX_PAGES = 50;
36
+ const POKE_KINDS = new Set([
37
+ 'epic.minted',
38
+ 'epic.status_changed',
39
+ 'job.queued',
40
+ 'job.status_changed',
41
+ 'job.needs_input',
42
+ 'human.answer',
43
+ 'human.message',
44
+ 'external.message',
45
+ 'validator.verdict',
46
+ 'outcome.recorded',
47
+ ]);
48
+
49
+ const DEFAULT_OPTS = () => ({
50
+ isTabBusy: () => false,
51
+ listJobs: () => [],
52
+ projectRoots: undefined,
53
+ debounceMs: 1000,
54
+ });
55
+
56
+ /** @type {{ isTabBusy: (epicId: string) => boolean | Promise<boolean>, listJobs: () => any, projectRoots: undefined | (() => string[]), debounceMs: number }} */
57
+ let opts = DEFAULT_OPTS();
58
+ /** key → debounce timeout */
59
+ const timers = new Map();
60
+ /** key → in-flight recompute promise */
61
+ const running = new Map();
62
+ /** keys poked while their recompute ran */
63
+ const again = new Set();
64
+ /** key → { cwd, epicId, lifecycleTo, attempt } waiting for its timer */
65
+ const pending = new Map();
66
+ /** key → { state, blockedKind, externalRef } | null */
67
+ const last = new Map();
68
+ let unsubscribe = null;
69
+
70
+ const keyOf = (cwd, epicId) => `${cwd}\0${epicId}`;
71
+ const str = (v) => (typeof v === 'string' && v !== '' ? v : null);
72
+ const msg = (e) => (e && e.message ? e.message : String(e));
73
+
74
+ /** @param {{ isTabBusy?: Function, listJobs?: Function, projectRoots?: Function, debounceMs?: number }} [o] */
75
+ function configureEpicStateEmitter(o = {}) {
76
+ if (!o || typeof o !== 'object') return;
77
+ if (typeof o.isTabBusy === 'function') opts.isTabBusy = /** @type {any} */ (o.isTabBusy);
78
+ if (typeof o.listJobs === 'function') opts.listJobs = /** @type {any} */ (o.listJobs);
79
+ if ('projectRoots' in o) opts.projectRoots = typeof o.projectRoots === 'function' ? /** @type {any} */ (o.projectRoots) : undefined;
80
+ if (Number.isFinite(o.debounceMs) && /** @type {number} */ (o.debounceMs) >= 0) opts.debounceMs = /** @type {number} */ (o.debounceMs);
81
+ }
82
+
83
+ /** The newest epic.state_changed in the Epic's log, or null. */
84
+ async function recoverLast(cwd, epicId) {
85
+ let after = 0;
86
+ let newest = null;
87
+ for (let page = 0; page < RECOVER_MAX_PAGES; page++) {
88
+ const res = await epicEventLog.readEpicEvents(cwd, epicId, { kinds: [KIND], after, limit: RECOVER_PAGE });
89
+ if (res.events.length) newest = res.events[res.events.length - 1];
90
+ if (!res.hasMore) break;
91
+ after = res.cursor;
92
+ }
93
+ if (!newest) return null;
94
+ return { state: str(newest.to), blockedKind: str(newest.blockedKind), externalRef: str(newest.externalRef) };
95
+ }
96
+
97
+ function arm(key, delay = opts.debounceMs) {
98
+ const t = timers.get(key);
99
+ if (t) clearTimeout(t);
100
+ const h = setTimeout(() => {
101
+ timers.delete(key);
102
+ fire(key);
103
+ }, delay);
104
+ if (h && typeof h.unref === 'function') h.unref();
105
+ timers.set(key, h);
106
+ }
107
+
108
+ function fire(key) {
109
+ if (running.has(key)) {
110
+ again.add(key);
111
+ return;
112
+ }
113
+ const p = pending.get(key);
114
+ if (!p) return;
115
+ pending.delete(key);
116
+ const prom = recompute(p).catch((e) => {
117
+ console.error('[epicStateEmitter] recompute failed', p.epicId, msg(e));
118
+ }).finally(() => {
119
+ running.delete(key);
120
+ if (again.delete(key)) fire(key);
121
+ });
122
+ running.set(key, prom);
123
+ }
124
+
125
+ /**
126
+ * pokeEpicState(cwd, epicId, { lifecycleTo? }) — schedule a debounced
127
+ * recompute of this Epic's outside state. Never throws.
128
+ */
129
+ function pokeEpicState(cwd, epicId, o = {}) {
130
+ try {
131
+ if (typeof cwd !== 'string' || !cwd || typeof epicId !== 'string' || !epicId) return;
132
+ const key = keyOf(cwd, epicId);
133
+ const p = pending.get(key) || { cwd, epicId, lifecycleTo: undefined, attempt: 0 };
134
+ const lt = o && typeof o === 'object' ? str(o.lifecycleTo) : null;
135
+ if (lt) p.lifecycleTo = lt;
136
+ p.attempt = 0;
137
+ pending.set(key, p);
138
+ arm(key);
139
+ } catch (e) {
140
+ console.error('[epicStateEmitter] poke failed', epicId, msg(e));
141
+ }
142
+ }
143
+
144
+ function scheduleRetry(key, cwd, epicId, attempt) {
145
+ const p = pending.get(key);
146
+ if (p) {
147
+ if (!p.lifecycleTo) p.lifecycleTo = 'active';
148
+ } else {
149
+ pending.set(key, { cwd, epicId, lifecycleTo: 'active', attempt });
150
+ }
151
+ arm(key);
152
+ }
153
+
154
+ async function recompute({ cwd, epicId, lifecycleTo, attempt }) {
155
+ const key = keyOf(cwd, epicId);
156
+ try {
157
+ if (!last.has(key)) last.set(key, await recoverLast(cwd, epicId));
158
+ const prev = last.get(key) || null;
159
+
160
+ /** @type {{ state: string|null, blockedKind: string|null, externalRef: string|null } | null} */
161
+ let next = null;
162
+ if (lifecycleTo === 'completed') {
163
+ next = { state: 'closed', blockedKind: null, externalRef: prev ? prev.externalRef : null };
164
+ } else if (lifecycleTo === 'proposed') {
165
+ next = { state: 'awaiting_approval', blockedKind: null, externalRef: prev ? prev.externalRef : null };
166
+ } else {
167
+ const outsideRead = require('./epicOutsideRead.cjs'); // lazy: pulls in promptSessionsIpc
168
+ const readOpts = { id: epicId, isTabBusy: opts.isTabBusy, listJobs: opts.listJobs };
169
+ if (opts.projectRoots) readOpts.projectRoots = opts.projectRoots;
170
+ const rec = await outsideRead.getEpicRecord(cwd, readOpts);
171
+ if (!rec) {
172
+ if (!prev || !prev.state || prev.state === 'closed' || prev.state === 'gone') return;
173
+ next = { state: 'gone', blockedKind: null, externalRef: prev.externalRef };
174
+ } else {
175
+ if (lifecycleTo === 'active' && rec.status !== 'active' && attempt < MAX_ACTIVE_RETRIES) {
176
+ scheduleRetry(key, cwd, epicId, attempt + 1);
177
+ return;
178
+ }
179
+ const state = str(rec.state);
180
+ next = {
181
+ state,
182
+ blockedKind: state === 'blocked' ? str(rec.blocked && rec.blocked.kind) : null,
183
+ externalRef: str(rec.externalRef),
184
+ };
185
+ }
186
+ }
187
+
188
+ if (!next.state || !TO_SET.has(next.state)) {
189
+ console.error('[epicStateEmitter] dropped unknown state', cwd, epicId, next.state);
190
+ return;
191
+ }
192
+ if (prev && prev.state === next.state && (prev.blockedKind || null) === (next.blockedKind || null)) return;
193
+
194
+ /** @type {Record<string, unknown>} */
195
+ const event = { kind: KIND, from: prev ? prev.state : null, to: next.state };
196
+ if (next.blockedKind) event.blockedKind = next.blockedKind;
197
+ if (next.externalRef) event.externalRef = next.externalRef;
198
+ await epicEventLog.appendEpicEvent(cwd, epicId, event);
199
+ last.set(key, next);
200
+ } catch (e) {
201
+ console.error('[epicStateEmitter] recompute failed', epicId, msg(e));
202
+ }
203
+ }
204
+
205
+ function onAppended(cwd, record) {
206
+ if (!record || !POKE_KINDS.has(record.kind)) return;
207
+ const epicId = str(record.epicId);
208
+ if (!epicId) return;
209
+ pokeEpicState(cwd, epicId, record.kind === 'epic.status_changed' ? { lifecycleTo: record.to } : {});
210
+ }
211
+
212
+ /** Subscribe to event-log appends (idempotent). Returns an unsubscribe function. */
213
+ function startEpicStateEmitter() {
214
+ if (!unsubscribe) unsubscribe = epicEventLog.onEpicEventAppended(onAppended);
215
+ return () => {
216
+ if (unsubscribe) unsubscribe();
217
+ unsubscribe = null;
218
+ };
219
+ }
220
+
221
+ /** Test helper: resolve once no timer or recompute is left. */
222
+ async function _settleForTests() {
223
+ for (let i = 0; i < 1000 && (timers.size || running.size || pending.size); i++) {
224
+ if (running.size) await Promise.all([...running.values()]);
225
+ else await new Promise((r) => setTimeout(r, Math.min(opts.debounceMs, 50) + 1));
226
+ }
227
+ }
228
+
229
+ function _resetForTests() {
230
+ for (const t of timers.values()) clearTimeout(t);
231
+ timers.clear();
232
+ running.clear();
233
+ again.clear();
234
+ pending.clear();
235
+ last.clear();
236
+ if (unsubscribe) unsubscribe();
237
+ unsubscribe = null;
238
+ opts = DEFAULT_OPTS();
239
+ }
240
+
241
+ module.exports = {
242
+ EPIC_STATE_CHANGED_TO,
243
+ configureEpicStateEmitter,
244
+ pokeEpicState,
245
+ startEpicStateEmitter,
246
+ _settleForTests,
247
+ _resetForTests,
248
+ };
@@ -143,8 +143,16 @@ function buildSettledDigest(settle, { epicId, notValidatedReason, cwd, findings
143
143
  const parked = s.parked || [];
144
144
  const cancelled = s.cancelled || [];
145
145
  const notValidated = (s.uncovered || []).map((u) => (typeof u === 'string' ? u : u.slug));
146
+ const held = Array.isArray(s.held) ? s.held : [];
147
+ const head = held.length
148
+ ? [
149
+ `PLAN SETTLED — nothing of this session is running; ${held.length} PRD(s) are held on a precondition and will run on their own:`,
150
+ ...held.map((h) => `- ${h.slug}${h.reason ? ` — ${h.reason}` : ''}`),
151
+ 'This is ONE digest, not a per-PRD request.',
152
+ ]
153
+ : [`PLAN SETTLED — no PRD of this session is pending or running. This is ONE digest, not a per-PRD request.`];
146
154
  const lines = [
147
- `PLAN SETTLED — no PRD of this session is pending or running. This is ONE digest, not a per-PRD request.`,
155
+ ...head,
148
156
  ...recordFolderLines(cwd, epicId),
149
157
  'Do NOT re-verify VERIFIED PRDs — a validator already checked them.',
150
158
  ];
@@ -189,7 +197,7 @@ const _rowInEpic = (r, epicId) => r && (r.epicId === epicId || r.sourcePromptId
189
197
 
190
198
  /**
191
199
  * runEpicSettle({ cwd, epicId }, deps) → { action, reason?, slug? }
192
- * Never throws. Actions: 'none' | 'sweep-queued' | 'digest-sent'.
200
+ * Never throws. Actions: 'none' | 'sweep-queued' | 'digest-sent' | 'digest-held'.
193
201
  */
194
202
  async function runEpicSettle({ cwd, epicId } = {}, deps = {}) {
195
203
  const {
@@ -300,7 +308,18 @@ async function runEpicSettle({ cwd, epicId } = {}, deps = {}) {
300
308
  try { (log || console).error('[epicValidationHook] readVerdictFiles failed', epicId, e); } catch { /* noop */ }
301
309
  }
302
310
  const prompt = buildSettledDigest(digestSettle, { epicId, notValidatedReason, cwd, findings });
303
- sendPrompt(epicId, prompt, { origin: 'scheduler' });
311
+ // A non-promise return or a rejected send counts as sent; only an explicit
312
+ // 'held' disposition (usage hold kept the turn) is recorded as held. The
313
+ // digestKey is kept either way so a later settle does not send a second one.
314
+ const sent = await Promise.resolve(sendPrompt(epicId, prompt, { origin: 'scheduler', heldKind: 'settle-digest' })).catch(() => null);
315
+ if (sent && sent.disposition === 'held') {
316
+ await appendResponseEvent(
317
+ cwd, epicId,
318
+ 'Plan digest held by the usage hold — it is delivered when the hold clears',
319
+ { outcome: 'digest', digestKey: settle.digestKey, held: true },
320
+ );
321
+ return { action: 'digest-held' };
322
+ }
304
323
  await appendResponseEvent(
305
324
  cwd, epicId,
306
325
  `Plan digest sent: ${settle.verified.length} verified, ${settle.refuted.length} refuted, ${settle.uncovered.length} not validated`,
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * planReviewInput.cjs — pure builder for the scheduler_create_prd input of one
5
+ * plan-review job (agentType plan-reviewer), plus a deterministic structural
6
+ * pre-check whose findings go into the job's notes. Pure: no fs, no child_process.
7
+ */
8
+
9
+ const { bareSlug } = require('../prd/depSlugResolve.cjs');
10
+
11
+ const PERSONA_LINE = 'Work as the plan-reviewer persona — the procedure is your system prompt.';
12
+
13
+ /** @param {any} m */
14
+ function isDocMember(m) {
15
+ const goal = typeof m.goal === 'string' ? m.goal.trim().toLowerCase() : '';
16
+ if (goal.startsWith('doc')) return true;
17
+ const files = Array.isArray(m.files) ? m.files : [];
18
+ return files.length > 0 && files.every((f) => typeof f === 'string' && /\.md$/i.test(f));
19
+ }
20
+
21
+ /**
22
+ * @param {Array<any>} members
23
+ * @returns {Array<{ check: string, slug: string, detail: string }>}
24
+ */
25
+ function structuralFindings(members) {
26
+ const list = Array.isArray(members) ? members : [];
27
+ const bySlug = new Map(list.map((m) => [bareSlug(m.slug), m]));
28
+ const findings = [];
29
+
30
+ /** @param {any} start */
31
+ const reachesNonDoc = (start) => {
32
+ const seen = new Set();
33
+ const stack = [...(start.dependsOn || [])];
34
+ while (stack.length) {
35
+ const b = bareSlug(stack.pop());
36
+ if (seen.has(b)) continue;
37
+ seen.add(b);
38
+ const m = bySlug.get(b);
39
+ if (!m) continue;
40
+ if (!isDocMember(m)) return true;
41
+ stack.push(...(m.dependsOn || []));
42
+ }
43
+ return false;
44
+ };
45
+
46
+ for (const m of list) {
47
+ if (isDocMember(m) && !reachesNonDoc(m)) {
48
+ findings.push({
49
+ check: 'doc-after-code',
50
+ slug: m.slug,
51
+ detail: `doc PRD ${m.slug} does not depend (transitively) on any code PRD in the plan`,
52
+ });
53
+ }
54
+ for (const d of m.dependsOn || []) {
55
+ if (!bySlug.has(bareSlug(d))) {
56
+ findings.push({
57
+ check: 'depends-on',
58
+ slug: m.slug,
59
+ detail: `${m.slug} dependsOn ${d}, which is not in the plan`,
60
+ });
61
+ }
62
+ }
63
+ }
64
+ return findings;
65
+ }
66
+
67
+ /**
68
+ * @param {{ epicId: string, cwd: string, epicGoal?: string, validateSlug: string,
69
+ * members: Array<any>, baseSha?: string | null, round?: number }} args
70
+ */
71
+ function buildPlanReviewInput({ epicId, cwd, epicGoal, validateSlug, members, baseSha, round }) {
72
+ const list = Array.isArray(members) ? members : [];
73
+ const bare = bareSlug(validateSlug);
74
+ const slug = `plan-review-${bare}${round && round >= 2 ? `-r${round}` : ''}`;
75
+ const recordPath = `session-manager-operations/plan-records/${epicId}/${validateSlug}.plan-review.md`;
76
+
77
+ const acceptanceCriteria = list.map((m) => `Review ${m.slug}`);
78
+ acceptanceCriteria.push(`Record written at ${recordPath}, relative to the job worktree's repository root (git rev-parse --show-toplevel), never relative to a subdirectory you cd'd into. Do not git add or commit it — the scheduler copies it to the main checkout`);
79
+
80
+ const lines = [
81
+ PERSONA_LINE,
82
+ `Epic goal: ${epicGoal || 'unknown'}`,
83
+ baseSha ? `Base: ${baseSha}` : 'Base: unknown',
84
+ '',
85
+ 'Plan members:',
86
+ ];
87
+ for (const m of list) {
88
+ lines.push(
89
+ `- ${m.slug}${m.title ? ` — ${m.title}` : ''}`,
90
+ ` PRD file: ${m.prdPath}`,
91
+ ` Goal: ${m.goal || ''}`,
92
+ ' Acceptance criteria:',
93
+ ...(m.acceptanceCriteria || []).map((c) => ` - ${c}`),
94
+ ` Files: ${(m.files || []).join(', ') || '(none)'}`,
95
+ ` Gate: ${(m.gate || []).join(' ; ') || '(none)'}`,
96
+ ` dependsOn: ${(m.dependsOn || []).join(', ') || '(none)'}`,
97
+ );
98
+ }
99
+ const findings = structuralFindings(list);
100
+ lines.push('', 'Structural pre-check:');
101
+ if (findings.length === 0) lines.push('- no findings');
102
+ for (const f of findings) lines.push(`- [${f.check}] ${f.detail}`);
103
+ lines.push('', 'Created automatically by the scheduler; no human or planner wrote this PRD.');
104
+
105
+ return {
106
+ title: `Plan review: ${bare}${round && round >= 2 ? ` (round ${round})` : ''}`,
107
+ slug,
108
+ goal: `review. Independent review of this Epic's plan before its PRDs dispatch: ${list.map((m) => m.slug).join(', ')}.`,
109
+ acceptanceCriteria,
110
+ implementationNotes: lines.join('\n'),
111
+ outOfScope: ['Editing product code', 'Queuing fix PRDs'],
112
+ gate: ['none'],
113
+ files: [recordPath],
114
+ deliverable: 'artifact',
115
+ artifactPaths: [recordPath],
116
+ agentType: 'plan-reviewer',
117
+ tag: 'build',
118
+ sourcePromptId: epicId,
119
+ cwd,
120
+ };
121
+ }
122
+
123
+ module.exports = { buildPlanReviewInput, structuralFindings };
@@ -975,5 +975,6 @@ module.exports = {
975
975
  listRestorableSessions,
976
976
  listRecentRestorableSessions,
977
977
  checkRestorableSessionSync,
978
+ showId,
978
979
  __resetCacheForTests,
979
980
  };
@@ -0,0 +1,71 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * scriptStartedBy.cjs — how a script-started Epic records who started it.
5
+ * EpicSource.startedBy = { kind: 'script', route, caller?, fromCwd?, fromEpicId? };
6
+ * absent for every human press. 'new-epic-ui' stays the mint authority
7
+ * (epicMint.cjs); startedBy sits next to it. The stored shape is lenient
8
+ * (promptSessionSchema.cjs); this is the strict entry-point validator.
9
+ */
10
+
11
+ const { z } = require('zod');
12
+
13
+ const CallerSchema = z.object({
14
+ pipeline: z.string().max(200).optional(),
15
+ runId: z.string().max(200).optional(),
16
+ step: z.string().max(200).optional(),
17
+ attempt: z.number().int().min(0).optional(),
18
+ }).strict();
19
+
20
+ const StartedBySchema = z.object({
21
+ kind: z.literal('script'),
22
+ route: z.string().min(1).max(200),
23
+ caller: CallerSchema.optional(),
24
+ fromCwd: z.string().max(4096).optional(),
25
+ fromEpicId: z.string().max(200).optional(),
26
+ }).strict();
27
+
28
+ /**
29
+ * Build a StartedBySchema-valid object, omitting absent/empty keys.
30
+ * @param {{ route: string, caller?: object, fromCwd?: string, fromEpicId?: string }} args
31
+ */
32
+ function buildStartedBy({ route, caller, fromCwd, fromEpicId } = {}) {
33
+ const out = { kind: 'script', route };
34
+ if (caller && typeof caller === 'object') {
35
+ const c = {};
36
+ for (const [k, v] of Object.entries(caller)) {
37
+ if (v !== undefined && v !== null && v !== '') c[k] = v;
38
+ }
39
+ if (Object.keys(c).length) out.caller = c;
40
+ }
41
+ if (typeof fromCwd === 'string' && fromCwd) out.fromCwd = fromCwd;
42
+ if (typeof fromEpicId === 'string' && fromEpicId) out.fromEpicId = fromEpicId;
43
+ return StartedBySchema.parse(out);
44
+ }
45
+
46
+ /**
47
+ * startedBy for a request: validated body caller + the chat that made the
48
+ * loopback call (resolved from the socket), mapped to its Epic when found.
49
+ * @param {{ route: string, caller?: object, socket?: object }} args
50
+ * @param {{ resolvePeerChatSession?: Function, findEpicByClaudeSessionId?: Function }} [deps]
51
+ */
52
+ async function startedByFromRequest({ route, caller, socket } = {}, deps = {}) {
53
+ let fromCwd;
54
+ let fromEpicId;
55
+ try {
56
+ const resolve = deps.resolvePeerChatSession || require('../process/peerChatSession.cjs').resolvePeerChatSession;
57
+ const peer = await resolve(socket);
58
+ if (peer && peer.chatSessionId && peer.projectRoot) {
59
+ const find = deps.findEpicByClaudeSessionId || require('../claude/agentModelResolve.cjs').findEpicByClaudeSessionId;
60
+ const epic = find(peer.projectRoot, peer.chatSessionId);
61
+ if (epic) {
62
+ fromCwd = peer.projectRoot;
63
+ fromEpicId = epic.id || epic.epicId || undefined;
64
+ if (!fromEpicId) fromCwd = undefined;
65
+ }
66
+ }
67
+ } catch { /* resolution is best-effort */ }
68
+ return buildStartedBy({ route, caller, fromCwd, fromEpicId });
69
+ }
70
+
71
+ module.exports = { CallerSchema, StartedBySchema, buildStartedBy, startedByFromRequest };
@@ -60,6 +60,9 @@ const CONTRACT = deepFreeze({
60
60
  { method: 'GET', path: '/__admin/health' },
61
61
  { method: 'POST', path: '/admin/feedback/open-session' },
62
62
  { method: 'POST', path: '/admin/macros/run' },
63
+ { method: 'POST', path: '/admin/projects/create' },
64
+ { method: 'POST', path: '/admin/services/pair-local' },
65
+ { method: 'POST', path: '/admin/services/pair-local/confirm' },
63
66
  { method: 'GET', path: '/admin/epics' },
64
67
  { method: 'GET', path: '/admin/epic' },
65
68
  // GET /admin/events: no epicId → audit-log rows { events, next, more, gap } (eventKinds below);
@@ -75,6 +78,7 @@ const CONTRACT = deepFreeze({
75
78
  { method: 'POST', path: '/admin/tasks/import' },
76
79
  { method: 'POST', path: '/admin/tasks/switch' },
77
80
  { method: 'GET', path: '/admin/validation-quality' },
81
+ { method: 'GET', path: '/admin/usage-hold' },
78
82
  ],
79
83
  tools: {
80
84
  feedback_open_session: { required: ['toCwd', 'fromCwd', 'title', 'motivation', 'acceptanceCriteria', 'body'] },
@@ -84,14 +88,18 @@ const CONTRACT = deepFreeze({
84
88
  agent_list: { required: [] },
85
89
  task_list: { required: ['cwd'] },
86
90
  task_get: { required: ['cwd', 'id'] },
91
+ usage_hold_get: { required: [] },
87
92
  },
88
93
  epicStates: ['closed', 'awaiting_approval', 'needs_input', 'blocked', 'working', 'in_review', 'verified', 'open'],
89
94
  epicRecordFields: [
90
95
  'epicId', 'cwd', 'title', 'goal', 'tag', 'agentType', 'status', 'state', 'phase', 'blocked', 'prds',
91
96
  'verified', 'refuted', 'unvalidated', 'externalRef', 'source', 'createdAt', 'completedAt', 'verdicts',
97
+ 'planReviews', 'planReviewStats',
92
98
  ],
93
99
  receiptFields: ['jobs', 'chat'],
94
100
  epicStateChangedFields: ['at', 'kind', 'cwd', 'epicId', 'from', 'to', 'blockedKind', 'externalRef'],
101
+ // Every `to` an epic_state_changed row can carry: the outside states plus 'gone' (epicStateEmitter.cjs EPIC_STATE_CHANGED_TO).
102
+ epicStateChangedTo: ['closed', 'awaiting_approval', 'needs_input', 'blocked', 'working', 'in_review', 'verified', 'open', 'gone'],
95
103
  // Keys of an event-mode epic_cross_project_reply row (crossProjectReply.cjs replyAsEvent) as readEventsAfter returns it.
96
104
  replyEventFields: [
97
105
  'at', 'kind', 'cwd', 'epicId', 'fromCwd', 'fromEpicId', 'outcome', 'delivery', 'mode', 'externalRef',
@@ -156,7 +164,15 @@ const CONTRACT_FINGERPRINTS = Object.freeze({
156
164
  // then GET /admin/validation-quality (validationQualityHandlers.cjs),
157
165
  // then 'phase' on epicRecordFields + taskFields (phaseProjection.cjs),
158
166
  // then POST /admin/tasks/switch (tasks/taskSwitchRoute.cjs),
159
- // then taskBodyKeys + taskRuntimeKeys + taskGetKeys (advertised on GET /__admin/health via healthInfo()).
167
+ // then taskBodyKeys + taskRuntimeKeys + taskGetKeys (advertised on GET /__admin/health via healthInfo()),
168
+ // then epicStateChangedTo: the pinned `to` set of epic_state_changed rows (the 8 outside states + 'gone',
169
+ // back to the v1 shape 0.141.0 served; 0.142.0 served lifecycle words only, after C6 909f6e47 narrowed it).
170
+ // then GET /admin/usage-hold (scheduler/usageHoldRoute.cjs): the 'pause above' hold POST /admin/tasks refuses on.
171
+ // then usage_hold_get: the MCP tool over GET /admin/usage-hold (scheduler-mcp-server.cjs).
172
+ // then POST /admin/projects/create (feedback-remote/projectCreate.cjs); no tool entry, mirroring macro_run.
173
+ // then POST /admin/services/pair-local + /confirm (feedback-remote/servicePairLocalRoutes.cjs).
174
+ // then 'planReviews' on epicRecordFields (stored plan-review records + release from plan-records/*.plan-review.json).
175
+ // then 'planReviewStats' on epicRecordFields (planReviewStats.cjs: reviewed vs unreviewed plan comparison).
160
176
  1: Object.freeze([
161
177
  '5a56abbb70184ff4a34346a5c6da4c5e6edbd756b54573c199b812d3f5a04101',
162
178
  '7383ff32c80561b1b2c505a78a1e8313ae2851bdc6e8fce6c6a88e1ab119bf5a',
@@ -164,6 +180,13 @@ const CONTRACT_FINGERPRINTS = Object.freeze({
164
180
  '2ddfa9e96382e6d2d8db6849361aeb89a62d86c237ad99d149ccb01c6b57db6a',
165
181
  'a5be9b9b073639b4622574c842ed9a41ebb39c24c0919d699b18d2e197a8eb67',
166
182
  'ffb97327f0bd2da7d3f29693171ee7ee53982d8347d20d009e5aa5baf2bc15d1',
183
+ '4f4ee647977bb670c71db57c6fdfa8dc5db89ce789a1f05dbf23f9468dcff30b',
184
+ '2c87717d95b8b7dceb8a2138affcd3fc990f762072691de7a433b2874fe89d4d',
185
+ '9490d3b89b9468f20666553747b3d4be3558e78ffcb5b79d63397cfa4ddd5235',
186
+ '799f062f9dd858b81afa20cf2153357e8fc7a3be2c748573d0f4c12b430d6683',
187
+ 'feaad10fabd300203314318c5484a8aed9b1cef496d2fbfb48464b06ff64628a',
188
+ 'e0ee3a1a0970e44c52b336d935ac59d05c4bfba3b4f3c602222292fbb5c77174',
189
+ '6fa520f745b48c393733123633029537aa54109040081bed320fa976888f1e77',
167
190
  ]),
168
191
  });
169
192
 
@@ -75,7 +75,7 @@ function autoStartFollowUp({ cwd, tabId, sessionId, send }) {
75
75
  try {
76
76
  if (typeof send !== 'function') return false;
77
77
  if (!autoStartNeedsPlan(cwd, sessionId)) return false;
78
- const r = send(tabId, AUTO_START_FOLLOW_UP_PROMPT, { origin: 'scheduler', sessionId, cwd });
78
+ const r = send(tabId, AUTO_START_FOLLOW_UP_PROMPT, { origin: 'scheduler', heldKind: 'auto-start-follow-up', sessionId, cwd });
79
79
  if (r && typeof r.catch === 'function') r.catch(() => {});
80
80
  return true;
81
81
  } catch {