@rryando/arcs 3.10.0 → 4.0.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 (366) hide show
  1. package/README.md +172 -146
  2. package/dist/cli/agent-registry.d.ts +12 -0
  3. package/dist/cli/agent-registry.d.ts.map +1 -0
  4. package/dist/cli/agent-registry.js +67 -0
  5. package/dist/cli/agent-registry.js.map +1 -0
  6. package/dist/cli/arcs-flash.d.ts +2 -0
  7. package/dist/cli/arcs-flash.d.ts.map +1 -0
  8. package/dist/cli/arcs-flash.js +68 -0
  9. package/dist/cli/arcs-flash.js.map +1 -0
  10. package/dist/cli/arcs-orchestrate-caveman.d.ts +2 -14
  11. package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
  12. package/dist/cli/arcs-orchestrate-caveman.js +6 -97
  13. package/dist/cli/arcs-orchestrate-caveman.js.map +1 -1
  14. package/dist/cli/arcs-orchestrate.d.ts +1 -1
  15. package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
  16. package/dist/cli/arcs-orchestrate.js +40 -383
  17. package/dist/cli/arcs-orchestrate.js.map +1 -1
  18. package/dist/cli/bundle-installer.d.ts +10 -4
  19. package/dist/cli/bundle-installer.d.ts.map +1 -1
  20. package/dist/cli/bundle-installer.js +99 -6
  21. package/dist/cli/bundle-installer.js.map +1 -1
  22. package/dist/cli/commands/batch.js +4 -0
  23. package/dist/cli/commands/batch.js.map +1 -1
  24. package/dist/cli/commands/hooks.d.ts +76 -0
  25. package/dist/cli/commands/hooks.d.ts.map +1 -0
  26. package/dist/cli/commands/hooks.js +436 -0
  27. package/dist/cli/commands/hooks.js.map +1 -0
  28. package/dist/cli/commands/index.d.ts +2 -0
  29. package/dist/cli/commands/index.d.ts.map +1 -1
  30. package/dist/cli/commands/index.js +2 -0
  31. package/dist/cli/commands/index.js.map +1 -1
  32. package/dist/cli/commands/project.js +27 -0
  33. package/dist/cli/commands/project.js.map +1 -1
  34. package/dist/cli/commands/task.js +16 -1
  35. package/dist/cli/commands/task.js.map +1 -1
  36. package/dist/cli/commands/web.d.ts +2 -0
  37. package/dist/cli/commands/web.d.ts.map +1 -0
  38. package/dist/cli/commands/web.js +66 -0
  39. package/dist/cli/commands/web.js.map +1 -0
  40. package/dist/cli/config.d.ts +46 -3
  41. package/dist/cli/config.d.ts.map +1 -1
  42. package/dist/cli/config.js +95 -38
  43. package/dist/cli/config.js.map +1 -1
  44. package/dist/cli/instructions.d.ts +32 -7
  45. package/dist/cli/instructions.d.ts.map +1 -1
  46. package/dist/cli/instructions.js +99 -34
  47. package/dist/cli/instructions.js.map +1 -1
  48. package/dist/cli/orchestrator-shared-blocks.d.ts +31 -0
  49. package/dist/cli/orchestrator-shared-blocks.d.ts.map +1 -0
  50. package/dist/cli/orchestrator-shared-blocks.js +148 -0
  51. package/dist/cli/orchestrator-shared-blocks.js.map +1 -0
  52. package/dist/cli/setup.d.ts.map +1 -1
  53. package/dist/cli/setup.js +230 -91
  54. package/dist/cli/setup.js.map +1 -1
  55. package/dist/retrieval/index-builder.d.ts.map +1 -1
  56. package/dist/retrieval/index-builder.js +29 -1
  57. package/dist/retrieval/index-builder.js.map +1 -1
  58. package/dist/shared/session-vocabulary.d.ts +88 -0
  59. package/dist/shared/session-vocabulary.d.ts.map +1 -0
  60. package/dist/shared/session-vocabulary.js +114 -0
  61. package/dist/shared/session-vocabulary.js.map +1 -0
  62. package/dist/utils/claude-code-hook-install.d.ts +80 -0
  63. package/dist/utils/claude-code-hook-install.d.ts.map +1 -0
  64. package/dist/utils/claude-code-hook-install.js +211 -0
  65. package/dist/utils/claude-code-hook-install.js.map +1 -0
  66. package/dist/utils/claude-transcript.d.ts +206 -0
  67. package/dist/utils/claude-transcript.d.ts.map +1 -0
  68. package/dist/utils/claude-transcript.js +384 -0
  69. package/dist/utils/claude-transcript.js.map +1 -0
  70. package/dist/utils/diagram-generator.d.ts +1 -1
  71. package/dist/utils/diagram-generator.d.ts.map +1 -1
  72. package/dist/utils/diagram-generator.js +3 -2
  73. package/dist/utils/diagram-generator.js.map +1 -1
  74. package/dist/utils/errors.d.ts +6 -2
  75. package/dist/utils/errors.d.ts.map +1 -1
  76. package/dist/utils/errors.js +12 -0
  77. package/dist/utils/errors.js.map +1 -1
  78. package/dist/utils/git.d.ts +21 -0
  79. package/dist/utils/git.d.ts.map +1 -1
  80. package/dist/utils/git.js +65 -1
  81. package/dist/utils/git.js.map +1 -1
  82. package/dist/utils/hook-contract.d.ts +36 -0
  83. package/dist/utils/hook-contract.d.ts.map +1 -0
  84. package/dist/utils/hook-contract.js +35 -0
  85. package/dist/utils/hook-contract.js.map +1 -0
  86. package/dist/utils/hook-token-store.d.ts +61 -0
  87. package/dist/utils/hook-token-store.d.ts.map +1 -0
  88. package/dist/utils/hook-token-store.js +86 -0
  89. package/dist/utils/hook-token-store.js.map +1 -0
  90. package/dist/utils/json-schemas.d.ts +186 -2
  91. package/dist/utils/json-schemas.d.ts.map +1 -1
  92. package/dist/utils/json-schemas.js +48 -4
  93. package/dist/utils/json-schemas.js.map +1 -1
  94. package/dist/utils/knowledge-store.d.ts +7 -1
  95. package/dist/utils/knowledge-store.d.ts.map +1 -1
  96. package/dist/utils/knowledge-store.js +97 -65
  97. package/dist/utils/knowledge-store.js.map +1 -1
  98. package/dist/utils/plan-store.d.ts +8 -0
  99. package/dist/utils/plan-store.d.ts.map +1 -1
  100. package/dist/utils/plan-store.js +98 -59
  101. package/dist/utils/plan-store.js.map +1 -1
  102. package/dist/utils/project-resolver.d.ts +8 -0
  103. package/dist/utils/project-resolver.d.ts.map +1 -1
  104. package/dist/utils/project-resolver.js +7 -2
  105. package/dist/utils/project-resolver.js.map +1 -1
  106. package/dist/utils/session-store.d.ts +339 -0
  107. package/dist/utils/session-store.d.ts.map +1 -0
  108. package/dist/utils/session-store.js +577 -0
  109. package/dist/utils/session-store.js.map +1 -0
  110. package/dist/utils/storage-utils.d.ts +31 -0
  111. package/dist/utils/storage-utils.d.ts.map +1 -1
  112. package/dist/utils/storage-utils.js +116 -5
  113. package/dist/utils/storage-utils.js.map +1 -1
  114. package/dist/utils/task-store.d.ts +7 -0
  115. package/dist/utils/task-store.d.ts.map +1 -1
  116. package/dist/utils/task-store.js +73 -23
  117. package/dist/utils/task-store.js.map +1 -1
  118. package/dist/web-client/assets/GraphCanvas-CTyf_XXQ.js +1 -0
  119. package/dist/web-client/assets/MarkdownEditor-af2vwQOX.js +77 -0
  120. package/dist/web-client/assets/abnfDiagram-VRR7QNED-CdxcKX9t.js +1 -0
  121. package/dist/web-client/assets/arc-Bfaogrm1.js +1 -0
  122. package/dist/web-client/assets/architecture-TIHT7OUA-Bt2-DmfV.js +1 -0
  123. package/dist/web-client/assets/architectureDiagram-ZJ3FMSHR-DOISDv6o.js +36 -0
  124. package/dist/web-client/assets/array-BifhSqXX.js +1 -0
  125. package/dist/web-client/assets/blockDiagram-677ZJIJ3-DKwtbttM.js +132 -0
  126. package/dist/web-client/assets/c4Diagram-LMCZKHZV-CilqK-Mm.js +10 -0
  127. package/dist/web-client/assets/channel-C2mb9np_.js +1 -0
  128. package/dist/web-client/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  129. package/dist/web-client/assets/chunk-32BRIVSS-C79m1mkG.js +1 -0
  130. package/dist/web-client/assets/chunk-52WLFC77-C6WelGWJ.js +10 -0
  131. package/dist/web-client/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  132. package/dist/web-client/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  133. package/dist/web-client/assets/chunk-C7G6YPKG-DLg7ryWI.js +1 -0
  134. package/dist/web-client/assets/chunk-EX3LRPZG-DjWgo4gL.js +231 -0
  135. package/dist/web-client/assets/chunk-FWX5IMBZ-BgS9p_zy.js +2 -0
  136. package/dist/web-client/assets/chunk-HOUHSVGY-DuVR7dZO.js +1 -0
  137. package/dist/web-client/assets/chunk-ICXQ74PX-Y8DlnIJM.js +2 -0
  138. package/dist/web-client/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  139. package/dist/web-client/assets/chunk-KEIR6QF5-DEvma7oi.js +161 -0
  140. package/dist/web-client/assets/chunk-MOJQB5TN-BEM3QgeD.js +88 -0
  141. package/dist/web-client/assets/chunk-OGEWGWER-DlM8LxGr.js +1 -0
  142. package/dist/web-client/assets/chunk-PUDLZKDR-c6cqNVTx.js +156 -0
  143. package/dist/web-client/assets/chunk-Q4XR5HBZ-C5lNmcka.js +70 -0
  144. package/dist/web-client/assets/chunk-RYQCIY6F-np2RyIY1.js +1 -0
  145. package/dist/web-client/assets/chunk-V7JOEXUC-nSswxvSG.js +206 -0
  146. package/dist/web-client/assets/chunk-VAUOI2AC-CqJkCkT0.js +1 -0
  147. package/dist/web-client/assets/chunk-VR4S4FIN-D3pFchin.js +1 -0
  148. package/dist/web-client/assets/chunk-WYO6CB5R-BI9c-NzI.js +125 -0
  149. package/dist/web-client/assets/chunk-XXDRQBXY-BvKO0v-W.js +1 -0
  150. package/dist/web-client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  151. package/dist/web-client/assets/chunk-ZGVPDNZ5-CKTF2kLR.js +62 -0
  152. package/dist/web-client/assets/chunk-ZIRB5QZD-BpeS1aZ7.js +32 -0
  153. package/dist/web-client/assets/classDiagram-OUVF2IWQ-CPd_w3Zr.js +1 -0
  154. package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-CPd_w3Zr.js +1 -0
  155. package/dist/web-client/assets/cose-bilkent-JH36ORCC-BebHqzgp.js +1 -0
  156. package/dist/web-client/assets/cynefin-VYW2F7L2-BrJrnfh1.js +1 -0
  157. package/dist/web-client/assets/cynefinDiagram-TSTJHNR4-9jYzPWJZ.js +62 -0
  158. package/dist/web-client/assets/cytoscape-fcose-peAzqedC.js +1 -0
  159. package/dist/web-client/assets/cytoscape.esm-C3UvhD5t.js +321 -0
  160. package/dist/web-client/assets/dagre-Buvkdvvj.js +1 -0
  161. package/dist/web-client/assets/dagre-VKFMJZFB-B705Djpu.js +4 -0
  162. package/dist/web-client/assets/defaultLocale-BFoDCU3G.js +1 -0
  163. package/dist/web-client/assets/diagram-FQU43EPY-BfQAlUlJ.js +3 -0
  164. package/dist/web-client/assets/diagram-G47NLZAW-s1YDe06A.js +24 -0
  165. package/dist/web-client/assets/diagram-NH7WQ7WH-Dy3z11Hc.js +24 -0
  166. package/dist/web-client/assets/diagram-OA4YK3LP-Bius2xUN.js +30 -0
  167. package/dist/web-client/assets/diagram-WEI45ONY-D7x4VcHM.js +41 -0
  168. package/dist/web-client/assets/dist-B_J_HbC0.js +1 -0
  169. package/dist/web-client/assets/ebnfDiagram-CCIWWBDH-CBg1xrmD.js +1 -0
  170. package/dist/web-client/assets/erDiagram-Q63AITRT-CJRvTFvd.js +85 -0
  171. package/dist/web-client/assets/eventmodeling-45OFAUF4-CTKRC2Yj.js +1 -0
  172. package/dist/web-client/assets/flowDiagram-23GEKE2U-CaZjFyU1.js +1 -0
  173. package/dist/web-client/assets/ganttDiagram-NO4QXBWP-C_LsypZ4.js +292 -0
  174. package/dist/web-client/assets/gitGraph-TEB2WS4Q-Dx2XxdGk.js +1 -0
  175. package/dist/web-client/assets/gitGraphDiagram-IHSO6WYX-DiKWkGWQ.js +106 -0
  176. package/dist/web-client/assets/graphlib-DS17s2tU.js +1 -0
  177. package/dist/web-client/assets/index-CYwhkPtc.js +60 -0
  178. package/dist/web-client/assets/index-wSzUPvml.css +2 -0
  179. package/dist/web-client/assets/info-DKCQHKI2-DORwHenK.js +1 -0
  180. package/dist/web-client/assets/infoDiagram-FWYZ7A6U-CQecXS1E.js +2 -0
  181. package/dist/web-client/assets/init-C-OQMol4.js +1 -0
  182. package/dist/web-client/assets/ishikawaDiagram-FXEZZL3T-CWhj60Zp.js +70 -0
  183. package/dist/web-client/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  184. package/dist/web-client/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  185. package/dist/web-client/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  186. package/dist/web-client/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  187. package/dist/web-client/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  188. package/dist/web-client/assets/journeyDiagram-5HDEW3XC-Cj3z2U8u.js +139 -0
  189. package/dist/web-client/assets/kanban-definition-HUTT4EX6-DFmBRenP.js +89 -0
  190. package/dist/web-client/assets/katex-DolUETbr.js +257 -0
  191. package/dist/web-client/assets/line-C_Hxz9xb.js +1 -0
  192. package/dist/web-client/assets/linear-DeUiD2wj.js +1 -0
  193. package/dist/web-client/assets/map-BaFkSB1l.js +1 -0
  194. package/dist/web-client/assets/mermaid-parser.core-E3xRdzPn.js +7 -0
  195. package/dist/web-client/assets/mermaid.core-C2_CcotH.js +11 -0
  196. package/dist/web-client/assets/mindmap-definition-LN4V7U3C-Bs7VxPid.js +96 -0
  197. package/dist/web-client/assets/ordinal-BDEzSJ7C.js +1 -0
  198. package/dist/web-client/assets/packet-7NZHBO7P-D2nqso7i.js +1 -0
  199. package/dist/web-client/assets/path-COt_16Va.js +1 -0
  200. package/dist/web-client/assets/pegDiagram-2B236MQR-Cepo1sIu.js +1 -0
  201. package/dist/web-client/assets/pie-RZYD4A2V-Sx0IGbXt.js +1 -0
  202. package/dist/web-client/assets/pieDiagram-ENE6RG2P-D-PMDNhk.js +39 -0
  203. package/dist/web-client/assets/quadrantDiagram-ABIIQ3AL-BNGC7Fms.js +7 -0
  204. package/dist/web-client/assets/radar-I7S5WNFK-CFf_-2OC.js +1 -0
  205. package/dist/web-client/assets/railroad-3IZDKUUU-BvZeVRGh.js +1 -0
  206. package/dist/web-client/assets/railroad-abnf-AHOZXSZD-DnGh6x2O.js +1 -0
  207. package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-CGfgCoaE.js +1 -0
  208. package/dist/web-client/assets/railroad-peg-LSFZ7HO6-BzQxYdqp.js +1 -0
  209. package/dist/web-client/assets/railroadDiagram-RFXS5EU6-D0iK_k84.js +1 -0
  210. package/dist/web-client/assets/requirementDiagram-TGXJPOKE-BPdsw9tz.js +84 -0
  211. package/dist/web-client/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
  212. package/dist/web-client/assets/rough.esm-By172zw-.js +1 -0
  213. package/dist/web-client/assets/sankeyDiagram-HTMAVEWB-maA6ukOJ.js +40 -0
  214. package/dist/web-client/assets/sequenceDiagram-DBY2YBRQ-DKmAjmgr.js +162 -0
  215. package/dist/web-client/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  216. package/dist/web-client/assets/src-oBChb5qS.js +1 -0
  217. package/dist/web-client/assets/stateDiagram-2N3HPSRC-esxmzk3w.js +1 -0
  218. package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-hcBqlOLc.js +1 -0
  219. package/dist/web-client/assets/swimlanes-5IMT3BWC-DFd-wGBv.js +2 -0
  220. package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DbSrPBYr.js +8 -0
  221. package/dist/web-client/assets/timeline-definition-FHXFAJF6-C7SG8MQH.js +120 -0
  222. package/dist/web-client/assets/treeView-QDETBFTQ-M0rhxbs2.js +1 -0
  223. package/dist/web-client/assets/treemap-6X3UGDF4-BQfkQxSh.js +1 -0
  224. package/dist/web-client/assets/vennDiagram-L72KCM5P-CyIlb8ju.js +34 -0
  225. package/dist/web-client/assets/wardley-OPB4EBWU-EE-7q8M1.js +1 -0
  226. package/dist/web-client/assets/wardleyDiagram-EHGQE667-bY8XdYYS.js +78 -0
  227. package/dist/web-client/assets/xychartDiagram-FW5EYKEG-AhuXJ3de.js +7 -0
  228. package/dist/web-client/index.html +15 -0
  229. package/dist/web-server/app.d.ts +16 -0
  230. package/dist/web-server/app.d.ts.map +1 -0
  231. package/dist/web-server/app.js +77 -0
  232. package/dist/web-server/app.js.map +1 -0
  233. package/dist/web-server/claude-runner.d.ts +188 -0
  234. package/dist/web-server/claude-runner.d.ts.map +1 -0
  235. package/dist/web-server/claude-runner.js +599 -0
  236. package/dist/web-server/claude-runner.js.map +1 -0
  237. package/dist/web-server/hook-auth.d.ts +12 -0
  238. package/dist/web-server/hook-auth.d.ts.map +1 -0
  239. package/dist/web-server/hook-auth.js +36 -0
  240. package/dist/web-server/hook-auth.js.map +1 -0
  241. package/dist/web-server/index.d.ts +23 -0
  242. package/dist/web-server/index.d.ts.map +1 -0
  243. package/dist/web-server/index.js +50 -0
  244. package/dist/web-server/index.js.map +1 -0
  245. package/dist/web-server/opencode-client.d.ts +123 -0
  246. package/dist/web-server/opencode-client.d.ts.map +1 -0
  247. package/dist/web-server/opencode-client.js +514 -0
  248. package/dist/web-server/opencode-client.js.map +1 -0
  249. package/dist/web-server/permission-policy.d.ts +46 -0
  250. package/dist/web-server/permission-policy.d.ts.map +1 -0
  251. package/dist/web-server/permission-policy.js +96 -0
  252. package/dist/web-server/permission-policy.js.map +1 -0
  253. package/dist/web-server/prompt-assembly.d.ts +454 -0
  254. package/dist/web-server/prompt-assembly.d.ts.map +1 -0
  255. package/dist/web-server/prompt-assembly.js +1122 -0
  256. package/dist/web-server/prompt-assembly.js.map +1 -0
  257. package/dist/web-server/respond.d.ts +33 -0
  258. package/dist/web-server/respond.d.ts.map +1 -0
  259. package/dist/web-server/respond.js +79 -0
  260. package/dist/web-server/respond.js.map +1 -0
  261. package/dist/web-server/routes/collections.d.ts +11 -0
  262. package/dist/web-server/routes/collections.d.ts.map +1 -0
  263. package/dist/web-server/routes/collections.js +217 -0
  264. package/dist/web-server/routes/collections.js.map +1 -0
  265. package/dist/web-server/routes/discovery.d.ts +7 -0
  266. package/dist/web-server/routes/discovery.d.ts.map +1 -0
  267. package/dist/web-server/routes/discovery.js +159 -0
  268. package/dist/web-server/routes/discovery.js.map +1 -0
  269. package/dist/web-server/routes/events.d.ts +6 -0
  270. package/dist/web-server/routes/events.d.ts.map +1 -0
  271. package/dist/web-server/routes/events.js +25 -0
  272. package/dist/web-server/routes/events.js.map +1 -0
  273. package/dist/web-server/routes/hook-events.d.ts +44 -0
  274. package/dist/web-server/routes/hook-events.d.ts.map +1 -0
  275. package/dist/web-server/routes/hook-events.js +320 -0
  276. package/dist/web-server/routes/hook-events.js.map +1 -0
  277. package/dist/web-server/routes/projects.d.ts +7 -0
  278. package/dist/web-server/routes/projects.d.ts.map +1 -0
  279. package/dist/web-server/routes/projects.js +272 -0
  280. package/dist/web-server/routes/projects.js.map +1 -0
  281. package/dist/web-server/routes/sessions.d.ts +18 -0
  282. package/dist/web-server/routes/sessions.d.ts.map +1 -0
  283. package/dist/web-server/routes/sessions.js +1298 -0
  284. package/dist/web-server/routes/sessions.js.map +1 -0
  285. package/dist/web-server/routes/workspace.d.ts +27 -0
  286. package/dist/web-server/routes/workspace.d.ts.map +1 -0
  287. package/dist/web-server/routes/workspace.js +280 -0
  288. package/dist/web-server/routes/workspace.js.map +1 -0
  289. package/dist/web-server/run-event-log.d.ts +167 -0
  290. package/dist/web-server/run-event-log.d.ts.map +1 -0
  291. package/dist/web-server/run-event-log.js +468 -0
  292. package/dist/web-server/run-event-log.js.map +1 -0
  293. package/dist/web-server/security.d.ts +7 -0
  294. package/dist/web-server/security.d.ts.map +1 -0
  295. package/dist/web-server/security.js +41 -0
  296. package/dist/web-server/security.js.map +1 -0
  297. package/dist/web-server/session-reconciler.d.ts +162 -0
  298. package/dist/web-server/session-reconciler.d.ts.map +1 -0
  299. package/dist/web-server/session-reconciler.js +363 -0
  300. package/dist/web-server/session-reconciler.js.map +1 -0
  301. package/dist/web-server/static.d.ts +17 -0
  302. package/dist/web-server/static.d.ts.map +1 -0
  303. package/dist/web-server/static.js +79 -0
  304. package/dist/web-server/static.js.map +1 -0
  305. package/dist/web-server/storage.d.ts +17 -0
  306. package/dist/web-server/storage.d.ts.map +1 -0
  307. package/dist/web-server/storage.js +42 -0
  308. package/dist/web-server/storage.js.map +1 -0
  309. package/dist/web-server/watcher.d.ts +37 -0
  310. package/dist/web-server/watcher.d.ts.map +1 -0
  311. package/dist/web-server/watcher.js +181 -0
  312. package/dist/web-server/watcher.js.map +1 -0
  313. package/dist/web-server/web-auth.d.ts +17 -0
  314. package/dist/web-server/web-auth.d.ts.map +1 -0
  315. package/dist/web-server/web-auth.js +33 -0
  316. package/dist/web-server/web-auth.js.map +1 -0
  317. package/dist/web-server/web-token.d.ts +39 -0
  318. package/dist/web-server/web-token.d.ts.map +1 -0
  319. package/dist/web-server/web-token.js +71 -0
  320. package/dist/web-server/web-token.js.map +1 -0
  321. package/opencode/arcs/bundle-runtime.json +5 -13
  322. package/opencode/arcs/manifest.json +215 -151
  323. package/opencode/arcs/prompts/arcs-docs.txt +53 -47
  324. package/opencode/arcs/prompts/arcs-flash.txt +190 -0
  325. package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +116 -422
  326. package/opencode/arcs/prompts/arcs-orchestrate.txt +114 -341
  327. package/opencode/arcs/prompts/code-reviewer.txt +37 -98
  328. package/opencode/arcs/prompts/devil-advocate.txt +44 -115
  329. package/opencode/arcs/prompts/graph-explorer.txt +31 -179
  330. package/opencode/arcs/prompts/software-engineer.txt +24 -6
  331. package/opencode/arcs/prompts/tech-architect.txt +25 -9
  332. package/opencode/arcs/skills/brainstorming/SKILL.md +65 -105
  333. package/opencode/arcs/skills/deep-pr-review/SKILL.md +5 -5
  334. package/opencode/arcs/skills/deep-pr-review/review-template.md +1 -1
  335. package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +17 -18
  336. package/opencode/arcs/skills/executing-plans/SKILL.md +26 -234
  337. package/opencode/arcs/skills/implementation/SKILL.md +61 -0
  338. package/opencode/arcs/skills/init-project/SKILL.md +16 -15
  339. package/opencode/arcs/skills/install-claude-code-hook/SKILL.md +143 -0
  340. package/opencode/arcs/skills/systematic-debugging/SKILL.md +7 -7
  341. package/opencode/arcs/skills/test-driven-development/SKILL.md +1 -1
  342. package/opencode/arcs/skills/to-diagram/SKILL.md +8 -3
  343. package/opencode/arcs/skills/writing-knowledge/SKILL.md +7 -6
  344. package/opencode/arcs/skills/writing-plans/SKILL.md +80 -130
  345. package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +38 -30
  346. package/package.json +14 -6
  347. package/scripts/build-opencode-bundle.mjs +22 -7
  348. package/scripts/claude-code-session-hook.mjs +171 -0
  349. package/scripts/deploy-claudecode-bundle.mjs +206 -132
  350. package/scripts/deploy-opencode-bundle.mjs +181 -5
  351. package/scripts/lib/bundle-helpers.mjs +26 -0
  352. package/scripts/lint-bundle.mjs +123 -3
  353. package/skills/explore-dag.md +5 -3
  354. package/skills/init-project.md +27 -26
  355. package/skills/orchestrate.md +29 -13
  356. package/skills/update-docs.md +8 -13
  357. package/opencode/arcs/prompts/docs-researcher.txt +0 -79
  358. package/opencode/arcs/prompts/oncall-ops.txt +0 -85
  359. package/opencode/arcs/skills/code-agent/SKILL.md +0 -63
  360. package/opencode/arcs/skills/executing-plans/code-quality-reviewer-prompt.md +0 -57
  361. package/opencode/arcs/skills/executing-plans/implementer-prompt.md +0 -152
  362. package/opencode/arcs/skills/executing-plans/spec-reviewer-prompt.md +0 -91
  363. package/opencode/arcs/skills/quick-dev/SKILL.md +0 -52
  364. package/opencode/arcs/skills/requesting-code-review/SKILL.md +0 -59
  365. package/opencode/arcs/skills/requesting-code-review/code-reviewer.md +0 -139
  366. package/opencode/arcs/skills/the-ladder/SKILL.md +0 -54
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Claude Code transcript mirroring for the session bridge.
3
+ *
4
+ * Owns a per-session sidecar at `sessions/{normalizedId}.transcript.jsonl`
5
+ * that mirrors a Claude Code JSONL transcript (the runtime's single source of
6
+ * truth) into a derived read-model for the web UI. The sidecar is append-only
7
+ * and keyed by transcript line offsets so re-mirroring is idempotent; when the
8
+ * transcript is compacted/rewritten below the mirrored offset, the sidecar is
9
+ * rebuilt from line 0 while preserving ARCS-authored turns (any record with a
10
+ * negative id — references and web-sent user/assistant turns).
11
+ *
12
+ * Never throws: missing/unreadable/oversized/malformed inputs are silent
13
+ * no-ops, and the sidecar never touches `sessions/index.json`.
14
+ */
15
+ /** A MarkdownSection payload the caller sent to the session. Preserved on the
16
+ * sidecar reference record verbatim so the web UI can render the section with
17
+ * click-through back to its source document. */
18
+ export interface ReferenceSection {
19
+ /** Heading depth of the referenced section (1-based). */
20
+ depth: number;
21
+ /** The section's rendered markdown, exactly as it was sent to the session. */
22
+ text: string;
23
+ /** Stable id of the section within its document. */
24
+ id: string;
25
+ /** Character offsets of the section within the full document text. */
26
+ startOffset: number;
27
+ endOffset: number;
28
+ }
29
+ /** Identity of the document a reference was quoted from. */
30
+ export interface ReferenceSource {
31
+ /** Which ARCS store the referenced document lives in. */
32
+ kind: "overview" | "knowledge" | "plan";
33
+ /** Human-readable name of the source document. */
34
+ label: string;
35
+ /** Optional doc identifier (e.g. knowledge entry id, plan id). */
36
+ doc?: string;
37
+ id?: string;
38
+ }
39
+ /**
40
+ * A markdown document section — the ONLY reference shape that existed before
41
+ * the union, and therefore the shape every reference turn already on disk
42
+ * carries. Its `section`/`source` fields are frozen: a sidecar written by an
43
+ * older ARCS must keep parsing, and a doc reference written today must stay
44
+ * byte-identical to one written then. The tag is filled in at the schema
45
+ * boundary (`sessionReferenceSchema`) rather than required on the wire, because
46
+ * legacy bodies carry no tag at all.
47
+ */
48
+ export interface DocReference {
49
+ type: "doc";
50
+ text: string;
51
+ section: ReferenceSection;
52
+ source: ReferenceSource;
53
+ }
54
+ /**
55
+ * A line range in a workspace file, sent as a POINTER rather than as content:
56
+ * `excerpt` is a short human anchor, never the authoritative text — the agent
57
+ * reads the live file. `headRev` is the revision the slice was taken at, so a
58
+ * later diff can tell whether the file moved under the agent.
59
+ */
60
+ export interface FileReference {
61
+ type: "file";
62
+ /** Workspace-relative path, as the caller sent it. */
63
+ path: string;
64
+ /** 1-based, inclusive. */
65
+ startLine: number;
66
+ endLine: number;
67
+ excerpt?: string;
68
+ headRev?: string;
69
+ }
70
+ /** A DAG entity. Carries no text slice — ARCS is the source of truth for it. */
71
+ export interface NodeReference {
72
+ type: "node";
73
+ kind: "task" | "plan" | "knowledge";
74
+ id: string;
75
+ }
76
+ /** Everything a caller can point a session at, discriminated on `type`. */
77
+ export type SessionReference = DocReference | FileReference | NodeReference;
78
+ /** The pointer kinds, which have no historical fields of their own and so ride
79
+ * a reference turn whole (see `TranscriptTurn.ref`). */
80
+ export type PointerReference = FileReference | NodeReference;
81
+ /**
82
+ * The `text` a reference TURN records — the sidecar's own label, which is what
83
+ * the transcript panel shows. NOT prompt text: rendering a reference for a
84
+ * model is `web-server/prompt-assembly.ts`'s exclusive job. Doc references keep
85
+ * the caller's quoted text verbatim (unchanged from before the union); the
86
+ * pointer kinds have no text of their own, so the turn carries their identity.
87
+ */
88
+ export declare function referenceTurnText(reference: SessionReference): string;
89
+ export interface TranscriptTurn {
90
+ /**
91
+ * Absolute 0-based line index in the source transcript for mirrored turns.
92
+ * ARCS-authored turns (references and web-sent user/assistant turns) carry a
93
+ * negative id drawn from one shared monotonic sequence, so they live in a
94
+ * disjoint space and can never collide with transcript line indices or with
95
+ * each other (the panel keys TurnRow on id).
96
+ */
97
+ id: number;
98
+ type: "user" | "assistant" | "reference";
99
+ text: string;
100
+ ts?: string;
101
+ tool?: {
102
+ name: string;
103
+ };
104
+ /** Reference turns only: the MarkdownSection payload the caller sent to the
105
+ * session, preserved for click-through rendering. */
106
+ section?: ReferenceSection;
107
+ /** Reference turns only: identity of the source document. */
108
+ source?: ReferenceSource;
109
+ /**
110
+ * Reference turns only, POINTER kinds only: the file-slice or DAG-node
111
+ * payload the caller sent, preserved whole. Doc references deliberately do
112
+ * NOT land here — they keep their historical `section`/`source` fields, so a
113
+ * record written today is byte-identical to one written before the union
114
+ * existed and an older sidecar still reads.
115
+ */
116
+ ref?: PointerReference;
117
+ /**
118
+ * Run this turn was folded down from (see web-server/run-event-log.ts). Set
119
+ * only on ARCS-authored turns written at a run's settle, where it doubles as
120
+ * the fold's idempotence marker: a run whose id already appears here has
121
+ * been folded and is never folded again.
122
+ */
123
+ run?: string;
124
+ }
125
+ export interface ReadTranscriptResult {
126
+ turns: TranscriptTurn[];
127
+ /** Number of record lines in the transcript (trailing newline excluded). */
128
+ totalLines: number;
129
+ }
130
+ export interface ReferenceTurnInput {
131
+ text?: string;
132
+ ts?: string;
133
+ tool?: {
134
+ name: string;
135
+ };
136
+ section?: ReferenceSection;
137
+ source?: ReferenceSource;
138
+ /** Pointer kinds only — see `TranscriptTurn.ref`. */
139
+ ref?: PointerReference;
140
+ }
141
+ /** An ARCS-authored user/assistant turn sent to the session from the web UI. */
142
+ export interface SessionTurnInput {
143
+ type: "user" | "assistant";
144
+ text: string;
145
+ ts?: string;
146
+ /** Tool this turn stands for — a `tool_use` folded down from a run's event
147
+ * log, rendered dimmed exactly like a mirrored tool turn. */
148
+ tool?: {
149
+ name: string;
150
+ };
151
+ /** Run this turn was folded down from; also the fold's idempotence marker. */
152
+ run?: string;
153
+ }
154
+ /** Single-read cap for transcript files; anything larger mirrors as a no-op. */
155
+ export declare const TRANSCRIPT_MAX_BYTES: number;
156
+ /**
157
+ * Sidecar path. The filename keys on the normalized id so it matches the
158
+ * session index record exactly (normalizeIdentifier round-trips UUIDs
159
+ * unchanged, so Claude Code session uuids survive verbatim).
160
+ */
161
+ export declare function sessionTranscriptPath(projectDir: string, normalizedId: string): string;
162
+ /**
163
+ * Reads a Claude Code JSONL transcript and parses only lines >= fromLine.
164
+ * Returns the kept turns (absolute line indices) plus the transcript's total
165
+ * record-line count. Never throws — unreadable files yield empty results.
166
+ */
167
+ export declare function readTranscriptTurns(filePath: string, fromLine: number): Promise<ReadTranscriptResult>;
168
+ /**
169
+ * Mirrors the transcript into the per-session sidecar (append-only, offset
170
+ * idempotent). When the transcript has fewer lines than the mirrored offset —
171
+ * Claude Code compacts/rewrites its JSONL — the sidecar is rebuilt from line 0
172
+ * with existing ARCS-authored turns (id < 0) preserved.
173
+ *
174
+ * Never throws: missing/unreadable/oversized/malformed inputs are silent
175
+ * no-ops and the sidecar stays untouched. Never writes sessions/index.json.
176
+ */
177
+ export declare function mirrorSessionTranscript(projectDir: string, normalizedId: string, transcriptPath: string): Promise<void>;
178
+ /**
179
+ * Appends an ARCS-authored reference turn (a document section, file slice or
180
+ * DAG node the caller pointed the session at) to the sidecar under the same
181
+ * sessions/.store lock the session
182
+ * store uses, so appends serialize with index mutations. A failed append is a
183
+ * swallowed no-op — the caller has already delivered the message. The id is
184
+ * minted from the shared ARCS-authored negative space so it can never collide
185
+ * with a web-sent user/assistant turn.
186
+ */
187
+ export declare function appendReferenceTurn(projectDir: string, normalizedId: string, turn: ReferenceTurnInput): Promise<void>;
188
+ /**
189
+ * Appends an ARCS-authored user/assistant turn (sent to the session from the
190
+ * web UI) to the sidecar under the same sessions/.store lock the session store
191
+ * and the other sidecar writers use, so appends serialize with index mutations
192
+ * and reference appends. A failed append is a swallowed no-op. The id is
193
+ * minted from the shared ARCS-authored negative space so it can never collide
194
+ * with a reference turn — both render through <TurnRow key={t.id}>.
195
+ *
196
+ * `tool` and `run` ride through verbatim: they are what a run's event-log
197
+ * fold-down writes (one turn per `tool_use`, every turn tagged with the run
198
+ * whose log produced it — see web-server/run-event-log.ts).
199
+ */
200
+ export declare function appendSessionTurn(projectDir: string, normalizedId: string, turn: SessionTurnInput): Promise<void>;
201
+ /**
202
+ * Reads the sidecar for the GET route, skipping malformed lines. Returns an
203
+ * empty array when the sidecar is missing. Never throws.
204
+ */
205
+ export declare function readSessionTurns(projectDir: string, normalizedId: string): Promise<TranscriptTurn[]>;
206
+ //# sourceMappingURL=claude-transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-transcript.d.ts","sourceRoot":"","sources":["../../src/utils/claude-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH;;iDAEiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CA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CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAEtF;AAyGD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,oBAAoB,CAAC,CAiB/B;AAyFD;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAoCf;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,EAAE,CAAC,CAM3B"}
@@ -0,0 +1,384 @@
1
+ /**
2
+ * Claude Code transcript mirroring for the session bridge.
3
+ *
4
+ * Owns a per-session sidecar at `sessions/{normalizedId}.transcript.jsonl`
5
+ * that mirrors a Claude Code JSONL transcript (the runtime's single source of
6
+ * truth) into a derived read-model for the web UI. The sidecar is append-only
7
+ * and keyed by transcript line offsets so re-mirroring is idempotent; when the
8
+ * transcript is compacted/rewritten below the mirrored offset, the sidecar is
9
+ * rebuilt from line 0 while preserving ARCS-authored turns (any record with a
10
+ * negative id — references and web-sent user/assistant turns).
11
+ *
12
+ * Never throws: missing/unreadable/oversized/malformed inputs are silent
13
+ * no-ops, and the sidecar never touches `sessions/index.json`.
14
+ */
15
+ import { appendFile, readFile, stat } from "node:fs/promises";
16
+ import { join } from "node:path";
17
+ import { withLock } from "./file-lock.js";
18
+ import { normalizeIdentifier } from "./slug.js";
19
+ import { ensureDir, nowISO, writeTextAtomic } from "./storage-utils.js";
20
+ /**
21
+ * The `text` a reference TURN records — the sidecar's own label, which is what
22
+ * the transcript panel shows. NOT prompt text: rendering a reference for a
23
+ * model is `web-server/prompt-assembly.ts`'s exclusive job. Doc references keep
24
+ * the caller's quoted text verbatim (unchanged from before the union); the
25
+ * pointer kinds have no text of their own, so the turn carries their identity.
26
+ */
27
+ export function referenceTurnText(reference) {
28
+ switch (reference.type) {
29
+ case "file":
30
+ return `${reference.path}:${reference.startLine}-${reference.endLine}`;
31
+ case "node":
32
+ return `${reference.kind} ${reference.id}`;
33
+ default:
34
+ return reference.text;
35
+ }
36
+ }
37
+ /** Single-read cap for transcript files; anything larger mirrors as a no-op. */
38
+ export const TRANSCRIPT_MAX_BYTES = 20 * 1024 * 1024;
39
+ // ---------------------------------------------------------------------------
40
+ // Paths & locking
41
+ // ---------------------------------------------------------------------------
42
+ /**
43
+ * Sidecar path. The filename keys on the normalized id so it matches the
44
+ * session index record exactly (normalizeIdentifier round-trips UUIDs
45
+ * unchanged, so Claude Code session uuids survive verbatim).
46
+ */
47
+ export function sessionTranscriptPath(projectDir, normalizedId) {
48
+ return join(projectDir, "sessions", `${normalizeIdentifier(normalizedId)}.transcript.jsonl`);
49
+ }
50
+ /**
51
+ * The same advisory lock the session store uses for index mutations. Kept
52
+ * local (not imported) because session-store's helper is private and that
53
+ * module is out of scope; the path mirrors its `sessions/.store` so appends
54
+ * here serialize with createSession/updateSession/etc.
55
+ */
56
+ function sessionStoreLockPath(projectDir) {
57
+ return join(projectDir, "sessions", ".store");
58
+ }
59
+ // ---------------------------------------------------------------------------
60
+ // Transcript parser — verified against the real Claude Code JSONL shape
61
+ // ---------------------------------------------------------------------------
62
+ function isBlock(value) {
63
+ return typeof value === "object" && value !== null && !Array.isArray(value);
64
+ }
65
+ /** Concatenates non-empty text blocks; thinking/tool_use blocks are dropped. */
66
+ function extractTextBlocks(blocks) {
67
+ return blocks
68
+ .filter((block) => isBlock(block) &&
69
+ block.type === "text" &&
70
+ typeof block.text === "string" &&
71
+ block.text !== "")
72
+ .map((block) => block.text)
73
+ .join("\n");
74
+ }
75
+ /**
76
+ * Parses one transcript line into a normalized turn, or null when the line is
77
+ * noise/malformed. Malformed JSON is skipped, never thrown.
78
+ *
79
+ * Noise rules (verified against real ~/.claude/projects JSONL transcripts):
80
+ * - types other than "user"/"assistant" (mode, agent-setting, permission-mode,
81
+ * file-history-snapshot, last-prompt, queue-operation, system, attachment…)
82
+ * - user entries with isMeta:true (the <local-command-caveat> wrapper)
83
+ * - user local-command payloads (<command-name>/<local-command-stdout>), which
84
+ * in practice carry NO isMeta flag at all — filtered by content marker
85
+ * - user entries whose content is a tool_result array (tool output echoes)
86
+ * - thinking blocks inside assistant content
87
+ * - assistant lines with neither text nor tool_use (thinking-only lines)
88
+ */
89
+ function parseTranscriptLine(rawLine, lineIndex) {
90
+ if (rawLine.trim() === "")
91
+ return null;
92
+ let entry;
93
+ try {
94
+ entry = JSON.parse(rawLine);
95
+ }
96
+ catch {
97
+ return null;
98
+ }
99
+ if (!isBlock(entry))
100
+ return null;
101
+ if (entry.type !== "user" && entry.type !== "assistant")
102
+ return null;
103
+ const message = entry.message;
104
+ if (!isBlock(message))
105
+ return null;
106
+ const ts = typeof entry.timestamp === "string" ? entry.timestamp : undefined;
107
+ if (entry.type === "user") {
108
+ if (entry.isMeta === true)
109
+ return null;
110
+ const content = message.content;
111
+ if (typeof content === "string") {
112
+ const text = content.trim();
113
+ if (text.startsWith("<command-name>") ||
114
+ text.startsWith("<local-command-stdout>") ||
115
+ text.startsWith("<local-command-caveat>")) {
116
+ return null;
117
+ }
118
+ return { id: lineIndex, type: "user", text, ...(ts !== undefined ? { ts } : {}) };
119
+ }
120
+ if (Array.isArray(content)) {
121
+ // Claude Code user arrays are tool_result blocks — echoed tool output,
122
+ // never a real prompt. (The rare text-only array, e.g. an interruption
123
+ // notice, is kept.)
124
+ if (content.some((block) => isBlock(block) && block.type === "tool_result"))
125
+ return null;
126
+ const text = extractTextBlocks(content);
127
+ if (text === "")
128
+ return null;
129
+ return { id: lineIndex, type: "user", text, ...(ts !== undefined ? { ts } : {}) };
130
+ }
131
+ return null;
132
+ }
133
+ // assistant — content is a block array: keep text, dim tool_use, drop thinking.
134
+ if (!Array.isArray(message.content))
135
+ return null;
136
+ const text = extractTextBlocks(message.content);
137
+ const toolUse = message.content.find((block) => isBlock(block) && block.type === "tool_use" && typeof block.name === "string");
138
+ if (text === "" && toolUse === undefined)
139
+ return null;
140
+ const turn = {
141
+ id: lineIndex,
142
+ type: "assistant",
143
+ text,
144
+ ...(ts !== undefined ? { ts } : {}),
145
+ };
146
+ if (toolUse !== undefined)
147
+ turn.tool = { name: toolUse.name };
148
+ return turn;
149
+ }
150
+ /**
151
+ * Reads a Claude Code JSONL transcript and parses only lines >= fromLine.
152
+ * Returns the kept turns (absolute line indices) plus the transcript's total
153
+ * record-line count. Never throws — unreadable files yield empty results.
154
+ */
155
+ export async function readTranscriptTurns(filePath, fromLine) {
156
+ let raw;
157
+ try {
158
+ raw = await readFile(filePath, "utf-8");
159
+ }
160
+ catch {
161
+ return { turns: [], totalLines: 0 };
162
+ }
163
+ const lines = raw.split("\n");
164
+ // A trailing newline produces one empty split element — not a record line.
165
+ while (lines.length > 0 && lines[lines.length - 1] === "")
166
+ lines.pop();
167
+ const totalLines = lines.length;
168
+ const turns = [];
169
+ for (let lineIndex = fromLine; lineIndex < totalLines; lineIndex++) {
170
+ const turn = parseTranscriptLine(lines[lineIndex] ?? "", lineIndex);
171
+ if (turn !== null)
172
+ turns.push(turn);
173
+ }
174
+ return { turns, totalLines };
175
+ }
176
+ // ---------------------------------------------------------------------------
177
+ // Sidecar read/write
178
+ // ---------------------------------------------------------------------------
179
+ function parseSidecarLine(rawLine) {
180
+ if (rawLine.trim() === "")
181
+ return null;
182
+ try {
183
+ const parsed = JSON.parse(rawLine);
184
+ if (isBlock(parsed) &&
185
+ (parsed.type === "user" || parsed.type === "assistant" || parsed.type === "reference")) {
186
+ return parsed;
187
+ }
188
+ return null;
189
+ }
190
+ catch {
191
+ return null;
192
+ }
193
+ }
194
+ /** Reads the sidecar, skipping malformed lines. Never throws. */
195
+ async function readSidecarRecords(filePath) {
196
+ try {
197
+ const raw = await readFile(filePath, "utf-8");
198
+ return raw.split("\n").flatMap((line) => {
199
+ const record = parseSidecarLine(line);
200
+ return record !== null ? [record] : [];
201
+ });
202
+ }
203
+ catch {
204
+ return [];
205
+ }
206
+ }
207
+ /**
208
+ * Resume offset = the next unmirrored transcript line. ARCS-authored turns are
209
+ * excluded (they are not transcript lines, and their negative ids never exceed
210
+ * the -1 sentinel, so they cannot push the offset), and the id of the last
211
+ * mirrored turn is the transcript line index it came from, so
212
+ * `last id + 1` is the count of transcript lines consumed. Equivalent to the
213
+ * sidecar line count in the noise-free case, and correct under interleaved
214
+ * noise and ARCS-authored turns where a raw line count would drift.
215
+ */
216
+ function mirrorOffset(records) {
217
+ let lastMirroredId = -1;
218
+ for (const record of records) {
219
+ if (record.type !== "reference" &&
220
+ typeof record.id === "number" &&
221
+ record.id > lastMirroredId) {
222
+ lastMirroredId = record.id;
223
+ }
224
+ }
225
+ return lastMirroredId + 1;
226
+ }
227
+ function serializeRecords(records) {
228
+ if (records.length === 0)
229
+ return "";
230
+ return `${records.map((record) => JSON.stringify(record)).join("\n")}\n`;
231
+ }
232
+ /**
233
+ * Next id in the shared ARCS-authored negative space: min(existing id < 0) − 1.
234
+ * All ARCS-authored records — session user/assistant turns and references —
235
+ * draw from this one monotonic sequence, so a user turn and a reference can
236
+ * never collide on the same id (the panel renders <TurnRow key={t.id}>).
237
+ * No negative ids yet: first id is −1 (0 − 1).
238
+ */
239
+ function nextNegativeTurnId(records) {
240
+ let minNegative = 0;
241
+ for (const record of records) {
242
+ if (typeof record.id === "number" && record.id < 0 && record.id < minNegative) {
243
+ minNegative = record.id;
244
+ }
245
+ }
246
+ return minNegative - 1;
247
+ }
248
+ async function appendRecords(filePath, records) {
249
+ if (records.length === 0)
250
+ return;
251
+ await appendFile(filePath, serializeRecords(records), "utf-8");
252
+ }
253
+ // ---------------------------------------------------------------------------
254
+ // Public API
255
+ // ---------------------------------------------------------------------------
256
+ /**
257
+ * Mirrors the transcript into the per-session sidecar (append-only, offset
258
+ * idempotent). When the transcript has fewer lines than the mirrored offset —
259
+ * Claude Code compacts/rewrites its JSONL — the sidecar is rebuilt from line 0
260
+ * with existing ARCS-authored turns (id < 0) preserved.
261
+ *
262
+ * Never throws: missing/unreadable/oversized/malformed inputs are silent
263
+ * no-ops and the sidecar stays untouched. Never writes sessions/index.json.
264
+ */
265
+ export async function mirrorSessionTranscript(projectDir, normalizedId, transcriptPath) {
266
+ try {
267
+ // Cap the single read: oversized transcripts are silently skipped.
268
+ const transcriptStat = await stat(transcriptPath);
269
+ if (!transcriptStat.isFile() || transcriptStat.size > TRANSCRIPT_MAX_BYTES)
270
+ return;
271
+ await withLock(sessionStoreLockPath(projectDir), async () => {
272
+ const sidecarPath = sessionTranscriptPath(projectDir, normalizedId);
273
+ const existing = await readSidecarRecords(sidecarPath);
274
+ const offset = mirrorOffset(existing);
275
+ const { turns, totalLines } = await readTranscriptTurns(transcriptPath, offset);
276
+ if (totalLines < offset) {
277
+ // Compaction/rewrite: rebuild from line 0, preserving every
278
+ // ARCS-authored turn (id < 0) — references and web-sent user/assistant
279
+ // turns both live in the negative space.
280
+ // SHORTCUT: compaction detection is line-count-only — a corrupted or
281
+ // truncated transcript that happens to shrink below the mirrored
282
+ // offset is treated as compaction and mirrored turns are dropped
283
+ // (ARCS-authored turns always survive). Upgrade when Claude Code's
284
+ // JSONL rewrite signals are identifiable, e.g. a marker record.
285
+ const arsAuthored = existing.filter((record) => typeof record.id === "number" && record.id < 0);
286
+ const { turns: allTurns } = await readTranscriptTurns(transcriptPath, 0);
287
+ await ensureDir(join(projectDir, "sessions"));
288
+ await writeTextAtomic(sidecarPath, serializeRecords([...arsAuthored, ...allTurns]));
289
+ return;
290
+ }
291
+ if (turns.length === 0)
292
+ return;
293
+ await ensureDir(join(projectDir, "sessions"));
294
+ await appendRecords(sidecarPath, turns);
295
+ });
296
+ }
297
+ catch {
298
+ // Never throws — every mirror failure is a swallowed no-op.
299
+ }
300
+ }
301
+ /**
302
+ * Appends an ARCS-authored reference turn (a document section, file slice or
303
+ * DAG node the caller pointed the session at) to the sidecar under the same
304
+ * sessions/.store lock the session
305
+ * store uses, so appends serialize with index mutations. A failed append is a
306
+ * swallowed no-op — the caller has already delivered the message. The id is
307
+ * minted from the shared ARCS-authored negative space so it can never collide
308
+ * with a web-sent user/assistant turn.
309
+ */
310
+ export async function appendReferenceTurn(projectDir, normalizedId, turn) {
311
+ try {
312
+ await ensureDir(join(projectDir, "sessions"));
313
+ await withLock(sessionStoreLockPath(projectDir), async () => {
314
+ const sidecarPath = sessionTranscriptPath(projectDir, normalizedId);
315
+ const existing = await readSidecarRecords(sidecarPath);
316
+ const record = {
317
+ id: nextNegativeTurnId(existing),
318
+ type: "reference",
319
+ text: turn.text ?? "",
320
+ ts: turn.ts ?? nowISO(),
321
+ ...(turn.tool !== undefined ? { tool: turn.tool } : {}),
322
+ ...(turn.section !== undefined ? { section: turn.section } : {}),
323
+ ...(turn.source !== undefined ? { source: turn.source } : {}),
324
+ // LAST for the POINTER records' sake. It buys the doc record nothing: a
325
+ // doc turn has `ref === undefined`, so this spread contributes no key
326
+ // wherever it sits, and the pre-union key order survives by that absence
327
+ // rather than by this position. What the position DOES fix is the pointer
328
+ // records' own layout — `ref` always trails `section`/`source`, so every
329
+ // file/node turn serializes its keys in one stable order.
330
+ ...(turn.ref !== undefined ? { ref: turn.ref } : {}),
331
+ };
332
+ await appendRecords(sidecarPath, [record]);
333
+ });
334
+ }
335
+ catch {
336
+ // Failed append is a swallowed no-op.
337
+ }
338
+ }
339
+ /**
340
+ * Appends an ARCS-authored user/assistant turn (sent to the session from the
341
+ * web UI) to the sidecar under the same sessions/.store lock the session store
342
+ * and the other sidecar writers use, so appends serialize with index mutations
343
+ * and reference appends. A failed append is a swallowed no-op. The id is
344
+ * minted from the shared ARCS-authored negative space so it can never collide
345
+ * with a reference turn — both render through <TurnRow key={t.id}>.
346
+ *
347
+ * `tool` and `run` ride through verbatim: they are what a run's event-log
348
+ * fold-down writes (one turn per `tool_use`, every turn tagged with the run
349
+ * whose log produced it — see web-server/run-event-log.ts).
350
+ */
351
+ export async function appendSessionTurn(projectDir, normalizedId, turn) {
352
+ try {
353
+ await ensureDir(join(projectDir, "sessions"));
354
+ await withLock(sessionStoreLockPath(projectDir), async () => {
355
+ const sidecarPath = sessionTranscriptPath(projectDir, normalizedId);
356
+ const existing = await readSidecarRecords(sidecarPath);
357
+ const record = {
358
+ id: nextNegativeTurnId(existing),
359
+ type: turn.type,
360
+ text: turn.text,
361
+ ...(turn.ts !== undefined ? { ts: turn.ts } : {}),
362
+ ...(turn.tool !== undefined ? { tool: turn.tool } : {}),
363
+ ...(turn.run !== undefined ? { run: turn.run } : {}),
364
+ };
365
+ await appendRecords(sidecarPath, [record]);
366
+ });
367
+ }
368
+ catch {
369
+ // Failed append is a swallowed no-op.
370
+ }
371
+ }
372
+ /**
373
+ * Reads the sidecar for the GET route, skipping malformed lines. Returns an
374
+ * empty array when the sidecar is missing. Never throws.
375
+ */
376
+ export async function readSessionTurns(projectDir, normalizedId) {
377
+ try {
378
+ return await readSidecarRecords(sessionTranscriptPath(projectDir, normalizedId));
379
+ }
380
+ catch {
381
+ return [];
382
+ }
383
+ }
384
+ //# sourceMappingURL=claude-transcript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-transcript.js","sourceRoot":"","sources":["../../src/utils/claude-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA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BAC7B,EAAE,EAAE,kBAAkB,CAAC,QAAQ,CAAC;gBAChC,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjD,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvD,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACrD,CAAC;YACF,MAAM,aAAa,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,UAAkB,EAClB,YAAoB;IAEpB,IAAI,CAAC;QACH,OAAO,MAAM,kBAAkB,CAAC,qBAAqB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { TaskMeta } from "./project-memory.js";
1
+ import { type TaskMeta } from "./task-store.js";
2
2
  export interface DiagramNode {
3
3
  nodeId: string;
4
4
  taskId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"diagram-generator.d.ts","sourceRoot":"","sources":["../../src/utils/diagram-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,qBAAqB,CAwHjG"}
1
+ {"version":3,"file":"diagram-generator.d.ts","sourceRoot":"","sources":["../../src/utils/diagram-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,qBAAqB,CAyHjG"}
@@ -1,3 +1,4 @@
1
+ import { normalizeTaskWorkMetadata } from "./task-store.js";
1
2
  /**
2
3
  * Generates a Mermaid .mmd diagram from plan tasks.
3
4
  * Node IDs assigned T001+ in stable task.id order (a.id.localeCompare(b.id)).
@@ -55,12 +56,12 @@ export function generateDiagramFromTasks(planId, tasks) {
55
56
  lines.push(`%% next-action: Start first backlog task`, "");
56
57
  for (let i = 0; i < nodes.length; i++) {
57
58
  const node = nodes[i];
58
- const t = sorted[i];
59
+ const t = normalizeTaskWorkMetadata(sorted[i]);
59
60
  const deps = t.dependsOn ?? [];
60
61
  const blockedBy = deps
61
62
  .map((depId) => taskIdToNodeId.get(depId))
62
63
  .filter((n) => n !== undefined);
63
- lines.push(`%% node: ${node.nodeId}`, `%% title: ${t.title}`, `%% status: ${t.status}`, `%% skill: ${t.skill ?? "quick-dev"}`, `%% scope: ${t.scope ?? "(TBD)"}`);
64
+ lines.push(`%% node: ${node.nodeId}`, `%% title: ${t.title}`, `%% status: ${t.status}`, `%% skill: ${t.skill ?? "implementation"}`, `%% work-mode: ${t.workMode ?? "bounded"}`, `%% scope: ${t.scope ?? "(TBD)"}`);
64
65
  if (t.sourceFiles && t.sourceFiles.length > 0) {
65
66
  const filesStr = t.sourceFiles
66
67
  .map((f) => (f.anchor ? `${f.path}:${f.anchor}` : f.path))