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
@@ -31,6 +31,16 @@ export type UpdateCheckResult = {
31
31
  downloadUrl?: string | null;
32
32
  };
33
33
 
34
+ /** Answer of `loginItem.status()` — whether Session Manager starts at OS login, and how. */
35
+ export type LoginItemStatus = {
36
+ supported: boolean;
37
+ enabled: boolean;
38
+ mechanism: 'electron-login-item' | 'xdg-autostart' | 'launch-agent' | null;
39
+ starts: 'npx' | 'app' | null;
40
+ entryPath: string | null;
41
+ reason: string | null;
42
+ };
43
+
34
44
  export type AutoUpdaterStatus = {
35
45
  state: AutoUpdaterState;
36
46
  current: string;
@@ -113,6 +123,12 @@ export interface ImportRef {
113
123
  * src/main/lib/opsOwnership.cjs — one writer per namespace; everyone reads. */
114
124
  export type OpsWriter = 'epics' | 'scheduler' | 'project-home' | 'ui-prefs';
115
125
 
126
+ /** Result of config:can-write. */
127
+ export interface ConfigWriteAccess {
128
+ ok: boolean;
129
+ reason?: 'outside-boundary' | 'sensitive' | 'ops-root' | 'not-imported' | 'permission';
130
+ }
131
+
116
132
  export interface WriteResult {
117
133
  ok: boolean;
118
134
  mtimeMs: number;
@@ -283,7 +299,7 @@ export type McpCheckResult =
283
299
  * HomeAgentTools section. */
284
300
  export interface McpToolCatalogEntry {
285
301
  name: string;
286
- group: 'scheduler' | 'chat' | 'feedback' | 'help' | 'project-home' | 'macros' | 'customer-feedback' | 'epics' | 'agents';
302
+ group: 'scheduler' | 'chat' | 'feedback' | 'help' | 'project-home' | 'macros' | 'customer-feedback' | 'epics' | 'agents' | 'tasks';
287
303
  purpose: string;
288
304
  /** Plain one-line summary (10-90 chars) — the Dashboard row text. */
289
305
  summary: string;
@@ -352,10 +368,15 @@ export interface MacroInput {
352
368
  options?: string[];
353
369
  }
354
370
 
355
- /** Background-build descriptor on a built-in macro. */
371
+ /** Background-build descriptor on a built-in macro or a project Video tool (surface 'project-video'). */
356
372
  export interface MacroJob {
357
373
  estimateMinutes: number;
358
- artifactPaths: string[];
374
+ /** Project Video tool: repos the run may write to. */
375
+ repoPaths?: string[];
376
+ /** Project Video tool: true adds a human review step before the entry is published. */
377
+ review?: boolean;
378
+ entryKind?: 'knowledge' | 'video';
379
+ artifactPaths?: string[];
359
380
  }
360
381
 
361
382
  export interface MacroJobDispatchInput {
@@ -366,6 +387,8 @@ export interface MacroJobDispatchInput {
366
387
  /** Per-launch effort chosen in the high-effort cost dialog: one of low, medium, high, xhigh, max;
367
388
  * main refuses anything else. Omitted = the persona's own effort. */
368
389
  effort?: string;
390
+ /** The press's {{name}} input values; a project Video tool renders its prompt with them. */
391
+ inputValues?: Record<string, string>;
369
392
  }
370
393
 
371
394
  export type MacroJobDispatchResult =
@@ -379,8 +402,11 @@ export interface MacroJobStatus {
379
402
  epicId: string | null;
380
403
  slug: string;
381
404
  state: MacroJobState;
382
- status: string;
383
- reason: string | null;
405
+ /** Raw queue status; a project Video tool whose entry waits on the human reports 'awaiting_review'. */
406
+ status: 'awaiting_review' | (string & {});
407
+ reason?: string | null;
408
+ /** Project Video tool only: the video entry this run feeds (null when none matched). */
409
+ entryId?: string | null;
384
410
  startedAt: string | null;
385
411
  finishedAt: string | null;
386
412
  }
@@ -411,7 +437,7 @@ export interface Macro {
411
437
  prompt: string;
412
438
  projects: string[];
413
439
  /** Which strip shows this macro. Defaults to `'sessions'` when absent. */
414
- surface: 'sessions' | 'project-home';
440
+ surface: 'sessions' | 'project-home' | 'project-video';
415
441
  /** True for a seeded, machine-authored macro (e.g. the built-in Project Home actions). */
416
442
  builtin?: boolean;
417
443
  /** Bumped by the seed when a builtin macro's definition changes, to reseed it. */
@@ -423,7 +449,7 @@ export interface Macro {
423
449
  autoStartTargets?: string[];
424
450
  /** True lets a script start this macro via POST /admin/macros/run. */
425
451
  scriptStart?: boolean;
426
- /** Set only on built-ins whose press builds in the background. */
452
+ /** Set on built-ins whose press builds in the background, and on every project Video tool. */
427
453
  job?: MacroJob;
428
454
  }
429
455
 
@@ -440,6 +466,34 @@ export interface ClaudeConfigPatchInput extends ClaudeConfigReadInput {
440
466
  value?: unknown;
441
467
  }
442
468
 
469
+ /** toolRisk:read — scope 'user' = ~/.claude/tool-risk.json, 'project' = <cwd>/.claude/tool-risk.json. */
470
+ export interface ToolRiskReadInput {
471
+ scope: 'user' | 'project';
472
+ /** Required (absolute) for scope 'project'. */
473
+ cwd?: string | null;
474
+ }
475
+ export type ToolRiskMark = 'read' | 'write' | 'irreversible' | 'money' | 'public';
476
+ export interface ToolRiskReadResult {
477
+ ok: boolean;
478
+ path: string | null;
479
+ exists: boolean;
480
+ /** rule (mcp__srv__tool, mcp__srv__*, Bash(prefix:*), Bash(exact)) -> mark. */
481
+ marks: Record<string, ToolRiskMark>;
482
+ interactive: boolean;
483
+ error?: string;
484
+ }
485
+ export interface ToolRiskWriteInput extends ToolRiskReadInput {
486
+ marks: Record<string, ToolRiskMark>;
487
+ /** Project only (refused for 'user'). true installs guard-tool-risk into
488
+ * <cwd>/.claude/settings.json PreToolUse; false removes it; omitted keeps the file's value. */
489
+ interactive?: boolean;
490
+ }
491
+ export interface ToolRiskWriteResult {
492
+ ok: boolean;
493
+ path: string | null;
494
+ error?: string;
495
+ }
496
+
443
497
  export interface MacroSaveInput {
444
498
  id?: string;
445
499
  label: string;
@@ -447,7 +501,7 @@ export interface MacroSaveInput {
447
501
  tag: AgentPersonaTag;
448
502
  prompt: string;
449
503
  projects?: string[];
450
- surface?: 'sessions' | 'project-home';
504
+ surface?: 'sessions' | 'project-home' | 'project-video';
451
505
  /** Omitted keeps the stored list on update; `[]` clears it. */
452
506
  inputs?: MacroInput[];
453
507
  /** Same omit/clear semantics as `inputs`. */
@@ -1383,6 +1437,127 @@ export interface HistoryDashboardResult {
1383
1437
  legacyDates: string[];
1384
1438
  }
1385
1439
 
1440
+ // ────────────────────────────────────────────── Tasks (main/lib/tasks/taskIpc.cjs)
1441
+ // Request types mirror the zod schemas of the same name in main/ipcSchemas.cjs.
1442
+
1443
+ /** Mirrors ipcSchemas TaskListQuery. since/until are ISO timestamps (inclusive). */
1444
+ export interface TaskListQuery {
1445
+ cwd: string;
1446
+ since?: string;
1447
+ until?: string;
1448
+ pipeline?: string;
1449
+ runId?: string;
1450
+ step?: string;
1451
+ agent?: string;
1452
+ status?: string;
1453
+ source?: string;
1454
+ /** 1..200, default 50. */
1455
+ limit?: number;
1456
+ offset?: number;
1457
+ }
1458
+
1459
+ /** Mirrors ipcSchemas TaskGetQuery. */
1460
+ export interface TaskGetQuery {
1461
+ cwd: string;
1462
+ id: string;
1463
+ }
1464
+
1465
+ /** Mirrors ipcSchemas TaskSwitchQuery. */
1466
+ export interface TaskSwitchQuery {
1467
+ cwd: string;
1468
+ }
1469
+
1470
+ /** Mirrors ipcSchemas TaskSwitchSet. */
1471
+ export interface TaskSwitchSet {
1472
+ cwd: string;
1473
+ enabled: boolean;
1474
+ }
1475
+
1476
+ export interface TaskUsage {
1477
+ input_tokens?: number;
1478
+ output_tokens?: number;
1479
+ cache_read_input_tokens?: number;
1480
+ cache_creation_input_tokens?: number;
1481
+ [key: string]: unknown;
1482
+ }
1483
+
1484
+ /**
1485
+ * One folded ledger summary row (start ⊕ end, or an imported line) as
1486
+ * taskLedger.listTasks returns it. Hashes + byte counts only — never text.
1487
+ */
1488
+ export interface TaskSummary {
1489
+ v?: number;
1490
+ taskId: string;
1491
+ /** 'sm' (ran through Session Manager) or 'direct' (imported). */
1492
+ source?: 'sm' | 'direct' | string;
1493
+ /** Ledger status; 'running' / 'interrupted' are derived when no end line exists. */
1494
+ status: 'running' | 'interrupted' | 'ok' | 'error' | 'timeout' | 'caller_gone' | 'rate_limited' | 'spawn_failed' | string;
1495
+ cwd?: string;
1496
+ runtimeCwd?: string;
1497
+ agent?: string;
1498
+ model?: string;
1499
+ effort?: string;
1500
+ missionId?: string | null;
1501
+ priority?: string;
1502
+ caller?: { pipeline?: string; runId?: string; step?: string; attempt?: number; [key: string]: unknown };
1503
+ importId?: string;
1504
+ startedAt?: string;
1505
+ endedAt?: string;
1506
+ timeoutSec?: number;
1507
+ slotWaitSec?: number;
1508
+ slotWaitMs?: number;
1509
+ durationMs?: number;
1510
+ exitCode?: number | null;
1511
+ usage?: TaskUsage | null;
1512
+ modelUsage?: Record<string, unknown> | null;
1513
+ costUsd?: number | null;
1514
+ cliCostUsd?: number | null;
1515
+ numTurns?: number | null;
1516
+ quota?: { rateLimited: boolean; resetsAt: string | null };
1517
+ error?: string | null;
1518
+ promptSha256?: string;
1519
+ promptBytes?: number;
1520
+ outputSha256?: string;
1521
+ outputBytes?: number;
1522
+ }
1523
+
1524
+ /** The Task's body file (tasks/bodies/<taskId>.json); prompt/output capped at 1 MiB each. */
1525
+ export interface TaskBody {
1526
+ v?: number;
1527
+ taskId: string;
1528
+ startedAt?: string;
1529
+ prompt?: string;
1530
+ promptTruncated?: boolean;
1531
+ output?: string;
1532
+ outputTruncated?: boolean;
1533
+ stderrTail?: string;
1534
+ envelope?: unknown;
1535
+ }
1536
+
1537
+ /**
1538
+ * taskLedger.getTask: the summary row plus its body (null when the body
1539
+ * file is missing). sha256s/byte counts sit on the summary fields.
1540
+ */
1541
+ export interface TaskDetail extends TaskSummary {
1542
+ body: TaskBody | null;
1543
+ }
1544
+
1545
+ export type TaskListResult =
1546
+ | { ok: true; tasks: TaskSummary[]; total: number; hasMore: boolean; skippedLines: number }
1547
+ | { ok: false; error: string };
1548
+
1549
+ export type TaskGetResult =
1550
+ | { ok: true; task: TaskDetail | null }
1551
+ | { ok: false; error: string };
1552
+
1553
+ export type TaskGetSwitchResult =
1554
+ | { ok: true; enabled: boolean }
1555
+ | { ok: false; error: string };
1556
+
1557
+ export type TaskSetSwitchResult =
1558
+ | { ok: true; enabled: boolean; changedAt: string }
1559
+ | { ok: false; error: string };
1560
+
1386
1561
 
1387
1562
  export interface FileEntry {
1388
1563
  name: string;
@@ -1694,7 +1869,9 @@ export interface ProjectPageMeta {
1694
1869
  export interface ProjectVideoMeta {
1695
1870
  id: string;
1696
1871
  title: string;
1697
- kind: 'project-demo' | 'blog-post' | 'feature';
1872
+ kind: 'project-demo' | 'blog-post' | 'feature' | 'episode';
1873
+ /** Frame shape from the document's sm-demo-aspect tag; absent on older entries (treat as '16:9'). */
1874
+ aspect?: '16:9' | '9:16';
1698
1875
  /** The `Video target:` text the video was built for (a post path or URL, or a feature name); absent for a Project demo. */
1699
1876
  target?: string;
1700
1877
  style: string;
@@ -1739,14 +1916,110 @@ export interface ProjectPagesGetResult {
1739
1916
  demoVideo: { path: string; mtimeMs: number } | null;
1740
1917
  }
1741
1918
 
1919
+ // ────────────────────────────────────────────── Project Pages: video review step
1920
+ // Mirrors src/main/lib/project-pages/videoReview.cjs (readReview / listReviews) and
1921
+ // src/main/lib/project-pages/videoReviewIpc.cjs (project-videos:review-list / review-decide / review-retry).
1922
+
1923
+ /** Lifecycle of one Video tool entry's human review step. */
1924
+ export type VideoReviewStatus = 'building' | 'waiting' | 'approved' | 'changes-requested';
1925
+
1926
+ /** dispatch.json — the tool run that is building (or last built) the entry. */
1927
+ export interface VideoReviewDispatch {
1928
+ entryId: string;
1929
+ macroId: string;
1930
+ /** The Epic that built the entry; approvals run there. */
1931
+ epicId: string | null;
1932
+ /** The queued PRD slug of the run. */
1933
+ slug: string;
1934
+ /** e.g. 'review' or 'final'. */
1935
+ stage: string;
1936
+ inputValues: Record<string, string>;
1937
+ extraInstructions: string;
1938
+ /** ISO timestamp. */
1939
+ dispatchedAt: string;
1940
+ }
1941
+
1942
+ /** material.json — what the tool saved for the human to look at. */
1943
+ export interface VideoReviewMaterial {
1944
+ entryId: string;
1945
+ /** Plain text — never render as HTML. */
1946
+ text: string;
1947
+ /** Review images; `path` is absolute — load via smfile://. */
1948
+ images: { name: string; path: string }[];
1949
+ /** ISO timestamp. */
1950
+ savedAt: string;
1951
+ }
1952
+
1953
+ /** decision.json — the human decision (written only by review-decide). */
1954
+ export interface VideoReviewDecision {
1955
+ entryId: string;
1956
+ decision: 'approve' | 'changes';
1957
+ /** Present when decision === 'changes'. */
1958
+ note?: string;
1959
+ /** Local-time stamp ('2026-11-22 13:05 PST'), present when decision === 'approve'. */
1960
+ at?: string;
1961
+ /** ISO timestamp. */
1962
+ decidedAt: string;
1963
+ }
1964
+
1965
+ /** One entry with a review folder, as returned by `projectPages.reviewList`. */
1966
+ export interface VideoReview {
1967
+ entryId: string;
1968
+ dispatch: VideoReviewDispatch | null;
1969
+ /** null only when the folder holds no records at all. */
1970
+ status: VideoReviewStatus | null;
1971
+ material: VideoReviewMaterial | null;
1972
+ decision: VideoReviewDecision | null;
1973
+ /** The queue job of dispatch.slug (jobStatusesBySlug), or null when there is no dispatch or no job row. */
1974
+ job: VideoReviewJob | null;
1975
+ /** True only for an approved entry whose recorded final-stage run ended failed (retryable()). */
1976
+ canRetry: boolean;
1977
+ }
1978
+
1979
+ /** The queue job behind an entry's recorded dispatch; `state` follows stateOf in macroJobStatus.cjs. */
1980
+ export interface VideoReviewJob {
1981
+ slug: string;
1982
+ state: 'queued' | 'running' | 'done' | 'failed';
1983
+ /** Raw queue status. */
1984
+ status: string | null;
1985
+ /** One-line failure reason; null unless state === 'failed'. */
1986
+ reason: string | null;
1987
+ }
1988
+
1989
+ export interface VideoReviewListPayload {
1990
+ cwd: string;
1991
+ }
1992
+
1993
+ export interface VideoReviewDecidePayload {
1994
+ cwd: string;
1995
+ entryId: string;
1996
+ decision: 'approve' | 'changes';
1997
+ /** Required (non-blank, at most 2000 chars) when decision === 'changes'. */
1998
+ note?: string;
1999
+ }
2000
+
2001
+ export type VideoReviewDecideResult =
2002
+ | { ok: true; slug: string; stage: string; decision: VideoReviewDecision }
2003
+ | { ok: false; error: string };
2004
+
2005
+ export interface VideoReviewRetryPayload {
2006
+ cwd: string;
2007
+ entryId: string;
2008
+ }
2009
+
2010
+ /** The final-stage dispatch result (macroJobDispatch); writes no decision. */
2011
+ export type VideoReviewRetryResult =
2012
+ | { ok: true; slug: string; epicId: string; entryId?: string | null; stage?: string }
2013
+ | { ok: false; error: string; activeSlug?: string };
2014
+
1742
2015
  // ────────────────────────────────────────────── Project Pages: markdown link network
1743
2016
  // Mirrors the JSDoc typedefs of the same names in src/main/lib/mdNetworkScan.cjs.
1744
2017
  // Every path is repo-relative POSIX.
1745
2018
 
1746
- /** 'hub' = the root CLAUDE.md; 'owner' = a CLAUDE.md / README.md / AGENTS.md one link from it; 'doc' = any other doc. */
2019
+ /** 'hub' = the root map doc: root AGENTS.md, else root CLAUDE.md (a root CLAUDE.md beside AGENTS.md is reached from it); 'owner' = a CLAUDE.md / README.md / AGENTS.md one link from it; 'doc' = any other doc. */
1747
2020
  export type MdNetworkNodeType = 'hub' | 'owner' | 'doc';
1748
2021
 
1749
- /** One doc reachable by links from the root CLAUDE.md. */
2022
+ /** One doc reachable by links from the root map doc (root AGENTS.md, else root CLAUDE.md). */
1750
2023
  export interface MdNetworkNode {
1751
2024
  /** Same as `path`. */
1752
2025
  id: string;
@@ -1782,6 +2055,8 @@ export interface MdNetworkBrokenLink {
1782
2055
  /** `${file}:${line} → ${target}` */
1783
2056
  where: string;
1784
2057
  detail: string;
2058
+ /** The target is not tracked in git but is gitignored or on disk here: the link works only on this machine. */
2059
+ localOnly?: boolean;
1785
2060
  }
1786
2061
 
1787
2062
  /** Docs that no link path from the root reaches, grouped by top-level folder. */
@@ -1798,13 +2073,26 @@ export interface MdNetworkOrphan {
1798
2073
  export type MdNetworkFinding = MdNetworkBrokenLink | MdNetworkOrphan;
1799
2074
 
1800
2075
  /**
1801
- * A project's markdown link network, mapped from its root CLAUDE.md, plus a per-doc
2076
+ * Two docs that share the same text (src/main/lib/mdNetworkScan.cjs via mdDuplicates.cjs
2077
+ * findDuplicates): `sharedRuns` distinct 8-word runs in common, up to 3 shared passages in
2078
+ * `samples`, `copy` when the shared runs cover at least 90% of the larger doc.
2079
+ */
2080
+ export interface MdDuplicatePair {
2081
+ a: string;
2082
+ b: string;
2083
+ sharedRuns: number;
2084
+ samples: string[];
2085
+ copy?: boolean;
2086
+ }
2087
+
2088
+ /**
2089
+ * A project's markdown link network, mapped from its root AGENTS.md, else root CLAUDE.md, plus a per-doc
1802
2090
  * census of every tracked .md (role, size, git recency, dead/stale refs, code mentions).
1803
2091
  * Orphan findings leave out docs the census puts in a record collection.
1804
2092
  */
1805
2093
  export interface MdNetwork {
1806
2094
  ok: true;
1807
- /** The root doc, 'CLAUDE.md'. */
2095
+ /** The root doc: 'AGENTS.md' when the root has one, else 'CLAUDE.md'. */
1808
2096
  root: string;
1809
2097
  /** Breadth-first from the root. */
1810
2098
  nodes: MdNetworkNode[];
@@ -1818,9 +2106,11 @@ export interface MdNetwork {
1818
2106
  scopes: string[];
1819
2107
  /** Every tracked .md; docs left unread past the 2000 cap have `lines`/`bytes` null. A failed git call adds a `warnings` entry, never an error. */
1820
2108
  census: MdCensus;
2109
+ /** Duplicated text between living docs (never history or record-collection docs), most shared first. A failure is `[]` plus a `census.warnings` entry. Optional only so older fixtures/results without it still type-check; the scan always sets it. */
2110
+ duplicates?: MdDuplicatePair[];
1821
2111
  }
1822
2112
 
1823
- /** `{ ok: false, error }` when there is nothing to map or the scan failed (not a git repo, no root CLAUDE.md, an ephemeral cwd). */
2113
+ /** `{ ok: false, error }` when there is nothing to map or the scan failed (not a git repo, no root AGENTS.md or CLAUDE.md, an ephemeral cwd). */
1824
2114
  export type MdNetworkResult = MdNetwork | { ok: false; error: string };
1825
2115
 
1826
2116
  // ────────────────────────────────────────────── Project Pages: Review MD network record
@@ -1869,10 +2159,10 @@ export type MdReviewResult = MdReviewOk | { ok: false; error: string };
1869
2159
  // Mirrors the JSDoc typedefs in src/main/lib/mdDocCensus.cjs.
1870
2160
  // Every path is repo-relative POSIX; folder strings end with '/'.
1871
2161
 
1872
- /** How agents meet a doc: 'map' = the root + its @-imports; 'scoped' = another CLAUDE.md / AGENTS.md / CLAUDE.local.md; 'agent' = .claude/, skills/, plugin agents/commands; 'record' = in a record collection and unreachable; 'doc' = anything else. */
2162
+ /** How agents meet a doc: 'map' = the root map doc (root AGENTS.md, else root CLAUDE.md), a root CLAUDE.md beside AGENTS.md, and their @-imports; 'scoped' = another CLAUDE.md / AGENTS.md / CLAUDE.local.md; 'agent' = .claude/, skills/, plugin agents/commands; 'record' = in a record collection and unreachable; 'doc' = anything else. */
1873
2163
  export type MdDocRole = 'map' | 'scoped' | 'agent' | 'record' | 'doc';
1874
2164
 
1875
- export interface MdDoc { path: string; role: MdDocRole; depth: number | null; lines: number | null; bytes: number | null; lastCommitMs: number | null; commits: number; linkedFrom: number; codeRefs: number; codeRefFiles: string[]; deadRefs: string[]; changedSince: { path: string; ms: number }[]; collection: string | null; }
2165
+ export interface MdDoc { path: string; role: MdDocRole; depth: number | null; lines: number | null; bytes: number | null; lastCommitMs: number | null; commits: number; linkedFrom: number; codeRefs: number; codeRefFiles: string[]; deadRefs: string[]; ambiguousRefs: string[]; changedSince: { path: string; ms: number }[]; collection: string | null; }
1876
2166
 
1877
2167
  /** A folder of machine-written, write-once, unlinked docs (e.g. validation records). */
1878
2168
  export interface MdRecordCollection { folder: string; docs: number; linked: number; lastCommitMs: number | null; source: 'heuristic' | 'override'; }
@@ -2506,16 +2796,25 @@ export interface SessionManagerAPI {
2506
2796
  /** Sets one key path; omit `value` to delete it. Broadcasts `config:changed`. */
2507
2797
  patch: (payload: ClaudeConfigPatchInput) => Promise<{ ok: true; path: string; data: Record<string, unknown> }>;
2508
2798
  };
2799
+ /** Tool-risk marks (System/Project) — validated by main's toolRiskMarks.cjs. */
2800
+ toolRisk: {
2801
+ read: (payload: ToolRiskReadInput) => Promise<ToolRiskReadResult>;
2802
+ write: (payload: ToolRiskWriteInput) => Promise<ToolRiskWriteResult>;
2803
+ };
2509
2804
  config: {
2510
2805
  readJson: (path: string) => Promise<ReadJsonResult>;
2511
2806
  readText: (path: string, opts?: ReadTextOptions) => Promise<ReadTextResult>;
2512
2807
  /** `writer` declares the owning surface for the single-writer law — required
2513
2808
  * when `path` is inside a project's session-manager-operations/ root. */
2514
2809
  writeJson: (path: string, data: unknown, writer?: OpsWriter) => Promise<WriteResult>;
2515
- writeText: (path: string, text: string, writer?: OpsWriter) => Promise<WriteResult>;
2810
+ /** `opts.importedBy` names the root instruction file that @-imports `path`; main
2811
+ * accepts an imported file only while that root still imports it. */
2812
+ writeText: (path: string, text: string, writer?: OpsWriter, opts?: { importedBy?: string }) => Promise<WriteResult>;
2516
2813
  listDir: (path: string, opts?: { filesOnly?: boolean; dirsOnly?: boolean; includeHidden?: boolean }) => Promise<ListDirResult>;
2517
- /** True when config:write-text would accept this path (same validateWrite). */
2518
- canWrite: (path: string) => Promise<boolean>;
2814
+ /** Whether config:write-text would accept this path (same decision, plus a W_OK
2815
+ * probe); `opts.importedBy` is passed through exactly as for writeText. A refusal
2816
+ * carries the reason the UI explains. */
2817
+ canWrite: (path: string, opts?: { importedBy?: string }) => Promise<ConfigWriteAccess>;
2519
2818
  exists: (path: string) => Promise<boolean>;
2520
2819
  watch: (paths: string[], opts?: { depth?: 0 | 1 | 2 }) => void;
2521
2820
  unwatch: (paths: string[], opts?: { depth?: 0 | 1 | 2 }) => void;
@@ -2649,9 +2948,18 @@ export interface SessionManagerAPI {
2649
2948
  dashboard: (req: HistoryDashboardRequest) => Promise<HistoryDashboardResult>;
2650
2949
  /** This usage week's validated-PRDs-per-usage efficiency, per project (loopEfficiency.cjs). */
2651
2950
  loopEfficiency: () => Promise<LoopEfficiencyResult>;
2951
+ /** Validator quality per project: first-pass + refuted rates, fix waves, escapes, weekly top miss (validationQuality.cjs). */
2952
+ validationQuality: () => Promise<{ ok: true; projects: ValidationQualityProject[] } | { ok: false; error: string }>;
2652
2953
  /** Fires (throttled to 1/5 s) when main appends days to the rollup. Returns unsubscribe. */
2653
2954
  onUpdated: (handler: () => void) => () => void;
2654
2955
  };
2956
+ /** Scheduler Tasks section (taskIpc.cjs). setSwitch is desktop-only (remote 'deny'). */
2957
+ tasks: {
2958
+ list: (q: TaskListQuery) => Promise<TaskListResult>;
2959
+ get: (q: TaskGetQuery) => Promise<TaskGetResult>;
2960
+ getSwitch: (q: TaskSwitchQuery) => Promise<TaskGetSwitchResult>;
2961
+ setSwitch: (q: TaskSwitchSet) => Promise<TaskSetSwitchResult>;
2962
+ };
2655
2963
  schedule: {
2656
2964
  state: () => Promise<ScheduleStateSnapshot>;
2657
2965
  /** Machine-wide claude -p slot pool (sessionSlots.cjs): total/inUse/holders + [min,max]/default/envOverride. */
@@ -2799,8 +3107,8 @@ export interface SessionManagerAPI {
2799
3107
  /** Read the project-pages library (knowledge/<id>/ pages and videos/<id>/ videos, each with its meta) as a `ProjectPagesGetResult`; empty lists if nothing exists yet. Never fires an LLM call. */
2800
3108
  get: (cwd: string) => Promise<ProjectPagesGetResult>;
2801
3109
  /** Map the project's markdown link network from its root CLAUDE.md (read-only, bounded, no LLM) for the Tools pane. Scans on every call — no watcher, no cache. `ok:false` (with `error`) for a cwd `get` answers with empty lists (tmpdir / linked worktree), a folder that is not a git repo, or no root CLAUDE.md; rejects on an invalid cwd, like `get`. */
2802
- mdNetwork: (payload: { cwd: string; recordFolders?: string[]; docFolders?: string[] }) => Promise<MdNetworkResult>;
2803
- /** Read the newest Review MD network record (reviews/docs/) and each given Epic id's validation record paths (reviews/validation/<id>/*.md). Read-only, no watcher, no cache, no LLM. `ok:false` for an ephemeral cwd; rejects on an invalid cwd or a bad Epic id. */
3110
+ mdNetwork: (payload: { cwd: string }) => Promise<MdNetworkResult>;
3111
+ /** Read the newest Review MD network record (reviews/docs/) and each given Epic id's validation record paths (session-manager-operations/plan-records/<id>/*.md, then legacy reviews/validation/<id>/*.md history). Read-only, no watcher, no cache, no LLM. `ok:false` for an ephemeral cwd; rejects on an invalid cwd or a bad Epic id. */
2804
3112
  mdReview: (payload: { cwd: string; epicIds?: string[] }) => Promise<MdReviewResult>;
2805
3113
  /** Read the saved Competitor matrix (project-pages/matrix/matrix.json) — read-only; writes go through project_matrix_write. */
2806
3114
  matrix: (payload: { cwd: string }) => Promise<CompetitorMatrixResult>;
@@ -2812,6 +3120,12 @@ export interface SessionManagerAPI {
2812
3120
  rename: (cwd: string, kind: 'knowledge' | 'video', id: string, title: string) => Promise<{ ok: true; title: string }>;
2813
3121
  /** Remove exactly one library entry folder. Rejects on a bad id or missing entry. */
2814
3122
  delete: (cwd: string, kind: 'knowledge' | 'video', id: string) => Promise<{ ok: true }>;
3123
+ /** List every Video tool entry with a review folder, newest record first. Read-only; rejects on an invalid cwd. */
3124
+ reviewList: (payload: VideoReviewListPayload) => Promise<VideoReview[]>;
3125
+ /** The human review decision for a 'waiting' entry: 'approve' queues the final run in the building Epic, 'changes' re-runs the review stage with the note. Desktop only (never via the phone relay); one in-flight decide per entry. */
3126
+ reviewDecide: (payload: VideoReviewDecidePayload) => Promise<VideoReviewDecideResult>;
3127
+ /** Re-dispatch the final stage of an approved entry whose final run failed (canRetry), reusing the recorded approval and inputs. Desktop only (never via the phone relay); one in-flight decide/retry per entry. */
3128
+ reviewRetry: (payload: VideoReviewRetryPayload) => Promise<VideoReviewRetryResult>;
2815
3129
  /** Fires whenever a watched cwd's knowledge/videos library is added/changed/removed, carrying the freshly read library result. */
2816
3130
  onChanged: (handler: (payload: { cwd: string } & ProjectPagesGetResult) => void) => () => void;
2817
3131
  };
@@ -2855,6 +3169,12 @@ export interface SessionManagerAPI {
2855
3169
  * renderer needs per-row badges without a separate git call per file. */
2856
3170
  fileStatus: (cwd: string) => Promise<GitFileStatusMap>;
2857
3171
  };
3172
+ loginItem: {
3173
+ status: () => Promise<LoginItemStatus>;
3174
+ setEnabled: (
3175
+ enabled: boolean,
3176
+ ) => Promise<{ ok: true; status: LoginItemStatus } | { ok: false; error: string }>;
3177
+ };
2858
3178
  updater: {
2859
3179
  status: () => Promise<AutoUpdaterStatus>;
2860
3180
  check: () => Promise<AutoUpdaterStatus>;
@@ -3226,6 +3546,29 @@ interface LoopEfficiencyRow {
3226
3546
  executorUsd: number;
3227
3547
  usdPerVerified: number | null;
3228
3548
  }
3549
+ interface ValidationQualityEscape {
3550
+ fixPrd: string;
3551
+ escapedPrd: string;
3552
+ verifiedBy: string | null;
3553
+ missKind: string;
3554
+ reason: string;
3555
+ at: string;
3556
+ }
3557
+ interface ValidationQualityProject {
3558
+ cwd: string;
3559
+ project: string;
3560
+ firstPass: { pct: number | null; prds: string[] };
3561
+ refuted: { pct: number | null; prds: string[] };
3562
+ fixWaves: { perPlan: number | null; plans: { plan: string; fixWaves: string[] }[] };
3563
+ escapes: ValidationQualityEscape[];
3564
+ week: {
3565
+ fromMs: number;
3566
+ toMs: number;
3567
+ topMiss: null | { missKind: string; count: number; prds: string[]; reasons: string[]; proposal: string };
3568
+ /** REFUTED verdicts recorded before checked JSON verdicts — no miss kind, kept out of topMiss. */
3569
+ unclassified: { count: number; prds: string[]; reasons: string[] };
3570
+ };
3571
+ }
3229
3572
  interface LoopEfficiencyResult {
3230
3573
  fromMs: number;
3231
3574
  toMs: number;