@stigmer/runner 3.15.3-dev.20260914100347 → 3.15.3-dev.20260916211208

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 (549) hide show
  1. package/README.md +1 -0
  2. package/dist/.build-fingerprint +1 -1
  3. package/dist/__test-utils__/approval-contract/types.d.ts +1 -1
  4. package/dist/__test-utils__/hermetic-activity.d.ts +61 -7
  5. package/dist/__test-utils__/hermetic-activity.js +100 -9
  6. package/dist/__test-utils__/hermetic-activity.js.map +1 -1
  7. package/dist/__test-utils__/model-registry-fixture.d.ts +22 -3
  8. package/dist/__test-utils__/model-registry-fixture.js +22 -7
  9. package/dist/__test-utils__/model-registry-fixture.js.map +1 -1
  10. package/dist/activities/execute-cursor/__test-utils__/contract-subject.d.ts +2 -2
  11. package/dist/activities/execute-cursor/__test-utils__/contract-subject.js +14 -11
  12. package/dist/activities/execute-cursor/__test-utils__/contract-subject.js.map +1 -1
  13. package/dist/activities/execute-cursor/__test-utils__/fold.d.ts +61 -0
  14. package/dist/activities/execute-cursor/__test-utils__/fold.js +94 -0
  15. package/dist/activities/execute-cursor/__test-utils__/fold.js.map +1 -0
  16. package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js +1 -1
  17. package/dist/activities/execute-cursor/__test-utils__/gateway-substrate.js.map +1 -1
  18. package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.d.ts +52 -14
  19. package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +46 -12
  20. package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -1
  21. package/dist/activities/execute-cursor/__test-utils__/scripted-agent.d.ts +21 -28
  22. package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js +27 -11
  23. package/dist/activities/execute-cursor/__test-utils__/scripted-agent.js.map +1 -1
  24. package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.d.ts +70 -26
  25. package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js +82 -32
  26. package/dist/activities/execute-cursor/__test-utils__/scripted-sdk.js.map +1 -1
  27. package/dist/activities/execute-cursor/adapter.d.ts +8 -7
  28. package/dist/activities/execute-cursor/adapter.js +13 -9
  29. package/dist/activities/execute-cursor/adapter.js.map +1 -1
  30. package/dist/activities/execute-cursor/approval-policy.d.ts +10 -10
  31. package/dist/activities/execute-cursor/approval-policy.js +12 -23
  32. package/dist/activities/execute-cursor/approval-policy.js.map +1 -1
  33. package/dist/activities/execute-cursor/approval-state.d.ts +35 -1
  34. package/dist/activities/execute-cursor/approval-state.js +65 -0
  35. package/dist/activities/execute-cursor/approval-state.js.map +1 -1
  36. package/dist/activities/execute-cursor/{message-translator.d.ts → boundary-rows.d.ts} +45 -341
  37. package/dist/activities/execute-cursor/boundary-rows.js +1018 -0
  38. package/dist/activities/execute-cursor/boundary-rows.js.map +1 -0
  39. package/dist/activities/execute-cursor/cursor-capabilities.d.ts +1 -1
  40. package/dist/activities/execute-cursor/cursor-capabilities.js +1 -1
  41. package/dist/activities/execute-cursor/cursor-event-recorder.d.ts +33 -14
  42. package/dist/activities/execute-cursor/cursor-event-recorder.js +43 -21
  43. package/dist/activities/execute-cursor/cursor-event-recorder.js.map +1 -1
  44. package/dist/activities/execute-cursor/prompt-builder.d.ts +3 -3
  45. package/dist/activities/execute-cursor/prompt-builder.js +4 -4
  46. package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
  47. package/dist/activities/execute-cursor/sdk-warmup.d.ts +15 -6
  48. package/dist/activities/execute-cursor/sdk-warmup.js +15 -6
  49. package/dist/activities/execute-cursor/sdk-warmup.js.map +1 -1
  50. package/dist/activities/execute-cursor/service-tier.js +1 -2
  51. package/dist/activities/execute-cursor/service-tier.js.map +1 -1
  52. package/dist/activities/execute-cursor/session-lifecycle.d.ts +38 -59
  53. package/dist/activities/execute-cursor/session-lifecycle.js +59 -96
  54. package/dist/activities/execute-cursor/session-lifecycle.js.map +1 -1
  55. package/dist/activities/execute-cursor/session-store.d.ts +100 -0
  56. package/dist/activities/execute-cursor/session-store.js +157 -0
  57. package/dist/activities/execute-cursor/session-store.js.map +1 -0
  58. package/dist/activities/execute-cursor/sub-agent-steps.d.ts +79 -0
  59. package/dist/activities/execute-cursor/sub-agent-steps.js +180 -0
  60. package/dist/activities/execute-cursor/sub-agent-steps.js.map +1 -0
  61. package/dist/activities/execute-cursor/tool-result.d.ts +49 -0
  62. package/dist/activities/execute-cursor/tool-result.js +130 -0
  63. package/dist/activities/execute-cursor/tool-result.js.map +1 -0
  64. package/dist/activities/execute-cursor/translator.d.ts +178 -0
  65. package/dist/activities/execute-cursor/translator.js +485 -0
  66. package/dist/activities/execute-cursor/translator.js.map +1 -0
  67. package/dist/activities/execute-cursor/turn-boundary.d.ts +15 -5
  68. package/dist/activities/execute-cursor/turn-boundary.js +10 -14
  69. package/dist/activities/execute-cursor/turn-boundary.js.map +1 -1
  70. package/dist/activities/execute-cursor/turn-settle.d.ts +11 -7
  71. package/dist/activities/execute-cursor/turn-settle.js +47 -34
  72. package/dist/activities/execute-cursor/turn-settle.js.map +1 -1
  73. package/dist/activities/execute-cursor/turn-setup.d.ts +2 -2
  74. package/dist/activities/execute-cursor/turn-setup.js +5 -5
  75. package/dist/activities/execute-cursor/turn-setup.js.map +1 -1
  76. package/dist/activities/execute-cursor/turn-stream.d.ts +23 -14
  77. package/dist/activities/execute-cursor/turn-stream.js +41 -28
  78. package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
  79. package/dist/activities/execute-cursor/turn.d.ts +4 -4
  80. package/dist/activities/execute-cursor/turn.js +5 -5
  81. package/dist/activities/execute-cursor/usage-pricing.d.ts +2 -2
  82. package/dist/activities/execute-cursor/usage-pricing.js +2 -2
  83. package/dist/activities/execute-deep-agent/__test-utils__/contract-subject.d.ts +2 -2
  84. package/dist/activities/execute-deep-agent/__test-utils__/contract-subject.js +2 -2
  85. package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.d.ts +16 -11
  86. package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js +22 -10
  87. package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js.map +1 -1
  88. package/dist/activities/execute-deep-agent/__test-utils__/hitl-script.js +1 -1
  89. package/dist/activities/execute-deep-agent/__test-utils__/hitl-script.js.map +1 -1
  90. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.d.ts +2 -3
  91. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.js +2 -3
  92. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model-module.js.map +1 -1
  93. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.d.ts +12 -3
  94. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js +18 -4
  95. package/dist/activities/execute-deep-agent/__test-utils__/scripted-model.js.map +1 -1
  96. package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.d.ts +10 -1
  97. package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js +24 -11
  98. package/dist/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.js.map +1 -1
  99. package/dist/activities/execute-deep-agent/adapter.d.ts +1 -1
  100. package/dist/activities/execute-deep-agent/adapter.js +1 -1
  101. package/dist/activities/execute-deep-agent/approval-file-change.d.ts +19 -19
  102. package/dist/activities/execute-deep-agent/approval-file-change.js +16 -15
  103. package/dist/activities/execute-deep-agent/approval-file-change.js.map +1 -1
  104. package/dist/activities/execute-deep-agent/deep-agent-capabilities.d.ts +2 -2
  105. package/dist/activities/execute-deep-agent/deep-agent-capabilities.js +2 -2
  106. package/dist/activities/execute-deep-agent/hitl.d.ts +2 -2
  107. package/dist/activities/execute-deep-agent/hitl.js +2 -2
  108. package/dist/activities/execute-deep-agent/inline-publisher.d.ts +13 -3
  109. package/dist/activities/execute-deep-agent/inline-publisher.js +3 -3
  110. package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -1
  111. package/dist/activities/execute-deep-agent/prompt-builder.d.ts +3 -3
  112. package/dist/activities/execute-deep-agent/prompt-builder.js +6 -7
  113. package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
  114. package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +16 -8
  115. package/dist/activities/execute-deep-agent/streaming-side-effects.js +20 -33
  116. package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -1
  117. package/dist/activities/execute-deep-agent/subagent-transformer.d.ts +3 -3
  118. package/dist/activities/execute-deep-agent/subagent-transformer.js +1 -1
  119. package/dist/activities/execute-deep-agent/translator.d.ts +134 -0
  120. package/dist/activities/execute-deep-agent/translator.js +418 -0
  121. package/dist/activities/execute-deep-agent/translator.js.map +1 -0
  122. package/dist/activities/execute-deep-agent/turn-settle.d.ts +13 -7
  123. package/dist/activities/execute-deep-agent/turn-settle.js +34 -45
  124. package/dist/activities/execute-deep-agent/turn-settle.js.map +1 -1
  125. package/dist/activities/execute-deep-agent/turn-setup.d.ts +8 -8
  126. package/dist/activities/execute-deep-agent/turn-setup.js +7 -7
  127. package/dist/activities/execute-deep-agent/turn-stream.d.ts +13 -10
  128. package/dist/activities/execute-deep-agent/turn-stream.js +44 -41
  129. package/dist/activities/execute-deep-agent/turn-stream.js.map +1 -1
  130. package/dist/activities/execute-deep-agent/turn.d.ts +3 -3
  131. package/dist/activities/execute-deep-agent/turn.js +3 -3
  132. package/dist/config.d.ts +2 -2
  133. package/dist/harness/approval-decisions.d.ts +1 -1
  134. package/dist/harness/approval-decisions.js +1 -1
  135. package/dist/harness/capabilities.d.ts +21 -11
  136. package/dist/harness/capabilities.js +2 -2
  137. package/dist/harness/capture.d.ts +4 -4
  138. package/dist/harness/capture.js +4 -4
  139. package/dist/harness/persist-chokepoint.d.ts +3 -3
  140. package/dist/harness/persist-chokepoint.js +3 -3
  141. package/dist/harness/registry.d.ts +2 -2
  142. package/dist/harness/registry.js +2 -2
  143. package/dist/harness/run-turn.d.ts +6 -4
  144. package/dist/harness/run-turn.js +31 -9
  145. package/dist/harness/run-turn.js.map +1 -1
  146. package/dist/harness/stop-controller.d.ts +1 -1
  147. package/dist/harness/stop-controller.js +1 -1
  148. package/dist/harness/terminal-table.d.ts +7 -7
  149. package/dist/harness/terminal-table.js +7 -7
  150. package/dist/harness/transcript/builder.d.ts +182 -0
  151. package/dist/harness/transcript/builder.js +693 -0
  152. package/dist/harness/transcript/builder.js.map +1 -0
  153. package/dist/harness/transcript/events.d.ts +218 -0
  154. package/dist/harness/transcript/events.js +50 -0
  155. package/dist/harness/transcript/events.js.map +1 -0
  156. package/dist/harness/transcript/state.d.ts +110 -0
  157. package/dist/harness/transcript/state.js +148 -0
  158. package/dist/harness/transcript/state.js.map +1 -0
  159. package/dist/harness/turn-context.d.ts +54 -38
  160. package/dist/harness/turn-context.js +42 -43
  161. package/dist/harness/turn-context.js.map +1 -1
  162. package/dist/harness/types.d.ts +63 -22
  163. package/dist/harness/types.js +12 -11
  164. package/dist/harness/types.js.map +1 -1
  165. package/dist/harness/usage-accumulator.d.ts +2 -2
  166. package/dist/harness/usage-accumulator.js +2 -2
  167. package/dist/harness-adapters.d.ts +5 -4
  168. package/dist/harness-adapters.js +5 -4
  169. package/dist/harness-adapters.js.map +1 -1
  170. package/dist/middleware/approval-gate.d.ts +6 -0
  171. package/dist/middleware/approval-gate.js +7 -57
  172. package/dist/middleware/approval-gate.js.map +1 -1
  173. package/dist/middleware/cost-advisory.d.ts +3 -3
  174. package/dist/middleware/cost-advisory.js +3 -3
  175. package/dist/middleware/index.d.ts +1 -1
  176. package/dist/middleware/index.js +1 -1
  177. package/dist/runner-manager.js +1 -1
  178. package/dist/runner-manager.js.map +1 -1
  179. package/dist/shared/approval-policy.d.ts +53 -0
  180. package/dist/shared/approval-policy.js +76 -0
  181. package/dist/shared/approval-policy.js.map +1 -1
  182. package/dist/shared/args-preview.d.ts +45 -22
  183. package/dist/shared/args-preview.js +51 -41
  184. package/dist/shared/args-preview.js.map +1 -1
  185. package/dist/shared/attachment-resolver.d.ts +4 -4
  186. package/dist/shared/attachment-resolver.js +4 -4
  187. package/dist/shared/attachment-vision.d.ts +2 -1
  188. package/dist/shared/attachment-vision.js.map +1 -1
  189. package/dist/shared/attachment-zip.d.ts +2 -2
  190. package/dist/shared/attachment-zip.js +2 -2
  191. package/dist/shared/cost-guard.d.ts +2 -2
  192. package/dist/shared/cost-guard.js +2 -2
  193. package/dist/shared/exact-apply.d.ts +1 -1
  194. package/dist/shared/exact-apply.js +1 -1
  195. package/dist/shared/execution-context.d.ts +2 -2
  196. package/dist/shared/execution-context.js +2 -2
  197. package/dist/shared/extract-structured-output.d.ts +2 -2
  198. package/dist/shared/extract-structured-output.js +2 -2
  199. package/dist/shared/filereview/cas-touched.d.ts +2 -2
  200. package/dist/shared/filereview/cas-touched.js +2 -2
  201. package/dist/shared/heartbeat.d.ts +1 -1
  202. package/dist/shared/heartbeat.js +1 -1
  203. package/dist/shared/llm-backend.d.ts +0 -4
  204. package/dist/shared/llm-backend.js +0 -4
  205. package/dist/shared/llm-backend.js.map +1 -1
  206. package/dist/shared/model-error.d.ts +1 -2
  207. package/dist/shared/model-error.js +1 -2
  208. package/dist/shared/model-error.js.map +1 -1
  209. package/dist/shared/persist-decision.d.ts +18 -24
  210. package/dist/shared/persist-decision.js +19 -11
  211. package/dist/shared/persist-decision.js.map +1 -1
  212. package/dist/shared/prompt-sections.d.ts +4 -4
  213. package/dist/shared/prompt-sections.js +4 -4
  214. package/dist/shared/skill-resolver.d.ts +3 -3
  215. package/dist/shared/skill-resolver.js +3 -3
  216. package/dist/shared/status-offload.d.ts +1 -1
  217. package/dist/shared/status-offload.js +2 -2
  218. package/dist/shared/status-offload.js.map +1 -1
  219. package/dist/shared/streaming-scheduler.d.ts +2 -7
  220. package/dist/shared/streaming-scheduler.js +6 -14
  221. package/dist/shared/streaming-scheduler.js.map +1 -1
  222. package/dist/shared/subagent-rows.d.ts +2 -2
  223. package/dist/shared/subagent-rows.js +2 -2
  224. package/dist/shared/todos.d.ts +3 -3
  225. package/dist/shared/todos.js +3 -3
  226. package/dist/shared/tool-row.d.ts +19 -1
  227. package/dist/shared/tool-row.js +36 -2
  228. package/dist/shared/tool-row.js.map +1 -1
  229. package/dist/shared/worker-shutdown.d.ts +1 -1
  230. package/dist/shared/worker-shutdown.js +1 -1
  231. package/dist/shared/workspace/session-provision.d.ts +1 -1
  232. package/dist/shared/workspace/session-provision.js +1 -1
  233. package/dist/shared/workspace/sources/empty.d.ts +1 -1
  234. package/dist/shared/workspace/sources/empty.js +1 -2
  235. package/dist/shared/workspace/sources/empty.js.map +1 -1
  236. package/dist/shared/workspace/sources/git.js +4 -4
  237. package/dist/shared/workspace/sources/git.js.map +1 -1
  238. package/dist/shared/workspace/sources/local-path.js +6 -6
  239. package/dist/shared/workspace/sources/local-path.js.map +1 -1
  240. package/dist/shared/workspace/stigmer-link.d.ts +1 -1
  241. package/dist/shared/workspace/stigmer-link.js +1 -1
  242. package/dist/shared/workspace/types.d.ts +2 -5
  243. package/dist/shared/workspace/types.js +0 -6
  244. package/dist/shared/workspace/types.js.map +1 -1
  245. package/dist/shared/workspace/writeback-coordinator.d.ts +17 -4
  246. package/dist/shared/workspace/writeback-coordinator.js +7 -9
  247. package/dist/shared/workspace/writeback-coordinator.js.map +1 -1
  248. package/package.json +5 -5
  249. package/src/__test-utils__/__tests__/execution-record-barrier.test.ts +70 -0
  250. package/src/__test-utils__/__tests__/harness-contract-self-check.test.ts +35 -1
  251. package/src/__test-utils__/approval-contract/contract.ts +1 -1
  252. package/src/__test-utils__/approval-contract/types.ts +1 -1
  253. package/src/__test-utils__/harness-boot-order-child.ts +1 -1
  254. package/src/__test-utils__/harness-contract/contract.ts +8 -8
  255. package/src/__test-utils__/harness-contract/recording-sink.ts +11 -1
  256. package/src/__test-utils__/harness-contract/runtime-contract.ts +52 -16
  257. package/src/__test-utils__/harness-contract/scripted-adapter.ts +47 -43
  258. package/src/__test-utils__/hermetic-activity.ts +113 -9
  259. package/src/__test-utils__/model-registry-fixture.ts +31 -7
  260. package/src/__test-utils__/module-specifiers.ts +32 -3
  261. package/src/__tests__/harness-boot-order.test.ts +1 -1
  262. package/src/__tests__/harness-contract.test.ts +1 -1
  263. package/src/__tests__/runner-manager.test.ts +1 -1
  264. package/src/activities/execute-cursor/__test-utils__/__tests__/scripted-double.test.ts +32 -8
  265. package/src/activities/execute-cursor/__test-utils__/contract-subject.ts +12 -10
  266. package/src/activities/execute-cursor/__test-utils__/fold.ts +116 -0
  267. package/src/activities/execute-cursor/__test-utils__/gateway-substrate.ts +1 -1
  268. package/src/activities/execute-cursor/__test-utils__/hermetic-cursor.ts +72 -19
  269. package/src/activities/execute-cursor/__test-utils__/scripted-agent.ts +35 -29
  270. package/src/activities/execute-cursor/__test-utils__/scripted-sdk.ts +94 -38
  271. package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +2 -1
  272. package/src/activities/execute-cursor/__tests__/approval-state.test.ts +14 -21
  273. package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +3 -3
  274. package/src/activities/execute-cursor/__tests__/coarse-fingerprint.test.ts +2 -1
  275. package/src/activities/execute-cursor/__tests__/cursor-baseurl-routing.test.ts +10 -8
  276. package/src/activities/execute-cursor/__tests__/cursor-event-recorder.test.ts +142 -0
  277. package/src/activities/execute-cursor/__tests__/cursor-fetch-interceptor-bypass.test.ts +24 -12
  278. package/src/activities/execute-cursor/__tests__/cursor-generate-image-live.test.ts +7 -2
  279. package/src/activities/execute-cursor/__tests__/cursor-hook-protocol-live.test.ts +163 -0
  280. package/src/activities/execute-cursor/__tests__/cursor-sdk-auth-smoke.test.ts +23 -20
  281. package/src/activities/execute-cursor/__tests__/cursor-transcript-live.test.ts +298 -0
  282. package/src/activities/execute-cursor/__tests__/deny-gate-exact-apply.test.ts +4 -2
  283. package/src/activities/execute-cursor/__tests__/fetch-interceptor.test.ts +1 -1
  284. package/src/activities/execute-cursor/__tests__/hermetic/deny-and-retry.test.ts +5 -2
  285. package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +5 -2
  286. package/src/activities/execute-cursor/__tests__/hermetic/goldens/mcp-tool-call.status.json +71 -0
  287. package/src/activities/execute-cursor/__tests__/hermetic/goldens/sdk-task-note.status.json +73 -0
  288. package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.error-delta.status.json +78 -0
  289. package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.output-first.status.json +72 -0
  290. package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.status.json +72 -0
  291. package/src/activities/execute-cursor/__tests__/hermetic/goldens/sub-agent-delegation.status.json +109 -0
  292. package/src/activities/execute-cursor/__tests__/hermetic/goldens/thinking-turn.status.json +78 -0
  293. package/src/activities/execute-cursor/__tests__/hermetic/goldens/todo-write.status.json +119 -0
  294. package/src/activities/execute-cursor/__tests__/hermetic/goldens/tool-error.status.json +68 -0
  295. package/src/activities/execute-cursor/__tests__/hermetic/goldens/tool-only-step.status.json +67 -0
  296. package/src/activities/execute-cursor/__tests__/hermetic/goldens/unattributed-hook-block.status.json +1 -1
  297. package/src/activities/execute-cursor/__tests__/hermetic/harness-contract.test.ts +10 -7
  298. package/src/activities/execute-cursor/__tests__/hermetic/mcp-tool-call.test.ts +146 -0
  299. package/src/activities/execute-cursor/__tests__/hermetic/pause-vs-shutdown.test.ts +8 -5
  300. package/src/activities/execute-cursor/__tests__/hermetic/plain-turn.test.ts +6 -2
  301. package/src/activities/execute-cursor/__tests__/hermetic/recovery-fresh-agent.test.ts +4 -1
  302. package/src/activities/execute-cursor/__tests__/hermetic/run-wait-arms.test.ts +6 -2
  303. package/src/activities/execute-cursor/__tests__/hermetic/sdk-task-note.test.ts +122 -0
  304. package/src/activities/execute-cursor/__tests__/hermetic/shell-output-delta.test.ts +276 -0
  305. package/src/activities/execute-cursor/__tests__/hermetic/stream-self-stop-arms.test.ts +12 -9
  306. package/src/activities/execute-cursor/__tests__/hermetic/sub-agent-delegation.test.ts +196 -0
  307. package/src/activities/execute-cursor/__tests__/hermetic/thinking-turn.test.ts +145 -0
  308. package/src/activities/execute-cursor/__tests__/hermetic/thrown-error-arms.test.ts +4 -1
  309. package/src/activities/execute-cursor/__tests__/hermetic/todo-write.test.ts +165 -0
  310. package/src/activities/execute-cursor/__tests__/hermetic/tool-call.test.ts +7 -4
  311. package/src/activities/execute-cursor/__tests__/hermetic/tool-error.test.ts +138 -0
  312. package/src/activities/execute-cursor/__tests__/hermetic/tool-only-step.test.ts +130 -0
  313. package/src/activities/execute-cursor/__tests__/hermetic/unattributed-hook-block.test.ts +17 -2
  314. package/src/activities/execute-cursor/__tests__/hermetic/workspace-lock-timeout.test.ts +5 -2
  315. package/src/activities/execute-cursor/__tests__/hitl-ledger.test.ts +43 -60
  316. package/src/activities/execute-cursor/__tests__/hitl-resume-history.test.ts +23 -28
  317. package/src/activities/execute-cursor/__tests__/hook-script.test.ts +2 -1
  318. package/src/activities/execute-cursor/__tests__/http2-interceptor.test.ts +1 -1
  319. package/src/activities/execute-cursor/__tests__/prompt-goldens.test.ts +5 -5
  320. package/src/activities/execute-cursor/__tests__/same-identity-reproposal.test.ts +11 -13
  321. package/src/activities/execute-cursor/__tests__/sequential-gate-resume.test.ts +8 -11
  322. package/src/activities/execute-cursor/__tests__/session-lifecycle.test.ts +86 -58
  323. package/src/activities/execute-cursor/__tests__/session-store.test.ts +220 -0
  324. package/src/activities/execute-cursor/__tests__/tool-result-image.test.ts +8 -22
  325. package/src/activities/execute-cursor/__tests__/translator.test.ts +594 -0
  326. package/src/activities/execute-cursor/__tests__/turn-boundary.test.ts +8 -5
  327. package/src/activities/execute-cursor/__tests__/turn-stream.test.ts +87 -63
  328. package/src/activities/execute-cursor/adapter.ts +13 -9
  329. package/src/activities/execute-cursor/approval-policy.ts +12 -24
  330. package/src/activities/execute-cursor/approval-state.ts +66 -1
  331. package/src/activities/execute-cursor/boundary-rows.ts +1132 -0
  332. package/src/activities/execute-cursor/cursor-capabilities.ts +1 -1
  333. package/src/activities/execute-cursor/cursor-event-recorder.ts +57 -28
  334. package/src/activities/execute-cursor/fetch-interceptor.ts +1 -1
  335. package/src/activities/execute-cursor/http2-interceptor.ts +1 -1
  336. package/src/activities/execute-cursor/prompt-builder.ts +6 -6
  337. package/src/activities/execute-cursor/sdk-warmup.ts +15 -6
  338. package/src/activities/execute-cursor/service-tier.ts +1 -2
  339. package/src/activities/execute-cursor/session-lifecycle.ts +63 -109
  340. package/src/activities/execute-cursor/session-store.ts +187 -0
  341. package/src/activities/execute-cursor/sub-agent-steps.ts +188 -0
  342. package/src/activities/execute-cursor/tool-result.ts +128 -0
  343. package/src/activities/execute-cursor/translator.ts +541 -0
  344. package/src/activities/execute-cursor/turn-boundary.ts +21 -14
  345. package/src/activities/execute-cursor/turn-settle.ts +46 -34
  346. package/src/activities/execute-cursor/turn-setup.ts +5 -5
  347. package/src/activities/execute-cursor/turn-stream.ts +49 -46
  348. package/src/activities/execute-cursor/turn.ts +5 -5
  349. package/src/activities/execute-cursor/usage-pricing.ts +2 -2
  350. package/src/activities/execute-deep-agent/__test-utils__/contract-subject.ts +2 -2
  351. package/src/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.ts +23 -11
  352. package/src/activities/execute-deep-agent/__test-utils__/hitl-script.ts +1 -1
  353. package/src/activities/execute-deep-agent/__test-utils__/scripted-model-module.ts +2 -3
  354. package/src/activities/execute-deep-agent/__test-utils__/scripted-model.ts +25 -4
  355. package/src/activities/execute-deep-agent/__test-utils__/v3-event-fixtures.ts +25 -11
  356. package/src/activities/execute-deep-agent/__tests__/adapter-graph-is-sdk-free.test.ts +1 -1
  357. package/src/activities/execute-deep-agent/__tests__/adapter-is-temporal-free.test.ts +1 -1
  358. package/src/activities/execute-deep-agent/__tests__/approval-file-change.test.ts +6 -17
  359. package/src/activities/execute-deep-agent/__tests__/hermetic/file-review-capture.test.ts +25 -8
  360. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve-all-lease.turn1.status.json +2 -7
  361. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve-all-lease.turn2.status.json +4 -14
  362. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/approve.turn2.status.json +1 -5
  363. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/file-review-capture.status.json +4 -7
  364. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/gate.turn1.status.json +1 -5
  365. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn1.status.json +2 -9
  366. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn2.status.json +2 -9
  367. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.after-tool.status.json +1 -4
  368. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/pause.loop.mid-tool.status.json +1 -4
  369. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/platform-stop.status.json +1 -4
  370. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/recursion-limit.persisted.status.json +109 -76
  371. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/reject.turn2.status.json +1 -5
  372. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sequential-gates.turn2.status.json +2 -10
  373. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sequential-gates.turn3.status.json +2 -10
  374. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/skip.turn2.status.json +1 -5
  375. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/sub-agent-delegation.status.json +3 -6
  376. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/tool-call.status.json +1 -4
  377. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/worker-shutdown.status.json +1 -4
  378. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/write-todos.status.json +92 -0
  379. package/src/activities/execute-deep-agent/__tests__/hermetic/harness-contract.test.ts +3 -3
  380. package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-approve-all-lease.test.ts +9 -5
  381. package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-round-trips.test.ts +3 -3
  382. package/src/activities/execute-deep-agent/__tests__/hermetic/hitl-sequential-gates.test.ts +3 -3
  383. package/src/activities/execute-deep-agent/__tests__/hermetic/inline-artifact-across-gate.test.ts +7 -6
  384. package/src/activities/execute-deep-agent/__tests__/hermetic/pause-vs-shutdown.test.ts +10 -11
  385. package/src/activities/execute-deep-agent/__tests__/hermetic/plain-turn.test.ts +4 -4
  386. package/src/activities/execute-deep-agent/__tests__/hermetic/platform-stop.test.ts +9 -8
  387. package/src/activities/execute-deep-agent/__tests__/hermetic/recursion-limit.test.ts +21 -13
  388. package/src/activities/execute-deep-agent/__tests__/hermetic/resolution-error.test.ts +2 -2
  389. package/src/activities/execute-deep-agent/__tests__/hermetic/structured-output.test.ts +7 -7
  390. package/src/activities/execute-deep-agent/__tests__/hermetic/sub-agent-delegation.test.ts +28 -12
  391. package/src/activities/execute-deep-agent/__tests__/hermetic/tool-call.test.ts +21 -21
  392. package/src/activities/execute-deep-agent/__tests__/hermetic/workspace-lock-timeout.test.ts +5 -5
  393. package/src/activities/execute-deep-agent/__tests__/hermetic/write-todos.test.ts +160 -0
  394. package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +35 -30
  395. package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +3 -4
  396. package/src/activities/execute-deep-agent/__tests__/prompt-goldens.test.ts +12 -10
  397. package/src/activities/execute-deep-agent/__tests__/scripted-model.test.ts +13 -3
  398. package/src/activities/execute-deep-agent/__tests__/streaming-side-effects.test.ts +26 -18
  399. package/src/activities/execute-deep-agent/__tests__/subagent-wiring.test.ts +1 -1
  400. package/src/activities/execute-deep-agent/__tests__/{subagent-tracker.test.ts → translator-subagents.test.ts} +76 -57
  401. package/src/activities/execute-deep-agent/__tests__/{v3-status-builder.test.ts → translator-through-builder.test.ts} +213 -299
  402. package/src/activities/execute-deep-agent/__tests__/translator.test.ts +505 -0
  403. package/src/activities/execute-deep-agent/__tests__/turn-stream.test.ts +11 -29
  404. package/src/activities/execute-deep-agent/adapter.ts +1 -1
  405. package/src/activities/execute-deep-agent/approval-file-change.ts +20 -22
  406. package/src/activities/execute-deep-agent/deep-agent-capabilities.ts +2 -2
  407. package/src/activities/execute-deep-agent/hitl.ts +2 -2
  408. package/src/activities/execute-deep-agent/inline-publisher.ts +16 -5
  409. package/src/activities/execute-deep-agent/prompt-builder.ts +6 -7
  410. package/src/activities/execute-deep-agent/streaming-side-effects.ts +22 -31
  411. package/src/activities/execute-deep-agent/subagent-transformer.ts +3 -3
  412. package/src/activities/execute-deep-agent/translator.ts +463 -0
  413. package/src/activities/execute-deep-agent/turn-settle.ts +35 -43
  414. package/src/activities/execute-deep-agent/turn-setup.ts +8 -8
  415. package/src/activities/execute-deep-agent/turn-stream.ts +53 -51
  416. package/src/activities/execute-deep-agent/turn.ts +3 -3
  417. package/src/config.ts +2 -2
  418. package/src/harness/README.md +335 -0
  419. package/src/harness/__tests__/approval-decisions.test.ts +2 -2
  420. package/src/harness/__tests__/capture.test.ts +3 -3
  421. package/src/harness/__tests__/import-direction.test.ts +3 -2
  422. package/src/harness/__tests__/mount-skills.test.ts +4 -1
  423. package/src/harness/__tests__/readme-index.test.ts +339 -0
  424. package/src/harness/__tests__/run-turn.test.ts +131 -6
  425. package/src/harness/__tests__/transcript-is-engine-free.test.ts +83 -0
  426. package/src/harness/__tests__/transcript-writers.test.ts +191 -0
  427. package/src/harness/__tests__/turn-attachments-vision.test.ts +5 -2
  428. package/src/harness/__tests__/turn-context.test.ts +5 -5
  429. package/src/harness/approval-decisions.ts +1 -1
  430. package/src/harness/capabilities.ts +21 -11
  431. package/src/harness/capture.ts +4 -4
  432. package/src/harness/persist-chokepoint.ts +3 -3
  433. package/src/harness/registry.ts +2 -2
  434. package/src/harness/run-turn.ts +33 -9
  435. package/src/harness/stop-controller.ts +1 -1
  436. package/src/harness/terminal-table.ts +7 -7
  437. package/src/harness/transcript/__tests__/builder.test.ts +975 -0
  438. package/src/harness/transcript/__tests__/state.test.ts +143 -0
  439. package/src/harness/transcript/builder.ts +755 -0
  440. package/src/harness/transcript/events.ts +262 -0
  441. package/src/harness/transcript/state.ts +167 -0
  442. package/src/harness/turn-context.ts +61 -46
  443. package/src/harness/types.ts +64 -22
  444. package/src/harness/usage-accumulator.ts +2 -2
  445. package/src/harness-adapters.ts +5 -4
  446. package/src/middleware/__tests__/cost-advisory.test.ts +2 -2
  447. package/src/middleware/approval-gate.ts +7 -74
  448. package/src/middleware/cost-advisory.ts +3 -3
  449. package/src/middleware/index.ts +1 -1
  450. package/src/runner-manager.ts +1 -1
  451. package/src/shared/__tests__/approval-policy.test.ts +45 -0
  452. package/src/shared/__tests__/args-preview.test.ts +40 -20
  453. package/src/shared/__tests__/attachment-naming.test.ts +1 -1
  454. package/src/shared/__tests__/attachment-resolver.test.ts +5 -5
  455. package/src/shared/__tests__/attachment-zip.test.ts +1 -1
  456. package/src/shared/__tests__/blueprint-resolver.test.ts +1 -1
  457. package/src/shared/__tests__/cost-guard.test.ts +1 -1
  458. package/src/shared/__tests__/exact-apply.test.ts +2 -1
  459. package/src/shared/__tests__/persist-decision.test.ts +19 -33
  460. package/src/shared/__tests__/prompt-sections.test.ts +1 -1
  461. package/src/shared/__tests__/stamp-flowed-rows.test.ts +1 -1
  462. package/src/shared/__tests__/status-offload.test.ts +1 -1
  463. package/src/shared/__tests__/streaming-scheduler.test.ts +8 -9
  464. package/src/shared/__tests__/todos.test.ts +1 -1
  465. package/src/shared/__tests__/tool-row.test.ts +1 -1
  466. package/src/shared/approval-policy.ts +95 -0
  467. package/src/shared/args-preview.ts +51 -42
  468. package/src/shared/attachment-resolver.ts +4 -4
  469. package/src/shared/attachment-vision.ts +2 -1
  470. package/src/shared/attachment-zip.ts +2 -2
  471. package/src/shared/cost-guard.ts +2 -2
  472. package/src/shared/exact-apply.ts +1 -1
  473. package/src/shared/execution-context.ts +2 -2
  474. package/src/shared/extract-structured-output.ts +2 -2
  475. package/src/shared/filereview/__tests__/capture.test.ts +9 -5
  476. package/src/shared/filereview/__tests__/git-substrate.test.ts +4 -1
  477. package/src/shared/filereview/__tests__/proxy-reconcile.test.ts +3 -3
  478. package/src/shared/filereview/cas-touched.ts +2 -2
  479. package/src/shared/heartbeat.ts +1 -1
  480. package/src/shared/llm-backend.ts +0 -4
  481. package/src/shared/model-error.ts +1 -2
  482. package/src/shared/persist-decision.ts +19 -28
  483. package/src/shared/prompt-sections.ts +4 -4
  484. package/src/shared/skill-resolver.ts +3 -3
  485. package/src/shared/status-offload.ts +2 -2
  486. package/src/shared/streaming-scheduler.ts +8 -13
  487. package/src/shared/subagent-rows.ts +2 -2
  488. package/src/shared/todos.ts +3 -3
  489. package/src/shared/tool-row.ts +38 -2
  490. package/src/shared/worker-shutdown.ts +1 -1
  491. package/src/shared/workspace/__tests__/git-source.test.ts +3 -3
  492. package/src/shared/workspace/__tests__/provisioner.test.ts +5 -5
  493. package/src/shared/workspace/__tests__/session-provision.test.ts +2 -2
  494. package/src/shared/workspace/__tests__/writeback-coordinator.integration.test.ts +8 -9
  495. package/src/shared/workspace/__tests__/writeback-coordinator.test.ts +25 -25
  496. package/src/shared/workspace/provisioner.ts +1 -1
  497. package/src/shared/workspace/session-provision.ts +1 -1
  498. package/src/shared/workspace/sources/empty.ts +2 -2
  499. package/src/shared/workspace/sources/git.ts +3 -4
  500. package/src/shared/workspace/sources/local-path.ts +5 -6
  501. package/src/shared/workspace/stigmer-link.ts +1 -1
  502. package/src/shared/workspace/types.ts +2 -5
  503. package/src/shared/workspace/writeback-coordinator.ts +23 -12
  504. package/dist/activities/execute-cursor/delta-enricher.d.ts +0 -87
  505. package/dist/activities/execute-cursor/delta-enricher.js +0 -265
  506. package/dist/activities/execute-cursor/delta-enricher.js.map +0 -1
  507. package/dist/activities/execute-cursor/message-translator.js +0 -2040
  508. package/dist/activities/execute-cursor/message-translator.js.map +0 -1
  509. package/dist/activities/execute-cursor/todo-tracker.d.ts +0 -40
  510. package/dist/activities/execute-cursor/todo-tracker.js +0 -80
  511. package/dist/activities/execute-cursor/todo-tracker.js.map +0 -1
  512. package/dist/activities/execute-deep-agent/execution-state.d.ts +0 -54
  513. package/dist/activities/execute-deep-agent/execution-state.js +0 -68
  514. package/dist/activities/execute-deep-agent/execution-state.js.map +0 -1
  515. package/dist/activities/execute-deep-agent/status-builder-shared.d.ts +0 -65
  516. package/dist/activities/execute-deep-agent/status-builder-shared.js +0 -90
  517. package/dist/activities/execute-deep-agent/status-builder-shared.js.map +0 -1
  518. package/dist/activities/execute-deep-agent/subagent-tracker.d.ts +0 -113
  519. package/dist/activities/execute-deep-agent/subagent-tracker.js +0 -400
  520. package/dist/activities/execute-deep-agent/subagent-tracker.js.map +0 -1
  521. package/dist/activities/execute-deep-agent/v3-events.d.ts +0 -102
  522. package/dist/activities/execute-deep-agent/v3-events.js +0 -35
  523. package/dist/activities/execute-deep-agent/v3-events.js.map +0 -1
  524. package/dist/activities/execute-deep-agent/v3-protocol-normalizer.d.ts +0 -15
  525. package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js +0 -235
  526. package/dist/activities/execute-deep-agent/v3-protocol-normalizer.js.map +0 -1
  527. package/dist/activities/execute-deep-agent/v3-status-builder.d.ts +0 -111
  528. package/dist/activities/execute-deep-agent/v3-status-builder.js +0 -457
  529. package/dist/activities/execute-deep-agent/v3-status-builder.js.map +0 -1
  530. package/dist/shared/execution-status-writer.d.ts +0 -31
  531. package/dist/shared/execution-status-writer.js +0 -43
  532. package/dist/shared/execution-status-writer.js.map +0 -1
  533. package/src/activities/execute-cursor/__tests__/delta-enricher.test.ts +0 -310
  534. package/src/activities/execute-cursor/__tests__/message-translator.test.ts +0 -1033
  535. package/src/activities/execute-cursor/__tests__/todo-tracker.test.ts +0 -498
  536. package/src/activities/execute-cursor/delta-enricher.ts +0 -307
  537. package/src/activities/execute-cursor/message-translator.ts +0 -2319
  538. package/src/activities/execute-cursor/todo-tracker.ts +0 -91
  539. package/src/activities/execute-deep-agent/__tests__/execution-state-extended.test.ts +0 -148
  540. package/src/activities/execute-deep-agent/__tests__/execution-state.test.ts +0 -154
  541. package/src/activities/execute-deep-agent/__tests__/status-builder-shared.test.ts +0 -47
  542. package/src/activities/execute-deep-agent/__tests__/v3-protocol-normalizer.test.ts +0 -324
  543. package/src/activities/execute-deep-agent/execution-state.ts +0 -78
  544. package/src/activities/execute-deep-agent/status-builder-shared.ts +0 -142
  545. package/src/activities/execute-deep-agent/subagent-tracker.ts +0 -479
  546. package/src/activities/execute-deep-agent/v3-events.ts +0 -153
  547. package/src/activities/execute-deep-agent/v3-protocol-normalizer.ts +0 -264
  548. package/src/activities/execute-deep-agent/v3-status-builder.ts +0 -565
  549. package/src/shared/execution-status-writer.ts +0 -56
@@ -25,14 +25,14 @@
25
25
  * knows are reported through the sink exactly as the orchestrator reported
26
26
  * them (the resolution labels are the runtime's).
27
27
  *
28
- * One root for everything (Q-S3-8): the deepagents backend, the CAS
28
+ * One root for everything: the deepagents backend, the CAS
29
29
  * observer, the gate's path normalization and the publisher are all rooted
30
30
  * at `workspace.primaryDir` — the same tree the runtime locks, links and
31
31
  * captures. For zero or one workspace entry this is byte-identical to the
32
32
  * orchestrator's `workspaceBackend.rootDir`.
33
33
  *
34
34
  * Moved from `setup.ts` `performSetup` (the LangGraph half; the resolution
35
- * half is the runtime's twelve phases) at S3 M2a; the step bodies are the
35
+ * half is the runtime's twelve phases) in #1096; the step bodies are the
36
36
  * orchestrator's, verbatim where nothing changed.
37
37
  */
38
38
  import type { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
@@ -52,7 +52,7 @@ import { CasCaptureObserver } from "./cas-capture-observer.js";
52
52
  * (`execute-cursor/turn-setup.ts` `CursorAdapterConfig` is the idiom): a
53
53
  * whole `Config` satisfies it, a test constructs these fields and nothing
54
54
  * else. Smaller than the orchestrator's reach — the synthesized attachments'
55
- * endpoints it read are the runtime's now (S3 M2a, F-M2a-10).
55
+ * endpoints it read are the runtime's now (since #1096).
56
56
  */
57
57
  export type DeepAgentAdapterConfig = Pick<Config, "checkpointerType" | "checkpointerProxyEndpoint" | "stigmerToken" | "proxyEndpoint" | "mode">;
58
58
  /** The deepagents graph as this module holds it; deepagents exports no stable type for the compiled agent. */
@@ -109,8 +109,8 @@ export type DeepAgentGraphInput = {
109
109
  * spec named none — the one reader of `spec.executionConfig.modelName`, which
110
110
  * the Cursor adapter reads too), or the registry's default for `"default"`.
111
111
  * The same reading the runtime's attachment phase made for the vision budget,
112
- * so the model that sees the images is the model that runs. (Until S3 M5 this
113
- * read the spec field beside the runtime's resolved copy; F-M3-P7.)
112
+ * so the model that sees the images is the model that runs. (Until #1096 this
113
+ * read the spec field beside the runtime's resolved copy.)
114
114
  */
115
115
  export declare function resolveModelName(input: TurnInput): Promise<string>;
116
116
  /**
@@ -122,7 +122,7 @@ export declare function resolveModelName(input: TurnInput): Promise<string>;
122
122
  export declare function openCheckpointer(input: TurnInput, sink: TurnSink, config: DeepAgentAdapterConfig): Promise<BaseCheckpointSaver>;
123
123
  /**
124
124
  * The workspace as the engine sees it, rooted at the runtime's primary tree
125
- * (Q-S3-8). The platform dir the shared provision ensured rides along so
125
+ * (the one root). The platform dir the shared provision ensured rides along so
126
126
  * the backend routes `.stigmer/…` reads to it.
127
127
  *
128
128
  * CAS capture (design docs 08/11/12): the single per-turn observer owns the
@@ -143,7 +143,7 @@ export declare function buildDeepAgentWorkspace(input: TurnInput): DeepAgentWork
143
143
  * refuses an empty config, which is what the orchestrator's MCP gate
144
144
  * (`mcp-gate.ts`) guarded against beside its channel-only reason; the
145
145
  * runtime resolves unconditionally, so the one remaining question is
146
- * "anything to connect?" (S3 M2a, F-M2a-17).
146
+ * "anything to connect?" (since #1096).
147
147
  */
148
148
  export declare function connectTools(input: TurnInput, sink: TurnSink): Promise<DeepAgentTools>;
149
149
  /**
@@ -186,7 +186,7 @@ export declare function composeSystemPrompt(input: TurnInput, recalledMemories:
186
186
  * stop on the invoke config and the budget middleware's ~80% advisory, so
187
187
  * the warning and the enforcement can never disagree.
188
188
  *
189
- * Nothing in the middleware stack stops the run (Q-S3-3, landed at S3 M2b):
189
+ * Nothing in the middleware stack stops the run (since #1096):
190
190
  * the runtime's abort is the platform's one stop, and its TERMINATED arm the
191
191
  * one enforcement of `max_cost_usd`; the cost advisory warns the model at
192
192
  * ~80% of the cap the way the budget middleware warns at ~80% of the
@@ -25,14 +25,14 @@
25
25
  * knows are reported through the sink exactly as the orchestrator reported
26
26
  * them (the resolution labels are the runtime's).
27
27
  *
28
- * One root for everything (Q-S3-8): the deepagents backend, the CAS
28
+ * One root for everything: the deepagents backend, the CAS
29
29
  * observer, the gate's path normalization and the publisher are all rooted
30
30
  * at `workspace.primaryDir` — the same tree the runtime locks, links and
31
31
  * captures. For zero or one workspace entry this is byte-identical to the
32
32
  * orchestrator's `workspaceBackend.rootDir`.
33
33
  *
34
34
  * Moved from `setup.ts` `performSetup` (the LangGraph half; the resolution
35
- * half is the runtime's twelve phases) at S3 M2a; the step bodies are the
35
+ * half is the runtime's twelve phases) in #1096; the step bodies are the
36
36
  * orchestrator's, verbatim where nothing changed.
37
37
  */
38
38
  import { createDeepAgent } from "deepagents";
@@ -71,8 +71,8 @@ import { modelHasNativeThinking, transformAndCompileSubagents } from "./subagent
71
71
  * spec named none — the one reader of `spec.executionConfig.modelName`, which
72
72
  * the Cursor adapter reads too), or the registry's default for `"default"`.
73
73
  * The same reading the runtime's attachment phase made for the vision budget,
74
- * so the model that sees the images is the model that runs. (Until S3 M5 this
75
- * read the spec field beside the runtime's resolved copy; F-M3-P7.)
74
+ * so the model that sees the images is the model that runs. (Until #1096 this
75
+ * read the spec field beside the runtime's resolved copy.)
76
76
  */
77
77
  export async function resolveModelName(input) {
78
78
  return input.model.requested === "default" ? await getDefaultModel() : input.model.requested;
@@ -95,7 +95,7 @@ export async function openCheckpointer(input, sink, config) {
95
95
  }
96
96
  /**
97
97
  * The workspace as the engine sees it, rooted at the runtime's primary tree
98
- * (Q-S3-8). The platform dir the shared provision ensured rides along so
98
+ * (the one root). The platform dir the shared provision ensured rides along so
99
99
  * the backend routes `.stigmer/…` reads to it.
100
100
  *
101
101
  * CAS capture (design docs 08/11/12): the single per-turn observer owns the
@@ -129,7 +129,7 @@ export function buildDeepAgentWorkspace(input) {
129
129
  * refuses an empty config, which is what the orchestrator's MCP gate
130
130
  * (`mcp-gate.ts`) guarded against beside its channel-only reason; the
131
131
  * runtime resolves unconditionally, so the one remaining question is
132
- * "anything to connect?" (S3 M2a, F-M2a-17).
132
+ * "anything to connect?" (since #1096).
133
133
  */
134
134
  export async function connectTools(input, sink) {
135
135
  if (input.mcp.servers.length === 0) {
@@ -231,7 +231,7 @@ export function composeSystemPrompt(input, recalledMemories) {
231
231
  * stop on the invoke config and the budget middleware's ~80% advisory, so
232
232
  * the warning and the enforcement can never disagree.
233
233
  *
234
- * Nothing in the middleware stack stops the run (Q-S3-3, landed at S3 M2b):
234
+ * Nothing in the middleware stack stops the run (since #1096):
235
235
  * the runtime's abort is the platform's one stop, and its TERMINATED arm the
236
236
  * one enforcement of `max_cost_usd`; the cost advisory warns the model at
237
237
  * ~80% of the cap the way the budget middleware warns at ~80% of the
@@ -9,7 +9,7 @@
9
9
  * runtime's stall watchdog measures the engine; `reportUsage()` per parent
10
10
  * `message_finish`, priced here at the registry's rates for the model the
11
11
  * turn runs on (`shared/model-pricing.ts`), so the runtime accounts and
12
- * enforces the cost cap and writes `streamingUsage` (Q-M2a-2); `requestPersist()`
12
+ * enforces the cost cap and writes `streamingUsage`; `requestPersist()`
13
13
  * where a discrete change or the streaming cadence says so
14
14
  * (`shared/persist-decision.ts` over the builder's one dirty flag), AWAITED,
15
15
  * so a platform STOP the runtime reads from that write aborts the signal
@@ -19,7 +19,7 @@
19
19
  * this loop never does). An error the aborted run throws is the abort itself
20
20
  * and settles `interrupted`, never `failed`.
21
21
  *
22
- * WHEN the run is aborted (S3 M2a, F-M2a-18): on the arrival of the next
22
+ * WHEN the run is aborted: on the arrival of the next
23
23
  * event — the graph's own step boundary — or after {@link STOP_GRACE_MS} if
24
24
  * no event arrives. A LangGraph run aborted while a step is in flight leaves
25
25
  * `@langchain/core` with an orphaned rejection (`AsyncGeneratorWithSetup`
@@ -34,7 +34,7 @@
34
34
  * here) is forced, and that one orphan is the price of unblocking it — the
35
35
  * contract's bound on settling `interrupted` is what wins.
36
36
  *
37
- * Until S3 M2a this loop (`streaming-v3.ts`) armed its own 120 s stall
37
+ * Until #1096 this loop (`streaming-v3.ts`) armed its own 120 s stall
38
38
  * check, pulsed the Temporal heartbeat every 2 s, read STOP from its own
39
39
  * persist and activated a graceful-stop middleware on it, told a pause from
40
40
  * the activity's cancellation signal, and wrote PAUSED, COMPLETED and
@@ -47,7 +47,7 @@
47
47
  import type { TurnInput, TurnSink } from "../../harness/types.js";
48
48
  import { InlinePublisher } from "./inline-publisher.js";
49
49
  import { type V3ProtocolEvent } from "./v3-event-recorder.js";
50
- import { V3StatusBuilder } from "./v3-status-builder.js";
50
+ import { DeepAgentTranslator } from "./translator.js";
51
51
  import type { DeepAgentEngine, DeepAgentGraphInput, DeepAgentWorkspace } from "./turn-setup.js";
52
52
  /**
53
53
  * The subset of the v3 `GraphRunStream` this loop consumes. Kept structural
@@ -71,14 +71,17 @@ export interface DeepAgentStreamResult {
71
71
  readonly pendingPublishPromises: readonly Promise<void>[];
72
72
  }
73
73
  /**
74
- * The transcript writers of one turn: the builder over `sink.status` and the
75
- * publisher that writes artifacts through it (so a published artifact still
76
- * forces the next persist). Built by the adapter's turn once and shared by
77
- * the stream and the settle; the builder reports usage into the sink, priced
78
- * for the model the turn runs on.
74
+ * This harness's transcript writers for one turn: the translator that turns
75
+ * the engine's events into canonical ones (over the gate's posture, so every
76
+ * tool start carries its attribution and gate answer), and the publisher
77
+ * that registers artifacts on the runtime's builder (`sink.transcript`, so
78
+ * a published artifact still dirties the next persist). The builder itself
79
+ * is the runtime's, one per turn, and is read from the sink where it is
80
+ * needed. Built by the adapter's turn once and shared by the stream and the
81
+ * settle.
79
82
  */
80
83
  export interface DeepAgentTranscript {
81
- readonly builder: V3StatusBuilder;
84
+ readonly translator: DeepAgentTranslator;
82
85
  readonly publisher: InlinePublisher;
83
86
  }
84
87
  export declare function createDeepAgentTranscript(input: TurnInput, sink: TurnSink, engine: DeepAgentEngine, workspace: DeepAgentWorkspace): DeepAgentTranscript;
@@ -9,7 +9,7 @@
9
9
  * runtime's stall watchdog measures the engine; `reportUsage()` per parent
10
10
  * `message_finish`, priced here at the registry's rates for the model the
11
11
  * turn runs on (`shared/model-pricing.ts`), so the runtime accounts and
12
- * enforces the cost cap and writes `streamingUsage` (Q-M2a-2); `requestPersist()`
12
+ * enforces the cost cap and writes `streamingUsage`; `requestPersist()`
13
13
  * where a discrete change or the streaming cadence says so
14
14
  * (`shared/persist-decision.ts` over the builder's one dirty flag), AWAITED,
15
15
  * so a platform STOP the runtime reads from that write aborts the signal
@@ -19,7 +19,7 @@
19
19
  * this loop never does). An error the aborted run throws is the abort itself
20
20
  * and settles `interrupted`, never `failed`.
21
21
  *
22
- * WHEN the run is aborted (S3 M2a, F-M2a-18): on the arrival of the next
22
+ * WHEN the run is aborted: on the arrival of the next
23
23
  * event — the graph's own step boundary — or after {@link STOP_GRACE_MS} if
24
24
  * no event arrives. A LangGraph run aborted while a step is in flight leaves
25
25
  * `@langchain/core` with an orphaned rejection (`AsyncGeneratorWithSetup`
@@ -34,7 +34,7 @@
34
34
  * here) is forced, and that one orphan is the price of unblocking it — the
35
35
  * contract's bound on settling `interrupted` is what wins.
36
36
  *
37
- * Until S3 M2a this loop (`streaming-v3.ts`) armed its own 120 s stall
37
+ * Until #1096 this loop (`streaming-v3.ts`) armed its own 120 s stall
38
38
  * check, pulsed the Temporal heartbeat every 2 s, read STOP from its own
39
39
  * persist and activated a graceful-stop middleware on it, told a pause from
40
40
  * the activity's cancellation signal, and wrote PAUSED, COMPLETED and
@@ -51,8 +51,7 @@ import { TimeoutError, withTimeout } from "../../shared/with-timeout.js";
51
51
  import { InlinePublisher } from "./inline-publisher.js";
52
52
  import { StreamingSideEffects } from "./streaming-side-effects.js";
53
53
  import { createV3EventRecorder } from "./v3-event-recorder.js";
54
- import { normalize } from "./v3-protocol-normalizer.js";
55
- import { V3StatusBuilder } from "./v3-status-builder.js";
54
+ import { DeepAgentTranslator, usageOf } from "./translator.js";
56
55
  /**
57
56
  * How long the loop waits for `run.output` after the stream ended before
58
57
  * proceeding without the final state (the structured response rides it).
@@ -65,41 +64,39 @@ const RUN_OUTPUT_TIMEOUT_MS = 30_000;
65
64
  */
66
65
  const STOP_GRACE_MS = 1_000;
67
66
  export function createDeepAgentTranscript(input, sink, engine, workspace) {
68
- const builder = new V3StatusBuilder(input.executionId, sink.status, {
69
- onUsage: (usage) => {
70
- // LangChain's `input_tokens` already INCLUDES the cache buckets (the
71
- // Anthropic adapter folds them in; the cost advisory reads them the
72
- // same way), so the counts are reported as delivered and the price
73
- // is computed over the disjoint buckets.
74
- const inputTokens = usage.input_tokens ?? 0;
75
- const outputTokens = usage.output_tokens ?? 0;
76
- const cacheReadTokens = usage.input_token_details?.cache_read ?? 0;
77
- const cacheWriteTokens = usage.input_token_details?.cache_creation ?? 0;
78
- const uncachedInput = Math.max(inputTokens - cacheReadTokens - cacheWriteTokens, 0);
79
- sink.reportUsage({
80
- inputTokens,
81
- outputTokens,
82
- cacheReadTokens,
83
- cacheWriteTokens,
84
- estimatedCostUsd: computeTurnCost(engine.pricing, uncachedInput, outputTokens, cacheWriteTokens, cacheReadTokens),
85
- model: engine.modelName,
86
- });
87
- },
88
- });
89
- builder.setApprovalProvider({
90
- policies: engine.gate.policies,
91
- toolServerMap: engine.gate.toolServerMap,
92
- leasedCategories: engine.gate.leasedCategories,
93
- globalBypass: engine.gate.globalBypass,
94
- unattended: engine.gate.unattended,
95
- });
67
+ const translator = new DeepAgentTranslator(engine.gate);
96
68
  const publisher = new InlinePublisher({
97
69
  workspaceBackend: workspace.backend,
98
70
  artifactStorage: input.artifactStorage,
99
- statusWriter: builder,
71
+ artifacts: sink.transcript,
100
72
  executionId: input.executionId,
101
73
  });
102
- return { builder, publisher };
74
+ return { translator, publisher };
75
+ }
76
+ /**
77
+ * Price one `message-finish`'s usage at the engine's rates and report it to
78
+ * the sink, which accounts, enforces the cost cap and writes `streamingUsage`
79
+ * (one writer of the summary). LangChain's `input_tokens` already INCLUDES the cache buckets
80
+ * (the Anthropic adapter folds them in; the cost advisory reads them the same
81
+ * way), so the counts are reported as delivered and the price is computed
82
+ * over the disjoint buckets. A sub-agent on its own model is priced at the
83
+ * parent's rate, as the in-graph cost cap always did (per-sub-agent pricing
84
+ * is #1121).
85
+ */
86
+ function reportUsage(sink, engine, usage) {
87
+ const inputTokens = usage.input_tokens ?? 0;
88
+ const outputTokens = usage.output_tokens ?? 0;
89
+ const cacheReadTokens = usage.input_token_details?.cache_read ?? 0;
90
+ const cacheWriteTokens = usage.input_token_details?.cache_creation ?? 0;
91
+ const uncachedInput = Math.max(inputTokens - cacheReadTokens - cacheWriteTokens, 0);
92
+ sink.reportUsage({
93
+ inputTokens,
94
+ outputTokens,
95
+ cacheReadTokens,
96
+ cacheWriteTokens,
97
+ estimatedCostUsd: computeTurnCost(engine.pricing, uncachedInput, outputTokens, cacheWriteTokens, cacheReadTokens),
98
+ model: engine.modelName,
99
+ });
103
100
  }
104
101
  /**
105
102
  * Start the graph run and consume it to the end, folding every event into
@@ -109,7 +106,8 @@ export function createDeepAgentTranscript(input, sink, engine, workspace) {
109
106
  export async function consumeDeepAgentStream(deps) {
110
107
  const { input, sink, engine, graphInput, transcript } = deps;
111
108
  const { executionId } = input;
112
- const { builder, publisher } = transcript;
109
+ const { translator, publisher } = transcript;
110
+ const builder = sink.transcript;
113
111
  const scheduler = new StreamingUpdateScheduler(loadStreamingConfig());
114
112
  const recorder = createV3EventRecorder(executionId, process.env.V3_EVENT_RECORD_DIR);
115
113
  const sideEffects = new StreamingSideEffects({ inlinePublisher: publisher });
@@ -152,18 +150,23 @@ export async function consumeDeepAgentStream(deps) {
152
150
  return interrupted();
153
151
  recorder?.record(event, eventsProcessed);
154
152
  let detail;
155
- for (const normalized of normalize(event)) {
156
- builder.processEvent(normalized);
153
+ for (const normalized of translator.translate(event)) {
154
+ builder.apply(normalized);
155
+ sideEffects.onEvent(normalized);
157
156
  if (normalized.kind === "tool_started")
158
157
  detail = normalized.name;
159
158
  }
160
- sideEffects.onProtocolEvent(event);
159
+ const usage = usageOf(event);
160
+ if (usage)
161
+ reportUsage(sink, engine, usage);
161
162
  eventsProcessed++;
162
163
  sink.recordActivity(detail);
163
- const persist = shouldPersistStreamingStatus({ deltaEnricherDirty: false, todosDirty: false, contentDirty: builder.forceNextUpdate }, scheduler, eventsProcessed);
164
+ const persist = shouldPersistStreamingStatus(builder.dirty, scheduler, eventsProcessed);
164
165
  if (!persist)
165
166
  continue;
166
- builder.clearForceFlag();
167
+ // Cleared as the write is requested, not after it lands: a change
168
+ // that folds while the write is in flight must dirty the next one.
169
+ builder.markPersisted();
167
170
  // The runtime attaches the mid-run file-change progress on this write
168
171
  // (the chokepoint's step 2), as it does on every write. Awaited so a platform STOP the runtime reads from this write has
169
172
  // aborted the signal by the time the next event arrives — where the
@@ -1 +1 @@
1
- {"version":3,"file":"turn-stream.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/turn-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAwB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,SAAS,EAA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AC;YAChC,OAAO,CAAC,IAAI,CAAC,2BAA2B,WAAW,MAAM,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC;YACzG,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,2BAA2B,WAAW,2BAA2B,GAAG,EAAE,CAAC,CAAC;QACrF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"turn-stream.js","sourceRoot":"","sources":["../../../src/activities/execute-deep-agent/turn-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAwB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAuB,MAAM,iBAAiB,CAAC;AAWpF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAErC;;;;GAIG;AACH,MAAM,aAAa,GAAG,KAAK,CAAC;AAiC5B,MAAM,UAAU,yBAAyB,CACvC,KAAgB,EAChB,IAAc,EACd,MAAuB,EACvB,SAA6B;IAE7B,MAAM,UAAU,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC;QACpC,gBAAgB,EAAE,SAAS,CAAC,OAAO;QACnC,eAAe,EAAE,KAAK,CAA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IAC1B,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,UAAU,gBAAgB,CAAC,GAAkB,EAAE,WAAmB;IACrE,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,WAAW,CAClC,qBAAqB,EACrB,qCAAqC,qBAAqB,IAAI,EAC9D,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CACjB,CAAC;QACF,MAAM,MAAM,GAAG,UAAqC,CAAC;QACrD,OAAO,CAAC,GAAG,CACT,2BAA2B,WAAW,0BAA0B;YAChE,UAAU,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,MAAM,EAAE,kBAAkB,KAAK,SAAS,EAAE,CACrH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,YAAY,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC,2BAA2B,WAAW,MAAM,GAAG,CAAC,OAAO,mCAAmC,CAAC,CAAC;YACzG,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,2BAA2B,WAAW,2BAA2B,GAAG,EAAE,CAAC,CAAC;QACrF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -24,7 +24,7 @@
24
24
  * other exception — a provider error unwrapped from LangChain's middleware
25
25
  * wrapper, an MCP connect failure, an empty stream — is `failed` on the
26
26
  * `internal` surface with `describeExecutionError`'s sentence as
27
- * `status.error` whole (Q-M2a-9). Never branches on why `stopSignal`
27
+ * `status.error` whole. Never branches on why `stopSignal`
28
28
  * aborted, never writes a phase or a terminal copy, never imports
29
29
  * `@temporalio/*` (`__tests__/adapter-is-temporal-free.test.ts`).
30
30
  *
@@ -33,9 +33,9 @@
33
33
  * are connected and closed per turn. Both are closed on EVERY exit path in
34
34
  * the `finally`, before the runtime removes the link and releases the lock.
35
35
  *
36
- * Extracted from `index.ts` `createDeepAgentActivities` at S3 M2a; the
36
+ * Extracted from `index.ts` `createDeepAgentActivities` in #1096; the
37
37
  * hermetic goldens under `__tests__/hermetic/` pin the result byte for
38
- * byte, with the ruled alignments quoted in their headers.
38
+ * byte, with that move's deliberate alignments quoted in their headers.
39
39
  */
40
40
  import type { TurnInput, TurnOutcome, TurnSink } from "../../harness/types.js";
41
41
  import { type DeepAgentAdapterConfig } from "./turn-setup.js";
@@ -24,7 +24,7 @@
24
24
  * other exception — a provider error unwrapped from LangChain's middleware
25
25
  * wrapper, an MCP connect failure, an empty stream — is `failed` on the
26
26
  * `internal` surface with `describeExecutionError`'s sentence as
27
- * `status.error` whole (Q-M2a-9). Never branches on why `stopSignal`
27
+ * `status.error` whole. Never branches on why `stopSignal`
28
28
  * aborted, never writes a phase or a terminal copy, never imports
29
29
  * `@temporalio/*` (`__tests__/adapter-is-temporal-free.test.ts`).
30
30
  *
@@ -33,9 +33,9 @@
33
33
  * are connected and closed per turn. Both are closed on EVERY exit path in
34
34
  * the `finally`, before the runtime removes the link and releases the lock.
35
35
  *
36
- * Extracted from `index.ts` `createDeepAgentActivities` at S3 M2a; the
36
+ * Extracted from `index.ts` `createDeepAgentActivities` in #1096; the
37
37
  * hermetic goldens under `__tests__/hermetic/` pin the result byte for
38
- * byte, with the ruled alignments quoted in their headers.
38
+ * byte, with that move's deliberate alignments quoted in their headers.
39
39
  */
40
40
  import { tryInferProvider } from "../../shared/llm-proxy.js";
41
41
  import { describeExecutionError } from "../../shared/model-error.js";
package/dist/config.d.ts CHANGED
@@ -142,8 +142,8 @@ export interface Config {
142
142
  * provides the proxy credential and mints no other, so
143
143
  * `proxyTokenRef === stigmerTokenRef`), the manager binds the minted runner
144
144
  * token (`proxyTokenRef === stigmerRunnerTokenRef`). Reading either sibling
145
- * directly would send the wrong credential from one of the two roots
146
- * (Q-S2-7). Required whenever `proxyEndpoint` is set; the Cursor adapter's
145
+ * directly would send the wrong credential from one of the two roots.
146
+ * Required whenever `proxyEndpoint` is set; the Cursor adapter's
147
147
  * boot refuses a proxy without it.
148
148
  */
149
149
  readonly proxyTokenRef?: {
@@ -34,7 +34,7 @@
34
34
  *
35
35
  * This is the contract as of stigmer#197: REJECT denies the tool and the run
36
36
  * CONTINUES; it never fails the execution. The native harness proved it
37
- * (`hitl.ts` `reconcileNonExecutingDecisions`, moved here at S3 M1) and the
37
+ * (`hitl.ts` `reconcileNonExecutingDecisions`, moved here in #1096) and the
38
38
  * conformance suite (`agentexecution-approval.conformance.test.ts`) is its
39
39
  * arbiter for both harnesses.
40
40
  */
@@ -34,7 +34,7 @@
34
34
  *
35
35
  * This is the contract as of stigmer#197: REJECT denies the tool and the run
36
36
  * CONTINUES; it never fails the execution. The native harness proved it
37
- * (`hitl.ts` `reconcileNonExecutingDecisions`, moved here at S3 M1) and the
37
+ * (`hitl.ts` `reconcileNonExecutingDecisions`, moved here in #1096) and the
38
38
  * conformance suite (`agentexecution-approval.conformance.test.ts`) is its
39
39
  * arbiter for both harnesses.
40
40
  */
@@ -15,8 +15,8 @@
15
15
  * the Cursor builder renders the session's first user message), and the
16
16
  * shared prompt glue (`shared/prompt-sections.ts`) is written so that
17
17
  * placement stays each adapter's. The runtime would branch on it only if it
18
- * ever composed prompts itself — the S4/S5 unification question, not a phase
19
- * that exists (S3 M5, Q-M5-6).
18
+ * ever composed prompts itself — an open unification question (#1135), not a
19
+ * phase that exists.
20
20
  *
21
21
  * The matrix the contract was designed against (2026-09; Claude and Codex are
22
22
  * the surveyed SDKs, not built harnesses):
@@ -51,12 +51,22 @@ import type { VisionProfile } from "../shared/attachment-vision.js";
51
51
  * - `deny-and-retry`: an out-of-process hook denies the tool, the adapter
52
52
  * records the denial, cancels the run, and re-runs with grants on the next
53
53
  * invocation.
54
- * - `callback`: an in-process callback decides per tool; the runtime still
55
- * returns `awaiting_approval` and reinvokes, so the adapter answers the
56
- * callback with "deny, stop" and resumes with the decisions.
57
- * - `none`: the engine offers no gate; the runtime confines it to
58
- * capture-only work (a read-only sandbox) and gated actions never reach
59
- * the engine.
54
+ * - `callback`: an in-process callback decides per tool. The intended shape
55
+ * is the `interrupt` one seen from the runtime: the turn still ends
56
+ * `awaiting_approval` and reinvokes, and the adapter answers the callback
57
+ * with "deny, stop" and resumes with the decisions.
58
+ * - `none`: the engine offers no gate. The intended shape is that the
59
+ * runtime confines such a harness to capture-only work (a read-only
60
+ * sandbox) so a gated action never reaches the engine.
61
+ *
62
+ * Two of the four are built and two are reserved. `interrupt` (native) and
63
+ * `deny-and-retry` (Cursor) each have a real adapter and the contract kit
64
+ * runs under both. `callback` and `none` come from the 2026-09 survey of the
65
+ * Claude and Codex SDKs: the type carries them so an adapter can declare
66
+ * them, but no adapter does, and the runtime reads `pausePrimitive` in one
67
+ * place only (`turn-context.ts` `regeneratesApprovedWrites`, which returns
68
+ * false for `none`). The capture-only confinement for `none` is design
69
+ * still to be done before the first gate-less harness lands.
60
70
  */
61
71
  export type PausePrimitive = "interrupt" | "deny-and-retry" | "callback" | "none";
62
72
  /**
@@ -74,9 +84,9 @@ export type StateIdSource = "deterministic" | "engine-minted";
74
84
  * workspace-relative paths the harness writes into the repo that a turn's
75
85
  * diff must never show (Cursor's transient `.cursor/hooks.json`). Declared
76
86
  * once per adapter, read by `harness/capture.ts` (the pin, the progress
77
- * slice, the candidate) and `turn-context.ts` (the reconcile). Ruled Q-M2-6
78
- * as an argument, homed here at S2 M3; the capture joined the reconcile as a
79
- * reader at S3 M4.
87
+ * slice, the candidate) and `turn-context.ts` (the reconcile). First passed
88
+ * as an argument, then homed here as a capability (#1070); the capture joined
89
+ * the reconcile as a reader in #1096.
80
90
  */
81
91
  export interface FileReviewIdentity {
82
92
  readonly harnessId: string;
@@ -15,8 +15,8 @@
15
15
  * the Cursor builder renders the session's first user message), and the
16
16
  * shared prompt glue (`shared/prompt-sections.ts`) is written so that
17
17
  * placement stays each adapter's. The runtime would branch on it only if it
18
- * ever composed prompts itself — the S4/S5 unification question, not a phase
19
- * that exists (S3 M5, Q-M5-6).
18
+ * ever composed prompts itself — an open unification question (#1135), not a
19
+ * phase that exists.
20
20
  *
21
21
  * The matrix the contract was designed against (2026-09; Claude and Codex are
22
22
  * the surveyed SDKs, not built harnesses):
@@ -21,7 +21,7 @@
21
21
  * that the runtime cannot read is what its engine observed touching
22
22
  * CAS-owned paths (`TurnSink.bindCasObservations`).
23
23
  *
24
- * Until S3 M4 both adapters carried this whole act (Cursor in its
24
+ * Until #1096 both adapters carried this whole act (Cursor in its
25
25
  * `turn-boundary.ts` between the stream and `run.wait()`, the deep-agent in
26
26
  * its `turn-settle.ts`), each with its own evidence source and its own
27
27
  * scoping rules for the provenance and the stamp. The two rules here are the
@@ -33,7 +33,7 @@
33
33
  * position, because on BOTH engines an approved command executes on the
34
34
  * row the runtime seeded for it (the deep-agent's builder and Cursor's
35
35
  * translator both reconcile the re-attempt onto the seeded WAITING row),
36
- * at its prior position; a positional scope misses it (F-M4-P3: Cursor's
36
+ * at its prior position; a positional scope misses it (Cursor's
37
37
  * did, so its auto-keep never qualified a gated-then-approved command).
38
38
  * "Executed" is a COMPLETED row. "Consented" is the row's own
39
39
  * server-authored `approval_action` — the seeded row keeps its id and its
@@ -50,10 +50,10 @@
50
50
  * The substrate and the ledger authoring (`shared/filereview/capture.ts`,
51
51
  * `cas-touched.ts`, `progress.ts`); the resume-time reconcile
52
52
  * (`turn-context.ts` `reconcileReinvocation`, already the runtime's since
53
- * S2); the outcome matrix that turns "a review is pending" into a phase
53
+ * #1070); the outcome matrix that turns "a review is pending" into a phase
54
54
  * (`run-turn.ts`, through `terminal-table.ts` `awaitingReviewArm`).
55
55
  *
56
- * TWO GAPS THIS MODULE DOES NOT CLOSE (recorded for S5, S3 M4 F-M4-P-gaps)
56
+ * TWO GAPS THIS MODULE DOES NOT CLOSE (recorded as #1115)
57
57
  * ----------------------------------------------------------------------
58
58
  * A turn that ends `interrupted` is not captured (a stop fired; the tree may
59
59
  * be mid-edit). So a platform STOP returns COMPLETED with unreviewed edits
@@ -21,7 +21,7 @@
21
21
  * that the runtime cannot read is what its engine observed touching
22
22
  * CAS-owned paths (`TurnSink.bindCasObservations`).
23
23
  *
24
- * Until S3 M4 both adapters carried this whole act (Cursor in its
24
+ * Until #1096 both adapters carried this whole act (Cursor in its
25
25
  * `turn-boundary.ts` between the stream and `run.wait()`, the deep-agent in
26
26
  * its `turn-settle.ts`), each with its own evidence source and its own
27
27
  * scoping rules for the provenance and the stamp. The two rules here are the
@@ -33,7 +33,7 @@
33
33
  * position, because on BOTH engines an approved command executes on the
34
34
  * row the runtime seeded for it (the deep-agent's builder and Cursor's
35
35
  * translator both reconcile the re-attempt onto the seeded WAITING row),
36
- * at its prior position; a positional scope misses it (F-M4-P3: Cursor's
36
+ * at its prior position; a positional scope misses it (Cursor's
37
37
  * did, so its auto-keep never qualified a gated-then-approved command).
38
38
  * "Executed" is a COMPLETED row. "Consented" is the row's own
39
39
  * server-authored `approval_action` — the seeded row keeps its id and its
@@ -50,10 +50,10 @@
50
50
  * The substrate and the ledger authoring (`shared/filereview/capture.ts`,
51
51
  * `cas-touched.ts`, `progress.ts`); the resume-time reconcile
52
52
  * (`turn-context.ts` `reconcileReinvocation`, already the runtime's since
53
- * S2); the outcome matrix that turns "a review is pending" into a phase
53
+ * #1070); the outcome matrix that turns "a review is pending" into a phase
54
54
  * (`run-turn.ts`, through `terminal-table.ts` `awaitingReviewArm`).
55
55
  *
56
- * TWO GAPS THIS MODULE DOES NOT CLOSE (recorded for S5, S3 M4 F-M4-P-gaps)
56
+ * TWO GAPS THIS MODULE DOES NOT CLOSE (recorded as #1115)
57
57
  * ----------------------------------------------------------------------
58
58
  * A turn that ends `interrupted` is not captured (a stop fired; the tree may
59
59
  * be mid-edit). So a platform STOP returns COMPLETED with unreviewed edits
@@ -15,7 +15,7 @@
15
15
  * the tree is read at most once per floor interval and only re-attached
16
16
  * when it moved (`shared/filereview/progress.ts`), so a write that
17
17
  * changed nothing on disk carries the snapshot it already had. Before
18
- * S3 M4 each adapter's stream loop did this before its own persists; the
18
+ * #1096 each adapter's stream loop did this before its own persists; the
19
19
  * runtime owns the capture now, so the display field it derives is
20
20
  * refreshed where every other runtime-owned field is — here.
21
21
  * 3. `streaming_usage` is refreshed from the accumulator when it has turns,
@@ -23,7 +23,7 @@
23
23
  * 4. `persistStatus` (`shared/status.ts`): tool-output offload, the
24
24
  * aggregate size cap, transient retry, oversize recovery. Never rejects.
25
25
  * 5. A Temporal heartbeat, so a long streaming turn's liveness is proven by
26
- * the writes it makes (Q-S2-10).
26
+ * the writes it makes.
27
27
  * 6. The control plane's answer: STOP becomes the runtime's platform-stop
28
28
  * cause on the stop controller, which aborts the adapter's signal.
29
29
  *
@@ -34,7 +34,7 @@
34
34
  * and resolves when that follow-up has. The promise it returns therefore
35
35
  * always means "the state as of my request is on the control plane", which
36
36
  * is what lets the Cursor loop await it and see a STOP before it pulls the
37
- * next event, exactly as its own inline persist did (Q-M3-2).
37
+ * next event, exactly as its own inline persist did.
38
38
  *
39
39
  * The runtime's terminal writes use the same path (`write()`), so the
40
40
  * secret backstop and the usage summary ride the final status too, as they
@@ -15,7 +15,7 @@
15
15
  * the tree is read at most once per floor interval and only re-attached
16
16
  * when it moved (`shared/filereview/progress.ts`), so a write that
17
17
  * changed nothing on disk carries the snapshot it already had. Before
18
- * S3 M4 each adapter's stream loop did this before its own persists; the
18
+ * #1096 each adapter's stream loop did this before its own persists; the
19
19
  * runtime owns the capture now, so the display field it derives is
20
20
  * refreshed where every other runtime-owned field is — here.
21
21
  * 3. `streaming_usage` is refreshed from the accumulator when it has turns,
@@ -23,7 +23,7 @@
23
23
  * 4. `persistStatus` (`shared/status.ts`): tool-output offload, the
24
24
  * aggregate size cap, transient retry, oversize recovery. Never rejects.
25
25
  * 5. A Temporal heartbeat, so a long streaming turn's liveness is proven by
26
- * the writes it makes (Q-S2-10).
26
+ * the writes it makes.
27
27
  * 6. The control plane's answer: STOP becomes the runtime's platform-stop
28
28
  * cause on the stop controller, which aborts the adapter's signal.
29
29
  *
@@ -34,7 +34,7 @@
34
34
  * and resolves when that follow-up has. The promise it returns therefore
35
35
  * always means "the state as of my request is on the control plane", which
36
36
  * is what lets the Cursor loop await it and see a STOP before it pulls the
37
- * next event, exactly as its own inline persist did (Q-M3-2).
37
+ * next event, exactly as its own inline persist did.
38
38
  *
39
39
  * The runtime's terminal writes use the same path (`write()`), so the
40
40
  * secret backstop and the usage summary ride the final status too, as they