pulseed 0.6.3 → 0.6.4

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 (509) hide show
  1. package/dist/adapters/datasources/artifact-metric-datasource.d.ts +11 -1
  2. package/dist/adapters/datasources/artifact-metric-datasource.d.ts.map +1 -1
  3. package/dist/adapters/datasources/artifact-metric-datasource.js +238 -8
  4. package/dist/adapters/datasources/artifact-metric-datasource.js.map +1 -1
  5. package/dist/base/config/global-config.d.ts +4 -4
  6. package/dist/base/protocol/exact-protocol.d.ts +47 -0
  7. package/dist/base/protocol/exact-protocol.d.ts.map +1 -0
  8. package/dist/base/protocol/exact-protocol.js +175 -0
  9. package/dist/base/protocol/exact-protocol.js.map +1 -0
  10. package/dist/base/types/core.d.ts +1 -1
  11. package/dist/base/types/core.d.ts.map +1 -1
  12. package/dist/base/types/core.js +1 -0
  13. package/dist/base/types/core.js.map +1 -1
  14. package/dist/base/utils/workspace-path.d.ts +6 -0
  15. package/dist/base/utils/workspace-path.d.ts.map +1 -0
  16. package/dist/base/utils/workspace-path.js +24 -0
  17. package/dist/base/utils/workspace-path.js.map +1 -0
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/interface/chat/chat-event-state.d.ts +2 -0
  23. package/dist/interface/chat/chat-event-state.d.ts.map +1 -1
  24. package/dist/interface/chat/chat-event-state.js +22 -41
  25. package/dist/interface/chat/chat-event-state.js.map +1 -1
  26. package/dist/interface/chat/chat-events.d.ts +15 -1
  27. package/dist/interface/chat/chat-events.d.ts.map +1 -1
  28. package/dist/interface/chat/chat-history.d.ts +3816 -192
  29. package/dist/interface/chat/chat-history.d.ts.map +1 -1
  30. package/dist/interface/chat/chat-history.js +529 -5
  31. package/dist/interface/chat/chat-history.js.map +1 -1
  32. package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -1
  33. package/dist/interface/chat/chat-runner-commands.js +22 -18
  34. package/dist/interface/chat/chat-runner-commands.js.map +1 -1
  35. package/dist/interface/chat/chat-runner-contracts.d.ts +5 -1
  36. package/dist/interface/chat/chat-runner-contracts.d.ts.map +1 -1
  37. package/dist/interface/chat/chat-runner-event-bridge.d.ts +13 -1
  38. package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -1
  39. package/dist/interface/chat/chat-runner-event-bridge.js +51 -3
  40. package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -1
  41. package/dist/interface/chat/chat-runner-routes.d.ts +5 -17
  42. package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -1
  43. package/dist/interface/chat/chat-runner-routes.js +80 -51
  44. package/dist/interface/chat/chat-runner-routes.js.map +1 -1
  45. package/dist/interface/chat/chat-runner-runtime.d.ts.map +1 -1
  46. package/dist/interface/chat/chat-runner-runtime.js +4 -0
  47. package/dist/interface/chat/chat-runner-runtime.js.map +1 -1
  48. package/dist/interface/chat/chat-runner.d.ts +7 -1
  49. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  50. package/dist/interface/chat/chat-runner.js +135 -49
  51. package/dist/interface/chat/chat-runner.js.map +1 -1
  52. package/dist/interface/chat/chat-session-store.d.ts +3 -0
  53. package/dist/interface/chat/chat-session-store.d.ts.map +1 -1
  54. package/dist/interface/chat/chat-session-store.js +12 -0
  55. package/dist/interface/chat/chat-session-store.js.map +1 -1
  56. package/dist/interface/chat/cross-platform-session.d.ts +15 -0
  57. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
  58. package/dist/interface/chat/cross-platform-session.js +260 -42
  59. package/dist/interface/chat/cross-platform-session.js.map +1 -1
  60. package/dist/interface/chat/failure-recovery.d.ts.map +1 -1
  61. package/dist/interface/chat/failure-recovery.js +15 -1
  62. package/dist/interface/chat/failure-recovery.js.map +1 -1
  63. package/dist/interface/chat/freeform-route-classifier.d.ts +2 -2
  64. package/dist/interface/chat/ingress-router.d.ts +3 -0
  65. package/dist/interface/chat/ingress-router.d.ts.map +1 -1
  66. package/dist/interface/chat/ingress-router.js +3 -0
  67. package/dist/interface/chat/ingress-router.js.map +1 -1
  68. package/dist/interface/chat/model-request-builder.d.ts +37 -0
  69. package/dist/interface/chat/model-request-builder.d.ts.map +1 -0
  70. package/dist/interface/chat/model-request-builder.js +76 -0
  71. package/dist/interface/chat/model-request-builder.js.map +1 -0
  72. package/dist/interface/chat/turn-context.d.ts +200 -0
  73. package/dist/interface/chat/turn-context.d.ts.map +1 -0
  74. package/dist/interface/chat/turn-context.js +249 -0
  75. package/dist/interface/chat/turn-context.js.map +1 -0
  76. package/dist/interface/chat/turn-protocol.d.ts +35 -0
  77. package/dist/interface/chat/turn-protocol.d.ts.map +1 -0
  78. package/dist/interface/chat/turn-protocol.js +27 -0
  79. package/dist/interface/chat/turn-protocol.js.map +1 -0
  80. package/dist/interface/chat/user-input.d.ts +55 -0
  81. package/dist/interface/chat/user-input.d.ts.map +1 -0
  82. package/dist/interface/chat/user-input.js +52 -0
  83. package/dist/interface/chat/user-input.js.map +1 -0
  84. package/dist/interface/cli/cli-command-registry.d.ts +1 -1
  85. package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
  86. package/dist/interface/cli/cli-command-registry.js +12 -16
  87. package/dist/interface/cli/cli-command-registry.js.map +1 -1
  88. package/dist/interface/cli/commands/daemon-shared.d.ts +8 -0
  89. package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -1
  90. package/dist/interface/cli/commands/daemon-shared.js +18 -2
  91. package/dist/interface/cli/commands/daemon-shared.js.map +1 -1
  92. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  93. package/dist/interface/cli/commands/daemon.js +5 -1
  94. package/dist/interface/cli/commands/daemon.js.map +1 -1
  95. package/dist/interface/cli/commands/doctor.d.ts.map +1 -1
  96. package/dist/interface/cli/commands/doctor.js +14 -1
  97. package/dist/interface/cli/commands/doctor.js.map +1 -1
  98. package/dist/interface/cli/commands/goal-dispatch.d.ts.map +1 -1
  99. package/dist/interface/cli/commands/goal-dispatch.js +10 -6
  100. package/dist/interface/cli/commands/goal-dispatch.js.map +1 -1
  101. package/dist/interface/cli/commands/goal-utils.d.ts.map +1 -1
  102. package/dist/interface/cli/commands/goal-utils.js +3 -5
  103. package/dist/interface/cli/commands/goal-utils.js.map +1 -1
  104. package/dist/interface/cli/commands/run.d.ts.map +1 -1
  105. package/dist/interface/cli/commands/run.js +50 -0
  106. package/dist/interface/cli/commands/run.js.map +1 -1
  107. package/dist/interface/cli/setup.d.ts +1 -1
  108. package/dist/interface/cli/setup.d.ts.map +1 -1
  109. package/dist/interface/cli/setup.js +4 -3
  110. package/dist/interface/cli/setup.js.map +1 -1
  111. package/dist/interface/cli/utils/loop-runner.d.ts +1 -0
  112. package/dist/interface/cli/utils/loop-runner.d.ts.map +1 -1
  113. package/dist/interface/cli/utils/loop-runner.js +12 -3
  114. package/dist/interface/cli/utils/loop-runner.js.map +1 -1
  115. package/dist/interface/tui/app.d.ts +6 -1
  116. package/dist/interface/tui/app.d.ts.map +1 -1
  117. package/dist/interface/tui/app.js +29 -12
  118. package/dist/interface/tui/app.js.map +1 -1
  119. package/dist/interface/tui/bash-mode.d.ts.map +1 -1
  120. package/dist/interface/tui/bash-mode.js +2 -9
  121. package/dist/interface/tui/bash-mode.js.map +1 -1
  122. package/dist/interface/tui/chat/viewport.d.ts.map +1 -1
  123. package/dist/interface/tui/chat/viewport.js +57 -11
  124. package/dist/interface/tui/chat/viewport.js.map +1 -1
  125. package/dist/interface/tui/entry-deps.d.ts +6 -1
  126. package/dist/interface/tui/entry-deps.d.ts.map +1 -1
  127. package/dist/interface/tui/entry-deps.js +3 -0
  128. package/dist/interface/tui/entry-deps.js.map +1 -1
  129. package/dist/interface/tui/entry.d.ts.map +1 -1
  130. package/dist/interface/tui/entry.js +6 -2
  131. package/dist/interface/tui/entry.js.map +1 -1
  132. package/dist/interface/tui/input-action.d.ts.map +1 -1
  133. package/dist/interface/tui/input-action.js +3 -2
  134. package/dist/interface/tui/input-action.js.map +1 -1
  135. package/dist/interface/tui/intent-recognizer.d.ts.map +1 -1
  136. package/dist/interface/tui/intent-recognizer.js +21 -33
  137. package/dist/interface/tui/intent-recognizer.js.map +1 -1
  138. package/dist/orchestrator/execution/adapter-layer.d.ts +6 -1
  139. package/dist/orchestrator/execution/adapter-layer.d.ts.map +1 -1
  140. package/dist/orchestrator/execution/adapter-layer.js.map +1 -1
  141. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.d.ts +12 -1
  142. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.d.ts.map +1 -1
  143. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.js +16 -31
  144. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.js.map +1 -1
  145. package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.d.ts +75 -0
  146. package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.d.ts.map +1 -0
  147. package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.js +10 -0
  148. package/dist/orchestrator/execution/agent-loop/agent-loop-compaction-record.js.map +1 -0
  149. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.d.ts +3 -2
  150. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.d.ts.map +1 -1
  151. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.js +185 -22
  152. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.js.map +1 -1
  153. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
  154. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +7 -1
  155. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
  156. package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts +8 -1
  157. package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts.map +1 -1
  158. package/dist/orchestrator/execution/agent-loop/agent-loop-events.js.map +1 -1
  159. package/dist/orchestrator/execution/agent-loop/agent-loop-history.d.ts +3 -1
  160. package/dist/orchestrator/execution/agent-loop/agent-loop-history.d.ts.map +1 -1
  161. package/dist/orchestrator/execution/agent-loop/agent-loop-history.js +12 -3
  162. package/dist/orchestrator/execution/agent-loop/agent-loop-history.js.map +1 -1
  163. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.d.ts.map +1 -1
  164. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.js +7 -1
  165. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.js.map +1 -1
  166. package/dist/orchestrator/execution/agent-loop/agent-loop-model.d.ts +37 -0
  167. package/dist/orchestrator/execution/agent-loop/agent-loop-model.d.ts.map +1 -1
  168. package/dist/orchestrator/execution/agent-loop/agent-loop-model.js +21 -0
  169. package/dist/orchestrator/execution/agent-loop/agent-loop-model.js.map +1 -1
  170. package/dist/orchestrator/execution/agent-loop/agent-loop-result.d.ts +17 -11
  171. package/dist/orchestrator/execution/agent-loop/agent-loop-result.d.ts.map +1 -1
  172. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.d.ts +4 -0
  173. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.d.ts.map +1 -1
  174. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.js +135 -0
  175. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.js.map +1 -1
  176. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +3 -2
  177. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
  178. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +68 -61
  179. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
  180. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +3 -1
  181. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
  182. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
  183. package/dist/orchestrator/execution/agent-loop/agent-timeline.d.ts +12 -1
  184. package/dist/orchestrator/execution/agent-loop/agent-timeline.d.ts.map +1 -1
  185. package/dist/orchestrator/execution/agent-loop/agent-timeline.js +19 -56
  186. package/dist/orchestrator/execution/agent-loop/agent-timeline.js.map +1 -1
  187. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.d.ts.map +1 -1
  188. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.js +8 -2
  189. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.js.map +1 -1
  190. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +12 -0
  191. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
  192. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +400 -80
  193. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
  194. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -1
  195. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
  196. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +80 -12
  197. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
  198. package/dist/orchestrator/execution/agent-loop/chat-display-output.d.ts +1 -0
  199. package/dist/orchestrator/execution/agent-loop/chat-display-output.d.ts.map +1 -1
  200. package/dist/orchestrator/execution/agent-loop/chat-display-output.js +3 -1
  201. package/dist/orchestrator/execution/agent-loop/chat-display-output.js.map +1 -1
  202. package/dist/orchestrator/execution/agent-loop/index.d.ts +3 -0
  203. package/dist/orchestrator/execution/agent-loop/index.d.ts.map +1 -1
  204. package/dist/orchestrator/execution/agent-loop/index.js +3 -0
  205. package/dist/orchestrator/execution/agent-loop/index.js.map +1 -1
  206. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.d.ts +1 -0
  207. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.d.ts.map +1 -1
  208. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.js +51 -9
  209. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.js.map +1 -1
  210. package/dist/orchestrator/execution/agent-loop/response-item-tool-router.d.ts +20 -0
  211. package/dist/orchestrator/execution/agent-loop/response-item-tool-router.d.ts.map +1 -0
  212. package/dist/orchestrator/execution/agent-loop/response-item-tool-router.js +180 -0
  213. package/dist/orchestrator/execution/agent-loop/response-item-tool-router.js.map +1 -0
  214. package/dist/orchestrator/execution/agent-loop/response-item.d.ts +805 -0
  215. package/dist/orchestrator/execution/agent-loop/response-item.d.ts.map +1 -0
  216. package/dist/orchestrator/execution/agent-loop/response-item.js +104 -0
  217. package/dist/orchestrator/execution/agent-loop/response-item.js.map +1 -0
  218. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.d.ts +7 -2
  219. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.d.ts.map +1 -1
  220. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.js +20 -1
  221. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.js.map +1 -1
  222. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts +5 -3
  223. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts.map +1 -1
  224. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.js +109 -10
  225. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.js.map +1 -1
  226. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.d.ts +2 -0
  227. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.d.ts.map +1 -1
  228. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.js +9 -4
  229. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.js.map +1 -1
  230. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.d.ts +0 -1
  231. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.d.ts.map +1 -1
  232. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.js +7 -87
  233. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.js.map +1 -1
  234. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.d.ts.map +1 -1
  235. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.js +25 -0
  236. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.js.map +1 -1
  237. package/dist/orchestrator/execution/context/issue-context-fetcher.d.ts +5 -1
  238. package/dist/orchestrator/execution/context/issue-context-fetcher.d.ts.map +1 -1
  239. package/dist/orchestrator/execution/context/issue-context-fetcher.js +7 -4
  240. package/dist/orchestrator/execution/context/issue-context-fetcher.js.map +1 -1
  241. package/dist/orchestrator/execution/task/task-artifact-contract.d.ts +18 -0
  242. package/dist/orchestrator/execution/task/task-artifact-contract.d.ts.map +1 -0
  243. package/dist/orchestrator/execution/task/task-artifact-contract.js +176 -0
  244. package/dist/orchestrator/execution/task/task-artifact-contract.js.map +1 -0
  245. package/dist/orchestrator/execution/task/task-diff-capture.d.ts +14 -1
  246. package/dist/orchestrator/execution/task/task-diff-capture.d.ts.map +1 -1
  247. package/dist/orchestrator/execution/task/task-diff-capture.js +269 -17
  248. package/dist/orchestrator/execution/task/task-diff-capture.js.map +1 -1
  249. package/dist/orchestrator/execution/task/task-execution-helpers.d.ts +1 -0
  250. package/dist/orchestrator/execution/task/task-execution-helpers.d.ts.map +1 -1
  251. package/dist/orchestrator/execution/task/task-execution-helpers.js +76 -17
  252. package/dist/orchestrator/execution/task/task-execution-helpers.js.map +1 -1
  253. package/dist/orchestrator/execution/task/task-executor.d.ts +16 -1
  254. package/dist/orchestrator/execution/task/task-executor.d.ts.map +1 -1
  255. package/dist/orchestrator/execution/task/task-executor.js +55 -50
  256. package/dist/orchestrator/execution/task/task-executor.js.map +1 -1
  257. package/dist/orchestrator/execution/task/task-generation.d.ts +54 -1
  258. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  259. package/dist/orchestrator/execution/task/task-generation.js +19 -3
  260. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  261. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +2 -2
  262. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -1
  263. package/dist/orchestrator/execution/task/task-lifecycle-runner.js +31 -4
  264. package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -1
  265. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +3 -3
  266. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  267. package/dist/orchestrator/execution/task/task-lifecycle.js +51 -10
  268. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  269. package/dist/orchestrator/execution/task/task-outcome-ledger.d.ts +8 -0
  270. package/dist/orchestrator/execution/task/task-outcome-ledger.d.ts.map +1 -1
  271. package/dist/orchestrator/execution/task/task-outcome-ledger.js +59 -3
  272. package/dist/orchestrator/execution/task/task-outcome-ledger.js.map +1 -1
  273. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts +3 -1
  274. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts.map +1 -1
  275. package/dist/orchestrator/execution/task/task-prompt-builder.js +23 -12
  276. package/dist/orchestrator/execution/task/task-prompt-builder.js.map +1 -1
  277. package/dist/orchestrator/execution/task/task-verifier-rules.d.ts +3 -2
  278. package/dist/orchestrator/execution/task/task-verifier-rules.d.ts.map +1 -1
  279. package/dist/orchestrator/execution/task/task-verifier-rules.js +328 -90
  280. package/dist/orchestrator/execution/task/task-verifier-rules.js.map +1 -1
  281. package/dist/orchestrator/execution/task/task-verifier-types.d.ts +13 -0
  282. package/dist/orchestrator/execution/task/task-verifier-types.d.ts.map +1 -1
  283. package/dist/orchestrator/execution/task/task-verifier-types.js.map +1 -1
  284. package/dist/orchestrator/execution/task/task-verifier.d.ts +5 -4
  285. package/dist/orchestrator/execution/task/task-verifier.d.ts.map +1 -1
  286. package/dist/orchestrator/execution/task/task-verifier.js +229 -22
  287. package/dist/orchestrator/execution/task/task-verifier.js.map +1 -1
  288. package/dist/orchestrator/execution/task/task-workspace.d.ts +5 -0
  289. package/dist/orchestrator/execution/task/task-workspace.d.ts.map +1 -1
  290. package/dist/orchestrator/execution/task/task-workspace.js +20 -10
  291. package/dist/orchestrator/execution/task/task-workspace.js.map +1 -1
  292. package/dist/orchestrator/execution/types/task-group.d.ts +76 -5
  293. package/dist/orchestrator/execution/types/task-group.d.ts.map +1 -1
  294. package/dist/orchestrator/execution/types/task.d.ts +117 -3
  295. package/dist/orchestrator/execution/types/task.d.ts.map +1 -1
  296. package/dist/orchestrator/execution/types/task.js +12 -0
  297. package/dist/orchestrator/execution/types/task.js.map +1 -1
  298. package/dist/orchestrator/loop/durable-loop/preparation.d.ts.map +1 -1
  299. package/dist/orchestrator/loop/durable-loop/preparation.js +7 -1
  300. package/dist/orchestrator/loop/durable-loop/preparation.js.map +1 -1
  301. package/dist/platform/corrections/memory-correction-ledger.d.ts +30 -30
  302. package/dist/platform/corrections/memory-governance.d.ts +2 -2
  303. package/dist/platform/knowledge/types/agent-memory.d.ts +30 -30
  304. package/dist/platform/observation/context-provider/collector.d.ts.map +1 -1
  305. package/dist/platform/observation/context-provider/collector.js +89 -24
  306. package/dist/platform/observation/context-provider/collector.js.map +1 -1
  307. package/dist/platform/observation/data-source-adapter.d.ts +2 -0
  308. package/dist/platform/observation/data-source-adapter.d.ts.map +1 -1
  309. package/dist/platform/observation/data-source-adapter.js.map +1 -1
  310. package/dist/platform/observation/observation-apply.d.ts.map +1 -1
  311. package/dist/platform/observation/observation-apply.js +8 -2
  312. package/dist/platform/observation/observation-apply.js.map +1 -1
  313. package/dist/platform/observation/observation-engine.d.ts.map +1 -1
  314. package/dist/platform/observation/observation-engine.js +118 -70
  315. package/dist/platform/observation/observation-engine.js.map +1 -1
  316. package/dist/platform/observation/observation-helpers.d.ts +2 -0
  317. package/dist/platform/observation/observation-helpers.d.ts.map +1 -1
  318. package/dist/platform/observation/observation-helpers.js.map +1 -1
  319. package/dist/platform/observation/types/data-source.d.ts +48 -0
  320. package/dist/platform/observation/types/data-source.d.ts.map +1 -1
  321. package/dist/platform/observation/types/data-source.js +4 -0
  322. package/dist/platform/observation/types/data-source.js.map +1 -1
  323. package/dist/platform/observation/workspace-context.d.ts.map +1 -1
  324. package/dist/platform/observation/workspace-context.js +13 -18
  325. package/dist/platform/observation/workspace-context.js.map +1 -1
  326. package/dist/platform/soil/contracts.d.ts +56 -56
  327. package/dist/reporting/types/report.d.ts +7 -0
  328. package/dist/reporting/types/report.d.ts.map +1 -1
  329. package/dist/runtime/approval-broker.d.ts +12 -0
  330. package/dist/runtime/approval-broker.d.ts.map +1 -1
  331. package/dist/runtime/approval-broker.js +27 -7
  332. package/dist/runtime/approval-broker.js.map +1 -1
  333. package/dist/runtime/control/daemon-runtime-control-executor.d.ts.map +1 -1
  334. package/dist/runtime/control/daemon-runtime-control-executor.js +9 -4
  335. package/dist/runtime/control/daemon-runtime-control-executor.js.map +1 -1
  336. package/dist/runtime/control/runtime-control-intent.d.ts.map +1 -1
  337. package/dist/runtime/control/runtime-control-intent.js +3 -2
  338. package/dist/runtime/control/runtime-control-intent.js.map +1 -1
  339. package/dist/runtime/control/runtime-control-service.d.ts +2 -1
  340. package/dist/runtime/control/runtime-control-service.d.ts.map +1 -1
  341. package/dist/runtime/control/runtime-control-service.js +9 -2
  342. package/dist/runtime/control/runtime-control-service.js.map +1 -1
  343. package/dist/runtime/control/runtime-target-resolver.js +2 -0
  344. package/dist/runtime/control/runtime-target-resolver.js.map +1 -1
  345. package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
  346. package/dist/runtime/daemon/runner-goal-cycle.js +1 -2
  347. package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
  348. package/dist/runtime/daemon/runner-recovery.d.ts +17 -3
  349. package/dist/runtime/daemon/runner-recovery.d.ts.map +1 -1
  350. package/dist/runtime/daemon/runner-recovery.js +50 -12
  351. package/dist/runtime/daemon/runner-recovery.js.map +1 -1
  352. package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
  353. package/dist/runtime/daemon/runner-startup.js +18 -1
  354. package/dist/runtime/daemon/runner-startup.js.map +1 -1
  355. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  356. package/dist/runtime/daemon/runner.js +3 -2
  357. package/dist/runtime/daemon/runner.js.map +1 -1
  358. package/dist/runtime/daemon/runtime-ownership.d.ts +0 -1
  359. package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -1
  360. package/dist/runtime/daemon/runtime-ownership.js +18 -18
  361. package/dist/runtime/daemon/runtime-ownership.js.map +1 -1
  362. package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
  363. package/dist/runtime/daemon/wait-deadline-resolver.js +2 -0
  364. package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
  365. package/dist/runtime/evidence-answer.d.ts.map +1 -1
  366. package/dist/runtime/evidence-answer.js +34 -7
  367. package/dist/runtime/evidence-answer.js.map +1 -1
  368. package/dist/runtime/gateway/channel-adapter.d.ts +3 -0
  369. package/dist/runtime/gateway/channel-adapter.d.ts.map +1 -1
  370. package/dist/runtime/gateway/channel-display-policy.d.ts +42 -0
  371. package/dist/runtime/gateway/channel-display-policy.d.ts.map +1 -0
  372. package/dist/runtime/gateway/channel-display-policy.js +85 -0
  373. package/dist/runtime/gateway/channel-display-policy.js.map +1 -0
  374. package/dist/runtime/gateway/chat-event-rendering.d.ts +2 -1
  375. package/dist/runtime/gateway/chat-event-rendering.d.ts.map +1 -1
  376. package/dist/runtime/gateway/chat-event-rendering.js +2 -0
  377. package/dist/runtime/gateway/chat-event-rendering.js.map +1 -1
  378. package/dist/runtime/gateway/chat-session-dispatch.d.ts.map +1 -1
  379. package/dist/runtime/gateway/chat-session-dispatch.js +4 -9
  380. package/dist/runtime/gateway/chat-session-dispatch.js.map +1 -1
  381. package/dist/runtime/gateway/chat-session-port.d.ts +2 -0
  382. package/dist/runtime/gateway/chat-session-port.d.ts.map +1 -1
  383. package/dist/runtime/gateway/chat-session-port.js.map +1 -1
  384. package/dist/runtime/gateway/discord-gateway-adapter.d.ts +4 -0
  385. package/dist/runtime/gateway/discord-gateway-adapter.d.ts.map +1 -1
  386. package/dist/runtime/gateway/discord-gateway-adapter.js +100 -31
  387. package/dist/runtime/gateway/discord-gateway-adapter.js.map +1 -1
  388. package/dist/runtime/gateway/index.d.ts +4 -0
  389. package/dist/runtime/gateway/index.d.ts.map +1 -1
  390. package/dist/runtime/gateway/index.js +2 -0
  391. package/dist/runtime/gateway/index.js.map +1 -1
  392. package/dist/runtime/gateway/non-tui-display-projector.d.ts +40 -0
  393. package/dist/runtime/gateway/non-tui-display-projector.d.ts.map +1 -0
  394. package/dist/runtime/gateway/non-tui-display-projector.js +166 -0
  395. package/dist/runtime/gateway/non-tui-display-projector.js.map +1 -0
  396. package/dist/runtime/gateway/signal-gateway-adapter.d.ts +1 -0
  397. package/dist/runtime/gateway/signal-gateway-adapter.d.ts.map +1 -1
  398. package/dist/runtime/gateway/signal-gateway-adapter.js +47 -4
  399. package/dist/runtime/gateway/signal-gateway-adapter.js.map +1 -1
  400. package/dist/runtime/gateway/slack-channel-adapter.d.ts +1 -0
  401. package/dist/runtime/gateway/slack-channel-adapter.d.ts.map +1 -1
  402. package/dist/runtime/gateway/slack-channel-adapter.js +93 -18
  403. package/dist/runtime/gateway/slack-channel-adapter.js.map +1 -1
  404. package/dist/runtime/gateway/telegram-gateway-adapter.d.ts +2 -0
  405. package/dist/runtime/gateway/telegram-gateway-adapter.d.ts.map +1 -1
  406. package/dist/runtime/gateway/telegram-gateway-adapter.js +61 -113
  407. package/dist/runtime/gateway/telegram-gateway-adapter.js.map +1 -1
  408. package/dist/runtime/gateway/whatsapp-gateway-adapter.d.ts +1 -0
  409. package/dist/runtime/gateway/whatsapp-gateway-adapter.d.ts.map +1 -1
  410. package/dist/runtime/gateway/whatsapp-gateway-adapter.js +49 -4
  411. package/dist/runtime/gateway/whatsapp-gateway-adapter.js.map +1 -1
  412. package/dist/runtime/permission-dialogue.d.ts +113 -0
  413. package/dist/runtime/permission-dialogue.d.ts.map +1 -0
  414. package/dist/runtime/permission-dialogue.js +82 -0
  415. package/dist/runtime/permission-dialogue.js.map +1 -0
  416. package/dist/runtime/run-spec/derive.d.ts +14 -14
  417. package/dist/runtime/run-spec/handoff.js +2 -0
  418. package/dist/runtime/run-spec/handoff.js.map +1 -1
  419. package/dist/runtime/run-spec/types.d.ts +16 -16
  420. package/dist/runtime/session-registry/types.d.ts +12 -12
  421. package/dist/runtime/store/artifact-retention.d.ts +2 -0
  422. package/dist/runtime/store/artifact-retention.d.ts.map +1 -1
  423. package/dist/runtime/store/artifact-retention.js +24 -21
  424. package/dist/runtime/store/artifact-retention.js.map +1 -1
  425. package/dist/runtime/store/budget-store.d.ts +8 -8
  426. package/dist/runtime/store/evidence-ledger.d.ts.map +1 -1
  427. package/dist/runtime/store/evidence-ledger.js +39 -1
  428. package/dist/runtime/store/evidence-ledger.js.map +1 -1
  429. package/dist/runtime/store/evidence-types.d.ts +118 -118
  430. package/dist/runtime/store/experiment-queue-store.d.ts +20 -20
  431. package/dist/runtime/store/reproducibility-manifest.d.ts +20 -20
  432. package/dist/runtime/store/runtime-operation-schemas.d.ts +18 -18
  433. package/dist/runtime/store/runtime-operation-schemas.d.ts.map +1 -1
  434. package/dist/runtime/store/runtime-operation-schemas.js +1 -0
  435. package/dist/runtime/store/runtime-operation-schemas.js.map +1 -1
  436. package/dist/runtime/store/runtime-schemas.d.ts +58 -28
  437. package/dist/runtime/store/runtime-schemas.d.ts.map +1 -1
  438. package/dist/runtime/store/runtime-schemas.js +1 -0
  439. package/dist/runtime/store/runtime-schemas.js.map +1 -1
  440. package/dist/tools/execution/MemorySaveTool/MemorySaveTool.d.ts +8 -8
  441. package/dist/tools/execution/RunAdapterTool/RunAdapterTool.d.ts +6 -0
  442. package/dist/tools/execution/RunAdapterTool/RunAdapterTool.d.ts.map +1 -1
  443. package/dist/tools/execution/RunAdapterTool/RunAdapterTool.js +2 -0
  444. package/dist/tools/execution/RunAdapterTool/RunAdapterTool.js.map +1 -1
  445. package/dist/tools/execution-orchestrator.d.ts +29 -0
  446. package/dist/tools/execution-orchestrator.d.ts.map +1 -0
  447. package/dist/tools/execution-orchestrator.js +153 -0
  448. package/dist/tools/execution-orchestrator.js.map +1 -0
  449. package/dist/tools/executor.d.ts +6 -0
  450. package/dist/tools/executor.d.ts.map +1 -1
  451. package/dist/tools/executor.js +48 -11
  452. package/dist/tools/executor.js.map +1 -1
  453. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.d.ts.map +1 -1
  454. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js +130 -17
  455. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js.map +1 -1
  456. package/dist/tools/mutation/TaskStopTool/TaskStopTool.d.ts.map +1 -1
  457. package/dist/tools/mutation/TaskStopTool/TaskStopTool.js +8 -0
  458. package/dist/tools/mutation/TaskStopTool/TaskStopTool.js.map +1 -1
  459. package/dist/tools/mutation/TaskUpdateTool/TaskUpdateTool.d.ts +6 -6
  460. package/dist/tools/network/GitHubCliTool/GitHubCliTool.d.ts +4 -4
  461. package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts +4 -4
  462. package/dist/tools/permission.d.ts +0 -1
  463. package/dist/tools/permission.d.ts.map +1 -1
  464. package/dist/tools/permission.js +9 -33
  465. package/dist/tools/permission.js.map +1 -1
  466. package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.d.ts +4 -4
  467. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts +8 -8
  468. package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts +4 -4
  469. package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +4 -4
  470. package/dist/tools/query/runtime-session-tools.d.ts +73 -5
  471. package/dist/tools/query/runtime-session-tools.d.ts.map +1 -1
  472. package/dist/tools/query/runtime-session-tools.js +114 -0
  473. package/dist/tools/query/runtime-session-tools.js.map +1 -1
  474. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +60 -42
  475. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -1
  476. package/dist/tools/runtime/LongRunningRuntimeTools.js +4 -1
  477. package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -1
  478. package/dist/tools/runtime/RunSpecHandoffTools.d.ts.map +1 -1
  479. package/dist/tools/runtime/RunSpecHandoffTools.js +162 -2
  480. package/dist/tools/runtime/RunSpecHandoffTools.js.map +1 -1
  481. package/dist/tools/runtime/SetupRuntimeControlTools.d.ts.map +1 -1
  482. package/dist/tools/runtime/SetupRuntimeControlTools.js +169 -17
  483. package/dist/tools/runtime/SetupRuntimeControlTools.js.map +1 -1
  484. package/dist/tools/system/GitDiffTool/GitDiffTool.d.ts +4 -4
  485. package/dist/tools/system/ShellCommandTool/ShellCommandTool.d.ts.map +1 -1
  486. package/dist/tools/system/ShellCommandTool/ShellCommandTool.js +7 -1
  487. package/dist/tools/system/ShellCommandTool/ShellCommandTool.js.map +1 -1
  488. package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
  489. package/dist/tools/system/ShellTool/ShellTool.js +24 -10
  490. package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
  491. package/dist/tools/system/ShellTool/command-policy.d.ts +11 -8
  492. package/dist/tools/system/ShellTool/command-policy.d.ts.map +1 -1
  493. package/dist/tools/system/ShellTool/command-policy.js +402 -98
  494. package/dist/tools/system/ShellTool/command-policy.js.map +1 -1
  495. package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts +1 -1
  496. package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts.map +1 -1
  497. package/dist/tools/system/TestRunnerTool/TestRunnerTool.js +152 -8
  498. package/dist/tools/system/TestRunnerTool/TestRunnerTool.js.map +1 -1
  499. package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.js +1 -1
  500. package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.js.map +1 -1
  501. package/dist/tools/types.d.ts +34 -12
  502. package/dist/tools/types.d.ts.map +1 -1
  503. package/dist/tools/types.js +26 -3
  504. package/dist/tools/types.js.map +1 -1
  505. package/dist/tools/workspace-scope.d.ts +11 -0
  506. package/dist/tools/workspace-scope.d.ts.map +1 -0
  507. package/dist/tools/workspace-scope.js +77 -0
  508. package/dist/tools/workspace-scope.js.map +1 -0
  509. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
1
3
  function uniqueNonEmpty(values) {
2
4
  return [...new Set(values.map((value) => value.trim()).filter((value) => value.length > 0))];
3
5
  }
@@ -6,46 +8,296 @@ function readStdoutFromExecError(error) {
6
8
  typeof error === "object" &&
7
9
  "stdout" in error &&
8
10
  typeof error.stdout === "string") {
9
- return error.stdout;
11
+ const stdout = error.stdout;
12
+ return stdout.length > 0 ? stdout : null;
10
13
  }
11
14
  if (error &&
12
15
  typeof error === "object" &&
13
16
  "stdout" in error &&
14
17
  Buffer.isBuffer(error.stdout)) {
15
- return (error.stdout).toString("utf-8");
18
+ const stdout = (error.stdout).toString("utf-8");
19
+ return stdout.length > 0 ? stdout : null;
16
20
  }
17
21
  return null;
18
22
  }
19
23
  function runGitRead(execFileSyncFn, cwd, args) {
20
24
  try {
21
- return execFileSyncFn("git", args, { cwd, encoding: "utf-8" });
25
+ return execFileSyncFn("git", args, { cwd, encoding: "utf-8", stdio: "pipe" });
22
26
  }
23
27
  catch (error) {
24
28
  return readStdoutFromExecError(error);
25
29
  }
26
30
  }
27
- export function captureExecutionDiffArtifacts(execFileSyncFn, cwd) {
31
+ function normalizeCwd(cwd) {
32
+ try {
33
+ return fs.realpathSync(cwd);
34
+ }
35
+ catch {
36
+ return path.resolve(cwd);
37
+ }
38
+ }
39
+ function captureGitChangedPaths(execFileSyncFn, cwd) {
28
40
  const trackedOutput = runGitRead(execFileSyncFn, cwd, ["diff", "--name-only"]);
41
+ const stagedOutput = runGitRead(execFileSyncFn, cwd, ["diff", "--cached", "--name-only"]);
29
42
  const untrackedOutput = runGitRead(execFileSyncFn, cwd, ["ls-files", "--others", "--exclude-standard"]);
30
- const available = trackedOutput !== null || untrackedOutput !== null;
43
+ const available = trackedOutput !== null || stagedOutput !== null || untrackedOutput !== null;
31
44
  if (!available) {
32
- return { available: false, changedPaths: [], fileDiffs: [] };
45
+ return {
46
+ available: false,
47
+ trackedPaths: [],
48
+ stagedPaths: [],
49
+ untrackedPaths: [],
50
+ changedPaths: [],
51
+ };
33
52
  }
34
53
  const trackedPaths = (trackedOutput ?? "").split("\n");
54
+ const stagedPaths = (stagedOutput ?? "").split("\n");
35
55
  const untrackedPaths = (untrackedOutput ?? "").split("\n");
36
- const changedPaths = uniqueNonEmpty([...trackedPaths, ...untrackedPaths]);
37
- const untrackedSet = new Set(uniqueNonEmpty(untrackedPaths));
38
- const fileDiffs = changedPaths.flatMap((path) => {
39
- const trackedPatch = runGitRead(execFileSyncFn, cwd, ["diff", "--", path])?.trim() ?? "";
40
- if (trackedPatch.length > 0) {
41
- return [{ path, patch: trackedPatch }];
56
+ const changedPaths = uniqueNonEmpty([...trackedPaths, ...stagedPaths, ...untrackedPaths])
57
+ .filter((filePath) => isSafeRelativePath(cwd, filePath));
58
+ return {
59
+ available: true,
60
+ trackedPaths,
61
+ stagedPaths,
62
+ untrackedPaths,
63
+ changedPaths,
64
+ };
65
+ }
66
+ export function captureExecutionDiffBaseline(execFileSyncFn, cwd) {
67
+ const normalizedCwd = normalizeCwd(cwd);
68
+ if (!hasGitMetadata(cwd)) {
69
+ return { available: false, cwd: normalizedCwd, changedPaths: [], pathFingerprints: {} };
70
+ }
71
+ const snapshot = captureGitChangedPaths(execFileSyncFn, cwd);
72
+ const untrackedSet = new Set(uniqueNonEmpty(snapshot.untrackedPaths));
73
+ const patchMap = readGitPathPatches(execFileSyncFn, cwd, snapshot);
74
+ return {
75
+ available: snapshot.available,
76
+ cwd: normalizedCwd,
77
+ changedPaths: snapshot.changedPaths,
78
+ pathFingerprints: Object.fromEntries(snapshot.changedPaths.map((filePath) => [
79
+ filePath,
80
+ patchMap.get(filePath) ?? (untrackedSet.has(filePath)
81
+ ? renderCurrentFileDiff(cwd, filePath, 200_000)[0]?.patch.trim() ?? ""
82
+ : ""),
83
+ ])),
84
+ };
85
+ }
86
+ function baselineChangedPathSetForCwd(baseline, cwd) {
87
+ if (!baseline?.available)
88
+ return undefined;
89
+ if (baseline.cwd !== normalizeCwd(cwd))
90
+ return undefined;
91
+ return new Set(baseline.changedPaths);
92
+ }
93
+ function baselinePathFingerprintsForCwd(baseline, cwd) {
94
+ if (!baseline?.available)
95
+ return undefined;
96
+ if (baseline.cwd !== normalizeCwd(cwd))
97
+ return undefined;
98
+ return new Map(Object.entries(baseline.pathFingerprints));
99
+ }
100
+ function readGitPathPatches(execFileSyncFn, cwd, snapshot) {
101
+ const patches = new Map();
102
+ const appendPatch = (filePath, patch) => {
103
+ const trimmed = patch.trim();
104
+ if (trimmed.length === 0)
105
+ return;
106
+ const existing = patches.get(filePath);
107
+ patches.set(filePath, existing ? `${existing}\n${trimmed}` : trimmed);
108
+ };
109
+ const trackedPaths = uniqueNonEmpty(snapshot.trackedPaths)
110
+ .filter((filePath) => isSafeRelativePath(cwd, filePath));
111
+ const stagedPaths = uniqueNonEmpty(snapshot.stagedPaths)
112
+ .filter((filePath) => isSafeRelativePath(cwd, filePath));
113
+ for (const [filePath, patch] of parseGitDiffByPath(trackedPaths.length > 0
114
+ ? runGitRead(execFileSyncFn, cwd, ["diff", "--", ...trackedPaths]) ?? ""
115
+ : "", trackedPaths)) {
116
+ appendPatch(filePath, patch);
117
+ }
118
+ for (const [filePath, patch] of parseGitDiffByPath(stagedPaths.length > 0
119
+ ? runGitRead(execFileSyncFn, cwd, ["diff", "--cached", "--", ...stagedPaths]) ?? ""
120
+ : "", stagedPaths)) {
121
+ appendPatch(filePath, patch);
122
+ }
123
+ return patches;
124
+ }
125
+ export function captureExecutionDiffArtifacts(execFileSyncFn, cwd, options = {}) {
126
+ const baselineChangedPaths = baselineChangedPathSetForCwd(options.baseline, cwd);
127
+ const baselinePathFingerprints = baselinePathFingerprintsForCwd(options.baseline, cwd);
128
+ const fallbackPaths = uniqueNonEmpty(options.fallbackChangedPaths ?? [])
129
+ .filter((filePath) => isSafeRelativePath(cwd, filePath));
130
+ if (!hasGitMetadata(cwd)) {
131
+ return renderFallbackDiffArtifacts(cwd, fallbackPaths, options.maxFallbackDiffBytes, baselineChangedPaths);
132
+ }
133
+ const snapshot = captureGitChangedPaths(execFileSyncFn, cwd);
134
+ if (!snapshot.available) {
135
+ return renderFallbackDiffArtifacts(cwd, fallbackPaths, options.maxFallbackDiffBytes, baselineChangedPaths);
136
+ }
137
+ const untrackedSet = new Set(uniqueNonEmpty(snapshot.untrackedPaths));
138
+ const patchMap = readGitPathPatches(execFileSyncFn, cwd, snapshot);
139
+ const changedPaths = [];
140
+ const fileDiffs = [];
141
+ for (const filePath of snapshot.changedPaths) {
142
+ const patch = patchMap.get(filePath)
143
+ ?? (untrackedSet.has(filePath)
144
+ ? renderCurrentFileDiff(cwd, filePath, options.maxFallbackDiffBytes ?? 200_000)[0]?.patch.trim() ?? ""
145
+ : "");
146
+ const baselinePatch = baselinePathFingerprints?.get(filePath);
147
+ if (baselinePatch !== undefined && patch === baselinePatch) {
148
+ continue;
42
149
  }
43
- if (!untrackedSet.has(path)) {
44
- return [];
150
+ changedPaths.push(filePath);
151
+ if (patch.length > 0) {
152
+ fileDiffs.push({
153
+ path: filePath,
154
+ patch,
155
+ ...(baselinePatch !== undefined ? { safe_to_revert: false } : {}),
156
+ });
45
157
  }
46
- const untrackedPatch = runGitRead(execFileSyncFn, cwd, ["diff", "--no-index", "--", "/dev/null", path])?.trim() ?? "";
47
- return untrackedPatch.length > 0 ? [{ path, patch: untrackedPatch }] : [];
48
- });
158
+ }
49
159
  return { available: true, changedPaths, fileDiffs };
50
160
  }
161
+ function parseGitDiffByPath(output, expectedPaths) {
162
+ const patches = new Map();
163
+ if (output.trim().length === 0)
164
+ return patches;
165
+ const expectedByLength = [...expectedPaths].sort((left, right) => right.length - left.length);
166
+ const sections = output.split(/^diff --git /m).filter((section) => section.trim().length > 0);
167
+ for (const section of sections) {
168
+ const patch = `diff --git ${section}`.trim();
169
+ const header = patch.split("\n", 1)[0] ?? "";
170
+ const filePath = expectedByLength.find((candidate) => header === `diff --git a/${candidate} b/${candidate}` ||
171
+ header.endsWith(` b/${candidate}`));
172
+ if (filePath) {
173
+ patches.set(filePath, patch);
174
+ }
175
+ }
176
+ return patches;
177
+ }
178
+ function renderFallbackDiffArtifacts(cwd, fallbackPaths, maxFallbackDiffBytes = 200_000, baselineChangedPaths) {
179
+ if (fallbackPaths.length === 0) {
180
+ return { available: false, changedPaths: [], fileDiffs: [] };
181
+ }
182
+ return {
183
+ available: true,
184
+ changedPaths: fallbackPaths,
185
+ fileDiffs: fallbackPaths.flatMap((filePath) => renderCurrentFileDiff(cwd, filePath, maxFallbackDiffBytes)
186
+ .map((diff) => ({
187
+ ...diff,
188
+ ...(baselineChangedPaths?.has(filePath) ? { safe_to_revert: false } : {}),
189
+ }))),
190
+ };
191
+ }
192
+ function hasGitMetadata(cwd) {
193
+ let current = path.resolve(cwd);
194
+ while (true) {
195
+ if (fs.existsSync(path.join(current, ".git")))
196
+ return true;
197
+ const parent = path.dirname(current);
198
+ if (parent === current)
199
+ return false;
200
+ current = parent;
201
+ }
202
+ }
203
+ function isSafeRelativePath(cwd, filePath) {
204
+ if (!filePath || filePath.includes("\0") || path.isAbsolute(filePath))
205
+ return false;
206
+ const root = path.resolve(cwd);
207
+ const resolved = path.resolve(root, filePath);
208
+ return resolved === root || resolved.startsWith(root + path.sep);
209
+ }
210
+ function isWithinRoot(root, candidate) {
211
+ return candidate === root || candidate.startsWith(root + path.sep);
212
+ }
213
+ function renderCurrentFileDiff(cwd, filePath, maxBytes) {
214
+ const resolved = path.resolve(cwd, filePath);
215
+ try {
216
+ const root = fs.realpathSync(cwd);
217
+ const realResolved = fs.realpathSync(resolved);
218
+ if (!isWithinRoot(root, realResolved)) {
219
+ return [{
220
+ path: filePath,
221
+ patch: [
222
+ `diff --git a/${filePath} b/${filePath}`,
223
+ `--- a/${filePath}`,
224
+ `+++ b/${filePath}`,
225
+ "@@ -0,0 +1 @@",
226
+ "+[non-git evidence] path resolves outside the workspace; content omitted",
227
+ "",
228
+ ].join("\n"),
229
+ }];
230
+ }
231
+ const stat = fs.statSync(realResolved);
232
+ if (!stat.isFile()) {
233
+ return [{
234
+ path: filePath,
235
+ patch: [
236
+ `diff --git a/${filePath} b/${filePath}`,
237
+ `--- a/${filePath}`,
238
+ `+++ b/${filePath}`,
239
+ "@@ -0,0 +1 @@",
240
+ `+[non-git evidence] path exists but is not a regular file (${stat.isDirectory() ? "directory" : "special file"})`,
241
+ "",
242
+ ].join("\n"),
243
+ }];
244
+ }
245
+ if (stat.size > maxBytes) {
246
+ return [{
247
+ path: filePath,
248
+ patch: [
249
+ `diff --git a/${filePath} b/${filePath}`,
250
+ `--- a/${filePath}`,
251
+ `+++ b/${filePath}`,
252
+ "@@ -0,0 +1 @@",
253
+ `+[non-git evidence] file exists; diff omitted because size ${stat.size} exceeds ${maxBytes} bytes`,
254
+ "",
255
+ ].join("\n"),
256
+ }];
257
+ }
258
+ const content = fs.readFileSync(realResolved, "utf-8");
259
+ if (content.includes("\0")) {
260
+ return [{
261
+ path: filePath,
262
+ patch: [
263
+ `diff --git a/${filePath} b/${filePath}`,
264
+ "new file mode 100644",
265
+ "--- /dev/null",
266
+ `+++ b/${filePath}`,
267
+ "@@ -0,0 +1 @@",
268
+ `+[non-git evidence] binary file exists; size ${stat.size} bytes`,
269
+ "",
270
+ ].join("\n"),
271
+ }];
272
+ }
273
+ const lines = content.length === 0
274
+ ? []
275
+ : content.replace(/\n$/, "").split("\n");
276
+ return [{
277
+ path: filePath,
278
+ patch: [
279
+ `diff --git a/${filePath} b/${filePath}`,
280
+ "new file mode 100644",
281
+ "--- /dev/null",
282
+ `+++ b/${filePath}`,
283
+ `@@ -0,0 +1,${lines.length} @@`,
284
+ ...lines.map((line) => `+${line}`),
285
+ "",
286
+ ].join("\n"),
287
+ }];
288
+ }
289
+ catch {
290
+ return [{
291
+ path: filePath,
292
+ patch: [
293
+ `diff --git a/${filePath} b/${filePath}`,
294
+ `--- a/${filePath}`,
295
+ "+++ /dev/null",
296
+ "@@ -1 +0,0 @@",
297
+ "-[non-git evidence] path was reported changed but is absent after execution",
298
+ "",
299
+ ].join("\n"),
300
+ }];
301
+ }
302
+ }
51
303
  //# sourceMappingURL=task-diff-capture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"task-diff-capture.js","sourceRoot":"","sources":["../../../../src/orchestrator/execution/task/task-diff-capture.ts"],"names":[],"mappings":"AAcA,SAAS,cAAc,CAAC,MAAgB;IACtC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC7C,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,QAAQ,IAAI,KAAK;QACjB,OAAQ,KAA8B,CAAC,MAAM,KAAK,QAAQ,EAC1D,CAAC;QACD,OAAQ,KAA4B,CAAC,MAAM,CAAC;IAC9C,CAAC;IAED,IACE,KAAK;QACL,OAAO,KAAK,KAAK,QAAQ;QACzB,QAAQ,IAAI,KAAK;QACjB,MAAM,CAAC,QAAQ,CAAE,KAA8B,CAAC,MAAM,CAAC,EACvD,CAAC;QACD,OAAO,CAAE,KAA4B,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC;AAC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,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC;YAChC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,CAAC;gBACN,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE;oBACL,gBAAgB,QAAQ,MAAM,QAAQ,EAAE;oBACxC,sBAAsB;oBACtB,eAAe;oBACf,SAAS,QAAQ,EAAE;oBACnB,cAAc,KAAK,CAAC,MAAM,KAAK;oBAC/B,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;oBAClC,EAAE;iBACH,CAAC,IAAI,CAAC,IAAI,CAAC;aACb,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC;gBACN,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE;oBACL,gBAAgB,QAAQ,MAAM,QAAQ,EAAE;oBACxC,SAAS,QAAQ,EAAE;oBACnB,eAAe;oBACf,eAAe;oBACf,6EAA6E;oBAC7E,EAAE;iBACH,CAAC,IAAI,CAAC,IAAI,CAAC;aACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -19,6 +19,7 @@ interface ExecuteTaskWithGuardsParams {
19
19
  cwd: string;
20
20
  encoding: "utf-8";
21
21
  }) => string;
22
+ fallbackCwd?: string;
22
23
  }
23
24
  export declare function executeTaskWithGuards(params: ExecuteTaskWithGuardsParams): Promise<AgentResult>;
24
25
  export declare function verifyExecutionWithGitDiff(toolExecutor: ToolExecutor | undefined, goalId: string): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"task-execution-helpers.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/execution/task/task-execution-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,UAAU,2BAA2B;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,QAAQ,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,MAAM,CAAC;CACnG;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,WAAW,CAAC,CA6GtB;AAeD,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA+BrD"}
1
+ {"version":3,"file":"task-execution-helpers.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/execution/task/task-execution-helpers.ts"],"names":[],"mappings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CA+BrD"}
@@ -1,7 +1,8 @@
1
- import { executeTask as executeTaskDirect } from "./task-executor.js";
2
- import { captureExecutionDiffArtifacts } from "./task-diff-capture.js";
1
+ import { applyPostExecutionDiffScopeChecks, executeTask as executeTaskDirect, } from "./task-executor.js";
2
+ import { captureExecutionDiffBaseline } from "./task-diff-capture.js";
3
+ import { resolveTaskWorkspacePath } from "./task-workspace.js";
3
4
  export async function executeTaskWithGuards(params) {
4
- const { task, adapter, workspaceContext, guardrailRunner, toolExecutor, adapterRegistry, stateManager, sessionManager, logger, execFileSyncFn, } = params;
5
+ const { task, adapter, workspaceContext, guardrailRunner, toolExecutor, adapterRegistry, stateManager, sessionManager, logger, execFileSyncFn, fallbackCwd, } = params;
5
6
  if (guardrailRunner) {
6
7
  const beforeResult = await guardrailRunner.run("before_tool", {
7
8
  checkpoint: "before_tool",
@@ -20,8 +21,10 @@ export async function executeTaskWithGuards(params) {
20
21
  };
21
22
  }
22
23
  }
24
+ let directFallbackDiffBaseline;
23
25
  if (toolExecutor) {
24
26
  try {
27
+ const workspaceCwd = await resolveTaskWorkspacePath({ stateManager, task, fallbackCwd });
25
28
  let trustBalance = 0;
26
29
  try {
27
30
  await stateManager.loadGoal(task.goal_id);
@@ -30,31 +33,47 @@ export async function executeTaskWithGuards(params) {
30
33
  // non-fatal, keep default trust balance
31
34
  }
32
35
  const toolCtx = {
33
- cwd: process.cwd(),
36
+ cwd: workspaceCwd ?? process.cwd(),
34
37
  goalId: task.goal_id,
35
38
  trustBalance,
36
39
  preApproved: true,
37
40
  approvalFn: async () => false,
38
41
  };
42
+ const diffBaseline = captureExecutionDiffBaseline(execFileSyncFn, toolCtx.cwd);
43
+ directFallbackDiffBaseline = diffBaseline;
39
44
  const toolResult = await toolExecutor.execute("run-adapter", {
40
45
  adapter_id: adapter.adapterType,
41
46
  task_description: task.work_description ?? "",
42
47
  goal_id: task.goal_id,
48
+ ...(workspaceCwd !== undefined ? { cwd: workspaceCwd } : {}),
43
49
  }, toolCtx);
44
- if (toolResult.success && toolResult.data != null) {
45
- const result = toolResult.data;
46
- const goal = await stateManager.loadGoal(task.goal_id).catch(() => null);
47
- const workspaceCwd = goal?.constraints.find((constraint) => constraint.startsWith("workspace_path:"))
48
- ?.slice("workspace_path:".length);
49
- const diffArtifacts = captureExecutionDiffArtifacts(execFileSyncFn, workspaceCwd ?? process.cwd());
50
- if (diffArtifacts.available) {
51
- result.filesChangedPaths = diffArtifacts.changedPaths;
52
- result.fileDiffs = diffArtifacts.fileDiffs;
53
- result.filesChanged = diffArtifacts.changedPaths.length > 0;
50
+ if (toolResult.data != null) {
51
+ if (isAgentResult(toolResult.data)) {
52
+ const result = toolResult.data;
53
+ await applyPostExecutionDiffScopeChecks({
54
+ result,
55
+ taskId: task.id,
56
+ cwd: workspaceCwd ?? process.cwd(),
57
+ execFileSyncFn,
58
+ logger,
59
+ fallbackChangedPaths: result.filesChangedPaths,
60
+ baseline: diffBaseline,
61
+ });
62
+ return result;
54
63
  }
55
- return result;
64
+ logger?.warn?.("[TaskLifecycle] run-adapter tool returned an invalid adapter result after execution");
65
+ return await buildInvalidRunAdapterResult({
66
+ taskId: task.id,
67
+ cwd: workspaceCwd ?? process.cwd(),
68
+ execFileSyncFn,
69
+ logger,
70
+ baseline: diffBaseline,
71
+ reason: "run-adapter returned invalid or truncated adapter result",
72
+ });
73
+ }
74
+ else {
75
+ logger?.warn?.(`[TaskLifecycle] run-adapter tool failed, falling back to direct call: ${toolResult.error ?? "unknown"}`);
56
76
  }
57
- logger?.warn?.(`[TaskLifecycle] run-adapter tool failed, falling back to direct call: ${toolResult.error ?? "unknown"}`);
58
77
  }
59
78
  catch (err) {
60
79
  logger?.warn?.(`[TaskLifecycle] run-adapter tool threw, falling back to direct call: ${err.message}`);
@@ -65,7 +84,8 @@ export async function executeTaskWithGuards(params) {
65
84
  sessionManager,
66
85
  logger,
67
86
  execFileSyncFn,
68
- }, task, adapter, workspaceContext);
87
+ fallbackCwd,
88
+ }, task, adapter, workspaceContext, undefined, { diffBaseline: directFallbackDiffBaseline });
69
89
  recordAdapterCircuitOutcome(adapterRegistry, adapter.adapterType, result);
70
90
  if (guardrailRunner) {
71
91
  const afterResult = await guardrailRunner.run("after_tool", {
@@ -87,6 +107,45 @@ export async function executeTaskWithGuards(params) {
87
107
  }
88
108
  return result;
89
109
  }
110
+ async function buildInvalidRunAdapterResult(input) {
111
+ const result = {
112
+ success: true,
113
+ output: "",
114
+ error: null,
115
+ exit_code: null,
116
+ elapsed_ms: 0,
117
+ stopped_reason: "completed",
118
+ };
119
+ await applyPostExecutionDiffScopeChecks({
120
+ result,
121
+ taskId: input.taskId,
122
+ cwd: input.cwd,
123
+ execFileSyncFn: input.execFileSyncFn,
124
+ logger: input.logger,
125
+ baseline: input.baseline,
126
+ });
127
+ const scopeError = result.error;
128
+ result.success = false;
129
+ result.error = scopeError ? `${input.reason}; ${scopeError}` : input.reason;
130
+ result.output = [
131
+ result.output,
132
+ `[Execution Result] ${input.reason}`,
133
+ ].filter((value) => value.length > 0).join("\n");
134
+ result.exit_code = null;
135
+ result.stopped_reason = "error";
136
+ return result;
137
+ }
138
+ function isAgentResult(value) {
139
+ if (typeof value !== "object" || value === null)
140
+ return false;
141
+ const candidate = value;
142
+ return (typeof candidate.success === "boolean"
143
+ && typeof candidate.output === "string"
144
+ && (typeof candidate.error === "string" || candidate.error === null)
145
+ && (typeof candidate.exit_code === "number" || candidate.exit_code === null)
146
+ && typeof candidate.elapsed_ms === "number"
147
+ && typeof candidate.stopped_reason === "string");
148
+ }
90
149
  function recordAdapterCircuitOutcome(adapterRegistry, adapterType, result) {
91
150
  if (!adapterRegistry)
92
151
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"task-execution-helpers.js","sourceRoot":"","sources":["../../../../src/orchestrator/execution/task/task-execution-helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,6BAA6B,EAAE,M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AY,GAAG,CAAC;YAC1B,WAAW,EAAE,GAAG,YAAY,QAAQ,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU;SAC5E,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IAC9D,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"task-execution-helpers.js","sourceRoot":"","sources":["../../../../src/orchestrator/execution/task/task-execution-helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,iCAAiC,EACjC,WAAW,IAAI,iBAAiB,GACjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAItE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAgB/D,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAmC;IAEnC,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,cAAc,EACd,MAAM,EACN,cAAc,EACd,WAAW,GACZ,GAAG,MAAM,CAAC;IAEX,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,aAAa,EAAE;YAC5D,UAAU,EAAE,aAAa;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,WAAW,EAAE;SACnD,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,uBAAuB,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,C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,CAAC;YAC1B,WAAW,EAAE,GAAG,YAAY,QAAQ,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,UAAU;SAC5E,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IAC9D,CAAC;AACH,CAAC"}
@@ -4,6 +4,7 @@ import { SessionManager } from "../session-manager.js";
4
4
  import type { AgentResult, IAdapter } from "../adapter-layer.js";
5
5
  import type { Task } from "../../../base/types/task.js";
6
6
  import type { Strategy } from "../../../base/types/strategy.js";
7
+ import type { ExecutionDiffBaseline } from "./task-diff-capture.js";
7
8
  export interface TaskExecutorDeps {
8
9
  stateManager: StateManager;
9
10
  sessionManager: SessionManager;
@@ -12,6 +13,10 @@ export interface TaskExecutorDeps {
12
13
  cwd: string;
13
14
  encoding: "utf-8";
14
15
  }) => string;
16
+ fallbackCwd?: string;
17
+ }
18
+ interface ExecuteTaskOptions {
19
+ diffBaseline?: ExecutionDiffBaseline;
15
20
  }
16
21
  export declare function durationToMs(duration: {
17
22
  value: number;
@@ -23,9 +28,19 @@ export declare function durationToMs(duration: {
23
28
  * Creates a session, builds context, converts to AgentTask, executes
24
29
  * via adapter, ends session, and updates task status based on result.
25
30
  */
26
- export declare function executeTask(deps: TaskExecutorDeps, task: Task, adapter: IAdapter, workspaceContext?: string, activeStrategy?: Strategy): Promise<AgentResult>;
31
+ export declare function executeTask(deps: TaskExecutorDeps, task: Task, adapter: IAdapter, workspaceContext?: string, activeStrategy?: Strategy, options?: ExecuteTaskOptions): Promise<AgentResult>;
32
+ export declare function applyPostExecutionDiffScopeChecks(input: {
33
+ result: AgentResult;
34
+ taskId: string;
35
+ cwd: string;
36
+ execFileSyncFn: TaskExecutorDeps["execFileSyncFn"];
37
+ logger?: Logger;
38
+ fallbackChangedPaths?: string[];
39
+ baseline?: ExecutionDiffBaseline;
40
+ }): Promise<void>;
27
41
  /**
28
42
  * Reload a task from disk (falls back to in-memory task if unavailable).
29
43
  */
30
44
  export declare function reloadTaskFromDisk(stateManager: StateManager, task: Task): Promise<Task>;
45
+ export {};
31
46
  //# sourceMappingURL=task-executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task-executor.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/execution/task/task-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAa,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAShE,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,MAAM,CAAC;CACnG;AAID,wBAAgB,YAAY,CAAC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAQ9E;AAID;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,QAAQ,EACjB,gBAAgB,CAAC,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,QAAQ,GACxB,OAAO,CAAC,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