@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
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Pins who may CREATE a transcript row: an `AgentMessage`, a `ToolCall` or a
3
+ * `SubAgentExecution` on the execution status. Two writers, and no third:
4
+ *
5
+ * - `src/harness/transcript/` — the one transcript builder, which every
6
+ * harness folds its engine's events through (`TurnSink.transcript`);
7
+ * - `src/harness/terminal-table.ts` — the runtime's terminal system rows
8
+ * (the pause copy, the failure copy), which are not transcript facts of
9
+ * any engine and never were.
10
+ *
11
+ * Why it matters (#1097's founding promise): the promise that a
12
+ * third harness is "a translator and nothing else" holds only while there
13
+ * is exactly one place a row comes from. A module that builds a row itself
14
+ * — an adapter pushing an AI message with a WAITING call, a settle
15
+ * synthesizing a SYSTEM line — is a second copy of the folding rule, and
16
+ * the two copies drift (the memo counted three such copies before this
17
+ * entry). The rule is about CREATION. Amending a row a builder created —
18
+ * flipping a WAITING row SKIPPED, stamping a change-set id, marking a
19
+ * sub-agent CANCELLED, the Cursor boundary's identity-based collapses — is
20
+ * legitimate, and the modules that do it are named in `TurnSink`'s header;
21
+ * a fence over them would be a list, not a rule.
22
+ *
23
+ * A reinvocation's prior rows are not an exception: the runtime seeds them
24
+ * THROUGH the builder (`TranscriptBuilder.seed`, from `turn-context.ts`
25
+ * `seedFromPersistedStatus`), so the seed indexes what it appends and this
26
+ * list stays at two. (For one commit the seed pushed rows itself and was
27
+ * the third name here.)
28
+ *
29
+ * The rule is read off the TypeScript syntax tree, as the import fences are
30
+ * (`import-direction.test.ts`): a schema named in a header comment, or a
31
+ * `.messages.push(` in prose, cannot trip it; a row built through any of the
32
+ * three schemas, or an array push onto `messages` / `subAgentExecutions`
33
+ * wherever the array is reached from, cannot slip past it.
34
+ */
35
+
36
+ import { describe, it, expect } from "vitest";
37
+ import { join, relative, sep } from "node:path";
38
+ import { fileURLToPath } from "node:url";
39
+ import ts from "typescript";
40
+
41
+ import { readSource, typeScriptFilesUnder } from "../../__test-utils__/module-specifiers.js";
42
+
43
+ const SRC_ROOT = fileURLToPath(new URL("../../", import.meta.url));
44
+
45
+ /** The proto schemas a transcript row is created through; naming one is creating one. */
46
+ const ROW_SCHEMAS: ReadonlySet<string> = new Set(["AgentMessageSchema", "ToolCallSchema", "SubAgentExecutionSchema"]);
47
+
48
+ /** The status arrays a created row is pushed onto. */
49
+ const ROW_ARRAYS: ReadonlySet<string> = new Set(["messages", "subAgentExecutions"]);
50
+
51
+ /** The modules allowed to create rows, relative to `src/`: a directory (every file under it) or a file. */
52
+ const ALLOWED_CREATORS: readonly string[] = [
53
+ join("harness", "transcript") + sep,
54
+ join("harness", "terminal-table.ts"),
55
+ ];
56
+
57
+ /** Every row-creating construct in `source`, in source order: `names <Schema>` or `pushes onto .<array>`. */
58
+ export function transcriptRowWrites(fileName: string, source: string): string[] {
59
+ const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, /* setParentNodes */ false);
60
+ const writes: string[] = [];
61
+ const visit = (node: ts.Node): void => {
62
+ if (ts.isIdentifier(node) && ROW_SCHEMAS.has(node.text)) {
63
+ const write = `names ${node.text}`;
64
+ if (!writes.includes(write)) writes.push(write);
65
+ } else if (
66
+ ts.isCallExpression(node) &&
67
+ ts.isPropertyAccessExpression(node.expression) &&
68
+ node.expression.name.text === "push" &&
69
+ ts.isPropertyAccessExpression(node.expression.expression) &&
70
+ ROW_ARRAYS.has(node.expression.expression.name.text)
71
+ ) {
72
+ const write = `pushes onto .${node.expression.expression.name.text}`;
73
+ if (!writes.includes(write)) writes.push(write);
74
+ }
75
+ ts.forEachChild(node, visit);
76
+ };
77
+ visit(sourceFile);
78
+ return writes;
79
+ }
80
+
81
+ function isAllowedCreator(relativeFile: string): boolean {
82
+ return ALLOWED_CREATORS.some((allowed) => (allowed.endsWith(sep) ? relativeFile.startsWith(allowed) : relativeFile === allowed));
83
+ }
84
+
85
+ interface Offence {
86
+ readonly file: string;
87
+ readonly writes: readonly string[];
88
+ }
89
+
90
+ interface Sweep {
91
+ readonly visited: string[];
92
+ readonly creators: string[];
93
+ readonly offences: Offence[];
94
+ }
95
+
96
+ /** Production modules only: tests and test utilities build rows freely (fixtures, goldens' drivers). */
97
+ function sweep(): Sweep {
98
+ const visited: string[] = [];
99
+ const creators: string[] = [];
100
+ const offences: Offence[] = [];
101
+ for (const file of typeScriptFilesUnder(SRC_ROOT, new Set(["__tests__", "__test-utils__"]))) {
102
+ const relativeFile = relative(SRC_ROOT, file);
103
+ visited.push(relativeFile);
104
+ const writes = transcriptRowWrites(file, readSource(file));
105
+ if (writes.length === 0) continue;
106
+ creators.push(relativeFile);
107
+ if (!isAllowedCreator(relativeFile)) offences.push({ file: relativeFile, writes });
108
+ }
109
+ return { visited, creators, offences };
110
+ }
111
+
112
+ function describeOffences(offences: readonly Offence[]): string {
113
+ return offences.map((o) => ` ${o.file}: ${o.writes.join(", ")}`).join("\n");
114
+ }
115
+
116
+ describe("transcriptRowWrites (the checker itself)", () => {
117
+ const file = join(SRC_ROOT, "activities", "some-harness", "settle.ts");
118
+
119
+ it.each([
120
+ ["a message built through its schema", 'const m = create(AgentMessageSchema, { content: "x" });', "names AgentMessageSchema"],
121
+ ["a tool call built through its schema", "const tc = create(ToolCallSchema, { id });", "names ToolCallSchema"],
122
+ ["a sub-agent row built through its schema", "const row = create(SubAgentExecutionSchema, { id });", "names SubAgentExecutionSchema"],
123
+ ["a schema merely imported", 'import { AgentMessageSchema } from "@stigmer/protos/x_pb";', "names AgentMessageSchema"],
124
+ ["a push onto the root transcript", "status.messages.push(msg);", "pushes onto .messages"],
125
+ ["a push onto a nested transcript", "scope.row.messages.push(msg);", "pushes onto .messages"],
126
+ ["a spread push", "sink.status.messages.push(...seed.messages);", "pushes onto .messages"],
127
+ ["a push onto the sub-agent rows", "this.proto.subAgentExecutions.push(row);", "pushes onto .subAgentExecutions"],
128
+ ])("flags %s", (_label, source, expected) => {
129
+ expect(transcriptRowWrites(file, source)).toEqual([expected]);
130
+ });
131
+
132
+ it.each([
133
+ ["a schema named in a comment", "// built through AgentMessageSchema elsewhere\nconst x = 1;"],
134
+ ["a push described in a comment", "// the builder does status.messages.push(msg)\nconst x = 1;"],
135
+ ["a schema named in a string", 'const hint = "AgentMessageSchema";'],
136
+ ["a read of the transcript", "const last = status.messages.at(-1);"],
137
+ ["a push onto an unrelated array", "status.artifacts.push(artifact);"],
138
+ ["a push onto a bare `messages` local", "messages.push(m);"],
139
+ ["the message TYPE, not its schema", 'import type { AgentMessage } from "@stigmer/protos/x_pb";'],
140
+ ["an in-place amendment of a row", "row.status = ToolCallStatus.TOOL_CALL_SKIPPED;"],
141
+ ])("does not flag %s", (_label, source) => {
142
+ expect(transcriptRowWrites(file, source)).toEqual([]);
143
+ });
144
+
145
+ it("names each construct once, in source order", () => {
146
+ const source = [
147
+ "const a = create(AgentMessageSchema, {});",
148
+ "const b = create(ToolCallSchema, {});",
149
+ "const c = create(AgentMessageSchema, {});",
150
+ "a.toolCalls.push(b); status.messages.push(a); status.messages.push(c);",
151
+ ].join("\n");
152
+ expect(transcriptRowWrites(file, source)).toEqual(["names AgentMessageSchema", "names ToolCallSchema", "pushes onto .messages"]);
153
+ });
154
+ });
155
+
156
+ describe("only the transcript builder and the terminal table create transcript rows", () => {
157
+ const result = sweep();
158
+
159
+ it("inspected production modules across src/ and skipped the test trees (the walk is rooted where it claims)", () => {
160
+ expect(result.visited).toEqual(
161
+ expect.arrayContaining([
162
+ join("harness", "run-turn.ts"),
163
+ join("harness", "transcript", "builder.ts"),
164
+ join("activities", "execute-cursor", "boundary-rows.ts"),
165
+ join("activities", "execute-deep-agent", "hitl.ts"),
166
+ join("shared", "exact-apply.ts"),
167
+ ]),
168
+ );
169
+ expect(
170
+ result.visited.some((f) => f.includes(`${sep}__tests__${sep}`) || f.includes(`${sep}__test-utils__${sep}`)),
171
+ "the production sweep must skip the test trees",
172
+ ).toBe(false);
173
+ });
174
+
175
+ it("found the allowed creators (the checker sees the rows it exists to see)", () => {
176
+ expect(result.creators).toEqual(
177
+ expect.arrayContaining([
178
+ join("harness", "transcript", "builder.ts"),
179
+ join("harness", "transcript", "state.ts"),
180
+ join("harness", "terminal-table.ts"),
181
+ ]),
182
+ );
183
+ });
184
+
185
+ it("finds no creator outside the allow-list", () => {
186
+ expect(
187
+ result.offences,
188
+ `a transcript row is created through TurnSink.transcript, never built in place:\n${describeOffences(result.offences)}`,
189
+ ).toEqual([]);
190
+ });
191
+ });
@@ -2,7 +2,7 @@
2
2
  * Pins which model the attachment phase asks the registry about when it
3
3
  * sizes the vision budget (`turn-context.ts` `resolveTurnAttachments`): the
4
4
  * model the execution named, or the registry's default when it named none —
5
- * the model the native harness will build in that case. Before S3 M1 the
5
+ * the model the native harness will build in that case. Before #1096 the
6
6
  * phase asked about the raw executionConfig name, so an execution with no
7
7
  * model named asked about `""` (always "unknown", read as sighted) while the
8
8
  * native orchestrator asked about the resolved default (its `setup.ts`,
@@ -29,14 +29,17 @@ import { DEEP_AGENT_VISION_PROFILE } from "../../shared/attachment-vision.js";
29
29
  import { TimingRecorder } from "../../shared/cold-start-timing.js";
30
30
  import { mockStigmerClient } from "../../__test-utils__/mock-client.js";
31
31
  import { testConfig } from "../../__test-utils__/config-fixture.js";
32
+ import { TranscriptBuilder } from "../transcript/builder.js";
32
33
  import { resolveTurnAttachments, type ResolutionDeps } from "../turn-context.js";
33
34
 
34
35
  function deps(): ResolutionDeps {
36
+ const status = create(AgentExecutionStatusSchema, {});
35
37
  return {
36
38
  input: { executionId: "aex_1", threadId: "", turnSeq: 0 },
37
39
  client: mockStigmerClient(),
38
40
  config: testConfig(),
39
- status: create(AgentExecutionStatusSchema, {}),
41
+ status,
42
+ transcript: new TranscriptBuilder("aex_1", status),
40
43
  artifactStorage: undefined,
41
44
  timing: new TimingRecorder(),
42
45
  signal: new AbortController().signal,
@@ -14,13 +14,13 @@
14
14
  * (`activities/execute-cursor/__tests__/approval-state.test.ts`), because
15
15
  * `src/harness/` never imports `src/activities/`, tests included.
16
16
  * - `decideReinvocation`: the three ways a resume proceeds (any decision
17
- * runs the agent — REJECT included since S3 M1 —, a clean file-review
17
+ * runs the agent — REJECT included since #1096 —, a clean file-review
18
18
  * resume completes, a failed or partially discarded one completes with
19
19
  * its facts carried).
20
20
  * - `regeneratesApprovedWrites`: which pause primitives make the runner pin
21
21
  * an approved whole-file write's bytes itself (the engine re-runs the
22
22
  * model) and which never do (the engine applies the exact args it paused
23
- * on). S3 M2a, Q-M2a-3.
23
+ * on).
24
24
  *
25
25
  * The phases that fetch and provision are exercised end to end by the
26
26
  * hermetic goldens (`activities/execute-cursor/__tests__/hermetic/`), which
@@ -163,10 +163,10 @@ describe("decideReinvocation", () => {
163
163
  expect(decideReinvocation(facts())).toBeUndefined();
164
164
  });
165
165
 
166
- it("a REJECT runs the agent like any other decision — the run continues without the tool (stigmer#197; S3 M1, Q-S3-2)", () => {
167
- // Until S3 M1 this returned `{ kind: "rejected-by-user" }` and the runtime
166
+ it("a REJECT runs the agent like any other decision — the run continues without the tool (stigmer#197)", () => {
167
+ // Until #1096 this returned `{ kind: "rejected-by-user" }` and the runtime
168
168
  // FAILED the execution before any engine ran, contradicting the proto, the
169
- // conformance suite and the native harness (S2 M4 finding F1).
169
+ // conformance suite and the native harness.
170
170
  const decisions = new Map([
171
171
  ["tc-1", ApprovalAction.APPROVE],
172
172
  ["tc-2", ApprovalAction.REJECT],
@@ -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):
@@ -53,12 +53,22 @@ import type { VisionProfile } from "../shared/attachment-vision.js";
53
53
  * - `deny-and-retry`: an out-of-process hook denies the tool, the adapter
54
54
  * records the denial, cancels the run, and re-runs with grants on the next
55
55
  * invocation.
56
- * - `callback`: an in-process callback decides per tool; the runtime still
57
- * returns `awaiting_approval` and reinvokes, so the adapter answers the
58
- * callback with "deny, stop" and resumes with the decisions.
59
- * - `none`: the engine offers no gate; the runtime confines it to
60
- * capture-only work (a read-only sandbox) and gated actions never reach
61
- * the engine.
56
+ * - `callback`: an in-process callback decides per tool. The intended shape
57
+ * is the `interrupt` one seen from the runtime: the turn still ends
58
+ * `awaiting_approval` and reinvokes, and the adapter answers the callback
59
+ * with "deny, stop" and resumes with the decisions.
60
+ * - `none`: the engine offers no gate. The intended shape is that the
61
+ * runtime confines such a harness to capture-only work (a read-only
62
+ * sandbox) so a gated action never reaches the engine.
63
+ *
64
+ * Two of the four are built and two are reserved. `interrupt` (native) and
65
+ * `deny-and-retry` (Cursor) each have a real adapter and the contract kit
66
+ * runs under both. `callback` and `none` come from the 2026-09 survey of the
67
+ * Claude and Codex SDKs: the type carries them so an adapter can declare
68
+ * them, but no adapter does, and the runtime reads `pausePrimitive` in one
69
+ * place only (`turn-context.ts` `regeneratesApprovedWrites`, which returns
70
+ * false for `none`). The capture-only confinement for `none` is design
71
+ * still to be done before the first gate-less harness lands.
62
72
  */
63
73
  export type PausePrimitive = "interrupt" | "deny-and-retry" | "callback" | "none";
64
74
 
@@ -78,9 +88,9 @@ export type StateIdSource = "deterministic" | "engine-minted";
78
88
  * workspace-relative paths the harness writes into the repo that a turn's
79
89
  * diff must never show (Cursor's transient `.cursor/hooks.json`). Declared
80
90
  * once per adapter, read by `harness/capture.ts` (the pin, the progress
81
- * slice, the candidate) and `turn-context.ts` (the reconcile). Ruled Q-M2-6
82
- * as an argument, homed here at S2 M3; the capture joined the reconcile as a
83
- * reader at S3 M4.
91
+ * slice, the candidate) and `turn-context.ts` (the reconcile). First passed
92
+ * as an argument, then homed here as a capability (#1070); the capture joined
93
+ * the reconcile as a reader in #1096.
84
94
  */
85
95
  export interface FileReviewIdentity {
86
96
  readonly harnessId: string;
@@ -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
@@ -10,7 +10,7 @@
10
10
  * dials the control plane, and `shutdownHarnesses` runs them in reverse so
11
11
  * what was set up last is torn down first.
12
12
  *
13
- * Error posture, ruled at the entry's gate (Q-S1-10):
13
+ * Error posture (fixed in #1064):
14
14
  * - Boot validates the whole table BEFORE booting anything (a duplicate name
15
15
  * is a configuration defect, and a half-booted worker is the worst state to
16
16
  * discover it in), then fails fast at the first adapter that rejects. A
@@ -23,7 +23,7 @@
23
23
  * turn runtime (`run-turn.ts`). The table of real rows is NOT here: it lives
24
24
  * at the source root (`src/harness-adapters.ts`), because a row imports its
25
25
  * adapter from `activities/` and nothing under `src/harness/` may
26
- * (`__tests__/import-direction.test.ts`; Q-M3-1). The registry knows rows,
26
+ * (`__tests__/import-direction.test.ts`). The registry knows rows,
27
27
  * never which adapters exist.
28
28
  *
29
29
  * `HarnessName` lives here and not in `types.ts` on purpose: the wire
@@ -3,7 +3,10 @@
3
3
  * every harness, with the engine behind the adapter contract (`types.ts`).
4
4
  *
5
5
  * What runs here and nowhere else: the activity's identity and its
6
- * execution-scoped context; the status and the single persist chokepoint;
6
+ * execution-scoped context; the status, the one transcript builder over it
7
+ * (born with the status, seeded by the reinvocation phase, handed to the
8
+ * adapter as `sink.transcript`, finalized once the adapter returns) and the
9
+ * single persist chokepoint;
7
10
  * the periodic heartbeat; the stop controller and its four producers (the
8
11
  * stall watchdog, the cost cap, the platform STOP, Temporal's cancellation);
9
12
  * the resolution phases (`turn-context.ts`) composed into the `TurnInput`;
@@ -24,9 +27,8 @@
24
27
  * registry row, not a branch.
25
28
  *
26
29
  * Extracted from `activities/execute-cursor/index.ts` `executeCursorInner`
27
- * (S2 M3; the milestone log in stigmer-cloud
28
- * `_projects/2026-09/20260911.03.sp.turn-runtime-extraction/` has every
29
- * ruling). Its twelve resolution phases came out at M2; what came out here is
30
+ * in #1070, whose body carries the reasoning behind each phase. Its twelve
31
+ * resolution phases came out first; what came out here is
30
32
  * everything between them and after the engine: the seventeen hermetic
31
33
  * goldens under `execute-cursor/__tests__/hermetic/` pin the result byte
32
34
  * for byte, and `__tests__/run-turn.test.ts` proves the table against the
@@ -81,6 +83,7 @@ import {
81
83
  workspaceLockTimeoutArm,
82
84
  type TerminalArm,
83
85
  } from "./terminal-table.js";
86
+ import { TranscriptBuilder } from "./transcript/builder.js";
84
87
  import { resolveTurnContext, type ResolutionDeps, type TurnFrame, type TurnSettlement } from "./turn-context.js";
85
88
  import type { HarnessAdapter, TurnInput, TurnSink } from "./types.js";
86
89
  import { UsageAccumulator } from "./usage-accumulator.js";
@@ -148,6 +151,15 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
148
151
  startedAt: utcTimestamp(),
149
152
  });
150
153
 
154
+ // The one transcript builder of this turn, born with the status and before
155
+ // any phase, so it exists for everything that writes a row or an output
156
+ // onto the status: the write-back coordinator (phase 2c), the seed of a
157
+ // reinvocation's prior rows (phase 3, through `seed()`, which indexes them
158
+ // as it appends), the adapter (`sink.transcript`), and the epilogue. One
159
+ // constructor call per turn; a second builder over the same status would
160
+ // index the same rows twice.
161
+ const transcript = new TranscriptBuilder(executionId, status);
162
+
151
163
  // Cold-start timeline of this turn's setup: one mark after each phase, the
152
164
  // adapter's own segments marked through the sink, emitted by the adapter
153
165
  // once its engine is resolved (an early return skips it — partial setups
@@ -254,7 +266,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
254
266
  );
255
267
  // The execution completes here, so its answer rides the slim as it
256
268
  // does from `completeTurn`: the seed carried the transcript and any
257
- // structured output the paused turn resolved (Q-M4-8).
269
+ // structured output the paused turn resolved.
258
270
  return { kind: "return", value: completionSlim(lastAssistantText()) };
259
271
  }
260
272
  default: {
@@ -274,7 +286,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
274
286
  // The stall watchdog: the periodic heartbeat proves the process is alive,
275
287
  // not that the engine is progressing; if the engine wedges, nothing
276
288
  // arrives and the turn would hang forever. Armed for the adapter's whole
277
- // stretch (Q-M3-13) and reset by every `recordActivity`; on stall the
289
+ // stretch and reset by every `recordActivity`; on stall the
278
290
  // signal aborts, the adapter cancels its run, and the table reports the
279
291
  // stall with the last detail the adapter named.
280
292
  watchdog = startStallWatchdog(config.cursorStreamStallTimeoutMs, (idleMs) => {
@@ -288,6 +300,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
288
300
 
289
301
  const sink: TurnSink = {
290
302
  status,
303
+ transcript,
291
304
  stopSignal: stop.signal,
292
305
  setupTiming,
293
306
  requestPersist: () => chokepoint.request(),
@@ -343,6 +356,16 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
343
356
  armedWatchdog.stop();
344
357
  heartbeatPhase = "epilogue";
345
358
 
359
+ // The stream is over, however it ended: nothing on the transcript is
360
+ // still streaming. Here and not only in the adapters' settles, because
361
+ // this is the one place that sees every path — a turn that failed before
362
+ // its settle, or ended on a thrown budget, used to persist its last
363
+ // message with the flag on, a spinner the console never stopped (the
364
+ // kit's settled-transcript fact caught it on both real adapters).
365
+ // Idempotent: an adapter that persists on the settled rows mid-settle
366
+ // finalizes first, as the Cursor harness does before `run.wait()`.
367
+ transcript.finalize();
368
+
346
369
  // The capture boundary, ONCE, over whatever the whole turn left on the
347
370
  // tree — unless a stop fired mid-turn (`interrupted`: the tree may be
348
371
  // mid-edit and the pause or drain reinvokes this same turn). Before the
@@ -381,7 +404,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
381
404
  // approval or file-review signal and reinvokes.
382
405
  return settleWith(awaitingApprovalArm());
383
406
  case "tool_call_limit": {
384
- // A review wins over the terminal (Q-M4-2): the limit's copy rides
407
+ // A review wins over the terminal: the limit's copy rides
385
408
  // the transcript and the reinvocation's reconcile completes the turn.
386
409
  const settledLimit = await settleWith(reviewPending ? awaitingReviewArm(toolCallLimitArm()) : toolCallLimitArm());
387
410
  console.log(`${activityName} terminated (tool-call limit): execution=${executionId}${reviewPending ? ", review pending" : ""}`);
@@ -459,7 +482,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
459
482
  /**
460
483
  * The engine finished AND left a reviewable change: the structured output
461
484
  * is resolved now, before the WAITING persist, so the resume that
462
- * reconciles the review completes with it (Q-M4-8 closes Q-M2a-5); then
485
+ * reconciles the review completes with it; then
463
486
  * the review pause. Nothing else of the completion epilogue runs here —
464
487
  * the plan artifact and the write-back belong to the settlement that
465
488
  * actually completes the execution.
@@ -530,7 +553,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
530
553
  * unless the adapter already did (the deep-agent's `structuredResponse`):
531
554
  * extracted from the final text through the tiers below. Runs where the
532
555
  * engine has FINISHED speaking — a completed turn, and a completed turn
533
- * the runtime pauses for file review (Q-M4-8: the pure-reconcile
556
+ * the runtime pauses for file review (the pure-reconcile
534
557
  * COMPLETED then carries it, on every harness).
535
558
  */
536
559
  async function resolveStructuredOutput(turn: TurnInput, finalText: string | undefined): Promise<void> {
@@ -663,6 +686,7 @@ async function runTurn(deps: TurnRuntimeDeps, input: NormalizedActivityInput): P
663
686
  client,
664
687
  config,
665
688
  status,
689
+ transcript,
666
690
  artifactStorage,
667
691
  timing: setupTiming,
668
692
  signal: cancellationSignal,
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * Nothing here is engine-specific and nothing here persists; the Cursor
16
16
  * orchestrator kept the same facts as flags on its stream state
17
- * (`turn-stream.ts` `TurnStreamState`, before S2 M3 moved them out).
17
+ * (`turn-stream.ts` `TurnStreamState`, before #1070 moved them out).
18
18
  */
19
19
 
20
20
  import type { StallTimeoutError } from "../shared/stall-watchdog.js";
@@ -9,7 +9,7 @@
9
9
  * for byte, `activities/execute-cursor/__tests__/hermetic/`), and a table a
10
10
  * reader can scan is how that contract stays reviewable. The native
11
11
  * harness once kept one function per arm (`streaming-terminal.ts`, retired
12
- * at S3 M2b); since S3 M2a both harnesses' turns end through this one table.
12
+ * in #1096); since #1096 both harnesses' turns end through this one table.
13
13
  *
14
14
  * The throw-vs-return rule, unchanged from the orchestrator it replaces:
15
15
  * - RETURN when a Temporal retry would only repeat the outcome — a stall
@@ -25,9 +25,9 @@
25
25
  * is persisted exactly once, by `run-turn.ts`'s `settleWith` — the one
26
26
  * writer of a terminal. The orchestrator this table replaced appended the
27
27
  * three THROW arms' rows twice (its throw fell into its own catch, which
28
- * wrote the copy again); S2 reproduced that on purpose so the goldens could
29
- * pin the wire byte for byte, and the PR after S2 removed it with a reviewed
30
- * golden regeneration (stigmer#1054, Q-S2-4).
28
+ * wrote the copy again); #1070 reproduced that on purpose so the goldens could
29
+ * pin the wire byte for byte, and the PR after it removed it with a reviewed
30
+ * golden regeneration (stigmer#1054).
31
31
  */
32
32
 
33
33
  import { create } from "@bufbuild/protobuf";
@@ -174,7 +174,7 @@ export function infrastructureCancelArm(): TerminalArm {
174
174
  * The engine proposed at least one gated side effect and stopped: the
175
175
  * WAITING_APPROVAL rows are already on the transcript. Not an error, not
176
176
  * complete, no copy; RETURN to the workflow, which waits for the approval
177
- * signal and reinvokes with the decisions. Until S3 M4 this was an inline
177
+ * signal and reinvokes with the decisions. Until #1096 this was an inline
178
178
  * phase flip in `run-turn.ts`; it is an arm because every way an activity
179
179
  * ends belongs in this one table.
180
180
  */
@@ -193,11 +193,11 @@ export function awaitingApprovalArm(): TerminalArm {
193
193
  * tool-call-limit copy; an `engine`-surface failure has none), never its
194
194
  * phase, its `error` or its completion stamp, and the resume's reconcile
195
195
  * settles the execution COMPLETED as every pure file-review resume does
196
- * (`fileReviewResolvedArm`). Until S3 M4 only the Cursor harness behaved so,
196
+ * (`fileReviewResolvedArm`). Until #1096 only the Cursor harness behaved so,
197
197
  * and only because its boundary ran before it consulted its engine's
198
198
  * result; the deep-agent wrote FAILED with the edits applied and unreviewed.
199
199
  * Stated cost: the cloud's `status.error` prefix match for a tool-call limit
200
- * does not fire when that limit left edits (Q-M4-2).
200
+ * does not fire when that limit left edits.
201
201
  */
202
202
  export function awaitingReviewArm(deferred?: TerminalArm): TerminalArm {
203
203
  return {