pulseed 0.5.3 → 0.5.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 (512) hide show
  1. package/dist/base/state/state-manager-goal-state.d.ts +40 -0
  2. package/dist/base/state/state-manager-goal-state.d.ts.map +1 -0
  3. package/dist/base/state/state-manager-goal-state.js +235 -0
  4. package/dist/base/state/state-manager-goal-state.js.map +1 -0
  5. package/dist/base/state/state-manager.d.ts +0 -5
  6. package/dist/base/state/state-manager.d.ts.map +1 -1
  7. package/dist/base/state/state-manager.js +27 -273
  8. package/dist/base/state/state-manager.js.map +1 -1
  9. package/dist/base/types/goal-activation.d.ts +25 -0
  10. package/dist/base/types/goal-activation.d.ts.map +1 -0
  11. package/dist/base/types/goal-activation.js +9 -0
  12. package/dist/base/types/goal-activation.js.map +1 -0
  13. package/dist/interface/chat/chat-history.d.ts +129 -0
  14. package/dist/interface/chat/chat-history.d.ts.map +1 -1
  15. package/dist/interface/chat/chat-history.js +135 -0
  16. package/dist/interface/chat/chat-history.js.map +1 -1
  17. package/dist/interface/chat/chat-runner-command-helpers.d.ts +50 -0
  18. package/dist/interface/chat/chat-runner-command-helpers.d.ts.map +1 -0
  19. package/dist/interface/chat/chat-runner-command-helpers.js +189 -0
  20. package/dist/interface/chat/chat-runner-command-helpers.js.map +1 -0
  21. package/dist/interface/chat/chat-runner-commands.d.ts +76 -0
  22. package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -0
  23. package/dist/interface/chat/chat-runner-commands.js +814 -0
  24. package/dist/interface/chat/chat-runner-commands.js.map +1 -0
  25. package/dist/interface/chat/chat-runner-event-bridge.d.ts +53 -0
  26. package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -0
  27. package/dist/interface/chat/chat-runner-event-bridge.js +311 -0
  28. package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -0
  29. package/dist/interface/chat/chat-runner-routes.d.ts +67 -0
  30. package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -0
  31. package/dist/interface/chat/chat-runner-routes.js +594 -0
  32. package/dist/interface/chat/chat-runner-routes.js.map +1 -0
  33. package/dist/interface/chat/chat-runner-runtime.d.ts +37 -0
  34. package/dist/interface/chat/chat-runner-runtime.d.ts.map +1 -0
  35. package/dist/interface/chat/chat-runner-runtime.js +236 -0
  36. package/dist/interface/chat/chat-runner-runtime.js.map +1 -0
  37. package/dist/interface/chat/chat-runner-state.d.ts +20 -0
  38. package/dist/interface/chat/chat-runner-state.d.ts.map +1 -0
  39. package/dist/interface/chat/chat-runner-state.js +157 -0
  40. package/dist/interface/chat/chat-runner-state.js.map +1 -0
  41. package/dist/interface/chat/chat-runner-support.d.ts +15 -0
  42. package/dist/interface/chat/chat-runner-support.d.ts.map +1 -0
  43. package/dist/interface/chat/chat-runner-support.js +116 -0
  44. package/dist/interface/chat/chat-runner-support.js.map +1 -0
  45. package/dist/interface/chat/chat-runner.d.ts +10 -153
  46. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  47. package/dist/interface/chat/chat-runner.js +299 -2642
  48. package/dist/interface/chat/chat-runner.js.map +1 -1
  49. package/dist/interface/chat/chat-session-store.d.ts +32 -0
  50. package/dist/interface/chat/chat-session-store.d.ts.map +1 -1
  51. package/dist/interface/chat/chat-session-store.js +100 -10
  52. package/dist/interface/chat/chat-session-store.js.map +1 -1
  53. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
  54. package/dist/interface/chat/cross-platform-session.js +2 -5
  55. package/dist/interface/chat/cross-platform-session.js.map +1 -1
  56. package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
  57. package/dist/interface/chat/event-subscriber.js +41 -0
  58. package/dist/interface/chat/event-subscriber.js.map +1 -1
  59. package/dist/interface/chat/ingress-router.d.ts +0 -25
  60. package/dist/interface/chat/ingress-router.d.ts.map +1 -1
  61. package/dist/interface/chat/ingress-router.js +12 -85
  62. package/dist/interface/chat/ingress-router.js.map +1 -1
  63. package/dist/interface/chat/tend-command.d.ts.map +1 -1
  64. package/dist/interface/chat/tend-command.js +2 -0
  65. package/dist/interface/chat/tend-command.js.map +1 -1
  66. package/dist/interface/cli/commands/daemon-shared.d.ts +32 -0
  67. package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -0
  68. package/dist/interface/cli/commands/daemon-shared.js +120 -0
  69. package/dist/interface/cli/commands/daemon-shared.js.map +1 -0
  70. package/dist/interface/cli/commands/daemon.d.ts +2 -2
  71. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  72. package/dist/interface/cli/commands/daemon.js +4 -120
  73. package/dist/interface/cli/commands/daemon.js.map +1 -1
  74. package/dist/interface/cli/commands/schedule/history.d.ts.map +1 -1
  75. package/dist/interface/cli/commands/schedule/history.js +5 -1
  76. package/dist/interface/cli/commands/schedule/history.js.map +1 -1
  77. package/dist/interface/cli/commands/schedule.js +34 -4
  78. package/dist/interface/cli/commands/schedule.js.map +1 -1
  79. package/dist/interface/tui/app.d.ts.map +1 -1
  80. package/dist/interface/tui/app.js +14 -1
  81. package/dist/interface/tui/app.js.map +1 -1
  82. package/dist/interface/tui/chat/suggestions.d.ts.map +1 -1
  83. package/dist/interface/tui/chat/suggestions.js +118 -4
  84. package/dist/interface/tui/chat/suggestions.js.map +1 -1
  85. package/dist/interface/tui/entry-approval.d.ts +8 -0
  86. package/dist/interface/tui/entry-approval.d.ts.map +1 -0
  87. package/dist/interface/tui/entry-approval.js +59 -0
  88. package/dist/interface/tui/entry-approval.js.map +1 -0
  89. package/dist/interface/tui/entry-daemon.d.ts +12 -0
  90. package/dist/interface/tui/entry-daemon.d.ts.map +1 -0
  91. package/dist/interface/tui/entry-daemon.js +74 -0
  92. package/dist/interface/tui/entry-daemon.js.map +1 -0
  93. package/dist/interface/tui/entry-deps.d.ts +22 -0
  94. package/dist/interface/tui/entry-deps.d.ts.map +1 -0
  95. package/dist/interface/tui/entry-deps.js +409 -0
  96. package/dist/interface/tui/entry-deps.js.map +1 -0
  97. package/dist/interface/tui/entry.d.ts +2 -4
  98. package/dist/interface/tui/entry.d.ts.map +1 -1
  99. package/dist/interface/tui/entry.js +10 -557
  100. package/dist/interface/tui/entry.js.map +1 -1
  101. package/dist/interface/tui/fullscreen-chat-render.d.ts +127 -0
  102. package/dist/interface/tui/fullscreen-chat-render.d.ts.map +1 -0
  103. package/dist/interface/tui/fullscreen-chat-render.js +667 -0
  104. package/dist/interface/tui/fullscreen-chat-render.js.map +1 -0
  105. package/dist/interface/tui/fullscreen-chat.d.ts +2 -111
  106. package/dist/interface/tui/fullscreen-chat.d.ts.map +1 -1
  107. package/dist/interface/tui/fullscreen-chat.js +4 -663
  108. package/dist/interface/tui/fullscreen-chat.js.map +1 -1
  109. package/dist/interface/tui/help-overlay.d.ts.map +1 -1
  110. package/dist/interface/tui/help-overlay.js +1 -1
  111. package/dist/interface/tui/help-overlay.js.map +1 -1
  112. package/dist/interface/tui/intent-recognizer.js +2 -2
  113. package/dist/interface/tui/intent-recognizer.js.map +1 -1
  114. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
  115. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +8 -0
  116. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
  117. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts.map +1 -1
  118. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js +2 -1
  119. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js.map +1 -1
  120. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +2 -0
  121. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
  122. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +31 -0
  123. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
  124. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +1 -0
  125. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
  126. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
  127. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +1 -0
  128. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
  129. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +36 -2
  130. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
  131. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
  132. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +2 -1
  133. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
  134. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +19 -0
  135. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -1
  136. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +164 -14
  137. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
  138. package/dist/orchestrator/execution/reflection-generator.d.ts +1 -0
  139. package/dist/orchestrator/execution/reflection-generator.d.ts.map +1 -1
  140. package/dist/orchestrator/execution/reflection-generator.js +10 -1
  141. package/dist/orchestrator/execution/reflection-generator.js.map +1 -1
  142. package/dist/orchestrator/execution/task/task-context-enricher.d.ts +2 -0
  143. package/dist/orchestrator/execution/task/task-context-enricher.d.ts.map +1 -1
  144. package/dist/orchestrator/execution/task/task-context-enricher.js +9 -4
  145. package/dist/orchestrator/execution/task/task-context-enricher.js.map +1 -1
  146. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts +5 -0
  147. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts.map +1 -0
  148. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js +6 -0
  149. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js.map +1 -0
  150. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  151. package/dist/orchestrator/execution/task/task-generation.js +8 -3
  152. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  153. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +73 -0
  154. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -0
  155. package/dist/orchestrator/execution/task/task-lifecycle-runner.js +184 -0
  156. package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -0
  157. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +7 -7
  158. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  159. package/dist/orchestrator/execution/task/task-lifecycle.js +37 -181
  160. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  161. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts +2 -0
  162. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts.map +1 -0
  163. package/dist/orchestrator/execution/task/task-verifier-internal.js +2 -0
  164. package/dist/orchestrator/execution/task/task-verifier-internal.js.map +1 -0
  165. package/dist/orchestrator/goal/goal-negotiator.d.ts.map +1 -1
  166. package/dist/orchestrator/goal/goal-negotiator.js +23 -3
  167. package/dist/orchestrator/goal/goal-negotiator.js.map +1 -1
  168. package/dist/orchestrator/loop/core-loop/contracts.d.ts +1 -0
  169. package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
  170. package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
  171. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts +7 -0
  172. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts.map +1 -0
  173. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js +43 -0
  174. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js.map +1 -0
  175. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts +14 -0
  176. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts.map +1 -0
  177. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js +41 -0
  178. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js.map +1 -0
  179. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +3 -2
  180. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
  181. package/dist/orchestrator/loop/core-loop/iteration-kernel.js +16 -87
  182. package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -1
  183. package/dist/orchestrator/loop/core-loop/phase-policy.js +5 -5
  184. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts +9 -0
  185. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -0
  186. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +297 -0
  187. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -0
  188. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts +11 -0
  189. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts.map +1 -0
  190. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js +176 -0
  191. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js.map +1 -0
  192. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +3 -15
  193. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
  194. package/dist/orchestrator/loop/core-loop/task-cycle.js +10 -444
  195. package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
  196. package/dist/orchestrator/loop/core-loop.d.ts +3 -0
  197. package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
  198. package/dist/orchestrator/loop/core-loop.js +4 -0
  199. package/dist/orchestrator/loop/core-loop.js.map +1 -1
  200. package/dist/orchestrator/strategy/portfolio-manager.d.ts +3 -2
  201. package/dist/orchestrator/strategy/portfolio-manager.d.ts.map +1 -1
  202. package/dist/orchestrator/strategy/portfolio-manager.js +16 -11
  203. package/dist/orchestrator/strategy/portfolio-manager.js.map +1 -1
  204. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts +1 -1
  205. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts.map +1 -1
  206. package/dist/orchestrator/strategy/portfolio-rebalance.js +31 -9
  207. package/dist/orchestrator/strategy/portfolio-rebalance.js.map +1 -1
  208. package/dist/orchestrator/strategy/strategy-manager-base.d.ts +12 -2
  209. package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
  210. package/dist/orchestrator/strategy/strategy-manager-base.js +23 -7
  211. package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
  212. package/dist/orchestrator/strategy/strategy-manager.d.ts +1 -11
  213. package/dist/orchestrator/strategy/strategy-manager.d.ts.map +1 -1
  214. package/dist/orchestrator/strategy/strategy-manager.js +78 -19
  215. package/dist/orchestrator/strategy/strategy-manager.js.map +1 -1
  216. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts +18 -0
  217. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts.map +1 -0
  218. package/dist/platform/dream/dream-consolidator/fs-metrics.js +130 -0
  219. package/dist/platform/dream/dream-consolidator/fs-metrics.js.map +1 -0
  220. package/dist/platform/dream/dream-consolidator.d.ts +4 -14
  221. package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
  222. package/dist/platform/dream/dream-consolidator.js +46 -166
  223. package/dist/platform/dream/dream-consolidator.js.map +1 -1
  224. package/dist/platform/dream/dream-soil-sync.d.ts +1 -0
  225. package/dist/platform/dream/dream-soil-sync.d.ts.map +1 -1
  226. package/dist/platform/dream/dream-soil-sync.js +8 -1
  227. package/dist/platform/dream/dream-soil-sync.js.map +1 -1
  228. package/dist/platform/dream/dream-types.d.ts +5 -0
  229. package/dist/platform/dream/dream-types.d.ts.map +1 -1
  230. package/dist/platform/dream/dream-types.js +1 -0
  231. package/dist/platform/dream/dream-types.js.map +1 -1
  232. package/dist/platform/dream/playbook-memory.d.ts +4 -4
  233. package/dist/platform/drive/stall-detector/analysis.d.ts +5 -0
  234. package/dist/platform/drive/stall-detector/analysis.d.ts.map +1 -0
  235. package/dist/platform/drive/stall-detector/analysis.js +55 -0
  236. package/dist/platform/drive/stall-detector/analysis.js.map +1 -0
  237. package/dist/platform/drive/stall-detector/repetitive.d.ts +3 -0
  238. package/dist/platform/drive/stall-detector/repetitive.d.ts.map +1 -0
  239. package/dist/platform/drive/stall-detector/repetitive.js +72 -0
  240. package/dist/platform/drive/stall-detector/repetitive.js.map +1 -0
  241. package/dist/platform/drive/stall-detector/thresholds.d.ts +10 -0
  242. package/dist/platform/drive/stall-detector/thresholds.d.ts.map +1 -0
  243. package/dist/platform/drive/stall-detector/thresholds.js +61 -0
  244. package/dist/platform/drive/stall-detector/thresholds.js.map +1 -0
  245. package/dist/platform/drive/stall-detector.d.ts +2 -20
  246. package/dist/platform/drive/stall-detector.d.ts.map +1 -1
  247. package/dist/platform/drive/stall-detector.js +9 -202
  248. package/dist/platform/drive/stall-detector.js.map +1 -1
  249. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts +55 -0
  250. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts.map +1 -0
  251. package/dist/platform/knowledge/knowledge-manager-agent-memory.js +232 -0
  252. package/dist/platform/knowledge/knowledge-manager-agent-memory.js.map +1 -0
  253. package/dist/platform/knowledge/knowledge-manager-internals.d.ts +10 -0
  254. package/dist/platform/knowledge/knowledge-manager-internals.d.ts.map +1 -0
  255. package/dist/platform/knowledge/knowledge-manager-internals.js +43 -0
  256. package/dist/platform/knowledge/knowledge-manager-internals.js.map +1 -0
  257. package/dist/platform/knowledge/knowledge-manager-store.d.ts +13 -0
  258. package/dist/platform/knowledge/knowledge-manager-store.d.ts.map +1 -0
  259. package/dist/platform/knowledge/knowledge-manager-store.js +67 -0
  260. package/dist/platform/knowledge/knowledge-manager-store.js.map +1 -0
  261. package/dist/platform/knowledge/knowledge-manager.d.ts +6 -2
  262. package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
  263. package/dist/platform/knowledge/knowledge-manager.js +43 -344
  264. package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
  265. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts +4 -0
  266. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts.map +1 -0
  267. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js +106 -0
  268. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js.map +1 -0
  269. package/dist/platform/knowledge/memory/memory-lifecycle.d.ts.map +1 -1
  270. package/dist/platform/knowledge/memory/memory-lifecycle.js +6 -112
  271. package/dist/platform/knowledge/memory/memory-lifecycle.js.map +1 -1
  272. package/dist/platform/observation/capability-detector/prompts.d.ts +18 -0
  273. package/dist/platform/observation/capability-detector/prompts.d.ts.map +1 -0
  274. package/dist/platform/observation/capability-detector/prompts.js +80 -0
  275. package/dist/platform/observation/capability-detector/prompts.js.map +1 -0
  276. package/dist/platform/observation/capability-detector/recommendations.d.ts +5 -0
  277. package/dist/platform/observation/capability-detector/recommendations.d.ts.map +1 -0
  278. package/dist/platform/observation/capability-detector/recommendations.js +76 -0
  279. package/dist/platform/observation/capability-detector/recommendations.js.map +1 -0
  280. package/dist/platform/observation/capability-detector/types.d.ts +112 -0
  281. package/dist/platform/observation/capability-detector/types.d.ts.map +1 -0
  282. package/dist/platform/observation/capability-detector/types.js +75 -0
  283. package/dist/platform/observation/capability-detector/types.js.map +1 -0
  284. package/dist/platform/observation/capability-detector.d.ts +4 -9
  285. package/dist/platform/observation/capability-detector.d.ts.map +1 -1
  286. package/dist/platform/observation/capability-detector.js +12 -212
  287. package/dist/platform/observation/capability-detector.js.map +1 -1
  288. package/dist/platform/observation/context-provider/collector.d.ts +13 -0
  289. package/dist/platform/observation/context-provider/collector.d.ts.map +1 -0
  290. package/dist/platform/observation/context-provider/collector.js +259 -0
  291. package/dist/platform/observation/context-provider/collector.js.map +1 -0
  292. package/dist/platform/observation/context-provider/search-terms.d.ts +2 -0
  293. package/dist/platform/observation/context-provider/search-terms.d.ts.map +1 -0
  294. package/dist/platform/observation/context-provider/search-terms.js +24 -0
  295. package/dist/platform/observation/context-provider/search-terms.js.map +1 -0
  296. package/dist/platform/observation/context-provider/shared.d.ts +17 -0
  297. package/dist/platform/observation/context-provider/shared.d.ts.map +1 -0
  298. package/dist/platform/observation/context-provider/shared.js +87 -0
  299. package/dist/platform/observation/context-provider/shared.js.map +1 -0
  300. package/dist/platform/observation/context-provider.d.ts +3 -28
  301. package/dist/platform/observation/context-provider.d.ts.map +1 -1
  302. package/dist/platform/observation/context-provider.js +7 -395
  303. package/dist/platform/observation/context-provider.js.map +1 -1
  304. package/dist/platform/soil/compiled-memory-projections.d.ts +2 -0
  305. package/dist/platform/soil/compiled-memory-projections.d.ts.map +1 -1
  306. package/dist/platform/soil/compiled-memory-projections.js +59 -0
  307. package/dist/platform/soil/compiled-memory-projections.js.map +1 -1
  308. package/dist/platform/soil/contracts.d.ts +2 -2
  309. package/dist/platform/soil/retriever.d.ts +25 -0
  310. package/dist/platform/soil/retriever.d.ts.map +1 -1
  311. package/dist/platform/soil/retriever.js +94 -5
  312. package/dist/platform/soil/retriever.js.map +1 -1
  313. package/dist/platform/soil/sqlite-repository-helpers.d.ts +80 -0
  314. package/dist/platform/soil/sqlite-repository-helpers.d.ts.map +1 -0
  315. package/dist/platform/soil/sqlite-repository-helpers.js +143 -0
  316. package/dist/platform/soil/sqlite-repository-helpers.js.map +1 -0
  317. package/dist/platform/soil/sqlite-repository-search.d.ts +8 -0
  318. package/dist/platform/soil/sqlite-repository-search.d.ts.map +1 -0
  319. package/dist/platform/soil/sqlite-repository-search.js +367 -0
  320. package/dist/platform/soil/sqlite-repository-search.js.map +1 -0
  321. package/dist/platform/soil/sqlite-repository-storage.d.ts +8 -0
  322. package/dist/platform/soil/sqlite-repository-storage.d.ts.map +1 -0
  323. package/dist/platform/soil/sqlite-repository-storage.js +278 -0
  324. package/dist/platform/soil/sqlite-repository-storage.js.map +1 -0
  325. package/dist/platform/soil/sqlite-repository.d.ts +1 -4
  326. package/dist/platform/soil/sqlite-repository.d.ts.map +1 -1
  327. package/dist/platform/soil/sqlite-repository.js +26 -820
  328. package/dist/platform/soil/sqlite-repository.js.map +1 -1
  329. package/dist/runtime/daemon/index.d.ts +1 -1
  330. package/dist/runtime/daemon/index.d.ts.map +1 -1
  331. package/dist/runtime/daemon/index.js +1 -1
  332. package/dist/runtime/daemon/index.js.map +1 -1
  333. package/dist/runtime/daemon/maintenance.d.ts +2 -10
  334. package/dist/runtime/daemon/maintenance.d.ts.map +1 -1
  335. package/dist/runtime/daemon/maintenance.js +14 -45
  336. package/dist/runtime/daemon/maintenance.js.map +1 -1
  337. package/dist/runtime/daemon/runner-bootstrap.d.ts +25 -0
  338. package/dist/runtime/daemon/runner-bootstrap.d.ts.map +1 -0
  339. package/dist/runtime/daemon/runner-bootstrap.js +77 -0
  340. package/dist/runtime/daemon/runner-bootstrap.js.map +1 -0
  341. package/dist/runtime/daemon/runner-commands.d.ts +7 -7
  342. package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
  343. package/dist/runtime/daemon/runner-commands.js +35 -20
  344. package/dist/runtime/daemon/runner-commands.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 +3 -5
  347. package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
  348. package/dist/runtime/daemon/runner-resident-curiosity.d.ts +12 -0
  349. package/dist/runtime/daemon/runner-resident-curiosity.d.ts.map +1 -0
  350. package/dist/runtime/daemon/runner-resident-curiosity.js +155 -0
  351. package/dist/runtime/daemon/runner-resident-curiosity.js.map +1 -0
  352. package/dist/runtime/daemon/runner-resident-dream.d.ts +20 -0
  353. package/dist/runtime/daemon/runner-resident-dream.d.ts.map +1 -0
  354. package/dist/runtime/daemon/runner-resident-dream.js +148 -0
  355. package/dist/runtime/daemon/runner-resident-dream.js.map +1 -0
  356. package/dist/runtime/daemon/runner-resident-proactive.d.ts +4 -0
  357. package/dist/runtime/daemon/runner-resident-proactive.d.ts.map +1 -0
  358. package/dist/runtime/daemon/runner-resident-proactive.js +113 -0
  359. package/dist/runtime/daemon/runner-resident-proactive.js.map +1 -0
  360. package/dist/runtime/daemon/runner-resident-shared.d.ts +40 -0
  361. package/dist/runtime/daemon/runner-resident-shared.d.ts.map +1 -0
  362. package/dist/runtime/daemon/runner-resident-shared.js +101 -0
  363. package/dist/runtime/daemon/runner-resident-shared.js.map +1 -0
  364. package/dist/runtime/daemon/runner-resident.d.ts +4 -68
  365. package/dist/runtime/daemon/runner-resident.d.ts.map +1 -1
  366. package/dist/runtime/daemon/runner-resident.js +4 -506
  367. package/dist/runtime/daemon/runner-resident.js.map +1 -1
  368. package/dist/runtime/daemon/runner-runtime.d.ts +12 -0
  369. package/dist/runtime/daemon/runner-runtime.d.ts.map +1 -0
  370. package/dist/runtime/daemon/runner-runtime.js +43 -0
  371. package/dist/runtime/daemon/runner-runtime.js.map +1 -0
  372. package/dist/runtime/daemon/runner-startup.js +3 -4
  373. package/dist/runtime/daemon/runner-startup.js.map +1 -1
  374. package/dist/runtime/daemon/runner.d.ts +10 -23
  375. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  376. package/dist/runtime/daemon/runner.js +27 -110
  377. package/dist/runtime/daemon/runner.js.map +1 -1
  378. package/dist/runtime/daemon/wait-deadline-resolver.d.ts +5 -2
  379. package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
  380. package/dist/runtime/daemon/wait-deadline-resolver.js +55 -35
  381. package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
  382. package/dist/runtime/event/dispatcher.d.ts +0 -2
  383. package/dist/runtime/event/dispatcher.d.ts.map +1 -1
  384. package/dist/runtime/event/dispatcher.js +0 -4
  385. package/dist/runtime/event/dispatcher.js.map +1 -1
  386. package/dist/runtime/executor/goal-worker.d.ts +2 -1
  387. package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
  388. package/dist/runtime/executor/goal-worker.js +2 -1
  389. package/dist/runtime/executor/goal-worker.js.map +1 -1
  390. package/dist/runtime/executor/loop-supervisor.d.ts +3 -0
  391. package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
  392. package/dist/runtime/executor/loop-supervisor.js +37 -11
  393. package/dist/runtime/executor/loop-supervisor.js.map +1 -1
  394. package/dist/runtime/schedule/engine-cron-reflection.d.ts +31 -0
  395. package/dist/runtime/schedule/engine-cron-reflection.d.ts.map +1 -0
  396. package/dist/runtime/schedule/engine-cron-reflection.js +229 -0
  397. package/dist/runtime/schedule/engine-cron-reflection.js.map +1 -0
  398. package/dist/runtime/schedule/engine-execution.d.ts +47 -0
  399. package/dist/runtime/schedule/engine-execution.d.ts.map +1 -0
  400. package/dist/runtime/schedule/engine-execution.js +424 -0
  401. package/dist/runtime/schedule/engine-execution.js.map +1 -0
  402. package/dist/runtime/schedule/engine-heartbeat.d.ts +5 -0
  403. package/dist/runtime/schedule/engine-heartbeat.d.ts.map +1 -0
  404. package/dist/runtime/schedule/engine-heartbeat.js +104 -0
  405. package/dist/runtime/schedule/engine-heartbeat.js.map +1 -0
  406. package/dist/runtime/schedule/engine-layers.d.ts +2 -0
  407. package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
  408. package/dist/runtime/schedule/engine-layers.js +12 -228
  409. package/dist/runtime/schedule/engine-layers.js.map +1 -1
  410. package/dist/runtime/schedule/engine-mutations.d.ts +37 -0
  411. package/dist/runtime/schedule/engine-mutations.d.ts.map +1 -0
  412. package/dist/runtime/schedule/engine-mutations.js +263 -0
  413. package/dist/runtime/schedule/engine-mutations.js.map +1 -0
  414. package/dist/runtime/schedule/engine.d.ts +11 -38
  415. package/dist/runtime/schedule/engine.d.ts.map +1 -1
  416. package/dist/runtime/schedule/engine.js +65 -810
  417. package/dist/runtime/schedule/engine.js.map +1 -1
  418. package/dist/runtime/schedule/history.d.ts +16 -0
  419. package/dist/runtime/schedule/history.d.ts.map +1 -1
  420. package/dist/runtime/schedule/history.js +8 -0
  421. package/dist/runtime/schedule/history.js.map +1 -1
  422. package/dist/runtime/schedule/index.d.ts +1 -0
  423. package/dist/runtime/schedule/index.d.ts.map +1 -1
  424. package/dist/runtime/schedule/index.js +1 -0
  425. package/dist/runtime/schedule/index.js.map +1 -1
  426. package/dist/runtime/schedule/legacy-cron-migration.d.ts +9 -0
  427. package/dist/runtime/schedule/legacy-cron-migration.d.ts.map +1 -0
  428. package/dist/runtime/schedule/legacy-cron-migration.js +89 -0
  429. package/dist/runtime/schedule/legacy-cron-migration.js.map +1 -0
  430. package/dist/runtime/schedule/wait-projection.d.ts +6 -0
  431. package/dist/runtime/schedule/wait-projection.d.ts.map +1 -0
  432. package/dist/runtime/schedule/wait-projection.js +102 -0
  433. package/dist/runtime/schedule/wait-projection.js.map +1 -0
  434. package/dist/runtime/session-registry/registry-helpers.d.ts +34 -0
  435. package/dist/runtime/session-registry/registry-helpers.d.ts.map +1 -0
  436. package/dist/runtime/session-registry/registry-helpers.js +241 -0
  437. package/dist/runtime/session-registry/registry-helpers.js.map +1 -0
  438. package/dist/runtime/session-registry/registry.d.ts.map +1 -1
  439. package/dist/runtime/session-registry/registry.js +14 -243
  440. package/dist/runtime/session-registry/registry.js.map +1 -1
  441. package/dist/runtime/session-registry/types.d.ts +36 -36
  442. package/dist/runtime/store/runtime-operation-schemas.d.ts +36 -36
  443. package/dist/runtime/store/runtime-schemas.d.ts +2 -2
  444. package/dist/runtime/types/daemon.d.ts +10 -0
  445. package/dist/runtime/types/daemon.d.ts.map +1 -1
  446. package/dist/runtime/types/daemon.js +2 -0
  447. package/dist/runtime/types/daemon.js.map +1 -1
  448. package/dist/runtime/types/schedule.d.ts +65 -0
  449. package/dist/runtime/types/schedule.d.ts.map +1 -1
  450. package/dist/runtime/types/schedule.js +5 -0
  451. package/dist/runtime/types/schedule.js.map +1 -1
  452. package/dist/tools/builtin/exports.d.ts +1 -0
  453. package/dist/tools/builtin/exports.d.ts.map +1 -1
  454. package/dist/tools/builtin/exports.js +1 -0
  455. package/dist/tools/builtin/exports.js.map +1 -1
  456. package/dist/tools/builtin/factory.d.ts +2 -0
  457. package/dist/tools/builtin/factory.d.ts.map +1 -1
  458. package/dist/tools/builtin/factory.js +8 -1
  459. package/dist/tools/builtin/factory.js.map +1 -1
  460. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts +1 -0
  461. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts.map +1 -1
  462. package/dist/tools/fs/FileValidationTool/protected-path-policy.js +17 -4
  463. package/dist/tools/fs/FileValidationTool/protected-path-policy.js.map +1 -1
  464. package/dist/tools/fs/ListDirTool/ListDirTool.js +1 -1
  465. package/dist/tools/fs/ListDirTool/ListDirTool.js.map +1 -1
  466. package/dist/tools/kaggle/paths.d.ts.map +1 -1
  467. package/dist/tools/kaggle/paths.js +6 -0
  468. package/dist/tools/kaggle/paths.js.map +1 -1
  469. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts.map +1 -1
  470. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js +23 -2
  471. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js.map +1 -1
  472. package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts.map +1 -1
  473. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js +24 -2
  474. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js.map +1 -1
  475. package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -1
  476. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +43 -9
  477. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -1
  478. package/dist/tools/query/code-search-root.d.ts +8 -0
  479. package/dist/tools/query/code-search-root.d.ts.map +1 -0
  480. package/dist/tools/query/code-search-root.js +41 -0
  481. package/dist/tools/query/code-search-root.js.map +1 -0
  482. package/dist/tools/query/runtime-session-tools.d.ts +560 -0
  483. package/dist/tools/query/runtime-session-tools.d.ts.map +1 -0
  484. package/dist/tools/query/runtime-session-tools.js +1015 -0
  485. package/dist/tools/query/runtime-session-tools.js.map +1 -0
  486. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +821 -0
  487. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -0
  488. package/dist/tools/runtime/LongRunningRuntimeTools.js +845 -0
  489. package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -0
  490. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts +1 -0
  491. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts.map +1 -1
  492. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js +11 -0
  493. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js.map +1 -1
  494. package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
  495. package/dist/tools/system/ShellTool/ShellTool.js +2 -1
  496. package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
  497. package/dist/tools/types.d.ts +2 -0
  498. package/dist/tools/types.d.ts.map +1 -1
  499. package/dist/tools/types.js.map +1 -1
  500. package/package.json +1 -1
  501. package/dist/base/types/cron.d.ts +0 -2
  502. package/dist/base/types/cron.d.ts.map +0 -1
  503. package/dist/base/types/cron.js +0 -3
  504. package/dist/base/types/cron.js.map +0 -1
  505. package/dist/runtime/cron-scheduler.d.ts +0 -13
  506. package/dist/runtime/cron-scheduler.d.ts.map +0 -1
  507. package/dist/runtime/cron-scheduler.js +0 -90
  508. package/dist/runtime/cron-scheduler.js.map +0 -1
  509. package/dist/runtime/types/cron.d.ts +0 -59
  510. package/dist/runtime/types/cron.d.ts.map +0 -1
  511. package/dist/runtime/types/cron.js +0 -13
  512. package/dist/runtime/types/cron.js.map +0 -1
@@ -0,0 +1,594 @@
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 = host.eventBridge.emitLifecycleErrorEvent("No resumable native agentloop state found.", assistantBuffer.text, eventContext);
48
+ host.eventBridge.emitLifecycleEndEvent("error", elapsed_ms, eventContext, false);
49
+ return {
50
+ success: false,
51
+ output,
52
+ elapsed_ms,
53
+ };
54
+ }
55
+ host.eventBridge.emitCheckpoint(resumeOnly ? "Session resumed" : "Agent loop started", resumeOnly
56
+ ? "Resumable agent-loop state is loaded."
57
+ : "The agent loop can now inspect, plan, edit, or verify with visible tool activity.", eventContext, "execution");
58
+ host.eventBridge.emitActivity("lifecycle", "Calling model...", eventContext, "lifecycle:model");
59
+ const result = await host.deps.chatAgentLoopRunner.execute({
60
+ message: basePrompt,
61
+ cwd: executionCwd,
62
+ goalId: executionGoalId,
63
+ history: priorTurns.map((m) => ({
64
+ role: m.role === "assistant" ? "assistant" : "user",
65
+ content: m.content,
66
+ })),
67
+ eventSink: host.eventBridge.createAgentLoopEventSink(eventContext),
68
+ approvalFn: async (request) => {
69
+ if (host.deps.approvalFn) {
70
+ return host.deps.approvalFn(request.reason);
71
+ }
72
+ return false;
73
+ },
74
+ toolCallContext: {
75
+ executionPolicy: await host.getSessionExecutionPolicy(),
76
+ ...(host.getConversationSessionId() ? { conversationSessionId: host.getConversationSessionId() } : {}),
77
+ },
78
+ ...(host.getNativeAgentLoopStatePath() ? { resumeStatePath: host.getNativeAgentLoopStatePath() } : {}),
79
+ ...(resumeState ? { resumeState } : {}),
80
+ ...(resumeOnly ? { resumeOnly: true } : {}),
81
+ ...(agentLoopSystemPrompt ? { systemPrompt: agentLoopSystemPrompt } : {}),
82
+ abortSignal: activeAbortSignal,
83
+ });
84
+ const elapsed_ms = Date.now() - start;
85
+ const agentLoopUsage = result.agentLoop?.usage
86
+ ? normalizeUsageCounter(result.agentLoop.usage)
87
+ : zeroUsageCounter();
88
+ if (hasUsage(agentLoopUsage)) {
89
+ history.recordUsage("agentloop", agentLoopUsage);
90
+ }
91
+ if (result.output) {
92
+ host.eventBridge.pushAssistantDelta(result.output, assistantBuffer, eventContext);
93
+ }
94
+ if (result.success) {
95
+ const diffArtifact = await collectGitDiffArtifact(gitRoot);
96
+ if (diffArtifact) {
97
+ host.eventBridge.emitDiffArtifact(diffArtifact, eventContext);
98
+ }
99
+ await history.appendAssistantMessage(result.output);
100
+ host.eventBridge.emitCheckpoint("Response ready", "The agent-loop response has been persisted for this turn.", eventContext, "complete");
101
+ host.eventBridge.emitActivity("lifecycle", "Finalizing response...", eventContext, "lifecycle:finalizing");
102
+ host.eventBridge.emitEvent({
103
+ type: "assistant_final",
104
+ text: result.output,
105
+ persisted: true,
106
+ ...host.eventBridge.eventBase(eventContext),
107
+ });
108
+ host.eventBridge.emitLifecycleEndEvent("completed", elapsed_ms, eventContext, true);
109
+ }
110
+ else {
111
+ result.output = host.eventBridge.emitLifecycleErrorEvent(result.output || result.error || "Unknown error", assistantBuffer.text, eventContext);
112
+ host.eventBridge.emitLifecycleEndEvent("error", elapsed_ms, eventContext, false);
113
+ }
114
+ return {
115
+ success: result.success,
116
+ output: result.output,
117
+ elapsed_ms,
118
+ };
119
+ }
120
+ catch (err) {
121
+ const message = err instanceof Error ? err.message : String(err);
122
+ const output = host.eventBridge.emitLifecycleErrorEvent(message, assistantBuffer.text, eventContext);
123
+ host.eventBridge.emitLifecycleEndEvent("error", Date.now() - start, eventContext, false);
124
+ return {
125
+ success: false,
126
+ output,
127
+ elapsed_ms: Date.now() - start,
128
+ };
129
+ }
130
+ }
131
+ export async function executeToolLoopRoute(host, params) {
132
+ try {
133
+ host.eventBridge.emitCheckpoint("Tool loop started", "The model will choose tools from the active catalog.", params.eventContext, "execution");
134
+ const toolResult = await executeWithTools(host, params.prompt, params.eventContext, params.assistantBuffer, params.systemPrompt, params.executionGoalId);
135
+ const elapsed_ms = Date.now() - params.start;
136
+ if (hasUsage(toolResult.usage)) {
137
+ params.history.recordUsage("execution", toolResult.usage);
138
+ }
139
+ const diffArtifact = await collectGitDiffArtifact(params.gitRoot);
140
+ if (diffArtifact) {
141
+ host.eventBridge.emitDiffArtifact(diffArtifact, params.eventContext);
142
+ }
143
+ await params.history.appendAssistantMessage(toolResult.output);
144
+ host.eventBridge.emitCheckpoint("Response ready", "The tool-loop response has been persisted for this turn.", params.eventContext, "complete");
145
+ host.eventBridge.emitActivity("lifecycle", "Finalizing response...", params.eventContext, "lifecycle:finalizing");
146
+ host.eventBridge.emitEvent({
147
+ type: "assistant_final",
148
+ text: toolResult.output,
149
+ persisted: true,
150
+ ...host.eventBridge.eventBase(params.eventContext),
151
+ });
152
+ host.eventBridge.emitLifecycleEndEvent("completed", elapsed_ms, params.eventContext, true);
153
+ return { success: true, output: toolResult.output, elapsed_ms };
154
+ }
155
+ catch (err) {
156
+ const message = err instanceof Error ? err.message : String(err);
157
+ const output = host.eventBridge.emitLifecycleErrorEvent(message, params.assistantBuffer.text, params.eventContext);
158
+ host.eventBridge.emitLifecycleEndEvent("error", Date.now() - params.start, params.eventContext, false);
159
+ return {
160
+ success: false,
161
+ output,
162
+ elapsed_ms: Date.now() - params.start,
163
+ };
164
+ }
165
+ }
166
+ export async function executeAdapterRoute(host, params) {
167
+ const task = {
168
+ prompt: params.prompt,
169
+ timeout_ms: params.timeoutMs,
170
+ adapter_type: host.deps.adapter.adapterType,
171
+ cwd: params.cwd,
172
+ ...(params.systemPrompt ? { system_prompt: params.systemPrompt } : {}),
173
+ };
174
+ const resolvedTimeoutMs = task.timeout_ms ?? DEFAULT_TIMEOUT_MS;
175
+ host.eventBridge.emitCheckpoint("Adapter started", "The configured adapter has the current prompt and project context.", params.eventContext, "execution");
176
+ host.eventBridge.emitActivity("lifecycle", "Calling adapter...", params.eventContext, "lifecycle:adapter");
177
+ const adapterPromise = host.deps.adapter.execute(task);
178
+ const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Chat adapter timed out after ${resolvedTimeoutMs}ms`)), resolvedTimeoutMs));
179
+ let result;
180
+ try {
181
+ result = await Promise.race([adapterPromise, timeoutPromise]);
182
+ }
183
+ catch (err) {
184
+ const message = err instanceof Error ? err.message : String(err);
185
+ const output = host.eventBridge.emitLifecycleErrorEvent(message, params.assistantBuffer.text, params.eventContext);
186
+ const timeoutElapsedMs = Date.now() - params.start;
187
+ host.eventBridge.emitLifecycleEndEvent("error", timeoutElapsedMs, params.eventContext, false);
188
+ return {
189
+ success: false,
190
+ output,
191
+ elapsed_ms: timeoutElapsedMs,
192
+ };
193
+ }
194
+ if (!result.output && result.error) {
195
+ result = { ...result, output: `Error: ${result.error}` };
196
+ }
197
+ const elapsed_ms = Date.now() - params.start;
198
+ if (result.output) {
199
+ host.eventBridge.pushAssistantDelta(result.output, params.assistantBuffer, params.eventContext);
200
+ }
201
+ const diffArtifact = await collectGitDiffArtifact(params.gitRoot);
202
+ if (diffArtifact) {
203
+ let retries = 0;
204
+ const VERIFY_TIMEOUT_MS = 30_000;
205
+ host.eventBridge.emitCheckpoint("Changes detected", "Verification is starting because the turn changed the working tree.", params.eventContext, "changes");
206
+ host.eventBridge.emitActivity("lifecycle", "Checking result...", params.eventContext, "lifecycle:checking");
207
+ let verification = await Promise.race([
208
+ verifyChatAction(params.gitRoot, host.deps.toolExecutor, { force: true }),
209
+ new Promise((resolve) => setTimeout(() => resolve({ passed: true }), VERIFY_TIMEOUT_MS)),
210
+ ]);
211
+ while (!verification.passed && retries < MAX_VERIFY_RETRIES) {
212
+ retries++;
213
+ host.eventBridge.emitCheckpoint("Verification retry", `Attempt ${retries} of ${MAX_VERIFY_RETRIES} is repairing failed checks.`, params.eventContext, `verification-retry-${retries}`);
214
+ const retryPrompt = `The previous changes caused test failures. Please fix them.\n\nTest output:\n${verification.testOutput ?? verification.errors.join("\n")}`;
215
+ const retryTask = { ...task, prompt: retryPrompt };
216
+ result = await host.deps.adapter.execute(retryTask);
217
+ verification = await verifyChatAction(params.gitRoot, host.deps.toolExecutor, { force: true });
218
+ }
219
+ if (!verification.passed) {
220
+ const finalDiffArtifact = await collectGitDiffArtifact(params.gitRoot);
221
+ if (finalDiffArtifact) {
222
+ host.eventBridge.emitDiffArtifact(finalDiffArtifact, params.eventContext);
223
+ }
224
+ host.eventBridge.emitCheckpoint("Verification failed", `Checks are still failing after ${MAX_VERIFY_RETRIES} retries.`, params.eventContext, "verification");
225
+ const failureOutput = host.eventBridge.emitLifecycleErrorEvent(`Changes applied but tests are still failing after ${MAX_VERIFY_RETRIES} retries.`, params.assistantBuffer.text, params.eventContext);
226
+ host.eventBridge.emitLifecycleEndEvent("error", Date.now() - params.start, params.eventContext, false);
227
+ return {
228
+ success: false,
229
+ output: `${failureOutput}\n\nTest output:\n${verification.testOutput ?? verification.errors.join("\n")}`.trim(),
230
+ elapsed_ms: Date.now() - params.start,
231
+ };
232
+ }
233
+ const finalDiffArtifact = await collectGitDiffArtifact(params.gitRoot);
234
+ if (finalDiffArtifact) {
235
+ host.eventBridge.emitDiffArtifact(finalDiffArtifact, params.eventContext);
236
+ }
237
+ host.eventBridge.emitCheckpoint("Verification passed", "Changed files passed the configured chat verification.", params.eventContext, "verification");
238
+ }
239
+ if (result.success) {
240
+ await params.history.appendAssistantMessage(result.output);
241
+ host.eventBridge.emitCheckpoint("Response ready", "The assistant response has been persisted for this turn.", params.eventContext, "complete");
242
+ host.eventBridge.emitActivity("lifecycle", "Finalizing response...", params.eventContext, "lifecycle:finalizing");
243
+ host.eventBridge.emitEvent({
244
+ type: "assistant_final",
245
+ text: result.output,
246
+ persisted: true,
247
+ ...host.eventBridge.eventBase(params.eventContext),
248
+ });
249
+ host.eventBridge.emitLifecycleEndEvent("completed", elapsed_ms, params.eventContext, true);
250
+ }
251
+ else {
252
+ const partialText = params.assistantBuffer.text !== result.output ? params.assistantBuffer.text : "";
253
+ result.output = host.eventBridge.emitLifecycleErrorEvent(result.output || result.error || "Unknown error", partialText, params.eventContext);
254
+ host.eventBridge.emitLifecycleEndEvent("error", elapsed_ms, params.eventContext, false);
255
+ }
256
+ return {
257
+ success: result.success,
258
+ output: result.output,
259
+ elapsed_ms,
260
+ };
261
+ }
262
+ async function executeWithTools(host, prompt, eventContext, assistantBuffer, systemPrompt, goalId) {
263
+ const llmClient = host.deps.llmClient;
264
+ const messages = [{ role: "user", content: prompt }];
265
+ const toolCallContext = await buildToolCallContext(host, goalId);
266
+ const usage = zeroUsageCounter();
267
+ for (let loop = 0; loop < MAX_TOOL_LOOPS; loop++) {
268
+ const tools = host.deps.registry
269
+ ? toToolDefinitionsFiltered(host.deps.registry.listAll(), { activatedTools: host.activatedTools })
270
+ : [];
271
+ const supportsNativeToolCalling = llmClient.supportsToolCalling?.() !== false;
272
+ let response;
273
+ try {
274
+ host.eventBridge.emitActivity("lifecycle", "Calling model...", eventContext, "lifecycle:model");
275
+ response = await sendLLMMessage(host, llmClient, messages, {
276
+ ...(supportsNativeToolCalling
277
+ ? { tools, ...(systemPrompt ? { system: systemPrompt } : {}) }
278
+ : { system: buildPromptedToolProtocolSystemPrompt({ systemPrompt, tools }) }),
279
+ }, assistantBuffer, eventContext);
280
+ }
281
+ catch (err) {
282
+ console.error("[chat-runner] executeWithTools error:", err);
283
+ const hint = err instanceof Error ? `: ${err.message}` : "";
284
+ throw new Error(`Sorry, I encountered an error processing your request${hint}.`);
285
+ }
286
+ addUsageCounter(usage, usageFromLLMResponse(response));
287
+ const toolCalls = response.tool_calls?.length
288
+ ? response.tool_calls
289
+ : supportsNativeToolCalling
290
+ ? []
291
+ : extractPromptedToolCalls({
292
+ content: response.content,
293
+ tools,
294
+ createId: () => `prompted-${loop}-${crypto.randomUUID()}`,
295
+ }).map((call) => ({
296
+ id: call.id,
297
+ type: "function",
298
+ function: {
299
+ name: call.name,
300
+ arguments: JSON.stringify(call.input ?? {}),
301
+ },
302
+ }));
303
+ if (!supportsNativeToolCalling && toolCalls.length > 0) {
304
+ assistantBuffer.text = "";
305
+ }
306
+ if (toolCalls.length === 0) {
307
+ return {
308
+ output: assistantBuffer.text || response.content || "(no response)",
309
+ usage,
310
+ };
311
+ }
312
+ messages.push({ role: "assistant", content: response.content || "" });
313
+ for (const tc of toolCalls) {
314
+ let args = {};
315
+ try {
316
+ args = JSON.parse(tc.function.arguments || "{}");
317
+ }
318
+ catch {
319
+ // ignore parse errors, use empty args
320
+ }
321
+ const toolResult = await dispatchToolCall(host, tc.id, tc.function.name, args, toolCallContext, eventContext);
322
+ if (tc.function.name === "tool_search") {
323
+ activateToolSearchResults(host.activatedTools, toolResult);
324
+ }
325
+ messages.push({ role: "user", content: `Tool result for ${tc.function.name}:\n${toolResult}` });
326
+ }
327
+ }
328
+ const lastAssistant = [...messages].reverse().find(m => m.role === "assistant");
329
+ return {
330
+ output: lastAssistant?.content || "I was unable to complete the request within the allowed tool call limit.",
331
+ usage,
332
+ };
333
+ }
334
+ async function dispatchToolCall(host, toolCallId, name, args, context, eventContext) {
335
+ if (!host.deps.registry) {
336
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, "No tool registry configured"), eventContext, toolCallId);
337
+ return JSON.stringify({ error: "No tool registry configured" });
338
+ }
339
+ const tool = host.deps.registry.get(name);
340
+ if (!tool) {
341
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, `Unknown tool: ${name}`), eventContext, toolCallId);
342
+ return JSON.stringify({ error: `Unknown tool: ${name}` });
343
+ }
344
+ const startTime = Date.now();
345
+ try {
346
+ const parsed = tool.inputSchema.safeParse(args);
347
+ if (!parsed.success) {
348
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, `Invalid input: ${parsed.error.message}`), eventContext, toolCallId);
349
+ host.eventBridge.emitEvent({
350
+ type: "tool_end",
351
+ toolCallId,
352
+ toolName: name,
353
+ success: false,
354
+ summary: `Invalid input: ${parsed.error.message}`,
355
+ durationMs: Date.now() - startTime,
356
+ ...host.eventBridge.eventBase(eventContext),
357
+ });
358
+ return JSON.stringify({ error: `Invalid input: ${parsed.error.message}` });
359
+ }
360
+ host.eventBridge.emitEvent({
361
+ type: "tool_start",
362
+ toolCallId,
363
+ toolName: name,
364
+ args,
365
+ ...host.eventBridge.eventBase(eventContext),
366
+ });
367
+ host.eventBridge.emitActivity("tool", formatToolActivity("Running", name, JSON.stringify(args)), eventContext, toolCallId);
368
+ let result;
369
+ if (host.deps.toolExecutor) {
370
+ host.eventBridge.emitEvent({
371
+ type: "tool_update",
372
+ toolCallId,
373
+ toolName: name,
374
+ status: "running",
375
+ message: "running",
376
+ ...host.eventBridge.eventBase(eventContext),
377
+ });
378
+ host.deps.onToolStart?.(name, args);
379
+ result = await host.deps.toolExecutor.execute(name, parsed.data, context);
380
+ }
381
+ else {
382
+ const permResult = await tool.checkPermissions(parsed.data, context);
383
+ if (permResult.status === "denied") {
384
+ host.eventBridge.emitEvent({
385
+ type: "tool_end",
386
+ toolCallId,
387
+ toolName: name,
388
+ success: false,
389
+ summary: permResult.reason,
390
+ durationMs: Date.now() - startTime,
391
+ ...host.eventBridge.eventBase(eventContext),
392
+ });
393
+ return `Tool ${name} denied: ${permResult.reason}`;
394
+ }
395
+ if (permResult.status === "needs_approval") {
396
+ host.eventBridge.emitActivity("tool", formatToolActivity("Running", name, `awaiting approval: ${permResult.reason}`), eventContext, toolCallId);
397
+ host.eventBridge.emitEvent({
398
+ type: "tool_update",
399
+ toolCallId,
400
+ toolName: name,
401
+ status: "awaiting_approval",
402
+ message: permResult.reason,
403
+ ...host.eventBridge.eventBase(eventContext),
404
+ });
405
+ const approved = await context.approvalFn({
406
+ toolName: name,
407
+ input: parsed.data,
408
+ reason: permResult.reason,
409
+ permissionLevel: tool.metadata.permissionLevel,
410
+ isDestructive: tool.metadata.isDestructive,
411
+ reversibility: "unknown",
412
+ });
413
+ if (!approved) {
414
+ host.eventBridge.emitEvent({
415
+ type: "tool_end",
416
+ toolCallId,
417
+ toolName: name,
418
+ success: false,
419
+ summary: `Not approved: ${permResult.reason}`,
420
+ durationMs: Date.now() - startTime,
421
+ ...host.eventBridge.eventBase(eventContext),
422
+ });
423
+ return `Tool ${name} not approved: ${permResult.reason}`;
424
+ }
425
+ }
426
+ host.eventBridge.emitEvent({
427
+ type: "tool_update",
428
+ toolCallId,
429
+ toolName: name,
430
+ status: "running",
431
+ message: "running",
432
+ ...host.eventBridge.eventBase(eventContext),
433
+ });
434
+ host.deps.onToolStart?.(name, args);
435
+ result = await tool.call(parsed.data, context);
436
+ }
437
+ const durationMs = Date.now() - startTime;
438
+ host.deps.onToolEnd?.(name, { success: result.success, summary: result.summary || "...", durationMs });
439
+ host.eventBridge.emitActivity("tool", formatToolActivity(result.success ? "Finished" : "Failed", name, result.summary || "..."), eventContext, toolCallId);
440
+ host.eventBridge.emitEvent({
441
+ type: "tool_update",
442
+ toolCallId,
443
+ toolName: name,
444
+ status: "result",
445
+ message: result.summary || "...",
446
+ ...host.eventBridge.eventBase(eventContext),
447
+ });
448
+ host.eventBridge.emitEvent({
449
+ type: "tool_end",
450
+ toolCallId,
451
+ toolName: name,
452
+ success: result.success,
453
+ summary: result.summary || "...",
454
+ durationMs,
455
+ ...host.eventBridge.eventBase(eventContext),
456
+ });
457
+ return result.data != null ? JSON.stringify(result.data) : (result.summary ?? "(no result)");
458
+ }
459
+ catch (err) {
460
+ const message = err instanceof Error ? err.message : String(err);
461
+ const durationMs = Date.now() - startTime;
462
+ host.deps.onToolEnd?.(name, { success: false, summary: message, durationMs });
463
+ host.eventBridge.emitActivity("tool", formatToolActivity("Failed", name, message), eventContext, toolCallId);
464
+ host.eventBridge.emitEvent({
465
+ type: "tool_end",
466
+ toolCallId,
467
+ toolName: name,
468
+ success: false,
469
+ summary: message,
470
+ durationMs,
471
+ ...host.eventBridge.eventBase(eventContext),
472
+ });
473
+ return JSON.stringify({ error: `Tool ${name} failed: ${message}` });
474
+ }
475
+ }
476
+ async function sendLLMMessage(host, llmClient, messages, options, assistantBuffer, eventContext) {
477
+ let streamed = false;
478
+ if (llmClient.sendMessageStream) {
479
+ const response = await llmClient.sendMessageStream(messages, options, {
480
+ onTextDelta: (delta) => {
481
+ streamed = true;
482
+ host.eventBridge.pushAssistantDelta(delta, assistantBuffer, eventContext);
483
+ },
484
+ });
485
+ if (!streamed && response.content) {
486
+ host.eventBridge.pushAssistantDelta(response.content, assistantBuffer, eventContext);
487
+ }
488
+ return response;
489
+ }
490
+ const response = await llmClient.sendMessage(messages, options);
491
+ if (response.content) {
492
+ host.eventBridge.pushAssistantDelta(response.content, assistantBuffer, eventContext);
493
+ }
494
+ return response;
495
+ }
496
+ async function buildToolCallContext(host, goalId = host.deps.goalId) {
497
+ const executionPolicy = await host.getSessionExecutionPolicy();
498
+ return {
499
+ cwd: host.getSessionCwd() ?? process.cwd(),
500
+ goalId: goalId ?? "",
501
+ trustBalance: 0,
502
+ preApproved: false,
503
+ approvalFn: async (req) => {
504
+ if (host.deps.approvalFn) {
505
+ return host.deps.approvalFn(req.reason);
506
+ }
507
+ return false;
508
+ },
509
+ executionPolicy,
510
+ };
511
+ }
512
+ async function loadResumableAgentLoopState(host) {
513
+ if (!host.getNativeAgentLoopStatePath())
514
+ return null;
515
+ const raw = await host.deps.stateManager.readRaw(host.getNativeAgentLoopStatePath());
516
+ if (!isAgentLoopSessionState(raw))
517
+ return null;
518
+ if (raw.status === "completed")
519
+ return null;
520
+ return {
521
+ ...raw,
522
+ messages: [...raw.messages],
523
+ calledTools: [...raw.calledTools],
524
+ };
525
+ }
526
+ function isAgentLoopSessionState(value) {
527
+ if (!value || typeof value !== "object")
528
+ return false;
529
+ const candidate = value;
530
+ return typeof candidate["sessionId"] === "string"
531
+ && typeof candidate["traceId"] === "string"
532
+ && typeof candidate["turnId"] === "string"
533
+ && typeof candidate["goalId"] === "string"
534
+ && typeof candidate["cwd"] === "string"
535
+ && typeof candidate["modelRef"] === "string"
536
+ && Array.isArray(candidate["messages"])
537
+ && Array.isArray(candidate["calledTools"])
538
+ && typeof candidate["status"] === "string";
539
+ }
540
+ function activateToolSearchResults(activatedTools, toolResult) {
541
+ try {
542
+ const parsed = JSON.parse(toolResult);
543
+ const results = Array.isArray(parsed) ? parsed : null;
544
+ if (results) {
545
+ for (const item of results) {
546
+ if (item && typeof item === "object" && typeof item["name"] === "string") {
547
+ activatedTools.add(item["name"]);
548
+ }
549
+ }
550
+ }
551
+ }
552
+ catch {
553
+ // Non-JSON result or unexpected shape — ignore
554
+ }
555
+ }
556
+ function zeroUsageCounter() {
557
+ return { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
558
+ }
559
+ function normalizeUsageCounter(usage) {
560
+ const inputTokens = Number.isFinite(usage.inputTokens) ? Math.max(0, Math.floor(usage.inputTokens)) : 0;
561
+ const outputTokens = Number.isFinite(usage.outputTokens) ? Math.max(0, Math.floor(usage.outputTokens)) : 0;
562
+ const totalTokens = Number.isFinite(usage.totalTokens)
563
+ ? Math.max(0, Math.floor(usage.totalTokens))
564
+ : inputTokens + outputTokens;
565
+ return { inputTokens, outputTokens, totalTokens };
566
+ }
567
+ function usageFromLLMResponse(response) {
568
+ const inputTokens = response.usage?.input_tokens ?? 0;
569
+ const outputTokens = response.usage?.output_tokens ?? 0;
570
+ return {
571
+ inputTokens,
572
+ outputTokens,
573
+ totalTokens: inputTokens + outputTokens,
574
+ };
575
+ }
576
+ function addUsageCounter(target, delta) {
577
+ const normalizedDelta = normalizeUsageCounter(delta);
578
+ target.inputTokens += normalizedDelta.inputTokens;
579
+ target.outputTokens += normalizedDelta.outputTokens;
580
+ target.totalTokens += normalizedDelta.totalTokens;
581
+ }
582
+ function hasUsage(usage) {
583
+ return usage.totalTokens > 0 || usage.inputTokens > 0 || usage.outputTokens > 0;
584
+ }
585
+ export async function resolveSessionExecutionPolicy(currentPolicy, sessionCwd) {
586
+ if (currentPolicy)
587
+ return currentPolicy;
588
+ const config = await loadProviderConfig({ saveMigration: false });
589
+ return resolveExecutionPolicy({
590
+ workspaceRoot: sessionCwd ?? process.cwd(),
591
+ security: config.agent_loop?.security,
592
+ });
593
+ }
594
+ //# 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,CA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