@rryando/arcs 5.2.0 → 5.2.1

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 (195) hide show
  1. package/README.md +29 -16
  2. package/dist/cli/commands/bundle.js +39 -0
  3. package/dist/cli/commands/bundle.js.map +1 -1
  4. package/dist/cli/commands/web.js +2 -2
  5. package/dist/cli/commands/web.js.map +1 -1
  6. package/dist/cli/config.d.ts +18 -0
  7. package/dist/cli/config.d.ts.map +1 -1
  8. package/dist/cli/config.js +46 -0
  9. package/dist/cli/config.js.map +1 -1
  10. package/dist/cli/setup.d.ts.map +1 -1
  11. package/dist/cli/setup.js +218 -35
  12. package/dist/cli/setup.js.map +1 -1
  13. package/dist/utils/json-schemas.d.ts +9 -9
  14. package/dist/utils/json-schemas.d.ts.map +1 -1
  15. package/dist/utils/json-schemas.js +1 -1
  16. package/dist/utils/json-schemas.js.map +1 -1
  17. package/dist/utils/run-transcript.d.ts +138 -0
  18. package/dist/utils/run-transcript.d.ts.map +1 -0
  19. package/dist/utils/run-transcript.js +146 -0
  20. package/dist/utils/run-transcript.js.map +1 -0
  21. package/dist/utils/storage-utils.d.ts +1 -1
  22. package/dist/utils/storage-utils.d.ts.map +1 -1
  23. package/dist/utils/storage-utils.js +1 -1
  24. package/dist/utils/storage-utils.js.map +1 -1
  25. package/dist/web-client/assets/{GraphCanvas-DvTmx2os.js → GraphCanvas-BgWF1rB_.js} +1 -1
  26. package/dist/web-client/assets/{MarkdownEditor-B8j_5lK7.js → MarkdownEditor-5buYPQ1d.js} +1 -1
  27. package/dist/web-client/assets/{abnfDiagram-VRR7QNED-DZ5c8NM5.js → abnfDiagram-VRR7QNED-AjQ08-zY.js} +1 -1
  28. package/dist/web-client/assets/architecture-TIHT7OUA-a3lTAuFS.js +1 -0
  29. package/dist/web-client/assets/{architectureDiagram-ZJ3FMSHR-DeNroB33.js → architectureDiagram-ZJ3FMSHR-CtW2pYEp.js} +1 -1
  30. package/dist/web-client/assets/{blockDiagram-677ZJIJ3-C92i1GHh.js → blockDiagram-677ZJIJ3-DE6HRcpA.js} +1 -1
  31. package/dist/web-client/assets/{c4Diagram-LMCZKHZV-BniYzyYJ.js → c4Diagram-LMCZKHZV-Rn6iQdUl.js} +1 -1
  32. package/dist/web-client/assets/channel-Rxk7gzWl.js +1 -0
  33. package/dist/web-client/assets/{chunk-32BRIVSS-DXA4fMwe.js → chunk-32BRIVSS-C4-ay_Qd.js} +1 -1
  34. package/dist/web-client/assets/{chunk-52WLFC77-DxLpDT5g.js → chunk-52WLFC77-Bib0DU0H.js} +1 -1
  35. package/dist/web-client/assets/{chunk-C7G6YPKG-DC22BvA6.js → chunk-C7G6YPKG-BLphnESE.js} +1 -1
  36. package/dist/web-client/assets/{chunk-EX3LRPZG-CP5bMsNz.js → chunk-EX3LRPZG-CzvkrPNM.js} +1 -1
  37. package/dist/web-client/assets/{chunk-FWX5IMBZ-CRhTkdyH.js → chunk-FWX5IMBZ-BFTR_OLz.js} +2 -2
  38. package/dist/web-client/assets/{chunk-HOUHSVGY-BL8xdKlN.js → chunk-HOUHSVGY-CZS3ExUR.js} +1 -1
  39. package/dist/web-client/assets/{chunk-ICXQ74PX-B7Ur00R9.js → chunk-ICXQ74PX-iWFpNZgv.js} +1 -1
  40. package/dist/web-client/assets/{chunk-MOJQB5TN-D9EnTuIj.js → chunk-MOJQB5TN-opEQCwVq.js} +1 -1
  41. package/dist/web-client/assets/{chunk-OGEWGWER-Dr-xsHrU.js → chunk-OGEWGWER-NCfmjyhi.js} +1 -1
  42. package/dist/web-client/assets/{chunk-PUDLZKDR-BIrspPOB.js → chunk-PUDLZKDR-D3_A--Z2.js} +1 -1
  43. package/dist/web-client/assets/{chunk-Q4XR5HBZ-Dfip_4XA.js → chunk-Q4XR5HBZ-D6s-qZLi.js} +1 -1
  44. package/dist/web-client/assets/{chunk-V7JOEXUC-CWqwzV_g.js → chunk-V7JOEXUC-DTqLR-bZ.js} +1 -1
  45. package/dist/web-client/assets/{chunk-VAUOI2AC-EosDVEFn.js → chunk-VAUOI2AC-Gsd0Itap.js} +1 -1
  46. package/dist/web-client/assets/{chunk-VR4S4FIN-DnMox7F5.js → chunk-VR4S4FIN-Cdo_MeDQ.js} +1 -1
  47. package/dist/web-client/assets/{chunk-WYO6CB5R-B3xja0Q5.js → chunk-WYO6CB5R-n7FhYrli.js} +1 -1
  48. package/dist/web-client/assets/{chunk-ZGVPDNZ5-BGoIOVsc.js → chunk-ZGVPDNZ5-DU1Jcue0.js} +1 -1
  49. package/dist/web-client/assets/classDiagram-OUVF2IWQ-BG5uYDvC.js +1 -0
  50. package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-BG5uYDvC.js +1 -0
  51. package/dist/web-client/assets/{cynefin-VYW2F7L2-BlBnSViH.js → cynefin-VYW2F7L2-D-gD9LCO.js} +1 -1
  52. package/dist/web-client/assets/{cynefinDiagram-TSTJHNR4-jRcAddSh.js → cynefinDiagram-TSTJHNR4-BFGkcrNl.js} +1 -1
  53. package/dist/web-client/assets/{dagre-VKFMJZFB-D4elj7jV.js → dagre-VKFMJZFB-BUaC6fks.js} +1 -1
  54. package/dist/web-client/assets/{diagram-FQU43EPY-D7OKzbLh.js → diagram-FQU43EPY-Ckgu02XC.js} +1 -1
  55. package/dist/web-client/assets/{diagram-G47NLZAW-DBF9p-RV.js → diagram-G47NLZAW-BickHhmE.js} +1 -1
  56. package/dist/web-client/assets/{diagram-NH7WQ7WH-CpE02PRM.js → diagram-NH7WQ7WH-CoqgJpcU.js} +1 -1
  57. package/dist/web-client/assets/{diagram-OA4YK3LP-BdJ1lOcZ.js → diagram-OA4YK3LP-CTSZWqCe.js} +1 -1
  58. package/dist/web-client/assets/{diagram-WEI45ONY-BpPxpOcu.js → diagram-WEI45ONY-D7xd1naU.js} +1 -1
  59. package/dist/web-client/assets/{ebnfDiagram-CCIWWBDH-DLKdgImF.js → ebnfDiagram-CCIWWBDH-FESKYpKQ.js} +1 -1
  60. package/dist/web-client/assets/{erDiagram-Q63AITRT-c0bbf0vk.js → erDiagram-Q63AITRT-C-879ftU.js} +1 -1
  61. package/dist/web-client/assets/eventmodeling-45OFAUF4-C3kRZCei.js +1 -0
  62. package/dist/web-client/assets/flowDiagram-23GEKE2U-QKWFycdH.js +1 -0
  63. package/dist/web-client/assets/{ganttDiagram-NO4QXBWP-Ynj8Qkax.js → ganttDiagram-NO4QXBWP-mIX5nPpv.js} +1 -1
  64. package/dist/web-client/assets/{gitGraph-TEB2WS4Q-j-MdxZrn.js → gitGraph-TEB2WS4Q-DlEDJ1IK.js} +1 -1
  65. package/dist/web-client/assets/{gitGraphDiagram-IHSO6WYX-SaPe2Npn.js → gitGraphDiagram-IHSO6WYX-D2fXD4AO.js} +1 -1
  66. package/dist/web-client/assets/index-BsYR-C8u.js +61 -0
  67. package/dist/web-client/assets/index-Cc5DCTOr.css +2 -0
  68. package/dist/web-client/assets/{info-DKCQHKI2-DzsnPugh.js → info-DKCQHKI2-jinbCROt.js} +1 -1
  69. package/dist/web-client/assets/{infoDiagram-FWYZ7A6U-e6BJvSRj.js → infoDiagram-FWYZ7A6U-CM-A4TL8.js} +1 -1
  70. package/dist/web-client/assets/{ishikawaDiagram-FXEZZL3T-DI1KDN2v.js → ishikawaDiagram-FXEZZL3T-BdFpHwp4.js} +1 -1
  71. package/dist/web-client/assets/{journeyDiagram-5HDEW3XC-BQbFOIm6.js → journeyDiagram-5HDEW3XC-BwDWz25z.js} +1 -1
  72. package/dist/web-client/assets/{kanban-definition-HUTT4EX6-D5DV7Dh0.js → kanban-definition-HUTT4EX6-_2QXjSvx.js} +1 -1
  73. package/dist/web-client/assets/{line-D_qHyqs1.js → line-HCziev87.js} +1 -1
  74. package/dist/web-client/assets/{mermaid-parser.core-VzGX5B89.js → mermaid-parser.core-C4139mkz.js} +3 -3
  75. package/dist/web-client/assets/{mermaid.core-BqWcehVs.js → mermaid.core-ocHwkZiF.js} +3 -3
  76. package/dist/web-client/assets/{mindmap-definition-LN4V7U3C-CcZZrFcy.js → mindmap-definition-LN4V7U3C-DHyCmflp.js} +1 -1
  77. package/dist/web-client/assets/{packet-7NZHBO7P-DWMuocpD.js → packet-7NZHBO7P-Bk0w_irl.js} +1 -1
  78. package/dist/web-client/assets/{pegDiagram-2B236MQR-CQfp4S-y.js → pegDiagram-2B236MQR-D_GrmL93.js} +1 -1
  79. package/dist/web-client/assets/{pie-RZYD4A2V-BlI6y28n.js → pie-RZYD4A2V-B6VIAbyj.js} +1 -1
  80. package/dist/web-client/assets/{pieDiagram-ENE6RG2P-DEsRhIVS.js → pieDiagram-ENE6RG2P-CiR2Y8y2.js} +1 -1
  81. package/dist/web-client/assets/{quadrantDiagram-ABIIQ3AL-BZCSbtlm.js → quadrantDiagram-ABIIQ3AL-CLlicKmV.js} +1 -1
  82. package/dist/web-client/assets/{radar-I7S5WNFK-DlwfjSpa.js → radar-I7S5WNFK-B53XVRSZ.js} +1 -1
  83. package/dist/web-client/assets/{railroad-3IZDKUUU-Be-bZpf0.js → railroad-3IZDKUUU-Dn8TN2M-.js} +1 -1
  84. package/dist/web-client/assets/railroad-abnf-AHOZXSZD-UrOKy6yx.js +1 -0
  85. package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-Bx73sfMZ.js +1 -0
  86. package/dist/web-client/assets/railroad-peg-LSFZ7HO6-C4QEje-y.js +1 -0
  87. package/dist/web-client/assets/{railroadDiagram-RFXS5EU6-ClVubHv1.js → railroadDiagram-RFXS5EU6-C6kZwOio.js} +1 -1
  88. package/dist/web-client/assets/{requirementDiagram-TGXJPOKE-swYyFYJk.js → requirementDiagram-TGXJPOKE-D2b1MeP8.js} +1 -1
  89. package/dist/web-client/assets/{sankeyDiagram-HTMAVEWB-LAu1XR2n.js → sankeyDiagram-HTMAVEWB-pS_Ufq1E.js} +1 -1
  90. package/dist/web-client/assets/{sequenceDiagram-DBY2YBRQ-XvIU8hX9.js → sequenceDiagram-DBY2YBRQ-BrsKXNzu.js} +1 -1
  91. package/dist/web-client/assets/{stateDiagram-2N3HPSRC-C3nbJ1dX.js → stateDiagram-2N3HPSRC-BuQKu3i0.js} +1 -1
  92. package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-BhqgaxDu.js +1 -0
  93. package/dist/web-client/assets/{swimlanes-5IMT3BWC-BF5fFeNe.js → swimlanes-5IMT3BWC-CzoImfTA.js} +1 -1
  94. package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-CHOEI9hI.js +8 -0
  95. package/dist/web-client/assets/{timeline-definition-FHXFAJF6-CjK82kFp.js → timeline-definition-FHXFAJF6-DvezW7Fr.js} +1 -1
  96. package/dist/web-client/assets/{treeView-QDETBFTQ-DBRGCYnY.js → treeView-QDETBFTQ-xu58R4kS.js} +1 -1
  97. package/dist/web-client/assets/{treemap-6X3UGDF4-BIexMw3j.js → treemap-6X3UGDF4-DMYBAOW1.js} +1 -1
  98. package/dist/web-client/assets/{vennDiagram-L72KCM5P-DOjvh0XG.js → vennDiagram-L72KCM5P-l1CbC7Ig.js} +1 -1
  99. package/dist/web-client/assets/{wardley-OPB4EBWU-Dxw6mW95.js → wardley-OPB4EBWU-G3zmnnM0.js} +1 -1
  100. package/dist/web-client/assets/{wardleyDiagram-EHGQE667-D1A7JTB_.js → wardleyDiagram-EHGQE667-Dl2I79Vx.js} +1 -1
  101. package/dist/web-client/assets/{xychartDiagram-FW5EYKEG-CxvobQJD.js → xychartDiagram-FW5EYKEG-BWfge21N.js} +1 -1
  102. package/dist/web-client/index.html +2 -2
  103. package/dist/web-server/app.d.ts.map +1 -1
  104. package/dist/web-server/app.js +11 -7
  105. package/dist/web-server/app.js.map +1 -1
  106. package/dist/web-server/ask-prompt.d.ts +70 -0
  107. package/dist/web-server/ask-prompt.d.ts.map +1 -0
  108. package/dist/web-server/ask-prompt.js +238 -0
  109. package/dist/web-server/ask-prompt.js.map +1 -0
  110. package/dist/web-server/index.d.ts.map +1 -1
  111. package/dist/web-server/index.js +56 -3
  112. package/dist/web-server/index.js.map +1 -1
  113. package/dist/web-server/respond.d.ts.map +1 -1
  114. package/dist/web-server/respond.js +2 -1
  115. package/dist/web-server/respond.js.map +1 -1
  116. package/dist/web-server/routes/ask.d.ts +29 -0
  117. package/dist/web-server/routes/ask.d.ts.map +1 -0
  118. package/dist/web-server/routes/ask.js +698 -0
  119. package/dist/web-server/routes/ask.js.map +1 -0
  120. package/dist/web-server/routes/changes.d.ts +35 -0
  121. package/dist/web-server/routes/changes.d.ts.map +1 -0
  122. package/dist/web-server/routes/changes.js +93 -0
  123. package/dist/web-server/routes/changes.js.map +1 -0
  124. package/dist/web-server/routes/runners.d.ts +15 -0
  125. package/dist/web-server/routes/runners.d.ts.map +1 -0
  126. package/dist/web-server/routes/runners.js +66 -0
  127. package/dist/web-server/routes/runners.js.map +1 -0
  128. package/dist/web-server/routes/workspace.d.ts +2 -2
  129. package/dist/web-server/routes/workspace.js +4 -4
  130. package/dist/web-server/run-diff.d.ts +188 -0
  131. package/dist/web-server/run-diff.d.ts.map +1 -0
  132. package/dist/web-server/run-diff.js +739 -0
  133. package/dist/web-server/run-diff.js.map +1 -0
  134. package/dist/web-server/run-driver.d.ts +102 -2
  135. package/dist/web-server/run-driver.d.ts.map +1 -1
  136. package/dist/web-server/run-driver.js +495 -1
  137. package/dist/web-server/run-driver.js.map +1 -1
  138. package/dist/web-server/run-event-log.d.ts +13 -6
  139. package/dist/web-server/run-event-log.d.ts.map +1 -1
  140. package/dist/web-server/run-event-log.js +70 -25
  141. package/dist/web-server/run-event-log.js.map +1 -1
  142. package/dist/web-server/run-store.d.ts +201 -0
  143. package/dist/web-server/run-store.d.ts.map +1 -0
  144. package/dist/web-server/run-store.js +304 -0
  145. package/dist/web-server/run-store.js.map +1 -0
  146. package/dist/web-server/watcher.d.ts.map +1 -1
  147. package/dist/web-server/watcher.js +4 -0
  148. package/dist/web-server/watcher.js.map +1 -1
  149. package/opencode/arcs/manifest.json +8 -8
  150. package/package.json +1 -1
  151. package/scripts/deploy-claudecode-bundle.mjs +1 -1
  152. package/scripts/deploy-opencode-bundle.mjs +1 -1
  153. package/scripts/deploy-pi-bundle.mjs +468 -0
  154. package/scripts/lint-bundle.mjs +1 -1
  155. package/dist/shared/session-vocabulary.d.ts +0 -88
  156. package/dist/shared/session-vocabulary.d.ts.map +0 -1
  157. package/dist/shared/session-vocabulary.js +0 -114
  158. package/dist/shared/session-vocabulary.js.map +0 -1
  159. package/dist/utils/claude-transcript.d.ts +0 -206
  160. package/dist/utils/claude-transcript.d.ts.map +0 -1
  161. package/dist/utils/claude-transcript.js +0 -384
  162. package/dist/utils/claude-transcript.js.map +0 -1
  163. package/dist/utils/session-store.d.ts +0 -313
  164. package/dist/utils/session-store.d.ts.map +0 -1
  165. package/dist/utils/session-store.js +0 -513
  166. package/dist/utils/session-store.js.map +0 -1
  167. package/dist/web-client/assets/architecture-TIHT7OUA-B6H7ClR9.js +0 -1
  168. package/dist/web-client/assets/channel-CinHQ6_V.js +0 -1
  169. package/dist/web-client/assets/classDiagram-OUVF2IWQ-D_fljwRI.js +0 -1
  170. package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-D_fljwRI.js +0 -1
  171. package/dist/web-client/assets/eventmodeling-45OFAUF4-DT6B-Tvn.js +0 -1
  172. package/dist/web-client/assets/flowDiagram-23GEKE2U-fbZofWHf.js +0 -1
  173. package/dist/web-client/assets/index-C1WQ25Ow.js +0 -60
  174. package/dist/web-client/assets/index-CHdOvANQ.css +0 -2
  175. package/dist/web-client/assets/railroad-abnf-AHOZXSZD-C5-D4PxJ.js +0 -1
  176. package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-pJcCXE74.js +0 -1
  177. package/dist/web-client/assets/railroad-peg-LSFZ7HO6-B33ruY8f.js +0 -1
  178. package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-Da0ex-S_.js +0 -1
  179. package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-cc5MstHU.js +0 -8
  180. package/dist/web-server/permission-policy.d.ts +0 -46
  181. package/dist/web-server/permission-policy.d.ts.map +0 -1
  182. package/dist/web-server/permission-policy.js +0 -96
  183. package/dist/web-server/permission-policy.js.map +0 -1
  184. package/dist/web-server/prompt-assembly.d.ts +0 -454
  185. package/dist/web-server/prompt-assembly.d.ts.map +0 -1
  186. package/dist/web-server/prompt-assembly.js +0 -1121
  187. package/dist/web-server/prompt-assembly.js.map +0 -1
  188. package/dist/web-server/routes/sessions.d.ts +0 -19
  189. package/dist/web-server/routes/sessions.d.ts.map +0 -1
  190. package/dist/web-server/routes/sessions.js +0 -1296
  191. package/dist/web-server/routes/sessions.js.map +0 -1
  192. package/dist/web-server/session-reconciler.d.ts +0 -162
  193. package/dist/web-server/session-reconciler.d.ts.map +0 -1
  194. package/dist/web-server/session-reconciler.js +0 -363
  195. package/dist/web-server/session-reconciler.js.map +0 -1
@@ -1,313 +0,0 @@
1
- /**
2
- * Session CRUD storage for ARCS projects.
3
- *
4
- * Tracks agent runtime sessions attached to a project. Unlike
5
- * tasks/plans/knowledge these records are volatile runtime state: they carry no
6
- * markdown mirror and never invalidate the graph cache.
7
- */
8
- export type { SessionLinkedNodeType, SessionRuntimeType, SessionStatus, } from "./storage-utils.js";
9
- export { SESSION_LINKED_NODE_TYPES, SESSION_RUNTIME_TYPES, SESSION_STATUSES, } from "./storage-utils.js";
10
- /**
11
- * Where a session record came from — its provenance, not its state.
12
- *
13
- * - `observed` — a runtime session ARCS merely watches: a terminal `claude`
14
- * session announcing itself through the hook bridge. Something outside ARCS
15
- * drives it.
16
- * - `arcs` — a record ARCS minted for itself (the headless oneshot/stable
17
- * threads). No terminal is attached; it is driven by headless runs only.
18
- *
19
- * Declared here rather than in storage-utils alongside the other session enums
20
- * because origin is derived by this module (legacy promotion below) and every
21
- * consumer already imports the session enums through this file.
22
- */
23
- export declare const SESSION_ORIGINS: readonly ["observed", "arcs"];
24
- export type SessionOrigin = (typeof SESSION_ORIGINS)[number];
25
- export interface SessionMeta {
26
- id: string;
27
- normalizedId: string;
28
- runtimeType: import("./storage-utils.js").SessionRuntimeType;
29
- /**
30
- * Runtime-native session id, verbatim (e.g. a claude-code session uuid).
31
- * Blank on a thread ARCS minted before its first run contacted the runtime —
32
- * an opencode thread has no id of its own until the first settled run
33
- * harvests one, and the run write-back persists it here.
34
- */
35
- runtimeSessionId: string;
36
- /**
37
- * Provenance of the record. Persisted, never client-settable, and never
38
- * rewritten by an upsert — whoever created the record fixed it. Always
39
- * present on a value read through this module even when the stored record
40
- * predates the field (see `withDerivedOrigin`).
41
- */
42
- origin: SessionOrigin;
43
- status: import("./storage-utils.js").SessionStatus;
44
- startedAt: string;
45
- lastMessageAt?: string;
46
- updatedAt: string;
47
- userEmail?: string;
48
- /**
49
- * DAG node this session is working on. Always set together with
50
- * `linkedNodeId` — a half-set link is never persisted.
51
- */
52
- linkedNodeType?: import("./storage-utils.js").SessionLinkedNodeType;
53
- /** Normalized task/plan id — never a diagram node id (T001…). */
54
- linkedNodeId?: string;
55
- /**
56
- * Id of the headless run currently claimed on this record — written when the
57
- * run is spawned and cleared when it settles (`beginSessionRun` /
58
- * `settleSessionRun`). Its presence IS the claim: a record carrying one is
59
- * believed to have a live `claude` child behind it.
60
- *
61
- * Written for the runs ARCS drives itself, so in practice every `arcs`-origin
62
- * thread; an `observed` record only carries one while a headless run targets
63
- * it. Deliberately absent from `UpdateSessionInput`: a claim is a fact about
64
- * a process, never something a caller hands in.
65
- */
66
- currentRunId?: string;
67
- /**
68
- * OS pid of the claimed run's child. Persisted because in-memory liveness
69
- * dies with the server and the restart case is exactly the one that has to be
70
- * recoverable — the startup sweep probes this pid to tell a live run from an
71
- * orphaned claim.
72
- */
73
- currentRunPid?: number;
74
- /**
75
- * ISO-8601 proof of life for the claimed run. Same unit as every other
76
- * top-level timestamp on this record; `metadata.run.*` keeps epoch ms and the
77
- * two never mix.
78
- *
79
- * SHORTCUT: nothing refreshes this mid-run yet, so it equals the run's spawn
80
- * time and RUN_HEARTBEAT_TTL_MS has to cover a whole run; upgrade to a
81
- * periodic touch (and a far shorter TTL) when the runner grows a heartbeat.
82
- */
83
- heartbeatAt?: string;
84
- /**
85
- * ISO-8601 time of the last runtime checkpoint ARCS observed — Claude Code's
86
- * `UserPromptSubmit` and `Stop` hooks. The only liveness evidence an
87
- * `observed` session ever produces: nothing else reports that a terminal
88
- * session is still working.
89
- */
90
- lastCheckpointAt?: string;
91
- metadata?: Record<string, unknown>;
92
- }
93
- export interface SessionIndex {
94
- sessions: SessionMeta[];
95
- }
96
- export interface CreateSessionInput {
97
- runtimeType: import("./storage-utils.js").SessionRuntimeType;
98
- /**
99
- * Runtime-native session id, verbatim. OPTIONAL for a thread ARCS mints
100
- * before its first run: an opencode thread has none until its first settled
101
- * run harvests one (persisted through `UpdateSessionInput`). Discovery
102
- * bridges always have the id and never pass `recordName`.
103
- */
104
- runtimeSessionId?: string;
105
- /**
106
- * Explicit record name, used as the store key when the runtime id is not
107
- * known yet. Absent → the key is normalizeIdentifier(runtimeSessionId).
108
- */
109
- recordName?: string;
110
- /**
111
- * Provenance, set once at creation and defaulting to `observed`. Only the
112
- * ARCS-minted headless threads pass `arcs`. Deliberately absent from every
113
- * request schema: provenance is a fact about who created the record, never
114
- * something a client hands in.
115
- */
116
- origin?: SessionOrigin;
117
- status?: import("./storage-utils.js").SessionStatus;
118
- startedAt?: string;
119
- lastMessageAt?: string;
120
- userEmail?: string;
121
- metadata?: Record<string, unknown>;
122
- now?: string;
123
- }
124
- export interface UpdateSessionInput {
125
- id: string;
126
- status?: import("./storage-utils.js").SessionStatus;
127
- /**
128
- * The runtime-native session id, verbatim — written by the run write-back
129
- * that harvested it off a first settled run. Never client-settable: the web
130
- * PATCH schema does not carry it.
131
- */
132
- runtimeSessionId?: string;
133
- /** Pass `null` to clear; pass an ISO timestamp to set. */
134
- lastMessageAt?: string | null;
135
- /**
136
- * ISO timestamp of a runtime checkpoint just observed (`null` clears it).
137
- * Settable here — unlike the run claim — because a checkpoint is a report the
138
- * hook bridge relays, not a process ARCS owns.
139
- */
140
- lastCheckpointAt?: string | null;
141
- /** Pass `null` to clear; pass a string to set. */
142
- userEmail?: string | null;
143
- /** Pass `null` to clear; merged shallowly into the existing metadata. */
144
- metadata?: Record<string, unknown> | null;
145
- /**
146
- * Link target kind. `null` (on either linkage field) clears the whole link.
147
- * Setting a link requires both fields to resolve to a value.
148
- */
149
- linkedNodeType?: import("./storage-utils.js").SessionLinkedNodeType | null;
150
- /** Normalized task/plan id — validated against the task/plan store. */
151
- linkedNodeId?: string | null;
152
- now?: string;
153
- }
154
- export interface SessionFilters {
155
- status?: import("./storage-utils.js").SessionStatus;
156
- runtimeType?: import("./storage-utils.js").SessionRuntimeType;
157
- }
158
- export declare function readSessionIndex(projectDir: string): Promise<SessionIndex>;
159
- /**
160
- * What a session is doing right now, as a reader of the UI would say it.
161
- *
162
- * DERIVED, never stored: there is no `phase` field on `SessionMeta` and no way
163
- * to write one through this module. A stored phase is a second source of truth
164
- * that goes stale the instant a process dies without telling anyone — which is
165
- * precisely the "stuck on running forever" failure this replaces.
166
- */
167
- export declare const SESSION_PHASES: readonly ["running", "idle", "failed", "ended"];
168
- export type SessionPhase = (typeof SESSION_PHASES)[number];
169
- /**
170
- * Outcome vocabulary persisted on `metadata.run.outcome`. A superset of the
171
- * runner's own `RunOutcome` ("success" | "error" | "timeout"): `interrupted` is
172
- * never produced BY a run, it is written FOR a run whose process disappeared
173
- * without ever settling — a restart's orphan. Declared here rather than
174
- * imported from the web server because `utils/` must not depend on
175
- * `web-server/`; claude-runner's union stays exactly what a child can return.
176
- */
177
- export declare const SESSION_RUN_OUTCOMES: readonly ["success", "error", "timeout", "interrupted"];
178
- export type SessionRunOutcome = (typeof SESSION_RUN_OUTCOMES)[number];
179
- /**
180
- * How long a run claim's heartbeat counts as proof of life. Sized to the
181
- * runner's default 10-minute run ceiling because nothing refreshes the
182
- * heartbeat mid-run yet (see `SessionMeta.heartbeatAt`) — a shorter window
183
- * would demote a perfectly healthy long run to `idle`.
184
- */
185
- export declare const RUN_HEARTBEAT_TTL_MS: number;
186
- /**
187
- * How long a runtime checkpoint counts as proof of life for an observed
188
- * session. Deliberately shorter than the run TTL: checkpoints arrive at every
189
- * prompt and every turn end, so a terminal that has produced neither in five
190
- * minutes is waiting on a human, not working.
191
- */
192
- export declare const CHECKPOINT_TTL_MS: number;
193
- export interface SessionPhaseOptions {
194
- /** Clock in epoch ms; defaults to `Date.now()`. */
195
- now?: number;
196
- heartbeatTtlMs?: number;
197
- checkpointTtlMs?: number;
198
- }
199
- /**
200
- * The record's run claim, or `undefined` when it holds none. Validated rather
201
- * than trusted: a hand-edited index can carry anything under this key.
202
- */
203
- export declare function sessionRunClaim(session: SessionMeta): string | undefined;
204
- /**
205
- * Derives a session's phase from its own persisted evidence, in one place.
206
- *
207
- * Precedence, strongest first:
208
- * 1. a terminal `status` — `failed` is `failed`, `completed`/`disconnected`
209
- * are `ended`. Nothing observed later reopens a session that is over.
210
- * 2. a run claim (`currentRunId`) — ARCS spawned a child for this record, so
211
- * its `heartbeatAt` is the freshest evidence there is. Stale means the
212
- * claim outlived its proof of life, which reads `idle`, not `failed`: the
213
- * run is settled by the reconciler, not guessed at here.
214
- * 3. `lastCheckpointAt` — the only signal an observed terminal session emits.
215
- *
216
- * `metadata.run.outcome` is deliberately NOT an input. That field is run-level
217
- * history (rendered next to the run), while phase answers "is this session live
218
- * right now" — a run that failed an hour ago leaves the session idle and ready
219
- * for the next one, not permanently `failed`.
220
- *
221
- * Pure: a record plus a clock, no I/O, no process probing. Liveness that needs
222
- * the world (a pid, `claude agents`) belongs to the reconciler, which starts
223
- * from this value and can only ever demote it.
224
- *
225
- * SHORTCUT: checkpoint freshness cannot tell `UserPromptSubmit` (turn started)
226
- * from `Stop` (turn ended), so a session reads `running` for the TTL after its
227
- * last turn; upgrade to a persisted checkpoint kind when the panel needs
228
- * turn-level precision.
229
- */
230
- export declare function deriveSessionPhase(session: SessionMeta, options?: SessionPhaseOptions): SessionPhase;
231
- export declare function createSession(projectDir: string, input: CreateSessionInput): Promise<SessionMeta>;
232
- /**
233
- * Create-or-update by runtime session id. Used by runtime discovery bridges,
234
- * which see the same session many times and must stay idempotent.
235
- *
236
- * Deliberately never touches `linkedNodeType`/`linkedNodeId`: discovery
237
- * refreshes carry status/metadata only and must not silently unlink a session
238
- * a human just linked. Linkage is `updateSession`-only.
239
- */
240
- export declare function upsertSession(projectDir: string, input: CreateSessionInput): Promise<SessionMeta>;
241
- export declare function listSessions(projectDir: string, filters?: SessionFilters): Promise<SessionMeta[]>;
242
- export declare function getSession(projectDir: string, sessionId: string): Promise<SessionMeta>;
243
- export declare function updateSession(projectDir: string, input: UpdateSessionInput): Promise<SessionMeta>;
244
- export interface BeginSessionRunInput {
245
- /** Caller-minted id for this run — the claim's identity. */
246
- runId: string;
247
- /** OS pid of the spawned child; absent/`null` when the spawn produced none. */
248
- pid?: number | null;
249
- /** ISO override for the heartbeat and `updatedAt` stamps (tests). */
250
- now?: string;
251
- }
252
- export interface SettleSessionRunInput {
253
- /**
254
- * Settles only when it matches the persisted claim. Omit to settle whatever
255
- * claim is there (the startup sweep passes the id it read, so a run that
256
- * started in between is never settled out from under itself).
257
- */
258
- runId?: string;
259
- outcome: SessionRunOutcome;
260
- error?: string;
261
- /** Epoch ms for `metadata.run.endedAt` — defaults to now. */
262
- endedAt?: number;
263
- /**
264
- * Extra `metadata.run` fields stamped in the SAME write as the outcome: what
265
- * the RUNNER measured and no claim could have known at spawn (the pid and
266
- * startedAt the child actually reported, the run's mode, the stream
267
- * observations). Merged UNDER the settle's own fields, so `outcome`/`endedAt`/
268
- * `error` can never be smuggled past the settle that owns them.
269
- */
270
- run?: Record<string, unknown>;
271
- /**
272
- * Sibling `metadata` keys written in the same read-modify-write, shallow
273
- * merged as `updateSession` merges. The seed-decision repair rides here: a
274
- * settle that released the claim in one write and repaired the record in a
275
- * second is readable in between as "this run failed" while still carrying the
276
- * seed state that failed it — and the second write can land AFTER a newer run
277
- * has already claimed the record, clobbering its live `metadata.run`. Merged
278
- * UNDER `run`, so `run` can never be rewritten through this door.
279
- */
280
- metadata?: Record<string, unknown>;
281
- /** ISO override for `updatedAt` (tests). */
282
- now?: string;
283
- }
284
- /**
285
- * Claims a session for a headless run: persists the run id, the child's pid and
286
- * the first heartbeat, all of which survive the server process that made them.
287
- *
288
- * The claim is what makes a run recoverable. In-memory liveness (the runner's
289
- * `liveRuns` map) dies with the server, so without a persisted claim a run
290
- * interrupted by a restart would leave the session reading `running` forever
291
- * with nothing left that could ever settle it.
292
- */
293
- export declare function beginSessionRun(projectDir: string, sessionId: string, input: BeginSessionRunInput): Promise<SessionMeta>;
294
- /**
295
- * Releases a session's run claim, records how the run ended on `metadata.run`,
296
- * and applies whatever the settle repaired — in ONE lock acquisition.
297
- *
298
- * Read-modify-write has to be atomic: `metadata.run` is replaced wholesale by
299
- * every writer, so settling through the generic `updateSession` would race the
300
- * route's own write-back and could drop the run's pid/startedAt.
301
- *
302
- * Everything a settle concludes therefore goes in HERE rather than in a
303
- * follow-up `updateSession`. The claim is the only thing serializing a run
304
- * against the next one, and releasing it is the LAST thing this write does — so
305
- * a conclusion left to a second write is both observable in the gap (the record
306
- * reads settled while still carrying the state the run just disproved) and
307
- * unguarded outside it: the `input.runId` check above holds only for the
308
- * duration of this lock, and a newer run can claim the record the moment it is
309
- * released.
310
- */
311
- export declare function settleSessionRun(projectDir: string, sessionId: string, input: SettleSessionRunInput): Promise<SessionMeta>;
312
- export declare function deleteSession(projectDir: string, sessionId: string): Promise<void>;
313
- //# sourceMappingURL=session-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/utils/session-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA6BH,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;;;;;GAYG;AACH,eAA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