@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,88 @@
1
+ /**
2
+ * Session-state vocabulary — the ONE derivation both sides of the wire read.
3
+ *
4
+ * A session carries two state fields: `status`, persisted by the store, and
5
+ * `phase`, derived per response and never persisted. The moment two call sites
6
+ * pick between them independently the product starts disagreeing with itself —
7
+ * a table badged `running` under an `active` chip, or a server refusing the
8
+ * resume the client just offered. Everything user-facing and every server gate
9
+ * goes through `sessionState()` here, so there is nothing to keep in sync.
10
+ *
11
+ * The predicates take the RECORD, never a pre-picked string, for the same
12
+ * reason the badge component does: handing the badge a record protects badge
13
+ * call sites only, and a counter or an affordance gate takes no badge prop.
14
+ *
15
+ * ---------------------------------------------------------------------------
16
+ * THIS MODULE MUST HAVE ZERO IMPORTS. Do not add one — not a type-only import,
17
+ * not a `import type { SessionMeta }` for the parameter shapes below.
18
+ *
19
+ * `web/` imports this file directly by relative path (there is no alias and no
20
+ * third package). Its being a LEAF — not the directory it sits in — is the
21
+ * entire guarantee that no server module graph is dragged into the client
22
+ * bundle. One import of anything under `src/utils/` or `src/web-server/` and
23
+ * the CLI's transitive graph starts resolving inside `vite build`.
24
+ *
25
+ * The corollary of that reach: this file is typechecked under BOTH tsconfigs,
26
+ * and `web/tsconfig.json` sets `noUncheckedIndexedAccess` and
27
+ * `verbatimModuleSyntax` where the root tsconfig sets neither. A root-legal
28
+ * edit here can fail `npm --workspace @arcs/web run typecheck`. Run both.
29
+ * ---------------------------------------------------------------------------
30
+ */
31
+ /**
32
+ * The two fields a session's state is read from — all this module ever needs of
33
+ * a record, so a store record, a reconciled server view and a wire-shaped
34
+ * client record can all be filtered, gated and badged through one derivation.
35
+ *
36
+ * Typed as plain strings rather than the `SessionStatus`/`SessionPhase` literal
37
+ * unions on purpose. Pinning those here would mean either an import (forbidden
38
+ * above) or a third hand-written copy of the wire vocabulary that the server
39
+ * store and `web/src/api/client.ts` already mirror deliberately. What is shared
40
+ * across the boundary is the DERIVATION, not the wire types; every caller keeps
41
+ * passing its own precisely-typed record, which is assignable to this.
42
+ */
43
+ export interface SessionStateSource {
44
+ status: string;
45
+ phase?: string;
46
+ }
47
+ /**
48
+ * The state a session is in, as the UI states it everywhere and as the server
49
+ * decides from: the derived phase — the only signal reflecting whether the
50
+ * session is live right now — falling back to the record's own status for a
51
+ * record that reached a decision site without one (the record echoed by
52
+ * `POST /run` carries no phase, and neither does a pre-phase endpoint).
53
+ *
54
+ * This is the single derivation site. `status` is still readable on the row
55
+ * (the status cell's tooltip), but nothing decides anything from it alone.
56
+ */
57
+ export declare function sessionState(session: SessionStateSource): string;
58
+ /**
59
+ * Is this a session a human could still reach — as the badge beside it reads?
60
+ *
61
+ * What the sessions header counts as "N live". Takes the record so the count is
62
+ * computed from the same field the badge one row below renders, rather than
63
+ * from whichever of the two a call site happened to reach for.
64
+ *
65
+ * This is the SAFE half of the pair: across the reachable pairs above, `status`
66
+ * and `phase` never disagree about liveness. A record stored `active` whose
67
+ * process is gone derives `idle`, and `idle` is live — the record is not over —
68
+ * so the count is right read either way. That is a property of today's
69
+ * derivation, not a guarantee; reading the record keeps the count correct if it
70
+ * stops holding. `isSessionAttached` below is where the two genuinely disagree.
71
+ */
72
+ export declare function isSessionLive(session: SessionStateSource): boolean;
73
+ /**
74
+ * Is a process driving this session right now?
75
+ *
76
+ * The gate on affordances that need the session's runtime thread free — today
77
+ * the composer's headless resume and the server route behind it, neither of
78
+ * which can attach to a session a terminal is already driving. Reading the
79
+ * persisted status here is wrong in BOTH directions, and both are reachable
80
+ * pairs: a record stored `active` whose process is gone derives `idle` — no
81
+ * fresh evidence of attachment — and would be refused the resume it is the
82
+ * perfect candidate for (`active`/`idle`), while a live `running` session
83
+ * stored `idle` would be offered one that cannot work (`idle`/`running`).
84
+ * `idle` is the state the whole affordance turns on; it is never `ended`, which
85
+ * only a terminal status produces.
86
+ */
87
+ export declare function isSessionAttached(session: SessionStateSource): boolean;
88
+ //# sourceMappingURL=session-vocabulary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-vocabulary.d.ts","sourceRoot":"","sources":["../../src/shared/session-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAEhE;AAwCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAElE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAEtE"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Session-state vocabulary — the ONE derivation both sides of the wire read.
3
+ *
4
+ * A session carries two state fields: `status`, persisted by the store, and
5
+ * `phase`, derived per response and never persisted. The moment two call sites
6
+ * pick between them independently the product starts disagreeing with itself —
7
+ * a table badged `running` under an `active` chip, or a server refusing the
8
+ * resume the client just offered. Everything user-facing and every server gate
9
+ * goes through `sessionState()` here, so there is nothing to keep in sync.
10
+ *
11
+ * The predicates take the RECORD, never a pre-picked string, for the same
12
+ * reason the badge component does: handing the badge a record protects badge
13
+ * call sites only, and a counter or an affordance gate takes no badge prop.
14
+ *
15
+ * ---------------------------------------------------------------------------
16
+ * THIS MODULE MUST HAVE ZERO IMPORTS. Do not add one — not a type-only import,
17
+ * not a `import type { SessionMeta }` for the parameter shapes below.
18
+ *
19
+ * `web/` imports this file directly by relative path (there is no alias and no
20
+ * third package). Its being a LEAF — not the directory it sits in — is the
21
+ * entire guarantee that no server module graph is dragged into the client
22
+ * bundle. One import of anything under `src/utils/` or `src/web-server/` and
23
+ * the CLI's transitive graph starts resolving inside `vite build`.
24
+ *
25
+ * The corollary of that reach: this file is typechecked under BOTH tsconfigs,
26
+ * and `web/tsconfig.json` sets `noUncheckedIndexedAccess` and
27
+ * `verbatimModuleSyntax` where the root tsconfig sets neither. A root-legal
28
+ * edit here can fail `npm --workspace @arcs/web run typecheck`. Run both.
29
+ * ---------------------------------------------------------------------------
30
+ */
31
+ /**
32
+ * The state a session is in, as the UI states it everywhere and as the server
33
+ * decides from: the derived phase — the only signal reflecting whether the
34
+ * session is live right now — falling back to the record's own status for a
35
+ * record that reached a decision site without one (the record echoed by
36
+ * `POST /run` carries no phase, and neither does a pre-phase endpoint).
37
+ *
38
+ * This is the single derivation site. `status` is still readable on the row
39
+ * (the status cell's tooltip), but nothing decides anything from it alone.
40
+ */
41
+ export function sessionState(session) {
42
+ return session.phase ?? session.status;
43
+ }
44
+ /** States meaning "this session is not over": the live phases, plus the raw
45
+ * `active`/`idle` a record that arrived without a phase is badged with. */
46
+ const LIVE_STATES = new Set(["running", "idle", "active"]);
47
+ /**
48
+ * States meaning "a process is driving this session right now".
49
+ *
50
+ * Deliberately NARROWER than `LIVE_STATES`, and the reason both sets are
51
+ * private to this module rather than living at their call sites: `idle` is live
52
+ * — the record is not over and the session list counts it — but nothing holds
53
+ * its runtime thread, which is exactly the session a headless resume works on.
54
+ * One shared "live" set would silently conflate "not over" with "attached" and
55
+ * take the resume affordance away from every session that can actually use it.
56
+ *
57
+ * REACHABLE PAIRS. The server's derivation (`deriveSessionPhase` →
58
+ * `reconcilePhase` → `runDeadlinePhase`, all composed in `withPhases`) can only
59
+ * ever produce these (`status`, `phase`) pairs, exhaustively:
60
+ *
61
+ * active/idle · active/running · completed/ended · disconnected/ended ·
62
+ * failed/failed · idle/idle · idle/running
63
+ *
64
+ * So `ended` comes ONLY from a terminal status (`completed`/`disconnected`):
65
+ * the derivation returns it before looking at any liveness evidence, the
66
+ * reconciler early-returns on every non-`running` derivation, and both probes
67
+ * can only demote `running` to `idle`. A record stored `active` whose process
68
+ * is gone therefore derives `idle` — "no fresh evidence of attachment" — and
69
+ * never `ended`. Both sit outside this set, so this predicate answers the same
70
+ * either way; the pair that carries the meaning is `active`/`idle`, because
71
+ * that is what "the process is gone" actually looks like on the wire.
72
+ *
73
+ * `active` itself is a persisted status, reachable only through
74
+ * `sessionState`'s fallback for a record handed to a predicate without a
75
+ * derived phase. Server call sites go through `withPhases` first, so the phase
76
+ * decides in practice; the fallback is the conservative answer for anything
77
+ * that does not — treat as attached and refuse, rather than silently accept.
78
+ */
79
+ const ATTACHED_STATES = new Set(["running", "active"]);
80
+ /**
81
+ * Is this a session a human could still reach — as the badge beside it reads?
82
+ *
83
+ * What the sessions header counts as "N live". Takes the record so the count is
84
+ * computed from the same field the badge one row below renders, rather than
85
+ * from whichever of the two a call site happened to reach for.
86
+ *
87
+ * This is the SAFE half of the pair: across the reachable pairs above, `status`
88
+ * and `phase` never disagree about liveness. A record stored `active` whose
89
+ * process is gone derives `idle`, and `idle` is live — the record is not over —
90
+ * so the count is right read either way. That is a property of today's
91
+ * derivation, not a guarantee; reading the record keeps the count correct if it
92
+ * stops holding. `isSessionAttached` below is where the two genuinely disagree.
93
+ */
94
+ export function isSessionLive(session) {
95
+ return LIVE_STATES.has(sessionState(session));
96
+ }
97
+ /**
98
+ * Is a process driving this session right now?
99
+ *
100
+ * The gate on affordances that need the session's runtime thread free — today
101
+ * the composer's headless resume and the server route behind it, neither of
102
+ * which can attach to a session a terminal is already driving. Reading the
103
+ * persisted status here is wrong in BOTH directions, and both are reachable
104
+ * pairs: a record stored `active` whose process is gone derives `idle` — no
105
+ * fresh evidence of attachment — and would be refused the resume it is the
106
+ * perfect candidate for (`active`/`idle`), while a live `running` session
107
+ * stored `idle` would be offered one that cannot work (`idle`/`running`).
108
+ * `idle` is the state the whole affordance turns on; it is never `ended`, which
109
+ * only a terminal status produces.
110
+ */
111
+ export function isSessionAttached(session) {
112
+ return ATTACHED_STATES.has(sessionState(session));
113
+ }
114
+ //# sourceMappingURL=session-vocabulary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-vocabulary.js","sourceRoot":"","sources":["../../src/shared/session-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAmBH;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,OAA2B;IACtD,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;AACzC,CAAC;AAED;4EAC4E;AAC5E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2B;IACvD,OAAO,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA2B;IAC3D,OAAO,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Consent-gated writer for the Claude Code session-bridge hook.
3
+ *
4
+ * `arcs hooks install-claude-code` deliberately never edits agent configuration
5
+ * — it prints a snippet. This module is the opt-in counterpart: when the user
6
+ * explicitly confirms during `arcs project init`, it merges the same hook entry
7
+ * into the workspace's `.claude/settings.local.json` (local-only: the token is a
8
+ * secret and `settings.local.json` is the git-ignored variant).
9
+ *
10
+ * Two rules the merge must never break:
11
+ * 1. A malformed existing file ABORTS the write. Silently coalescing an
12
+ * unparseable settings file to `{}` would destroy a user's `permissions`
13
+ * block over a stray comma, so parse errors are surfaced, not swallowed.
14
+ * 2. Replacement is keyed on the absolute hook script path, not the project
15
+ * slug. A workspace can be reassigned between ARCS projects, so matching on
16
+ * the script path leaves exactly one current ARCS entry per event instead
17
+ * of accumulating stale ones. Entries belonging to other tools are kept
18
+ * untouched, in place.
19
+ */
20
+ interface HookCommandEntry {
21
+ type?: string;
22
+ command?: string;
23
+ [key: string]: unknown;
24
+ }
25
+ interface HookMatcherEntry {
26
+ hooks?: HookCommandEntry[];
27
+ [key: string]: unknown;
28
+ }
29
+ export interface ClaudeSettings {
30
+ hooks?: Record<string, HookMatcherEntry[]>;
31
+ [key: string]: unknown;
32
+ }
33
+ export interface ClaudeCodeHookInstallResult {
34
+ settingsPath: string;
35
+ token: string;
36
+ hookScriptPath: string;
37
+ serverUrl: string;
38
+ events: string[];
39
+ }
40
+ /** The only file this module ever writes — never `~/.claude/settings.json`. */
41
+ export declare function claudeSettingsLocalPath(workspacePath: string): string;
42
+ /**
43
+ * Returns a copy of `settings` with the ARCS hook entry registered under every
44
+ * hook event, replacing any prior entry that runs the same `hookScriptPath`.
45
+ * Pure — no I/O, so the merge rules are directly testable.
46
+ */
47
+ export declare function mergeHookIntoSettings(settings: ClaudeSettings, hook: {
48
+ command: string;
49
+ hookScriptPath: string;
50
+ }): ClaudeSettings;
51
+ /**
52
+ * Reads the workspace's `.claude/settings.local.json` (if any), merges in a
53
+ * freshly provisioned hook, and writes it back owner-only.
54
+ *
55
+ * Throws when the existing file is present but unparseable — nothing is written
56
+ * in that case, so a hand-edited settings file is never clobbered.
57
+ */
58
+ export declare function installClaudeCodeHook(options: {
59
+ workspacePath: string;
60
+ projectDir: string;
61
+ slug: string;
62
+ serverUrl?: string;
63
+ }): Promise<ClaudeCodeHookInstallResult>;
64
+ /**
65
+ * Interactively offers the hook install during `arcs project init`.
66
+ *
67
+ * Mirrors `promptAndInstallCodegraph`: a note explaining the offer, a confirm
68
+ * defaulting to "no", and a manual-fallback hint when declined. Returns the
69
+ * install result only when a write actually happened; returns `null` on
70
+ * decline, cancel, or failure. Never throws — `arcs project init` succeeding
71
+ * matters more than this offer succeeding.
72
+ */
73
+ export declare function promptAndInstallClaudeCodeHook(options: {
74
+ workspacePath: string;
75
+ projectDir: string;
76
+ slug: string;
77
+ serverUrl?: string;
78
+ }): Promise<ClaudeCodeHookInstallResult | null>;
79
+ export {};
80
+ //# sourceMappingURL=claude-code-hook-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-code-hook-install.d.ts","sourceRoot":"","sources":["../../src/utils/claude-code-hook-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,UAAU,gBAAgB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EA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AAI,CAAC,CAyC9C"}
@@ -0,0 +1,211 @@
1
+ /**
2
+ * Consent-gated writer for the Claude Code session-bridge hook.
3
+ *
4
+ * `arcs hooks install-claude-code` deliberately never edits agent configuration
5
+ * — it prints a snippet. This module is the opt-in counterpart: when the user
6
+ * explicitly confirms during `arcs project init`, it merges the same hook entry
7
+ * into the workspace's `.claude/settings.local.json` (local-only: the token is a
8
+ * secret and `settings.local.json` is the git-ignored variant).
9
+ *
10
+ * Two rules the merge must never break:
11
+ * 1. A malformed existing file ABORTS the write. Silently coalescing an
12
+ * unparseable settings file to `{}` would destroy a user's `permissions`
13
+ * block over a stray comma, so parse errors are surfaced, not swallowed.
14
+ * 2. Replacement is keyed on the absolute hook script path, not the project
15
+ * slug. A workspace can be reassigned between ARCS projects, so matching on
16
+ * the script path leaves exactly one current ARCS entry per event instead
17
+ * of accumulating stale ones. Entries belonging to other tools are kept
18
+ * untouched, in place.
19
+ */
20
+ import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
21
+ import { dirname, join } from "node:path";
22
+ import * as p from "@clack/prompts";
23
+ import color from "picocolors";
24
+ import { HOOK_EVENTS, provisionHookCommand } from "../cli/commands/hooks.js";
25
+ /** The only file this module ever writes — never `~/.claude/settings.json`. */
26
+ export function claudeSettingsLocalPath(workspacePath) {
27
+ return join(workspacePath, ".claude", "settings.local.json");
28
+ }
29
+ /**
30
+ * `chmod` that tolerates an absent file and nothing else.
31
+ *
32
+ * Used to narrow a settings file BEFORE it is rewritten, where "there is no
33
+ * file yet" is the ordinary fresh-install outcome and not a failure — the
34
+ * write's own `mode` covers that path. Every other errno (EPERM on a file this
35
+ * user does not own, EROFS) means the mode of a token-bearing file is not ours
36
+ * to set, so it propagates and fails the install closed, exactly as the
37
+ * trailing chmod does.
38
+ */
39
+ async function chmodIfPresent(path, mode) {
40
+ try {
41
+ await chmod(path, mode);
42
+ }
43
+ catch (err) {
44
+ if (err?.code !== "ENOENT")
45
+ throw err;
46
+ }
47
+ }
48
+ /**
49
+ * Returns a copy of `settings` with the ARCS hook entry registered under every
50
+ * hook event, replacing any prior entry that runs the same `hookScriptPath`.
51
+ * Pure — no I/O, so the merge rules are directly testable.
52
+ */
53
+ export function mergeHookIntoSettings(settings, hook) {
54
+ const hooks = { ...(settings.hooks ?? {}) };
55
+ for (const event of HOOK_EVENTS) {
56
+ const existing = Array.isArray(hooks[event]) ? hooks[event] : [];
57
+ const preserved = [];
58
+ for (const entry of existing) {
59
+ if (!entry || typeof entry !== "object" || !Array.isArray(entry.hooks)) {
60
+ // Not a shape we understand — leave it exactly as found.
61
+ preserved.push(entry);
62
+ continue;
63
+ }
64
+ // Strip only OUR command, at the inner level: a matcher entry may mix an
65
+ // ARCS hook with another tool's, and that other tool must survive.
66
+ const kept = entry.hooks.filter((h) => !(typeof h?.command === "string" && h.command.includes(hook.hookScriptPath)));
67
+ if (kept.length === 0)
68
+ continue;
69
+ preserved.push({ ...entry, hooks: kept });
70
+ }
71
+ preserved.push({ hooks: [{ type: "command", command: hook.command }] });
72
+ hooks[event] = preserved;
73
+ }
74
+ return { ...settings, hooks };
75
+ }
76
+ /**
77
+ * Reads the workspace's `.claude/settings.local.json` (if any), merges in a
78
+ * freshly provisioned hook, and writes it back owner-only.
79
+ *
80
+ * Throws when the existing file is present but unparseable — nothing is written
81
+ * in that case, so a hand-edited settings file is never clobbered.
82
+ */
83
+ export async function installClaudeCodeHook(options) {
84
+ const settingsPath = claudeSettingsLocalPath(options.workspacePath);
85
+ let raw;
86
+ try {
87
+ raw = await readFile(settingsPath, "utf-8");
88
+ }
89
+ catch {
90
+ // Absent file — start from an empty settings object.
91
+ }
92
+ let settings = {};
93
+ if (raw !== undefined && raw.trim().length > 0) {
94
+ let parsed;
95
+ try {
96
+ parsed = JSON.parse(raw);
97
+ }
98
+ catch {
99
+ throw new Error(`${settingsPath} exists but is not valid JSON — fix it manually or delete it, ` +
100
+ `then re-run \`arcs hooks install-claude-code ${options.slug}\`. Nothing was written.`);
101
+ }
102
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
103
+ throw new Error(`${settingsPath} is valid JSON but not an object — fix it manually or delete it, ` +
104
+ `then re-run \`arcs hooks install-claude-code ${options.slug}\`. Nothing was written.`);
105
+ }
106
+ settings = parsed;
107
+ }
108
+ const provisioned = await provisionHookCommand({
109
+ projectDir: options.projectDir,
110
+ slug: options.slug,
111
+ serverUrl: options.serverUrl,
112
+ });
113
+ const merged = mergeHookIntoSettings(settings, provisioned);
114
+ await mkdir(dirname(settingsPath), { recursive: true });
115
+ // The merged command embeds `ARCS_HOOK_TOKEN=<value>`, so this file is a
116
+ // SECOND cleartext copy of the hook token — this one in the user's repo
117
+ // rather than under ARCS's own data dir. It is narrowed in three steps
118
+ // because no one of them covers both the fresh and the repair path:
119
+ //
120
+ // 1. chmod BEFORE the write, best-effort. `writeFile` is a direct,
121
+ // non-atomic open(path, "w", mode): when the file already exists the
122
+ // `mode` argument is a no-op and the open merely truncates the inode
123
+ // that is there, so without this step the freshly minted token would be
124
+ // written into a still-0644 inode and sit world-readable for the write
125
+ // plus an await hop. ENOENT is ignored (see chmodIfPresent) because on a
126
+ // fresh install there is nothing to narrow yet. This runs AFTER the
127
+ // strict parse above, so a file that aborts the install keeps its mode
128
+ // as well as its bytes.
129
+ // 2. `mode` on the write itself. It applies only when the open CREATES the
130
+ // inode — which is precisely the fresh path, where it means the inode is
131
+ // 0600 before the token's first byte reaches it and step 1 had nothing
132
+ // to do. (That create-only caveat is exactly the one that does NOT apply
133
+ // to the token store's temp+rename writer, where every write installs a
134
+ // fresh inode — it bites squarely here.)
135
+ // 3. chmod after the write, unconditional. Steps 1 and 2 are each a claim
136
+ // about how THIS writer behaves — one assumes the inode survives the
137
+ // write, the other that the write creates it. Step 3 assumes nothing, so
138
+ // "0600 when this function returns" is a postcondition rather than an
139
+ // inference from the writer's syscalls.
140
+ //
141
+ // What this buys, stated honestly: 0o600 is a cross-user control. It does
142
+ // nothing against a process running as THIS user, and it does not hide the
143
+ // token from `ps` — the value is inlined in the hook command string, so every
144
+ // hook fire still exposes it in the process table. Handing the hook a path
145
+ // (`ARCS_HOOK_TOKEN_FILE=<path>`) instead of the value would close that; the
146
+ // mode only closes the on-disk half. Nor can any mode revoke a descriptor
147
+ // another account already opened on a 0644 file: the write edits that same
148
+ // inode in place, so such a reader follows the file into the new token. All
149
+ // three steps are a floor from this point forward, not a retraction of what
150
+ // was reachable before.
151
+ //
152
+ // The `.claude` DIRECTORY is deliberately left exactly as found. Unlike the
153
+ // hooks dir under ARCS's data dir, which holds nothing but the token, this
154
+ // one holds the user's other Claude Code files, and narrowing it would be a
155
+ // hostile surprise in a directory ARCS does not own.
156
+ await chmodIfPresent(settingsPath, 0o600);
157
+ await writeFile(settingsPath, `${JSON.stringify(merged, null, 2)}\n`, {
158
+ encoding: "utf-8",
159
+ mode: 0o600,
160
+ });
161
+ await chmod(settingsPath, 0o600);
162
+ return {
163
+ settingsPath,
164
+ token: provisioned.token,
165
+ hookScriptPath: provisioned.hookScriptPath,
166
+ serverUrl: provisioned.serverUrl,
167
+ events: [...HOOK_EVENTS],
168
+ };
169
+ }
170
+ /**
171
+ * Interactively offers the hook install during `arcs project init`.
172
+ *
173
+ * Mirrors `promptAndInstallCodegraph`: a note explaining the offer, a confirm
174
+ * defaulting to "no", and a manual-fallback hint when declined. Returns the
175
+ * install result only when a write actually happened; returns `null` on
176
+ * decline, cancel, or failure. Never throws — `arcs project init` succeeding
177
+ * matters more than this offer succeeding.
178
+ */
179
+ export async function promptAndInstallClaudeCodeHook(options) {
180
+ const settingsPath = claudeSettingsLocalPath(options.workspacePath);
181
+ p.note([
182
+ "The session-bridge hook lets the ARCS web UI see your Claude Code",
183
+ "sessions and queue messages for them (delivered at the next prompt).",
184
+ "",
185
+ `Writes ${color.cyan(settingsPath)} only — never your global config.`,
186
+ ].join("\n"), "Optional: Claude Code session bridge");
187
+ const shouldInstall = await p.confirm({
188
+ message: "Install the Claude Code session-bridge hook now?",
189
+ initialValue: false,
190
+ });
191
+ if (p.isCancel(shouldInstall) || !shouldInstall) {
192
+ p.log.info(color.dim(`Install later: arcs hooks install-claude-code ${options.slug}`));
193
+ return null;
194
+ }
195
+ try {
196
+ const result = await installClaudeCodeHook(options);
197
+ p.log.success([
198
+ `${color.green("✔")} Hook installed → ${color.cyan(result.settingsPath)}`,
199
+ color.dim("Start a NEW Claude Code session to pick it up — running sessions won't."),
200
+ ].join("\n"));
201
+ return result;
202
+ }
203
+ catch (err) {
204
+ p.log.warn([
205
+ `${color.yellow("⚠")} Could not install the hook: ${err instanceof Error ? err.message : String(err)}`,
206
+ color.dim(`Install manually later: arcs hooks install-claude-code ${options.slug}`),
207
+ ].join("\n"));
208
+ return null;
209
+ }
210
+ }
211
+ //# sourceMappingURL=claude-code-hook-install.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-code-hook-install.js","sourceRoot":"","sources":["../../src/utils/claude-code-hook-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0B7E,+EAA+E;AAC/E,MAAM,UAAU,uBAAuB,CAAC,aAAqB;IAC3D,OAAO,IAAI,CAAC,aAAa,EAAE,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;GASG;AACH,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,IAAY;IACtD,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE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