pulseed 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (910) hide show
  1. package/README.md +13 -9
  2. package/dist/adapters/datasources/artifact-metric-datasource.d.ts +18 -0
  3. package/dist/adapters/datasources/artifact-metric-datasource.d.ts.map +1 -0
  4. package/dist/adapters/datasources/artifact-metric-datasource.js +592 -0
  5. package/dist/adapters/datasources/artifact-metric-datasource.js.map +1 -0
  6. package/dist/adapters/types/mcp.d.ts +6 -6
  7. package/dist/base/state/state-manager-goal-state.d.ts +40 -0
  8. package/dist/base/state/state-manager-goal-state.d.ts.map +1 -0
  9. package/dist/base/state/state-manager-goal-state.js +235 -0
  10. package/dist/base/state/state-manager-goal-state.js.map +1 -0
  11. package/dist/base/state/state-manager.d.ts +0 -5
  12. package/dist/base/state/state-manager.d.ts.map +1 -1
  13. package/dist/base/state/state-manager.js +27 -273
  14. package/dist/base/state/state-manager.js.map +1 -1
  15. package/dist/base/types/goal-activation.d.ts +37 -0
  16. package/dist/base/types/goal-activation.d.ts.map +1 -0
  17. package/dist/base/types/goal-activation.js +13 -0
  18. package/dist/base/types/goal-activation.js.map +1 -0
  19. package/dist/index.d.ts +6 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +4 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/interface/chat/chat-history.d.ts +129 -0
  24. package/dist/interface/chat/chat-history.d.ts.map +1 -1
  25. package/dist/interface/chat/chat-history.js +135 -0
  26. package/dist/interface/chat/chat-history.js.map +1 -1
  27. package/dist/interface/chat/chat-runner-command-helpers.d.ts +50 -0
  28. package/dist/interface/chat/chat-runner-command-helpers.d.ts.map +1 -0
  29. package/dist/interface/chat/chat-runner-command-helpers.js +189 -0
  30. package/dist/interface/chat/chat-runner-command-helpers.js.map +1 -0
  31. package/dist/interface/chat/chat-runner-commands.d.ts +82 -0
  32. package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -0
  33. package/dist/interface/chat/chat-runner-commands.js +906 -0
  34. package/dist/interface/chat/chat-runner-commands.js.map +1 -0
  35. package/dist/interface/chat/chat-runner-event-bridge.d.ts +60 -0
  36. package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -0
  37. package/dist/interface/chat/chat-runner-event-bridge.js +377 -0
  38. package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -0
  39. package/dist/interface/chat/chat-runner-routes.d.ts +67 -0
  40. package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -0
  41. package/dist/interface/chat/chat-runner-routes.js +610 -0
  42. package/dist/interface/chat/chat-runner-routes.js.map +1 -0
  43. package/dist/interface/chat/chat-runner-runtime.d.ts +37 -0
  44. package/dist/interface/chat/chat-runner-runtime.d.ts.map +1 -0
  45. package/dist/interface/chat/chat-runner-runtime.js +236 -0
  46. package/dist/interface/chat/chat-runner-runtime.js.map +1 -0
  47. package/dist/interface/chat/chat-runner-state.d.ts +20 -0
  48. package/dist/interface/chat/chat-runner-state.d.ts.map +1 -0
  49. package/dist/interface/chat/chat-runner-state.js +157 -0
  50. package/dist/interface/chat/chat-runner-state.js.map +1 -0
  51. package/dist/interface/chat/chat-runner-support.d.ts +39 -0
  52. package/dist/interface/chat/chat-runner-support.d.ts.map +1 -0
  53. package/dist/interface/chat/chat-runner-support.js +170 -0
  54. package/dist/interface/chat/chat-runner-support.js.map +1 -0
  55. package/dist/interface/chat/chat-runner.d.ts +10 -153
  56. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  57. package/dist/interface/chat/chat-runner.js +330 -2643
  58. package/dist/interface/chat/chat-runner.js.map +1 -1
  59. package/dist/interface/chat/chat-session-store.d.ts +32 -0
  60. package/dist/interface/chat/chat-session-store.d.ts.map +1 -1
  61. package/dist/interface/chat/chat-session-store.js +100 -10
  62. package/dist/interface/chat/chat-session-store.js.map +1 -1
  63. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
  64. package/dist/interface/chat/cross-platform-session.js +15 -6
  65. package/dist/interface/chat/cross-platform-session.js.map +1 -1
  66. package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
  67. package/dist/interface/chat/event-subscriber.js +61 -0
  68. package/dist/interface/chat/event-subscriber.js.map +1 -1
  69. package/dist/interface/chat/failure-recovery.d.ts +43 -1
  70. package/dist/interface/chat/failure-recovery.d.ts.map +1 -1
  71. package/dist/interface/chat/failure-recovery.js +259 -89
  72. package/dist/interface/chat/failure-recovery.js.map +1 -1
  73. package/dist/interface/chat/ingress-router.d.ts +2 -26
  74. package/dist/interface/chat/ingress-router.d.ts.map +1 -1
  75. package/dist/interface/chat/ingress-router.js +14 -88
  76. package/dist/interface/chat/ingress-router.js.map +1 -1
  77. package/dist/interface/chat/tend-command.d.ts.map +1 -1
  78. package/dist/interface/chat/tend-command.js +3 -0
  79. package/dist/interface/chat/tend-command.js.map +1 -1
  80. package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
  81. package/dist/interface/cli/cli-command-registry.js +19 -3
  82. package/dist/interface/cli/cli-command-registry.js.map +1 -1
  83. package/dist/interface/cli/commands/daemon-shared.d.ts +33 -0
  84. package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -0
  85. package/dist/interface/cli/commands/daemon-shared.js +152 -0
  86. package/dist/interface/cli/commands/daemon-shared.js.map +1 -0
  87. package/dist/interface/cli/commands/daemon.d.ts +2 -2
  88. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  89. package/dist/interface/cli/commands/daemon.js +62 -127
  90. package/dist/interface/cli/commands/daemon.js.map +1 -1
  91. package/dist/interface/cli/commands/goal-read.d.ts.map +1 -1
  92. package/dist/interface/cli/commands/goal-read.js +10 -3
  93. package/dist/interface/cli/commands/goal-read.js.map +1 -1
  94. package/dist/interface/cli/commands/notify.d.ts.map +1 -1
  95. package/dist/interface/cli/commands/notify.js +7 -1
  96. package/dist/interface/cli/commands/notify.js.map +1 -1
  97. package/dist/interface/cli/commands/run.d.ts.map +1 -1
  98. package/dist/interface/cli/commands/run.js +29 -0
  99. package/dist/interface/cli/commands/run.js.map +1 -1
  100. package/dist/interface/cli/commands/runtime.d.ts +1 -1
  101. package/dist/interface/cli/commands/runtime.d.ts.map +1 -1
  102. package/dist/interface/cli/commands/runtime.js +407 -2
  103. package/dist/interface/cli/commands/runtime.js.map +1 -1
  104. package/dist/interface/cli/commands/schedule/history.d.ts.map +1 -1
  105. package/dist/interface/cli/commands/schedule/history.js +5 -1
  106. package/dist/interface/cli/commands/schedule/history.js.map +1 -1
  107. package/dist/interface/cli/commands/schedule.js +34 -4
  108. package/dist/interface/cli/commands/schedule.js.map +1 -1
  109. package/dist/interface/cli/data-source-bootstrap.d.ts.map +1 -1
  110. package/dist/interface/cli/data-source-bootstrap.js +25 -12
  111. package/dist/interface/cli/data-source-bootstrap.js.map +1 -1
  112. package/dist/interface/cli/setup.d.ts.map +1 -1
  113. package/dist/interface/cli/setup.js +14 -0
  114. package/dist/interface/cli/setup.js.map +1 -1
  115. package/dist/interface/cli/utils/loop-runner.d.ts.map +1 -1
  116. package/dist/interface/cli/utils/loop-runner.js +2 -1
  117. package/dist/interface/cli/utils/loop-runner.js.map +1 -1
  118. package/dist/interface/cli/utils.d.ts.map +1 -1
  119. package/dist/interface/cli/utils.js +8 -1
  120. package/dist/interface/cli/utils.js.map +1 -1
  121. package/dist/interface/tui/app.d.ts +4 -1
  122. package/dist/interface/tui/app.d.ts.map +1 -1
  123. package/dist/interface/tui/app.js +282 -11
  124. package/dist/interface/tui/app.js.map +1 -1
  125. package/dist/interface/tui/chat/suggestions.d.ts.map +1 -1
  126. package/dist/interface/tui/chat/suggestions.js +118 -4
  127. package/dist/interface/tui/chat/suggestions.js.map +1 -1
  128. package/dist/interface/tui/chat-surface.d.ts +2 -0
  129. package/dist/interface/tui/chat-surface.d.ts.map +1 -1
  130. package/dist/interface/tui/chat-surface.js +3 -0
  131. package/dist/interface/tui/chat-surface.js.map +1 -1
  132. package/dist/interface/tui/dashboard.d.ts +37 -1
  133. package/dist/interface/tui/dashboard.d.ts.map +1 -1
  134. package/dist/interface/tui/dashboard.js +264 -1
  135. package/dist/interface/tui/dashboard.js.map +1 -1
  136. package/dist/interface/tui/entry-approval.d.ts +8 -0
  137. package/dist/interface/tui/entry-approval.d.ts.map +1 -0
  138. package/dist/interface/tui/entry-approval.js +59 -0
  139. package/dist/interface/tui/entry-approval.js.map +1 -0
  140. package/dist/interface/tui/entry-daemon.d.ts +12 -0
  141. package/dist/interface/tui/entry-daemon.d.ts.map +1 -0
  142. package/dist/interface/tui/entry-daemon.js +74 -0
  143. package/dist/interface/tui/entry-daemon.js.map +1 -0
  144. package/dist/interface/tui/entry-deps.d.ts +24 -0
  145. package/dist/interface/tui/entry-deps.d.ts.map +1 -0
  146. package/dist/interface/tui/entry-deps.js +427 -0
  147. package/dist/interface/tui/entry-deps.js.map +1 -0
  148. package/dist/interface/tui/entry.d.ts +2 -4
  149. package/dist/interface/tui/entry.d.ts.map +1 -1
  150. package/dist/interface/tui/entry.js +11 -556
  151. package/dist/interface/tui/entry.js.map +1 -1
  152. package/dist/interface/tui/fullscreen-chat-render.d.ts +127 -0
  153. package/dist/interface/tui/fullscreen-chat-render.d.ts.map +1 -0
  154. package/dist/interface/tui/fullscreen-chat-render.js +667 -0
  155. package/dist/interface/tui/fullscreen-chat-render.js.map +1 -0
  156. package/dist/interface/tui/fullscreen-chat.d.ts +2 -111
  157. package/dist/interface/tui/fullscreen-chat.d.ts.map +1 -1
  158. package/dist/interface/tui/fullscreen-chat.js +4 -663
  159. package/dist/interface/tui/fullscreen-chat.js.map +1 -1
  160. package/dist/interface/tui/help-overlay.d.ts.map +1 -1
  161. package/dist/interface/tui/help-overlay.js +1 -1
  162. package/dist/interface/tui/help-overlay.js.map +1 -1
  163. package/dist/interface/tui/intent-recognizer.d.ts +8 -3
  164. package/dist/interface/tui/intent-recognizer.d.ts.map +1 -1
  165. package/dist/interface/tui/intent-recognizer.js +74 -68
  166. package/dist/interface/tui/intent-recognizer.js.map +1 -1
  167. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
  168. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +49 -0
  169. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
  170. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts.map +1 -1
  171. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js +2 -1
  172. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js.map +1 -1
  173. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +2 -0
  174. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
  175. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +31 -0
  176. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
  177. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +1 -0
  178. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
  179. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
  180. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +1 -0
  181. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
  182. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +36 -2
  183. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
  184. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -1
  185. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
  186. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +2 -1
  187. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
  188. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +19 -0
  189. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -1
  190. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +165 -14
  191. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
  192. package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts +1 -1
  193. package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts.map +1 -1
  194. package/dist/orchestrator/execution/agent-loop/core-phase-runner.js +10 -1
  195. package/dist/orchestrator/execution/agent-loop/core-phase-runner.js.map +1 -1
  196. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts +2 -0
  197. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts.map +1 -1
  198. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js +4 -0
  199. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js.map +1 -1
  200. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts +8 -8
  201. package/dist/orchestrator/execution/reflection-generator.d.ts +1 -0
  202. package/dist/orchestrator/execution/reflection-generator.d.ts.map +1 -1
  203. package/dist/orchestrator/execution/reflection-generator.js +10 -1
  204. package/dist/orchestrator/execution/reflection-generator.js.map +1 -1
  205. package/dist/orchestrator/execution/task/task-context-enricher.d.ts +2 -0
  206. package/dist/orchestrator/execution/task/task-context-enricher.d.ts.map +1 -1
  207. package/dist/orchestrator/execution/task/task-context-enricher.js +9 -4
  208. package/dist/orchestrator/execution/task/task-context-enricher.js.map +1 -1
  209. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts +5 -0
  210. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts.map +1 -0
  211. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js +6 -0
  212. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js.map +1 -0
  213. package/dist/orchestrator/execution/task/task-generation.d.ts +3 -1
  214. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  215. package/dist/orchestrator/execution/task/task-generation.js +25 -5
  216. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  217. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +77 -0
  218. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -0
  219. package/dist/orchestrator/execution/task/task-lifecycle-runner.js +188 -0
  220. package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -0
  221. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +17 -8
  222. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  223. package/dist/orchestrator/execution/task/task-lifecycle.js +144 -187
  224. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  225. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts +2 -1
  226. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts.map +1 -1
  227. package/dist/orchestrator/execution/task/task-prompt-builder.js +4 -2
  228. package/dist/orchestrator/execution/task/task-prompt-builder.js.map +1 -1
  229. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts +2 -0
  230. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts.map +1 -0
  231. package/dist/orchestrator/execution/task/task-verifier-internal.js +2 -0
  232. package/dist/orchestrator/execution/task/task-verifier-internal.js.map +1 -0
  233. package/dist/orchestrator/execution/types/pipeline.d.ts +6 -6
  234. package/dist/orchestrator/goal/goal-negotiator.d.ts.map +1 -1
  235. package/dist/orchestrator/goal/goal-negotiator.js +23 -3
  236. package/dist/orchestrator/goal/goal-negotiator.js.map +1 -1
  237. package/dist/orchestrator/goal/types/goal.d.ts +282 -0
  238. package/dist/orchestrator/goal/types/goal.d.ts.map +1 -1
  239. package/dist/orchestrator/goal/types/goal.js +20 -0
  240. package/dist/orchestrator/goal/types/goal.js.map +1 -1
  241. package/dist/orchestrator/loop/core-loop/contracts.d.ts +47 -3
  242. package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
  243. package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
  244. package/dist/orchestrator/loop/core-loop/decision-engine.d.ts.map +1 -1
  245. package/dist/orchestrator/loop/core-loop/decision-engine.js +4 -0
  246. package/dist/orchestrator/loop/core-loop/decision-engine.js.map +1 -1
  247. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts +48 -0
  248. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts.map +1 -0
  249. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js +377 -0
  250. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js.map +1 -0
  251. package/dist/orchestrator/loop/core-loop/evidence-ledger.js +1 -1
  252. package/dist/orchestrator/loop/core-loop/evidence-ledger.js.map +1 -1
  253. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts +7 -0
  254. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts.map +1 -0
  255. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js +43 -0
  256. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js.map +1 -0
  257. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts +14 -0
  258. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts.map +1 -0
  259. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js +41 -0
  260. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js.map +1 -0
  261. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +4 -2
  262. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
  263. package/dist/orchestrator/loop/core-loop/iteration-kernel.js +507 -87
  264. package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -1
  265. package/dist/orchestrator/loop/core-loop/phase-policy.d.ts.map +1 -1
  266. package/dist/orchestrator/loop/core-loop/phase-policy.js +40 -5
  267. package/dist/orchestrator/loop/core-loop/phase-policy.js.map +1 -1
  268. package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts +2 -0
  269. package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts.map +1 -1
  270. package/dist/orchestrator/loop/core-loop/phase-runtime.js +43 -2
  271. package/dist/orchestrator/loop/core-loop/phase-runtime.js.map +1 -1
  272. package/dist/orchestrator/loop/core-loop/phase-specs.d.ts +969 -2
  273. package/dist/orchestrator/loop/core-loop/phase-specs.d.ts.map +1 -1
  274. package/dist/orchestrator/loop/core-loop/phase-specs.js +198 -0
  275. package/dist/orchestrator/loop/core-loop/phase-specs.js.map +1 -1
  276. package/dist/orchestrator/loop/core-loop/public-research.d.ts +32 -0
  277. package/dist/orchestrator/loop/core-loop/public-research.d.ts.map +1 -0
  278. package/dist/orchestrator/loop/core-loop/public-research.js +112 -0
  279. package/dist/orchestrator/loop/core-loop/public-research.js.map +1 -0
  280. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts +9 -0
  281. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -0
  282. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +433 -0
  283. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -0
  284. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts +11 -0
  285. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts.map +1 -0
  286. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js +176 -0
  287. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js.map +1 -0
  288. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +7 -15
  289. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
  290. package/dist/orchestrator/loop/core-loop/task-cycle.js +17 -444
  291. package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
  292. package/dist/orchestrator/loop/core-loop.d.ts +18 -5
  293. package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
  294. package/dist/orchestrator/loop/core-loop.js +287 -17
  295. package/dist/orchestrator/loop/core-loop.js.map +1 -1
  296. package/dist/orchestrator/loop/loop-report-helper.d.ts.map +1 -1
  297. package/dist/orchestrator/loop/loop-report-helper.js +4 -0
  298. package/dist/orchestrator/loop/loop-report-helper.js.map +1 -1
  299. package/dist/orchestrator/loop/loop-result-types.d.ts +20 -1
  300. package/dist/orchestrator/loop/loop-result-types.d.ts.map +1 -1
  301. package/dist/orchestrator/loop/loop-result-types.js.map +1 -1
  302. package/dist/orchestrator/loop/post-loop-hooks.d.ts +1 -0
  303. package/dist/orchestrator/loop/post-loop-hooks.d.ts.map +1 -1
  304. package/dist/orchestrator/loop/post-loop-hooks.js +34 -1
  305. package/dist/orchestrator/loop/post-loop-hooks.js.map +1 -1
  306. package/dist/orchestrator/loop/run-policy.d.ts +10 -0
  307. package/dist/orchestrator/loop/run-policy.d.ts.map +1 -0
  308. package/dist/orchestrator/loop/run-policy.js +30 -0
  309. package/dist/orchestrator/loop/run-policy.js.map +1 -0
  310. package/dist/orchestrator/strategy/divergent-exploration.d.ts +37 -0
  311. package/dist/orchestrator/strategy/divergent-exploration.d.ts.map +1 -0
  312. package/dist/orchestrator/strategy/divergent-exploration.js +324 -0
  313. package/dist/orchestrator/strategy/divergent-exploration.js.map +1 -0
  314. package/dist/orchestrator/strategy/portfolio-manager.d.ts +3 -2
  315. package/dist/orchestrator/strategy/portfolio-manager.d.ts.map +1 -1
  316. package/dist/orchestrator/strategy/portfolio-manager.js +16 -11
  317. package/dist/orchestrator/strategy/portfolio-manager.js.map +1 -1
  318. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts +1 -1
  319. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts.map +1 -1
  320. package/dist/orchestrator/strategy/portfolio-rebalance.js +31 -9
  321. package/dist/orchestrator/strategy/portfolio-rebalance.js.map +1 -1
  322. package/dist/orchestrator/strategy/strategy-helpers.d.ts +108 -0
  323. package/dist/orchestrator/strategy/strategy-helpers.d.ts.map +1 -1
  324. package/dist/orchestrator/strategy/strategy-helpers.js +34 -2
  325. package/dist/orchestrator/strategy/strategy-helpers.js.map +1 -1
  326. package/dist/orchestrator/strategy/strategy-manager-base.d.ts +31 -2
  327. package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
  328. package/dist/orchestrator/strategy/strategy-manager-base.js +93 -12
  329. package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
  330. package/dist/orchestrator/strategy/strategy-manager.d.ts +1 -11
  331. package/dist/orchestrator/strategy/strategy-manager.d.ts.map +1 -1
  332. package/dist/orchestrator/strategy/strategy-manager.js +78 -19
  333. package/dist/orchestrator/strategy/strategy-manager.js.map +1 -1
  334. package/dist/orchestrator/strategy/types/cross-portfolio.d.ts +2 -2
  335. package/dist/orchestrator/strategy/types/strategy.d.ts +364 -0
  336. package/dist/orchestrator/strategy/types/strategy.d.ts.map +1 -1
  337. package/dist/orchestrator/strategy/types/strategy.js +43 -0
  338. package/dist/orchestrator/strategy/types/strategy.js.map +1 -1
  339. package/dist/platform/dream/dream-activation.d.ts +1 -1
  340. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts +18 -0
  341. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts.map +1 -0
  342. package/dist/platform/dream/dream-consolidator/fs-metrics.js +130 -0
  343. package/dist/platform/dream/dream-consolidator/fs-metrics.js.map +1 -0
  344. package/dist/platform/dream/dream-consolidator.d.ts +4 -14
  345. package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
  346. package/dist/platform/dream/dream-consolidator.js +46 -166
  347. package/dist/platform/dream/dream-consolidator.js.map +1 -1
  348. package/dist/platform/dream/dream-event-workflows.d.ts +6 -6
  349. package/dist/platform/dream/dream-soil-sync.d.ts +1 -0
  350. package/dist/platform/dream/dream-soil-sync.d.ts.map +1 -1
  351. package/dist/platform/dream/dream-soil-sync.js +8 -1
  352. package/dist/platform/dream/dream-soil-sync.js.map +1 -1
  353. package/dist/platform/dream/dream-types.d.ts +94 -89
  354. package/dist/platform/dream/dream-types.d.ts.map +1 -1
  355. package/dist/platform/dream/dream-types.js +1 -0
  356. package/dist/platform/dream/dream-types.js.map +1 -1
  357. package/dist/platform/dream/playbook-memory.d.ts +4 -4
  358. package/dist/platform/drive/metric-history.d.ts +61 -0
  359. package/dist/platform/drive/metric-history.d.ts.map +1 -0
  360. package/dist/platform/drive/metric-history.js +206 -0
  361. package/dist/platform/drive/metric-history.js.map +1 -0
  362. package/dist/platform/drive/progress-predictor.d.ts +7 -0
  363. package/dist/platform/drive/progress-predictor.d.ts.map +1 -1
  364. package/dist/platform/drive/progress-predictor.js +23 -0
  365. package/dist/platform/drive/progress-predictor.js.map +1 -1
  366. package/dist/platform/drive/stall-detector/analysis.d.ts +5 -0
  367. package/dist/platform/drive/stall-detector/analysis.d.ts.map +1 -0
  368. package/dist/platform/drive/stall-detector/analysis.js +55 -0
  369. package/dist/platform/drive/stall-detector/analysis.js.map +1 -0
  370. package/dist/platform/drive/stall-detector/repetitive.d.ts +3 -0
  371. package/dist/platform/drive/stall-detector/repetitive.d.ts.map +1 -0
  372. package/dist/platform/drive/stall-detector/repetitive.js +72 -0
  373. package/dist/platform/drive/stall-detector/repetitive.js.map +1 -0
  374. package/dist/platform/drive/stall-detector/thresholds.d.ts +10 -0
  375. package/dist/platform/drive/stall-detector/thresholds.d.ts.map +1 -0
  376. package/dist/platform/drive/stall-detector/thresholds.js +61 -0
  377. package/dist/platform/drive/stall-detector/thresholds.js.map +1 -0
  378. package/dist/platform/drive/stall-detector.d.ts +5 -21
  379. package/dist/platform/drive/stall-detector.d.ts.map +1 -1
  380. package/dist/platform/drive/stall-detector.js +47 -201
  381. package/dist/platform/drive/stall-detector.js.map +1 -1
  382. package/dist/platform/drive/types/satisficing.d.ts +2 -2
  383. package/dist/platform/drive/types/stall.d.ts +4 -0
  384. package/dist/platform/drive/types/stall.d.ts.map +1 -1
  385. package/dist/platform/drive/types/stall.js +1 -0
  386. package/dist/platform/drive/types/stall.js.map +1 -1
  387. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts +55 -0
  388. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts.map +1 -0
  389. package/dist/platform/knowledge/knowledge-manager-agent-memory.js +232 -0
  390. package/dist/platform/knowledge/knowledge-manager-agent-memory.js.map +1 -0
  391. package/dist/platform/knowledge/knowledge-manager-internals.d.ts +10 -0
  392. package/dist/platform/knowledge/knowledge-manager-internals.d.ts.map +1 -0
  393. package/dist/platform/knowledge/knowledge-manager-internals.js +43 -0
  394. package/dist/platform/knowledge/knowledge-manager-internals.js.map +1 -0
  395. package/dist/platform/knowledge/knowledge-manager-store.d.ts +13 -0
  396. package/dist/platform/knowledge/knowledge-manager-store.d.ts.map +1 -0
  397. package/dist/platform/knowledge/knowledge-manager-store.js +67 -0
  398. package/dist/platform/knowledge/knowledge-manager-store.js.map +1 -0
  399. package/dist/platform/knowledge/knowledge-manager.d.ts +6 -2
  400. package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
  401. package/dist/platform/knowledge/knowledge-manager.js +43 -344
  402. package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
  403. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts +4 -0
  404. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts.map +1 -0
  405. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js +106 -0
  406. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js.map +1 -0
  407. package/dist/platform/knowledge/memory/memory-lifecycle.d.ts.map +1 -1
  408. package/dist/platform/knowledge/memory/memory-lifecycle.js +6 -112
  409. package/dist/platform/knowledge/memory/memory-lifecycle.js.map +1 -1
  410. package/dist/platform/knowledge/types/learning.d.ts +2 -2
  411. package/dist/platform/observation/capability-detector/prompts.d.ts +18 -0
  412. package/dist/platform/observation/capability-detector/prompts.d.ts.map +1 -0
  413. package/dist/platform/observation/capability-detector/prompts.js +80 -0
  414. package/dist/platform/observation/capability-detector/prompts.js.map +1 -0
  415. package/dist/platform/observation/capability-detector/recommendations.d.ts +5 -0
  416. package/dist/platform/observation/capability-detector/recommendations.d.ts.map +1 -0
  417. package/dist/platform/observation/capability-detector/recommendations.js +76 -0
  418. package/dist/platform/observation/capability-detector/recommendations.js.map +1 -0
  419. package/dist/platform/observation/capability-detector/types.d.ts +112 -0
  420. package/dist/platform/observation/capability-detector/types.d.ts.map +1 -0
  421. package/dist/platform/observation/capability-detector/types.js +75 -0
  422. package/dist/platform/observation/capability-detector/types.js.map +1 -0
  423. package/dist/platform/observation/capability-detector.d.ts +4 -9
  424. package/dist/platform/observation/capability-detector.d.ts.map +1 -1
  425. package/dist/platform/observation/capability-detector.js +12 -212
  426. package/dist/platform/observation/capability-detector.js.map +1 -1
  427. package/dist/platform/observation/context-provider/collector.d.ts +13 -0
  428. package/dist/platform/observation/context-provider/collector.d.ts.map +1 -0
  429. package/dist/platform/observation/context-provider/collector.js +259 -0
  430. package/dist/platform/observation/context-provider/collector.js.map +1 -0
  431. package/dist/platform/observation/context-provider/search-terms.d.ts +2 -0
  432. package/dist/platform/observation/context-provider/search-terms.d.ts.map +1 -0
  433. package/dist/platform/observation/context-provider/search-terms.js +24 -0
  434. package/dist/platform/observation/context-provider/search-terms.js.map +1 -0
  435. package/dist/platform/observation/context-provider/shared.d.ts +17 -0
  436. package/dist/platform/observation/context-provider/shared.d.ts.map +1 -0
  437. package/dist/platform/observation/context-provider/shared.js +87 -0
  438. package/dist/platform/observation/context-provider/shared.js.map +1 -0
  439. package/dist/platform/observation/context-provider.d.ts +3 -28
  440. package/dist/platform/observation/context-provider.d.ts.map +1 -1
  441. package/dist/platform/observation/context-provider.js +7 -395
  442. package/dist/platform/observation/context-provider.js.map +1 -1
  443. package/dist/platform/observation/data-source-adapter.d.ts +1 -0
  444. package/dist/platform/observation/data-source-adapter.d.ts.map +1 -1
  445. package/dist/platform/observation/data-source-adapter.js.map +1 -1
  446. package/dist/platform/observation/observation-datasource.d.ts.map +1 -1
  447. package/dist/platform/observation/observation-datasource.js +2 -0
  448. package/dist/platform/observation/observation-datasource.js.map +1 -1
  449. package/dist/platform/observation/types/data-source.d.ts +153 -9
  450. package/dist/platform/observation/types/data-source.d.ts.map +1 -1
  451. package/dist/platform/observation/types/data-source.js +13 -1
  452. package/dist/platform/observation/types/data-source.js.map +1 -1
  453. package/dist/platform/soil/compiled-memory-projections.d.ts +2 -0
  454. package/dist/platform/soil/compiled-memory-projections.d.ts.map +1 -1
  455. package/dist/platform/soil/compiled-memory-projections.js +59 -0
  456. package/dist/platform/soil/compiled-memory-projections.js.map +1 -1
  457. package/dist/platform/soil/contracts.d.ts +67 -67
  458. package/dist/platform/soil/importer.d.ts +6 -6
  459. package/dist/platform/soil/retriever.d.ts +25 -0
  460. package/dist/platform/soil/retriever.d.ts.map +1 -1
  461. package/dist/platform/soil/retriever.js +94 -5
  462. package/dist/platform/soil/retriever.js.map +1 -1
  463. package/dist/platform/soil/sqlite-repository-helpers.d.ts +80 -0
  464. package/dist/platform/soil/sqlite-repository-helpers.d.ts.map +1 -0
  465. package/dist/platform/soil/sqlite-repository-helpers.js +143 -0
  466. package/dist/platform/soil/sqlite-repository-helpers.js.map +1 -0
  467. package/dist/platform/soil/sqlite-repository-search.d.ts +8 -0
  468. package/dist/platform/soil/sqlite-repository-search.d.ts.map +1 -0
  469. package/dist/platform/soil/sqlite-repository-search.js +367 -0
  470. package/dist/platform/soil/sqlite-repository-search.js.map +1 -0
  471. package/dist/platform/soil/sqlite-repository-storage.d.ts +8 -0
  472. package/dist/platform/soil/sqlite-repository-storage.d.ts.map +1 -0
  473. package/dist/platform/soil/sqlite-repository-storage.js +278 -0
  474. package/dist/platform/soil/sqlite-repository-storage.js.map +1 -0
  475. package/dist/platform/soil/sqlite-repository.d.ts +1 -4
  476. package/dist/platform/soil/sqlite-repository.d.ts.map +1 -1
  477. package/dist/platform/soil/sqlite-repository.js +26 -820
  478. package/dist/platform/soil/sqlite-repository.js.map +1 -1
  479. package/dist/platform/soil/types.d.ts +8 -8
  480. package/dist/platform/time/deadline-finalization.d.ts +57 -0
  481. package/dist/platform/time/deadline-finalization.d.ts.map +1 -0
  482. package/dist/platform/time/deadline-finalization.js +136 -0
  483. package/dist/platform/time/deadline-finalization.js.map +1 -0
  484. package/dist/platform/time/execution-mode.d.ts +29 -0
  485. package/dist/platform/time/execution-mode.d.ts.map +1 -0
  486. package/dist/platform/time/execution-mode.js +84 -0
  487. package/dist/platform/time/execution-mode.js.map +1 -0
  488. package/dist/platform/traits/types/curiosity.d.ts +9 -9
  489. package/dist/platform/traits/types/guardrail.d.ts +6 -6
  490. package/dist/reporting/report-formatters.d.ts.map +1 -1
  491. package/dist/reporting/report-formatters.js +67 -2
  492. package/dist/reporting/report-formatters.js.map +1 -1
  493. package/dist/reporting/reporting-engine.d.ts.map +1 -1
  494. package/dist/reporting/reporting-engine.js +3 -1
  495. package/dist/reporting/reporting-engine.js.map +1 -1
  496. package/dist/reporting/reporting-types.d.ts +4 -0
  497. package/dist/reporting/reporting-types.d.ts.map +1 -1
  498. package/dist/reporting/types/report.d.ts +59 -0
  499. package/dist/reporting/types/report.d.ts.map +1 -1
  500. package/dist/reporting/types/report.js +9 -0
  501. package/dist/reporting/types/report.js.map +1 -1
  502. package/dist/runtime/command-dispatcher.d.ts +2 -0
  503. package/dist/runtime/command-dispatcher.d.ts.map +1 -1
  504. package/dist/runtime/command-dispatcher.js +16 -0
  505. package/dist/runtime/command-dispatcher.js.map +1 -1
  506. package/dist/runtime/confirmation-decision.d.ts +94 -0
  507. package/dist/runtime/confirmation-decision.d.ts.map +1 -0
  508. package/dist/runtime/confirmation-decision.js +109 -0
  509. package/dist/runtime/confirmation-decision.js.map +1 -0
  510. package/dist/runtime/control/daemon-runtime-control-executor.d.ts.map +1 -1
  511. package/dist/runtime/control/daemon-runtime-control-executor.js +31 -1
  512. package/dist/runtime/control/daemon-runtime-control-executor.js.map +1 -1
  513. package/dist/runtime/control/runtime-control-intent.d.ts +9 -1
  514. package/dist/runtime/control/runtime-control-intent.d.ts.map +1 -1
  515. package/dist/runtime/control/runtime-control-intent.js +82 -16
  516. package/dist/runtime/control/runtime-control-intent.js.map +1 -1
  517. package/dist/runtime/control/runtime-control-service.d.ts +35 -1
  518. package/dist/runtime/control/runtime-control-service.d.ts.map +1 -1
  519. package/dist/runtime/control/runtime-control-service.js +285 -5
  520. package/dist/runtime/control/runtime-control-service.js.map +1 -1
  521. package/dist/runtime/daemon/client.d.ts +12 -0
  522. package/dist/runtime/daemon/client.d.ts.map +1 -1
  523. package/dist/runtime/daemon/client.js +9 -0
  524. package/dist/runtime/daemon/client.js.map +1 -1
  525. package/dist/runtime/daemon/index.d.ts +1 -1
  526. package/dist/runtime/daemon/index.d.ts.map +1 -1
  527. package/dist/runtime/daemon/index.js +1 -1
  528. package/dist/runtime/daemon/index.js.map +1 -1
  529. package/dist/runtime/daemon/maintenance.d.ts +2 -10
  530. package/dist/runtime/daemon/maintenance.d.ts.map +1 -1
  531. package/dist/runtime/daemon/maintenance.js +14 -45
  532. package/dist/runtime/daemon/maintenance.js.map +1 -1
  533. package/dist/runtime/daemon/runner-bootstrap.d.ts +25 -0
  534. package/dist/runtime/daemon/runner-bootstrap.d.ts.map +1 -0
  535. package/dist/runtime/daemon/runner-bootstrap.js +77 -0
  536. package/dist/runtime/daemon/runner-bootstrap.js.map +1 -0
  537. package/dist/runtime/daemon/runner-commands.d.ts +13 -9
  538. package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
  539. package/dist/runtime/daemon/runner-commands.js +272 -21
  540. package/dist/runtime/daemon/runner-commands.js.map +1 -1
  541. package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
  542. package/dist/runtime/daemon/runner-goal-cycle.js +62 -6
  543. package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
  544. package/dist/runtime/daemon/runner-resident-curiosity.d.ts +12 -0
  545. package/dist/runtime/daemon/runner-resident-curiosity.d.ts.map +1 -0
  546. package/dist/runtime/daemon/runner-resident-curiosity.js +155 -0
  547. package/dist/runtime/daemon/runner-resident-curiosity.js.map +1 -0
  548. package/dist/runtime/daemon/runner-resident-dream.d.ts +20 -0
  549. package/dist/runtime/daemon/runner-resident-dream.d.ts.map +1 -0
  550. package/dist/runtime/daemon/runner-resident-dream.js +148 -0
  551. package/dist/runtime/daemon/runner-resident-dream.js.map +1 -0
  552. package/dist/runtime/daemon/runner-resident-proactive.d.ts +4 -0
  553. package/dist/runtime/daemon/runner-resident-proactive.d.ts.map +1 -0
  554. package/dist/runtime/daemon/runner-resident-proactive.js +113 -0
  555. package/dist/runtime/daemon/runner-resident-proactive.js.map +1 -0
  556. package/dist/runtime/daemon/runner-resident-shared.d.ts +40 -0
  557. package/dist/runtime/daemon/runner-resident-shared.d.ts.map +1 -0
  558. package/dist/runtime/daemon/runner-resident-shared.js +101 -0
  559. package/dist/runtime/daemon/runner-resident-shared.js.map +1 -0
  560. package/dist/runtime/daemon/runner-resident.d.ts +4 -68
  561. package/dist/runtime/daemon/runner-resident.d.ts.map +1 -1
  562. package/dist/runtime/daemon/runner-resident.js +4 -506
  563. package/dist/runtime/daemon/runner-resident.js.map +1 -1
  564. package/dist/runtime/daemon/runner-runtime.d.ts +12 -0
  565. package/dist/runtime/daemon/runner-runtime.d.ts.map +1 -0
  566. package/dist/runtime/daemon/runner-runtime.js +43 -0
  567. package/dist/runtime/daemon/runner-runtime.js.map +1 -0
  568. package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
  569. package/dist/runtime/daemon/runner-startup.js +15 -6
  570. package/dist/runtime/daemon/runner-startup.js.map +1 -1
  571. package/dist/runtime/daemon/runner.d.ts +14 -23
  572. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  573. package/dist/runtime/daemon/runner.js +40 -110
  574. package/dist/runtime/daemon/runner.js.map +1 -1
  575. package/dist/runtime/daemon/runtime-ownership.d.ts +9 -0
  576. package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -1
  577. package/dist/runtime/daemon/runtime-ownership.js +248 -1
  578. package/dist/runtime/daemon/runtime-ownership.js.map +1 -1
  579. package/dist/runtime/daemon/wait-deadline-resolver.d.ts +5 -2
  580. package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
  581. package/dist/runtime/daemon/wait-deadline-resolver.js +55 -35
  582. package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
  583. package/dist/runtime/dream-sidecar-review.d.ts +92 -0
  584. package/dist/runtime/dream-sidecar-review.d.ts.map +1 -0
  585. package/dist/runtime/dream-sidecar-review.js +495 -0
  586. package/dist/runtime/dream-sidecar-review.js.map +1 -0
  587. package/dist/runtime/event/dispatcher.d.ts +0 -2
  588. package/dist/runtime/event/dispatcher.d.ts.map +1 -1
  589. package/dist/runtime/event/dispatcher.js +0 -4
  590. package/dist/runtime/event/dispatcher.js.map +1 -1
  591. package/dist/runtime/event/server-command-handler.d.ts +2 -4
  592. package/dist/runtime/event/server-command-handler.d.ts.map +1 -1
  593. package/dist/runtime/event/server-command-handler.js +36 -6
  594. package/dist/runtime/event/server-command-handler.js.map +1 -1
  595. package/dist/runtime/event/server-snapshot-reader.d.ts +15 -1
  596. package/dist/runtime/event/server-snapshot-reader.d.ts.map +1 -1
  597. package/dist/runtime/event/server-snapshot-reader.js +66 -2
  598. package/dist/runtime/event/server-snapshot-reader.js.map +1 -1
  599. package/dist/runtime/event/server-types.d.ts +7 -0
  600. package/dist/runtime/event/server-types.d.ts.map +1 -1
  601. package/dist/runtime/event/server.d.ts +5 -0
  602. package/dist/runtime/event/server.d.ts.map +1 -1
  603. package/dist/runtime/event/server.js +43 -11
  604. package/dist/runtime/event/server.js.map +1 -1
  605. package/dist/runtime/evidence-answer.d.ts +41 -0
  606. package/dist/runtime/evidence-answer.d.ts.map +1 -0
  607. package/dist/runtime/evidence-answer.js +366 -0
  608. package/dist/runtime/evidence-answer.js.map +1 -0
  609. package/dist/runtime/executor/goal-worker.d.ts +6 -2
  610. package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
  611. package/dist/runtime/executor/goal-worker.js +7 -2
  612. package/dist/runtime/executor/goal-worker.js.map +1 -1
  613. package/dist/runtime/executor/loop-supervisor.d.ts +7 -0
  614. package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
  615. package/dist/runtime/executor/loop-supervisor.js +72 -17
  616. package/dist/runtime/executor/loop-supervisor.js.map +1 -1
  617. package/dist/runtime/guardrails/backpressure-controller.d.ts +32 -0
  618. package/dist/runtime/guardrails/backpressure-controller.d.ts.map +1 -0
  619. package/dist/runtime/guardrails/backpressure-controller.js +88 -0
  620. package/dist/runtime/guardrails/backpressure-controller.js.map +1 -0
  621. package/dist/runtime/guardrails/circuit-breaker.d.ts +32 -0
  622. package/dist/runtime/guardrails/circuit-breaker.d.ts.map +1 -0
  623. package/dist/runtime/guardrails/circuit-breaker.js +88 -0
  624. package/dist/runtime/guardrails/circuit-breaker.js.map +1 -0
  625. package/dist/runtime/guardrails/guardrail-store.d.ts +23 -0
  626. package/dist/runtime/guardrails/guardrail-store.d.ts.map +1 -0
  627. package/dist/runtime/guardrails/guardrail-store.js +95 -0
  628. package/dist/runtime/guardrails/guardrail-store.js.map +1 -0
  629. package/dist/runtime/guardrails/index.d.ts +4 -0
  630. package/dist/runtime/guardrails/index.d.ts.map +1 -0
  631. package/dist/runtime/guardrails/index.js +4 -0
  632. package/dist/runtime/guardrails/index.js.map +1 -0
  633. package/dist/runtime/interactive-automation/browser-session-store.d.ts +43 -0
  634. package/dist/runtime/interactive-automation/browser-session-store.d.ts.map +1 -0
  635. package/dist/runtime/interactive-automation/browser-session-store.js +104 -0
  636. package/dist/runtime/interactive-automation/browser-session-store.js.map +1 -0
  637. package/dist/runtime/interactive-automation/failure-classifier.d.ts +12 -0
  638. package/dist/runtime/interactive-automation/failure-classifier.d.ts.map +1 -0
  639. package/dist/runtime/interactive-automation/failure-classifier.js +50 -0
  640. package/dist/runtime/interactive-automation/failure-classifier.js.map +1 -0
  641. package/dist/runtime/interactive-automation/index.d.ts +2 -0
  642. package/dist/runtime/interactive-automation/index.d.ts.map +1 -1
  643. package/dist/runtime/interactive-automation/index.js +2 -0
  644. package/dist/runtime/interactive-automation/index.js.map +1 -1
  645. package/dist/runtime/interactive-automation/providers/manus-browser.d.ts.map +1 -1
  646. package/dist/runtime/interactive-automation/providers/manus-browser.js +17 -1
  647. package/dist/runtime/interactive-automation/providers/manus-browser.js.map +1 -1
  648. package/dist/runtime/interactive-automation/types.d.ts +4 -0
  649. package/dist/runtime/interactive-automation/types.d.ts.map +1 -1
  650. package/dist/runtime/interactive-automation/types.js.map +1 -1
  651. package/dist/runtime/notification-routing.d.ts +45 -2
  652. package/dist/runtime/notification-routing.d.ts.map +1 -1
  653. package/dist/runtime/notification-routing.js +196 -79
  654. package/dist/runtime/notification-routing.js.map +1 -1
  655. package/dist/runtime/run-spec/confirmation.d.ts +34 -0
  656. package/dist/runtime/run-spec/confirmation.d.ts.map +1 -0
  657. package/dist/runtime/run-spec/confirmation.js +176 -0
  658. package/dist/runtime/run-spec/confirmation.js.map +1 -0
  659. package/dist/runtime/run-spec/derive.d.ts +284 -0
  660. package/dist/runtime/run-spec/derive.d.ts.map +1 -0
  661. package/dist/runtime/run-spec/derive.js +379 -0
  662. package/dist/runtime/run-spec/derive.js.map +1 -0
  663. package/dist/runtime/run-spec/index.d.ts +5 -0
  664. package/dist/runtime/run-spec/index.d.ts.map +1 -0
  665. package/dist/runtime/run-spec/index.js +5 -0
  666. package/dist/runtime/run-spec/index.js.map +1 -0
  667. package/dist/runtime/run-spec/store.d.ts +11 -0
  668. package/dist/runtime/run-spec/store.d.ts.map +1 -0
  669. package/dist/runtime/run-spec/store.js +36 -0
  670. package/dist/runtime/run-spec/store.js.map +1 -0
  671. package/dist/runtime/run-spec/types.d.ts +495 -0
  672. package/dist/runtime/run-spec/types.d.ts.map +1 -0
  673. package/dist/runtime/run-spec/types.js +87 -0
  674. package/dist/runtime/run-spec/types.js.map +1 -0
  675. package/dist/runtime/schedule/engine-cron-reflection.d.ts +31 -0
  676. package/dist/runtime/schedule/engine-cron-reflection.d.ts.map +1 -0
  677. package/dist/runtime/schedule/engine-cron-reflection.js +229 -0
  678. package/dist/runtime/schedule/engine-cron-reflection.js.map +1 -0
  679. package/dist/runtime/schedule/engine-execution.d.ts +48 -0
  680. package/dist/runtime/schedule/engine-execution.d.ts.map +1 -0
  681. package/dist/runtime/schedule/engine-execution.js +424 -0
  682. package/dist/runtime/schedule/engine-execution.js.map +1 -0
  683. package/dist/runtime/schedule/engine-heartbeat.d.ts +5 -0
  684. package/dist/runtime/schedule/engine-heartbeat.d.ts.map +1 -0
  685. package/dist/runtime/schedule/engine-heartbeat.js +104 -0
  686. package/dist/runtime/schedule/engine-heartbeat.js.map +1 -0
  687. package/dist/runtime/schedule/engine-layers.d.ts +4 -1
  688. package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
  689. package/dist/runtime/schedule/engine-layers.js +15 -229
  690. package/dist/runtime/schedule/engine-layers.js.map +1 -1
  691. package/dist/runtime/schedule/engine-mutations.d.ts +37 -0
  692. package/dist/runtime/schedule/engine-mutations.d.ts.map +1 -0
  693. package/dist/runtime/schedule/engine-mutations.js +263 -0
  694. package/dist/runtime/schedule/engine-mutations.js.map +1 -0
  695. package/dist/runtime/schedule/engine.d.ts +13 -39
  696. package/dist/runtime/schedule/engine.d.ts.map +1 -1
  697. package/dist/runtime/schedule/engine.js +65 -810
  698. package/dist/runtime/schedule/engine.js.map +1 -1
  699. package/dist/runtime/schedule/history.d.ts +20 -4
  700. package/dist/runtime/schedule/history.d.ts.map +1 -1
  701. package/dist/runtime/schedule/history.js +8 -0
  702. package/dist/runtime/schedule/history.js.map +1 -1
  703. package/dist/runtime/schedule/index.d.ts +1 -0
  704. package/dist/runtime/schedule/index.d.ts.map +1 -1
  705. package/dist/runtime/schedule/index.js +1 -0
  706. package/dist/runtime/schedule/index.js.map +1 -1
  707. package/dist/runtime/schedule/legacy-cron-migration.d.ts +9 -0
  708. package/dist/runtime/schedule/legacy-cron-migration.d.ts.map +1 -0
  709. package/dist/runtime/schedule/legacy-cron-migration.js +89 -0
  710. package/dist/runtime/schedule/legacy-cron-migration.js.map +1 -0
  711. package/dist/runtime/schedule/wait-projection.d.ts +6 -0
  712. package/dist/runtime/schedule/wait-projection.d.ts.map +1 -0
  713. package/dist/runtime/schedule/wait-projection.js +102 -0
  714. package/dist/runtime/schedule/wait-projection.js.map +1 -0
  715. package/dist/runtime/session-registry/registry-helpers.d.ts +34 -0
  716. package/dist/runtime/session-registry/registry-helpers.d.ts.map +1 -0
  717. package/dist/runtime/session-registry/registry-helpers.js +241 -0
  718. package/dist/runtime/session-registry/registry-helpers.js.map +1 -0
  719. package/dist/runtime/session-registry/registry.d.ts.map +1 -1
  720. package/dist/runtime/session-registry/registry.js +16 -243
  721. package/dist/runtime/session-registry/registry.js.map +1 -1
  722. package/dist/runtime/session-registry/types.d.ts +138 -130
  723. package/dist/runtime/session-registry/types.d.ts.map +1 -1
  724. package/dist/runtime/session-registry/types.js +2 -0
  725. package/dist/runtime/session-registry/types.js.map +1 -1
  726. package/dist/runtime/store/artifact-retention.d.ts +44 -0
  727. package/dist/runtime/store/artifact-retention.d.ts.map +1 -0
  728. package/dist/runtime/store/artifact-retention.js +263 -0
  729. package/dist/runtime/store/artifact-retention.js.map +1 -0
  730. package/dist/runtime/store/background-run-store.d.ts +1 -0
  731. package/dist/runtime/store/background-run-store.d.ts.map +1 -1
  732. package/dist/runtime/store/background-run-store.js +1 -0
  733. package/dist/runtime/store/background-run-store.js.map +1 -1
  734. package/dist/runtime/store/budget-store.d.ts +442 -0
  735. package/dist/runtime/store/budget-store.d.ts.map +1 -0
  736. package/dist/runtime/store/budget-store.js +318 -0
  737. package/dist/runtime/store/budget-store.js.map +1 -0
  738. package/dist/runtime/store/dream-checkpoints.d.ts +9 -0
  739. package/dist/runtime/store/dream-checkpoints.d.ts.map +1 -0
  740. package/dist/runtime/store/dream-checkpoints.js +16 -0
  741. package/dist/runtime/store/dream-checkpoints.js.map +1 -0
  742. package/dist/runtime/store/evaluator-results.d.ts +97 -0
  743. package/dist/runtime/store/evaluator-results.d.ts.map +1 -0
  744. package/dist/runtime/store/evaluator-results.js +355 -0
  745. package/dist/runtime/store/evaluator-results.js.map +1 -0
  746. package/dist/runtime/store/evidence-ledger.d.ts +5298 -0
  747. package/dist/runtime/store/evidence-ledger.d.ts.map +1 -0
  748. package/dist/runtime/store/evidence-ledger.js +1452 -0
  749. package/dist/runtime/store/evidence-ledger.js.map +1 -0
  750. package/dist/runtime/store/experiment-queue-store.d.ts +1164 -0
  751. package/dist/runtime/store/experiment-queue-store.d.ts.map +1 -0
  752. package/dist/runtime/store/experiment-queue-store.js +341 -0
  753. package/dist/runtime/store/experiment-queue-store.js.map +1 -0
  754. package/dist/runtime/store/health-store.d.ts.map +1 -1
  755. package/dist/runtime/store/health-store.js +6 -0
  756. package/dist/runtime/store/health-store.js.map +1 -1
  757. package/dist/runtime/store/index.d.ts +25 -2
  758. package/dist/runtime/store/index.d.ts.map +1 -1
  759. package/dist/runtime/store/index.js +13 -1
  760. package/dist/runtime/store/index.js.map +1 -1
  761. package/dist/runtime/store/metric-history.d.ts +10 -0
  762. package/dist/runtime/store/metric-history.d.ts.map +1 -0
  763. package/dist/runtime/store/metric-history.js +56 -0
  764. package/dist/runtime/store/metric-history.js.map +1 -0
  765. package/dist/runtime/store/operator-handoff-store.d.ts +179 -0
  766. package/dist/runtime/store/operator-handoff-store.d.ts.map +1 -0
  767. package/dist/runtime/store/operator-handoff-store.js +120 -0
  768. package/dist/runtime/store/operator-handoff-store.js.map +1 -0
  769. package/dist/runtime/store/postmortem-report.d.ts +485 -0
  770. package/dist/runtime/store/postmortem-report.d.ts.map +1 -0
  771. package/dist/runtime/store/postmortem-report.js +561 -0
  772. package/dist/runtime/store/postmortem-report.js.map +1 -0
  773. package/dist/runtime/store/reproducibility-manifest.d.ts +565 -0
  774. package/dist/runtime/store/reproducibility-manifest.d.ts.map +1 -0
  775. package/dist/runtime/store/reproducibility-manifest.js +392 -0
  776. package/dist/runtime/store/reproducibility-manifest.js.map +1 -0
  777. package/dist/runtime/store/research-evidence.d.ts +8 -0
  778. package/dist/runtime/store/research-evidence.d.ts.map +1 -0
  779. package/dist/runtime/store/research-evidence.js +15 -0
  780. package/dist/runtime/store/research-evidence.js.map +1 -0
  781. package/dist/runtime/store/runtime-operation-schemas.d.ts +80 -34
  782. package/dist/runtime/store/runtime-operation-schemas.d.ts.map +1 -1
  783. package/dist/runtime/store/runtime-operation-schemas.js +16 -1
  784. package/dist/runtime/store/runtime-operation-schemas.js.map +1 -1
  785. package/dist/runtime/store/runtime-paths.d.ts +25 -0
  786. package/dist/runtime/store/runtime-paths.d.ts.map +1 -1
  787. package/dist/runtime/store/runtime-paths.js +73 -0
  788. package/dist/runtime/store/runtime-paths.js.map +1 -1
  789. package/dist/runtime/store/runtime-schemas.d.ts +1934 -15
  790. package/dist/runtime/store/runtime-schemas.d.ts.map +1 -1
  791. package/dist/runtime/store/runtime-schemas.js +201 -0
  792. package/dist/runtime/store/runtime-schemas.js.map +1 -1
  793. package/dist/runtime/store/safe-pause-store.d.ts +28 -0
  794. package/dist/runtime/store/safe-pause-store.d.ts.map +1 -0
  795. package/dist/runtime/store/safe-pause-store.js +103 -0
  796. package/dist/runtime/store/safe-pause-store.js.map +1 -0
  797. package/dist/runtime/types/daemon.d.ts +234 -14
  798. package/dist/runtime/types/daemon.d.ts.map +1 -1
  799. package/dist/runtime/types/daemon.js +29 -2
  800. package/dist/runtime/types/daemon.js.map +1 -1
  801. package/dist/runtime/types/envelope.d.ts +10 -10
  802. package/dist/runtime/types/hook.d.ts +9 -9
  803. package/dist/runtime/types/notification.d.ts +6 -6
  804. package/dist/runtime/types/plugin.d.ts +2 -2
  805. package/dist/runtime/types/schedule.d.ts +162 -54
  806. package/dist/runtime/types/schedule.d.ts.map +1 -1
  807. package/dist/runtime/types/schedule.js +15 -1
  808. package/dist/runtime/types/schedule.js.map +1 -1
  809. package/dist/runtime/types/trigger.d.ts +2 -2
  810. package/dist/tools/automation/InteractiveAutomationTools.d.ts +10 -0
  811. package/dist/tools/automation/InteractiveAutomationTools.d.ts.map +1 -1
  812. package/dist/tools/automation/InteractiveAutomationTools.js +139 -8
  813. package/dist/tools/automation/InteractiveAutomationTools.js.map +1 -1
  814. package/dist/tools/builtin/exports.d.ts +2 -1
  815. package/dist/tools/builtin/exports.d.ts.map +1 -1
  816. package/dist/tools/builtin/exports.js +2 -1
  817. package/dist/tools/builtin/exports.js.map +1 -1
  818. package/dist/tools/builtin/factory.d.ts +7 -0
  819. package/dist/tools/builtin/factory.d.ts.map +1 -1
  820. package/dist/tools/builtin/factory.js +26 -3
  821. package/dist/tools/builtin/factory.js.map +1 -1
  822. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts +1 -0
  823. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts.map +1 -1
  824. package/dist/tools/fs/FileValidationTool/protected-path-policy.js +17 -4
  825. package/dist/tools/fs/FileValidationTool/protected-path-policy.js.map +1 -1
  826. package/dist/tools/fs/ListDirTool/ListDirTool.js +1 -1
  827. package/dist/tools/fs/ListDirTool/ListDirTool.js.map +1 -1
  828. package/dist/tools/kaggle/KaggleExperimentTools.d.ts +792 -8
  829. package/dist/tools/kaggle/KaggleExperimentTools.d.ts.map +1 -1
  830. package/dist/tools/kaggle/KaggleExperimentTools.js +284 -19
  831. package/dist/tools/kaggle/KaggleExperimentTools.js.map +1 -1
  832. package/dist/tools/kaggle/KaggleSubmissionTools.d.ts +18 -12
  833. package/dist/tools/kaggle/KaggleSubmissionTools.d.ts.map +1 -1
  834. package/dist/tools/kaggle/KaggleSubmissionTools.js +23 -4
  835. package/dist/tools/kaggle/KaggleSubmissionTools.js.map +1 -1
  836. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts +28 -9
  837. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts.map +1 -1
  838. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js +182 -4
  839. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js.map +1 -1
  840. package/dist/tools/kaggle/index.d.ts +1 -1
  841. package/dist/tools/kaggle/index.d.ts.map +1 -1
  842. package/dist/tools/kaggle/index.js +1 -1
  843. package/dist/tools/kaggle/index.js.map +1 -1
  844. package/dist/tools/kaggle/metrics.d.ts +845 -4
  845. package/dist/tools/kaggle/metrics.d.ts.map +1 -1
  846. package/dist/tools/kaggle/metrics.js +410 -1
  847. package/dist/tools/kaggle/metrics.js.map +1 -1
  848. package/dist/tools/kaggle/paths.d.ts.map +1 -1
  849. package/dist/tools/kaggle/paths.js +6 -0
  850. package/dist/tools/kaggle/paths.js.map +1 -1
  851. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts +6 -0
  852. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts.map +1 -1
  853. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js +9 -2
  854. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js.map +1 -1
  855. package/dist/tools/mutation/TaskCreateTool/TaskCreateTool.d.ts +4 -4
  856. package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts +4 -4
  857. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts.map +1 -1
  858. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js +23 -2
  859. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js.map +1 -1
  860. package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts.map +1 -1
  861. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js +24 -2
  862. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js.map +1 -1
  863. package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +2 -2
  864. package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -1
  865. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +43 -9
  866. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -1
  867. package/dist/tools/query/code-search-root.d.ts +8 -0
  868. package/dist/tools/query/code-search-root.d.ts.map +1 -0
  869. package/dist/tools/query/code-search-root.js +41 -0
  870. package/dist/tools/query/code-search-root.js.map +1 -0
  871. package/dist/tools/query/runtime-dream-review-tool.d.ts +34 -0
  872. package/dist/tools/query/runtime-dream-review-tool.d.ts.map +1 -0
  873. package/dist/tools/query/runtime-dream-review-tool.js +62 -0
  874. package/dist/tools/query/runtime-dream-review-tool.js.map +1 -0
  875. package/dist/tools/query/runtime-session-tools.d.ts +560 -0
  876. package/dist/tools/query/runtime-session-tools.d.ts.map +1 -0
  877. package/dist/tools/query/runtime-session-tools.js +1017 -0
  878. package/dist/tools/query/runtime-session-tools.js.map +1 -0
  879. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +821 -0
  880. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -0
  881. package/dist/tools/runtime/LongRunningRuntimeTools.js +905 -0
  882. package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -0
  883. package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts +62 -32
  884. package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts.map +1 -1
  885. package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts +78 -44
  886. package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts.map +1 -1
  887. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts +1 -0
  888. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts.map +1 -1
  889. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js +11 -0
  890. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js.map +1 -1
  891. package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
  892. package/dist/tools/system/ShellTool/ShellTool.js +2 -1
  893. package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
  894. package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts +4 -4
  895. package/dist/tools/types.d.ts +2 -0
  896. package/dist/tools/types.d.ts.map +1 -1
  897. package/dist/tools/types.js.map +1 -1
  898. package/package.json +2 -1
  899. package/dist/base/types/cron.d.ts +0 -2
  900. package/dist/base/types/cron.d.ts.map +0 -1
  901. package/dist/base/types/cron.js +0 -3
  902. package/dist/base/types/cron.js.map +0 -1
  903. package/dist/runtime/cron-scheduler.d.ts +0 -13
  904. package/dist/runtime/cron-scheduler.d.ts.map +0 -1
  905. package/dist/runtime/cron-scheduler.js +0 -90
  906. package/dist/runtime/cron-scheduler.js.map +0 -1
  907. package/dist/runtime/types/cron.d.ts +0 -59
  908. package/dist/runtime/types/cron.d.ts.map +0 -1
  909. package/dist/runtime/types/cron.js +0 -13
  910. package/dist/runtime/types/cron.js.map +0 -1
@@ -0,0 +1,610 @@
1
+ import { loadProviderConfig } from "../../base/llm/provider-config.js";
2
+ import { toToolDefinitionsFiltered } from "../../tools/tool-definition-adapter.js";
3
+ import { buildPromptedToolProtocolSystemPrompt, extractPromptedToolCalls, } from "../../orchestrator/execution/agent-loop/prompted-tool-protocol.js";
4
+ import { verifyChatAction } from "./chat-verifier.js";
5
+ import { collectGitDiffArtifact, formatToolActivity, } from "./chat-runner-support.js";
6
+ import { resolveExecutionPolicy } from "../../orchestrator/execution/agent-loop/execution-policy.js";
7
+ const DEFAULT_TIMEOUT_MS = 120_000;
8
+ const MAX_VERIFY_RETRIES = 2;
9
+ const MAX_TOOL_LOOPS = 5;
10
+ export async function executeRuntimeControlRoute(host, route, runtimeControlContext, cwd, start) {
11
+ if (!host.deps.runtimeControlService) {
12
+ return {
13
+ success: false,
14
+ output: "Runtime control is not available in this chat surface yet.",
15
+ elapsed_ms: Date.now() - start,
16
+ };
17
+ }
18
+ const replyTarget = runtimeControlContext?.replyTarget ?? host.deps.runtimeReplyTarget;
19
+ const actor = runtimeControlContext?.actor ?? host.deps.runtimeControlActor;
20
+ const result = await host.deps.runtimeControlService.request({
21
+ intent: route.intent,
22
+ cwd,
23
+ requestedBy: actor ?? {
24
+ surface: replyTarget?.surface ?? "chat",
25
+ platform: replyTarget?.platform,
26
+ conversation_id: replyTarget?.conversation_id,
27
+ identity_key: replyTarget?.identity_key,
28
+ user_id: replyTarget?.user_id,
29
+ },
30
+ replyTarget: replyTarget ?? { surface: "chat" },
31
+ approvalFn: runtimeControlContext?.approvalFn
32
+ ?? host.deps.runtimeControlApprovalFn
33
+ ?? host.deps.approvalFn,
34
+ });
35
+ return {
36
+ success: result.success,
37
+ output: result.message,
38
+ elapsed_ms: Date.now() - start,
39
+ };
40
+ }
41
+ export async function executeAgentLoopRoute(host, params) {
42
+ const { resumeOnly, executionCwd, executionGoalId, basePrompt, priorTurns, agentLoopSystemPrompt, assistantBuffer, eventContext, history, gitRoot, activeAbortSignal, start, } = params;
43
+ try {
44
+ const resumeState = resumeOnly ? await loadResumableAgentLoopState(host) : null;
45
+ if (resumeOnly && !resumeState) {
46
+ const elapsed_ms = Date.now() - start;
47
+ const output = await host.eventBridge.emitLifecycleErrorEventWithFallback("No resumable native agentloop state found.", assistantBuffer.text, eventContext, {
48
+ code: "resume_state_missing",
49
+ stoppedReason: "resume_state_missing",
50
+ }, host.deps.llmClient);
51
+ host.eventBridge.emitLifecycleEndEvent("error", elapsed_ms, eventContext, false);
52
+ return {
53
+ success: false,
54
+ output,
55
+ elapsed_ms,
56
+ };
57
+ }
58
+ host.eventBridge.emitCheckpoint(resumeOnly ? "Session resumed" : "Agent loop started", resumeOnly
59
+ ? "Resumable agent-loop state is loaded."
60
+ : "The agent loop can now inspect, plan, edit, or verify with visible tool activity.", eventContext, "execution");
61
+ host.eventBridge.emitActivity("lifecycle", "Calling model...", eventContext, "lifecycle:model");
62
+ const result = await host.deps.chatAgentLoopRunner.execute({
63
+ message: basePrompt,
64
+ cwd: executionCwd,
65
+ goalId: executionGoalId,
66
+ history: priorTurns.map((m) => ({
67
+ role: m.role === "assistant" ? "assistant" : "user",
68
+ content: m.content,
69
+ })),
70
+ eventSink: host.eventBridge.createAgentLoopEventSink(eventContext),
71
+ approvalFn: async (request) => {
72
+ if (host.deps.approvalFn) {
73
+ return host.deps.approvalFn(request.reason);
74
+ }
75
+ return false;
76
+ },
77
+ toolCallContext: {
78
+ executionPolicy: await host.getSessionExecutionPolicy(),
79
+ ...(host.getConversationSessionId() ? { conversationSessionId: host.getConversationSessionId() } : {}),
80
+ },
81
+ ...(host.getNativeAgentLoopStatePath() ? { resumeStatePath: host.getNativeAgentLoopStatePath() } : {}),
82
+ ...(resumeState ? { resumeState } : {}),
83
+ ...(resumeOnly ? { resumeOnly: true } : {}),
84
+ ...(agentLoopSystemPrompt ? { systemPrompt: agentLoopSystemPrompt } : {}),
85
+ abortSignal: activeAbortSignal,
86
+ });
87
+ const elapsed_ms = Date.now() - start;
88
+ const agentLoopUsage = result.agentLoop?.usage
89
+ ? normalizeUsageCounter(result.agentLoop.usage)
90
+ : zeroUsageCounter();
91
+ if (hasUsage(agentLoopUsage)) {
92
+ history.recordUsage("agentloop", agentLoopUsage);
93
+ }
94
+ if (result.output) {
95
+ host.eventBridge.pushAssistantDelta(result.output, assistantBuffer, eventContext);
96
+ }
97
+ if (result.success) {
98
+ const diffArtifact = await collectGitDiffArtifact(gitRoot);
99
+ if (diffArtifact) {
100
+ host.eventBridge.emitDiffArtifact(diffArtifact, eventContext);
101
+ }
102
+ await history.appendAssistantMessage(result.output);
103
+ host.eventBridge.emitCheckpoint("Response ready", "The agent-loop response has been persisted for this turn.", eventContext, "complete");
104
+ host.eventBridge.emitActivity("lifecycle", "Finalizing response...", eventContext, "lifecycle:finalizing");
105
+ host.eventBridge.emitEvent({
106
+ type: "assistant_final",
107
+ text: result.output,
108
+ persisted: true,
109
+ ...host.eventBridge.eventBase(eventContext),
110
+ });
111
+ host.eventBridge.emitLifecycleEndEvent("completed", elapsed_ms, eventContext, true);
112
+ }
113
+ else {
114
+ result.output = await host.eventBridge.emitLifecycleErrorEventWithFallback(result.output || result.error || "Unknown error", assistantBuffer.text, eventContext, {
115
+ stoppedReason: result.stopped_reason,
116
+ agentLoopStopReason: result.agentLoop?.stopReason,
117
+ }, host.deps.llmClient);
118
+ host.eventBridge.emitLifecycleEndEvent("error", elapsed_ms, eventContext, false);
119
+ }
120
+ return {
121
+ success: result.success,
122
+ output: result.output,
123
+ elapsed_ms,
124
+ };
125
+ }
126
+ catch (err) {
127
+ const message = err instanceof Error ? err.message : String(err);
128
+ const output = await host.eventBridge.emitLifecycleErrorEventWithFallback(message, assistantBuffer.text, eventContext, {}, host.deps.llmClient);
129
+ host.eventBridge.emitLifecycleEndEvent("error", Date.now() - start, eventContext, false);
130
+ return {
131
+ success: false,
132
+ output,
133
+ elapsed_ms: Date.now() - start,
134
+ };
135
+ }
136
+ }
137
+ export async function executeToolLoopRoute(host, params) {
138
+ try {
139
+ host.eventBridge.emitCheckpoint("Tool loop started", "The model will choose tools from the active catalog.", params.eventContext, "execution");
140
+ const toolResult = await executeWithTools(host, params.prompt, params.eventContext, params.assistantBuffer, params.systemPrompt, params.executionGoalId);
141
+ const elapsed_ms = Date.now() - params.start;
142
+ if (hasUsage(toolResult.usage)) {
143
+ params.history.recordUsage("execution", toolResult.usage);
144
+ }
145
+ const diffArtifact = await collectGitDiffArtifact(params.gitRoot);
146
+ if (diffArtifact) {
147
+ host.eventBridge.emitDiffArtifact(diffArtifact, params.eventContext);
148
+ }
149
+ await params.history.appendAssistantMessage(toolResult.output);
150
+ host.eventBridge.emitCheckpoint("Response ready", "The tool-loop response has been persisted for this turn.", params.eventContext, "complete");
151
+ host.eventBridge.emitActivity("lifecycle", "Finalizing response...", params.eventContext, "lifecycle:finalizing");
152
+ host.eventBridge.emitEvent({
153
+ type: "assistant_final",
154
+ text: toolResult.output,
155
+ persisted: true,
156
+ ...host.eventBridge.eventBase(params.eventContext),
157
+ });
158
+ host.eventBridge.emitLifecycleEndEvent("completed", elapsed_ms, params.eventContext, true);
159
+ return { success: true, output: toolResult.output, elapsed_ms };
160
+ }
161
+ catch (err) {
162
+ const message = err instanceof Error ? err.message : String(err);
163
+ const output = await host.eventBridge.emitLifecycleErrorEventWithFallback(message, params.assistantBuffer.text, params.eventContext, {}, host.deps.llmClient);
164
+ host.eventBridge.emitLifecycleEndEvent("error", Date.now() - params.start, params.eventContext, false);
165
+ return {
166
+ success: false,
167
+ output,
168
+ elapsed_ms: Date.now() - params.start,
169
+ };
170
+ }
171
+ }
172
+ export async function executeAdapterRoute(host, params) {
173
+ const task = {
174
+ prompt: params.prompt,
175
+ timeout_ms: params.timeoutMs,
176
+ adapter_type: host.deps.adapter.adapterType,
177
+ cwd: params.cwd,
178
+ ...(params.systemPrompt ? { system_prompt: params.systemPrompt } : {}),
179
+ };
180
+ const resolvedTimeoutMs = task.timeout_ms ?? DEFAULT_TIMEOUT_MS;
181
+ host.eventBridge.emitCheckpoint("Adapter started", "The configured adapter has the current prompt and project context.", params.eventContext, "execution");
182
+ host.eventBridge.emitActivity("lifecycle", "Calling adapter...", params.eventContext, "lifecycle:adapter");
183
+ const adapterPromise = host.deps.adapter.execute(task);
184
+ const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Chat adapter timed out after ${resolvedTimeoutMs}ms`)), resolvedTimeoutMs));
185
+ let result;
186
+ try {
187
+ result = await Promise.race([adapterPromise, timeoutPromise]);
188
+ }
189
+ catch (err) {
190
+ const message = err instanceof Error ? err.message : String(err);
191
+ const output = await host.eventBridge.emitLifecycleErrorEventWithFallback(message, params.assistantBuffer.text, params.eventContext, {}, host.deps.llmClient);
192
+ const timeoutElapsedMs = Date.now() - params.start;
193
+ host.eventBridge.emitLifecycleEndEvent("error", timeoutElapsedMs, params.eventContext, false);
194
+ return {
195
+ success: false,
196
+ output,
197
+ elapsed_ms: timeoutElapsedMs,
198
+ };
199
+ }
200
+ if (!result.output && result.error) {
201
+ result = { ...result, output: `Error: ${result.error}` };
202
+ }
203
+ const elapsed_ms = Date.now() - params.start;
204
+ if (result.output) {
205
+ host.eventBridge.pushAssistantDelta(result.output, params.assistantBuffer, params.eventContext);
206
+ }
207
+ const diffArtifact = await collectGitDiffArtifact(params.gitRoot);
208
+ if (diffArtifact) {
209
+ let retries = 0;
210
+ const VERIFY_TIMEOUT_MS = 30_000;
211
+ host.eventBridge.emitCheckpoint("Changes detected", "Verification is starting because the turn changed the working tree.", params.eventContext, "changes");
212
+ host.eventBridge.emitActivity("lifecycle", "Checking result...", params.eventContext, "lifecycle:checking");
213
+ let verification = await Promise.race([
214
+ verifyChatAction(params.gitRoot, host.deps.toolExecutor, { force: true }),
215
+ new Promise((resolve) => setTimeout(() => resolve({ passed: true }), VERIFY_TIMEOUT_MS)),
216
+ ]);
217
+ while (!verification.passed && retries < MAX_VERIFY_RETRIES) {
218
+ retries++;
219
+ host.eventBridge.emitCheckpoint("Verification retry", `Attempt ${retries} of ${MAX_VERIFY_RETRIES} is repairing failed checks.`, params.eventContext, `verification-retry-${retries}`);
220
+ const retryPrompt = `The previous changes caused test failures. Please fix them.\n\nTest output:\n${verification.testOutput ?? verification.errors.join("\n")}`;
221
+ const retryTask = { ...task, prompt: retryPrompt };
222
+ result = await host.deps.adapter.execute(retryTask);
223
+ verification = await verifyChatAction(params.gitRoot, host.deps.toolExecutor, { force: true });
224
+ }
225
+ if (!verification.passed) {
226
+ const finalDiffArtifact = await collectGitDiffArtifact(params.gitRoot);
227
+ if (finalDiffArtifact) {
228
+ host.eventBridge.emitDiffArtifact(finalDiffArtifact, params.eventContext);
229
+ }
230
+ host.eventBridge.emitCheckpoint("Verification failed", `Checks are still failing after ${MAX_VERIFY_RETRIES} retries.`, params.eventContext, "verification");
231
+ const failureOutput = await host.eventBridge.emitLifecycleErrorEventWithFallback(`Changes applied but tests are still failing after ${MAX_VERIFY_RETRIES} retries.`, params.assistantBuffer.text, params.eventContext, {
232
+ code: "verification_failed",
233
+ signals: [{ kind: "verification", status: "failed" }],
234
+ }, host.deps.llmClient);
235
+ host.eventBridge.emitLifecycleEndEvent("error", Date.now() - params.start, params.eventContext, false);
236
+ return {
237
+ success: false,
238
+ output: `${failureOutput}\n\nTest output:\n${verification.testOutput ?? verification.errors.join("\n")}`.trim(),
239
+ elapsed_ms: Date.now() - params.start,
240
+ };
241
+ }
242
+ const finalDiffArtifact = await collectGitDiffArtifact(params.gitRoot);
243
+ if (finalDiffArtifact) {
244
+ host.eventBridge.emitDiffArtifact(finalDiffArtifact, params.eventContext);
245
+ }
246
+ host.eventBridge.emitCheckpoint("Verification passed", "Changed files passed the configured chat verification.", params.eventContext, "verification");
247
+ }
248
+ if (result.success) {
249
+ await params.history.appendAssistantMessage(result.output);
250
+ host.eventBridge.emitCheckpoint("Response ready", "The assistant response has been persisted for this turn.", params.eventContext, "complete");
251
+ host.eventBridge.emitActivity("lifecycle", "Finalizing response...", params.eventContext, "lifecycle:finalizing");
252
+ host.eventBridge.emitEvent({
253
+ type: "assistant_final",
254
+ text: result.output,
255
+ persisted: true,
256
+ ...host.eventBridge.eventBase(params.eventContext),
257
+ });
258
+ host.eventBridge.emitLifecycleEndEvent("completed", elapsed_ms, params.eventContext, true);
259
+ }
260
+ else {
261
+ const partialText = params.assistantBuffer.text !== result.output ? params.assistantBuffer.text : "";
262
+ result.output = await host.eventBridge.emitLifecycleErrorEventWithFallback(result.output || result.error || "Unknown error", partialText, params.eventContext, {
263
+ stoppedReason: result.stopped_reason,
264
+ signals: [{
265
+ kind: "adapter",
266
+ adapterType: host.deps.adapter.adapterType,
267
+ stoppedReason: result.stopped_reason,
268
+ }],
269
+ }, host.deps.llmClient);
270
+ host.eventBridge.emitLifecycleEndEvent("error", elapsed_ms, params.eventContext, false);
271
+ }
272
+ return {
273
+ success: result.success,
274
+ output: result.output,
275
+ elapsed_ms,
276
+ };
277
+ }
278
+ async function executeWithTools(host, prompt, eventContext, assistantBuffer, systemPrompt, goalId) {
279
+ const llmClient = host.deps.llmClient;
280
+ const messages = [{ role: "user", content: prompt }];
281
+ const toolCallContext = await buildToolCallContext(host, goalId);
282
+ const usage = zeroUsageCounter();
283
+ for (let loop = 0; loop < MAX_TOOL_LOOPS; loop++) {
284
+ const tools = host.deps.registry
285
+ ? toToolDefinitionsFiltered(host.deps.registry.listAll(), { activatedTools: host.activatedTools })
286
+ : [];
287
+ const supportsNativeToolCalling = llmClient.supportsToolCalling?.() !== false;
288
+ let response;
289
+ try {
290
+ host.eventBridge.emitActivity("lifecycle", "Calling model...", eventContext, "lifecycle:model");
291
+ response = await sendLLMMessage(host, llmClient, messages, {
292
+ ...(supportsNativeToolCalling
293
+ ? { tools, ...(systemPrompt ? { system: systemPrompt } : {}) }
294
+ : { system: buildPromptedToolProtocolSystemPrompt({ systemPrompt, tools }) }),
295
+ }, assistantBuffer, eventContext);
296
+ }
297
+ catch (err) {
298
+ console.error("[chat-runner] executeWithTools error:", err);
299
+ const hint = err instanceof Error ? `: ${err.message}` : "";
300
+ throw new Error(`Sorry, I encountered an error processing your request${hint}.`);
301
+ }
302
+ addUsageCounter(usage, usageFromLLMResponse(response));
303
+ const toolCalls = response.tool_calls?.length
304
+ ? response.tool_calls
305
+ : supportsNativeToolCalling
306
+ ? []
307
+ : extractPromptedToolCalls({
308
+ content: response.content,
309
+ tools,
310
+ createId: () => `prompted-${loop}-${crypto.randomUUID()}`,
311
+ }).map((call) => ({
312
+ id: call.id,
313
+ type: "function",
314
+ function: {
315
+ name: call.name,
316
+ arguments: JSON.stringify(call.input ?? {}),
317
+ },
318
+ }));
319
+ if (!supportsNativeToolCalling && toolCalls.length > 0) {
320
+ assistantBuffer.text = "";
321
+ }
322
+ if (toolCalls.length === 0) {
323
+ return {
324
+ output: assistantBuffer.text || response.content || "(no response)",
325
+ usage,
326
+ };
327
+ }
328
+ messages.push({ role: "assistant", content: response.content || "" });
329
+ for (const tc of toolCalls) {
330
+ let args = {};
331
+ try {
332
+ args = JSON.parse(tc.function.arguments || "{}");
333
+ }
334
+ catch {
335
+ // ignore parse errors, use empty args
336
+ }
337
+ const toolResult = await dispatchToolCall(host, tc.id, tc.function.name, args, toolCallContext, eventContext);
338
+ if (tc.function.name === "tool_search") {
339
+ activateToolSearchResults(host.activatedTools, toolResult);
340
+ }
341
+ messages.push({ role: "user", content: `Tool result for ${tc.function.name}:\n${toolResult}` });
342
+ }
343
+ }
344
+ const lastAssistant = [...messages].reverse().find(m => m.role === "assistant");
345
+ return {
346
+ output: lastAssistant?.content || "I was unable to complete the request within the allowed tool call limit.",
347
+ usage,
348
+ };
349
+ }
350
+ async function dispatchToolCall(host, toolCallId, name, args, context, eventContext) {
351
+ if (!host.deps.registry) {
352
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, "No tool registry configured"), eventContext, toolCallId);
353
+ return JSON.stringify({ error: "No tool registry configured" });
354
+ }
355
+ const tool = host.deps.registry.get(name);
356
+ if (!tool) {
357
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, `Unknown tool: ${name}`), eventContext, toolCallId);
358
+ return JSON.stringify({ error: `Unknown tool: ${name}` });
359
+ }
360
+ const startTime = Date.now();
361
+ try {
362
+ const parsed = tool.inputSchema.safeParse(args);
363
+ if (!parsed.success) {
364
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, `Invalid input: ${parsed.error.message}`), eventContext, toolCallId);
365
+ host.eventBridge.emitEvent({
366
+ type: "tool_end",
367
+ toolCallId,
368
+ toolName: name,
369
+ success: false,
370
+ summary: `Invalid input: ${parsed.error.message}`,
371
+ durationMs: Date.now() - startTime,
372
+ ...host.eventBridge.eventBase(eventContext),
373
+ });
374
+ return JSON.stringify({ error: `Invalid input: ${parsed.error.message}` });
375
+ }
376
+ host.eventBridge.emitEvent({
377
+ type: "tool_start",
378
+ toolCallId,
379
+ toolName: name,
380
+ args,
381
+ ...host.eventBridge.eventBase(eventContext),
382
+ });
383
+ host.eventBridge.emitActivity("tool", formatToolActivity("Running", name, JSON.stringify(args)), eventContext, toolCallId);
384
+ let result;
385
+ if (host.deps.toolExecutor) {
386
+ host.eventBridge.emitEvent({
387
+ type: "tool_update",
388
+ toolCallId,
389
+ toolName: name,
390
+ status: "running",
391
+ message: "running",
392
+ ...host.eventBridge.eventBase(eventContext),
393
+ });
394
+ host.deps.onToolStart?.(name, args);
395
+ result = await host.deps.toolExecutor.execute(name, parsed.data, context);
396
+ }
397
+ else {
398
+ const permResult = await tool.checkPermissions(parsed.data, context);
399
+ if (permResult.status === "denied") {
400
+ host.eventBridge.emitEvent({
401
+ type: "tool_end",
402
+ toolCallId,
403
+ toolName: name,
404
+ success: false,
405
+ summary: permResult.reason,
406
+ durationMs: Date.now() - startTime,
407
+ ...host.eventBridge.eventBase(eventContext),
408
+ });
409
+ return `Tool ${name} denied: ${permResult.reason}`;
410
+ }
411
+ if (permResult.status === "needs_approval") {
412
+ host.eventBridge.emitActivity("tool", formatToolActivity("Running", name, `awaiting approval: ${permResult.reason}`), eventContext, toolCallId);
413
+ host.eventBridge.emitEvent({
414
+ type: "tool_update",
415
+ toolCallId,
416
+ toolName: name,
417
+ status: "awaiting_approval",
418
+ message: permResult.reason,
419
+ ...host.eventBridge.eventBase(eventContext),
420
+ });
421
+ const approved = await context.approvalFn({
422
+ toolName: name,
423
+ input: parsed.data,
424
+ reason: permResult.reason,
425
+ permissionLevel: tool.metadata.permissionLevel,
426
+ isDestructive: tool.metadata.isDestructive,
427
+ reversibility: "unknown",
428
+ });
429
+ if (!approved) {
430
+ host.eventBridge.emitEvent({
431
+ type: "tool_end",
432
+ toolCallId,
433
+ toolName: name,
434
+ success: false,
435
+ summary: `Not approved: ${permResult.reason}`,
436
+ durationMs: Date.now() - startTime,
437
+ ...host.eventBridge.eventBase(eventContext),
438
+ });
439
+ return `Tool ${name} not approved: ${permResult.reason}`;
440
+ }
441
+ }
442
+ host.eventBridge.emitEvent({
443
+ type: "tool_update",
444
+ toolCallId,
445
+ toolName: name,
446
+ status: "running",
447
+ message: "running",
448
+ ...host.eventBridge.eventBase(eventContext),
449
+ });
450
+ host.deps.onToolStart?.(name, args);
451
+ result = await tool.call(parsed.data, context);
452
+ }
453
+ const durationMs = Date.now() - startTime;
454
+ host.deps.onToolEnd?.(name, { success: result.success, summary: result.summary || "...", durationMs });
455
+ host.eventBridge.emitActivity("tool", formatToolActivity(result.success ? "Finished" : "Failed", name, result.summary || "..."), eventContext, toolCallId);
456
+ host.eventBridge.emitEvent({
457
+ type: "tool_update",
458
+ toolCallId,
459
+ toolName: name,
460
+ status: "result",
461
+ message: result.summary || "...",
462
+ ...host.eventBridge.eventBase(eventContext),
463
+ });
464
+ host.eventBridge.emitEvent({
465
+ type: "tool_end",
466
+ toolCallId,
467
+ toolName: name,
468
+ success: result.success,
469
+ summary: result.summary || "...",
470
+ durationMs,
471
+ ...host.eventBridge.eventBase(eventContext),
472
+ });
473
+ return result.data != null ? JSON.stringify(result.data) : (result.summary ?? "(no result)");
474
+ }
475
+ catch (err) {
476
+ const message = err instanceof Error ? err.message : String(err);
477
+ const durationMs = Date.now() - startTime;
478
+ host.deps.onToolEnd?.(name, { success: false, summary: message, durationMs });
479
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, message), eventContext, toolCallId);
480
+ host.eventBridge.emitEvent({
481
+ type: "tool_end",
482
+ toolCallId,
483
+ toolName: name,
484
+ success: false,
485
+ summary: message,
486
+ durationMs,
487
+ ...host.eventBridge.eventBase(eventContext),
488
+ });
489
+ return JSON.stringify({ error: `Tool ${name} failed: ${message}` });
490
+ }
491
+ }
492
+ async function sendLLMMessage(host, llmClient, messages, options, assistantBuffer, eventContext) {
493
+ let streamed = false;
494
+ if (llmClient.sendMessageStream) {
495
+ const response = await llmClient.sendMessageStream(messages, options, {
496
+ onTextDelta: (delta) => {
497
+ streamed = true;
498
+ host.eventBridge.pushAssistantDelta(delta, assistantBuffer, eventContext);
499
+ },
500
+ });
501
+ if (!streamed && response.content) {
502
+ host.eventBridge.pushAssistantDelta(response.content, assistantBuffer, eventContext);
503
+ }
504
+ return response;
505
+ }
506
+ const response = await llmClient.sendMessage(messages, options);
507
+ if (response.content) {
508
+ host.eventBridge.pushAssistantDelta(response.content, assistantBuffer, eventContext);
509
+ }
510
+ return response;
511
+ }
512
+ async function buildToolCallContext(host, goalId = host.deps.goalId) {
513
+ const executionPolicy = await host.getSessionExecutionPolicy();
514
+ return {
515
+ cwd: host.getSessionCwd() ?? process.cwd(),
516
+ goalId: goalId ?? "",
517
+ trustBalance: 0,
518
+ preApproved: false,
519
+ approvalFn: async (req) => {
520
+ if (host.deps.approvalFn) {
521
+ return host.deps.approvalFn(req.reason);
522
+ }
523
+ return false;
524
+ },
525
+ executionPolicy,
526
+ };
527
+ }
528
+ async function loadResumableAgentLoopState(host) {
529
+ if (!host.getNativeAgentLoopStatePath())
530
+ return null;
531
+ const raw = await host.deps.stateManager.readRaw(host.getNativeAgentLoopStatePath());
532
+ if (!isAgentLoopSessionState(raw))
533
+ return null;
534
+ if (raw.status === "completed")
535
+ return null;
536
+ return {
537
+ ...raw,
538
+ messages: [...raw.messages],
539
+ calledTools: [...raw.calledTools],
540
+ };
541
+ }
542
+ function isAgentLoopSessionState(value) {
543
+ if (!value || typeof value !== "object")
544
+ return false;
545
+ const candidate = value;
546
+ return typeof candidate["sessionId"] === "string"
547
+ && typeof candidate["traceId"] === "string"
548
+ && typeof candidate["turnId"] === "string"
549
+ && typeof candidate["goalId"] === "string"
550
+ && typeof candidate["cwd"] === "string"
551
+ && typeof candidate["modelRef"] === "string"
552
+ && Array.isArray(candidate["messages"])
553
+ && Array.isArray(candidate["calledTools"])
554
+ && typeof candidate["status"] === "string";
555
+ }
556
+ function activateToolSearchResults(activatedTools, toolResult) {
557
+ try {
558
+ const parsed = JSON.parse(toolResult);
559
+ const results = Array.isArray(parsed) ? parsed : null;
560
+ if (results) {
561
+ for (const item of results) {
562
+ if (item && typeof item === "object" && typeof item["name"] === "string") {
563
+ activatedTools.add(item["name"]);
564
+ }
565
+ }
566
+ }
567
+ }
568
+ catch {
569
+ // Non-JSON result or unexpected shape — ignore
570
+ }
571
+ }
572
+ function zeroUsageCounter() {
573
+ return { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
574
+ }
575
+ function normalizeUsageCounter(usage) {
576
+ const inputTokens = Number.isFinite(usage.inputTokens) ? Math.max(0, Math.floor(usage.inputTokens)) : 0;
577
+ const outputTokens = Number.isFinite(usage.outputTokens) ? Math.max(0, Math.floor(usage.outputTokens)) : 0;
578
+ const totalTokens = Number.isFinite(usage.totalTokens)
579
+ ? Math.max(0, Math.floor(usage.totalTokens))
580
+ : inputTokens + outputTokens;
581
+ return { inputTokens, outputTokens, totalTokens };
582
+ }
583
+ function usageFromLLMResponse(response) {
584
+ const inputTokens = response.usage?.input_tokens ?? 0;
585
+ const outputTokens = response.usage?.output_tokens ?? 0;
586
+ return {
587
+ inputTokens,
588
+ outputTokens,
589
+ totalTokens: inputTokens + outputTokens,
590
+ };
591
+ }
592
+ function addUsageCounter(target, delta) {
593
+ const normalizedDelta = normalizeUsageCounter(delta);
594
+ target.inputTokens += normalizedDelta.inputTokens;
595
+ target.outputTokens += normalizedDelta.outputTokens;
596
+ target.totalTokens += normalizedDelta.totalTokens;
597
+ }
598
+ function hasUsage(usage) {
599
+ return usage.totalTokens > 0 || usage.inputTokens > 0 || usage.outputTokens > 0;
600
+ }
601
+ export async function resolveSessionExecutionPolicy(currentPolicy, sessionCwd) {
602
+ if (currentPolicy)
603
+ return currentPolicy;
604
+ const config = await loadProviderConfig({ saveMigration: false });
605
+ return resolveExecutionPolicy({
606
+ workspaceRoot: sessionCwd ?? process.cwd(),
607
+ security: config.agent_loop?.security,
608
+ });
609
+ }
610
+ //# sourceMappingURL=chat-runner-routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-runner-routes.js","sourceRoot":"","sources":["../../../src/interface/chat/chat-runner-routes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EACL,qCAAqC,EACrC,wBAAwB,GACzB,MAAM,mEAAmE,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,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