@stigmer/runner 3.0.9-dev.20260615153829 → 3.1.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 (329) hide show
  1. package/dist/.build-fingerprint +1 -1
  2. package/dist/__test-utils__/approval-contract/types.d.ts +174 -0
  3. package/dist/__test-utils__/approval-contract/types.js +24 -0
  4. package/dist/__test-utils__/approval-contract/types.js.map +1 -0
  5. package/dist/activities/call-agent-status.d.ts +19 -1
  6. package/dist/activities/call-agent-status.js +64 -5
  7. package/dist/activities/call-agent-status.js.map +1 -1
  8. package/dist/activities/call-llm.js +19 -53
  9. package/dist/activities/call-llm.js.map +1 -1
  10. package/dist/activities/classify-tool-approvals.d.ts +24 -0
  11. package/dist/activities/classify-tool-approvals.js +69 -17
  12. package/dist/activities/classify-tool-approvals.js.map +1 -1
  13. package/dist/activities/discover-mcp-server.d.ts +7 -0
  14. package/dist/activities/discover-mcp-server.js +11 -1
  15. package/dist/activities/discover-mcp-server.js.map +1 -1
  16. package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.d.ts +140 -0
  17. package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.js +130 -0
  18. package/dist/activities/execute-cursor/__test-utils__/cursor-hook-harness.js.map +1 -0
  19. package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.d.ts +18 -0
  20. package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js +123 -0
  21. package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js.map +1 -0
  22. package/dist/activities/execute-cursor/approval-policy.d.ts +17 -61
  23. package/dist/activities/execute-cursor/approval-policy.js +8 -120
  24. package/dist/activities/execute-cursor/approval-policy.js.map +1 -1
  25. package/dist/activities/execute-cursor/approval-state.d.ts +219 -9
  26. package/dist/activities/execute-cursor/approval-state.js +233 -17
  27. package/dist/activities/execute-cursor/approval-state.js.map +1 -1
  28. package/dist/activities/execute-cursor/capture-flow.d.ts +127 -0
  29. package/dist/activities/execute-cursor/capture-flow.js +234 -0
  30. package/dist/activities/execute-cursor/capture-flow.js.map +1 -0
  31. package/dist/activities/execute-cursor/cas-observations.d.ts +96 -0
  32. package/dist/activities/execute-cursor/cas-observations.js +184 -0
  33. package/dist/activities/execute-cursor/cas-observations.js.map +1 -0
  34. package/dist/activities/execute-cursor/command-provenance.d.ts +62 -0
  35. package/dist/activities/execute-cursor/command-provenance.js +128 -0
  36. package/dist/activities/execute-cursor/command-provenance.js.map +1 -0
  37. package/dist/activities/execute-cursor/exact-apply.d.ts +110 -0
  38. package/dist/activities/execute-cursor/exact-apply.js +204 -0
  39. package/dist/activities/execute-cursor/exact-apply.js.map +1 -0
  40. package/dist/activities/execute-cursor/hook-script.d.ts +53 -24
  41. package/dist/activities/execute-cursor/hook-script.js +310 -47
  42. package/dist/activities/execute-cursor/hook-script.js.map +1 -1
  43. package/dist/activities/execute-cursor/index.d.ts +8 -1
  44. package/dist/activities/execute-cursor/index.js +500 -64
  45. package/dist/activities/execute-cursor/index.js.map +1 -1
  46. package/dist/activities/execute-cursor/message-translator.d.ts +258 -11
  47. package/dist/activities/execute-cursor/message-translator.js +836 -90
  48. package/dist/activities/execute-cursor/message-translator.js.map +1 -1
  49. package/dist/activities/execute-cursor/prompt-builder.d.ts +20 -23
  50. package/dist/activities/execute-cursor/prompt-builder.js +74 -15
  51. package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
  52. package/dist/activities/execute-cursor/workspace-setup.d.ts +17 -0
  53. package/dist/activities/execute-cursor/workspace-setup.js +212 -33
  54. package/dist/activities/execute-cursor/workspace-setup.js.map +1 -1
  55. package/dist/activities/execute-deep-agent/__test-utils__/gateway-substrate.d.ts +19 -0
  56. package/dist/activities/execute-deep-agent/__test-utils__/gateway-substrate.js +143 -0
  57. package/dist/activities/execute-deep-agent/__test-utils__/gateway-substrate.js.map +1 -0
  58. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.d.ts +88 -0
  59. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js +81 -0
  60. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js.map +1 -0
  61. package/dist/activities/execute-deep-agent/approval-file-change.d.ts +47 -0
  62. package/dist/activities/execute-deep-agent/approval-file-change.js +68 -0
  63. package/dist/activities/execute-deep-agent/approval-file-change.js.map +1 -0
  64. package/dist/activities/execute-deep-agent/attachment-injector.d.ts +8 -1
  65. package/dist/activities/execute-deep-agent/attachment-injector.js +7 -7
  66. package/dist/activities/execute-deep-agent/attachment-injector.js.map +1 -1
  67. package/dist/activities/execute-deep-agent/cas-capture-backend.d.ts +42 -0
  68. package/dist/activities/execute-deep-agent/cas-capture-backend.js +47 -0
  69. package/dist/activities/execute-deep-agent/cas-capture-backend.js.map +1 -0
  70. package/dist/activities/execute-deep-agent/cas-capture-observer.d.ts +79 -0
  71. package/dist/activities/execute-deep-agent/cas-capture-observer.js +112 -0
  72. package/dist/activities/execute-deep-agent/cas-capture-observer.js.map +1 -0
  73. package/dist/activities/execute-deep-agent/hitl.d.ts +16 -3
  74. package/dist/activities/execute-deep-agent/hitl.js +11 -3
  75. package/dist/activities/execute-deep-agent/hitl.js.map +1 -1
  76. package/dist/activities/execute-deep-agent/index.d.ts +2 -1
  77. package/dist/activities/execute-deep-agent/index.js +393 -33
  78. package/dist/activities/execute-deep-agent/index.js.map +1 -1
  79. package/dist/activities/execute-deep-agent/inline-publisher.d.ts +7 -1
  80. package/dist/activities/execute-deep-agent/inline-publisher.js +23 -2
  81. package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -1
  82. package/dist/activities/execute-deep-agent/setup.d.ts +53 -2
  83. package/dist/activities/execute-deep-agent/setup.js +149 -92
  84. package/dist/activities/execute-deep-agent/setup.js.map +1 -1
  85. package/dist/activities/execute-deep-agent/stamp-flowed-rows.d.ts +36 -0
  86. package/dist/activities/execute-deep-agent/stamp-flowed-rows.js +56 -0
  87. package/dist/activities/execute-deep-agent/stamp-flowed-rows.js.map +1 -0
  88. package/dist/activities/execute-deep-agent/status-builder-shared.d.ts +34 -1
  89. package/dist/activities/execute-deep-agent/status-builder-shared.js +26 -25
  90. package/dist/activities/execute-deep-agent/status-builder-shared.js.map +1 -1
  91. package/dist/activities/execute-deep-agent/status-builder.d.ts +17 -5
  92. package/dist/activities/execute-deep-agent/status-builder.js +44 -3
  93. package/dist/activities/execute-deep-agent/status-builder.js.map +1 -1
  94. package/dist/activities/execute-deep-agent/streaming-side-effects.js +2 -19
  95. package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -1
  96. package/dist/activities/execute-deep-agent/streaming.js +3 -15
  97. package/dist/activities/execute-deep-agent/streaming.js.map +1 -1
  98. package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +25 -7
  99. package/dist/activities/execute-deep-agent/subagent-transformer.js +23 -7
  100. package/dist/activities/execute-deep-agent/subagent-transformer.js.map +1 -1
  101. package/dist/activities/execute-deep-agent/subagent-wiring.d.ts +30 -3
  102. package/dist/activities/execute-deep-agent/subagent-wiring.js +29 -3
  103. package/dist/activities/execute-deep-agent/subagent-wiring.js.map +1 -1
  104. package/dist/activities/execute-deep-agent/v3-status-builder.js +32 -2
  105. package/dist/activities/execute-deep-agent/v3-status-builder.js.map +1 -1
  106. package/dist/claimcheck/payload-codec.js +9 -5
  107. package/dist/claimcheck/payload-codec.js.map +1 -1
  108. package/dist/client/stigmer-client.d.ts +2 -0
  109. package/dist/client/stigmer-client.js +2 -0
  110. package/dist/client/stigmer-client.js.map +1 -1
  111. package/dist/middleware/approval-gate.d.ts +85 -4
  112. package/dist/middleware/approval-gate.js +165 -38
  113. package/dist/middleware/approval-gate.js.map +1 -1
  114. package/dist/middleware/types.d.ts +2 -5
  115. package/dist/shared/activity-input.d.ts +43 -0
  116. package/dist/shared/activity-input.js +17 -0
  117. package/dist/shared/activity-input.js.map +1 -0
  118. package/dist/shared/approval-canonicalize.d.ts +19 -0
  119. package/dist/shared/approval-canonicalize.js +119 -0
  120. package/dist/shared/approval-canonicalize.js.map +1 -0
  121. package/dist/shared/approval-fingerprint.d.ts +106 -0
  122. package/dist/shared/approval-fingerprint.js +113 -0
  123. package/dist/shared/approval-fingerprint.js.map +1 -0
  124. package/dist/shared/approval-policy.d.ts +182 -12
  125. package/dist/shared/approval-policy.js +213 -27
  126. package/dist/shared/approval-policy.js.map +1 -1
  127. package/dist/shared/args-preview.d.ts +52 -0
  128. package/dist/shared/args-preview.js +93 -0
  129. package/dist/shared/args-preview.js.map +1 -0
  130. package/dist/shared/artifact-storage.d.ts +19 -1
  131. package/dist/shared/artifact-storage.js +48 -11
  132. package/dist/shared/artifact-storage.js.map +1 -1
  133. package/dist/shared/file-change.d.ts +44 -0
  134. package/dist/shared/file-change.js +57 -0
  135. package/dist/shared/file-change.js.map +1 -0
  136. package/dist/shared/file-tools.d.ts +107 -0
  137. package/dist/shared/file-tools.js +168 -0
  138. package/dist/shared/file-tools.js.map +1 -0
  139. package/dist/shared/filereview/capture.d.ts +202 -0
  140. package/dist/shared/filereview/capture.js +498 -0
  141. package/dist/shared/filereview/capture.js.map +1 -0
  142. package/dist/shared/filereview/cas-substrate.d.ts +190 -0
  143. package/dist/shared/filereview/cas-substrate.js +284 -0
  144. package/dist/shared/filereview/cas-substrate.js.map +1 -0
  145. package/dist/shared/filereview/digest.d.ts +40 -0
  146. package/dist/shared/filereview/digest.js +66 -0
  147. package/dist/shared/filereview/digest.js.map +1 -0
  148. package/dist/shared/filereview/events.d.ts +170 -0
  149. package/dist/shared/filereview/events.js +298 -0
  150. package/dist/shared/filereview/events.js.map +1 -0
  151. package/dist/shared/filereview/git-substrate.d.ts +175 -0
  152. package/dist/shared/filereview/git-substrate.js +439 -0
  153. package/dist/shared/filereview/git-substrate.js.map +1 -0
  154. package/dist/shared/filereview/index.d.ts +11 -0
  155. package/dist/shared/filereview/index.js +12 -0
  156. package/dist/shared/filereview/index.js.map +1 -0
  157. package/dist/shared/filereview/secret-paths.d.ts +63 -0
  158. package/dist/shared/filereview/secret-paths.js +105 -0
  159. package/dist/shared/filereview/secret-paths.js.map +1 -0
  160. package/dist/shared/fingerprint-secret.d.ts +26 -0
  161. package/dist/shared/fingerprint-secret.js +47 -0
  162. package/dist/shared/fingerprint-secret.js.map +1 -0
  163. package/dist/shared/model-client.d.ts +51 -0
  164. package/dist/shared/model-client.js +77 -0
  165. package/dist/shared/model-client.js.map +1 -0
  166. package/dist/shared/plan-artifact.js +0 -2
  167. package/dist/shared/plan-artifact.js.map +1 -1
  168. package/dist/shared/status-offload.d.ts +83 -9
  169. package/dist/shared/status-offload.js +399 -79
  170. package/dist/shared/status-offload.js.map +1 -1
  171. package/dist/shared/status.js +14 -1
  172. package/dist/shared/status.js.map +1 -1
  173. package/dist/shared/tool-kind.d.ts +19 -0
  174. package/dist/shared/tool-kind.js +13 -0
  175. package/dist/shared/tool-kind.js.map +1 -1
  176. package/dist/shared/tool-row.d.ts +88 -0
  177. package/dist/shared/tool-row.js +127 -0
  178. package/dist/shared/tool-row.js.map +1 -0
  179. package/dist/shared/workspace/platform-dir.d.ts +25 -0
  180. package/dist/shared/workspace/platform-dir.js +38 -2
  181. package/dist/shared/workspace/platform-dir.js.map +1 -1
  182. package/dist/workflows/call-agent-orchestrator.js +56 -7
  183. package/dist/workflows/call-agent-orchestrator.js.map +1 -1
  184. package/dist/workflows/connect-mcp-server.d.ts +50 -0
  185. package/dist/workflows/connect-mcp-server.js +136 -15
  186. package/dist/workflows/connect-mcp-server.js.map +1 -1
  187. package/dist/workflows/types.d.ts +8 -0
  188. package/package.json +2 -2
  189. package/src/__test-utils__/approval-contract/contract.ts +224 -0
  190. package/src/__test-utils__/approval-contract/types.ts +179 -0
  191. package/src/__test-utils__/fake-artifact-storage.ts +72 -0
  192. package/src/__tests__/approval-gateway-contract.test.ts +29 -0
  193. package/src/__tests__/claimcheck-codec.test.ts +16 -53
  194. package/src/__tests__/golden-e2e.test.ts +2 -0
  195. package/src/__tests__/runner-token-coordinator.test.ts +3 -3
  196. package/src/activities/__tests__/call-agent-status.test.ts +135 -0
  197. package/src/activities/__tests__/call-llm.test.ts +1 -1
  198. package/src/activities/__tests__/classify-tool-approvals.test.ts +208 -1
  199. package/src/activities/__tests__/discover-mcp-server.test.ts +30 -0
  200. package/src/activities/__tests__/workflow-event-activities.test.ts +2 -1
  201. package/src/activities/call-agent-status.ts +74 -4
  202. package/src/activities/call-llm.ts +18 -63
  203. package/src/activities/classify-tool-approvals.ts +101 -19
  204. package/src/activities/discover-mcp-server.ts +29 -1
  205. package/src/activities/execute-cursor/__test-utils__/cursor-hook-harness.ts +216 -0
  206. package/src/activities/execute-cursor/__test-utils__/gateway-substrate.ts +148 -0
  207. package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +41 -9
  208. package/src/activities/execute-cursor/__tests__/approval-state.test.ts +292 -0
  209. package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +68 -1
  210. package/src/activities/execute-cursor/__tests__/capture-flow.test.ts +1005 -0
  211. package/src/activities/execute-cursor/__tests__/cas-observations.test.ts +187 -0
  212. package/src/activities/execute-cursor/__tests__/coarse-fingerprint.test.ts +97 -0
  213. package/src/activities/execute-cursor/__tests__/command-provenance.test.ts +240 -0
  214. package/src/activities/execute-cursor/__tests__/deny-gate-exact-apply.test.ts +203 -0
  215. package/src/activities/execute-cursor/__tests__/exact-apply.test.ts +375 -0
  216. package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +1294 -24
  217. package/src/activities/execute-cursor/__tests__/hitl-resume-history.test.ts +446 -0
  218. package/src/activities/execute-cursor/__tests__/hook-script.test.ts +384 -110
  219. package/src/activities/execute-cursor/__tests__/message-translator.test.ts +171 -25
  220. package/src/activities/execute-cursor/__tests__/sequential-gate-resume.test.ts +189 -0
  221. package/src/activities/execute-cursor/__tests__/tool-result-image.test.ts +44 -23
  222. package/src/activities/execute-cursor/__tests__/workspace-setup.test.ts +190 -10
  223. package/src/activities/execute-cursor/approval-policy.ts +28 -159
  224. package/src/activities/execute-cursor/approval-state.ts +366 -18
  225. package/src/activities/execute-cursor/capture-flow.ts +323 -0
  226. package/src/activities/execute-cursor/cas-observations.ts +204 -0
  227. package/src/activities/execute-cursor/command-provenance.ts +168 -0
  228. package/src/activities/execute-cursor/exact-apply.ts +253 -0
  229. package/src/activities/execute-cursor/hook-script.ts +317 -51
  230. package/src/activities/execute-cursor/index.ts +575 -67
  231. package/src/activities/execute-cursor/message-translator.ts +963 -89
  232. package/src/activities/execute-cursor/prompt-builder.ts +80 -14
  233. package/src/activities/execute-cursor/workspace-setup.ts +257 -42
  234. package/src/activities/execute-deep-agent/__test-utils__/gateway-substrate.ts +180 -0
  235. package/src/activities/execute-deep-agent/__test-utils__/scripted-model.ts +134 -0
  236. package/src/activities/execute-deep-agent/__tests__/approval-file-change.test.ts +84 -0
  237. package/src/activities/execute-deep-agent/__tests__/attachment-injector.test.ts +11 -24
  238. package/src/activities/execute-deep-agent/__tests__/cas-capture-backend.test.ts +64 -0
  239. package/src/activities/execute-deep-agent/__tests__/cas-capture-observer.test.ts +163 -0
  240. package/src/activities/execute-deep-agent/__tests__/hitl-integration.test.ts +8 -5
  241. package/src/activities/execute-deep-agent/__tests__/hitl-resume-approve-all.test.ts +342 -0
  242. package/src/activities/execute-deep-agent/__tests__/hitl-resume-history.test.ts +284 -0
  243. package/src/activities/execute-deep-agent/__tests__/hitl.test.ts +14 -36
  244. package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +31 -13
  245. package/src/activities/execute-deep-agent/__tests__/sequential-gate-resume.test.ts +349 -0
  246. package/src/activities/execute-deep-agent/__tests__/stamp-flowed-rows.test.ts +119 -0
  247. package/src/activities/execute-deep-agent/__tests__/status-builder.test.ts +91 -10
  248. package/src/activities/execute-deep-agent/__tests__/streaming-v3.test.ts +9 -9
  249. package/src/activities/execute-deep-agent/__tests__/subagent-approval-propagation.test.ts +160 -0
  250. package/src/activities/execute-deep-agent/__tests__/subagent-gitignored-capture.test.ts +213 -0
  251. package/src/activities/execute-deep-agent/__tests__/subagent-transformer.test.ts +3 -6
  252. package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +84 -1
  253. package/src/activities/execute-deep-agent/__tests__/v3-status-builder.test.ts +4 -1
  254. package/src/activities/execute-deep-agent/approval-file-change.ts +80 -0
  255. package/src/activities/execute-deep-agent/attachment-injector.ts +20 -11
  256. package/src/activities/execute-deep-agent/cas-capture-backend.ts +66 -0
  257. package/src/activities/execute-deep-agent/cas-capture-observer.ts +125 -0
  258. package/src/activities/execute-deep-agent/hitl.ts +23 -7
  259. package/src/activities/execute-deep-agent/index.ts +463 -40
  260. package/src/activities/execute-deep-agent/inline-publisher.ts +27 -4
  261. package/src/activities/execute-deep-agent/setup.ts +223 -125
  262. package/src/activities/execute-deep-agent/stamp-flowed-rows.ts +64 -0
  263. package/src/activities/execute-deep-agent/status-builder-shared.ts +62 -23
  264. package/src/activities/execute-deep-agent/status-builder.ts +63 -8
  265. package/src/activities/execute-deep-agent/streaming-side-effects.ts +2 -16
  266. package/src/activities/execute-deep-agent/streaming.ts +3 -13
  267. package/src/activities/execute-deep-agent/subagent-transformer.ts +53 -13
  268. package/src/activities/execute-deep-agent/subagent-wiring.ts +50 -3
  269. package/src/activities/execute-deep-agent/v3-status-builder.ts +36 -2
  270. package/src/claimcheck/payload-codec.ts +8 -8
  271. package/src/client/stigmer-client.ts +9 -1
  272. package/src/middleware/__tests__/approval-gate.test.ts +488 -4
  273. package/src/middleware/approval-gate.ts +247 -38
  274. package/src/middleware/types.ts +5 -5
  275. package/src/shared/__tests__/activity-input.test.ts +78 -0
  276. package/src/shared/__tests__/approval-canonicalize.test.ts +106 -0
  277. package/src/shared/__tests__/approval-fingerprint.test.ts +115 -0
  278. package/src/shared/__tests__/approval-policy.test.ts +274 -40
  279. package/src/shared/__tests__/args-preview.test.ts +78 -0
  280. package/src/shared/__tests__/artifact-storage-extended.test.ts +62 -10
  281. package/src/shared/__tests__/artifact-storage.test.ts +123 -11
  282. package/src/shared/__tests__/file-change.test.ts +85 -0
  283. package/src/shared/__tests__/file-tools.test.ts +90 -0
  284. package/src/shared/__tests__/fingerprint-secret.test.ts +51 -0
  285. package/src/shared/__tests__/lease-scope-corpus.test.ts +56 -0
  286. package/src/shared/__tests__/model-client.test.ts +162 -0
  287. package/src/shared/__tests__/plan-artifact.test.ts +11 -26
  288. package/src/shared/__tests__/policy-source-corpus.test.ts +58 -0
  289. package/src/shared/__tests__/status-offload.test.ts +573 -16
  290. package/src/shared/__tests__/status.test.ts +4 -5
  291. package/src/shared/__tests__/tool-kind.test.ts +24 -1
  292. package/src/shared/__tests__/tool-row.test.ts +221 -0
  293. package/src/shared/activity-input.ts +57 -0
  294. package/src/shared/approval-canonicalize.ts +159 -0
  295. package/src/shared/approval-fingerprint.ts +148 -0
  296. package/src/shared/approval-policy.ts +303 -27
  297. package/src/shared/args-preview.ts +98 -0
  298. package/src/shared/artifact-storage.ts +62 -11
  299. package/src/shared/checkpointer/__tests__/http-saver.test.ts +1 -2
  300. package/src/shared/file-change.ts +64 -0
  301. package/src/shared/file-tools.ts +169 -0
  302. package/src/shared/filereview/__tests__/capture.test.ts +856 -0
  303. package/src/shared/filereview/__tests__/cas-substrate.test.ts +404 -0
  304. package/src/shared/filereview/__tests__/digest.test.ts +100 -0
  305. package/src/shared/filereview/__tests__/events.test.ts +245 -0
  306. package/src/shared/filereview/__tests__/git-substrate.test.ts +362 -0
  307. package/src/shared/filereview/__tests__/proxy-reconcile.test.ts +286 -0
  308. package/src/shared/filereview/__tests__/secret-paths.test.ts +121 -0
  309. package/src/shared/filereview/capture.ts +727 -0
  310. package/src/shared/filereview/cas-substrate.ts +401 -0
  311. package/src/shared/filereview/digest.ts +83 -0
  312. package/src/shared/filereview/events.ts +449 -0
  313. package/src/shared/filereview/git-substrate.ts +555 -0
  314. package/src/shared/filereview/index.ts +60 -0
  315. package/src/shared/filereview/secret-paths.ts +121 -0
  316. package/src/shared/fingerprint-secret.ts +53 -0
  317. package/src/shared/model-client.ts +122 -0
  318. package/src/shared/plan-artifact.ts +0 -2
  319. package/src/shared/status-offload.ts +433 -77
  320. package/src/shared/status.ts +13 -0
  321. package/src/shared/tool-kind.ts +33 -0
  322. package/src/shared/tool-row.ts +135 -0
  323. package/src/shared/workspace/platform-dir.ts +41 -2
  324. package/src/workflow-engine/__tests__/golden-execution.test.ts +35 -18
  325. package/src/workflow-engine/__tests__/tasks/try.test.ts +1 -1
  326. package/src/workflows/__tests__/connect-mcp-server.test.ts +304 -29
  327. package/src/workflows/call-agent-orchestrator.ts +53 -6
  328. package/src/workflows/connect-mcp-server.ts +179 -24
  329. package/src/workflows/types.ts +8 -0
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Scripted deep-agent test harness: a deterministic chat model plus the
3
+ * parent-checkpoint interrupt reader.
4
+ *
5
+ * These two helpers are what every "drive a real deepagents/LangGraph graph
6
+ * through the approval gate" test needs, and they were previously copy-pasted
7
+ * inline. They are shared by:
8
+ * - `__tests__/subagent-approval-propagation.test.ts` (sub-agent interrupt
9
+ * propagation against the real runtime), and
10
+ * - `__test-utils__/gateway-substrate.ts` (the deep-agent adapter for the
11
+ * gateway Contract Test Kit).
12
+ *
13
+ * Keeping one copy means a change to how the runner reads pending interrupts (or
14
+ * how a scripted run is driven) updates every consumer at once.
15
+ */
16
+ import { BaseChatModel } from "@langchain/core/language_models/chat_models";
17
+ import { AIMessage, ToolMessage } from "@langchain/core/messages";
18
+ /**
19
+ * A deterministic two-turn chat model: on the first turn it proposes the
20
+ * selected role's tool calls; once a tool result comes back it returns the
21
+ * role's terminating text. No LLM, no network — the role is keyed on the bound
22
+ * tool names so the same model instance drives a parent and its sub-agents.
23
+ */
24
+ export class ScriptedModel extends BaseChatModel {
25
+ toolNames = [];
26
+ select;
27
+ constructor(select) {
28
+ super({});
29
+ this.select = select;
30
+ }
31
+ _llmType() {
32
+ return "scripted";
33
+ }
34
+ bindTools(tools) {
35
+ const next = new ScriptedModel(this.select);
36
+ next.toolNames = tools.map((t) => t?.name ?? "");
37
+ return next;
38
+ }
39
+ async _generate(messages) {
40
+ const step = this.select(this.toolNames);
41
+ const lastIsToolResult = messages[messages.length - 1] instanceof ToolMessage;
42
+ const message = lastIsToolResult
43
+ ? new AIMessage({ content: step.done })
44
+ : new AIMessage({
45
+ content: "",
46
+ tool_calls: step.toolCalls.map((tc) => ({ ...tc, type: "tool_call" })),
47
+ });
48
+ const text = typeof message.content === "string" ? message.content : "";
49
+ return { generations: [{ message, text }] };
50
+ }
51
+ }
52
+ /**
53
+ * Read the pending approval interrupts from a graph state, exactly as the
54
+ * production resume path does (`hitl.ts` / `index.ts`): scan the parent's
55
+ * top-level `tasks[].interrupts`, skipping any already carrying a resume value.
56
+ *
57
+ * Crucially `interruptId` is the interrupt's OWN id (`interrupts[].id`), not the
58
+ * owning `task.id` — for a nested sub-agent interrupt the two differ, and only
59
+ * the interrupt id routes a `Command(resume=...)` value back into the nested
60
+ * `interrupt()`.
61
+ */
62
+ export function readPendingInterrupts(state) {
63
+ const out = [];
64
+ for (const task of state.tasks ?? []) {
65
+ for (const intr of task.interrupts ?? []) {
66
+ if (intr.resumeValue !== undefined)
67
+ continue;
68
+ const v = (intr.value ?? {});
69
+ out.push({
70
+ taskId: task.id,
71
+ interruptId: intr.id ?? task.id,
72
+ toolCallId: v.tool_call_id ?? "",
73
+ toolName: v.tool_name ?? "",
74
+ message: v.message ?? "",
75
+ policySource: v.policy_source ?? "",
76
+ });
77
+ }
78
+ }
79
+ return out;
80
+ }
81
+ //# sourceMappingURL=scripted-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripted-model.js","sourceRoot":"","sources":["../../../../src/activities/execute-deep-agent/__test-utils__/scripted-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,WAAW,EAAoB,MAAM,0BAA0B,CAAC;AA2BpF;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC9C,SAA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9C,CAAC;CACF;AAkBD;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAKrC;IACC,MAAM,GAAG,GAAuB,EAAE,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;gBAAE,SAAS;YAC7C,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAA4B,CAAC;YACxD,GAAG,CAAC,IAAI,CAAC;gBACP,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,WAAW,EAAG,IAAI,CAAC,EAAa,IAAI,IAAI,CAAC,EAAE;gBAC3C,UAAU,EAAG,CAAC,CAAC,YAAuB,IAAI,EAAE;gBAC5C,QAAQ,EAAG,CAAC,CAAC,SAAoB,IAAI,EAAE;gBACvC,OAAO,EAAG,CAAC,CAAC,OAAkB,IAAI,EAAE;gBACpC,YAAY,EAAG,CAAC,CAAC,aAAwB,IAAI,EAAE;aAChD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Pre-execution args capture for the HITL approval gate (native harness).
3
+ *
4
+ * When the graph pauses for approval — before the tool runs — this captures a
5
+ * sanitized args preview so the gate can show the proposed change. It owns only
6
+ * the native-specific seam: correlating a gated `tool_call_id` to its arguments
7
+ * from graph state (the authoritative single source of truth at the interrupt,
8
+ * since the streamed input cache is empty and the interrupt value carries only a
9
+ * few fields). The approval card renders the proposed write/edit content from
10
+ * these args; there is no separate captured `file_changes` (removed in Phase 5
11
+ * Slice 4 — the args are the single source, and the Cursor deny-gate's
12
+ * exact-apply reads the same args on resume; see execute-cursor/exact-apply.ts).
13
+ *
14
+ * @since First-Class Diff Review (#186), approval-gate phase
15
+ */
16
+ /** What the gate capture contributes to a `WAITING_APPROVAL` `ToolCall`. */
17
+ export interface ApprovalCaptureResult {
18
+ /** Sanitized JSON args preview, omitted when there are no args to show. */
19
+ readonly argsPreview?: string;
20
+ }
21
+ /**
22
+ * Correlate a gated `tool_call_id` to its arguments by scanning graph-state
23
+ * messages for the AI-message tool call that emitted it.
24
+ *
25
+ * Matching keys on the presence of a `tool_calls` array, which is robust to
26
+ * whether the message is a hydrated LangChain class instance or a plain
27
+ * serialized object: a `ToolMessage` carries a singular `tool_call_id`, never a
28
+ * `tool_calls` array, so it cannot be mistaken for the emitting AI message.
29
+ *
30
+ * Returns the args object (possibly empty when the tool call took no arguments),
31
+ * or `undefined` when no message in scope emitted this id — e.g. a tool call
32
+ * whose AI message lives only inside a nested sub-agent state, which this
33
+ * parent-scope scan does not reach. That degrades the gate to an args-less
34
+ * preview for that one interrupt, exactly as today.
35
+ */
36
+ export declare function findAiMessageToolCallArgs(messages: readonly unknown[], toolCallId: string): Record<string, unknown> | undefined;
37
+ /**
38
+ * Capture the gate's args preview from a single correlation lookup, keeping the
39
+ * call site thin.
40
+ *
41
+ * Returns an empty result when the tool call cannot be correlated or took no
42
+ * arguments, so the gate falls back to today's behavior for that interrupt.
43
+ */
44
+ export declare function captureApprovalArtifacts(opts: {
45
+ readonly toolCallId: string;
46
+ readonly messages: readonly unknown[];
47
+ }): ApprovalCaptureResult;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Pre-execution args capture for the HITL approval gate (native harness).
3
+ *
4
+ * When the graph pauses for approval — before the tool runs — this captures a
5
+ * sanitized args preview so the gate can show the proposed change. It owns only
6
+ * the native-specific seam: correlating a gated `tool_call_id` to its arguments
7
+ * from graph state (the authoritative single source of truth at the interrupt,
8
+ * since the streamed input cache is empty and the interrupt value carries only a
9
+ * few fields). The approval card renders the proposed write/edit content from
10
+ * these args; there is no separate captured `file_changes` (removed in Phase 5
11
+ * Slice 4 — the args are the single source, and the Cursor deny-gate's
12
+ * exact-apply reads the same args on resume; see execute-cursor/exact-apply.ts).
13
+ *
14
+ * @since First-Class Diff Review (#186), approval-gate phase
15
+ */
16
+ import { sanitizeArgsPreview } from "./status-builder-shared.js";
17
+ /**
18
+ * Correlate a gated `tool_call_id` to its arguments by scanning graph-state
19
+ * messages for the AI-message tool call that emitted it.
20
+ *
21
+ * Matching keys on the presence of a `tool_calls` array, which is robust to
22
+ * whether the message is a hydrated LangChain class instance or a plain
23
+ * serialized object: a `ToolMessage` carries a singular `tool_call_id`, never a
24
+ * `tool_calls` array, so it cannot be mistaken for the emitting AI message.
25
+ *
26
+ * Returns the args object (possibly empty when the tool call took no arguments),
27
+ * or `undefined` when no message in scope emitted this id — e.g. a tool call
28
+ * whose AI message lives only inside a nested sub-agent state, which this
29
+ * parent-scope scan does not reach. That degrades the gate to an args-less
30
+ * preview for that one interrupt, exactly as today.
31
+ */
32
+ export function findAiMessageToolCallArgs(messages, toolCallId) {
33
+ for (const msg of messages) {
34
+ if (!msg || typeof msg !== "object")
35
+ continue;
36
+ const toolCalls = msg.tool_calls;
37
+ if (!Array.isArray(toolCalls))
38
+ continue;
39
+ for (const tc of toolCalls) {
40
+ if (!tc || typeof tc !== "object")
41
+ continue;
42
+ const entry = tc;
43
+ if (entry.id !== toolCallId)
44
+ continue;
45
+ return entry.args &&
46
+ typeof entry.args === "object" &&
47
+ !Array.isArray(entry.args)
48
+ ? entry.args
49
+ : {};
50
+ }
51
+ }
52
+ return undefined;
53
+ }
54
+ /**
55
+ * Capture the gate's args preview from a single correlation lookup, keeping the
56
+ * call site thin.
57
+ *
58
+ * Returns an empty result when the tool call cannot be correlated or took no
59
+ * arguments, so the gate falls back to today's behavior for that interrupt.
60
+ */
61
+ export function captureApprovalArtifacts(opts) {
62
+ const args = findAiMessageToolCallArgs(opts.messages, opts.toolCallId);
63
+ if (!args || Object.keys(args).length === 0)
64
+ return {};
65
+ const argsPreview = sanitizeArgsPreview(args) || undefined;
66
+ return { argsPreview };
67
+ }
68
+ //# sourceMappingURL=approval-file-change.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-file-change.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/approval-file-change.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA4B,EAC5B,UAAkB;IAElB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,SAAS;QAC9C,MAAM,SAAS,GAAI,GAAgC,CAAC,UAAU,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YAAE,SAAS;QAExC,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;YAC3B,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ;gBAAE,SAAS;YAC5C,MAAM,KAAK,GAAG,EAAsC,CAAC;YACrD,IAAI,KAAK,CAAC,EAAE,KAAK,UAAU;gBAAE,SAAS;YAEtC,OAAO,KAAK,CAAC,IAAI;gBACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAC9B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;gBAC1B,CAAC,CAAE,KAAK,CAAC,IAAgC;gBACzC,CAAC,CAAC,EAAE,CAAC;QACT,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAGxC;IACC,MAAM,IAAI,GAAG,yBAAyB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACvE,IAAI,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvD,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;IAC3D,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC"}
@@ -27,7 +27,14 @@ export interface InjectedFile {
27
27
  export interface InjectAttachmentsOptions {
28
28
  readonly backend: WorkspaceBackend;
29
29
  readonly attachments: readonly Attachment[];
30
- readonly storage: ArtifactStorage;
30
+ /**
31
+ * Artifact storage for cloud-mode attachment download. `undefined` when the
32
+ * runner could not build a store (proxy misconfig). With no attachments this is
33
+ * never touched (the function early-returns); a cloud-mode attachment that
34
+ * genuinely needs storage surfaces a clear {@link AttachmentInjectionError}
35
+ * rather than dereferencing undefined.
36
+ */
37
+ readonly storage: ArtifactStorage | undefined;
31
38
  readonly isLocalMode: boolean;
32
39
  }
33
40
  export interface ZipEntryInfo {
@@ -216,14 +216,14 @@ async function downloadAttachment(attachment, storage, isLocalMode) {
216
216
  if (!attachment.storageKey) {
217
217
  throw new AttachmentInjectionError(attachment.filename, "missing storageKey — cannot download attachment from storage");
218
218
  }
219
+ // The attachment must come from storage, but the runner could not build one
220
+ // (proxy misconfig). Fail with an actionable message rather than dereferencing
221
+ // undefined — consistent with the degraded posture, never a silent skip.
222
+ if (!storage) {
223
+ throw new AttachmentInjectionError(attachment.filename, `artifact storage is unavailable, so this attachment (key: ${attachment.storageKey}) cannot be downloaded`);
224
+ }
219
225
  try {
220
- const url = await storage.getDownloadUrl(attachment.storageKey);
221
- const response = await fetch(url);
222
- if (!response.ok) {
223
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
224
- }
225
- const arrayBuffer = await response.arrayBuffer();
226
- return Buffer.from(arrayBuffer);
226
+ return await storage.download(attachment.storageKey);
227
227
  }
228
228
  catch (err) {
229
229
  if (err instanceof AttachmentInjectionError)
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-injector.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/att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BAAiB,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC7C,MAAM,OAAO,GAAG,gBAAgB,EAAE,CAAC;YACnC,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACxD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,uCAAuC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAgB;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,UAAU,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAErE,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;IAChC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A capture-mode `FilesystemBackend` that observes gitignored file mutations for
3
+ * CAS review (design docs 08/11/12; the `.gitignored` half of apply-then-review).
4
+ *
5
+ * WHY A BACKEND WRAPPER, NOT THE APPROVAL GATE
6
+ * --------------------------------------------
7
+ * Capture is a property of the TURN, not of authorization — exactly like the git
8
+ * substrate, which snapshots the working tree at the turn boundary regardless of
9
+ * how or whether a tool was gated. File review opens even under the global bypass
10
+ * (`spec.auto_approve_all`), where the approval gate is not installed at all, so
11
+ * sourcing the before-bytes from the gate would let gitignored edits silently
12
+ * escape review under auto-approve-all. Observing at the backend keeps CAS
13
+ * capture gate-independent, so it is symmetric with the git-tracked path.
14
+ *
15
+ * THIS CLASS IS A THIN ADAPTER
16
+ * ----------------------------
17
+ * All capture state and logic live in the shared {@link CasCaptureObserver} (one
18
+ * per turn). The parent graph and every sub-agent graph are each handed a backend
19
+ * pointing at the SAME observer, so their gitignored writes compose into one CAS
20
+ * change set with race-free first-touch-wins (see the observer's docs). This
21
+ * backend only forwards the mutation point to the observer before delegating to
22
+ * the base `FilesystemBackend`.
23
+ *
24
+ * deepagents mutates only via `write` (create/overwrite) and `edit` (modify);
25
+ * there is no backend delete/rename, so this observes CREATE and MODIFY. A
26
+ * gitignored delete can only arrive via shell, which stays on the approval gate.
27
+ *
28
+ * @since File-Change HITL Redesign (Phase 3 — CAS deep-agent wiring); sub-agent
29
+ * gitignored capture parity (Session 26, DD-19)
30
+ */
31
+ import { FilesystemBackend } from "deepagents";
32
+ import type { CasCaptureObserver } from "./cas-capture-observer.js";
33
+ export type { CasBeforeMap } from "./cas-capture-observer.js";
34
+ type FilesystemBackendOptions = NonNullable<ConstructorParameters<typeof FilesystemBackend>[0]>;
35
+ export declare class CasCaptureFilesystemBackend extends FilesystemBackend {
36
+ private readonly observer;
37
+ constructor(options: FilesystemBackendOptions, deps: {
38
+ readonly observer: CasCaptureObserver;
39
+ });
40
+ write(filePath: string, content: string): Promise<import("deepagents").WriteResult>;
41
+ edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise<import("deepagents").EditResult>;
42
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A capture-mode `FilesystemBackend` that observes gitignored file mutations for
3
+ * CAS review (design docs 08/11/12; the `.gitignored` half of apply-then-review).
4
+ *
5
+ * WHY A BACKEND WRAPPER, NOT THE APPROVAL GATE
6
+ * --------------------------------------------
7
+ * Capture is a property of the TURN, not of authorization — exactly like the git
8
+ * substrate, which snapshots the working tree at the turn boundary regardless of
9
+ * how or whether a tool was gated. File review opens even under the global bypass
10
+ * (`spec.auto_approve_all`), where the approval gate is not installed at all, so
11
+ * sourcing the before-bytes from the gate would let gitignored edits silently
12
+ * escape review under auto-approve-all. Observing at the backend keeps CAS
13
+ * capture gate-independent, so it is symmetric with the git-tracked path.
14
+ *
15
+ * THIS CLASS IS A THIN ADAPTER
16
+ * ----------------------------
17
+ * All capture state and logic live in the shared {@link CasCaptureObserver} (one
18
+ * per turn). The parent graph and every sub-agent graph are each handed a backend
19
+ * pointing at the SAME observer, so their gitignored writes compose into one CAS
20
+ * change set with race-free first-touch-wins (see the observer's docs). This
21
+ * backend only forwards the mutation point to the observer before delegating to
22
+ * the base `FilesystemBackend`.
23
+ *
24
+ * deepagents mutates only via `write` (create/overwrite) and `edit` (modify);
25
+ * there is no backend delete/rename, so this observes CREATE and MODIFY. A
26
+ * gitignored delete can only arrive via shell, which stays on the approval gate.
27
+ *
28
+ * @since File-Change HITL Redesign (Phase 3 — CAS deep-agent wiring); sub-agent
29
+ * gitignored capture parity (Session 26, DD-19)
30
+ */
31
+ import { FilesystemBackend } from "deepagents";
32
+ export class CasCaptureFilesystemBackend extends FilesystemBackend {
33
+ observer;
34
+ constructor(options, deps) {
35
+ super(options);
36
+ this.observer = deps.observer;
37
+ }
38
+ async write(filePath, content) {
39
+ await this.observer.recordBefore(filePath);
40
+ return super.write(filePath, content);
41
+ }
42
+ async edit(filePath, oldString, newString, replaceAll) {
43
+ await this.observer.recordBefore(filePath);
44
+ return super.edit(filePath, oldString, newString, replaceAll);
45
+ }
46
+ }
47
+ //# sourceMappingURL=cas-capture-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cas-capture-backend.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/cas-capture-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAS/C,MAAM,OAAO,2BAA4B,SAAQ,iBAAiB;IAC/C,QAAQ,CAAqB;IAE9C,YACE,OAAiC,EACjC,IAA+C;QAE/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;IAEQ,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,OAAe;QACpD,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAEQ,KAAK,CAAC,IAAI,CACjB,QAAgB,EAChB,SAAiB,EACjB,SAAiB,EACjB,UAAoB;QAEpB,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The single owner of one turn's CAS (content-addressed) capture state for the
3
+ * deep-agent activity — the `.gitignored` half of apply-then-review (design docs
4
+ * 08/11/12).
5
+ *
6
+ * WHY ONE SHARED OBSERVER (NOT PER-BACKEND STATE)
7
+ * -----------------------------------------------
8
+ * Capture is a property of the TURN, not of any single graph. The parent graph
9
+ * AND every sub-agent graph run against the same workspace root within one turn,
10
+ * and up to {@link SubAgentGate} sub-agents run CONCURRENTLY. If each filesystem
11
+ * backend held its own before-map + reservation, two graphs touching the same
12
+ * gitignored path could each read a "before" — the later one reading mid-turn
13
+ * (post-write) bytes as the baseline, corrupting the reviewed diff and breaking
14
+ * the "reviewed == applied" invariant.
15
+ *
16
+ * Making ONE observer own the before-map AND the reservation set fixes this by
17
+ * construction: `reserving.add` is synchronous (executes before the first
18
+ * `await` in {@link recordBefore}), so first-touch-wins holds across every
19
+ * backend instance that delegates here — the parent and all sub-agents.
20
+ *
21
+ * WHAT IT OWNS
22
+ * ------------
23
+ * - `before`: the pre-turn bytes of each first-touched gitignored path
24
+ * (`null` = the path did not exist → an ADD), read at the turn boundary to
25
+ * build the CAS `before` side.
26
+ * - `blockedSecretPaths`: gitignored paths the approval gate hard-blocked as
27
+ * secret-like (DD-E) — never applied, never captured; the boundary authors a
28
+ * content-less `DIFF_UNREVIEWABLE` entry for each (path only — the name is not
29
+ * the secret; the CONTENT never leaves the workspace).
30
+ *
31
+ * The AFTER bytes are re-read from disk at the turn boundary (the authoritative
32
+ * net result of the turn), so multiple edits to one path collapse to one
33
+ * before/after. Git-tracked paths are never recorded here — the turn-boundary git
34
+ * diff captures them — so memory is bounded to the gitignored scope.
35
+ *
36
+ * @since File-Change HITL Redesign (Phase 3 — CAS deep-agent wiring); sub-agent
37
+ * gitignored capture parity (Session 26, DD-19)
38
+ */
39
+ /**
40
+ * Pre-turn bytes of each first-touched gitignored path, keyed by workspace-root-
41
+ * relative path. `null` means the path did not exist before the turn (an ADD).
42
+ */
43
+ export type CasBeforeMap = Map<string, Uint8Array | null>;
44
+ export declare class CasCaptureObserver {
45
+ private readonly rootDir;
46
+ /** Raw (uncached) gitignore predicate; results are memoized in {@link ignoredCache}. */
47
+ private readonly isIgnoredRaw;
48
+ /** Pre-turn bytes of first-touched gitignored paths (see {@link CasBeforeMap}). */
49
+ readonly before: CasBeforeMap;
50
+ /** Paths whose before-read is in flight — the synchronous first-touch lock. */
51
+ private readonly reserving;
52
+ /** Memoized `git check-ignore` results (one classification per distinct path). */
53
+ private readonly ignoredCache;
54
+ /** Gitignored paths hard-blocked as secret-like (never applied, never captured). */
55
+ private readonly blocked;
56
+ constructor(deps: {
57
+ readonly rootDir: string;
58
+ /** True when the workspace-relative path is gitignored (CAS-owned). Uncached. */
59
+ readonly isIgnored: (relPath: string) => Promise<boolean>;
60
+ });
61
+ /** Gitignored paths the gate refused as secret-like, read at the turn boundary. */
62
+ get blockedSecretPaths(): ReadonlySet<string>;
63
+ /**
64
+ * Record the pre-turn bytes of `rawPath` when it is a first-touched gitignored
65
+ * path. First-touch-wins across ALL backends sharing this observer: the slot is
66
+ * reserved SYNCHRONOUSLY (before the first `await`), so two concurrent
67
+ * mutations of the same path — even from different graphs — cannot both read a
68
+ * post-write "before". Non-gitignored paths (git-tracked) are ignored here; the
69
+ * turn-boundary git diff captures them.
70
+ */
71
+ recordBefore(rawPath: string): Promise<void>;
72
+ /**
73
+ * Record a gitignored path the approval gate hard-blocked as secret-like. The
74
+ * raw path is resolved to the same workspace-relative key the CAS reconcile
75
+ * uses, so the boundary can author its `DIFF_UNREVIEWABLE` entry. Idempotent.
76
+ */
77
+ recordBlockedSecret(rawPath: string): void;
78
+ private isPathIgnored;
79
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * The single owner of one turn's CAS (content-addressed) capture state for the
3
+ * deep-agent activity — the `.gitignored` half of apply-then-review (design docs
4
+ * 08/11/12).
5
+ *
6
+ * WHY ONE SHARED OBSERVER (NOT PER-BACKEND STATE)
7
+ * -----------------------------------------------
8
+ * Capture is a property of the TURN, not of any single graph. The parent graph
9
+ * AND every sub-agent graph run against the same workspace root within one turn,
10
+ * and up to {@link SubAgentGate} sub-agents run CONCURRENTLY. If each filesystem
11
+ * backend held its own before-map + reservation, two graphs touching the same
12
+ * gitignored path could each read a "before" — the later one reading mid-turn
13
+ * (post-write) bytes as the baseline, corrupting the reviewed diff and breaking
14
+ * the "reviewed == applied" invariant.
15
+ *
16
+ * Making ONE observer own the before-map AND the reservation set fixes this by
17
+ * construction: `reserving.add` is synchronous (executes before the first
18
+ * `await` in {@link recordBefore}), so first-touch-wins holds across every
19
+ * backend instance that delegates here — the parent and all sub-agents.
20
+ *
21
+ * WHAT IT OWNS
22
+ * ------------
23
+ * - `before`: the pre-turn bytes of each first-touched gitignored path
24
+ * (`null` = the path did not exist → an ADD), read at the turn boundary to
25
+ * build the CAS `before` side.
26
+ * - `blockedSecretPaths`: gitignored paths the approval gate hard-blocked as
27
+ * secret-like (DD-E) — never applied, never captured; the boundary authors a
28
+ * content-less `DIFF_UNREVIEWABLE` entry for each (path only — the name is not
29
+ * the secret; the CONTENT never leaves the workspace).
30
+ *
31
+ * The AFTER bytes are re-read from disk at the turn boundary (the authoritative
32
+ * net result of the turn), so multiple edits to one path collapse to one
33
+ * before/after. Git-tracked paths are never recorded here — the turn-boundary git
34
+ * diff captures them — so memory is bounded to the gitignored scope.
35
+ *
36
+ * @since File-Change HITL Redesign (Phase 3 — CAS deep-agent wiring); sub-agent
37
+ * gitignored capture parity (Session 26, DD-19)
38
+ */
39
+ import { readFile } from "node:fs/promises";
40
+ import { resolveWorkspacePath } from "../../shared/file-change.js";
41
+ export class CasCaptureObserver {
42
+ rootDir;
43
+ /** Raw (uncached) gitignore predicate; results are memoized in {@link ignoredCache}. */
44
+ isIgnoredRaw;
45
+ /** Pre-turn bytes of first-touched gitignored paths (see {@link CasBeforeMap}). */
46
+ before = new Map();
47
+ /** Paths whose before-read is in flight — the synchronous first-touch lock. */
48
+ reserving = new Set();
49
+ /** Memoized `git check-ignore` results (one classification per distinct path). */
50
+ ignoredCache = new Map();
51
+ /** Gitignored paths hard-blocked as secret-like (never applied, never captured). */
52
+ blocked = new Set();
53
+ constructor(deps) {
54
+ this.rootDir = deps.rootDir;
55
+ this.isIgnoredRaw = deps.isIgnored;
56
+ }
57
+ /** Gitignored paths the gate refused as secret-like, read at the turn boundary. */
58
+ get blockedSecretPaths() {
59
+ return this.blocked;
60
+ }
61
+ /**
62
+ * Record the pre-turn bytes of `rawPath` when it is a first-touched gitignored
63
+ * path. First-touch-wins across ALL backends sharing this observer: the slot is
64
+ * reserved SYNCHRONOUSLY (before the first `await`), so two concurrent
65
+ * mutations of the same path — even from different graphs — cannot both read a
66
+ * post-write "before". Non-gitignored paths (git-tracked) are ignored here; the
67
+ * turn-boundary git diff captures them.
68
+ */
69
+ async recordBefore(rawPath) {
70
+ const { path: relPath, absolutePath } = resolveWorkspacePath(rawPath, this.rootDir, true);
71
+ if (this.before.has(relPath) || this.reserving.has(relPath))
72
+ return;
73
+ this.reserving.add(relPath);
74
+ try {
75
+ if (!(await this.isPathIgnored(relPath)))
76
+ return;
77
+ // Re-check after the await: a concurrent call may have won the slot.
78
+ if (this.before.has(relPath))
79
+ return;
80
+ this.before.set(relPath, await readBytesOrNull(absolutePath));
81
+ }
82
+ finally {
83
+ this.reserving.delete(relPath);
84
+ }
85
+ }
86
+ /**
87
+ * Record a gitignored path the approval gate hard-blocked as secret-like. The
88
+ * raw path is resolved to the same workspace-relative key the CAS reconcile
89
+ * uses, so the boundary can author its `DIFF_UNREVIEWABLE` entry. Idempotent.
90
+ */
91
+ recordBlockedSecret(rawPath) {
92
+ this.blocked.add(resolveWorkspacePath(rawPath, this.rootDir, true).path);
93
+ }
94
+ async isPathIgnored(relPath) {
95
+ const cached = this.ignoredCache.get(relPath);
96
+ if (cached !== undefined)
97
+ return cached;
98
+ const ignored = await this.isIgnoredRaw(relPath);
99
+ this.ignoredCache.set(relPath, ignored);
100
+ return ignored;
101
+ }
102
+ }
103
+ /** Raw bytes of a file, or `null` when it does not exist (an ADD). */
104
+ async function readBytesOrNull(absolutePath) {
105
+ try {
106
+ return await readFile(absolutePath);
107
+ }
108
+ catch {
109
+ return null;
110
+ }
111
+ }
112
+ //# sourceMappingURL=cas-capture-observer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cas-capture-observer.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/cas-capture-observer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,QAAQ,EAAE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eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;QAChE,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,OAAe;QACjC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAe;QACzC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC;QACxC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,sEAAsE;AACtE,KAAK,UAAU,eAAe,CAAC,YAAoB;IACjD,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -31,6 +31,16 @@ export interface GraphInterrupt {
31
31
  readonly interrupts?: readonly InterruptValue[];
32
32
  }
33
33
  export interface InterruptValue {
34
+ /**
35
+ * The interrupt's own id — the canonical key LangGraph matches a
36
+ * `Command(resume={...})` map against. For a parent-level tool interrupt this
37
+ * coincides with the owning task id, but for a *nested sub-agent* interrupt
38
+ * the two differ: the sub-agent's interrupt surfaces under the parent task
39
+ * that ran the `task` tool, and ONLY this id routes the resume value back into
40
+ * the sub-agent's `interrupt()`. Keying by `task.id` silently skips sub-agent
41
+ * approvals (verified empirically in subagent-approval-propagation.test.ts).
42
+ */
43
+ readonly id?: string;
34
44
  readonly value: Record<string, unknown>;
35
45
  readonly resumeValue?: unknown;
36
46
  }
@@ -40,10 +50,13 @@ export interface InterruptValue {
40
50
  * Returns a `Command(resume=...)` if there are pending interrupts with
41
51
  * matching approval decisions, or a fresh user message input if this is
42
52
  * not a resume scenario.
53
+ *
54
+ * The graph checkpoint snapshot is read once by the caller and passed in: the
55
+ * same snapshot also decides whether status must be seeded from the persisted
56
+ * transcript (see `index.ts`), and on the durable (http) saver an extra
57
+ * `getState` is a network round-trip best avoided.
43
58
  */
44
- export declare function resolveResumeInput(execution: AgentExecution, agentGraph: {
45
- getState(config: Record<string, unknown>): Promise<GraphStateSnapshot>;
46
- }, langgraphConfig: Record<string, unknown>, userMessage: string): Promise<ResumeResult>;
59
+ export declare function resolveResumeInput(execution: AgentExecution, graphState: GraphStateSnapshot, userMessage: string): ResumeResult;
47
60
  interface ApprovalDecisionEntry {
48
61
  readonly action: ApprovalAction;
49
62
  readonly comment: string;