claude-code-session-manager 0.140.0 → 0.142.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 (204) hide show
  1. package/README.md +80 -70
  2. package/bin/cli.cjs +11 -0
  3. package/dist/assets/AppSettings-BcZgIvvY.js +2 -0
  4. package/dist/assets/{History--JwsFnbn.js → History-DpZuJXi1.js} +1 -1
  5. package/dist/assets/HomeClaudeConfig-D32ZJtU-.js +3 -0
  6. package/dist/assets/{Panel-CALyU0pe.js → Panel-BjdJjhqt.js} +1 -1
  7. package/dist/assets/{ProjectClaudeConfig-sdlA-fUb.js → ProjectClaudeConfig-BTClYV6i.js} +7 -7
  8. package/dist/assets/Scheduler-DPobKx1Z.js +16 -0
  9. package/dist/assets/{SkillReferenceGraph-CxAuwhNN.js → SkillReferenceGraph-Cqyu4mef.js} +1 -1
  10. package/dist/assets/{Skills-DtRzghn5.js → Skills-vv0noNVI.js} +5 -5
  11. package/dist/assets/{TiptapBody-DApeu7x8.js → TiptapBody-CXi8Pvut.js} +1 -1
  12. package/dist/assets/Toggle-CiYCWLjh.js +1 -0
  13. package/dist/assets/{VoiceButton-DtStfv1H.js → VoiceButton-4NKKd1sC.js} +1 -1
  14. package/dist/assets/{historyTotals-ydfnwepc.js → historyTotals-DDunb8Ch.js} +1 -1
  15. package/dist/assets/index-Cn5E9958.js +3133 -0
  16. package/dist/assets/{index-DKXdXfka.css → index-DVHIHoJf.css} +1 -1
  17. package/dist/index.html +2 -2
  18. package/dist-web/app.css +1 -1
  19. package/dist-web/app.js +496 -484
  20. package/package.json +4 -2
  21. package/plugins/AGENTS.md +4 -3
  22. package/plugins/session-manager-dev/hooks/hooks.json +15 -0
  23. package/plugins/session-manager-dev/hooks/residue-check.cjs +241 -0
  24. package/plugins/session-manager-dev/skills/builder/SKILL.md +4 -2
  25. package/plugins/session-manager-dev/skills/develop/SKILL.md +55 -18
  26. package/plugins/session-manager-dev/skills/develop/standards.md +3 -2
  27. package/scripts/README.md +1 -0
  28. package/scripts/hooks/guard-tool-risk.cjs +5 -1
  29. package/scripts/hooks/lib/guard-tool-risk-policy.cjs +158 -1
  30. package/scripts/scheduler-mcp-server.cjs +737 -110
  31. package/src/main/adminRouteRegistry.cjs +59 -0
  32. package/src/main/agentLibrary.cjs +72 -4
  33. package/src/main/agentsIpc.cjs +3 -2
  34. package/src/main/build-info.json +4 -4
  35. package/src/main/chatRunner.cjs +231 -16
  36. package/src/main/config.cjs +30 -0
  37. package/src/main/docEdit.cjs +4 -2
  38. package/src/main/health.cjs +91 -0
  39. package/src/main/index.cjs +98 -48
  40. package/src/main/ipcSchemas.cjs +171 -8
  41. package/src/main/lib/AGENTS.md +1 -1
  42. package/src/main/lib/chatBootRecovery.cjs +2 -0
  43. package/src/main/lib/claude/agentModelResolve.cjs +51 -25
  44. package/src/main/lib/claude/agentSnapshot.cjs +186 -0
  45. package/src/main/lib/claude/environmentProfiles.cjs +242 -0
  46. package/src/main/lib/claude/jobSandboxPolicy.cjs +241 -33
  47. package/src/main/lib/claude/personaToolScope.cjs +82 -31
  48. package/src/main/lib/claude/runClaudeP.cjs +4 -2
  49. package/src/main/lib/claude/toolRiskMarks.cjs +41 -1
  50. package/src/main/lib/claude/usageCircuit.cjs +49 -21
  51. package/src/main/lib/claude/vaultRefs.cjs +277 -0
  52. package/src/main/lib/demo-video-kit/capture.cjs +282 -12
  53. package/src/main/lib/demo-video-kit/cast.md +43 -0
  54. package/src/main/lib/demo-video-kit/character.cjs +722 -30
  55. package/src/main/lib/demo-video-kit/checks.cjs +120 -1
  56. package/src/main/lib/demo-video-kit/export.cjs +218 -0
  57. package/src/main/lib/demo-video-kit/frames.cjs +104 -9
  58. package/src/main/lib/demo-video-kit/kind-marketing.md +121 -0
  59. package/src/main/lib/demo-video-kit/kind-tiktok.md +99 -0
  60. package/src/main/lib/demo-video-kit/kokoroSay.cjs +205 -0
  61. package/src/main/lib/demo-video-kit/project-home-html.md +43 -0
  62. package/src/main/lib/demo-video-kit/resumableRun.cjs +298 -0
  63. package/src/main/lib/demo-video-kit/seedKit.cjs +3 -3
  64. package/src/main/lib/demo-video-kit/voiceLane.cjs +233 -0
  65. package/src/main/lib/demo-video-kit/voiceLibrary.cjs +312 -0
  66. package/src/main/lib/epic/artifactAdminRoutes.cjs +211 -0
  67. package/src/main/lib/epic/artifactIpc.cjs +153 -0
  68. package/src/main/lib/epic/artifactNotice.cjs +72 -0
  69. package/src/main/lib/epic/artifactRetention.cjs +310 -0
  70. package/src/main/lib/epic/artifactStore.cjs +392 -0
  71. package/src/main/lib/epic/delegationReadiness.cjs +76 -2
  72. package/src/main/lib/epic/epicAgentRefresh.cjs +97 -0
  73. package/src/main/lib/epic/epicEventLog.cjs +214 -0
  74. package/src/main/lib/epic/epicMint.cjs +43 -1
  75. package/src/main/lib/epic/epicOutsideRead.cjs +1 -0
  76. package/src/main/lib/epic/epicOutsideState.cjs +18 -4
  77. package/src/main/lib/epic/epicPurge.cjs +347 -0
  78. package/src/main/lib/epic/epicReopen.cjs +5 -2
  79. package/src/main/lib/epic/epicSettle.cjs +4 -13
  80. package/src/main/lib/epic/epicSpawnPlan.cjs +57 -4
  81. package/src/main/lib/epic/epicStatusMirror.cjs +34 -1
  82. package/src/main/lib/epic/epicTransitions.cjs +139 -0
  83. package/src/main/lib/epic/epicValidationHook.cjs +81 -2
  84. package/src/main/lib/epic/guardSpawnSettings.cjs +3 -2
  85. package/src/main/lib/externalContract.cjs +37 -4
  86. package/src/main/lib/feedback-remote/crossProjectReply.cjs +389 -126
  87. package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -3
  88. package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +11 -6
  89. package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +26 -1
  90. package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +5 -2
  91. package/src/main/lib/feedback-remote/feedbackBoxDrain.cjs +409 -0
  92. package/src/main/lib/feedback-remote/feedbackBoxKeys.cjs +218 -0
  93. package/src/main/lib/feedback-remote/feedbackEnvelope.cjs +163 -0
  94. package/src/main/lib/feedback-remote/feedbackRelayClient.cjs +164 -0
  95. package/src/main/lib/feedback-remote/feedbackReport.cjs +234 -0
  96. package/src/main/lib/feedback-remote/feedbackSeal.cjs +217 -0
  97. package/src/main/lib/feedback-remote/localAdminHttp.cjs +108 -2
  98. package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +2 -1
  99. package/src/main/lib/feedback-remote/needsYouIpc.cjs +17 -0
  100. package/src/main/lib/feedback-remote/needsYouStore.cjs +177 -6
  101. package/src/main/lib/feedback-remote/pendingReplies.cjs +189 -0
  102. package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +188 -10
  103. package/src/main/lib/feedback-remote/serviceClient.cjs +429 -0
  104. package/src/main/lib/feedback-remote/serviceMcpSession.cjs +252 -0
  105. package/src/main/lib/feedback-remote/serviceMcpTools.cjs +284 -0
  106. package/src/main/lib/feedback-remote/servicePairings.cjs +313 -0
  107. package/src/main/lib/feedback-remote/serviceStdioBridge.cjs +290 -0
  108. package/src/main/lib/feedback-remote/siteFeedbackAdminRoutes.cjs +295 -0
  109. package/src/main/lib/feedback-remote/siteFeedbackInbox.cjs +598 -0
  110. package/src/main/lib/feedback-remote/siteFeedbackIpc.cjs +86 -0
  111. package/src/main/lib/feedback-remote/siteFeedbackService.cjs +477 -0
  112. package/src/main/lib/git/worktreeDeps.cjs +77 -2
  113. package/src/main/lib/mcpToolCatalog.cjs +315 -30
  114. package/src/main/lib/opsOwnership.cjs +29 -1
  115. package/src/main/lib/opsRetentionSettings.cjs +27 -5
  116. package/src/main/lib/persona-macro/builtinMacros.cjs +7 -2
  117. package/src/main/lib/persona-macro/macroJobDispatch.cjs +52 -8
  118. package/src/main/lib/persona-macro/macroJobIpc.cjs +16 -6
  119. package/src/main/lib/persona-macro/macroLibrary.cjs +49 -7
  120. package/src/main/lib/persona-macro/personaFrontmatterSchema.cjs +83 -0
  121. package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +3 -0
  122. package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +263 -0
  123. package/src/main/lib/phaseProjection.cjs +103 -0
  124. package/src/main/lib/prd/depSlugResolve.cjs +4 -13
  125. package/src/main/lib/prd/prdBodyPatch.cjs +12 -17
  126. package/src/main/lib/prd/prdCreate.cjs +67 -5
  127. package/src/main/lib/prd/prdCriteria.cjs +225 -0
  128. package/src/main/lib/prd/prdFrontmatter.cjs +68 -3
  129. package/src/main/lib/prd/prdGateFiles.cjs +125 -49
  130. package/src/main/lib/prd/prdSizing.cjs +3 -1
  131. package/src/main/lib/process/cleanEnv.cjs +52 -1
  132. package/src/main/lib/process/leftoverRenice.cjs +178 -0
  133. package/src/main/lib/process/memoryScope.cjs +31 -3
  134. package/src/main/lib/project-pages/pagesLibrary.cjs +72 -6
  135. package/src/main/lib/project-pages/videoReviewIpc.cjs +3 -2
  136. package/src/main/lib/project-pages/voiceAdminRoutes.cjs +175 -0
  137. package/src/main/lib/project-pages/voicePreview.cjs +196 -0
  138. package/src/main/lib/project-pages/voicesIpc.cjs +186 -0
  139. package/src/main/lib/promptSessionSchema.cjs +6 -0
  140. package/src/main/lib/scheduler/cancelledRow.cjs +57 -0
  141. package/src/main/lib/scheduler/cpuSample.cjs +133 -42
  142. package/src/main/lib/scheduler/criteriaChecks.cjs +169 -0
  143. package/src/main/lib/scheduler/definitionOfDone.cjs +44 -5
  144. package/src/main/lib/scheduler/jobMemoryStats.cjs +313 -0
  145. package/src/main/lib/scheduler/loadGate.cjs +82 -4
  146. package/src/main/lib/scheduler/planRecordHarvest.cjs +32 -2
  147. package/src/main/lib/scheduler/prdOutcomeRecord.cjs +133 -0
  148. package/src/main/lib/scheduler/preflightCheck.cjs +97 -0
  149. package/src/main/lib/scheduler/reviewNotice.cjs +39 -0
  150. package/src/main/lib/scheduler/runLogRetention.cjs +42 -1
  151. package/src/main/lib/scheduler/scheduleJobSchema.cjs +5 -0
  152. package/src/main/lib/scheduler/scheduleJobTransitions.cjs +47 -0
  153. package/src/main/lib/scheduler/schedulerConfig.cjs +47 -0
  154. package/src/main/lib/scheduler/schedulerPaths.cjs +0 -3
  155. package/src/main/lib/scheduler/schedulerRuntimeState.cjs +50 -1
  156. package/src/main/lib/scheduler/sessionSlots.cjs +5 -1
  157. package/src/main/lib/scheduler/slotsRoute.cjs +237 -0
  158. package/src/main/lib/scheduler/toolClearance.cjs +258 -0
  159. package/src/main/lib/scheduler/validatorVerdictSchema.cjs +140 -10
  160. package/src/main/lib/tasks/memoryConsolidation.cjs +300 -0
  161. package/src/main/lib/tasks/mitigationReview.cjs +294 -0
  162. package/src/main/lib/tasks/taskAdminRoutes.cjs +312 -22
  163. package/src/main/lib/tasks/taskIpc.cjs +22 -18
  164. package/src/main/lib/tasks/taskLedger.cjs +147 -25
  165. package/src/main/lib/tasks/taskRun.cjs +186 -17
  166. package/src/main/lib/tasks/taskSwitch.cjs +85 -12
  167. package/src/main/lib/tasks/taskSwitchRoute.cjs +172 -0
  168. package/src/main/lib/telemetry/auditEvents.cjs +207 -6
  169. package/src/main/lib/telemetry/eventsAdminRoutes.cjs +198 -6
  170. package/src/main/lib/telemetry/webhookDelivery.cjs +205 -0
  171. package/src/main/lib/telemetry/webhookRegistry.cjs +281 -0
  172. package/src/main/lib/toolUseClassify.cjs +181 -0
  173. package/src/main/lib/util/smfileRange.cjs +77 -0
  174. package/src/main/projectPages.cjs +3 -1
  175. package/src/main/promptSessionEvents.cjs +5 -0
  176. package/src/main/pty.cjs +68 -0
  177. package/src/main/queueOps.cjs +32 -13
  178. package/src/main/runVerify.cjs +74 -9
  179. package/src/main/scheduler/AGENTS.md +1 -0
  180. package/src/main/scheduler/budget.cjs +6 -5
  181. package/src/main/scheduler/prdParser.cjs +62 -14
  182. package/src/main/scheduler/reviewLadder.cjs +45 -28
  183. package/src/main/scheduler/starvation.cjs +69 -0
  184. package/src/main/scheduler/utilizationHold.cjs +101 -0
  185. package/src/main/scheduler.cjs +1745 -210
  186. package/src/main/templates/PRD_AUTHORING.md +13 -2
  187. package/src/main/webRemote.cjs +463 -6
  188. package/src/preload/api.d.ts +529 -38
  189. package/src/preload/apiSurface.json +209 -7
  190. package/src/preload/index.cjs +46 -1
  191. package/src/seed/agents/architect.md +6 -1
  192. package/src/seed/agents/blender-artist.md +2 -1
  193. package/src/seed/agents/competitive-analyst.md +3 -1
  194. package/src/seed/agents/competitive-researcher.md +2 -1
  195. package/src/seed/agents/demo-video-builder.md +87 -83
  196. package/src/seed/agents/dev-lead.md +3 -3
  197. package/src/seed/agents/project-home-builder.md +9 -31
  198. package/src/seed/agents/validator.md +9 -10
  199. package/dist/assets/AppSettings-CMFEM68R.js +0 -2
  200. package/dist/assets/HomeClaudeConfig-ijEXs--3.js +0 -3
  201. package/dist/assets/Scheduler-YT3j8SUa.js +0 -16
  202. package/dist/assets/ViewTabs-B7qLXRAH.js +0 -1
  203. package/dist/assets/index-CtxruO1L.js +0 -3121
  204. package/src/main/lib/epic/epicStateWatcher.cjs +0 -157
@@ -294,35 +294,6 @@ export type McpCheckResult =
294
294
  | { ok: true; status: 'connected'; tools: { name: string; description?: string }[]; checkedAt: number }
295
295
  | { ok: false; status: 'failed' | 'needs-auth'; error: string; checkedAt: number };
296
296
 
297
- /** One session-manager-scheduler MCP tool's catalog entry (src/main/lib/mcpToolCatalog.cjs) —
298
- * the same data GET /admin/mcp/catalog serves, read in-process for the Dashboard's
299
- * HomeAgentTools section. */
300
- export interface McpToolCatalogEntry {
301
- name: string;
302
- group: 'scheduler' | 'chat' | 'feedback' | 'help' | 'project-home' | 'macros' | 'customer-feedback' | 'epics' | 'agents' | 'tasks';
303
- purpose: string;
304
- /** Plain one-line summary (10-90 chars) — the Dashboard row text. */
305
- summary: string;
306
- whenToUse: string;
307
- whenNotToUse: string;
308
- exampleArgs: Record<string, unknown>;
309
- notes: string | null;
310
- /** Arg groups the handler refuses a call without ('exactly one of'). */
311
- requiredOneOf?: string[][];
312
- }
313
-
314
- export interface McpRecipe {
315
- id: string;
316
- title: string;
317
- steps: string[];
318
- }
319
-
320
- export interface McpCatalogResult {
321
- ok: boolean;
322
- tools: McpToolCatalogEntry[];
323
- recipes: McpRecipe[];
324
- }
325
-
326
297
  /** Mirrors WorkType (src/main/lib/prd/workTypeLibrary.cjs) / EpicTag (tagLibrary.ts) — the
327
298
  * same Epic-mission taxonomy, reused here since an Agent persona's `tags` field is that
328
299
  * same concept, not a free-form string list. */
@@ -389,6 +360,12 @@ export interface MacroJobDispatchInput {
389
360
  effort?: string;
390
361
  /** The press's {{name}} input values; a project Video tool renders its prompt with them. */
391
362
  inputValues?: Record<string, string>;
363
+ /** A Demo Video press asking for the review stage: the job stops for a human review before the final save.
364
+ * Omitted or false = straight to the final save. */
365
+ reviewStage?: boolean;
366
+ /** A project Video tool press's picked library voice (voiceLibrary id); beats the tool's default voiceId.
367
+ * Omitted = the tool default, else the persona voice, else the kit default. */
368
+ voiceId?: string;
392
369
  }
393
370
 
394
371
  export type MacroJobDispatchResult =
@@ -411,6 +388,52 @@ export interface MacroJobStatus {
411
388
  finishedAt: string | null;
412
389
  }
413
390
 
391
+ /** Kind of a published artifact (lib/epic/artifactStore.cjs KINDS). */
392
+ export type ArtifactKind = 'video' | 'audio' | 'image' | 'doc' | 'data' | 'other';
393
+
394
+ /** Who produced an artifact (artifactStore.cjs cleanProducer). */
395
+ export interface ArtifactProducer {
396
+ epicId: string | null;
397
+ prdSlug: string | null;
398
+ sessionId: string | null;
399
+ taskId: string | null;
400
+ }
401
+
402
+ /** One artifacts:list row — a ledger entry + its owner folder + the owning Epic's title. */
403
+ export interface ArtifactEntry {
404
+ /** File name inside `artifacts/<ownerId>/`. */
405
+ name: string;
406
+ title?: string | null;
407
+ kind?: ArtifactKind | string;
408
+ /** Bytes. */
409
+ size?: number;
410
+ sha256?: string;
411
+ /** ISO timestamp. */
412
+ createdAt?: string;
413
+ producer?: ArtifactProducer | null;
414
+ /** Epic id, or `_tasks/<task-id>` for Task-owned artifacts. */
415
+ ownerId: string;
416
+ epicTitle: string | null;
417
+ }
418
+
419
+ export type ArtifactsListResult =
420
+ | { ok: true; artifacts: ArtifactEntry[] }
421
+ | { ok: false; error: string };
422
+
423
+ /** One artifacts:worktrees row. `aheadOfBase` = commits on `branch` not on the base; `uncommitted` = `git status --porcelain` lines in the worktree (capped at 999); each null when unknown. */
424
+ export interface ArtifactWorktree {
425
+ epicId: string;
426
+ title: string | null;
427
+ path: string;
428
+ branch: string;
429
+ aheadOfBase: number | null;
430
+ uncommitted: number | null;
431
+ }
432
+
433
+ export type ArtifactsWorktreesResult =
434
+ | { ok: true; worktrees: ArtifactWorktree[] }
435
+ | { ok: false; error: string };
436
+
414
437
  /** 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
438
  /** One "Needs you" item an outside app posted (main/lib/feedback-remote/needsYouStore.cjs StoredItemSchema). */
416
439
  export interface NeedsYouItem {
@@ -451,6 +474,8 @@ export interface Macro {
451
474
  scriptStart?: boolean;
452
475
  /** Set on built-ins whose press builds in the background, and on every project Video tool. */
453
476
  job?: MacroJob;
477
+ /** A project Home / Video tool's default library voice (macroLibrary); its press preselects it. */
478
+ voiceId?: string;
454
479
  }
455
480
 
456
481
  /** Omit `id` to create; set it to update an existing macro. */
@@ -472,7 +497,7 @@ export interface ToolRiskReadInput {
472
497
  /** Required (absolute) for scope 'project'. */
473
498
  cwd?: string | null;
474
499
  }
475
- export type ToolRiskMark = 'read' | 'write' | 'irreversible' | 'money' | 'public';
500
+ export type ToolRiskMark = 'read' | 'write' | 'confirm' | 'irreversible' | 'money' | 'public';
476
501
  export interface ToolRiskReadResult {
477
502
  ok: boolean;
478
503
  path: string | null;
@@ -797,6 +822,8 @@ export interface CustomerFeedbackInboxItem {
797
822
  epicId: string | null;
798
823
  /** Screenshot metadata in submission order; `path` = local cache file, null until downloaded. */
799
824
  images: { mime: string; bytes: number; path: string | null }[];
825
+ /** Host's opaque widget context (page/marks/console/network), <= 262144 bytes of JSON; untrusted shape. */
826
+ context?: Record<string, unknown> | null;
800
827
  }
801
828
 
802
829
  export interface CustomerFeedbackOwnerInfo {
@@ -804,6 +831,188 @@ export interface CustomerFeedbackOwnerInfo {
804
831
  projectCwd: string | null;
805
832
  }
806
833
 
834
+ // Website-feedback widgets + their decrypted inbox. Results mirror
835
+ // src/main/lib/feedback-remote/siteFeedbackService.cjs (via siteFeedbackIpc.cjs, which strips
836
+ // secret-named fields); each `*Input` mirrors the same-named zod schema in src/main/ipcSchemas.cjs
837
+ // (SiteFeedbackWidgetCreateInput ↔ siteFeedbackWidgetCreate, …).
838
+ export type SiteFeedbackStatus = 'open' | 'in_progress' | 'resolved' | 'wontfix';
839
+ /** Relay box state; 'unknown' = relay unreadable, 'gone' = relay no longer lists the box. */
840
+ export type SiteFeedbackWidgetState = 'open' | 'paused' | 'unknown' | 'gone' | (string & {});
841
+ export type SiteFeedbackImageKind = 'screenshot' | 'annotated';
842
+
843
+ /** Every siteFeedback call resolves this on failure; relay error codes pass through verbatim. */
844
+ export interface SiteFeedbackFailure {
845
+ ok: false;
846
+ error: string;
847
+ message: string;
848
+ status?: number;
849
+ retryAfterSec?: number;
850
+ }
851
+ export type SiteFeedbackResult<T> = ({ ok: true } & T) | SiteFeedbackFailure;
852
+
853
+ export interface SiteFeedbackWidget {
854
+ boxId: string;
855
+ projectCwd: string;
856
+ fingerprint: string;
857
+ createdAt: string;
858
+ /** The one-line `<script>` embed. */
859
+ snippet: string;
860
+ label: string;
861
+ allowedOrigins: string[];
862
+ state: SiteFeedbackWidgetState;
863
+ /** Envelopes waiting on the relay; null when the relay could not be read. */
864
+ pending: number | null;
865
+ hint: string | null;
866
+ }
867
+
868
+ /** updateWidget echoes the relay's view of the box. */
869
+ export interface SiteFeedbackWidgetPatched {
870
+ boxId: string;
871
+ label?: string;
872
+ allowedOrigins?: string[];
873
+ state?: string;
874
+ pending?: number;
875
+ }
876
+
877
+ export interface SiteFeedbackSnippet {
878
+ boxId: string;
879
+ fingerprint: string;
880
+ snippet: string;
881
+ }
882
+
883
+ /** meta.json of one stored item (siteFeedbackInbox.cjs InboxMeta). */
884
+ export interface SiteFeedbackItemMeta {
885
+ hostId: string;
886
+ boxId: string;
887
+ receivedAt: string;
888
+ origin: string;
889
+ status: SiteFeedbackStatus;
890
+ statusNote: string | null;
891
+ epicId: string | null;
892
+ statusChangedAt: string;
893
+ /** The drain's signed-reporter check: true verified, false signature did not match, null / absent claimed by site. */
894
+ reporterVerified?: boolean | null;
895
+ }
896
+
897
+ /** One inbox row (siteFeedbackInbox.cjs InboxSummary). */
898
+ export interface SiteFeedbackInboxItem extends SiteFeedbackItemMeta {
899
+ title: string;
900
+ type: SiteFeedbackReportType | (string & {});
901
+ reporter: { id: string; name: string | null; email: string | null } | null;
902
+ }
903
+
904
+ export type SiteFeedbackReportType = 'bug' | 'feature' | 'other';
905
+ export type SiteFeedbackMarkColor = '#a83818' | '#f4b942' | '#2e5a3e' | '#1a1612';
906
+
907
+ export interface SiteFeedbackElementInfo {
908
+ selector: string;
909
+ label?: string;
910
+ tag: string;
911
+ id?: string;
912
+ classes?: string[];
913
+ text?: string;
914
+ role?: string;
915
+ ariaLabel?: string;
916
+ xpath?: string;
917
+ }
918
+
919
+ export type SiteFeedbackMark =
920
+ | { kind: 'pin'; n: number; x: number; y: number; color: SiteFeedbackMarkColor; note: string }
921
+ | { kind: 'box'; n: number; x: number; y: number; w: number; h: number; color: SiteFeedbackMarkColor; note: string }
922
+ | {
923
+ kind: 'element'; n: number; x: number; y: number; w: number; h: number;
924
+ color: SiteFeedbackMarkColor; note: string; element: SiteFeedbackElementInfo;
925
+ }
926
+ | { kind: 'arrow'; x1: number; y1: number; x2: number; y2: number; color: SiteFeedbackMarkColor }
927
+ | { kind: 'draw'; points: [number, number][]; color: SiteFeedbackMarkColor }
928
+ | { kind: 'text'; x: number; y: number; text: string; color: SiteFeedbackMarkColor };
929
+
930
+ /** Report v1 as stored (feedbackReport.cjs reportSchema / web/feedback-widget/schema/report.v1.json). */
931
+ export interface SiteFeedbackReport {
932
+ schemaVersion: 1;
933
+ clientReportId: string;
934
+ project: string;
935
+ type: SiteFeedbackReportType;
936
+ title: string;
937
+ details: string;
938
+ createdAt: string;
939
+ page: {
940
+ url: string;
941
+ title: string;
942
+ viewport: { width: number; height: number; devicePixelRatio: number; scrollX: number; scrollY: number };
943
+ };
944
+ screenshot: { part: 'screenshot'; annotatedPart: 'annotated'; width: number; height: number; scale: number };
945
+ marks: SiteFeedbackMark[];
946
+ console:
947
+ | { level: 'error'; message: string; stack?: string; source?: string; timestamp: string; count: number }[]
948
+ | null;
949
+ network:
950
+ | { method: string; url: string; status: number | 'network-error' | 'timeout'; durationMs: number; timestamp: string }[]
951
+ | null;
952
+ user: { id: string; name?: string; email?: string; [k: string]: unknown } | null;
953
+ client: { widgetVersion: string; captureError?: string };
954
+ }
955
+
956
+ /** One item in full (siteFeedbackInbox.cjs get()). `report` is null when report.json is unreadable. */
957
+ export interface SiteFeedbackItemDetail {
958
+ meta: SiteFeedbackItemMeta;
959
+ report: SiteFeedbackReport | null;
960
+ /** Local file paths; null when that image is absent. Use inboxImage to display one. */
961
+ imagePaths: { screenshot: string | null; annotated: string | null };
962
+ }
963
+
964
+ export interface SiteFeedbackDrainResult {
965
+ stored: number;
966
+ duplicates: number;
967
+ rejected: number;
968
+ goneBoxes: string[];
969
+ heldBoxes: string[];
970
+ }
971
+
972
+ export interface SiteFeedbackWidgetCreateInput {
973
+ cwd: string;
974
+ label: string;
975
+ allowedOrigins: string[];
976
+ }
977
+ export interface SiteFeedbackWidgetListInput {
978
+ cwd?: string;
979
+ }
980
+ export interface SiteFeedbackWidgetUpdateInput {
981
+ boxId: string;
982
+ label?: string;
983
+ allowedOrigins?: string[];
984
+ state?: 'open' | 'paused';
985
+ }
986
+ export interface SiteFeedbackWidgetBoxInput {
987
+ boxId: string;
988
+ }
989
+ export interface SiteFeedbackInboxListInput {
990
+ cwd: string;
991
+ status?: SiteFeedbackStatus;
992
+ }
993
+ export interface SiteFeedbackInboxGetInput {
994
+ cwd: string;
995
+ /** `FB-` + 5 of [0-9A-Z]. */
996
+ hostId: string;
997
+ }
998
+ export interface SiteFeedbackInboxImageInput {
999
+ cwd: string;
1000
+ hostId: string;
1001
+ /** Default 'annotated'. */
1002
+ which?: SiteFeedbackImageKind;
1003
+ }
1004
+ export interface SiteFeedbackInboxSetStatusInput {
1005
+ cwd: string;
1006
+ hostId: string;
1007
+ status: SiteFeedbackStatus;
1008
+ note?: string | null;
1009
+ }
1010
+ export interface SiteFeedbackInboxLinkEpicInput {
1011
+ cwd: string;
1012
+ hostId: string;
1013
+ epicId: string;
1014
+ }
1015
+
807
1016
  // Product telemetry (bilko.run) — anonymous, on-by-default, opt-out. See
808
1017
  // session-manager-operations/architecture/telemetry.md for the data model.
809
1018
  export interface TelemetryConfig {
@@ -892,10 +1101,20 @@ export interface ScheduleJobRuntime {
892
1101
  }
893
1102
 
894
1103
  export interface ScheduleJob {
1104
+ /**
1105
+ * True when a human cancelled this row. Set only by main in the schedule:state
1106
+ * payload, from lib/scheduler/cancelledRow.cjs isCancelledRow — the renderer
1107
+ * must read this and never re-derive the rule. Never stored in queue.json.
1108
+ */
1109
+ cancelled?: boolean;
895
1110
  macroId?: string | null;
1111
+ /** Content id of the AgentSnapshot the first dispatch pinned; a resume re-runs it, never the live persona. */
1112
+ agentSnapshotId?: string;
896
1113
  /** PRD frontmatter artifact-only declaration (PRD 3114). */
897
1114
  deliverable?: 'artifact' | null;
898
1115
  artifactPaths?: string[] | null;
1116
+ /** PRD frontmatter library voice (in-process only); handed to the job as SM_VOICE_ID. */
1117
+ voiceId?: string | null;
899
1118
  slug: string;
900
1119
  title: string;
901
1120
  cwd: string | null;
@@ -1183,7 +1402,7 @@ export interface ScheduleLaunchMitigation {
1183
1402
  * Every field is computed by tickQueue; nothing here is derived in the UI. */
1184
1403
  export interface ScheduleLastTick {
1185
1404
  fired: boolean;
1186
- reason: 'held' | 'slots-exhausted' | 'memory-deferred' | 'already-running' | 'drained' | 'paused' | string;
1405
+ reason: 'held' | 'slots-exhausted' | 'memory-deferred' | 'already-running' | 'drained' | 'paused' | 'utilization-held' | 'manual-fire-policy' | 'usage-meter-degraded' | 'load-deferred' | string;
1187
1406
  /** Human-readable one-liner for the binding constraint, when there is one. */
1188
1407
  detail?: string;
1189
1408
  deferredCount?: number;
@@ -1550,8 +1769,14 @@ export type TaskGetResult =
1550
1769
  | { ok: true; task: TaskDetail | null }
1551
1770
  | { ok: false; error: string };
1552
1771
 
1772
+ /** Who made the last change to a project's 'Scripts may run Tasks' switch (taskSwitch.cjs). */
1773
+ export type TaskSwitchBy =
1774
+ | { via: 'ui' }
1775
+ | { via: 'agent'; claudeSessionId: string; quote: string; promptAt: string }
1776
+ | { via: 'unknown' };
1777
+
1553
1778
  export type TaskGetSwitchResult =
1554
- | { ok: true; enabled: boolean }
1779
+ | { ok: true; enabled: boolean; changedAt?: string | null; by?: TaskSwitchBy | null }
1555
1780
  | { ok: false; error: string };
1556
1781
 
1557
1782
  export type TaskSetSwitchResult =
@@ -1869,7 +2094,9 @@ export interface ProjectPageMeta {
1869
2094
  export interface ProjectVideoMeta {
1870
2095
  id: string;
1871
2096
  title: string;
1872
- kind: 'project-demo' | 'blog-post' | 'feature' | 'episode';
2097
+ kind: 'project-demo' | 'blog-post' | 'feature' | 'episode' | 'tiktok' | 'marketing';
2098
+ /** TikTok post copy (caption 1-150 chars, audience 1-200 chars); absent on other kinds and older entries. */
2099
+ post?: { caption: string; audience: string };
1873
2100
  /** Frame shape from the document's sm-demo-aspect tag; absent on older entries (treat as '16:9'). */
1874
2101
  aspect?: '16:9' | '9:16';
1875
2102
  /** The `Video target:` text the video was built for (a post path or URL, or a feature name); absent for a Project demo. */
@@ -1901,9 +2128,25 @@ export interface ProjectLibraryEntry<M> {
1901
2128
  mtimeMs: number;
1902
2129
  meta: M | null;
1903
2130
  error: string | null;
2131
+ /** Video entries only: absolute paths of the exported videos/<id>/video.mp4 and poster.png, null when absent. */
2132
+ exports?: { mp4: string | null; poster: string | null };
2133
+ }
2134
+
2135
+ /** A video run that ended without a video by design (videos/<id>/outcome.json, no index.html). */
2136
+ export interface ProjectVideoOutcome {
2137
+ id: string;
2138
+ outcome: 'season-complete';
2139
+ /** The one-line text the run saved. */
2140
+ text: string;
2141
+ /** ISO time the outcome was recorded. */
2142
+ at: string;
1904
2143
  }
1905
2144
 
1906
2145
  export interface ProjectPagesGetResult {
2146
+ /** Video outcomes, newest first; absent when there are none. */
2147
+ outcomes?: ProjectVideoOutcome[];
2148
+ /** The project's saved persona (videos/_character), or null when none/invalid. */
2149
+ persona?: { name: string } | null;
1907
2150
  /** Knowledge pages, newest first. */
1908
2151
  knowledge: ProjectLibraryEntry<ProjectPageMeta>[];
1909
2152
  /** Videos, newest first. */
@@ -2012,6 +2255,88 @@ export type VideoReviewRetryResult =
2012
2255
  | { ok: true; slug: string; epicId: string; entryId?: string | null; stage?: string }
2013
2256
  | { ok: false; error: string; activeSlug?: string };
2014
2257
 
2258
+ // ────────────────────────────────────────────── Voices screen
2259
+ // Mirrors src/main/lib/demo-video-kit/voiceLibrary.cjs (listVoices) and
2260
+ // src/main/lib/project-pages/voicesIpc.cjs (voices:list / preview / approve / unapprove / delete).
2261
+ // voicesIpc is the ONLY writer of voice approvals and deletions; renderer IPC only.
2262
+
2263
+ export type VoiceScope = 'project' | 'machine' | 'builtin';
2264
+
2265
+ export interface VoiceLastPreview {
2266
+ /** ISO time the newest preview of this voice in this project left the voice lane. */
2267
+ at: string | null;
2268
+ wallMs: number | null;
2269
+ audioSeconds: number | null;
2270
+ }
2271
+
2272
+ export interface VoiceLaneTicket {
2273
+ voiceId: string | null;
2274
+ label: string | null;
2275
+ projectRoot: string | null;
2276
+ pid: number;
2277
+ since: string;
2278
+ /** 0 = currently speaking. */
2279
+ position: number;
2280
+ }
2281
+
2282
+ export interface VoiceLibraryEntry {
2283
+ id: string;
2284
+ label: string;
2285
+ voice: Record<string, unknown>;
2286
+ engine: string;
2287
+ sampleText: string;
2288
+ licence: string;
2289
+ heavy: boolean;
2290
+ pinFiles?: string[];
2291
+ scope: VoiceScope;
2292
+ /** Absent on built-ins. */
2293
+ file?: string;
2294
+ /** Built-ins only: whether the Kokoro model is installed. */
2295
+ installed?: boolean;
2296
+ approved: boolean;
2297
+ /** False when approved but the voice changed since approval (the voice is refused until re-approved). */
2298
+ pinOk: boolean;
2299
+ lastPreview: VoiceLastPreview | null;
2300
+ inLane: { lane: string; position: number } | null;
2301
+ }
2302
+
2303
+ export interface VoicesListResult {
2304
+ voices: VoiceLibraryEntry[];
2305
+ errors: Array<{ file: string; error: string }>;
2306
+ /** voiceLane.laneSnapshot(): live tickets per lane ('heavy' | 'light'). */
2307
+ lane: Record<string, VoiceLaneTicket[]>;
2308
+ }
2309
+
2310
+ export interface VoicesListPayload {
2311
+ cwd: string;
2312
+ }
2313
+
2314
+ export interface VoicesPreviewPayload {
2315
+ cwd: string;
2316
+ voiceId: string;
2317
+ /** 1-300 chars after trimming. */
2318
+ text: string;
2319
+ }
2320
+
2321
+ export type VoicesPreviewResult =
2322
+ | { ok: true; cached: boolean; wavPath: string; bytes: Uint8Array }
2323
+ | { ok: false; error: string };
2324
+
2325
+ export interface VoicesVoicePayload {
2326
+ cwd: string;
2327
+ voiceId: string;
2328
+ }
2329
+
2330
+ export type VoicesApproveResult =
2331
+ | { ok: true; voiceId: string; scope: 'project' | 'machine'; pin: string; approvedAt: string }
2332
+ | { ok: false; error: string };
2333
+
2334
+ export type VoicesUnapproveResult = { ok: true; voiceId: string } | { ok: false; error: string };
2335
+
2336
+ export type VoicesDeleteResult =
2337
+ | { ok: true; voiceId: string; scope: 'project' | 'machine'; file: string }
2338
+ | { ok: false; error: string };
2339
+
2015
2340
  // ────────────────────────────────────────────── Project Pages: markdown link network
2016
2341
  // Mirrors the JSDoc typedefs of the same names in src/main/lib/mdNetworkScan.cjs.
2017
2342
  // Every path is repo-relative POSIX.
@@ -2558,6 +2883,75 @@ export interface WebRemoteMutationResult {
2558
2883
  error?: string;
2559
2884
  }
2560
2885
 
2886
+ /** Tool names a paired service may be scoped to (servicePairings.cjs SERVICE_TOOL_NAMES). */
2887
+ export type WebRemoteServiceTool =
2888
+ | 'feedback_list_projects'
2889
+ | 'feedback_open_session'
2890
+ | 'macro_list'
2891
+ | 'macro_run'
2892
+ | 'epic_get'
2893
+ | 'events_read';
2894
+
2895
+ /** A paired service as the renderer sees it (its pinned key is never returned). */
2896
+ export interface WebRemoteService {
2897
+ serviceId: string;
2898
+ name: string;
2899
+ homeCwd: string;
2900
+ scope: WebRemoteServiceTool[];
2901
+ relayClientId: string | null;
2902
+ pairedAt: number;
2903
+ lastSeenAt: number;
2904
+ }
2905
+
2906
+ export interface WebRemotePendingService {
2907
+ pairingId: string;
2908
+ name: string;
2909
+ homeCwd: string;
2910
+ scope: WebRemoteServiceTool[];
2911
+ createdAt: number;
2912
+ expiresAt: number;
2913
+ }
2914
+
2915
+ /** A relay client no local service owns. */
2916
+ export interface WebRemoteRelayOrphan {
2917
+ clientId: string;
2918
+ clientName: string;
2919
+ issuedAt: string | number | null;
2920
+ }
2921
+
2922
+ export interface WebRemoteServicesListResult {
2923
+ ok: true;
2924
+ services: WebRemoteService[];
2925
+ pending: WebRemotePendingService[];
2926
+ relayOrphans: WebRemoteRelayOrphan[];
2927
+ /** Set when the relay client list could not be read (relayOrphans is then []). */
2928
+ relayError?: string;
2929
+ }
2930
+
2931
+ /** Mirrors zod webRemoteServicePairStart. */
2932
+ export interface WebRemoteServicePairStartInput {
2933
+ name: string;
2934
+ homeCwd: string;
2935
+ scope: WebRemoteServiceTool[];
2936
+ }
2937
+
2938
+ export type WebRemoteServicePairStartResult =
2939
+ | { ok: true; code: string; pairingId: string; codeExpiresAt: number; deviceId: string }
2940
+ | { ok: false; error: 'relay_unsupported' | 'device_token_invalid' | 'rate_limited' | 'no_paired_device' | (string & {}) };
2941
+
2942
+ export type WebRemoteServiceConfirmSasResult =
2943
+ | { ok: true; service: WebRemoteService }
2944
+ | { ok: false; error: string };
2945
+
2946
+ /** webRemote.cjs servicePairCancel: `cancelled` = a pending pairing was dropped; `dropped` = waiting clients torn down. */
2947
+ export type WebRemoteServicePairCancelResult =
2948
+ | { ok: true; cancelled: boolean; dropped: number }
2949
+ | { ok: false; error: string };
2950
+
2951
+ export type WebRemoteServiceRevokeResult =
2952
+ | { ok: true; relayRevoked: boolean }
2953
+ | { ok: false; error: string };
2954
+
2561
2955
  export interface WebRemoteAuditTailResult {
2562
2956
  ok: boolean;
2563
2957
  lines?: string[];
@@ -2660,7 +3054,6 @@ export interface SessionManagerAPI {
2660
3054
  };
2661
3055
  mcp: {
2662
3056
  status: () => Promise<McpStatusResult>;
2663
- catalog: () => Promise<McpCatalogResult>;
2664
3057
  /** Desktop-only: the web remote is denied it (apiSurface remote: deny) — it spawns the server. */
2665
3058
  checkServer: (req: McpCheckRequest) => Promise<McpCheckResult>;
2666
3059
  };
@@ -2746,6 +3139,8 @@ export interface SessionManagerAPI {
2746
3139
  list: () => Promise<{ ok: true; items: NeedsYouItem[] }>;
2747
3140
  /** Answer one open item with one of its options; `ok: false` + error in words when no such open item/option. */
2748
3141
  answer: (payload: { app: string; id: string; answer: string }) => Promise<{ ok: true; item: NeedsYouItem } | { ok: false; error: string }>;
3142
+ /** IPC 'scheduler:confirm-tool': answer a tool-risk 'confirm' item (app 'tool-risk') by tool + sha256 args digest. Approve resumes the asking job's same session with a single-use clearance; Deny parks it (confirmation_denied). Applied on the scheduler's next tick. */
3143
+ confirmTool: (payload: { tool: string; argsDigest: string; approved: boolean }) => Promise<{ ok: true; item: NeedsYouItem } | { ok: false; error: string }>;
2749
3144
  /** Fires after any post/withdraw/answer — re-fetch list(). */
2750
3145
  onChanged: (handler: () => void) => () => void;
2751
3146
  };
@@ -2892,6 +3287,45 @@ export interface SessionManagerAPI {
2892
3287
  { ok: true; dataUrl: string } | { ok: false; error: string }
2893
3288
  >;
2894
3289
  };
3290
+ /** File Explorer reads of a project's Artifacts store and unmerged Epic worktrees (lib/epic/artifactIpc.cjs). Read-only. */
3291
+ artifacts: {
3292
+ /** Ledger entries of every owner, newest first, each joined with its Epic's title (null for Tasks / unknown). */
3293
+ list: (p: { cwd: string }) => Promise<ArtifactsListResult>;
3294
+ /** Active Epics of `cwd` with an on-disk, git-registered worktree. */
3295
+ worktrees: (p: { cwd: string }) => Promise<ArtifactsWorktreesResult>;
3296
+ };
3297
+ /** Website-feedback widgets + inbox (siteFeedbackIpc.cjs), one method per channel. */
3298
+ siteFeedback: {
3299
+ widgetCreate: (p: SiteFeedbackWidgetCreateInput) => Promise<
3300
+ SiteFeedbackResult<{ boxId: string; fingerprint: string; snippet: string }>
3301
+ >;
3302
+ /** Relay unreadable → ok with `relayError` and widgets in state 'unknown'. */
3303
+ widgetList: (p?: SiteFeedbackWidgetListInput) => Promise<
3304
+ SiteFeedbackResult<{ widgets: SiteFeedbackWidget[]; relayError?: SiteFeedbackFailure }>
3305
+ >;
3306
+ widgetUpdate: (p: SiteFeedbackWidgetUpdateInput) => Promise<
3307
+ SiteFeedbackResult<{ widget: SiteFeedbackWidgetPatched }>
3308
+ >;
3309
+ widgetDelete: (p: SiteFeedbackWidgetBoxInput) => Promise<SiteFeedbackResult<{ boxId: string }>>;
3310
+ widgetSnippet: (p: SiteFeedbackWidgetBoxInput) => Promise<SiteFeedbackResult<SiteFeedbackSnippet>>;
3311
+ inboxList: (p: SiteFeedbackInboxListInput) => Promise<
3312
+ SiteFeedbackResult<{ items: SiteFeedbackInboxItem[] }>
3313
+ >;
3314
+ inboxGet: (p: SiteFeedbackInboxGetInput) => Promise<SiteFeedbackResult<{ item: SiteFeedbackItemDetail }>>;
3315
+ /** A PNG data URL — never log it. */
3316
+ inboxImage: (p: SiteFeedbackInboxImageInput) => Promise<
3317
+ SiteFeedbackResult<{ hostId: string; which: SiteFeedbackImageKind; dataUrl: string }>
3318
+ >;
3319
+ inboxSetStatus: (p: SiteFeedbackInboxSetStatusInput) => Promise<
3320
+ SiteFeedbackResult<{ meta: SiteFeedbackItemMeta }>
3321
+ >;
3322
+ inboxLinkEpic: (p: SiteFeedbackInboxLinkEpicInput) => Promise<
3323
+ SiteFeedbackResult<{ meta: SiteFeedbackItemMeta }>
3324
+ >;
3325
+ /** Deletes one stored item (report, images, meta); not_found when it was already gone. */
3326
+ inboxRemove: (p: SiteFeedbackInboxGetInput) => Promise<SiteFeedbackResult<{ hostId: string }>>;
3327
+ drainNow: () => Promise<SiteFeedbackResult<SiteFeedbackDrainResult>>;
3328
+ };
2895
3329
  telemetry: {
2896
3330
  getConfig: () => Promise<TelemetryConfig>;
2897
3331
  setConfig: (cfg: TelemetryConfig) => Promise<TelemetrySetConfigResult>;
@@ -3129,6 +3563,18 @@ export interface SessionManagerAPI {
3129
3563
  /** Fires whenever a watched cwd's knowledge/videos library is added/changed/removed, carrying the freshly read library result. */
3130
3564
  onChanged: (handler: (payload: { cwd: string } & ProjectPagesGetResult) => void) => () => void;
3131
3565
  };
3566
+ voices: {
3567
+ /** Every library voice the project can use (project, machine, built-in) with approval state, last-preview stats and the live voice lane. Read-only. */
3568
+ list: (payload: VoicesListPayload) => Promise<VoicesListResult>;
3569
+ /** Speak `text` in one voice (cached clip, else waits in the voice lane). Desktop only. */
3570
+ preview: (payload: VoicesPreviewPayload) => Promise<VoicesPreviewResult>;
3571
+ /** Approve a project or machine voice at its current pin; refuses built-ins. Desktop only — the only approval writer. */
3572
+ approve: (payload: VoicesVoicePayload) => Promise<VoicesApproveResult>;
3573
+ /** Remove a voice's approval. Desktop only. */
3574
+ unapprove: (payload: VoicesVoicePayload) => Promise<VoicesUnapproveResult>;
3575
+ /** Delete the effective project or machine voice file; refuses an approved voice and a built-in. Desktop only. */
3576
+ delete: (payload: VoicesVoicePayload) => Promise<VoicesDeleteResult>;
3577
+ };
3132
3578
  promptSessionTranscript: {
3133
3579
  /** Append one full-text turn to an Epic's durable JSONL transcript. Best-effort — resolves `{ok:false}` rather than throwing on failure. */
3134
3580
  append: (
@@ -3156,8 +3602,8 @@ export interface SessionManagerAPI {
3156
3602
  * Kind allowlist is enforced main-side (ipcSchemas.cjs) — this channel is
3157
3603
  * append-only, no read/list IPC exists. */
3158
3604
  append: (
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 },
3605
+ kind: 'epic_create' | 'epic_approve' | 'epic_complete' | 'epic_delete' | 'epic_resume' | 'epic_duplicate' | 'epic_draft_update',
3606
+ fields: { cwd: string; epicId: string; source: string },
3161
3607
  ) => Promise<{ ok: boolean }>;
3162
3608
  };
3163
3609
  git: {
@@ -3209,6 +3655,18 @@ export interface SessionManagerAPI {
3209
3655
  * E2E session as authenticated and unblocks MUTATE-tier commands. Pass the
3210
3656
  * client's `key` when several clients are pending (else `ambiguous_pending_sas`). */
3211
3657
  confirmSas: (clientKey?: string) => Promise<WebRemoteMutationResult>;
3658
+ /** Paired + pending services (no keys or tokens) plus relay orphans. */
3659
+ servicesList: () => Promise<WebRemoteServicesListResult>;
3660
+ /** One-time relay client code (8 chars, 5 minutes) + a pending pairing. */
3661
+ servicePairStart: (input: WebRemoteServicePairStartInput) => Promise<WebRemoteServicePairStartResult>;
3662
+ /** Confirm a pending service's 6-digit SAS. */
3663
+ serviceConfirmSas: (pairingId: string, sas: string) => Promise<WebRemoteServiceConfirmSasResult>;
3664
+ /** Cancel a pending pairing and drop its waiting service client. */
3665
+ servicePairCancel: (pairingId: string) => Promise<WebRemoteServicePairCancelResult>;
3666
+ /** Revoke a paired service locally and at the relay (relay failure still revokes locally). */
3667
+ serviceRevoke: (serviceId: string) => Promise<WebRemoteServiceRevokeResult>;
3668
+ /** Revoke an orphaned relay client. */
3669
+ relayClientRevoke: (clientId: string) => Promise<WebRemoteMutationResult>;
3212
3670
  };
3213
3671
  chat: {
3214
3672
  /** Spawn a headless `claude -p` run for a tab. Results arrive via the on* listeners. */
@@ -3317,10 +3775,39 @@ export interface SessionManagerAPI {
3317
3775
  archiveTranscript: (payload: { cwd: string; epicId: string; claudeSessionId: string }) => Promise<{ path: string; bytes: number; gzBytes: number; sha256: string } | null>;
3318
3776
  /** Reopens a completed Epic in place (same id + claudeSessionId); never mints an Epic. */
3319
3777
  reopen: (payload: PromptSessionsReopenPayload) => Promise<PromptSessionsReopenResult>;
3778
+ /** Re-snapshots the Epic's persona and re-stamps its agentSnapshotId — the only way a live
3779
+ * persona edit reaches an existing Epic (lib/epic/epicAgentRefresh.cjs). Audited; same id = no-op. */
3780
+ refreshAgentSnapshot: (payload: EpicRefreshAgentSnapshotPayload) => Promise<EpicRefreshAgentSnapshotResult>;
3781
+ /** epic:purge — deletes a completed Epic's transcripts, run logs, history rows, PRDs, events and
3782
+ * JSON, leaving a content-free tombstone + one audit record (lib/epic/epicPurge.cjs). Human-only:
3783
+ * the Purge button (typed-id confirm) is its only caller. `dryRun: true` deletes and writes
3784
+ * nothing and returns what a purge would remove (the confirm shows its count). */
3785
+ purge: (payload: EpicPurgePayload) => Promise<EpicPurgeResult>;
3320
3786
  };
3321
3787
  }
3322
3788
 
3323
3789
  export interface PromptSessionsReopenPayload { cwd: string; epicId: string }
3790
+ export interface EpicRefreshAgentSnapshotPayload { cwd: string; epicId: string }
3791
+ export interface EpicPurgePayload { cwd: string; epicId: string; dryRun?: boolean }
3792
+ export type EpicPurgeArtifactKind =
3793
+ | 'cli-transcript' | 'run-log' | 'history-rows' | 'prd-sources' | 'plan-records'
3794
+ | 'event-log' | 'agent-snapshot' | 'archived-transcript' | 'epic-json' | 'index-row'
3795
+ export interface EpicPurgeArtifact { kind: EpicPurgeArtifactKind; path: string }
3796
+ export type EpicPurgeResult =
3797
+ | {
3798
+ ok: true
3799
+ /** true = nothing was touched; `removed` is then []. */
3800
+ dryRun: boolean
3801
+ artifacts: EpicPurgeArtifact[]
3802
+ counts: Record<EpicPurgeArtifactKind, number>
3803
+ total: number
3804
+ removed: string[]
3805
+ }
3806
+ | { ok: false; code: 'not_human' | 'invalid_epic_id' | 'invalid_cwd' | 'epic_running' | string; error: string };
3807
+ export type EpicRefreshAgentSnapshotResult =
3808
+ | { ok: true; changed: boolean; from: string | null; to: string; session: PromptSession }
3809
+ | { ok: false; code: string; message: string };
3810
+
3324
3811
  export type PromptSessionsReopenResult =
3325
3812
  | { ok: true; session: PromptSession; events: PromptSessionEvent[]; alreadyOpen: boolean }
3326
3813
  | { ok: false; code: 'not_found' | 'transcript_missing' | 'invalid_session_id' | 'restore_failed' | 'write_failed'; message: string };
@@ -3370,7 +3857,7 @@ export interface PromptSessionsCreateEpicPayload {
3370
3857
  text: string;
3371
3858
  source?: string;
3372
3859
  /** Which part of its AIM slot this entry is; absent on Epics minted before AIM sections. */
3373
- part?: 'persona' | 'grounding' | 'injection' | 'handoff' | 'reference' | 'job-type' | 'goal';
3860
+ part?: 'persona' | 'grounding' | 'injection' | 'reference' | 'job-type' | 'goal';
3374
3861
  }>;
3375
3862
  /** Adopt an existing CLI session of this project instead of minting one. */
3376
3863
  restoreSessionId?: string;
@@ -3495,9 +3982,13 @@ export interface PromptSessionEventAppendedPayload {
3495
3982
  text?: string;
3496
3983
  /** 'job-not-queued' = a macro's background build could not be queued for this Epic (macroJobIpc.cjs);
3497
3984
  * 'build-done' / 'build-failed' = a macro's background-build PRD finished (scheduler.cjs notifyOriginatingTab). */
3498
- notice?: 'job-not-queued' | 'build-done' | 'build-failed';
3985
+ notice?: 'job-not-queued' | 'build-done' | 'build-failed' | 'artifact-ready';
3499
3986
  /** The saved Project Home entry a 'build-done' notice names, when its meta.json was readable. */
3500
3987
  buildOutput?: { kind: 'video' | 'knowledge'; id: string; title: string };
3988
+ /** 'artifact-ready' rows (lib/epic/artifactNotice.cjs); `path` is relative to the project cwd. */
3989
+ artifacts?: Array<{ title: string; kind: string; path: string; size: number }>;
3990
+ /** 'artifact-ready' only — artifacts beyond the listed rows. */
3991
+ moreCount?: number;
3501
3992
  };
3502
3993
  }
3503
3994