@stigmer/runner 3.0.9-dev.20260616060535 → 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 (328) 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 +10 -0
  74. package/dist/activities/execute-deep-agent/hitl.js +5 -1
  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 +370 -56
  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 +11 -5
  92. package/dist/activities/execute-deep-agent/status-builder.js +6 -2
  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 +6 -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 +2 -5
  243. package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +31 -13
  244. package/src/activities/execute-deep-agent/__tests__/sequential-gate-resume.test.ts +349 -0
  245. package/src/activities/execute-deep-agent/__tests__/stamp-flowed-rows.test.ts +119 -0
  246. package/src/activities/execute-deep-agent/__tests__/status-builder.test.ts +12 -11
  247. package/src/activities/execute-deep-agent/__tests__/streaming-v3.test.ts +9 -9
  248. package/src/activities/execute-deep-agent/__tests__/subagent-approval-propagation.test.ts +160 -0
  249. package/src/activities/execute-deep-agent/__tests__/subagent-gitignored-capture.test.ts +213 -0
  250. package/src/activities/execute-deep-agent/__tests__/subagent-transformer.test.ts +3 -6
  251. package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +84 -1
  252. package/src/activities/execute-deep-agent/__tests__/v3-status-builder.test.ts +4 -1
  253. package/src/activities/execute-deep-agent/approval-file-change.ts +80 -0
  254. package/src/activities/execute-deep-agent/attachment-injector.ts +20 -11
  255. package/src/activities/execute-deep-agent/cas-capture-backend.ts +66 -0
  256. package/src/activities/execute-deep-agent/cas-capture-observer.ts +125 -0
  257. package/src/activities/execute-deep-agent/hitl.ts +15 -1
  258. package/src/activities/execute-deep-agent/index.ts +434 -64
  259. package/src/activities/execute-deep-agent/inline-publisher.ts +27 -4
  260. package/src/activities/execute-deep-agent/setup.ts +223 -125
  261. package/src/activities/execute-deep-agent/stamp-flowed-rows.ts +64 -0
  262. package/src/activities/execute-deep-agent/status-builder-shared.ts +62 -23
  263. package/src/activities/execute-deep-agent/status-builder.ts +19 -7
  264. package/src/activities/execute-deep-agent/streaming-side-effects.ts +2 -16
  265. package/src/activities/execute-deep-agent/streaming.ts +3 -13
  266. package/src/activities/execute-deep-agent/subagent-transformer.ts +53 -13
  267. package/src/activities/execute-deep-agent/subagent-wiring.ts +50 -3
  268. package/src/activities/execute-deep-agent/v3-status-builder.ts +8 -2
  269. package/src/claimcheck/payload-codec.ts +8 -8
  270. package/src/client/stigmer-client.ts +9 -1
  271. package/src/middleware/__tests__/approval-gate.test.ts +488 -4
  272. package/src/middleware/approval-gate.ts +247 -38
  273. package/src/middleware/types.ts +5 -5
  274. package/src/shared/__tests__/activity-input.test.ts +78 -0
  275. package/src/shared/__tests__/approval-canonicalize.test.ts +106 -0
  276. package/src/shared/__tests__/approval-fingerprint.test.ts +115 -0
  277. package/src/shared/__tests__/approval-policy.test.ts +274 -40
  278. package/src/shared/__tests__/args-preview.test.ts +78 -0
  279. package/src/shared/__tests__/artifact-storage-extended.test.ts +62 -10
  280. package/src/shared/__tests__/artifact-storage.test.ts +123 -11
  281. package/src/shared/__tests__/file-change.test.ts +85 -0
  282. package/src/shared/__tests__/file-tools.test.ts +90 -0
  283. package/src/shared/__tests__/fingerprint-secret.test.ts +51 -0
  284. package/src/shared/__tests__/lease-scope-corpus.test.ts +56 -0
  285. package/src/shared/__tests__/model-client.test.ts +162 -0
  286. package/src/shared/__tests__/plan-artifact.test.ts +11 -26
  287. package/src/shared/__tests__/policy-source-corpus.test.ts +58 -0
  288. package/src/shared/__tests__/status-offload.test.ts +573 -16
  289. package/src/shared/__tests__/status.test.ts +4 -5
  290. package/src/shared/__tests__/tool-kind.test.ts +24 -1
  291. package/src/shared/__tests__/tool-row.test.ts +221 -0
  292. package/src/shared/activity-input.ts +57 -0
  293. package/src/shared/approval-canonicalize.ts +159 -0
  294. package/src/shared/approval-fingerprint.ts +148 -0
  295. package/src/shared/approval-policy.ts +303 -27
  296. package/src/shared/args-preview.ts +98 -0
  297. package/src/shared/artifact-storage.ts +62 -11
  298. package/src/shared/checkpointer/__tests__/http-saver.test.ts +1 -2
  299. package/src/shared/file-change.ts +64 -0
  300. package/src/shared/file-tools.ts +169 -0
  301. package/src/shared/filereview/__tests__/capture.test.ts +856 -0
  302. package/src/shared/filereview/__tests__/cas-substrate.test.ts +404 -0
  303. package/src/shared/filereview/__tests__/digest.test.ts +100 -0
  304. package/src/shared/filereview/__tests__/events.test.ts +245 -0
  305. package/src/shared/filereview/__tests__/git-substrate.test.ts +362 -0
  306. package/src/shared/filereview/__tests__/proxy-reconcile.test.ts +286 -0
  307. package/src/shared/filereview/__tests__/secret-paths.test.ts +121 -0
  308. package/src/shared/filereview/capture.ts +727 -0
  309. package/src/shared/filereview/cas-substrate.ts +401 -0
  310. package/src/shared/filereview/digest.ts +83 -0
  311. package/src/shared/filereview/events.ts +449 -0
  312. package/src/shared/filereview/git-substrate.ts +555 -0
  313. package/src/shared/filereview/index.ts +60 -0
  314. package/src/shared/filereview/secret-paths.ts +121 -0
  315. package/src/shared/fingerprint-secret.ts +53 -0
  316. package/src/shared/model-client.ts +122 -0
  317. package/src/shared/plan-artifact.ts +0 -2
  318. package/src/shared/status-offload.ts +433 -77
  319. package/src/shared/status.ts +13 -0
  320. package/src/shared/tool-kind.ts +33 -0
  321. package/src/shared/tool-row.ts +135 -0
  322. package/src/shared/workspace/platform-dir.ts +41 -2
  323. package/src/workflow-engine/__tests__/golden-execution.test.ts +35 -18
  324. package/src/workflow-engine/__tests__/tasks/try.test.ts +1 -1
  325. package/src/workflows/__tests__/connect-mcp-server.test.ts +304 -29
  326. package/src/workflows/call-agent-orchestrator.ts +53 -6
  327. package/src/workflows/connect-mcp-server.ts +179 -24
  328. package/src/workflows/types.ts +8 -0
@@ -9,21 +9,36 @@
9
9
  * State file format (JSON):
10
10
  * {
11
11
  * "autoApproveAll": false,
12
+ * "leasedCategories": ["shell"],
12
13
  * "mcpToolPolicies": {
13
14
  * "apply_cloud_resource": { "requiresApproval": true, "message": "..." }
14
15
  * },
15
- * "approvedGrants": [{ "toolName": "edit", "mcpServerSlug": "", "key": "write", "salient": "a.txt" }],
16
- * "approvedGrantTokens": ["d3JpdGUKYS50eHQ="]
16
+ * "approvedGrants": [{ "toolName": "edit", "mcpServerSlug": "", "key": "write", "salient": "a.txt", "contentDigest": "<sha256>" }],
17
+ * "approvedGrantTokens": ["<base64(key\nsalient[\ncontentDigest])>"]
17
18
  * }
18
19
  *
20
+ * A grant token is the action's PRIMARY token: base64(key \n salient \n digest)
21
+ * for a content-identified file edit (so a DIFFERENT edit to the same file does
22
+ * not match), or base64(key \n salient) for shell/delete/MCP and the rare
23
+ * content-less fallback. See {@link primaryToken}.
24
+ *
19
25
  * The hook gates the dangerous built-in set and the MCP tools that require
20
26
  * approval (mcpToolPolicies, which by construction holds only require-approval
21
27
  * entries); every other tool is allowed. The gated built-in set and its
22
28
  * name->category mapping are baked into the generated hook script (from
23
29
  * approval-policy.ts), not carried in the state file — only the dynamic inputs
24
- * (autoApproveAll, mcpToolPolicies, approvedGrantTokens) live here. This mirrors
25
- * the native harness and avoids denying auto-approved MCP tools, which are
26
- * absent from the policy map and indistinguishable from unknown tools by name.
30
+ * (autoApproveAll, leasedCategories, mcpToolPolicies, approvedGrantTokens) live
31
+ * here. This mirrors the native harness and avoids denying auto-approved MCP
32
+ * tools, which are absent from the policy map and indistinguishable from unknown
33
+ * tools by name.
34
+ *
35
+ * Approval leases (the scoped successor to autoApproveAll): `autoApproveAll` is
36
+ * now ONLY the pre-armed spec.auto_approve_all global bypass. An interactive
37
+ * "approve all" of a given class becomes a run-lifetime lease: a built-in
38
+ * category lease is listed in `leasedCategories` (the hook allows any built-in of
39
+ * that category), and an MCP-server lease is applied upstream by dropping the
40
+ * server's tools from mcpToolPolicies (so the hook allows them as auto-approved)
41
+ * — the hook is not server-aware, so omission is the lever there.
27
42
  *
28
43
  * Why grants instead of tool-call ids: a resumed Cursor agent re-issues the
29
44
  * approved tool with a BRAND NEW call id, so matching on the original call id
@@ -50,12 +65,15 @@
50
65
  * as approvedGrantTokens, so a denial token approved this turn becomes a grant
51
66
  * token next turn.
52
67
  */
53
- import { writeFile, readFile, mkdir } from "node:fs/promises";
68
+ import { watch } from "node:fs";
69
+ import { writeFile, readFile, mkdir, rename, rm } from "node:fs/promises";
54
70
  import { join } from "node:path";
55
71
  import { create } from "@bufbuild/protobuf";
56
72
  import { ApprovalAction, ToolCallStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
57
73
  import { PendingApprovalSchema } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/approval_pb";
58
- import { extractArgKey, approvalCategory } from "./approval-policy.js";
74
+ import { extractArgKey, approvalCategory, POLICY_ENGINE_VERSION } from "./approval-policy.js";
75
+ import { contentDigest } from "../../shared/file-tools.js";
76
+ import { fingerprintCoarseIdentity, } from "../../shared/approval-fingerprint.js";
59
77
  export function toolIdentity(toolName, mcpServerSlug, args) {
60
78
  if (mcpServerSlug) {
61
79
  return { key: toolName, salient: "" };
@@ -74,20 +92,91 @@ export function toolIdentity(toolName, mcpServerSlug, args) {
74
92
  export function grantToken(key, salient) {
75
93
  return Buffer.from(`${key}\n${salient}`, "utf-8").toString("base64");
76
94
  }
95
+ /**
96
+ * The content-exact wire token: `base64(key \n salient \n contentDigest)`. This
97
+ * is the exact-identity grant the hook matches for a file-mutating tool, so an
98
+ * approval of one edit does NOT authorize a DIFFERENT edit to the same file (a
99
+ * different digest yields a different token). The hook recomputes the identical
100
+ * token from `tool_input` (it appends the same `\n<digest>` only when the digest
101
+ * is non-empty — see hook-script.ts), so this encoding must stay byte-identical
102
+ * to the hook's, exactly as {@link grantToken} already is.
103
+ */
104
+ export function contentToken(key, salient, contentDigest) {
105
+ return Buffer.from(`${key}\n${salient}\n${contentDigest}`, "utf-8").toString("base64");
106
+ }
107
+ /**
108
+ * The single token a tool call authorizes (as a grant) and is recorded under (as
109
+ * a denial): the {@link contentToken} when a content digest is present (file
110
+ * edits/writes), else the coarse {@link grantToken} (shell, delete, MCP, or a
111
+ * content-less grep-fallback). One definition, used by the runner for both grant
112
+ * building and denial correlation and mirrored by the hook, so the deny-time and
113
+ * reinvoke-time identities can never drift.
114
+ */
115
+ export function primaryToken(key, salient, contentDigest) {
116
+ return contentDigest ? contentToken(key, salient, contentDigest) : grantToken(key, salient);
117
+ }
118
+ /**
119
+ * The shared HMAC coarse fingerprint of an approval grant.
120
+ *
121
+ * This is the SAME canonical coarse identity the wire token (grantToken) encodes
122
+ * — `(key, salient)` plus the MCP slug — run through the one shared HMAC+canonical
123
+ * path ({@link fingerprintCoarseIdentity}). It is NOT the hook's wire-match value:
124
+ * the hook matches on the mechanically-reproducible base64 token (a bash script
125
+ * can recompute base64 but not a keyed HMAC over a workspace-root-normalized
126
+ * salient). This fingerprint is the cross-substrate, anti-forgery identity used
127
+ * for the runner-side shadow receipt today and as the successor wire token once a
128
+ * lease becomes a server-issued bearer token (Phase 7). Because it shares the
129
+ * exact category + salient the token uses, the hook-side and stream-side
130
+ * fingerprints of one action are equal by construction (see the parity tests).
131
+ */
132
+ export function grantFingerprint(key, grant) {
133
+ return fingerprintCoarseIdentity(key, {
134
+ tool: grant.key,
135
+ mcpServerSlug: grant.mcpServerSlug,
136
+ salient: grant.salient,
137
+ });
138
+ }
139
+ /**
140
+ * Emit a best-effort shadow ExecutionReceipt for each grant the runner issues
141
+ * this turn (Phase 2, mirror of the deep-agent gateway's receipt).
142
+ *
143
+ * Cursor executes tools out-of-process, so unlike the in-process deep-agent
144
+ * gateway the runner cannot observe the actual side effect — the receipt is
145
+ * issued when the authorization GRANT is written (best-effort, `verified:false`),
146
+ * not at execution. Structured log only: never persisted, no proto. Shares the
147
+ * one HMAC+canonical fingerprint path so the value matches the deep-agent and
148
+ * cross-language corpus definitions.
149
+ */
150
+ export function emitCursorGrantReceipts(grants, fingerprintKey, executionId) {
151
+ for (const g of grants) {
152
+ console.log("[hitl-gateway] receipt " +
153
+ JSON.stringify({
154
+ executionId,
155
+ toolName: g.toolName,
156
+ mcpServerSlug: g.mcpServerSlug,
157
+ category: g.mcpServerSlug ? "" : g.key,
158
+ authorization: "approval",
159
+ policyEngineVersion: POLICY_ENGINE_VERSION,
160
+ fingerprint: grantFingerprint(fingerprintKey, g),
161
+ substrate: "cursor",
162
+ verified: false,
163
+ }));
164
+ }
165
+ }
77
166
  /**
78
167
  * Build approval grants from the pending approvals the user adjudicated and
79
168
  * their decisions. Only APPROVE / APPROVE_ALL decisions produce grants. Each
80
169
  * grant carries the canonical {@link ToolIdentity} (category + salient resource)
81
170
  * so the hook allows the exact approved resource on the resumed turn.
82
171
  */
83
- export function buildApprovalGrants(pendingApprovals, decisions) {
172
+ export function buildApprovalGrants(pendingApprovals, decisions, contentDigests) {
84
173
  const grants = [];
85
174
  for (const pa of pendingApprovals) {
86
175
  // Both APPROVE and APPROVE_ALL allow the adjudicated tool through on the
87
- // resumed turn. APPROVE_ALL additionally flips autoApproveAll for the whole
88
- // run (handled by the caller via hasApproveAllDecision), but we still emit a
89
- // grant here so the clicked tool is allowed regardless of how the hook reads
90
- // the state file.
176
+ // resumed turn. APPROVE_ALL additionally grants a run-lifetime lease for the
177
+ // clicked action's class (handled by the caller via deriveActiveLeases ->
178
+ // leasedCategories / dropped MCP server), but we still emit a grant here so
179
+ // the clicked tool itself is allowed regardless of how the hook reads state.
91
180
  const decision = decisions.get(pa.toolCallId);
92
181
  if (decision !== ApprovalAction.APPROVE && decision !== ApprovalAction.APPROVE_ALL)
93
182
  continue;
@@ -97,6 +186,14 @@ export function buildApprovalGrants(pendingApprovals, decisions) {
97
186
  mcpServerSlug: pa.mcpServerSlug,
98
187
  key: id.key,
99
188
  salient: id.salient,
189
+ // The content digest comes from the gate's authoritative captured input
190
+ // (carried on the tool call, see reconstructAdjudicatedApprovals) — NOT
191
+ // from argsPreview, which elides heavy edit content. Empty when the gate
192
+ // had no content (shell/delete/MCP) or it was unrecoverable, in which case
193
+ // the grant degrades to the coarse token (a same-file sibling can ride it,
194
+ // the documented bounded residual).
195
+ contentDigest: contentDigests?.get(pa.toolCallId) ?? "",
196
+ sourceToolCallId: pa.toolCallId,
100
197
  });
101
198
  }
102
199
  return grants;
@@ -117,14 +214,17 @@ function parseArgs(argsPreview) {
117
214
  * grants from a previous HITL cycle.
118
215
  *
119
216
  * The state file carries the hook script's DYNAMIC inputs:
120
- * - mcpToolPolicies: per-tool policy for MCP tools requiring approval
217
+ * - globalBypass: the pre-armed spec.auto_approve_all (written as autoApproveAll)
218
+ * - leasedCategories: built-in categories with a run-lifetime lease
219
+ * - mcpToolPolicies: per-tool policy for MCP tools requiring approval (leased
220
+ * servers are already absent — dropped upstream by mergeApprovalPolicies)
121
221
  * - approvedGrants / approvedGrantTokens: tools approved in the current HITL
122
222
  * cycle, allowed through on reinvocation
123
223
  *
124
224
  * The static gated built-in set and its category mapping are baked into the
125
225
  * generated hook script (from approval-policy.ts), not carried here.
126
226
  */
127
- export function buildApprovalState(mergedPolicies, autoApproveAll, grants) {
227
+ export function buildApprovalState(mergedPolicies, globalBypass, leasedCategories, grants, captureMode = false, captureIgnored = false, gitWorkspace = true) {
128
228
  const approvedGrants = grants ?? [];
129
229
  const mcpToolPolicies = {};
130
230
  for (const policy of mergedPolicies.values()) {
@@ -134,10 +234,17 @@ export function buildApprovalState(mergedPolicies, autoApproveAll, grants) {
134
234
  };
135
235
  }
136
236
  return {
137
- autoApproveAll,
237
+ autoApproveAll: globalBypass,
238
+ leasedCategories: [...leasedCategories],
138
239
  mcpToolPolicies,
139
240
  approvedGrants,
140
- approvedGrantTokens: approvedGrants.map((g) => grantToken(g.key, g.salient)),
241
+ // The hook matches a tool call's PRIMARY token (content when it can compute a
242
+ // digest from tool_input, else coarse). A content-identified grant authorizes
243
+ // only its exact content; a content-less grant authorizes the coarse token.
244
+ approvedGrantTokens: approvedGrants.map((g) => primaryToken(g.key, g.salient, g.contentDigest)),
245
+ captureMode,
246
+ captureIgnored,
247
+ gitWorkspace,
141
248
  };
142
249
  }
143
250
  const STATE_FILE_NAME = "approval-state.json";
@@ -188,6 +295,48 @@ export async function resetDenialLedger(hitlDir) {
188
295
  await writeFile(filePath, "", "utf-8");
189
296
  return filePath;
190
297
  }
298
+ /**
299
+ * Watch the denial ledger so the stream loop learns about a hook denial the
300
+ * moment it is written — not on the next tool_call event.
301
+ *
302
+ * The hook appends to denials.jsonl BEFORE Cursor surfaces the failure to the
303
+ * model, so a filesystem notification is the earliest possible signal that a
304
+ * turn must pause. The watcher deliberately does NOT read the file itself: it
305
+ * only flips the caller's dirty flag, and the stream loop confirms with a
306
+ * readDenialLedger() — a notification can fire for the per-turn reset
307
+ * truncation too, and only a read distinguishes "reset to empty" from "denial
308
+ * appended". Watching the DIRECTORY (not the file) survives the file being
309
+ * replaced/truncated between turns.
310
+ *
311
+ * fs.watch is best-effort by platform contract, so this is an accelerator,
312
+ * never the only trigger: the stream loop keeps its tool_call-event read as
313
+ * the backstop. On any watcher error we fall back to that backstop silently.
314
+ *
315
+ * Returns a close function, idempotent and safe to call on every exit path.
316
+ */
317
+ export function watchDenialLedger(hitlDir, onDirty) {
318
+ try {
319
+ const watcher = watch(hitlDir, (_eventType, filename) => {
320
+ if (!filename || filename === DENIAL_LEDGER_FILE)
321
+ onDirty();
322
+ });
323
+ // Without an error listener a watcher error crashes the process; with one,
324
+ // the watcher just goes quiet and the tool_call backstop takes over.
325
+ watcher.on("error", () => { });
326
+ return () => {
327
+ try {
328
+ watcher.close();
329
+ }
330
+ catch {
331
+ // Already closed — nothing to release.
332
+ }
333
+ };
334
+ }
335
+ catch {
336
+ // Watch unsupported on this platform/filesystem — backstop only.
337
+ return () => { };
338
+ }
339
+ }
191
340
  /**
192
341
  * Read the denial ledger written by the hook during the turn. Missing file →
193
342
  * no denials. Blank or partially-written lines are tolerated (the hook appends
@@ -213,6 +362,7 @@ export async function readDenialLedger(hitlDir) {
213
362
  entries.push({
214
363
  toolName: typeof obj.toolName === "string" ? obj.toolName : "",
215
364
  token: obj.token,
365
+ input: decodeLedgerInput(obj.input),
216
366
  });
217
367
  }
218
368
  }
@@ -222,9 +372,70 @@ export async function readDenialLedger(hitlDir) {
222
372
  }
223
373
  return entries;
224
374
  }
375
+ /**
376
+ * Decode the hook's base64(JSON(tool_input)) into the authoritative args object,
377
+ * or undefined when absent/garbage. Tolerant by construction: a bad capture must
378
+ * never drop the denial it rides on — the gate still surfaces, just without the
379
+ * richer preview.
380
+ */
381
+ function decodeLedgerInput(raw) {
382
+ if (typeof raw !== "string" || raw.length === 0)
383
+ return undefined;
384
+ try {
385
+ const json = Buffer.from(raw, "base64").toString("utf-8");
386
+ const parsed = JSON.parse(json);
387
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed)
388
+ ? parsed
389
+ : undefined;
390
+ }
391
+ catch {
392
+ return undefined;
393
+ }
394
+ }
395
+ // ─────────────────────────────────────────────────────────────────────────────
396
+ // Active-turn pointer (runner → stable hook): the per-turn indirection that makes
397
+ // a single, process-cached hook script resolve the CURRENT execution's artifacts
398
+ // ─────────────────────────────────────────────────────────────────────────────
399
+ const ACTIVE_POINTER_FILE = "active.json";
400
+ /** Absolute path of the active-turn pointer inside a workspace's gate directory. */
401
+ export function activePointerPath(gateDir) {
402
+ return join(gateDir, ACTIVE_POINTER_FILE);
403
+ }
404
+ /**
405
+ * Atomically point the workspace's stable hook at the current turn's artifacts.
406
+ *
407
+ * Written compactly (the hook's grep fallback parses `"key":"value"` with no
408
+ * spaces) and atomically (write a temp sibling, then rename) so a hook firing
409
+ * concurrently with the write never reads a half-written pointer. Returns the
410
+ * pointer path.
411
+ */
412
+ export async function writeActiveTurnPointer(gateDir, pointer) {
413
+ await mkdir(gateDir, { recursive: true });
414
+ const filePath = activePointerPath(gateDir);
415
+ const tmpPath = `${filePath}.${process.pid}.tmp`;
416
+ await writeFile(tmpPath, JSON.stringify(pointer), "utf-8");
417
+ await rename(tmpPath, filePath);
418
+ return filePath;
419
+ }
420
+ /**
421
+ * Remove the active-turn pointer on teardown so the gate is INERT between turns:
422
+ * a hook that fires when no turn is active (a leftover cached hooks.json, the
423
+ * user's own IDE) reads no pointer and allows immediately. Best-effort — a
424
+ * teardown failure must never fail the execution, and a stale pointer is itself
425
+ * inert once its runnerPid is gone (the scope guard fails closed to allow).
426
+ */
427
+ export async function removeActiveTurnPointer(gateDir) {
428
+ try {
429
+ await rm(activePointerPath(gateDir), { force: true });
430
+ }
431
+ catch {
432
+ // Already gone or unwritable — nothing to clean.
433
+ }
434
+ }
225
435
  export function reconstructAdjudicatedApprovals(messages) {
226
436
  const pendingApprovals = [];
227
437
  const decisions = new Map();
438
+ const contentDigests = new Map();
228
439
  for (const msg of messages) {
229
440
  for (const tc of msg.toolCalls) {
230
441
  if (tc.status !== ToolCallStatus.TOOL_CALL_WAITING_APPROVAL)
@@ -232,6 +443,11 @@ export function reconstructAdjudicatedApprovals(messages) {
232
443
  if (tc.approvalAction === ApprovalAction.UNSPECIFIED)
233
444
  continue;
234
445
  decisions.set(tc.id, tc.approvalAction);
446
+ // Prefer the persisted digest (set at the gate from the authoritative
447
+ // captured input, and never elided); recompute from args only for an
448
+ // execution that predates the field.
449
+ contentDigests.set(tc.id, tc.approvalContentDigest ||
450
+ (tc.args ? contentDigest(tc.args) : ""));
235
451
  pendingApprovals.push(create(PendingApprovalSchema, {
236
452
  toolCallId: tc.id,
237
453
  toolName: tc.name,
@@ -242,6 +458,6 @@ export function reconstructAdjudicatedApprovals(messages) {
242
458
  }));
243
459
  }
244
460
  }
245
- return { pendingApprovals, decisions };
461
+ return { pendingApprovals, decisions, contentDigests };
246
462
  }
247
463
  //# sourceMappingURL=approval-state.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"approval-state.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/approval-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9G,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAIzG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA8BvE,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,aAAqB,EACrB,IAAyC;IAEzC,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACxC,CAAC;IACD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC5C,8EAA8E;IAC9E,+EAA+E;IAC/E,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;AACrE,CAAC;AAuBD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,OAAe;IACrD,OAAO,MAAM,CAA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ostic capture-mode orchestration
3
+ * ({@link ../../shared/filereview/capture.js}).
4
+ *
5
+ * The substrate (git snapshot/restore) and the orchestration (baseline/candidate/
6
+ * reconcile authoring) live in `shared/filereview/` so the Cursor and deep-agent
7
+ * harnesses author IDENTICAL ledger entries. This adapter binds the Cursor
8
+ * specifics:
9
+ * - `harnessId = "cursor"` (stamped on the BASELINE payload the projection reads);
10
+ * - the Cursor gate files written into the workspace, excluded from the captured
11
+ * diff (`CURSOR_RUNNER_OWNED_PATHS`);
12
+ * - stamping the streamed file-edit transcript rows that flowed this turn with
13
+ * the change set id (`stampFlowedFileEditRows`) — the rows stay visible as
14
+ * observational/audit records at their transcript positions, while
15
+ * `file_change_sets` remains the single DECISION surface.
16
+ *
17
+ * The three turn-boundary functions keep their original signatures so the
18
+ * activity wiring (index.ts) and the cutover tests are unchanged.
19
+ */
20
+ import type { AgentMessage } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
21
+ import type { AgentExecutionStatus } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
22
+ import type { FileChangeSet, TurnCommandProvenance } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/filereview_pb";
23
+ import { type CaptureResumeResult } from "../../shared/filereview/capture.js";
24
+ import type { GitSubstrateChange as GitCapturedChange } from "../../shared/filereview/git-substrate.js";
25
+ import type { ArtifactStorage } from "../../shared/artifact-storage.js";
26
+ export type { CaptureResumeResult };
27
+ export { deriveCaptureMode } from "../../shared/filereview/capture.js";
28
+ /**
29
+ * Turn start: pin the pre-turn working tree behind the baseline ref and author
30
+ * BASELINE_CAPTURED (harnessId "cursor"). Returns the baseline tree sha for the
31
+ * turn-end diff.
32
+ */
33
+ export declare function captureBaselineToLedger(opts: {
34
+ readonly status: AgentExecutionStatus;
35
+ readonly gitRoot: string;
36
+ readonly executionId: string;
37
+ readonly changeSetId: string;
38
+ /** True (default) for a git work tree; false for a CAS-only non-git workspace. */
39
+ readonly gitWorkspace?: boolean;
40
+ }): Promise<string>;
41
+ /**
42
+ * Turn end: capture the change set + author CANDIDATE_CAPTURED, then stamp the
43
+ * streamed file-edit rows that flowed this turn with the change set id — the
44
+ * rows stay visible in place as observational records while `file_change_sets`
45
+ * remains the single decision surface. The working tree is LEFT applied
46
+ * (Cursor parity).
47
+ *
48
+ * The change set is HYBRID (git tree) or CAS-only (non-git): the hook-staged
49
+ * writes from the cas-observations sidecar this turn ({@link readCasObservations})
50
+ * — the Cursor analog of deep-agent's `buildCasTurnCaptures` — composed with the
51
+ * git-tracked diff when `gitWorkspace`. Non-secret staged paths become
52
+ * `GIT_IGNORED_CAPTURED` (git tree) or `NON_GIT_CAS` (non-git) CAS captures
53
+ * (before-bytes from the sidecar, after-bytes re-read from disk);
54
+ * secret-blocked paths become content-less `DIFF_UNREVIEWABLE` entries. The
55
+ * boundary re-runs {@link partitionIgnoredPathsBySecret} as a fail-closed
56
+ * backstop, so a secret that ever slipped into the captured set still has its
57
+ * bytes withheld from durable storage.
58
+ *
59
+ * `deniedTokens` are the identities the hook gated this turn (shell/MCP, or a
60
+ * gitignored delete). A streamed file-edit row whose identity is in that set is
61
+ * left for the deny-gate reconcile path — it did NOT flow. A flowed gitignored
62
+ * write is NOT in that set (the hook allowed it), so it is stamped like any
63
+ * other flowed edit and its captured delta surfaces as a CAS entry in the set.
64
+ *
65
+ * `hitlDir`/`storage` are omitted only by callers with no artifact storage
66
+ * (captureIgnored off); the CAS half is then skipped and this is a git-only
67
+ * capture exactly as before.
68
+ *
69
+ * Mutates `messages` and `status` in place. Returns the captured git changes.
70
+ */
71
+ export declare function captureTurnToLedger(opts: {
72
+ readonly status: AgentExecutionStatus;
73
+ readonly gitRoot: string;
74
+ readonly executionId: string;
75
+ readonly changeSetId: string;
76
+ readonly baselineTree: string;
77
+ readonly messages: AgentMessage[];
78
+ readonly deniedTokens: ReadonlySet<string>;
79
+ readonly hitlDir?: string;
80
+ readonly storage?: ArtifactStorage;
81
+ /**
82
+ * Sub-agent tool-call ids that existed BEFORE this turn's stream (the seeded
83
+ * prior sub-agents). Sub-agent edit rows created this turn are stamped with the
84
+ * parent change set id; rows in this set are skipped so a resume never
85
+ * re-stamps a prior turn's sub-agent rows. Omit when there are no prior
86
+ * sub-agents.
87
+ */
88
+ readonly priorSubAgentToolCallIds?: ReadonlySet<string>;
89
+ /**
90
+ * True (default) for a git work tree — the candidate is the git diff composed
91
+ * with the gitignored CAS captures (`GIT_IGNORED_CAPTURED`). False for a non-git
92
+ * workspace (Slice 2c): there is no git diff, so the whole change set is the CAS
93
+ * captures the hook staged for EVERY touched path (`NON_GIT_CAS`).
94
+ */
95
+ readonly gitWorkspace?: boolean;
96
+ /**
97
+ * The approved-command turn facts (DD-28), derived by the caller from the
98
+ * turn's tool calls ({@link ../command-provenance.js}). Present only when the
99
+ * turn qualifies; carried verbatim to the CANDIDATE event.
100
+ */
101
+ readonly commandProvenance?: TurnCommandProvenance;
102
+ }): Promise<readonly GitCapturedChange[]>;
103
+ /**
104
+ * Resume: reconcile the working tree to the change set's DECIDED decisions
105
+ * (keep approved "after" bytes, snap rejected/undecided back to baseline,
106
+ * hash-verified), author RECONCILED / FAILED, and release the refs. Delegates to
107
+ * the shared orchestration with the Cursor harness id + exclude paths.
108
+ *
109
+ * `storage` threads the CAS blob store + reader so gitignored (CAS) files in the
110
+ * change set reconcile from the durable manifest — approved after-blobs written
111
+ * (hash-verified), rejected files snapped back to their before-blobs. Omit for a
112
+ * git-only harness/turn; the shared CAS branch is then skipped. The read path is
113
+ * the same one `exact-apply` already uses (`ArtifactStorage.download`).
114
+ */
115
+ export declare function applyCaptureDecisions(opts: {
116
+ readonly status: AgentExecutionStatus;
117
+ readonly gitRoot: string;
118
+ readonly executionId: string;
119
+ readonly changeSet: FileChangeSet;
120
+ readonly storage?: ArtifactStorage;
121
+ /**
122
+ * True (default) for a git work tree; false for a CAS-only non-git workspace
123
+ * (Slice 2c). When false the reconcile never consults git refs — it is driven
124
+ * entirely by the durable CAS manifest.
125
+ */
126
+ readonly gitWorkspace?: boolean;
127
+ }): Promise<CaptureResumeResult>;