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
@@ -160,6 +160,7 @@ async function parsePrdRaw(filePath) {
160
160
  // Optional precondition command (preflightCheck.cjs); reconcile copies it
161
161
  // onto the queue row so spawnJob can hold the job while it exits non-zero.
162
162
  preflight: typeof fm.preflight === 'string' ? parsePreflightValue(rawFrontmatterValue(text, 'preflight')) : null,
163
+ planReview: typeof fm.planReview === 'string' && fm.planReview.trim().toLowerCase() === 'required' ? 'required' : null,
163
164
  // Opt-in exclusive-lease flag (PRD 1107, quietMachineLease.cjs +
164
165
  // schedulerBatch.cjs's pickNextBatch). Only a literal `true` opts in —
165
166
  // matches prdFrontmatter.cjs's applyKey semantics for this field.
@@ -942,6 +942,8 @@ function selectAutoFixTargets(jobs, { fixSlugExists, resolveJobRunId = resolveRu
942
942
  // fix-plan investigation to diagnose — there is no code defect to
943
943
  // author a PRD against, only another job's still-uncommitted tree.
944
944
  if (job.blockedByForeignWip === true) return false;
945
+ // The job sandbox refused it (environmentLimit): an investigation runs in the same sandbox and hits the same wall.
946
+ if (job.environmentLimit) return false;
945
947
  // A budget-killed job parks for a human/ladder decision, never an
946
948
  // auto-fix investigation or auto-retry — the run didn't fail, it simply
947
949
  // overran its own estimate; there's no code defect to diagnose (Out of
@@ -29,6 +29,7 @@
29
29
  * window: string | null,
30
30
  * percent: number | null,
31
31
  * threshold: number | null,
32
+ * baseThreshold?: number | null,
32
33
  * resetsAt: string | null,
33
34
  * detail: string,
34
35
  * }} AutoDispatchHold
@@ -44,6 +45,68 @@ function resetMs(resetsAt) {
44
45
  return Number.isFinite(ms) ? ms : Infinity;
45
46
  }
46
47
 
48
+ const DAY_MS = 24 * 60 * 60 * 1000;
49
+ const HOUR_MS = 60 * 60 * 1000;
50
+
51
+ /**
52
+ * The pro-rated threshold reaches this in a window's final stretch. 99, not
53
+ * 100: automatic work stops one point short of the account limit so
54
+ * interactive chats keep working until the reset (owner's choice, 2026-11-24).
55
+ * A saved 'pause above' at or above it is returned unchanged.
56
+ */
57
+ const PRO_RATE_CEILING = 99;
58
+ /** Share of a window left at which the threshold reaches the ceiling (last 2 days of a week). */
59
+ const PRO_RATE_FULL_FRACTION = 2 / 7;
60
+ /** Length of each usage window kind. */
61
+ const WINDOW_LENGTH_MS = Object.freeze({ weekly: 7 * DAY_MS, fiveHour: 5 * HOUR_MS });
62
+
63
+ /**
64
+ * Window length from its name, or null for an unknown window.
65
+ * @param {string | null | undefined} window
66
+ * @returns {number | null}
67
+ */
68
+ function windowLengthMs(window) {
69
+ if (typeof window !== 'string') return null;
70
+ if (/weekly|seven_day/i.test(window)) return WINDOW_LENGTH_MS.weekly;
71
+ if (/five_hour|session/i.test(window)) return WINDOW_LENGTH_MS.fiveHour;
72
+ return null;
73
+ }
74
+
75
+ /**
76
+ * Effective 'pause above' value for one window: the owner would rather touch
77
+ * the limit than leave credits unspent, so the threshold rises from `base`
78
+ * (whole window left) linearly to PRO_RATE_CEILING once only
79
+ * PRO_RATE_FULL_FRACTION of the window is left. Never below `base`; unknown
80
+ * window, missing/unparseable reset, or non-finite base -> base unchanged.
81
+ * @param {{ base: number, window: string | null | undefined, resetsAt: string | null | undefined, now: number }} args
82
+ * @returns {number}
83
+ */
84
+ function proRatedThreshold({ base, window, resetsAt, now }) {
85
+ if (typeof base !== 'number' || !Number.isFinite(base)) return base;
86
+ if (base >= PRO_RATE_CEILING) return base;
87
+ const length = windowLengthMs(window);
88
+ if (length === null) return base;
89
+ const reset = resetMs(resetsAt);
90
+ if (!Number.isFinite(reset)) return base;
91
+ const f = (reset - now) / length;
92
+ if (!Number.isFinite(f)) return base;
93
+ if (f >= 1) return base;
94
+ if (f <= PRO_RATE_FULL_FRACTION) return PRO_RATE_CEILING;
95
+ const value = base + (PRO_RATE_CEILING - base) * (1 - f) / (1 - PRO_RATE_FULL_FRACTION);
96
+ return Math.max(base, value);
97
+ }
98
+
99
+ /**
100
+ * Human time left: "1.7 days", "4.0 h", "25 min".
101
+ * @param {number} ms
102
+ * @returns {string}
103
+ */
104
+ function formatTimeLeft(ms) {
105
+ if (ms >= DAY_MS) return `${(ms / DAY_MS).toFixed(1)} days`;
106
+ if (ms >= HOUR_MS) return `${(ms / HOUR_MS).toFixed(1)} h`;
107
+ return `${String(Math.max(0, Math.round(ms / 60_000)))} min`;
108
+ }
109
+
47
110
  /**
48
111
  * @param {{
49
112
  * firePolicy: string | null | undefined,
@@ -66,14 +129,13 @@ function evaluateAutoDispatchHold({ firePolicy, threshold, reading, now }) {
66
129
  }
67
130
  if (reading == null || reading.known !== true) return null;
68
131
  if (typeof threshold !== 'number' || !Number.isFinite(threshold)) return null;
69
- const limit = threshold;
70
132
 
71
133
  /** @type {UsageWindow[]} */
72
134
  const candidates = Array.isArray(reading.windows) && reading.windows.length > 0
73
135
  ? reading.windows
74
136
  : [{ window: reading.window, percent: reading.percent, resetsAt: reading.resetsAt }];
75
137
 
76
- /** @type {{ window: string | null, percent: number, resetsAt: string | null, resetAt: number } | null} */
138
+ /** @type {{ window: string | null, percent: number, resetsAt: string | null, resetAt: number, limit: number } | null} */
77
139
  let pick = null;
78
140
  for (const c of candidates) {
79
141
  if (!c) continue;
@@ -81,21 +143,54 @@ function evaluateAutoDispatchHold({ firePolicy, threshold, reading, now }) {
81
143
  if (typeof percent !== 'number' || !Number.isFinite(percent)) continue;
82
144
  const resetAt = resetMs(c.resetsAt);
83
145
  if (resetAt <= now) continue; // already reset: its old reading no longer applies
146
+ const limit = utilizationHold.proRatedThreshold({ base: threshold, window: c.window, resetsAt: c.resetsAt, now });
84
147
  if (percent < limit) continue;
85
148
  if (pick === null || resetAt > pick.resetAt || (resetAt === pick.resetAt && percent > pick.percent)) {
86
- pick = { window: c.window ?? null, percent, resetsAt: c.resetsAt ?? null, resetAt };
149
+ pick = { window: c.window ?? null, percent, resetsAt: c.resetsAt ?? null, resetAt, limit };
87
150
  }
88
151
  }
89
152
  if (pick === null) return null;
90
153
 
154
+ const proRated = pick.limit !== threshold
155
+ ? ` (pause above ${String(threshold)}%, pro-rated: ${formatTimeLeft(pick.resetAt - now)} to reset)`
156
+ : '';
157
+ const shownLimit = Math.round(pick.limit * 10) / 10;
91
158
  return {
92
159
  reason: 'utilization-held',
93
160
  window: pick.window,
94
161
  percent: pick.percent,
95
- threshold: limit,
162
+ threshold: pick.limit,
163
+ baseThreshold: threshold,
96
164
  resetsAt: pick.resetsAt,
97
- detail: `${pick.window ?? 'binding'} window at ${String(pick.percent)}% ≥ ${String(limit)}%, resets ${pick.resetsAt ?? 'unknown'}`,
165
+ detail: `${pick.window ?? 'binding'} window at ${String(pick.percent)}% ≥ ${String(shownLimit)}%${proRated}, resets ${pick.resetsAt ?? 'unknown'}`,
98
166
  };
99
167
  }
100
168
 
101
- module.exports = { evaluateAutoDispatchHold };
169
+ const MINUTE_MS = 60_000;
170
+
171
+ /**
172
+ * Identity of one auto-dispatch hold: reason + window + reset, for the
173
+ * once-per-hold audit keys. The usage API returns a different resets_at string
174
+ * for the same reset on almost every fetch (329 distinct strings for one
175
+ * weekly reset across 640 heartbeat lines, about ±0.5 s either side of the
176
+ * minute), so the reset is rounded to the nearest whole minute. An unparseable
177
+ * resetsAt is used raw ('' when absent) so the key stays stable.
178
+ * @param {{ reason: string, window?: string | null, resetsAt?: string | null }} hold
179
+ * @returns {string}
180
+ */
181
+ function holdIdentityKey(hold) {
182
+ const raw = hold.resetsAt ?? '';
183
+ const ms = typeof hold.resetsAt === 'string' ? Date.parse(hold.resetsAt) : NaN;
184
+ const reset = Number.isFinite(ms) ? new Date(Math.round(ms / MINUTE_MS) * MINUTE_MS).toISOString() : raw;
185
+ return `${hold.reason}|${hold.window ?? ''}|${reset}`;
186
+ }
187
+
188
+ const utilizationHold = {
189
+ evaluateAutoDispatchHold,
190
+ holdIdentityKey,
191
+ proRatedThreshold,
192
+ PRO_RATE_CEILING,
193
+ PRO_RATE_FULL_FRACTION,
194
+ WINDOW_LENGTH_MS,
195
+ };
196
+ module.exports = utilizationHold;