claude-code-session-manager 0.143.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 (119) hide show
  1. package/README.md +3 -1
  2. package/dist/assets/AppSettings-Z68gQiVE.js +2 -0
  3. package/dist/assets/{History-DTttbvPb.js → History-C3E6y_7t.js} +2 -2
  4. package/dist/assets/HomeClaudeConfig-Yd1vXzBn.js +5 -0
  5. package/dist/assets/{Panel-B_D4Bg7L.js → Panel-CnfWs46Z.js} +1 -1
  6. package/dist/assets/ProjectClaudeConfig-CP0Wsg-H.js +26 -0
  7. package/dist/assets/Scheduler-D8un7N3B.js +16 -0
  8. package/dist/assets/{SkillReferenceGraph-D1b2aiol.js → SkillReferenceGraph-DRtZV1Al.js} +1 -1
  9. package/dist/assets/{Skills-cfV7sgk6.js → Skills-Bg5O2Hyn.js} +23 -23
  10. package/dist/assets/{TiptapBody-DVXtEIVy.js → TiptapBody-BdzoBmqu.js} +27 -27
  11. package/dist/assets/{Toggle-CYajnSdx.js → Toggle-Dt5K1OXt.js} +1 -1
  12. package/dist/assets/{VoiceButton-DJ4gGRuE.js → VoiceButton-CTLyRgdF.js} +1 -1
  13. package/dist/assets/{historyTotals-D3MoHY2U.js → historyTotals-B2_KWBga.js} +1 -1
  14. package/dist/assets/{index-CdTppjKR.js → index-446b69rr.js} +698 -697
  15. package/dist/assets/{index-DVHIHoJf.css → index-BJ5TJvmz.css} +1 -1
  16. package/dist/index.html +2 -2
  17. package/dist-web/app.css +1 -1
  18. package/dist-web/app.js +439 -436
  19. package/package.json +4 -2
  20. package/plugins/session-manager-dev/skills/develop/SKILL.md +14 -13
  21. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +16 -2
  22. package/plugins/session-manager-dev/skills/maintaining-md-network/weekly-consolidation.md +87 -0
  23. package/scripts/README.md +1 -1
  24. package/scripts/scheduler-mcp-server.cjs +77 -0
  25. package/src/main/adminRouteRegistry.cjs +6 -0
  26. package/src/main/agentLibrary.cjs +60 -11
  27. package/src/main/agentsIpc.cjs +19 -0
  28. package/src/main/build-info.json +4 -4
  29. package/src/main/chatRunner.cjs +109 -0
  30. package/src/main/health.cjs +59 -17
  31. package/src/main/index.cjs +4 -0
  32. package/src/main/ipcSchemas.cjs +50 -1
  33. package/src/main/lib/claude/agentArmory.cjs +128 -0
  34. package/src/main/lib/claude/agentModelResolve.cjs +3 -2
  35. package/src/main/lib/claude/agentSnapshot.cjs +24 -3
  36. package/src/main/lib/claude/builtinTools.cjs +110 -0
  37. package/src/main/lib/claude/environmentProfiles.cjs +1 -1
  38. package/src/main/lib/claude/headlessMcpServers.cjs +138 -0
  39. package/src/main/lib/claude/jobSandboxPolicy.cjs +8 -2
  40. package/src/main/lib/claude/personaToolScope.cjs +77 -6
  41. package/src/main/lib/epic/epicDepsSync.cjs +66 -0
  42. package/src/main/lib/epic/epicOutsideRead.cjs +38 -1
  43. package/src/main/lib/epic/epicSettle.cjs +48 -4
  44. package/src/main/lib/epic/epicSpawnPlan.cjs +3 -1
  45. package/src/main/lib/epic/epicValidationHook.cjs +9 -1
  46. package/src/main/lib/epic/planReviewInput.cjs +123 -0
  47. package/src/main/lib/epic/restorableSessions.cjs +1 -0
  48. package/src/main/lib/epic/scriptStartedBy.cjs +71 -0
  49. package/src/main/lib/externalContract.cjs +12 -0
  50. package/src/main/lib/feedback-remote/createdProjects.cjs +291 -0
  51. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +24 -2
  52. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +24 -3
  53. package/src/main/lib/feedback-remote/pendingReplies.cjs +8 -4
  54. package/src/main/lib/feedback-remote/projectCreate.cjs +415 -0
  55. package/src/main/lib/feedback-remote/replyClaims.cjs +15 -6
  56. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +29 -1
  57. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +43 -2
  58. package/src/main/lib/feedback-remote/servicePairLocalRoutes.cjs +91 -0
  59. package/src/main/lib/feedback-remote/servicePairings.cjs +47 -7
  60. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +99 -1
  61. package/src/main/lib/git/gitWorktree.cjs +1 -1
  62. package/src/main/lib/git/worktreeDeps.cjs +9 -3
  63. package/src/main/lib/mcpToolCatalog.cjs +43 -5
  64. package/src/main/lib/mcpToolsProbe.cjs +19 -2
  65. package/src/main/lib/packs/packCatalog.cjs +98 -5
  66. package/src/main/lib/persona-macro/agentPersonaSchema.cjs +6 -0
  67. package/src/main/lib/persona-macro/builtinMacros.cjs +6 -4
  68. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +9 -0
  69. package/src/main/lib/persona-macro/personaLoadout.cjs +58 -0
  70. package/src/main/lib/persona-macro/personaMerge.cjs +11 -3
  71. package/src/main/lib/persona-macro/personaUpgrade.cjs +96 -0
  72. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +1 -1
  73. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +94 -0
  74. package/src/main/lib/prd/prdCreate.cjs +48 -5
  75. package/src/main/lib/prd/prdFrontmatter.cjs +5 -2
  76. package/src/main/lib/prd/prdMcpReachWarnings.cjs +44 -0
  77. package/src/main/lib/prd/prdSandboxWarnings.cjs +49 -0
  78. package/src/main/lib/process/peerChatSession.cjs +165 -0
  79. package/src/main/lib/project-pages/videoScriptPress.cjs +6 -0
  80. package/src/main/lib/project-pages/videoScriptRunRoute.cjs +24 -4
  81. package/src/main/lib/promptSessionSchema.cjs +2 -0
  82. package/src/main/lib/scheduler/baselineGate.cjs +31 -2
  83. package/src/main/lib/scheduler/planRecordHarvest.cjs +104 -12
  84. package/src/main/lib/scheduler/planReleaseRoute.cjs +110 -0
  85. package/src/main/lib/scheduler/planReviewSchema.cjs +182 -0
  86. package/src/main/lib/scheduler/planReviewStats.cjs +63 -0
  87. package/src/main/lib/scheduler/planReviewStore.cjs +128 -0
  88. package/src/main/lib/scheduler/sandboxEnvironmentLimit.cjs +141 -0
  89. package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
  90. package/src/main/lib/scheduler/upgradeDrain.cjs +32 -5
  91. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +12 -2
  92. package/src/main/lib/tasks/memoryConsolidation.cjs +109 -37
  93. package/src/main/lib/tasks/taskAdminRoutes.cjs +26 -14
  94. package/src/main/lib/tasks/taskRun.cjs +3 -1
  95. package/src/main/lib/tasks/weeklyConsolidationInputs.cjs +178 -0
  96. package/src/main/projectPages.cjs +22 -14
  97. package/src/main/pty.cjs +3 -0
  98. package/src/main/runVerify.cjs +3 -2
  99. package/src/main/scheduler/planReviewHold.cjs +140 -0
  100. package/src/main/scheduler/prdParser.cjs +1 -0
  101. package/src/main/scheduler/reviewLadder.cjs +2 -0
  102. package/src/main/scheduler/utilizationHold.cjs +7 -2
  103. package/src/main/scheduler.cjs +532 -78
  104. package/src/main/seedAgentPersonas.cjs +11 -6
  105. package/src/main/seedStatus.cjs +1 -1
  106. package/src/main/templates/PRD_AUTHORING.md +16 -1
  107. package/src/main/webRemote.cjs +47 -7
  108. package/src/preload/api.d.ts +71 -1
  109. package/src/preload/apiSurface.json +28 -0
  110. package/src/preload/index.cjs +9 -0
  111. package/src/seed/agents/architect.md +28 -43
  112. package/src/seed/agents/dev-lead.md +3 -1
  113. package/src/seed/agents/md-network-curator.md +27 -0
  114. package/src/seed/agents/plan-reviewer.md +47 -0
  115. package/src/seed/agents/validator.md +2 -1
  116. package/dist/assets/AppSettings-BO4jDVGO.js +0 -2
  117. package/dist/assets/HomeClaudeConfig-DADP5bfn.js +0 -3
  118. package/dist/assets/ProjectClaudeConfig-DPnDJKcr.js +0 -26
  119. package/dist/assets/Scheduler-CNLjn90m.js +0 -16
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * planReviewHold.cjs — pure rule deciding which plans need an independent plan
5
+ * review, which pending rows are held 'held: plan-review' until it lands, and
6
+ * which holds have timed out. Shaped like computePreflightHolds so the tick can
7
+ * merge `held` into heldSlugs. No fs: the caller passes queue rows and the
8
+ * stored review records ({ [bareValidateSlug]: record }).
9
+ *
10
+ * Record fields read (all optional): `release` (non-null object, as planReviewStore.recordPlanRelease writes it = released),
11
+ * `firstReviewAt` / `reviews[0].at` (hold start when a review exists).
12
+ */
13
+
14
+ const { bareSlug } = require('../lib/prd/depSlugResolve.cjs');
15
+
16
+ const DEFAULT_HOLD_MINUTES = 240;
17
+ const REVIEWER_AGENT = 'plan-reviewer';
18
+
19
+ function holdMsFromEnv(env = process.env) {
20
+ const n = Number(env.SM_PLAN_REVIEW_HOLD_MINUTES);
21
+ const minutes = Number.isFinite(n) && n > 0 ? n : DEFAULT_HOLD_MINUTES;
22
+ return minutes * 60 * 1000;
23
+ }
24
+
25
+ function planReviewEnabled(env = process.env) {
26
+ return String(env.SM_PLAN_REVIEW ?? '') !== '0';
27
+ }
28
+
29
+ /**
30
+ * Transitive dependsOn walk from a validator row. Same-cwd only (a row with no
31
+ * cwd is kept), bare-slug matching. Excludes the validator and reviewer rows.
32
+ * @param {any} validateRow
33
+ * @param {any[]} rows
34
+ * @returns {any[]}
35
+ */
36
+ function planMembers(validateRow, rows) {
37
+ if (!validateRow || !Array.isArray(rows)) return [];
38
+ const scoped = rows.filter((r) => r && (!validateRow.cwd || r.cwd == null || r.cwd === validateRow.cwd));
39
+ const byBare = new Map();
40
+ for (const r of scoped) {
41
+ const b = bareSlug(r.slug);
42
+ if (!byBare.has(b)) byBare.set(b, []);
43
+ byBare.get(b).push(r);
44
+ }
45
+ const members = [];
46
+ const seen = new Set();
47
+ const visited = new Set();
48
+ const queue = Array.isArray(validateRow.dependsOn) ? [...validateRow.dependsOn] : [];
49
+ while (queue.length) {
50
+ const dep = bareSlug(queue.shift());
51
+ if (visited.has(dep)) continue;
52
+ visited.add(dep);
53
+ for (const row of byBare.get(dep) ?? []) {
54
+ if (row === validateRow || row.slug === validateRow.slug) continue;
55
+ if (row.agentType === REVIEWER_AGENT || row.agentType === 'validator') continue;
56
+ if (!seen.has(row.slug)) {
57
+ seen.add(row.slug);
58
+ members.push(row);
59
+ }
60
+ for (const d of row.dependsOn ?? []) if (!visited.has(bareSlug(d))) queue.push(d);
61
+ }
62
+ }
63
+ return members;
64
+ }
65
+
66
+ /** True when >= 3 members, or any member depends on another member. */
67
+ function qualifiesForReview(members) {
68
+ if (!Array.isArray(members)) return false;
69
+ if (members.length >= 3) return true;
70
+ const bares = new Set(members.map((m) => bareSlug(m.slug)));
71
+ return members.some((m) => (m.dependsOn ?? []).some(
72
+ (d) => bares.has(bareSlug(d)) && bareSlug(d) !== bareSlug(m.slug),
73
+ ));
74
+ }
75
+
76
+ function isReleased(record) {
77
+ return !!record && record.release != null && typeof record.release === 'object';
78
+ }
79
+
80
+ function holdStartMs(validateRow, record) {
81
+ const first = record?.firstReviewAt ?? record?.reviews?.[0]?.at;
82
+ const t = Date.parse(first ?? '');
83
+ if (Number.isFinite(t)) return t;
84
+ const c = Date.parse(validateRow.createdAt ?? '');
85
+ return Number.isFinite(c) ? c : null;
86
+ }
87
+
88
+ /**
89
+ * @param {any[]} rows
90
+ * @param {Record<string, any>} reviewsByValidateSlug keyed by bare validate slug
91
+ * @param {{ now?: number, holdMs?: number }} [opts]
92
+ * @returns {{ held: Map<string, string>, needsReview: string[], expired: string[] }}
93
+ */
94
+ function computePlanReviewHolds(rows, reviewsByValidateSlug, opts = {}) {
95
+ const now = opts.now ?? Date.now();
96
+ const holdMs = opts.holdMs ?? holdMsFromEnv();
97
+ const held = new Map();
98
+ const needsReview = [];
99
+ const expired = [];
100
+ const reviews = reviewsByValidateSlug || {};
101
+ for (const v of rows || []) {
102
+ if (!v || v.status !== 'pending' || v.agentType !== 'validator' || v.planReview !== 'required') continue;
103
+ const members = planMembers(v, rows);
104
+ if (!qualifiesForReview(members)) continue;
105
+ const record = reviews[bareSlug(v.slug)];
106
+ if (isReleased(record)) continue;
107
+ const hasReview = !!record && (record.firstReviewAt || (Array.isArray(record.reviews) && record.reviews.length > 0));
108
+ if (!hasReview) needsReview.push(v.slug);
109
+ const start = holdStartMs(v, record);
110
+ if (start != null && now - start > holdMs) expired.push(v.slug);
111
+ const reason = `held: plan-review — waiting on independent review of plan ${bareSlug(v.slug)}`;
112
+ for (const m of members) {
113
+ if (m.status === 'pending') held.set(m.slug, reason);
114
+ }
115
+ }
116
+ return { held, needsReview, expired };
117
+ }
118
+
119
+ const MODEL_FAMILIES = ['opus', 'sonnet', 'haiku', 'fable'];
120
+ function familyOf(model) {
121
+ const m = String(model ?? '').toLowerCase();
122
+ return MODEL_FAMILIES.find((f) => m.includes(f)) || null;
123
+ }
124
+
125
+ /**
126
+ * The reviewer must not share the planner's model family: personaModel is kept
127
+ * unless it matches plannerModel's family, then 'opus' (persona sonnet) else 'sonnet'.
128
+ */
129
+ function reviewerModelFor(personaModel, plannerModel) {
130
+ const persona = String(personaModel ?? '').trim();
131
+ const pf = familyOf(persona);
132
+ const lf = familyOf(plannerModel);
133
+ if (persona && !(pf && lf && pf === lf)) return persona;
134
+ return pf === 'sonnet' ? 'opus' : 'sonnet';
135
+ }
136
+
137
+ module.exports = {
138
+ reviewerModelFor,
139
+ planMembers, qualifiesForReview, computePlanReviewHolds, holdMsFromEnv, planReviewEnabled,
140
+ };
@@ -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
@@ -48,8 +48,13 @@ function resetMs(resetsAt) {
48
48
  const DAY_MS = 24 * 60 * 60 * 1000;
49
49
  const HOUR_MS = 60 * 60 * 1000;
50
50
 
51
- /** The pro-rated threshold reaches this in a window's final stretch. */
52
- const PRO_RATE_CEILING = 100;
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;
53
58
  /** Share of a window left at which the threshold reaches the ceiling (last 2 days of a week). */
54
59
  const PRO_RATE_FULL_FRACTION = 2 / 7;
55
60
  /** Length of each usage window kind. */