claude-code-session-manager 0.138.0 → 0.140.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 (194) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +352 -79
  3. package/dist/assets/AppSettings-CMFEM68R.js +2 -0
  4. package/dist/assets/History--JwsFnbn.js +2 -0
  5. package/dist/assets/HomeClaudeConfig-ijEXs--3.js +3 -0
  6. package/dist/assets/{Panel-CeDiyuNn.js → Panel-CALyU0pe.js} +1 -1
  7. package/dist/assets/ProjectClaudeConfig-sdlA-fUb.js +26 -0
  8. package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-CFMK8NJh.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
  10. package/dist/assets/Skills-DtRzghn5.js +67 -0
  11. package/dist/assets/{TiptapBody-D1kTj-tn.js → TiptapBody-DApeu7x8.js} +60 -54
  12. package/dist/assets/ViewTabs-B7qLXRAH.js +1 -0
  13. package/dist/assets/{VoiceButton-CZeyPM31.js → VoiceButton-DtStfv1H.js} +1 -1
  14. package/dist/assets/{historyTotals-B00l64Jw.js → historyTotals-ydfnwepc.js} +1 -1
  15. package/dist/assets/index-CtxruO1L.js +3121 -0
  16. package/dist/assets/{index-62tyjEQB.css → index-DKXdXfka.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +467 -451
  20. package/package.json +17 -6
  21. package/plugins/AGENTS.md +60 -0
  22. package/plugins/CLAUDE.md +1 -60
  23. package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
  24. package/plugins/session-manager-dev/skills/builder/SKILL.md +12 -4
  25. package/plugins/session-manager-dev/skills/builder/scripts/publish-preflight.cjs +255 -0
  26. package/plugins/session-manager-dev/skills/develop/SKILL.md +36 -22
  27. package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
  28. package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
  29. package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
  30. package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
  31. package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
  32. package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
  33. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
  34. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
  35. package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
  36. package/scripts/README.md +2 -0
  37. package/scripts/hooks/guard-tool-risk.cjs +91 -0
  38. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
  39. package/scripts/ops-sweep.cjs +53 -23
  40. package/scripts/scheduler-mcp-server.cjs +360 -35
  41. package/src/main/build-info.json +4 -4
  42. package/src/main/chatRunner.cjs +2 -2
  43. package/src/main/config.cjs +112 -8
  44. package/src/main/docEdit.cjs +6 -1
  45. package/src/main/exchanges.cjs +70 -5
  46. package/src/main/files.cjs +7 -27
  47. package/src/main/health.cjs +48 -15
  48. package/src/main/historyAggregator.cjs +172 -63
  49. package/src/main/historyDashboard.cjs +87 -17
  50. package/src/main/index.cjs +78 -4
  51. package/src/main/ipcSchemas.cjs +233 -20
  52. package/src/main/lib/AGENTS.md +54 -0
  53. package/src/main/lib/CLAUDE.md +1 -54
  54. package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
  55. package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
  56. package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
  57. package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
  58. package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
  59. package/src/main/lib/claude/effectiveModelInfo.cjs +92 -22
  60. package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
  61. package/src/main/lib/claude/modelPricing.cjs +148 -0
  62. package/src/main/lib/claude/personaToolScope.cjs +12 -6
  63. package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
  64. package/src/main/lib/claude/runClaudeP.cjs +6 -1
  65. package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
  66. package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
  67. package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
  68. package/src/main/lib/ephemeralCwd.cjs +37 -2
  69. package/src/main/lib/epic/delegationReadiness.cjs +42 -9
  70. package/src/main/lib/epic/epicAdminRoutes.cjs +121 -0
  71. package/src/main/lib/epic/epicJobReceipt.cjs +87 -0
  72. package/src/main/lib/epic/epicOutsideRead.cjs +423 -0
  73. package/src/main/lib/epic/epicOutsideState.cjs +233 -0
  74. package/src/main/lib/epic/epicSettle.cjs +1 -1
  75. package/src/main/lib/epic/epicStateWatcher.cjs +157 -0
  76. package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
  77. package/src/main/lib/epic/epicValidationHook.cjs +24 -4
  78. package/src/main/lib/epic/externalRef.cjs +37 -0
  79. package/src/main/lib/epic/externalRefIndex.cjs +136 -0
  80. package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
  81. package/src/main/lib/epic/restorableSessions.cjs +151 -17
  82. package/src/main/lib/epic/transcriptUsage.cjs +197 -0
  83. package/src/main/lib/externalContract.cjs +137 -0
  84. package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +176 -5
  85. package/src/main/lib/feedback-remote/crossProjectReply.cjs +186 -9
  86. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -6
  87. package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +50 -8
  88. package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +218 -4
  89. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +19 -3
  90. package/src/main/lib/feedback-remote/feedbackImages.cjs +171 -0
  91. package/src/main/lib/feedback-remote/localAdminHttp.cjs +11 -10
  92. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +167 -21
  93. package/src/main/lib/feedback-remote/needsYouAdminRoutes.cjs +133 -0
  94. package/src/main/lib/feedback-remote/needsYouIpc.cjs +50 -0
  95. package/src/main/lib/feedback-remote/needsYouStore.cjs +285 -0
  96. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
  97. package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
  98. package/src/main/lib/git/branchSweep.cjs +209 -4
  99. package/src/main/lib/git/gitWorktree.cjs +41 -5
  100. package/src/main/lib/guardShims.cjs +1 -1
  101. package/src/main/lib/historyRollup.cjs +58 -5
  102. package/src/main/lib/insideHome.cjs +27 -1
  103. package/src/main/lib/mcpToolCatalog.cjs +232 -25
  104. package/src/main/lib/mdDocCensus.cjs +59 -78
  105. package/src/main/lib/mdDocRefs.cjs +71 -93
  106. package/src/main/lib/mdNetworkScan.cjs +245 -250
  107. package/src/main/lib/mdReviewRecord.cjs +22 -9
  108. package/src/main/lib/memoryMdNetwork.cjs +5 -12
  109. package/src/main/lib/opsOwnership.cjs +18 -2
  110. package/src/main/lib/opsRetentionSettings.cjs +28 -4
  111. package/src/main/lib/persona-macro/agentAdminRoutes.cjs +121 -0
  112. package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
  113. package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
  114. package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
  115. package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
  116. package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
  117. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
  118. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
  119. package/src/main/lib/prd/depSlugResolve.cjs +104 -4
  120. package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
  121. package/src/main/lib/prd/prdCreate.cjs +351 -23
  122. package/src/main/lib/prd/prdDisposition.cjs +11 -2
  123. package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
  124. package/src/main/lib/process/loginItem.cjs +171 -0
  125. package/src/main/lib/process/loginItemPlan.cjs +193 -0
  126. package/src/main/lib/project-pages/playerBridge.cjs +4 -0
  127. package/src/main/lib/project-pages/videoReview.cjs +268 -0
  128. package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
  129. package/src/main/lib/promptSessionSchema.cjs +4 -0
  130. package/src/main/lib/remoteTranscriptTail.cjs +32 -1
  131. package/src/main/lib/scheduler/cpuSample.cjs +131 -4
  132. package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
  133. package/src/main/lib/scheduler/loadGate.cjs +24 -6
  134. package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
  135. package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
  136. package/src/main/lib/scheduler/queueStore.cjs +7 -0
  137. package/src/main/lib/scheduler/rcaReport.cjs +21 -1
  138. package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
  139. package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
  140. package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
  141. package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
  142. package/src/main/lib/scheduler/schedulerPaths.cjs +12 -0
  143. package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
  144. package/src/main/lib/scheduler/validationQuality.cjs +282 -0
  145. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
  146. package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
  147. package/src/main/lib/tasks/taskIpc.cjs +80 -0
  148. package/src/main/lib/tasks/taskLedger.cjs +502 -0
  149. package/src/main/lib/tasks/taskRun.cjs +313 -0
  150. package/src/main/lib/tasks/taskSwitch.cjs +120 -0
  151. package/src/main/lib/telemetry/auditEvents.cjs +176 -0
  152. package/src/main/lib/telemetry/eventsAdminRoutes.cjs +45 -0
  153. package/src/main/loginItemIpc.cjs +35 -0
  154. package/src/main/loopEfficiencyHandlers.cjs +11 -2
  155. package/src/main/projectPages.cjs +6 -15
  156. package/src/main/promptSessionEvents.cjs +9 -1
  157. package/src/main/queueOps.cjs +260 -3
  158. package/src/main/runVerify.cjs +53 -25
  159. package/src/main/scheduler/AGENTS.md +26 -0
  160. package/src/main/scheduler/CLAUDE.md +1 -26
  161. package/src/main/scheduler/budget.cjs +239 -9
  162. package/src/main/scheduler/cancelDependents.cjs +154 -0
  163. package/src/main/scheduler/prdParser.cjs +4 -1
  164. package/src/main/scheduler/starvation.cjs +20 -18
  165. package/src/main/scheduler.cjs +774 -64
  166. package/src/main/supervisor.cjs +5 -1
  167. package/src/main/templates/PRD_AUTHORING.md +7 -1
  168. package/src/main/transcripts.cjs +62 -7
  169. package/src/main/validationQualityHandlers.cjs +199 -0
  170. package/src/main/webRemote.cjs +132 -20
  171. package/src/preload/api.d.ts +434 -28
  172. package/src/preload/apiSurface.cjs +7 -0
  173. package/src/preload/apiSurface.json +485 -81
  174. package/src/preload/index.cjs +38 -5
  175. package/src/seed/agents/validator.md +19 -8
  176. package/dist/assets/AgentLibrary-C1d_D7uQ.js +0 -2
  177. package/dist/assets/AppSettings-CgDhqrsU.js +0 -2
  178. package/dist/assets/Button-Bk23rEnZ.js +0 -1
  179. package/dist/assets/DocumentEditorPane-BqY5Nq6W.js +0 -1
  180. package/dist/assets/Extensions-CXem-uwI.js +0 -2
  181. package/dist/assets/History-BwO3coo4.js +0 -2
  182. package/dist/assets/Library-BDV69fSe.js +0 -32
  183. package/dist/assets/ListDetail-CD-Fm6mh.js +0 -1
  184. package/dist/assets/ProjectClaudeConfig-NjdKdwe8.js +0 -25
  185. package/dist/assets/ProvenanceBadge-Bu8NmI_R.js +0 -1
  186. package/dist/assets/Scheduler-CkhTvG7C.js +0 -16
  187. package/dist/assets/Settings-COT34hBF.js +0 -2
  188. package/dist/assets/Skills-BgexoUkQ.js +0 -29
  189. package/dist/assets/SourceChip-BXjcdeb1.js +0 -1
  190. package/dist/assets/SystemPrompt-CeeH3EeW.js +0 -1
  191. package/dist/assets/Toggle-CENi19iK.js +0 -1
  192. package/dist/assets/ViewTabs-DDBb0x96.js +0 -1
  193. package/dist/assets/claude-settings-schema-COigsajx.js +0 -3
  194. package/dist/assets/index-CgCxpunJ.js +0 -3116
@@ -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,12 +299,16 @@ export type McpCheckResult =
283
299
  * HomeAgentTools section. */
284
300
  export interface McpToolCatalogEntry {
285
301
  name: string;
286
- group: 'scheduler' | 'chat' | 'feedback' | 'help';
302
+ group: 'scheduler' | 'chat' | 'feedback' | 'help' | 'project-home' | 'macros' | 'customer-feedback' | 'epics' | 'agents' | 'tasks';
287
303
  purpose: string;
304
+ /** Plain one-line summary (10-90 chars) — the Dashboard row text. */
305
+ summary: string;
288
306
  whenToUse: string;
289
307
  whenNotToUse: string;
290
308
  exampleArgs: Record<string, unknown>;
291
309
  notes: string | null;
310
+ /** Arg groups the handler refuses a call without ('exactly one of'). */
311
+ requiredOneOf?: string[][];
292
312
  }
293
313
 
294
314
  export interface McpRecipe {
@@ -348,10 +368,15 @@ export interface MacroInput {
348
368
  options?: string[];
349
369
  }
350
370
 
351
- /** 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'). */
352
372
  export interface MacroJob {
353
373
  estimateMinutes: number;
354
- 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[];
355
380
  }
356
381
 
357
382
  export interface MacroJobDispatchInput {
@@ -362,6 +387,8 @@ export interface MacroJobDispatchInput {
362
387
  /** Per-launch effort chosen in the high-effort cost dialog: one of low, medium, high, xhigh, max;
363
388
  * main refuses anything else. Omitted = the persona's own effort. */
364
389
  effort?: string;
390
+ /** The press's {{name}} input values; a project Video tool renders its prompt with them. */
391
+ inputValues?: Record<string, string>;
365
392
  }
366
393
 
367
394
  export type MacroJobDispatchResult =
@@ -375,13 +402,33 @@ export interface MacroJobStatus {
375
402
  epicId: string | null;
376
403
  slug: string;
377
404
  state: MacroJobState;
378
- status: string;
379
- 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;
380
410
  startedAt: string | null;
381
411
  finishedAt: string | null;
382
412
  }
383
413
 
384
414
  /** One user-defined sidebar HOT KEYS macro (macroLibrary.cjs). `projects` = absolute cwds or `'*'` (every project); a surface `'project-home'` macro is always `['*']` (only its generated artifacts are per project). */
415
+ /** One "Needs you" item an outside app posted (main/lib/feedback-remote/needsYouStore.cjs StoredItemSchema). */
416
+ export interface NeedsYouItem {
417
+ app: string;
418
+ id: string;
419
+ title: string;
420
+ why: string;
421
+ link: string | null;
422
+ /** 2-5 distinct choices; null = no answer buttons (informational only). */
423
+ options: string[] | null;
424
+ externalRef: string | null;
425
+ status: 'open' | 'answered' | 'withdrawn';
426
+ answer: string | null;
427
+ createdAt: string;
428
+ updatedAt: string;
429
+ answeredAt: string | null;
430
+ }
431
+
385
432
  export interface Macro {
386
433
  id: string;
387
434
  label: string;
@@ -390,7 +437,7 @@ export interface Macro {
390
437
  prompt: string;
391
438
  projects: string[];
392
439
  /** Which strip shows this macro. Defaults to `'sessions'` when absent. */
393
- surface: 'sessions' | 'project-home';
440
+ surface: 'sessions' | 'project-home' | 'project-video';
394
441
  /** True for a seeded, machine-authored macro (e.g. the built-in Project Home actions). */
395
442
  builtin?: boolean;
396
443
  /** Bumped by the seed when a builtin macro's definition changes, to reseed it. */
@@ -402,7 +449,7 @@ export interface Macro {
402
449
  autoStartTargets?: string[];
403
450
  /** True lets a script start this macro via POST /admin/macros/run. */
404
451
  scriptStart?: boolean;
405
- /** 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. */
406
453
  job?: MacroJob;
407
454
  }
408
455
 
@@ -419,6 +466,34 @@ export interface ClaudeConfigPatchInput extends ClaudeConfigReadInput {
419
466
  value?: unknown;
420
467
  }
421
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
+
422
497
  export interface MacroSaveInput {
423
498
  id?: string;
424
499
  label: string;
@@ -426,7 +501,7 @@ export interface MacroSaveInput {
426
501
  tag: AgentPersonaTag;
427
502
  prompt: string;
428
503
  projects?: string[];
429
- surface?: 'sessions' | 'project-home';
504
+ surface?: 'sessions' | 'project-home' | 'project-video';
430
505
  /** Omitted keeps the stored list on update; `[]` clears it. */
431
506
  inputs?: MacroInput[];
432
507
  /** Same omit/clear semantics as `inputs`. */
@@ -703,6 +778,8 @@ export interface CustomerFeedbackItem {
703
778
  statusNote: string | null;
704
779
  statusAt: number | string | null;
705
780
  seenStatusAt: number | string | null;
781
+ /** Images the feedback host confirmed it stored (0 when none were sent). */
782
+ imageCount?: number;
706
783
  }
707
784
 
708
785
  export interface CustomerFeedbackInboxItem {
@@ -718,6 +795,8 @@ export interface CustomerFeedbackInboxItem {
718
795
  statusNote: string | null;
719
796
  statusAt: string | number | null;
720
797
  epicId: string | null;
798
+ /** Screenshot metadata in submission order; `path` = local cache file, null until downloaded. */
799
+ images: { mime: string; bytes: number; path: string | null }[];
721
800
  }
722
801
 
723
802
  export interface CustomerFeedbackOwnerInfo {
@@ -1260,6 +1339,10 @@ export interface DayProjectRow {
1260
1339
  outputTokens: number;
1261
1340
  cacheReadTokens: number;
1262
1341
  cacheCreationTokens: number;
1342
+ /** Recorded 1-hour part of cacheCreationTokens. */
1343
+ cacheCreation1hTokens?: number;
1344
+ /** Part of cacheCreationTokens with no recorded 5-minute / 1-hour split (rollup lines written before v4); priced at the 1-hour rate and marked estimated when above zero. */
1345
+ cacheCreationUnknownTokens?: number;
1263
1346
  costUsd: number;
1264
1347
  /** Set when the model id didn't match opus/sonnet/haiku and was priced at Sonnet rates as a fallback. */
1265
1348
  estimated?: boolean;
@@ -1313,6 +1396,10 @@ export interface HistoryDashboardProjectRow extends HistoryDashboardTotals {
1313
1396
  outputTokens: number;
1314
1397
  cacheReadTokens: number;
1315
1398
  cacheCreationTokens: number;
1399
+ /** Recorded 1-hour part of cacheCreationTokens. */
1400
+ cacheCreation1hTokens?: number;
1401
+ /** Part of cacheCreationTokens with no recorded 5-minute / 1-hour split (rollup lines written before v4); priced at the 1-hour rate and marked estimated when above zero. */
1402
+ cacheCreationUnknownTokens?: number;
1316
1403
  costUsd: number;
1317
1404
  estimated?: boolean;
1318
1405
  }>;
@@ -1335,6 +1422,10 @@ export interface HistoryDashboardResult {
1335
1422
  outputTokens: number;
1336
1423
  cacheReadTokens: number;
1337
1424
  cacheCreationTokens: number;
1425
+ /** Recorded 1-hour part of cacheCreationTokens. */
1426
+ cacheCreation1hTokens?: number;
1427
+ /** Part of cacheCreationTokens with no recorded 5-minute / 1-hour split (rollup lines written before v4); priced at the 1-hour rate and marked estimated when above zero. */
1428
+ cacheCreationUnknownTokens?: number;
1338
1429
  costUsd: number;
1339
1430
  estimated?: boolean;
1340
1431
  }>;
@@ -1342,8 +1433,131 @@ export interface HistoryDashboardResult {
1342
1433
  generatedAt: number;
1343
1434
  /** Dates included in `days` that are NOT yet finalized (typically just today). */
1344
1435
  provisionalDates: string[];
1436
+ /** Dates in range finalized under an older rollup version (counted before once-per-call counting; read high). */
1437
+ legacyDates: string[];
1438
+ }
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;
1345
1474
  }
1346
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
+
1347
1561
 
1348
1562
  export interface FileEntry {
1349
1563
  name: string;
@@ -1655,7 +1869,9 @@ export interface ProjectPageMeta {
1655
1869
  export interface ProjectVideoMeta {
1656
1870
  id: string;
1657
1871
  title: string;
1658
- 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';
1659
1875
  /** The `Video target:` text the video was built for (a post path or URL, or a feature name); absent for a Project demo. */
1660
1876
  target?: string;
1661
1877
  style: string;
@@ -1700,14 +1916,110 @@ export interface ProjectPagesGetResult {
1700
1916
  demoVideo: { path: string; mtimeMs: number } | null;
1701
1917
  }
1702
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
+
1703
2015
  // ────────────────────────────────────────────── Project Pages: markdown link network
1704
2016
  // Mirrors the JSDoc typedefs of the same names in src/main/lib/mdNetworkScan.cjs.
1705
2017
  // Every path is repo-relative POSIX.
1706
2018
 
1707
- /** '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. */
1708
2020
  export type MdNetworkNodeType = 'hub' | 'owner' | 'doc';
1709
2021
 
1710
- /** 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). */
1711
2023
  export interface MdNetworkNode {
1712
2024
  /** Same as `path`. */
1713
2025
  id: string;
@@ -1743,6 +2055,8 @@ export interface MdNetworkBrokenLink {
1743
2055
  /** `${file}:${line} → ${target}` */
1744
2056
  where: string;
1745
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;
1746
2060
  }
1747
2061
 
1748
2062
  /** Docs that no link path from the root reaches, grouped by top-level folder. */
@@ -1759,13 +2073,26 @@ export interface MdNetworkOrphan {
1759
2073
  export type MdNetworkFinding = MdNetworkBrokenLink | MdNetworkOrphan;
1760
2074
 
1761
2075
  /**
1762
- * 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
1763
2090
  * census of every tracked .md (role, size, git recency, dead/stale refs, code mentions).
1764
2091
  * Orphan findings leave out docs the census puts in a record collection.
1765
2092
  */
1766
2093
  export interface MdNetwork {
1767
2094
  ok: true;
1768
- /** The root doc, 'CLAUDE.md'. */
2095
+ /** The root doc: 'AGENTS.md' when the root has one, else 'CLAUDE.md'. */
1769
2096
  root: string;
1770
2097
  /** Breadth-first from the root. */
1771
2098
  nodes: MdNetworkNode[];
@@ -1779,9 +2106,11 @@ export interface MdNetwork {
1779
2106
  scopes: string[];
1780
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. */
1781
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[];
1782
2111
  }
1783
2112
 
1784
- /** `{ 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). */
1785
2114
  export type MdNetworkResult = MdNetwork | { ok: false; error: string };
1786
2115
 
1787
2116
  // ────────────────────────────────────────────── Project Pages: Review MD network record
@@ -1830,10 +2159,10 @@ export type MdReviewResult = MdReviewOk | { ok: false; error: string };
1830
2159
  // Mirrors the JSDoc typedefs in src/main/lib/mdDocCensus.cjs.
1831
2160
  // Every path is repo-relative POSIX; folder strings end with '/'.
1832
2161
 
1833
- /** 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. */
1834
2163
  export type MdDocRole = 'map' | 'scoped' | 'agent' | 'record' | 'doc';
1835
2164
 
1836
- 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; }
1837
2166
 
1838
2167
  /** A folder of machine-written, write-once, unlinked docs (e.g. validation records). */
1839
2168
  export interface MdRecordCollection { folder: string; docs: number; linked: number; lastCommitMs: number | null; source: 'heuristic' | 'override'; }
@@ -2309,8 +2638,10 @@ export interface SessionManagerAPI {
2309
2638
  exists: (cwd: string, sessionUuid: string) => Promise<boolean>;
2310
2639
  /** Batched token-usage totals, one map entry per requested sessionId. A
2311
2640
  * session with no transcript file yet (or one over the main-process size
2312
- * cap) maps to null. */
2313
- usageFor: (cwd: string, sessionIds: string[]) => Promise<Record<string, { inputTokens: number; outputTokens: number } | null>>;
2641
+ * cap) maps to null. `lastContext` = input + cache-read + cache-creation
2642
+ * tokens of the newest model call (null when there is none); `calls` =
2643
+ * number of model calls, each message.id counted once. */
2644
+ usageFor: (cwd: string, sessionIds: string[]) => Promise<Record<string, { inputTokens: number; outputTokens: number; lastContext: number | null; calls: number } | null>>;
2314
2645
  /** Fires once per main-process flush with the ORDERED batch of events that
2315
2646
  * flush produced (never one call per event) — see transcripts.cjs's
2316
2647
  * doFlush / MAX_EVENTS_PER_BATCH. */
@@ -2410,6 +2741,14 @@ export interface SessionManagerAPI {
2410
2741
  /** Fires after any save/delete/setProject — re-fetch list(). */
2411
2742
  onChanged: (handler: () => void) => () => void;
2412
2743
  };
2744
+ needsYou: {
2745
+ /** Open items only, across every app. */
2746
+ list: () => Promise<{ ok: true; items: NeedsYouItem[] }>;
2747
+ /** Answer one open item with one of its options; `ok: false` + error in words when no such open item/option. */
2748
+ answer: (payload: { app: string; id: string; answer: string }) => Promise<{ ok: true; item: NeedsYouItem } | { ok: false; error: string }>;
2749
+ /** Fires after any post/withdraw/answer — re-fetch list(). */
2750
+ onChanged: (handler: () => void) => () => void;
2751
+ };
2413
2752
  appPreview: {
2414
2753
  /** The Epic's package.json scripts (dir = worktree when it has one) plus a suggested dev script. */
2415
2754
  scripts: (payload: { cwd: string; epicId: string }) => Promise<AppPreviewScriptsResult>;
@@ -2457,16 +2796,25 @@ export interface SessionManagerAPI {
2457
2796
  /** Sets one key path; omit `value` to delete it. Broadcasts `config:changed`. */
2458
2797
  patch: (payload: ClaudeConfigPatchInput) => Promise<{ ok: true; path: string; data: Record<string, unknown> }>;
2459
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
+ };
2460
2804
  config: {
2461
2805
  readJson: (path: string) => Promise<ReadJsonResult>;
2462
2806
  readText: (path: string, opts?: ReadTextOptions) => Promise<ReadTextResult>;
2463
2807
  /** `writer` declares the owning surface for the single-writer law — required
2464
2808
  * when `path` is inside a project's session-manager-operations/ root. */
2465
2809
  writeJson: (path: string, data: unknown, writer?: OpsWriter) => Promise<WriteResult>;
2466
- 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>;
2467
2813
  listDir: (path: string, opts?: { filesOnly?: boolean; dirsOnly?: boolean; includeHidden?: boolean }) => Promise<ListDirResult>;
2468
- /** True when config:write-text would accept this path (same validateWrite). */
2469
- 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>;
2470
2818
  exists: (path: string) => Promise<boolean>;
2471
2819
  watch: (paths: string[], opts?: { depth?: 0 | 1 | 2 }) => void;
2472
2820
  unwatch: (paths: string[], opts?: { depth?: 0 | 1 | 2 }) => void;
@@ -2511,8 +2859,14 @@ export interface SessionManagerAPI {
2511
2859
  configPath: () => Promise<string>;
2512
2860
  };
2513
2861
  customerFeedback: {
2514
- submit: (p: { title: string; body: string; tag: CustomerFeedbackTag }) => Promise<
2515
- { ok: true; item: CustomerFeedbackItem } | { ok: false; error: string }
2862
+ /** `images` are raw data URLs; main prepares (validates/downscales) them before sending. */
2863
+ submit: (p: {
2864
+ title: string;
2865
+ body: string;
2866
+ tag: CustomerFeedbackTag;
2867
+ images?: { dataUrl: string }[];
2868
+ }) => Promise<
2869
+ { ok: true; item: CustomerFeedbackItem; warning?: string } | { ok: false; error: string }
2516
2870
  >;
2517
2871
  list: () => Promise<CustomerFeedbackItem[]>;
2518
2872
  refreshStatus: () => Promise<
@@ -2533,6 +2887,10 @@ export interface SessionManagerAPI {
2533
2887
  inboxLinkEpic: (p: { id: string; epicId: string }) => Promise<
2534
2888
  { ok: true } | { ok: false; error: string }
2535
2889
  >;
2890
+ /** A cached inbox screenshot as a data URL; `index` is 0-based. */
2891
+ inboxImage(p: { id: string; index: number }): Promise<
2892
+ { ok: true; dataUrl: string } | { ok: false; error: string }
2893
+ >;
2536
2894
  };
2537
2895
  telemetry: {
2538
2896
  getConfig: () => Promise<TelemetryConfig>;
@@ -2590,9 +2948,18 @@ export interface SessionManagerAPI {
2590
2948
  dashboard: (req: HistoryDashboardRequest) => Promise<HistoryDashboardResult>;
2591
2949
  /** This usage week's validated-PRDs-per-usage efficiency, per project (loopEfficiency.cjs). */
2592
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 }>;
2593
2953
  /** Fires (throttled to 1/5 s) when main appends days to the rollup. Returns unsubscribe. */
2594
2954
  onUpdated: (handler: () => void) => () => void;
2595
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
+ };
2596
2963
  schedule: {
2597
2964
  state: () => Promise<ScheduleStateSnapshot>;
2598
2965
  /** Machine-wide claude -p slot pool (sessionSlots.cjs): total/inUse/holders + [min,max]/default/envOverride. */
@@ -2740,8 +3107,8 @@ export interface SessionManagerAPI {
2740
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. */
2741
3108
  get: (cwd: string) => Promise<ProjectPagesGetResult>;
2742
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`. */
2743
- mdNetwork: (payload: { cwd: string; recordFolders?: string[]; docFolders?: string[] }) => Promise<MdNetworkResult>;
2744
- /** 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. */
2745
3112
  mdReview: (payload: { cwd: string; epicIds?: string[] }) => Promise<MdReviewResult>;
2746
3113
  /** Read the saved Competitor matrix (project-pages/matrix/matrix.json) — read-only; writes go through project_matrix_write. */
2747
3114
  matrix: (payload: { cwd: string }) => Promise<CompetitorMatrixResult>;
@@ -2753,6 +3120,12 @@ export interface SessionManagerAPI {
2753
3120
  rename: (cwd: string, kind: 'knowledge' | 'video', id: string, title: string) => Promise<{ ok: true; title: string }>;
2754
3121
  /** Remove exactly one library entry folder. Rejects on a bad id or missing entry. */
2755
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>;
2756
3129
  /** Fires whenever a watched cwd's knowledge/videos library is added/changed/removed, carrying the freshly read library result. */
2757
3130
  onChanged: (handler: (payload: { cwd: string } & ProjectPagesGetResult) => void) => () => void;
2758
3131
  };
@@ -2783,8 +3156,8 @@ export interface SessionManagerAPI {
2783
3156
  * Kind allowlist is enforced main-side (ipcSchemas.cjs) — this channel is
2784
3157
  * append-only, no read/list IPC exists. */
2785
3158
  append: (
2786
- kind: 'epic_create' | 'epic_approve' | 'epic_complete' | 'epic_delete' | 'epic_resume' | 'epic_duplicate' | 'epic_draft_update',
2787
- fields: { cwd: string; epicId: string; source: string },
3159
+ kind: 'epic_create' | 'epic_approve' | 'epic_complete' | 'epic_delete' | 'epic_resume' | 'epic_duplicate' | 'epic_draft_update' | 'epic_continue',
3160
+ fields: { cwd: string; epicId: string; source: string; fromEpicId?: string },
2788
3161
  ) => Promise<{ ok: boolean }>;
2789
3162
  };
2790
3163
  git: {
@@ -2796,6 +3169,12 @@ export interface SessionManagerAPI {
2796
3169
  * renderer needs per-row badges without a separate git call per file. */
2797
3170
  fileStatus: (cwd: string) => Promise<GitFileStatusMap>;
2798
3171
  };
3172
+ loginItem: {
3173
+ status: () => Promise<LoginItemStatus>;
3174
+ setEnabled: (
3175
+ enabled: boolean,
3176
+ ) => Promise<{ ok: true; status: LoginItemStatus } | { ok: false; error: string }>;
3177
+ };
2799
3178
  updater: {
2800
3179
  status: () => Promise<AutoUpdaterStatus>;
2801
3180
  check: () => Promise<AutoUpdaterStatus>;
@@ -2862,6 +3241,8 @@ export interface SessionManagerAPI {
2862
3241
  title: string;
2863
3242
  prompt: string;
2864
3243
  macroId?: string;
3244
+ /** An outside app's own id for the Epic to create. */
3245
+ externalRef?: string;
2865
3246
  /** Set when main awaits the result; echo it back via `reportExternalNewSessionResult`. */
2866
3247
  requestId?: string;
2867
3248
  via?: 'script';
@@ -2976,6 +3357,8 @@ export interface PromptSessionsCreateEpicPayload {
2976
3357
  sourceTabId?: string;
2977
3358
  /** The macro that launched this Epic. */
2978
3359
  macroId?: string;
3360
+ /** An outside app's own id for this Epic. */
3361
+ externalRef?: string;
2979
3362
  };
2980
3363
  /** Full first-prompt body + its labeled sections (epicIntake.ts's
2981
3364
  * composeEpicIntake) — carried alongside goalText so the Epic's first
@@ -2987,7 +3370,7 @@ export interface PromptSessionsCreateEpicPayload {
2987
3370
  text: string;
2988
3371
  source?: string;
2989
3372
  /** Which part of its AIM slot this entry is; absent on Epics minted before AIM sections. */
2990
- part?: 'persona' | 'grounding' | 'injection' | 'reference' | 'job-type' | 'goal';
3373
+ part?: 'persona' | 'grounding' | 'injection' | 'handoff' | 'reference' | 'job-type' | 'goal';
2991
3374
  }>;
2992
3375
  /** Adopt an existing CLI session of this project instead of minting one. */
2993
3376
  restoreSessionId?: string;
@@ -3163,6 +3546,29 @@ interface LoopEfficiencyRow {
3163
3546
  executorUsd: number;
3164
3547
  usdPerVerified: number | null;
3165
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
+ }
3166
3572
  interface LoopEfficiencyResult {
3167
3573
  fromMs: number;
3168
3574
  toMs: number;