claude-code-session-manager 0.130.3 → 0.132.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 (78) hide show
  1. package/dist/assets/{AgentLibrary-BmrXNwK8.js → AgentLibrary-C09MlPFx.js} +2 -2
  2. package/dist/assets/AppSettings-DvDKsCnD.js +2 -0
  3. package/dist/assets/{Button-UUr5giu8.js → Button-BzG_KdBC.js} +1 -1
  4. package/dist/assets/{DocumentEditorPane-C46Hj0lz.js → DocumentEditorPane-fm6zsnLM.js} +1 -1
  5. package/dist/assets/Extensions-DgxKT_OZ.js +2 -0
  6. package/dist/assets/{History-Bndupj87.js → History-Nd3bKjBq.js} +2 -2
  7. package/dist/assets/{Library-DFn0YPIW.js → Library-R71t6VAB.js} +12 -12
  8. package/dist/assets/{ListDetail-DjMn8a_3.js → ListDetail-CG50Ul7c.js} +1 -1
  9. package/dist/assets/{Panel-CIvb-XXN.js → Panel-C7EFG4eU.js} +1 -1
  10. package/dist/assets/{ProjectClaudeConfig-BQQRtMdK.js → ProjectClaudeConfig-J92iNEGC.js} +7 -7
  11. package/dist/assets/{ProvenanceBadge-ej8W2ZIK.js → ProvenanceBadge-C3KB3ILO.js} +1 -1
  12. package/dist/assets/Scheduler-DeYBA7uc.js +16 -0
  13. package/dist/assets/{Settings-DqxUna06.js → Settings-B6r7N4v-.js} +1 -1
  14. package/dist/assets/{SkillReferenceGraph-BEMTdxdD.js → SkillReferenceGraph-D7bt3fyB.js} +1 -1
  15. package/dist/assets/Skills-GpxtUrFP.js +29 -0
  16. package/dist/assets/{SourceChip-BrPci8FX.js → SourceChip-uyVMCZc7.js} +1 -1
  17. package/dist/assets/{SystemPrompt-B43hNP0X.js → SystemPrompt-Cv25uFSM.js} +1 -1
  18. package/dist/assets/{TiptapBody-B-R2Bpda.js → TiptapBody-uP8fJkbM.js} +1 -1
  19. package/dist/assets/{Toggle-DKb4x1BP.js → Toggle-DRs80cX-.js} +1 -1
  20. package/dist/assets/{ViewTabs-CcJdFZgv.js → ViewTabs-BDkvvzJ8.js} +1 -1
  21. package/dist/assets/{VoiceButton-BSH0UI3u.js → VoiceButton-Cmtz2sQt.js} +1 -1
  22. package/dist/assets/{historyTotals-5oUEu_fe.js → historyTotals-DHwAXunq.js} +1 -1
  23. package/dist/assets/index-CBCdyHbZ.js +3097 -0
  24. package/dist/assets/{index-CMCcT2yg.css → index-oXqzajWV.css} +1 -1
  25. package/dist/index.html +2 -2
  26. package/dist-web/app.css +1 -1
  27. package/dist-web/app.js +414 -390
  28. package/package.json +1 -1
  29. package/scripts/scheduler-mcp-server.cjs +83 -4
  30. package/src/main/build-info.json +4 -4
  31. package/src/main/index.cjs +11 -0
  32. package/src/main/ipcSchemas.cjs +28 -1
  33. package/src/main/lib/epic/epicMint.cjs +61 -6
  34. package/src/main/lib/epic/epicWorktreeMint.cjs +45 -4
  35. package/src/main/lib/epic/promptSessionsCreateEpic.cjs +32 -5
  36. package/src/main/lib/epic/restorableSessions.cjs +749 -0
  37. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +36 -13
  38. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +61 -0
  39. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +2 -0
  40. package/src/main/lib/git/branchSweep.cjs +9 -3
  41. package/src/main/lib/git/gitExec.cjs +8 -1
  42. package/src/main/lib/git/gitWorktree.cjs +564 -62
  43. package/src/main/lib/git/jobWorktree.cjs +3 -0
  44. package/src/main/lib/git/jobWorktreeBootLive.cjs +14 -2
  45. package/src/main/lib/mcpToolCatalog.cjs +43 -6
  46. package/src/main/lib/mcpToolsProbe.cjs +831 -0
  47. package/src/main/lib/persona-macro/builtinMacros.cjs +33 -0
  48. package/src/main/lib/persona-macro/macroJobDispatch.cjs +8 -0
  49. package/src/main/lib/persona-macro/macroJobIpc.cjs +57 -11
  50. package/src/main/lib/persona-macro/macroLibrary.cjs +40 -10
  51. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +38 -0
  52. package/src/main/lib/project-pages/competitiveMatrix.cjs +258 -0
  53. package/src/main/lib/project-pages/matrixHtml.cjs +239 -0
  54. package/src/main/lib/project-pages/matrixStore.cjs +112 -0
  55. package/src/main/lib/promptSessionSchema.cjs +5 -0
  56. package/src/main/lib/scheduler/fixPlanSlug.cjs +15 -1
  57. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -0
  58. package/src/main/lib/scheduler/scheduleJobSchema.cjs +2 -0
  59. package/src/main/lib/scheduler/scheduleJobTransitions.cjs +8 -7
  60. package/src/main/projectPages.cjs +25 -2
  61. package/src/main/promptSessionEvents.cjs +10 -6
  62. package/src/main/runVerify.cjs +8 -3
  63. package/src/main/scheduler/budget.cjs +146 -7
  64. package/src/main/scheduler/gitTreeGuard.cjs +10 -11
  65. package/src/main/scheduler/reviewLadder.cjs +60 -0
  66. package/src/main/scheduler.cjs +461 -48
  67. package/src/main/seedAgentPersonas.cjs +1 -1
  68. package/src/preload/api.d.ts +162 -2
  69. package/src/preload/apiSurface.json +21 -0
  70. package/src/preload/index.cjs +5 -0
  71. package/src/seed/agents/competitive-analyst.md +69 -0
  72. package/src/seed/agents/competitive-researcher.md +75 -0
  73. package/src/seed/agents/validator.md +2 -2
  74. package/dist/assets/AppSettings-Cs4POznd.js +0 -2
  75. package/dist/assets/Extensions-B9QdiNOV.js +0 -2
  76. package/dist/assets/Scheduler-DSVBWqRK.js +0 -16
  77. package/dist/assets/Skills-DTXehVS7.js +0 -12
  78. package/dist/assets/index-C9w-dVzo.js +0 -3090
@@ -68,10 +68,13 @@ module.exports = {
68
68
  listStrandedPins: gitWorktree.listStrandedPins,
69
69
  pinUnlandedWorktreeCommits: gitWorktree.pinUnlandedWorktreeCommits,
70
70
  resolveDefaultBranch: gitWorktree.resolveDefaultBranch,
71
+ resolveForkSha: gitWorktree.resolveForkSha,
71
72
  parseWorktreeListPorcelain: gitWorktree.parseWorktreeListPorcelain,
72
73
  reconcileWorktreesOnBoot: (cwds, opts = {}) => gitWorktree.reconcileWorktreesOnBoot(cwds, { kind: KIND, isLive: opts.isLive }),
73
74
  reclaimTerminalJobOrphans: gitWorktree.reclaimTerminalJobOrphans,
74
75
  unchangedCarriedPaths: gitWorktree.unchangedCarriedPaths,
76
+ snapshotUncommittedWork: gitWorktree.snapshotUncommittedWork,
77
+ worktreeRunCommitCount: gitWorktree.worktreeRunCommitCount,
75
78
  // Test-only escape hatch for the in-memory concurrency counter.
76
79
  _resetActiveWorktreeCountForTests(n = 0) { gitWorktree._resetActiveWorktreeCountForTests(KIND, n); },
77
80
  _getActiveWorktreeCountForTests() { return gitWorktree._getActiveWorktreeCountForTests(KIND); },
@@ -19,6 +19,13 @@
19
19
  * written) while the process is still actually running.
20
20
  * Either match logs one line naming the slug and which check held it, so a
21
21
  * persistently-skipped leak stays visible (RCA: PRD 1108).
22
+ *
23
+ * PRD 2908: scheduler.cjs now runs partitionBootOrphans BEFORE this sweep and
24
+ * passes its adopted slugs in as `adoptedSlugs`, checked first — so the sweep
25
+ * and the partition agree on adoption. A run that printed PASS and exited
26
+ * seconds before the restart (dead pid, no holder, fresh run log) is adopted
27
+ * by the partition; its checkout and sm-job branch must survive so
28
+ * reapDeadRunningJobs can land it instead of parking a stranded pin.
22
29
  */
23
30
 
24
31
  /**
@@ -26,10 +33,11 @@
26
33
  * supervisor-record → runtime.pid → run-log ladder partitionBootOrphans uses,
27
34
  * so the two boot passes agree. Default: runtime.pid alone.
28
35
  *
29
- * @param {{ bootJobs: Array<object>, claudePidAlive: (pid: number) => boolean, hasLiveHolder: (dir: string, holders?: Set<string>) => boolean, cwdHolders?: Set<string>, rowPid?: (job: object) => number|null }} deps
36
+ * @param {{ bootJobs: Array<object>, claudePidAlive: (pid: number) => boolean, hasLiveHolder: (dir: string, holders?: Set<string>) => boolean, cwdHolders?: Set<string>, rowPid?: (job: object) => number|null, adoptedSlugs?: Set<string>|Array<string> }} deps
30
37
  * @returns {(slug: string, entry: { worktree: string, branch: string|null }) => boolean}
31
38
  */
32
- function buildJobWorktreeIsLive({ bootJobs, claudePidAlive, hasLiveHolder, cwdHolders, rowPid = (j) => j.runtime && j.runtime.pid }) {
39
+ function buildJobWorktreeIsLive({ bootJobs, claudePidAlive, hasLiveHolder, cwdHolders, rowPid = (j) => j.runtime && j.runtime.pid, adoptedSlugs = [] }) {
40
+ const adopted = new Set(adoptedSlugs || []);
33
41
  const runningPidBySlug = new Map();
34
42
  for (const j of Array.isArray(bootJobs) ? bootJobs : []) {
35
43
  if (!j || j.status !== 'running') continue;
@@ -38,6 +46,10 @@ function buildJobWorktreeIsLive({ bootJobs, claudePidAlive, hasLiveHolder, cwdHo
38
46
  }
39
47
 
40
48
  return function isLive(slug, entry) {
49
+ if (adopted.has(slug)) {
50
+ console.log(`[gitWorktree] boot sweep: skipping job worktree slug=${slug} — adopted row, the reaper finalizes it`);
51
+ return true;
52
+ }
41
53
  const pid = runningPidBySlug.get(slug);
42
54
  if (pid && claudePidAlive(pid)) {
43
55
  console.log(`[gitWorktree] boot sweep: skipping job worktree slug=${slug} — running row with live pid=${pid}`);
@@ -337,6 +337,34 @@ const MCP_TOOL_CATALOG = [
337
337
  notes: "cwd is optional — defaults to the calling session's own project root (SM_PROJECT_ROOT or process.cwd()) when omitted. "
338
338
  + 'Give exactly one of `html` / `htmlPath` (absolute .html/.htm file, <= 2MB read limit).',
339
339
  },
340
+ {
341
+ name: 'project_matrix_read',
342
+ group: 'project-home',
343
+ purpose: "Load this project's saved competitive feature matrix (session-manager-operations/project-pages/matrix/matrix.json) "
344
+ + "together with its JSON Schema, via the session-manager app's admin API — the warm start for a competitive-analysis run.",
345
+ whenToUse: 'Call FIRST in a competitive-analysis run, before any research: start from the saved products, groups and features '
346
+ + 'instead of a cold start, and shape every edit to the returned `schema`. `matrix` is null when none has been saved yet.',
347
+ whenNotToUse: 'Do not use to save — use project_matrix_write. Do not read matrix.json from disk yourself: '
348
+ + 'this call returns the stored copy and the schema it must satisfy in one step.',
349
+ exampleArgs: { cwd: '/home/bilko/Projects/session-manager' },
350
+ notes: "cwd is optional — defaults to the calling session's own project root (SM_PROJECT_ROOT or process.cwd()) when omitted. "
351
+ + 'Returns { ok, matrix | null, error, path, schema }; a non-null `error` means a stored file exists but did not parse or validate.',
352
+ },
353
+ {
354
+ name: 'project_matrix_write',
355
+ group: 'project-home',
356
+ purpose: "Save this project's competitive feature matrix — ONE JSON object matching the schema project_matrix_read returns — "
357
+ + "via the session-manager app's admin API. Each call replaces the whole stored matrix.",
358
+ whenToUse: 'Use once, at the end of a competitive-analysis run, to save the finished matrix. Build the whole object from '
359
+ + 'project_matrix_read\'s result plus what your research really found, then pass it as `matrix` or — preferred for a large '
360
+ + 'matrix — write it to a local .json file and pass its absolute path as `matrixPath`. Pass `model` to record which model wrote it.',
361
+ whenNotToUse: 'Never fabricate features, products or sources — every cell must trace to something researched. Do not call it '
362
+ + 'per feature or per product: it is a single whole-matrix save. Do not use for HTML pages — use project_page_write. '
363
+ + 'The call is rejected for a matrix that fails the schema or exceeds 1MB.',
364
+ exampleArgs: { matrixPath: '/home/bilko/.cache/competitive-matrix/run/matrix.json', model: 'claude-opus-5-5' },
365
+ notes: "cwd is optional — defaults to the calling session's own project root (SM_PROJECT_ROOT or process.cwd()) when omitted. "
366
+ + 'Give exactly one of `matrix` (object) / `matrixPath` (absolute .json file, <= 1MB, parsed as JSON).',
367
+ },
340
368
  {
341
369
  name: 'project_video_write',
342
370
  group: 'project-home',
@@ -434,8 +462,9 @@ const MCP_TOOL_CATALOG = [
434
462
  name: 'macro_list',
435
463
  group: 'macros',
436
464
  purpose: "List this project's HOT KEYS macros — the saved (agent, tag, prompt) one-click buttons shown "
437
- + "in the Sessions tab's HOT KEYS strip or the Project Home button row, via the session-manager app's admin API. "
438
- + "Each macro's `surface` tells where it shows: 'sessions' = Sessions HOT KEYS strip, 'project-home' = Project Home button row.",
465
+ + "in the Sessions tab's HOT KEYS strip or as tools in Project Home ▸ Tools, via the session-manager app's admin API. "
466
+ + "Each macro's `surface` tells where it shows: 'sessions' = Sessions HOT KEYS strip, 'project-home' = a tool in "
467
+ + 'Project Home ▸ Tools, shown in every project (only what it generates is per project).',
439
468
  whenToUse: 'Use to see what macros already exist for this project (including machine-wide `*` macros and '
440
469
  + 'built-ins) before deciding whether to add, update or delete one.',
441
470
  whenNotToUse: 'WHEN NOT TO USE IT: macros are scoped to the caller\'s own project — this only ever returns '
@@ -451,13 +480,18 @@ const MCP_TOOL_CATALOG = [
451
480
  + 'the Sessions HOT KEYS strip reads from.',
452
481
  whenToUse: 'Pass `id` to update an existing macro already visible to this project; omit `id` to create a new '
453
482
  + 'one scoped to this project. Use for things like a "Publish git + npm" macro a human will press '
454
- + 'repeatedly, when they have asked for that macro to exist.',
483
+ + 'repeatedly, when they have asked for that macro to exist. A surface \'project-home\' macro is a Project Home '
484
+ + 'tool and is always saved for every project; pass `humanRequestQuote` with the human\'s words naming Project Home '
485
+ + '(or every project).',
455
486
  whenNotToUse: 'WHEN NOT TO USE IT: macros are scoped to the caller\'s own project — this call is refused if '
456
487
  + '`id` resolves to a macro not visible to this project. Built-in macros (`id` starting with `builtin-`) '
457
488
  + "cannot be edited through this route. A macro is a HUMAN's one-click button, not a task runner — never "
458
489
  + 'create or update one unless the human has actually asked for that macro to exist. '
459
490
  + 'To remove a macro use macro_delete; never rewrite it into a placeholder. '
460
- + 'Never pass `projects` unless the human asked for every project in this chat; quote their words in `humanRequestQuote`.',
491
+ + 'Never pass `projects` unless the human asked for every project in this chat; quote their words in `humanRequestQuote`. '
492
+ + 'Never save a surface \'project-home\' macro unless the human asked in this chat for a Project Home tool — it is '
493
+ + 'always saved for every project, needs `humanRequestQuote` naming Project Home (or every project), and is refused '
494
+ + 'in a scheduled job or outside a Session Manager chat session.',
461
495
  exampleArgs: {
462
496
  cwd: '/home/bilko/Projects/session-manager',
463
497
  label: 'Publish git + npm',
@@ -468,10 +502,13 @@ const MCP_TOOL_CATALOG = [
468
502
  },
469
503
  notes: "cwd is optional — defaults to the calling session's own project root (SM_PROJECT_ROOT or "
470
504
  + 'process.cwd()) when omitted. label, agentName, tag and prompt are all required strings. '
471
- + "`surface` is optional: 'sessions' = Sessions HOT KEYS strip, 'project-home' = Project Home button row. "
505
+ + "`surface` is optional: 'sessions' = Sessions HOT KEYS strip, 'project-home' = a tool in Project Home ▸ Tools. "
506
+ + "A surface 'project-home' macro is always saved for every project (only what it generates is per project); it "
507
+ + 'needs `humanRequestQuote` naming Project Home (or every project) and is refused in a scheduled job or outside '
508
+ + 'a Session Manager chat session. '
472
509
  + '`projects: ["*"]` shows the macro in every project; it needs `humanRequestQuote`, the words the human typed in '
473
510
  + 'this chat that ask for every/all projects, and is refused in a scheduled job or outside a Session Manager session. '
474
- + 'Without `projects` the macro stays scoped to this project. '
511
+ + "Without `projects`, a 'sessions' macro stays scoped to this project. "
475
512
  + '`inputs` is an optional array of { name, label, default, required, options } fields the human fills in '
476
513
  + 'when pressing the macro; reference each in the prompt as {{name}}. Omitting `inputs` on update keeps '
477
514
  + 'the existing inputs; `[]` clears them.',