claude-code-session-manager 0.139.0 → 0.141.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 (154) hide show
  1. package/README.md +20 -4
  2. package/dist/assets/AppSettings-DExeJhqQ.js +2 -0
  3. package/dist/assets/History-DJMiuXyK.js +2 -0
  4. package/dist/assets/{HomeClaudeConfig-CGD2Onjv.js → HomeClaudeConfig-CTp2tkZ4.js} +2 -2
  5. package/dist/assets/{Panel-Csyd9HbD.js → Panel-Bf1Cf8UL.js} +1 -1
  6. package/dist/assets/{ProjectClaudeConfig-C-jlYpC_.js → ProjectClaudeConfig-BWPpypf9.js} +1 -1
  7. package/dist/assets/Scheduler-cyr61UAC.js +16 -0
  8. package/dist/assets/{SkillReferenceGraph-DcscPXAG.js → SkillReferenceGraph-Ba4TkX2C.js} +1 -1
  9. package/dist/assets/{Skills-BpGRKOcY.js → Skills-C1v91GEO.js} +26 -26
  10. package/dist/assets/{TiptapBody-DSU3769X.js → TiptapBody-BrcWVpiW.js} +1 -1
  11. package/dist/assets/{ViewTabs-C0PRZx4_.js → ViewTabs-DXhOWFG0.js} +1 -1
  12. package/dist/assets/{VoiceButton-D2rMurNg.js → VoiceButton-qivnDV6K.js} +1 -1
  13. package/dist/assets/{historyTotals-TcIQs2sh.js → historyTotals-CMCPTKqC.js} +1 -1
  14. package/dist/assets/index-B2TQz3nd.js +3121 -0
  15. package/dist/assets/{index-BCySPdtU.css → index-DKXdXfka.css} +1 -1
  16. package/dist/index.html +2 -2
  17. package/dist-web/app.css +1 -1
  18. package/dist-web/app.js +423 -426
  19. package/package.json +5 -2
  20. package/plugins/AGENTS.md +60 -0
  21. package/plugins/CLAUDE.md +1 -60
  22. package/plugins/session-manager-dev/skills/builder/SKILL.md +4 -2
  23. package/plugins/session-manager-dev/skills/develop/SKILL.md +29 -19
  24. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
  25. package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
  26. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
  27. package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
  28. package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
  29. package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
  30. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
  31. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
  33. package/scripts/README.md +1 -0
  34. package/scripts/hooks/guard-tool-risk.cjs +91 -0
  35. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
  36. package/scripts/ops-sweep.cjs +53 -23
  37. package/scripts/scheduler-mcp-server.cjs +205 -18
  38. package/src/main/build-info.json +4 -4
  39. package/src/main/config.cjs +112 -8
  40. package/src/main/docEdit.cjs +6 -1
  41. package/src/main/files.cjs +7 -27
  42. package/src/main/health.cjs +48 -15
  43. package/src/main/historyAggregator.cjs +88 -5
  44. package/src/main/historyDashboard.cjs +69 -4
  45. package/src/main/index.cjs +56 -2
  46. package/src/main/ipcSchemas.cjs +122 -16
  47. package/src/main/lib/AGENTS.md +54 -0
  48. package/src/main/lib/CLAUDE.md +1 -54
  49. package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
  50. package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
  51. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
  52. package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
  53. package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
  54. package/src/main/lib/claude/effectiveModelInfo.cjs +90 -20
  55. package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
  56. package/src/main/lib/claude/personaToolScope.cjs +12 -6
  57. package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
  58. package/src/main/lib/claude/runClaudeP.cjs +6 -1
  59. package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
  60. package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
  61. package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
  62. package/src/main/lib/ephemeralCwd.cjs +37 -2
  63. package/src/main/lib/epic/delegationReadiness.cjs +42 -9
  64. package/src/main/lib/epic/epicAdminRoutes.cjs +25 -5
  65. package/src/main/lib/epic/epicOutsideRead.cjs +118 -1
  66. package/src/main/lib/epic/epicOutsideState.cjs +2 -2
  67. package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
  68. package/src/main/lib/epic/epicValidationHook.cjs +24 -4
  69. package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
  70. package/src/main/lib/externalContract.cjs +31 -5
  71. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +55 -1
  72. package/src/main/lib/feedback-remote/crossProjectReply.cjs +106 -11
  73. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +47 -19
  74. package/src/main/lib/feedback-remote/needsYouStore.cjs +6 -2
  75. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
  76. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
  77. package/src/main/lib/git/branchSweep.cjs +209 -4
  78. package/src/main/lib/git/gitWorktree.cjs +41 -5
  79. package/src/main/lib/guardShims.cjs +1 -1
  80. package/src/main/lib/historyRollup.cjs +26 -0
  81. package/src/main/lib/insideHome.cjs +27 -1
  82. package/src/main/lib/mcpToolCatalog.cjs +132 -13
  83. package/src/main/lib/mdDocCensus.cjs +59 -78
  84. package/src/main/lib/mdDocRefs.cjs +71 -93
  85. package/src/main/lib/mdNetworkScan.cjs +245 -250
  86. package/src/main/lib/mdReviewRecord.cjs +22 -9
  87. package/src/main/lib/memoryMdNetwork.cjs +5 -12
  88. package/src/main/lib/opsOwnership.cjs +18 -2
  89. package/src/main/lib/opsRetentionSettings.cjs +28 -4
  90. package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
  91. package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
  92. package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
  93. package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
  94. package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
  95. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
  96. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  97. package/src/main/lib/prd/depSlugResolve.cjs +104 -4
  98. package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
  99. package/src/main/lib/prd/prdCreate.cjs +377 -23
  100. package/src/main/lib/prd/prdDisposition.cjs +11 -2
  101. package/src/main/lib/prd/prdFrontmatter.cjs +121 -3
  102. package/src/main/lib/process/loginItem.cjs +171 -0
  103. package/src/main/lib/process/loginItemPlan.cjs +193 -0
  104. package/src/main/lib/project-pages/playerBridge.cjs +4 -0
  105. package/src/main/lib/project-pages/videoReview.cjs +268 -0
  106. package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
  107. package/src/main/lib/scheduler/cpuSample.cjs +131 -4
  108. package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
  109. package/src/main/lib/scheduler/loadGate.cjs +24 -6
  110. package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
  111. package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
  112. package/src/main/lib/scheduler/preflightCheck.cjs +97 -0
  113. package/src/main/lib/scheduler/queueStore.cjs +7 -0
  114. package/src/main/lib/scheduler/rcaReport.cjs +21 -1
  115. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
  116. package/src/main/lib/scheduler/reviewNotice.cjs +39 -0
  117. package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
  118. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  119. package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
  120. package/src/main/lib/scheduler/schedulerPaths.cjs +3 -0
  121. package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
  122. package/src/main/lib/scheduler/validationQuality.cjs +282 -0
  123. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
  124. package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
  125. package/src/main/lib/tasks/taskIpc.cjs +80 -0
  126. package/src/main/lib/tasks/taskLedger.cjs +502 -0
  127. package/src/main/lib/tasks/taskRun.cjs +313 -0
  128. package/src/main/lib/tasks/taskSwitch.cjs +120 -0
  129. package/src/main/loginItemIpc.cjs +35 -0
  130. package/src/main/loopEfficiencyHandlers.cjs +10 -1
  131. package/src/main/projectPages.cjs +6 -15
  132. package/src/main/promptSessionEvents.cjs +9 -1
  133. package/src/main/queueOps.cjs +260 -3
  134. package/src/main/runVerify.cjs +53 -25
  135. package/src/main/scheduler/AGENTS.md +26 -0
  136. package/src/main/scheduler/CLAUDE.md +1 -26
  137. package/src/main/scheduler/budget.cjs +239 -9
  138. package/src/main/scheduler/cancelDependents.cjs +154 -0
  139. package/src/main/scheduler/prdParser.cjs +19 -1
  140. package/src/main/scheduler/reviewLadder.cjs +36 -3
  141. package/src/main/scheduler/starvation.cjs +89 -18
  142. package/src/main/scheduler.cjs +1080 -89
  143. package/src/main/supervisor.cjs +5 -1
  144. package/src/main/templates/PRD_AUTHORING.md +14 -1
  145. package/src/main/validationQualityHandlers.cjs +199 -0
  146. package/src/main/webRemote.cjs +10 -2
  147. package/src/preload/api.d.ts +364 -21
  148. package/src/preload/apiSurface.json +89 -10
  149. package/src/preload/index.cjs +23 -2
  150. package/src/seed/agents/validator.md +19 -8
  151. package/dist/assets/AppSettings-CUfWY9vN.js +0 -2
  152. package/dist/assets/History-DDnqaLyw.js +0 -2
  153. package/dist/assets/Scheduler-NLs08fx7.js +0 -16
  154. package/dist/assets/index-C-d0DCre.js +0 -3124
@@ -9,9 +9,11 @@
9
9
  * could still fail to block at run time (or vice versa) — so the matching
10
10
  * rule lives here once, not copied into each caller.
11
11
  *
12
- * Resolution rule: exact slug match first; else bare-name match after
13
- * stripping one leading `NN-` prefix — a human-authored `dependsOn:` can't
14
- * know the `NN-` prefix the allocator will hand a sibling PRD.
12
+ * Resolution rule (write-time resolveDepSlug): exact slug match first; else
13
+ * bare-name match after stripping one leading `NN-` prefix — a human-authored
14
+ * `dependsOn:` can't know the `NN-` prefix the allocator will hand a sibling
15
+ * PRD. Run-time gating uses makeDepResolver below, which adds the satisfied
16
+ * record and Epic ordering on top of the same bare-name rule.
15
17
  */
16
18
 
17
19
  /** Strip one leading `NN-` prefix, if present. */
@@ -84,4 +86,102 @@ function findNearMatches(depSlug, candidateSlugs, limit = 3) {
84
86
  .map((entry) => entry.slug);
85
87
  }
86
88
 
87
- module.exports = { bareSlug, resolveDepSlug, findNearMatches, isSatisfiedDepRow };
89
+ /**
90
+ * Was this row cancelled by a human (admin API cancel), rather than failing on
91
+ * its own? scheduler.cjs's cancel handler stamps `cancelledAt` and an error
92
+ * starting 'cancelled via admin API'; either marker counts.
93
+ */
94
+ function isCancelledRow(row) {
95
+ if (!row) return false;
96
+ if (typeof row.cancelledAt === 'string' ? row.cancelledAt.length > 0 : row.cancelledAt != null) return true;
97
+ return typeof row.error === 'string' && row.error.startsWith('cancelled via admin API');
98
+ }
99
+
100
+ /** The Epic a queue row belongs to: `epicId`, else its `sourcePromptId`. */
101
+ function epicOf(job) {
102
+ return job?.epicId ?? job?.sourcePromptId ?? null;
103
+ }
104
+
105
+ /** True when `slug` carries a leading `NN-` allocator prefix. */
106
+ function isPrefixedSlug(slug) {
107
+ return /^\d+-/.test(String(slug ?? ''));
108
+ }
109
+
110
+ /**
111
+ * makeDepResolver(projectJobs, satisfiedSlugs, { failOpen, epicId }) — the ONE
112
+ * run-time `dependsOn` resolution rule, shared by every schedulerBatch.cjs
113
+ * gate (findBlockingDep, findUnresolvableDepRoots, pickForProject's hold
114
+ * records and root-blocker walk) so gating, holds and the root walk can never
115
+ * disagree about what a dep names.
116
+ *
117
+ * resolve(dep, dependentJob) → { kind: 'row'|'satisfied'|'unresolved', rows }, in order:
118
+ * 1. an exact live row → 'row'
119
+ * 2. the exact slug in satisfiedSlugs → 'satisfied'
120
+ * 3. NN-prefixed dep: a live row with the same bare name IN THE DEPENDENT'S
121
+ * EPIC → 'row'; else 'unresolved'
122
+ * (a dep written with a full slug names one PRD — another Epic's
123
+ * re-allocated sibling is not it)
124
+ * 4. bare dep: live rows with that bare name, preferring rows in the
125
+ * dependent's Epic → 'row'
126
+ * 5. bare dep: a satisfied record with that bare name → 'satisfied'
127
+ * 6. → 'unresolved'
128
+ * In steps 3-4 a cancelled row (isCancelledRow) is dropped when a satisfied
129
+ * record shares its bare name — a human-cancelled duplicate must never freeze
130
+ * the dependents of the PRD that genuinely finished (Self, 2026-11-22: the
131
+ * cancelled 1056-sm-contract-client froze 16 dependents of the completed
132
+ * 1047-sm-contract-client).
133
+ *
134
+ * `failOpen` (the caller's history/archive lookup failed this tick): any dep
135
+ * that resolves to no live row is 'satisfied' instead of 'unresolved'.
136
+ * `epicId` is the fallback Epic when resolve() is called without a dependent.
137
+ */
138
+ function makeDepResolver(projectJobs, satisfiedSlugs = new Set(), opts = {}) {
139
+ const failOpen = opts.failOpen === true;
140
+ const satisfied = satisfiedSlugs instanceof Set ? satisfiedSlugs : new Set(satisfiedSlugs ?? []);
141
+ const rowBySlug = new Map();
142
+ const rowsByBareSlug = new Map();
143
+ for (const j of projectJobs) {
144
+ if (!rowBySlug.has(j.slug)) rowBySlug.set(j.slug, j);
145
+ const bare = bareSlug(j.slug);
146
+ if (!rowsByBareSlug.has(bare)) rowsByBareSlug.set(bare, []);
147
+ rowsByBareSlug.get(bare).push(j);
148
+ }
149
+ let satisfiedBareSlugs = null;
150
+ const hasSatisfiedBare = (bare) => {
151
+ if (satisfiedBareSlugs === null) {
152
+ satisfiedBareSlugs = new Set();
153
+ for (const s of satisfied) satisfiedBareSlugs.add(bareSlug(s));
154
+ }
155
+ return satisfiedBareSlugs.has(bare);
156
+ };
157
+ const unresolved = () => (failOpen ? { kind: 'satisfied', rows: [] } : { kind: 'unresolved', rows: [] });
158
+
159
+ const resolve = (dep, dependentJob) => {
160
+ const exact = rowBySlug.get(dep);
161
+ if (exact) return { kind: 'row', rows: [exact] };
162
+ if (satisfied.has(dep)) return { kind: 'satisfied', rows: [] };
163
+ const bare = bareSlug(dep);
164
+ const depEpic = dependentJob ? epicOf(dependentJob) : (opts.epicId ?? null);
165
+ const sameEpic = (r) => depEpic != null && epicOf(r) === depEpic;
166
+ const bareRows = rowsByBareSlug.get(bare) ?? [];
167
+ const bareSatisfied = hasSatisfiedBare(bare);
168
+ const live = (rows) => (bareSatisfied ? rows.filter((r) => !isCancelledRow(r)) : rows);
169
+
170
+ if (isPrefixedSlug(dep)) {
171
+ const rows = live(bareRows.filter(sameEpic));
172
+ return rows.length > 0 ? { kind: 'row', rows } : unresolved();
173
+ }
174
+ const preferred = bareRows.filter(sameEpic);
175
+ const rows = live(preferred.length > 0 ? preferred : bareRows);
176
+ if (rows.length > 0) return { kind: 'row', rows };
177
+ if (bareSatisfied) return { kind: 'satisfied', rows: [] };
178
+ return unresolved();
179
+ };
180
+ const rowsForDep = (dep, dependentJob) => resolve(dep, dependentJob).rows;
181
+ const isKnownSatisfied = (dep, dependentJob) => resolve(dep, dependentJob).kind === 'satisfied';
182
+ return { resolve, rowsForDep, isKnownSatisfied };
183
+ }
184
+
185
+ module.exports = {
186
+ bareSlug, resolveDepSlug, findNearMatches, isSatisfiedDepRow, isCancelledRow, epicOf, makeDepResolver,
187
+ };
@@ -185,9 +185,12 @@ function registerAdminRoute(adminHttp, remote) {
185
185
  sendJson(res, 400, { ok: false, error: 'invalid payload', details: e?.issues ?? e?.message });
186
186
  return;
187
187
  }
188
- const result = await remote.cancelJob(input.slug, { cwd: input.cwd });
188
+ const result = await remote.cancelJob(input.slug, { cwd: input.cwd, dependents: input.dependents });
189
189
  if (!result.ok) {
190
- const status = result.error === 'invalid slug' ? 400
190
+ // A dependents refusal/abort (result.dependents set) is always a 409 —
191
+ // the job exists; the caller must pass or fix a dependents choice.
192
+ const status = Array.isArray(result.dependents) ? 409
193
+ : result.error === 'invalid slug' ? 400
191
194
  : /unknown slug|not found/i.test(result.error ?? '') ? 404
192
195
  : 409;
193
196
  sendJson(res, status, result);
@@ -197,6 +200,36 @@ function registerAdminRoute(adminHttp, remote) {
197
200
  sendJson(res, 200, result);
198
201
  });
199
202
 
203
+ // POST /admin/scheduler/dismiss-cancelled — the honest exit for a cancelled
204
+ // row (PRD 3492): removes it from the live queue and files its PRD under
205
+ // prds-cancelled/, which never satisfies a dependsOn (archive-prd refuses
206
+ // cancelled rows). Same body shape as cancel-job, including `dependents`.
207
+ adminHttp.registerRoute('POST', '/admin/scheduler/dismiss-cancelled', async (req, res) => {
208
+ const raw = await readBody(req);
209
+ const parsedBody = parseJsonBody(raw);
210
+ if (!parsedBody.ok) {
211
+ sendJson(res, 400, { ok: false, error: 'invalid JSON body' });
212
+ return;
213
+ }
214
+ let input;
215
+ try {
216
+ input = schemas.adminCancelJob.parse(parsedBody.value);
217
+ } catch (e) {
218
+ sendJson(res, 400, { ok: false, error: 'invalid payload', details: e?.issues ?? e?.message });
219
+ return;
220
+ }
221
+ const result = await queueOps.dismissCancelled(input.slug, input.cwd, { dependents: input.dependents });
222
+ if (!result.ok) {
223
+ const status = Array.isArray(result.dependents) || result.notCancelled ? 409
224
+ : result.error === 'invalid slug' ? 400
225
+ : /unknown slug/i.test(result.error ?? '') ? 404
226
+ : 500;
227
+ sendJson(res, status, result);
228
+ return;
229
+ }
230
+ sendJson(res, 200, result);
231
+ });
232
+
200
233
  adminHttp.registerRoute('POST', '/admin/scheduler/retag-prd', async (req, res) => {
201
234
  const raw = await readBody(req);
202
235
  const parsedBody = parseJsonBody(raw);