pulseed 0.5.2 → 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 (824) 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/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/interface/chat/chat-event-state.d.ts +10 -0
  18. package/dist/interface/chat/chat-event-state.d.ts.map +1 -1
  19. package/dist/interface/chat/chat-event-state.js +184 -9
  20. package/dist/interface/chat/chat-event-state.js.map +1 -1
  21. package/dist/interface/chat/chat-events.d.ts +3 -1
  22. package/dist/interface/chat/chat-events.d.ts.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 +76 -0
  32. package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -0
  33. package/dist/interface/chat/chat-runner-commands.js +814 -0
  34. package/dist/interface/chat/chat-runner-commands.js.map +1 -0
  35. package/dist/interface/chat/chat-runner-event-bridge.d.ts +53 -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 +311 -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 +594 -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 +15 -0
  52. package/dist/interface/chat/chat-runner-support.d.ts.map +1 -0
  53. package/dist/interface/chat/chat-runner-support.js +116 -0
  54. package/dist/interface/chat/chat-runner-support.js.map +1 -0
  55. package/dist/interface/chat/chat-runner.d.ts +13 -133
  56. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  57. package/dist/interface/chat/chat-runner.js +242 -1974
  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/chat-verifier.d.ts +3 -1
  64. package/dist/interface/chat/chat-verifier.d.ts.map +1 -1
  65. package/dist/interface/chat/chat-verifier.js +2 -2
  66. package/dist/interface/chat/chat-verifier.js.map +1 -1
  67. package/dist/interface/chat/cross-platform-session.d.ts +1 -0
  68. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
  69. package/dist/interface/chat/cross-platform-session.js +23 -2
  70. package/dist/interface/chat/cross-platform-session.js.map +1 -1
  71. package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
  72. package/dist/interface/chat/event-subscriber.js +41 -0
  73. package/dist/interface/chat/event-subscriber.js.map +1 -1
  74. package/dist/interface/chat/failure-recovery.d.ts +11 -0
  75. package/dist/interface/chat/failure-recovery.d.ts.map +1 -0
  76. package/dist/interface/chat/failure-recovery.js +115 -0
  77. package/dist/interface/chat/failure-recovery.js.map +1 -0
  78. package/dist/interface/chat/ingress-router.d.ts +0 -16
  79. package/dist/interface/chat/ingress-router.d.ts.map +1 -1
  80. package/dist/interface/chat/ingress-router.js +12 -51
  81. package/dist/interface/chat/ingress-router.js.map +1 -1
  82. package/dist/interface/chat/tend-command.d.ts +8 -0
  83. package/dist/interface/chat/tend-command.d.ts.map +1 -1
  84. package/dist/interface/chat/tend-command.js +82 -4
  85. package/dist/interface/chat/tend-command.js.map +1 -1
  86. package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
  87. package/dist/interface/cli/cli-command-registry.js +4 -0
  88. package/dist/interface/cli/cli-command-registry.js.map +1 -1
  89. package/dist/interface/cli/commands/daemon-shared.d.ts +32 -0
  90. package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -0
  91. package/dist/interface/cli/commands/daemon-shared.js +120 -0
  92. package/dist/interface/cli/commands/daemon-shared.js.map +1 -0
  93. package/dist/interface/cli/commands/daemon.d.ts +2 -2
  94. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  95. package/dist/interface/cli/commands/daemon.js +4 -120
  96. package/dist/interface/cli/commands/daemon.js.map +1 -1
  97. package/dist/interface/cli/commands/runtime.d.ts +3 -0
  98. package/dist/interface/cli/commands/runtime.d.ts.map +1 -0
  99. package/dist/interface/cli/commands/runtime.js +231 -0
  100. package/dist/interface/cli/commands/runtime.js.map +1 -0
  101. package/dist/interface/cli/commands/schedule/history.d.ts.map +1 -1
  102. package/dist/interface/cli/commands/schedule/history.js +5 -1
  103. package/dist/interface/cli/commands/schedule/history.js.map +1 -1
  104. package/dist/interface/cli/commands/schedule.js +34 -4
  105. package/dist/interface/cli/commands/schedule.js.map +1 -1
  106. package/dist/interface/cli/utils.d.ts.map +1 -1
  107. package/dist/interface/cli/utils.js +4 -0
  108. package/dist/interface/cli/utils.js.map +1 -1
  109. package/dist/interface/tui/app.d.ts.map +1 -1
  110. package/dist/interface/tui/app.js +35 -1
  111. package/dist/interface/tui/app.js.map +1 -1
  112. package/dist/interface/tui/chat/scroll.d.ts +3 -0
  113. package/dist/interface/tui/chat/scroll.d.ts.map +1 -1
  114. package/dist/interface/tui/chat/scroll.js +15 -0
  115. package/dist/interface/tui/chat/scroll.js.map +1 -1
  116. package/dist/interface/tui/chat/suggestions.d.ts.map +1 -1
  117. package/dist/interface/tui/chat/suggestions.js +118 -4
  118. package/dist/interface/tui/chat/suggestions.js.map +1 -1
  119. package/dist/interface/tui/chat/types.d.ts +1 -1
  120. package/dist/interface/tui/chat/types.d.ts.map +1 -1
  121. package/dist/interface/tui/chat/viewport.d.ts.map +1 -1
  122. package/dist/interface/tui/chat/viewport.js +8 -2
  123. package/dist/interface/tui/chat/viewport.js.map +1 -1
  124. package/dist/interface/tui/chat-surface.d.ts +2 -0
  125. package/dist/interface/tui/chat-surface.d.ts.map +1 -1
  126. package/dist/interface/tui/chat-surface.js +11 -0
  127. package/dist/interface/tui/chat-surface.js.map +1 -1
  128. package/dist/interface/tui/chat.d.ts.map +1 -1
  129. package/dist/interface/tui/chat.js +15 -7
  130. package/dist/interface/tui/chat.js.map +1 -1
  131. package/dist/interface/tui/clipboard.d.ts +6 -1
  132. package/dist/interface/tui/clipboard.d.ts.map +1 -1
  133. package/dist/interface/tui/clipboard.js +24 -5
  134. package/dist/interface/tui/clipboard.js.map +1 -1
  135. package/dist/interface/tui/entry-approval.d.ts +8 -0
  136. package/dist/interface/tui/entry-approval.d.ts.map +1 -0
  137. package/dist/interface/tui/entry-approval.js +59 -0
  138. package/dist/interface/tui/entry-approval.js.map +1 -0
  139. package/dist/interface/tui/entry-daemon.d.ts +12 -0
  140. package/dist/interface/tui/entry-daemon.d.ts.map +1 -0
  141. package/dist/interface/tui/entry-daemon.js +74 -0
  142. package/dist/interface/tui/entry-daemon.js.map +1 -0
  143. package/dist/interface/tui/entry-deps.d.ts +22 -0
  144. package/dist/interface/tui/entry-deps.d.ts.map +1 -0
  145. package/dist/interface/tui/entry-deps.js +409 -0
  146. package/dist/interface/tui/entry-deps.js.map +1 -0
  147. package/dist/interface/tui/entry.d.ts +2 -4
  148. package/dist/interface/tui/entry.d.ts.map +1 -1
  149. package/dist/interface/tui/entry.js +15 -550
  150. package/dist/interface/tui/entry.js.map +1 -1
  151. package/dist/interface/tui/flicker/MouseTracking.d.ts +1 -1
  152. package/dist/interface/tui/flicker/MouseTracking.d.ts.map +1 -1
  153. package/dist/interface/tui/flicker/MouseTracking.js +8 -4
  154. package/dist/interface/tui/flicker/MouseTracking.js.map +1 -1
  155. package/dist/interface/tui/fullscreen-chat-render.d.ts +127 -0
  156. package/dist/interface/tui/fullscreen-chat-render.d.ts.map +1 -0
  157. package/dist/interface/tui/fullscreen-chat-render.js +667 -0
  158. package/dist/interface/tui/fullscreen-chat-render.js.map +1 -0
  159. package/dist/interface/tui/fullscreen-chat.d.ts +1 -29
  160. package/dist/interface/tui/fullscreen-chat.d.ts.map +1 -1
  161. package/dist/interface/tui/fullscreen-chat.js +306 -411
  162. package/dist/interface/tui/fullscreen-chat.js.map +1 -1
  163. package/dist/interface/tui/help-overlay.d.ts.map +1 -1
  164. package/dist/interface/tui/help-overlay.js +1 -1
  165. package/dist/interface/tui/help-overlay.js.map +1 -1
  166. package/dist/interface/tui/intent-recognizer.js +2 -2
  167. package/dist/interface/tui/intent-recognizer.js.map +1 -1
  168. package/dist/interface/tui/markdown-renderer.d.ts.map +1 -1
  169. package/dist/interface/tui/markdown-renderer.js +40 -12
  170. package/dist/interface/tui/markdown-renderer.js.map +1 -1
  171. package/dist/interface/tui/test-entry.js +1 -1
  172. package/dist/interface/tui/test-entry.js.map +1 -1
  173. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts.map +1 -1
  174. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js +1 -0
  175. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js.map +1 -1
  176. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
  177. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +35 -13
  178. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
  179. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.d.ts.map +1 -1
  180. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.js +7 -4
  181. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.js.map +1 -1
  182. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts.map +1 -1
  183. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js +2 -1
  184. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js.map +1 -1
  185. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +2 -0
  186. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
  187. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +31 -0
  188. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
  189. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +1 -0
  190. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
  191. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
  192. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +1 -0
  193. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
  194. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +42 -2
  195. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
  196. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -0
  197. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
  198. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +3 -1
  199. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
  200. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +19 -0
  201. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -1
  202. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +164 -14
  203. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
  204. package/dist/orchestrator/execution/agent-loop/index.d.ts +1 -0
  205. package/dist/orchestrator/execution/agent-loop/index.d.ts.map +1 -1
  206. package/dist/orchestrator/execution/agent-loop/index.js +1 -0
  207. package/dist/orchestrator/execution/agent-loop/index.js.map +1 -1
  208. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts +34 -0
  209. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts.map +1 -0
  210. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js +54 -0
  211. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js.map +1 -0
  212. package/dist/orchestrator/execution/reflection-generator.d.ts +1 -0
  213. package/dist/orchestrator/execution/reflection-generator.d.ts.map +1 -1
  214. package/dist/orchestrator/execution/reflection-generator.js +10 -1
  215. package/dist/orchestrator/execution/reflection-generator.js.map +1 -1
  216. package/dist/orchestrator/execution/task/task-context-enricher.d.ts +2 -0
  217. package/dist/orchestrator/execution/task/task-context-enricher.d.ts.map +1 -1
  218. package/dist/orchestrator/execution/task/task-context-enricher.js +9 -4
  219. package/dist/orchestrator/execution/task/task-context-enricher.js.map +1 -1
  220. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts +5 -0
  221. package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts.map +1 -0
  222. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js +6 -0
  223. package/dist/orchestrator/execution/task/task-execution-helpers-internal.js.map +1 -0
  224. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  225. package/dist/orchestrator/execution/task/task-generation.js +8 -3
  226. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  227. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +73 -0
  228. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -0
  229. package/dist/orchestrator/execution/task/task-lifecycle-runner.js +184 -0
  230. package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -0
  231. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +7 -7
  232. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  233. package/dist/orchestrator/execution/task/task-lifecycle.js +37 -181
  234. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  235. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts +2 -0
  236. package/dist/orchestrator/execution/task/task-verifier-internal.d.ts.map +1 -0
  237. package/dist/orchestrator/execution/task/task-verifier-internal.js +2 -0
  238. package/dist/orchestrator/execution/task/task-verifier-internal.js.map +1 -0
  239. package/dist/orchestrator/goal/goal-negotiator.d.ts.map +1 -1
  240. package/dist/orchestrator/goal/goal-negotiator.js +23 -3
  241. package/dist/orchestrator/goal/goal-negotiator.js.map +1 -1
  242. package/dist/orchestrator/loop/core-loop/contracts.d.ts +1 -0
  243. package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
  244. package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
  245. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts +7 -0
  246. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts.map +1 -0
  247. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js +43 -0
  248. package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js.map +1 -0
  249. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts +14 -0
  250. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts.map +1 -0
  251. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js +41 -0
  252. package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js.map +1 -0
  253. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +3 -2
  254. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
  255. package/dist/orchestrator/loop/core-loop/iteration-kernel.js +16 -87
  256. package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -1
  257. package/dist/orchestrator/loop/core-loop/phase-policy.d.ts.map +1 -1
  258. package/dist/orchestrator/loop/core-loop/phase-policy.js +8 -5
  259. package/dist/orchestrator/loop/core-loop/phase-policy.js.map +1 -1
  260. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts +9 -0
  261. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -0
  262. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +297 -0
  263. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -0
  264. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts +11 -0
  265. package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts.map +1 -0
  266. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js +176 -0
  267. package/dist/orchestrator/loop/core-loop/task-cycle-wait.js.map +1 -0
  268. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +3 -15
  269. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
  270. package/dist/orchestrator/loop/core-loop/task-cycle.js +10 -444
  271. package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
  272. package/dist/orchestrator/loop/core-loop.d.ts +3 -0
  273. package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
  274. package/dist/orchestrator/loop/core-loop.js +4 -0
  275. package/dist/orchestrator/loop/core-loop.js.map +1 -1
  276. package/dist/orchestrator/strategy/portfolio-manager.d.ts +3 -2
  277. package/dist/orchestrator/strategy/portfolio-manager.d.ts.map +1 -1
  278. package/dist/orchestrator/strategy/portfolio-manager.js +16 -11
  279. package/dist/orchestrator/strategy/portfolio-manager.js.map +1 -1
  280. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts +1 -1
  281. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts.map +1 -1
  282. package/dist/orchestrator/strategy/portfolio-rebalance.js +31 -9
  283. package/dist/orchestrator/strategy/portfolio-rebalance.js.map +1 -1
  284. package/dist/orchestrator/strategy/strategy-manager-base.d.ts +12 -2
  285. package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
  286. package/dist/orchestrator/strategy/strategy-manager-base.js +23 -7
  287. package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
  288. package/dist/orchestrator/strategy/strategy-manager.d.ts +1 -11
  289. package/dist/orchestrator/strategy/strategy-manager.d.ts.map +1 -1
  290. package/dist/orchestrator/strategy/strategy-manager.js +78 -19
  291. package/dist/orchestrator/strategy/strategy-manager.js.map +1 -1
  292. package/dist/platform/code-search/candidate-normalizer.d.ts +3 -0
  293. package/dist/platform/code-search/candidate-normalizer.d.ts.map +1 -0
  294. package/dist/platform/code-search/candidate-normalizer.js +61 -0
  295. package/dist/platform/code-search/candidate-normalizer.js.map +1 -0
  296. package/dist/platform/code-search/candidate.d.ts +25 -0
  297. package/dist/platform/code-search/candidate.d.ts.map +1 -0
  298. package/dist/platform/code-search/candidate.js +61 -0
  299. package/dist/platform/code-search/candidate.js.map +1 -0
  300. package/dist/platform/code-search/contracts.d.ts +275 -0
  301. package/dist/platform/code-search/contracts.d.ts.map +1 -0
  302. package/dist/platform/code-search/contracts.js +22 -0
  303. package/dist/platform/code-search/contracts.js.map +1 -0
  304. package/dist/platform/code-search/eval/fixtures.d.ts +14 -0
  305. package/dist/platform/code-search/eval/fixtures.d.ts.map +1 -0
  306. package/dist/platform/code-search/eval/fixtures.js +24 -0
  307. package/dist/platform/code-search/eval/fixtures.js.map +1 -0
  308. package/dist/platform/code-search/eval/metrics.d.ts +10 -0
  309. package/dist/platform/code-search/eval/metrics.d.ts.map +1 -0
  310. package/dist/platform/code-search/eval/metrics.js +20 -0
  311. package/dist/platform/code-search/eval/metrics.js.map +1 -0
  312. package/dist/platform/code-search/eval/runner.d.ts +3 -0
  313. package/dist/platform/code-search/eval/runner.d.ts.map +1 -0
  314. package/dist/platform/code-search/eval/runner.js +13 -0
  315. package/dist/platform/code-search/eval/runner.js.map +1 -0
  316. package/dist/platform/code-search/fusion.d.ts +6 -0
  317. package/dist/platform/code-search/fusion.d.ts.map +1 -0
  318. package/dist/platform/code-search/fusion.js +12 -0
  319. package/dist/platform/code-search/fusion.js.map +1 -0
  320. package/dist/platform/code-search/generated-detector.d.ts +15 -0
  321. package/dist/platform/code-search/generated-detector.d.ts.map +1 -0
  322. package/dist/platform/code-search/generated-detector.js +42 -0
  323. package/dist/platform/code-search/generated-detector.js.map +1 -0
  324. package/dist/platform/code-search/indexes/call-graph.d.ts +3 -0
  325. package/dist/platform/code-search/indexes/call-graph.d.ts.map +1 -0
  326. package/dist/platform/code-search/indexes/call-graph.js +13 -0
  327. package/dist/platform/code-search/indexes/call-graph.js.map +1 -0
  328. package/dist/platform/code-search/indexes/config-index.d.ts +3 -0
  329. package/dist/platform/code-search/indexes/config-index.d.ts.map +1 -0
  330. package/dist/platform/code-search/indexes/config-index.js +7 -0
  331. package/dist/platform/code-search/indexes/config-index.js.map +1 -0
  332. package/dist/platform/code-search/indexes/file-index.d.ts +5 -0
  333. package/dist/platform/code-search/indexes/file-index.d.ts.map +1 -0
  334. package/dist/platform/code-search/indexes/file-index.js +106 -0
  335. package/dist/platform/code-search/indexes/file-index.js.map +1 -0
  336. package/dist/platform/code-search/indexes/index-store.d.ts +6 -0
  337. package/dist/platform/code-search/indexes/index-store.d.ts.map +1 -0
  338. package/dist/platform/code-search/indexes/index-store.js +14 -0
  339. package/dist/platform/code-search/indexes/index-store.js.map +1 -0
  340. package/dist/platform/code-search/indexes/indexer.d.ts +3 -0
  341. package/dist/platform/code-search/indexes/indexer.d.ts.map +1 -0
  342. package/dist/platform/code-search/indexes/indexer.js +27 -0
  343. package/dist/platform/code-search/indexes/indexer.js.map +1 -0
  344. package/dist/platform/code-search/indexes/package-graph.d.ts +3 -0
  345. package/dist/platform/code-search/indexes/package-graph.d.ts.map +1 -0
  346. package/dist/platform/code-search/indexes/package-graph.js +26 -0
  347. package/dist/platform/code-search/indexes/package-graph.js.map +1 -0
  348. package/dist/platform/code-search/indexes/repo-map-index.d.ts +3 -0
  349. package/dist/platform/code-search/indexes/repo-map-index.d.ts.map +1 -0
  350. package/dist/platform/code-search/indexes/repo-map-index.js +26 -0
  351. package/dist/platform/code-search/indexes/repo-map-index.js.map +1 -0
  352. package/dist/platform/code-search/indexes/semantic-index.d.ts +3 -0
  353. package/dist/platform/code-search/indexes/semantic-index.d.ts.map +1 -0
  354. package/dist/platform/code-search/indexes/semantic-index.js +4 -0
  355. package/dist/platform/code-search/indexes/semantic-index.js.map +1 -0
  356. package/dist/platform/code-search/indexes/symbol-index.d.ts +3 -0
  357. package/dist/platform/code-search/indexes/symbol-index.d.ts.map +1 -0
  358. package/dist/platform/code-search/indexes/symbol-index.js +84 -0
  359. package/dist/platform/code-search/indexes/symbol-index.js.map +1 -0
  360. package/dist/platform/code-search/indexes/test-index.d.ts +3 -0
  361. package/dist/platform/code-search/indexes/test-index.d.ts.map +1 -0
  362. package/dist/platform/code-search/indexes/test-index.js +22 -0
  363. package/dist/platform/code-search/indexes/test-index.js.map +1 -0
  364. package/dist/platform/code-search/orchestrator.d.ts +9 -0
  365. package/dist/platform/code-search/orchestrator.d.ts.map +1 -0
  366. package/dist/platform/code-search/orchestrator.js +81 -0
  367. package/dist/platform/code-search/orchestrator.js.map +1 -0
  368. package/dist/platform/code-search/path-policy.d.ts +6 -0
  369. package/dist/platform/code-search/path-policy.d.ts.map +1 -0
  370. package/dist/platform/code-search/path-policy.js +60 -0
  371. package/dist/platform/code-search/path-policy.js.map +1 -0
  372. package/dist/platform/code-search/progressive-reader.d.ts +8 -0
  373. package/dist/platform/code-search/progressive-reader.d.ts.map +1 -0
  374. package/dist/platform/code-search/progressive-reader.js +173 -0
  375. package/dist/platform/code-search/progressive-reader.js.map +1 -0
  376. package/dist/platform/code-search/query-planner.d.ts +4 -0
  377. package/dist/platform/code-search/query-planner.d.ts.map +1 -0
  378. package/dist/platform/code-search/query-planner.js +107 -0
  379. package/dist/platform/code-search/query-planner.js.map +1 -0
  380. package/dist/platform/code-search/reranker.d.ts +4 -0
  381. package/dist/platform/code-search/reranker.d.ts.map +1 -0
  382. package/dist/platform/code-search/reranker.js +57 -0
  383. package/dist/platform/code-search/reranker.js.map +1 -0
  384. package/dist/platform/code-search/retrievers/callgraph-retriever.d.ts +6 -0
  385. package/dist/platform/code-search/retrievers/callgraph-retriever.d.ts.map +1 -0
  386. package/dist/platform/code-search/retrievers/callgraph-retriever.js +31 -0
  387. package/dist/platform/code-search/retrievers/callgraph-retriever.js.map +1 -0
  388. package/dist/platform/code-search/retrievers/config-retriever.d.ts +6 -0
  389. package/dist/platform/code-search/retrievers/config-retriever.d.ts.map +1 -0
  390. package/dist/platform/code-search/retrievers/config-retriever.js +23 -0
  391. package/dist/platform/code-search/retrievers/config-retriever.js.map +1 -0
  392. package/dist/platform/code-search/retrievers/lexical-retriever.d.ts +6 -0
  393. package/dist/platform/code-search/retrievers/lexical-retriever.d.ts.map +1 -0
  394. package/dist/platform/code-search/retrievers/lexical-retriever.js +49 -0
  395. package/dist/platform/code-search/retrievers/lexical-retriever.js.map +1 -0
  396. package/dist/platform/code-search/retrievers/package-retriever.d.ts +6 -0
  397. package/dist/platform/code-search/retrievers/package-retriever.d.ts.map +1 -0
  398. package/dist/platform/code-search/retrievers/package-retriever.js +29 -0
  399. package/dist/platform/code-search/retrievers/package-retriever.js.map +1 -0
  400. package/dist/platform/code-search/retrievers/repo-map-retriever.d.ts +6 -0
  401. package/dist/platform/code-search/retrievers/repo-map-retriever.d.ts.map +1 -0
  402. package/dist/platform/code-search/retrievers/repo-map-retriever.js +30 -0
  403. package/dist/platform/code-search/retrievers/repo-map-retriever.js.map +1 -0
  404. package/dist/platform/code-search/retrievers/semantic-retriever.d.ts +6 -0
  405. package/dist/platform/code-search/retrievers/semantic-retriever.d.ts.map +1 -0
  406. package/dist/platform/code-search/retrievers/semantic-retriever.js +18 -0
  407. package/dist/platform/code-search/retrievers/semantic-retriever.js.map +1 -0
  408. package/dist/platform/code-search/retrievers/stacktrace-retriever.d.ts +6 -0
  409. package/dist/platform/code-search/retrievers/stacktrace-retriever.d.ts.map +1 -0
  410. package/dist/platform/code-search/retrievers/stacktrace-retriever.js +30 -0
  411. package/dist/platform/code-search/retrievers/stacktrace-retriever.js.map +1 -0
  412. package/dist/platform/code-search/retrievers/symbol-retriever.d.ts +6 -0
  413. package/dist/platform/code-search/retrievers/symbol-retriever.d.ts.map +1 -0
  414. package/dist/platform/code-search/retrievers/symbol-retriever.js +32 -0
  415. package/dist/platform/code-search/retrievers/symbol-retriever.js.map +1 -0
  416. package/dist/platform/code-search/retrievers/test-retriever.d.ts +6 -0
  417. package/dist/platform/code-search/retrievers/test-retriever.d.ts.map +1 -0
  418. package/dist/platform/code-search/retrievers/test-retriever.js +30 -0
  419. package/dist/platform/code-search/retrievers/test-retriever.js.map +1 -0
  420. package/dist/platform/code-search/session-store.d.ts +11 -0
  421. package/dist/platform/code-search/session-store.d.ts.map +1 -0
  422. package/dist/platform/code-search/session-store.js +41 -0
  423. package/dist/platform/code-search/session-store.js.map +1 -0
  424. package/dist/platform/code-search/trace.d.ts +9 -0
  425. package/dist/platform/code-search/trace.d.ts.map +1 -0
  426. package/dist/platform/code-search/trace.js +25 -0
  427. package/dist/platform/code-search/trace.js.map +1 -0
  428. package/dist/platform/code-search/verification-retrieval.d.ts +3 -0
  429. package/dist/platform/code-search/verification-retrieval.d.ts.map +1 -0
  430. package/dist/platform/code-search/verification-retrieval.js +33 -0
  431. package/dist/platform/code-search/verification-retrieval.js.map +1 -0
  432. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts +18 -0
  433. package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts.map +1 -0
  434. package/dist/platform/dream/dream-consolidator/fs-metrics.js +130 -0
  435. package/dist/platform/dream/dream-consolidator/fs-metrics.js.map +1 -0
  436. package/dist/platform/dream/dream-consolidator.d.ts +4 -14
  437. package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
  438. package/dist/platform/dream/dream-consolidator.js +46 -166
  439. package/dist/platform/dream/dream-consolidator.js.map +1 -1
  440. package/dist/platform/dream/dream-soil-sync.d.ts +1 -0
  441. package/dist/platform/dream/dream-soil-sync.d.ts.map +1 -1
  442. package/dist/platform/dream/dream-soil-sync.js +8 -1
  443. package/dist/platform/dream/dream-soil-sync.js.map +1 -1
  444. package/dist/platform/dream/dream-types.d.ts +5 -0
  445. package/dist/platform/dream/dream-types.d.ts.map +1 -1
  446. package/dist/platform/dream/dream-types.js +1 -0
  447. package/dist/platform/dream/dream-types.js.map +1 -1
  448. package/dist/platform/dream/playbook-memory.d.ts +4 -4
  449. package/dist/platform/drive/stall-detector/analysis.d.ts +5 -0
  450. package/dist/platform/drive/stall-detector/analysis.d.ts.map +1 -0
  451. package/dist/platform/drive/stall-detector/analysis.js +55 -0
  452. package/dist/platform/drive/stall-detector/analysis.js.map +1 -0
  453. package/dist/platform/drive/stall-detector/repetitive.d.ts +3 -0
  454. package/dist/platform/drive/stall-detector/repetitive.d.ts.map +1 -0
  455. package/dist/platform/drive/stall-detector/repetitive.js +72 -0
  456. package/dist/platform/drive/stall-detector/repetitive.js.map +1 -0
  457. package/dist/platform/drive/stall-detector/thresholds.d.ts +10 -0
  458. package/dist/platform/drive/stall-detector/thresholds.d.ts.map +1 -0
  459. package/dist/platform/drive/stall-detector/thresholds.js +61 -0
  460. package/dist/platform/drive/stall-detector/thresholds.js.map +1 -0
  461. package/dist/platform/drive/stall-detector.d.ts +2 -20
  462. package/dist/platform/drive/stall-detector.d.ts.map +1 -1
  463. package/dist/platform/drive/stall-detector.js +9 -202
  464. package/dist/platform/drive/stall-detector.js.map +1 -1
  465. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts +55 -0
  466. package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts.map +1 -0
  467. package/dist/platform/knowledge/knowledge-manager-agent-memory.js +232 -0
  468. package/dist/platform/knowledge/knowledge-manager-agent-memory.js.map +1 -0
  469. package/dist/platform/knowledge/knowledge-manager-internals.d.ts +10 -0
  470. package/dist/platform/knowledge/knowledge-manager-internals.d.ts.map +1 -0
  471. package/dist/platform/knowledge/knowledge-manager-internals.js +43 -0
  472. package/dist/platform/knowledge/knowledge-manager-internals.js.map +1 -0
  473. package/dist/platform/knowledge/knowledge-manager-store.d.ts +13 -0
  474. package/dist/platform/knowledge/knowledge-manager-store.d.ts.map +1 -0
  475. package/dist/platform/knowledge/knowledge-manager-store.js +67 -0
  476. package/dist/platform/knowledge/knowledge-manager-store.js.map +1 -0
  477. package/dist/platform/knowledge/knowledge-manager.d.ts +6 -2
  478. package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
  479. package/dist/platform/knowledge/knowledge-manager.js +43 -344
  480. package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
  481. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts +4 -0
  482. package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts.map +1 -0
  483. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js +106 -0
  484. package/dist/platform/knowledge/memory/memory-lifecycle-storage.js.map +1 -0
  485. package/dist/platform/knowledge/memory/memory-lifecycle.d.ts.map +1 -1
  486. package/dist/platform/knowledge/memory/memory-lifecycle.js +6 -112
  487. package/dist/platform/knowledge/memory/memory-lifecycle.js.map +1 -1
  488. package/dist/platform/observation/capability-detector/prompts.d.ts +18 -0
  489. package/dist/platform/observation/capability-detector/prompts.d.ts.map +1 -0
  490. package/dist/platform/observation/capability-detector/prompts.js +80 -0
  491. package/dist/platform/observation/capability-detector/prompts.js.map +1 -0
  492. package/dist/platform/observation/capability-detector/recommendations.d.ts +5 -0
  493. package/dist/platform/observation/capability-detector/recommendations.d.ts.map +1 -0
  494. package/dist/platform/observation/capability-detector/recommendations.js +76 -0
  495. package/dist/platform/observation/capability-detector/recommendations.js.map +1 -0
  496. package/dist/platform/observation/capability-detector/types.d.ts +112 -0
  497. package/dist/platform/observation/capability-detector/types.d.ts.map +1 -0
  498. package/dist/platform/observation/capability-detector/types.js +75 -0
  499. package/dist/platform/observation/capability-detector/types.js.map +1 -0
  500. package/dist/platform/observation/capability-detector.d.ts +4 -9
  501. package/dist/platform/observation/capability-detector.d.ts.map +1 -1
  502. package/dist/platform/observation/capability-detector.js +12 -212
  503. package/dist/platform/observation/capability-detector.js.map +1 -1
  504. package/dist/platform/observation/context-provider/collector.d.ts +13 -0
  505. package/dist/platform/observation/context-provider/collector.d.ts.map +1 -0
  506. package/dist/platform/observation/context-provider/collector.js +259 -0
  507. package/dist/platform/observation/context-provider/collector.js.map +1 -0
  508. package/dist/platform/observation/context-provider/search-terms.d.ts +2 -0
  509. package/dist/platform/observation/context-provider/search-terms.d.ts.map +1 -0
  510. package/dist/platform/observation/context-provider/search-terms.js +24 -0
  511. package/dist/platform/observation/context-provider/search-terms.js.map +1 -0
  512. package/dist/platform/observation/context-provider/shared.d.ts +17 -0
  513. package/dist/platform/observation/context-provider/shared.d.ts.map +1 -0
  514. package/dist/platform/observation/context-provider/shared.js +87 -0
  515. package/dist/platform/observation/context-provider/shared.js.map +1 -0
  516. package/dist/platform/observation/context-provider.d.ts +3 -28
  517. package/dist/platform/observation/context-provider.d.ts.map +1 -1
  518. package/dist/platform/observation/context-provider.js +7 -358
  519. package/dist/platform/observation/context-provider.js.map +1 -1
  520. package/dist/platform/observation/workspace-context.d.ts.map +1 -1
  521. package/dist/platform/observation/workspace-context.js +27 -0
  522. package/dist/platform/observation/workspace-context.js.map +1 -1
  523. package/dist/platform/soil/compiled-memory-projections.d.ts +2 -0
  524. package/dist/platform/soil/compiled-memory-projections.d.ts.map +1 -1
  525. package/dist/platform/soil/compiled-memory-projections.js +59 -0
  526. package/dist/platform/soil/compiled-memory-projections.js.map +1 -1
  527. package/dist/platform/soil/contracts.d.ts +2 -2
  528. package/dist/platform/soil/retriever.d.ts +25 -0
  529. package/dist/platform/soil/retriever.d.ts.map +1 -1
  530. package/dist/platform/soil/retriever.js +94 -5
  531. package/dist/platform/soil/retriever.js.map +1 -1
  532. package/dist/platform/soil/sqlite-repository-helpers.d.ts +80 -0
  533. package/dist/platform/soil/sqlite-repository-helpers.d.ts.map +1 -0
  534. package/dist/platform/soil/sqlite-repository-helpers.js +143 -0
  535. package/dist/platform/soil/sqlite-repository-helpers.js.map +1 -0
  536. package/dist/platform/soil/sqlite-repository-search.d.ts +8 -0
  537. package/dist/platform/soil/sqlite-repository-search.d.ts.map +1 -0
  538. package/dist/platform/soil/sqlite-repository-search.js +367 -0
  539. package/dist/platform/soil/sqlite-repository-search.js.map +1 -0
  540. package/dist/platform/soil/sqlite-repository-storage.d.ts +8 -0
  541. package/dist/platform/soil/sqlite-repository-storage.d.ts.map +1 -0
  542. package/dist/platform/soil/sqlite-repository-storage.js +278 -0
  543. package/dist/platform/soil/sqlite-repository-storage.js.map +1 -0
  544. package/dist/platform/soil/sqlite-repository.d.ts +1 -4
  545. package/dist/platform/soil/sqlite-repository.d.ts.map +1 -1
  546. package/dist/platform/soil/sqlite-repository.js +26 -820
  547. package/dist/platform/soil/sqlite-repository.js.map +1 -1
  548. package/dist/runtime/daemon/client.d.ts +13 -1
  549. package/dist/runtime/daemon/client.d.ts.map +1 -1
  550. package/dist/runtime/daemon/client.js +2 -2
  551. package/dist/runtime/daemon/client.js.map +1 -1
  552. package/dist/runtime/daemon/index.d.ts +1 -1
  553. package/dist/runtime/daemon/index.d.ts.map +1 -1
  554. package/dist/runtime/daemon/index.js +1 -1
  555. package/dist/runtime/daemon/index.js.map +1 -1
  556. package/dist/runtime/daemon/maintenance.d.ts +2 -10
  557. package/dist/runtime/daemon/maintenance.d.ts.map +1 -1
  558. package/dist/runtime/daemon/maintenance.js +14 -45
  559. package/dist/runtime/daemon/maintenance.js.map +1 -1
  560. package/dist/runtime/daemon/runner-bootstrap.d.ts +25 -0
  561. package/dist/runtime/daemon/runner-bootstrap.d.ts.map +1 -0
  562. package/dist/runtime/daemon/runner-bootstrap.js +77 -0
  563. package/dist/runtime/daemon/runner-bootstrap.js.map +1 -0
  564. package/dist/runtime/daemon/runner-commands.d.ts +14 -6
  565. package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
  566. package/dist/runtime/daemon/runner-commands.js +63 -17
  567. package/dist/runtime/daemon/runner-commands.js.map +1 -1
  568. package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
  569. package/dist/runtime/daemon/runner-goal-cycle.js +3 -5
  570. package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
  571. package/dist/runtime/daemon/runner-resident-curiosity.d.ts +12 -0
  572. package/dist/runtime/daemon/runner-resident-curiosity.d.ts.map +1 -0
  573. package/dist/runtime/daemon/runner-resident-curiosity.js +155 -0
  574. package/dist/runtime/daemon/runner-resident-curiosity.js.map +1 -0
  575. package/dist/runtime/daemon/runner-resident-dream.d.ts +20 -0
  576. package/dist/runtime/daemon/runner-resident-dream.d.ts.map +1 -0
  577. package/dist/runtime/daemon/runner-resident-dream.js +148 -0
  578. package/dist/runtime/daemon/runner-resident-dream.js.map +1 -0
  579. package/dist/runtime/daemon/runner-resident-proactive.d.ts +4 -0
  580. package/dist/runtime/daemon/runner-resident-proactive.d.ts.map +1 -0
  581. package/dist/runtime/daemon/runner-resident-proactive.js +113 -0
  582. package/dist/runtime/daemon/runner-resident-proactive.js.map +1 -0
  583. package/dist/runtime/daemon/runner-resident-shared.d.ts +40 -0
  584. package/dist/runtime/daemon/runner-resident-shared.d.ts.map +1 -0
  585. package/dist/runtime/daemon/runner-resident-shared.js +101 -0
  586. package/dist/runtime/daemon/runner-resident-shared.js.map +1 -0
  587. package/dist/runtime/daemon/runner-resident.d.ts +4 -68
  588. package/dist/runtime/daemon/runner-resident.d.ts.map +1 -1
  589. package/dist/runtime/daemon/runner-resident.js +4 -506
  590. package/dist/runtime/daemon/runner-resident.js.map +1 -1
  591. package/dist/runtime/daemon/runner-runtime.d.ts +12 -0
  592. package/dist/runtime/daemon/runner-runtime.d.ts.map +1 -0
  593. package/dist/runtime/daemon/runner-runtime.js +43 -0
  594. package/dist/runtime/daemon/runner-runtime.js.map +1 -0
  595. package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
  596. package/dist/runtime/daemon/runner-startup.js +23 -3
  597. package/dist/runtime/daemon/runner-startup.js.map +1 -1
  598. package/dist/runtime/daemon/runner.d.ts +10 -23
  599. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  600. package/dist/runtime/daemon/runner.js +29 -111
  601. package/dist/runtime/daemon/runner.js.map +1 -1
  602. package/dist/runtime/daemon/runtime-root.d.ts +5 -0
  603. package/dist/runtime/daemon/runtime-root.d.ts.map +1 -0
  604. package/dist/runtime/daemon/runtime-root.js +60 -0
  605. package/dist/runtime/daemon/runtime-root.js.map +1 -0
  606. package/dist/runtime/daemon/wait-deadline-resolver.d.ts +5 -2
  607. package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
  608. package/dist/runtime/daemon/wait-deadline-resolver.js +55 -35
  609. package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
  610. package/dist/runtime/event/dispatcher.d.ts +0 -2
  611. package/dist/runtime/event/dispatcher.d.ts.map +1 -1
  612. package/dist/runtime/event/dispatcher.js +0 -4
  613. package/dist/runtime/event/dispatcher.js.map +1 -1
  614. package/dist/runtime/event/server-command-handler.d.ts.map +1 -1
  615. package/dist/runtime/event/server-command-handler.js +47 -3
  616. package/dist/runtime/event/server-command-handler.js.map +1 -1
  617. package/dist/runtime/executor/goal-worker.d.ts +3 -1
  618. package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
  619. package/dist/runtime/executor/goal-worker.js +3 -1
  620. package/dist/runtime/executor/goal-worker.js.map +1 -1
  621. package/dist/runtime/executor/loop-supervisor.d.ts +27 -1
  622. package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
  623. package/dist/runtime/executor/loop-supervisor.js +218 -13
  624. package/dist/runtime/executor/loop-supervisor.js.map +1 -1
  625. package/dist/runtime/gateway/telegram-gateway-adapter.d.ts.map +1 -1
  626. package/dist/runtime/gateway/telegram-gateway-adapter.js +2 -1
  627. package/dist/runtime/gateway/telegram-gateway-adapter.js.map +1 -1
  628. package/dist/runtime/schedule/engine-cron-reflection.d.ts +31 -0
  629. package/dist/runtime/schedule/engine-cron-reflection.d.ts.map +1 -0
  630. package/dist/runtime/schedule/engine-cron-reflection.js +229 -0
  631. package/dist/runtime/schedule/engine-cron-reflection.js.map +1 -0
  632. package/dist/runtime/schedule/engine-execution.d.ts +47 -0
  633. package/dist/runtime/schedule/engine-execution.d.ts.map +1 -0
  634. package/dist/runtime/schedule/engine-execution.js +424 -0
  635. package/dist/runtime/schedule/engine-execution.js.map +1 -0
  636. package/dist/runtime/schedule/engine-heartbeat.d.ts +5 -0
  637. package/dist/runtime/schedule/engine-heartbeat.d.ts.map +1 -0
  638. package/dist/runtime/schedule/engine-heartbeat.js +104 -0
  639. package/dist/runtime/schedule/engine-heartbeat.js.map +1 -0
  640. package/dist/runtime/schedule/engine-layers.d.ts +2 -0
  641. package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
  642. package/dist/runtime/schedule/engine-layers.js +12 -228
  643. package/dist/runtime/schedule/engine-layers.js.map +1 -1
  644. package/dist/runtime/schedule/engine-mutations.d.ts +37 -0
  645. package/dist/runtime/schedule/engine-mutations.d.ts.map +1 -0
  646. package/dist/runtime/schedule/engine-mutations.js +263 -0
  647. package/dist/runtime/schedule/engine-mutations.js.map +1 -0
  648. package/dist/runtime/schedule/engine.d.ts +11 -38
  649. package/dist/runtime/schedule/engine.d.ts.map +1 -1
  650. package/dist/runtime/schedule/engine.js +65 -810
  651. package/dist/runtime/schedule/engine.js.map +1 -1
  652. package/dist/runtime/schedule/history.d.ts +16 -0
  653. package/dist/runtime/schedule/history.d.ts.map +1 -1
  654. package/dist/runtime/schedule/history.js +8 -0
  655. package/dist/runtime/schedule/history.js.map +1 -1
  656. package/dist/runtime/schedule/index.d.ts +1 -0
  657. package/dist/runtime/schedule/index.d.ts.map +1 -1
  658. package/dist/runtime/schedule/index.js +1 -0
  659. package/dist/runtime/schedule/index.js.map +1 -1
  660. package/dist/runtime/schedule/legacy-cron-migration.d.ts +9 -0
  661. package/dist/runtime/schedule/legacy-cron-migration.d.ts.map +1 -0
  662. package/dist/runtime/schedule/legacy-cron-migration.js +89 -0
  663. package/dist/runtime/schedule/legacy-cron-migration.js.map +1 -0
  664. package/dist/runtime/schedule/wait-projection.d.ts +6 -0
  665. package/dist/runtime/schedule/wait-projection.d.ts.map +1 -0
  666. package/dist/runtime/schedule/wait-projection.js +102 -0
  667. package/dist/runtime/schedule/wait-projection.js.map +1 -0
  668. package/dist/runtime/session-registry/index.d.ts +3 -0
  669. package/dist/runtime/session-registry/index.d.ts.map +1 -0
  670. package/dist/runtime/session-registry/index.js +3 -0
  671. package/dist/runtime/session-registry/index.js.map +1 -0
  672. package/dist/runtime/session-registry/registry-helpers.d.ts +34 -0
  673. package/dist/runtime/session-registry/registry-helpers.d.ts.map +1 -0
  674. package/dist/runtime/session-registry/registry-helpers.js +241 -0
  675. package/dist/runtime/session-registry/registry-helpers.js.map +1 -0
  676. package/dist/runtime/session-registry/registry.d.ts +39 -0
  677. package/dist/runtime/session-registry/registry.d.ts.map +1 -0
  678. package/dist/runtime/session-registry/registry.js +532 -0
  679. package/dist/runtime/session-registry/registry.js.map +1 -0
  680. package/dist/runtime/session-registry/types.d.ts +985 -0
  681. package/dist/runtime/session-registry/types.d.ts.map +1 -0
  682. package/dist/runtime/session-registry/types.js +108 -0
  683. package/dist/runtime/session-registry/types.js.map +1 -0
  684. package/dist/runtime/store/background-run-store.d.ts +75 -0
  685. package/dist/runtime/store/background-run-store.d.ts.map +1 -0
  686. package/dist/runtime/store/background-run-store.js +157 -0
  687. package/dist/runtime/store/background-run-store.js.map +1 -0
  688. package/dist/runtime/store/index.d.ts +2 -0
  689. package/dist/runtime/store/index.d.ts.map +1 -1
  690. package/dist/runtime/store/index.js +1 -0
  691. package/dist/runtime/store/index.js.map +1 -1
  692. package/dist/runtime/store/runtime-operation-schemas.d.ts +12 -12
  693. package/dist/runtime/store/runtime-paths.d.ts +2 -0
  694. package/dist/runtime/store/runtime-paths.d.ts.map +1 -1
  695. package/dist/runtime/store/runtime-paths.js +6 -0
  696. package/dist/runtime/store/runtime-paths.js.map +1 -1
  697. package/dist/runtime/store/runtime-schemas.d.ts +2 -2
  698. package/dist/runtime/types/daemon.d.ts +13 -0
  699. package/dist/runtime/types/daemon.d.ts.map +1 -1
  700. package/dist/runtime/types/daemon.js +3 -0
  701. package/dist/runtime/types/daemon.js.map +1 -1
  702. package/dist/runtime/types/schedule.d.ts +65 -0
  703. package/dist/runtime/types/schedule.d.ts.map +1 -1
  704. package/dist/runtime/types/schedule.js +5 -0
  705. package/dist/runtime/types/schedule.js.map +1 -1
  706. package/dist/tools/builtin/exports.d.ts +5 -0
  707. package/dist/tools/builtin/exports.d.ts.map +1 -1
  708. package/dist/tools/builtin/exports.js +5 -0
  709. package/dist/tools/builtin/exports.js.map +1 -1
  710. package/dist/tools/builtin/factory.d.ts +2 -0
  711. package/dist/tools/builtin/factory.d.ts.map +1 -1
  712. package/dist/tools/builtin/factory.js +26 -1
  713. package/dist/tools/builtin/factory.js.map +1 -1
  714. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts +1 -0
  715. package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts.map +1 -1
  716. package/dist/tools/fs/FileValidationTool/protected-path-policy.js +17 -4
  717. package/dist/tools/fs/FileValidationTool/protected-path-policy.js.map +1 -1
  718. package/dist/tools/fs/GlobTool/GlobTool.js +2 -2
  719. package/dist/tools/fs/GlobTool/GlobTool.js.map +1 -1
  720. package/dist/tools/fs/GrepTool/GrepTool.js +2 -2
  721. package/dist/tools/fs/GrepTool/GrepTool.js.map +1 -1
  722. package/dist/tools/fs/ListDirTool/ListDirTool.js +1 -1
  723. package/dist/tools/fs/ListDirTool/ListDirTool.js.map +1 -1
  724. package/dist/tools/fs/ReadTool/ReadTool.js +2 -2
  725. package/dist/tools/fs/ReadTool/ReadTool.js.map +1 -1
  726. package/dist/tools/kaggle/KaggleExperimentTools.d.ts +395 -0
  727. package/dist/tools/kaggle/KaggleExperimentTools.d.ts.map +1 -0
  728. package/dist/tools/kaggle/KaggleExperimentTools.js +923 -0
  729. package/dist/tools/kaggle/KaggleExperimentTools.js.map +1 -0
  730. package/dist/tools/kaggle/KaggleSubmissionTools.d.ts +241 -0
  731. package/dist/tools/kaggle/KaggleSubmissionTools.d.ts.map +1 -0
  732. package/dist/tools/kaggle/KaggleSubmissionTools.js +558 -0
  733. package/dist/tools/kaggle/KaggleSubmissionTools.js.map +1 -0
  734. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts +105 -0
  735. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts.map +1 -0
  736. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js +135 -0
  737. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js.map +1 -0
  738. package/dist/tools/kaggle/index.d.ts +6 -0
  739. package/dist/tools/kaggle/index.d.ts.map +1 -0
  740. package/dist/tools/kaggle/index.js +6 -0
  741. package/dist/tools/kaggle/index.js.map +1 -0
  742. package/dist/tools/kaggle/metrics.d.ts +89 -0
  743. package/dist/tools/kaggle/metrics.d.ts.map +1 -0
  744. package/dist/tools/kaggle/metrics.js +51 -0
  745. package/dist/tools/kaggle/metrics.js.map +1 -0
  746. package/dist/tools/kaggle/paths.d.ts +15 -0
  747. package/dist/tools/kaggle/paths.d.ts.map +1 -0
  748. package/dist/tools/kaggle/paths.js +142 -0
  749. package/dist/tools/kaggle/paths.js.map +1 -0
  750. package/dist/tools/network/GitHubCliTool/GitHubCliTool.d.ts +2 -2
  751. package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.d.ts +801 -0
  752. package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.d.ts.map +1 -0
  753. package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.js +147 -0
  754. package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.js.map +1 -0
  755. package/dist/tools/query/CodeReadContextTool/constants.d.ts +5 -0
  756. package/dist/tools/query/CodeReadContextTool/constants.d.ts.map +1 -0
  757. package/dist/tools/query/CodeReadContextTool/constants.js +5 -0
  758. package/dist/tools/query/CodeReadContextTool/constants.js.map +1 -0
  759. package/dist/tools/query/CodeReadContextTool/prompt.d.ts +2 -0
  760. package/dist/tools/query/CodeReadContextTool/prompt.d.ts.map +1 -0
  761. package/dist/tools/query/CodeReadContextTool/prompt.js +6 -0
  762. package/dist/tools/query/CodeReadContextTool/prompt.js.map +1 -0
  763. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts +125 -0
  764. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts.map +1 -0
  765. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js +118 -0
  766. package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js.map +1 -0
  767. package/dist/tools/query/CodeSearchRepairTool/constants.d.ts +5 -0
  768. package/dist/tools/query/CodeSearchRepairTool/constants.d.ts.map +1 -0
  769. package/dist/tools/query/CodeSearchRepairTool/constants.js +5 -0
  770. package/dist/tools/query/CodeSearchRepairTool/constants.js.map +1 -0
  771. package/dist/tools/query/CodeSearchRepairTool/prompt.d.ts +2 -0
  772. package/dist/tools/query/CodeSearchRepairTool/prompt.d.ts.map +1 -0
  773. package/dist/tools/query/CodeSearchRepairTool/prompt.js +5 -0
  774. package/dist/tools/query/CodeSearchRepairTool/prompt.js.map +1 -0
  775. package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts +123 -0
  776. package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts.map +1 -0
  777. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js +117 -0
  778. package/dist/tools/query/CodeSearchTool/CodeSearchTool.js.map +1 -0
  779. package/dist/tools/query/CodeSearchTool/constants.d.ts +5 -0
  780. package/dist/tools/query/CodeSearchTool/constants.d.ts.map +1 -0
  781. package/dist/tools/query/CodeSearchTool/constants.js +5 -0
  782. package/dist/tools/query/CodeSearchTool/constants.js.map +1 -0
  783. package/dist/tools/query/CodeSearchTool/prompt.d.ts +2 -0
  784. package/dist/tools/query/CodeSearchTool/prompt.d.ts.map +1 -0
  785. package/dist/tools/query/CodeSearchTool/prompt.js +6 -0
  786. package/dist/tools/query/CodeSearchTool/prompt.js.map +1 -0
  787. package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -1
  788. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +43 -9
  789. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -1
  790. package/dist/tools/query/code-search-root.d.ts +8 -0
  791. package/dist/tools/query/code-search-root.d.ts.map +1 -0
  792. package/dist/tools/query/code-search-root.js +41 -0
  793. package/dist/tools/query/code-search-root.js.map +1 -0
  794. package/dist/tools/query/runtime-session-tools.d.ts +560 -0
  795. package/dist/tools/query/runtime-session-tools.d.ts.map +1 -0
  796. package/dist/tools/query/runtime-session-tools.js +1015 -0
  797. package/dist/tools/query/runtime-session-tools.js.map +1 -0
  798. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +821 -0
  799. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -0
  800. package/dist/tools/runtime/LongRunningRuntimeTools.js +845 -0
  801. package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -0
  802. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts +1 -0
  803. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts.map +1 -1
  804. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js +11 -0
  805. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js.map +1 -1
  806. package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
  807. package/dist/tools/system/ShellTool/ShellTool.js +2 -1
  808. package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
  809. package/dist/tools/types.d.ts +2 -0
  810. package/dist/tools/types.d.ts.map +1 -1
  811. package/dist/tools/types.js.map +1 -1
  812. package/package.json +2 -1
  813. package/dist/base/types/cron.d.ts +0 -2
  814. package/dist/base/types/cron.d.ts.map +0 -1
  815. package/dist/base/types/cron.js +0 -3
  816. package/dist/base/types/cron.js.map +0 -1
  817. package/dist/runtime/cron-scheduler.d.ts +0 -13
  818. package/dist/runtime/cron-scheduler.d.ts.map +0 -1
  819. package/dist/runtime/cron-scheduler.js +0 -90
  820. package/dist/runtime/cron-scheduler.js.map +0 -1
  821. package/dist/runtime/types/cron.d.ts +0 -59
  822. package/dist/runtime/types/cron.d.ts.map +0 -1
  823. package/dist/runtime/types/cron.js +0 -13
  824. package/dist/runtime/types/cron.js.map +0 -1
@@ -0,0 +1,1015 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { z } from "zod";
3
+ import { ChatHistory, ChatSessionSchema } from "../../interface/chat/chat-history.js";
4
+ import { ChatSessionCatalog } from "../../interface/chat/chat-session-store.js";
5
+ import { createRuntimeSessionRegistry } from "../../runtime/session-registry/index.js";
6
+ import { OutboxStore } from "../../runtime/store/outbox-store.js";
7
+ const READ_ONLY = true;
8
+ const READ_PERMISSION = "read_only";
9
+ const WRITE_PERMISSION = "write_local";
10
+ const TAGS = ["session", "self-grounding"];
11
+ function normalizeConversationSelector(selector) {
12
+ return selector.startsWith("session:conversation:")
13
+ ? selector.slice("session:conversation:".length)
14
+ : selector;
15
+ }
16
+ function toConversationRuntimeId(sessionId) {
17
+ return `session:conversation:${sessionId}`;
18
+ }
19
+ function buildCompletionMessage(session, status, summary) {
20
+ const title = session.title ? ` "${session.title}"` : "";
21
+ return `Session ${session.id}${title} ${status}: ${summary}`;
22
+ }
23
+ function summarizeMessages(messages, limit) {
24
+ return messages.slice(-limit).map((message) => ({
25
+ role: message.role,
26
+ content: message.content,
27
+ timestamp: message.timestamp,
28
+ turnIndex: message.turnIndex,
29
+ }));
30
+ }
31
+ function reindexMessages(messages) {
32
+ return messages.map((message, index) => ({
33
+ role: message.role,
34
+ content: message.content,
35
+ timestamp: message.timestamp,
36
+ turnIndex: index,
37
+ }));
38
+ }
39
+ function toChatSessionRecord(session) {
40
+ return {
41
+ id: session.id,
42
+ cwd: session.cwd,
43
+ createdAt: session.createdAt,
44
+ updatedAt: session.updatedAt,
45
+ messages: [...session.messages],
46
+ ...(session.parentSessionId ? { parentSessionId: session.parentSessionId } : {}),
47
+ ...(session.spawnedBySessionId ? { spawnedBySessionId: session.spawnedBySessionId } : {}),
48
+ ...(session.spawnedByRuntimeSessionId ? { spawnedByRuntimeSessionId: session.spawnedByRuntimeSessionId } : {}),
49
+ ...(session.spawnedAt ? { spawnedAt: session.spawnedAt } : {}),
50
+ ...(session.sessionStatus ? { sessionStatus: session.sessionStatus } : {}),
51
+ ...(session.sessionSummary ? { sessionSummary: session.sessionSummary } : {}),
52
+ ...(session.completedAt ? { completedAt: session.completedAt } : {}),
53
+ ...(session.goalId ? { goalId: session.goalId } : {}),
54
+ ...(session.strategyId ? { strategyId: session.strategyId } : {}),
55
+ ...(session.notificationPolicy ? { notificationPolicy: session.notificationPolicy } : {}),
56
+ ...(session.ownerId ? { ownerId: session.ownerId } : {}),
57
+ ...(session.ownerClaimedAt ? { ownerClaimedAt: session.ownerClaimedAt } : {}),
58
+ ...(session.waitingUntil ? { waitingUntil: session.waitingUntil } : {}),
59
+ ...(session.waitingCondition ? { waitingCondition: session.waitingCondition } : {}),
60
+ ...(session.retryCount !== null && session.retryCount !== undefined ? { retryCount: session.retryCount } : {}),
61
+ ...(session.lastRetryAt ? { lastRetryAt: session.lastRetryAt } : {}),
62
+ ...(session.lastResumedAt ? { lastResumedAt: session.lastResumedAt } : {}),
63
+ ...(session.notificationReplyTarget ? { notificationReplyTarget: session.notificationReplyTarget } : {}),
64
+ ...(session.parentNotificationStatus ? { parentNotificationStatus: session.parentNotificationStatus } : {}),
65
+ ...(session.parentNotificationSummary ? { parentNotificationSummary: session.parentNotificationSummary } : {}),
66
+ ...(session.parentNotifiedAt ? { parentNotifiedAt: session.parentNotifiedAt } : {}),
67
+ ...(session.compactionSummary ? { compactionSummary: session.compactionSummary } : {}),
68
+ ...(session.title ? { title: session.title } : {}),
69
+ ...(session.agentLoopStatePath ? { agentLoopStatePath: session.agentLoopStatePath } : {}),
70
+ ...(session.agentLoopStatus === "running" || session.agentLoopStatus === "completed" || session.agentLoopStatus === "failed"
71
+ ? { agentLoopStatus: session.agentLoopStatus }
72
+ : {}),
73
+ ...(session.agentLoopResumable ? { agentLoopResumable: true } : {}),
74
+ ...(session.agentLoopUpdatedAt ? { agentLoopUpdatedAt: session.agentLoopUpdatedAt } : {}),
75
+ ...(session.agentLoop ? { agentLoop: session.agentLoop } : {}),
76
+ ...(session.usage ? { usage: session.usage } : {}),
77
+ };
78
+ }
79
+ class RuntimeSessionToolService {
80
+ stateManager;
81
+ constructor(stateManager) {
82
+ this.stateManager = stateManager;
83
+ }
84
+ catalog() {
85
+ return new ChatSessionCatalog(this.stateManager);
86
+ }
87
+ registry() {
88
+ return createRuntimeSessionRegistry({ stateManager: this.stateManager });
89
+ }
90
+ outbox() {
91
+ return new OutboxStore(this.stateManager.getBaseDir());
92
+ }
93
+ async listSessions(input, context) {
94
+ const snapshot = await this.registry().snapshot();
95
+ const allowedConversationIds = await this.allowedConversationIds(input.scope, context);
96
+ const runtimeAllowedIds = allowedConversationIds
97
+ ? new Set(Array.from(allowedConversationIds, (id) => toConversationRuntimeId(id)))
98
+ : null;
99
+ const kindFilter = input.kinds?.length ? new Set(input.kinds) : null;
100
+ const sessions = snapshot.sessions.filter((session) => {
101
+ if (kindFilter && !kindFilter.has(session.kind))
102
+ return false;
103
+ if (input.activeOnly && session.status !== "active")
104
+ return false;
105
+ if (!runtimeAllowedIds)
106
+ return true;
107
+ if (session.kind === "conversation")
108
+ return runtimeAllowedIds.has(session.id);
109
+ return session.parent_session_id ? runtimeAllowedIds.has(session.parent_session_id) : false;
110
+ });
111
+ if (!input.includeRuns) {
112
+ return { sessions };
113
+ }
114
+ const runs = snapshot.background_runs.filter((run) => {
115
+ if (!runtimeAllowedIds)
116
+ return true;
117
+ if (run.parent_session_id && runtimeAllowedIds.has(run.parent_session_id))
118
+ return true;
119
+ return run.child_session_id ? sessions.some((session) => session.id === run.child_session_id) : false;
120
+ });
121
+ return { sessions, runs };
122
+ }
123
+ async loadHistory(selector, limit) {
124
+ const session = await this.resolveConversationSession(selector);
125
+ return {
126
+ sessionId: session.id,
127
+ runtimeSessionId: toConversationRuntimeId(session.id),
128
+ title: session.title,
129
+ parentSessionId: session.parentSessionId ?? null,
130
+ cwd: session.cwd,
131
+ createdAt: session.createdAt,
132
+ updatedAt: session.updatedAt,
133
+ ...(session.compactionSummary ? { compactionSummary: session.compactionSummary } : {}),
134
+ messages: summarizeMessages(session.messages, limit),
135
+ };
136
+ }
137
+ async readSession(selector) {
138
+ const session = await this.resolveConversationSession(selector);
139
+ const entries = await this.catalog().listSessions();
140
+ return {
141
+ sessionId: session.id,
142
+ runtimeSessionId: toConversationRuntimeId(session.id),
143
+ title: session.title,
144
+ parentSessionId: session.parentSessionId ?? null,
145
+ childSessionIds: entries.filter((entry) => entry.parentSessionId === session.id).map((entry) => entry.id),
146
+ cwd: session.cwd,
147
+ createdAt: session.createdAt,
148
+ updatedAt: session.updatedAt,
149
+ sessionStatus: session.sessionStatus ?? null,
150
+ sessionSummary: session.sessionSummary ?? null,
151
+ completedAt: session.completedAt ?? null,
152
+ goalId: session.goalId ?? null,
153
+ strategyId: session.strategyId ?? null,
154
+ notificationPolicy: session.notificationPolicy ?? null,
155
+ ownerId: session.ownerId ?? null,
156
+ ownerClaimedAt: session.ownerClaimedAt ?? null,
157
+ waitingUntil: session.waitingUntil ?? null,
158
+ waitingCondition: session.waitingCondition ?? null,
159
+ retryCount: session.retryCount ?? null,
160
+ lastRetryAt: session.lastRetryAt ?? null,
161
+ lastResumedAt: session.lastResumedAt ?? null,
162
+ parentNotificationStatus: session.parentNotificationStatus ?? null,
163
+ parentNotifiedAt: session.parentNotifiedAt ?? null,
164
+ notificationReplyTarget: session.notificationReplyTarget ?? null,
165
+ };
166
+ }
167
+ async listChildren(selector) {
168
+ const session = await this.resolveConversationSession(selector);
169
+ const entries = await this.catalog().listSessions();
170
+ const loadedChildren = await Promise.all(entries
171
+ .filter((entry) => entry.parentSessionId === session.id)
172
+ .map((entry) => this.catalog().loadSession(entry.id)));
173
+ return {
174
+ sessionId: session.id,
175
+ runtimeSessionId: toConversationRuntimeId(session.id),
176
+ children: loadedChildren
177
+ .filter((child) => child !== null)
178
+ .map((child) => ({
179
+ sessionId: child.id,
180
+ runtimeSessionId: toConversationRuntimeId(child.id),
181
+ title: child.title,
182
+ sessionStatus: child.sessionStatus ?? null,
183
+ goalId: child.goalId ?? null,
184
+ strategyId: child.strategyId ?? null,
185
+ waitingUntil: child.waitingUntil ?? null,
186
+ ownerId: child.ownerId ?? null,
187
+ })),
188
+ };
189
+ }
190
+ async spawnSession(input, context) {
191
+ const now = new Date().toISOString();
192
+ const sessionId = randomUUID();
193
+ const parentSessionId = context.conversationSessionId ?? null;
194
+ const baseSession = input.copy_recent_messages && parentSessionId
195
+ ? await this.catalog().loadSession(parentSessionId)
196
+ : null;
197
+ const seededMessages = input.copy_recent_messages && baseSession
198
+ ? reindexMessages(baseSession.messages.slice(-input.recent_message_limit))
199
+ : [];
200
+ const persisted = ChatSessionSchema.parse({
201
+ id: sessionId,
202
+ cwd: input.cwd?.trim() || context.cwd,
203
+ createdAt: now,
204
+ updatedAt: now,
205
+ messages: seededMessages,
206
+ ...(input.title?.trim() ? { title: input.title.trim() } : {}),
207
+ ...(parentSessionId ? { parentSessionId } : {}),
208
+ ...(parentSessionId ? { spawnedBySessionId: parentSessionId } : {}),
209
+ ...(context.sessionId ? { spawnedByRuntimeSessionId: context.sessionId } : {}),
210
+ spawnedAt: now,
211
+ ...(input.goal_id?.trim() ? { goalId: input.goal_id.trim() } : {}),
212
+ ...(input.strategy_id?.trim() ? { strategyId: input.strategy_id.trim() } : {}),
213
+ notificationPolicy: input.notification_policy ?? (parentSessionId ? "all_terminal" : "important_only"),
214
+ ...(input.owner_id?.trim() ? { ownerId: input.owner_id.trim() } : {}),
215
+ ...(input.owner_id?.trim() ? { ownerClaimedAt: now } : {}),
216
+ sessionStatus: input.message?.trim() ? "queued" : "idle",
217
+ parentNotificationStatus: parentSessionId ? "pending" : "none",
218
+ ...(baseSession?.notificationReplyTarget ? { notificationReplyTarget: baseSession.notificationReplyTarget } : {}),
219
+ agentLoopStatePath: `chat/agentloop/${sessionId}.state.json`,
220
+ });
221
+ const history = ChatHistory.fromSession(this.stateManager, persisted);
222
+ if (input.message?.trim()) {
223
+ await history.appendUserMessage(input.message.trim());
224
+ }
225
+ else {
226
+ await history.persist();
227
+ }
228
+ return {
229
+ sessionId,
230
+ runtimeSessionId: toConversationRuntimeId(sessionId),
231
+ parentSessionId,
232
+ resumeCommand: `/resume session:conversation:${sessionId}`,
233
+ messageQueued: Boolean(input.message?.trim()),
234
+ };
235
+ }
236
+ async sendToSession(selector, message) {
237
+ const session = await this.resolveConversationSession(selector);
238
+ const history = ChatHistory.fromSession(this.stateManager, toChatSessionRecord(session));
239
+ history.setSessionLifecycle({ status: "queued" });
240
+ await history.appendUserMessage(message.trim());
241
+ const updated = history.getSessionData();
242
+ return {
243
+ sessionId: session.id,
244
+ runtimeSessionId: toConversationRuntimeId(session.id),
245
+ messageCount: updated.messages.length,
246
+ updatedAt: updated.updatedAt ?? updated.createdAt,
247
+ };
248
+ }
249
+ async updateSession(selector, input) {
250
+ const session = await this.resolveConversationSession(selector);
251
+ const history = ChatHistory.fromSession(this.stateManager, toChatSessionRecord(session));
252
+ const completedAt = input.status === "completed" || input.status === "failed"
253
+ ? (input.completed_at ?? new Date().toISOString())
254
+ : null;
255
+ history.setSessionLifecycle({
256
+ status: input.status,
257
+ summary: input.summary ?? undefined,
258
+ completedAt,
259
+ goalId: input.goal_id ?? undefined,
260
+ strategyId: input.strategy_id ?? undefined,
261
+ notificationPolicy: input.notification_policy ?? undefined,
262
+ waitingUntil: input.waiting_until ?? (input.status === "waiting" ? null : undefined),
263
+ waitingCondition: input.waiting_condition ?? (input.status === "waiting" ? null : undefined),
264
+ lastResumedAt: input.status === "running" ? new Date().toISOString() : undefined,
265
+ parentNotificationStatus: session.parentSessionId && input.notify_parent ? "pending" : undefined,
266
+ });
267
+ if (input.append_assistant_message && input.summary?.trim()) {
268
+ await history.appendAssistantMessage(input.summary.trim());
269
+ }
270
+ else {
271
+ await history.persist();
272
+ }
273
+ let notified = false;
274
+ let parentNotificationStatus = session.parentNotificationStatus ?? null;
275
+ if (session.parentSessionId
276
+ && input.notify_parent
277
+ && input.summary?.trim()
278
+ && (input.status === "completed" || input.status === "failed")) {
279
+ try {
280
+ await this.notifyParentSession(session, input.status, input.summary.trim(), completedAt ?? new Date().toISOString());
281
+ parentNotificationStatus = "sent";
282
+ notified = true;
283
+ }
284
+ catch {
285
+ parentNotificationStatus = "failed";
286
+ }
287
+ const refreshed = ChatHistory.fromSession(this.stateManager, {
288
+ ...history.getSessionData(),
289
+ });
290
+ refreshed.setSessionLifecycle({
291
+ parentNotificationStatus,
292
+ parentNotificationSummary: input.summary.trim(),
293
+ parentNotifiedAt: notified ? new Date().toISOString() : null,
294
+ });
295
+ await refreshed.persist();
296
+ }
297
+ return {
298
+ sessionId: session.id,
299
+ runtimeSessionId: toConversationRuntimeId(session.id),
300
+ status: input.status,
301
+ parentSessionId: session.parentSessionId ?? null,
302
+ parentNotificationStatus,
303
+ notified,
304
+ };
305
+ }
306
+ async claimSession(selector, ownerId) {
307
+ const session = await this.resolveConversationSession(selector);
308
+ const history = ChatHistory.fromSession(this.stateManager, toChatSessionRecord(session));
309
+ const ownerClaimedAt = new Date().toISOString();
310
+ history.setSessionLifecycle({ ownerId, ownerClaimedAt });
311
+ await history.persist();
312
+ return {
313
+ sessionId: session.id,
314
+ runtimeSessionId: toConversationRuntimeId(session.id),
315
+ ownerId,
316
+ ownerClaimedAt,
317
+ };
318
+ }
319
+ async cancelSession(selector, reason) {
320
+ await this.updateSession(selector, {
321
+ session_id: selector,
322
+ status: "failed",
323
+ summary: reason,
324
+ append_assistant_message: false,
325
+ notify_parent: true,
326
+ });
327
+ const session = await this.resolveConversationSession(selector);
328
+ return {
329
+ sessionId: session.id,
330
+ runtimeSessionId: toConversationRuntimeId(session.id),
331
+ status: "failed",
332
+ };
333
+ }
334
+ async retrySession(selector, message) {
335
+ const session = await this.resolveConversationSession(selector);
336
+ const history = ChatHistory.fromSession(this.stateManager, toChatSessionRecord(session));
337
+ const retryCount = (session.retryCount ?? 0) + 1;
338
+ const now = new Date().toISOString();
339
+ history.setSessionLifecycle({
340
+ status: "queued",
341
+ completedAt: null,
342
+ summary: null,
343
+ retryCount,
344
+ lastRetryAt: now,
345
+ waitingUntil: null,
346
+ waitingCondition: null,
347
+ parentNotificationStatus: session.parentSessionId ? "pending" : session.parentNotificationStatus ?? null,
348
+ });
349
+ if (message?.trim()) {
350
+ await history.appendUserMessage(message.trim());
351
+ }
352
+ else {
353
+ await history.persist();
354
+ }
355
+ return {
356
+ sessionId: session.id,
357
+ runtimeSessionId: toConversationRuntimeId(session.id),
358
+ retryCount,
359
+ status: "queued",
360
+ };
361
+ }
362
+ async notifyParentSession(childSession, status, summary, completedAt) {
363
+ const parentSession = await this.resolveConversationSession(childSession.parentSessionId);
364
+ const parentHistory = ChatHistory.fromSession(this.stateManager, toChatSessionRecord(parentSession));
365
+ const message = buildCompletionMessage(childSession, status, summary);
366
+ await parentHistory.appendAssistantMessage(message);
367
+ const replyTarget = parentSession.notificationReplyTarget ?? childSession.notificationReplyTarget ?? null;
368
+ if (!replyTarget)
369
+ return;
370
+ const outbox = this.outbox();
371
+ const createdAt = Date.now();
372
+ await outbox.append({
373
+ event_type: "session_completion",
374
+ correlation_id: childSession.id,
375
+ created_at: createdAt,
376
+ payload: {
377
+ session_id: childSession.id,
378
+ runtime_session_id: toConversationRuntimeId(childSession.id),
379
+ parent_session_id: childSession.parentSessionId,
380
+ status,
381
+ summary,
382
+ completed_at: completedAt,
383
+ reply_target: replyTarget,
384
+ },
385
+ });
386
+ await outbox.append({
387
+ event_type: "chat_response",
388
+ correlation_id: childSession.id,
389
+ created_at: Date.now(),
390
+ payload: {
391
+ goalId: `session:${childSession.id}`,
392
+ goal_id: `session:${childSession.id}`,
393
+ message,
394
+ status,
395
+ reply_target: replyTarget,
396
+ session_completion: {
397
+ session_id: childSession.id,
398
+ runtime_session_id: toConversationRuntimeId(childSession.id),
399
+ parent_session_id: childSession.parentSessionId,
400
+ status,
401
+ summary,
402
+ completed_at: completedAt,
403
+ },
404
+ },
405
+ });
406
+ }
407
+ async resolveConversationSession(selector) {
408
+ const session = await this.catalog().loadSessionBySelector(normalizeConversationSelector(selector));
409
+ if (!session) {
410
+ throw new Error(`No chat session matched selector "${selector}".`);
411
+ }
412
+ return session;
413
+ }
414
+ async allowedConversationIds(scope, context) {
415
+ const currentConversationId = context.conversationSessionId ?? null;
416
+ if (scope === "all" || !currentConversationId)
417
+ return null;
418
+ if (scope === "self")
419
+ return new Set([currentConversationId]);
420
+ const entries = await this.catalog().listSessions();
421
+ const descendants = new Set([currentConversationId]);
422
+ let changed = true;
423
+ while (changed) {
424
+ changed = false;
425
+ for (const entry of entries) {
426
+ if (!entry.parentSessionId)
427
+ continue;
428
+ if (descendants.has(entry.parentSessionId) && !descendants.has(entry.id)) {
429
+ descendants.add(entry.id);
430
+ changed = true;
431
+ }
432
+ }
433
+ }
434
+ return descendants;
435
+ }
436
+ }
437
+ export const RuntimeSessionsListInputSchema = z.object({
438
+ scope: z.enum(["self", "tree", "all"]).default("tree"),
439
+ kinds: z.array(z.enum(["conversation", "agent", "coreloop"])).optional(),
440
+ activeOnly: z.boolean().default(false),
441
+ includeRuns: z.boolean().default(false),
442
+ });
443
+ export class RuntimeSessionsListTool {
444
+ service;
445
+ metadata = {
446
+ name: "sessions_list",
447
+ aliases: ["list_sessions", "runtime_sessions_list"],
448
+ permissionLevel: READ_PERMISSION,
449
+ isReadOnly: READ_ONLY,
450
+ isDestructive: false,
451
+ shouldDefer: false,
452
+ alwaysLoad: false,
453
+ maxConcurrency: 0,
454
+ maxOutputChars: 12000,
455
+ tags: [...TAGS],
456
+ };
457
+ inputSchema = RuntimeSessionsListInputSchema;
458
+ constructor(service) {
459
+ this.service = service;
460
+ }
461
+ description(_context) {
462
+ return "List PulSeed runtime sessions. Supports current-session scope, spawned-session tree scope, or all sessions.";
463
+ }
464
+ async call(input, context) {
465
+ const started = Date.now();
466
+ try {
467
+ const data = await this.service.listSessions(input, context);
468
+ return {
469
+ success: true,
470
+ data,
471
+ summary: `Found ${data.sessions.length} session(s)`,
472
+ durationMs: Date.now() - started,
473
+ };
474
+ }
475
+ catch (error) {
476
+ return {
477
+ success: false,
478
+ data: null,
479
+ summary: `sessions_list failed: ${error instanceof Error ? error.message : String(error)}`,
480
+ error: error instanceof Error ? error.message : String(error),
481
+ durationMs: Date.now() - started,
482
+ };
483
+ }
484
+ }
485
+ async checkPermissions() {
486
+ return { status: "allowed" };
487
+ }
488
+ isConcurrencySafe() {
489
+ return true;
490
+ }
491
+ }
492
+ export const RuntimeSessionsHistoryInputSchema = z.object({
493
+ session_id: z.string().min(1, "session_id is required"),
494
+ limit: z.number().int().positive().max(100).default(20),
495
+ });
496
+ export class RuntimeSessionsHistoryTool {
497
+ service;
498
+ metadata = {
499
+ name: "sessions_history",
500
+ aliases: ["read_session_history", "runtime_session_history"],
501
+ permissionLevel: READ_PERMISSION,
502
+ isReadOnly: READ_ONLY,
503
+ isDestructive: false,
504
+ shouldDefer: false,
505
+ alwaysLoad: false,
506
+ maxConcurrency: 0,
507
+ maxOutputChars: 12000,
508
+ tags: [...TAGS],
509
+ };
510
+ inputSchema = RuntimeSessionsHistoryInputSchema;
511
+ constructor(service) {
512
+ this.service = service;
513
+ }
514
+ description(_context) {
515
+ return "Read recent message history from a PulSeed chat conversation session by chat id or runtime session id.";
516
+ }
517
+ async call(input, _context) {
518
+ const started = Date.now();
519
+ try {
520
+ const data = await this.service.loadHistory(input.session_id, input.limit);
521
+ return {
522
+ success: true,
523
+ data,
524
+ summary: `Loaded ${data.messages.length} message(s) from session ${data.sessionId}`,
525
+ durationMs: Date.now() - started,
526
+ };
527
+ }
528
+ catch (error) {
529
+ return {
530
+ success: false,
531
+ data: null,
532
+ summary: `sessions_history failed: ${error instanceof Error ? error.message : String(error)}`,
533
+ error: error instanceof Error ? error.message : String(error),
534
+ durationMs: Date.now() - started,
535
+ };
536
+ }
537
+ }
538
+ async checkPermissions() {
539
+ return { status: "allowed" };
540
+ }
541
+ isConcurrencySafe() {
542
+ return true;
543
+ }
544
+ }
545
+ export const RuntimeSessionsReadInputSchema = z.object({
546
+ session_id: z.string().min(1, "session_id is required"),
547
+ });
548
+ export class RuntimeSessionsReadTool {
549
+ service;
550
+ metadata = {
551
+ name: "sessions_read",
552
+ aliases: ["read_session", "runtime_session_read"],
553
+ permissionLevel: READ_PERMISSION,
554
+ isReadOnly: READ_ONLY,
555
+ isDestructive: false,
556
+ shouldDefer: false,
557
+ alwaysLoad: false,
558
+ maxConcurrency: 0,
559
+ maxOutputChars: 12000,
560
+ tags: [...TAGS],
561
+ };
562
+ inputSchema = RuntimeSessionsReadInputSchema;
563
+ constructor(service) {
564
+ this.service = service;
565
+ }
566
+ description() {
567
+ return "Read one PulSeed conversation session with parent/child relationships, lifecycle state, and notification metadata.";
568
+ }
569
+ async call(input, _context) {
570
+ const started = Date.now();
571
+ try {
572
+ const data = await this.service.readSession(input.session_id);
573
+ return {
574
+ success: true,
575
+ data,
576
+ summary: `Loaded session ${data.sessionId}`,
577
+ durationMs: Date.now() - started,
578
+ };
579
+ }
580
+ catch (error) {
581
+ return {
582
+ success: false,
583
+ data: null,
584
+ summary: `sessions_read failed: ${error instanceof Error ? error.message : String(error)}`,
585
+ error: error instanceof Error ? error.message : String(error),
586
+ durationMs: Date.now() - started,
587
+ };
588
+ }
589
+ }
590
+ async checkPermissions() {
591
+ return { status: "allowed" };
592
+ }
593
+ isConcurrencySafe() {
594
+ return true;
595
+ }
596
+ }
597
+ export const RuntimeSessionsChildrenInputSchema = z.object({
598
+ session_id: z.string().min(1, "session_id is required"),
599
+ });
600
+ export class RuntimeSessionsChildrenTool {
601
+ service;
602
+ metadata = {
603
+ name: "sessions_children",
604
+ aliases: ["list_session_children", "runtime_session_children"],
605
+ permissionLevel: READ_PERMISSION,
606
+ isReadOnly: READ_ONLY,
607
+ isDestructive: false,
608
+ shouldDefer: false,
609
+ alwaysLoad: false,
610
+ maxConcurrency: 0,
611
+ maxOutputChars: 12000,
612
+ tags: [...TAGS],
613
+ };
614
+ inputSchema = RuntimeSessionsChildrenInputSchema;
615
+ constructor(service) {
616
+ this.service = service;
617
+ }
618
+ description() {
619
+ return "List child conversation sessions spawned from a PulSeed conversation session.";
620
+ }
621
+ async call(input, _context) {
622
+ const started = Date.now();
623
+ try {
624
+ const data = await this.service.listChildren(input.session_id);
625
+ return {
626
+ success: true,
627
+ data,
628
+ summary: `Loaded ${data.children.length} child session(s) for ${data.sessionId}`,
629
+ durationMs: Date.now() - started,
630
+ };
631
+ }
632
+ catch (error) {
633
+ return {
634
+ success: false,
635
+ data: null,
636
+ summary: `sessions_children failed: ${error instanceof Error ? error.message : String(error)}`,
637
+ error: error instanceof Error ? error.message : String(error),
638
+ durationMs: Date.now() - started,
639
+ };
640
+ }
641
+ }
642
+ async checkPermissions() {
643
+ return { status: "allowed" };
644
+ }
645
+ isConcurrencySafe() {
646
+ return true;
647
+ }
648
+ }
649
+ export const RuntimeSessionsSpawnInputSchema = z.object({
650
+ title: z.string().trim().min(1).max(200).optional(),
651
+ message: z.string().trim().min(1).optional(),
652
+ cwd: z.string().trim().min(1).optional(),
653
+ goal_id: z.string().trim().min(1).optional(),
654
+ strategy_id: z.string().trim().min(1).optional(),
655
+ notification_policy: z.enum(["silent", "important_only", "periodic", "all_terminal"]).optional(),
656
+ owner_id: z.string().trim().min(1).optional(),
657
+ copy_recent_messages: z.boolean().default(false),
658
+ recent_message_limit: z.number().int().positive().max(20).default(6),
659
+ });
660
+ export class RuntimeSessionsSpawnTool {
661
+ service;
662
+ metadata = {
663
+ name: "sessions_spawn",
664
+ aliases: ["spawn_session_runtime", "delegate_session"],
665
+ permissionLevel: WRITE_PERMISSION,
666
+ isReadOnly: false,
667
+ isDestructive: false,
668
+ shouldDefer: false,
669
+ alwaysLoad: false,
670
+ maxConcurrency: 1,
671
+ maxOutputChars: 8000,
672
+ tags: [...TAGS],
673
+ };
674
+ inputSchema = RuntimeSessionsSpawnInputSchema;
675
+ constructor(service) {
676
+ this.service = service;
677
+ }
678
+ description(_context) {
679
+ return "Create a new PulSeed chat conversation session, optionally seeded with a task message, so work can be moved into a separate session.";
680
+ }
681
+ async call(input, context) {
682
+ const started = Date.now();
683
+ try {
684
+ const data = await this.service.spawnSession(input, context);
685
+ return {
686
+ success: true,
687
+ data,
688
+ summary: `Spawned session ${data.sessionId}`,
689
+ contextModifier: `Use ${data.resumeCommand} to continue the delegated work in that separate session.`,
690
+ durationMs: Date.now() - started,
691
+ };
692
+ }
693
+ catch (error) {
694
+ return {
695
+ success: false,
696
+ data: null,
697
+ summary: `sessions_spawn failed: ${error instanceof Error ? error.message : String(error)}`,
698
+ error: error instanceof Error ? error.message : String(error),
699
+ durationMs: Date.now() - started,
700
+ };
701
+ }
702
+ }
703
+ async checkPermissions() {
704
+ return { status: "allowed" };
705
+ }
706
+ isConcurrencySafe() {
707
+ return false;
708
+ }
709
+ }
710
+ export const RuntimeSessionsSendInputSchema = z.object({
711
+ session_id: z.string().min(1, "session_id is required"),
712
+ message: z.string().trim().min(1, "message is required"),
713
+ });
714
+ export class RuntimeSessionsSendTool {
715
+ service;
716
+ metadata = {
717
+ name: "sessions_send",
718
+ aliases: ["send_session_message", "enqueue_session_message"],
719
+ permissionLevel: WRITE_PERMISSION,
720
+ isReadOnly: false,
721
+ isDestructive: false,
722
+ shouldDefer: false,
723
+ alwaysLoad: false,
724
+ maxConcurrency: 1,
725
+ maxOutputChars: 8000,
726
+ tags: [...TAGS],
727
+ };
728
+ inputSchema = RuntimeSessionsSendInputSchema;
729
+ constructor(service) {
730
+ this.service = service;
731
+ }
732
+ description(_context) {
733
+ return "Append a user message to another PulSeed chat conversation session by chat id or runtime session id.";
734
+ }
735
+ async call(input, _context) {
736
+ const started = Date.now();
737
+ try {
738
+ const data = await this.service.sendToSession(input.session_id, input.message);
739
+ return {
740
+ success: true,
741
+ data,
742
+ summary: `Queued a message for session ${data.sessionId}`,
743
+ contextModifier: `Resume ${data.runtimeSessionId} later to act on the queued message in that separate session.`,
744
+ durationMs: Date.now() - started,
745
+ };
746
+ }
747
+ catch (error) {
748
+ return {
749
+ success: false,
750
+ data: null,
751
+ summary: `sessions_send failed: ${error instanceof Error ? error.message : String(error)}`,
752
+ error: error instanceof Error ? error.message : String(error),
753
+ durationMs: Date.now() - started,
754
+ };
755
+ }
756
+ }
757
+ async checkPermissions() {
758
+ return { status: "allowed" };
759
+ }
760
+ isConcurrencySafe() {
761
+ return false;
762
+ }
763
+ }
764
+ export const RuntimeSessionsUpdateInputSchema = z.object({
765
+ session_id: z.string().min(1, "session_id is required"),
766
+ status: z.enum(["queued", "running", "waiting", "completed", "failed"]),
767
+ summary: z.string().trim().min(1).optional(),
768
+ goal_id: z.string().trim().min(1).optional(),
769
+ strategy_id: z.string().trim().min(1).optional(),
770
+ notification_policy: z.enum(["silent", "important_only", "periodic", "all_terminal"]).optional(),
771
+ waiting_until: z.string().trim().min(1).nullable().optional(),
772
+ waiting_condition: z.string().trim().min(1).nullable().optional(),
773
+ append_assistant_message: z.boolean().default(false),
774
+ notify_parent: z.boolean().default(false),
775
+ completed_at: z.string().optional(),
776
+ }).superRefine((value, ctx) => {
777
+ if ((value.status === "completed" || value.status === "failed") && !value.summary) {
778
+ ctx.addIssue({
779
+ code: z.ZodIssueCode.custom,
780
+ path: ["summary"],
781
+ message: "summary is required when marking a session completed or failed",
782
+ });
783
+ }
784
+ if (value.status === "waiting" && !value.waiting_until && !value.waiting_condition) {
785
+ ctx.addIssue({
786
+ code: z.ZodIssueCode.custom,
787
+ path: ["waiting_until"],
788
+ message: "waiting_until or waiting_condition is required when marking a session waiting",
789
+ });
790
+ }
791
+ });
792
+ export class RuntimeSessionsUpdateTool {
793
+ service;
794
+ metadata = {
795
+ name: "sessions_update",
796
+ aliases: ["update_session_status", "complete_session", "fail_session"],
797
+ permissionLevel: WRITE_PERMISSION,
798
+ isReadOnly: false,
799
+ isDestructive: false,
800
+ shouldDefer: false,
801
+ alwaysLoad: false,
802
+ maxConcurrency: 1,
803
+ maxOutputChars: 8000,
804
+ tags: [...TAGS],
805
+ };
806
+ inputSchema = RuntimeSessionsUpdateInputSchema;
807
+ constructor(service) {
808
+ this.service = service;
809
+ }
810
+ description() {
811
+ return "Update a PulSeed conversation session lifecycle state. Can mark child sessions completed or failed and notify the parent session durably.";
812
+ }
813
+ async call(input, _context) {
814
+ const started = Date.now();
815
+ try {
816
+ const data = await this.service.updateSession(input.session_id, input);
817
+ return {
818
+ success: true,
819
+ data,
820
+ summary: `Updated session ${data.sessionId} to ${data.status}`,
821
+ durationMs: Date.now() - started,
822
+ };
823
+ }
824
+ catch (error) {
825
+ return {
826
+ success: false,
827
+ data: null,
828
+ summary: `sessions_update failed: ${error instanceof Error ? error.message : String(error)}`,
829
+ error: error instanceof Error ? error.message : String(error),
830
+ durationMs: Date.now() - started,
831
+ };
832
+ }
833
+ }
834
+ async checkPermissions() {
835
+ return { status: "allowed" };
836
+ }
837
+ isConcurrencySafe() {
838
+ return false;
839
+ }
840
+ }
841
+ export const RuntimeSessionsClaimInputSchema = z.object({
842
+ session_id: z.string().min(1, "session_id is required"),
843
+ owner_id: z.string().trim().min(1, "owner_id is required"),
844
+ });
845
+ export class RuntimeSessionsClaimTool {
846
+ service;
847
+ metadata = {
848
+ name: "sessions_claim",
849
+ aliases: ["claim_session", "runtime_session_claim"],
850
+ permissionLevel: WRITE_PERMISSION,
851
+ isReadOnly: false,
852
+ isDestructive: false,
853
+ shouldDefer: false,
854
+ alwaysLoad: false,
855
+ maxConcurrency: 1,
856
+ maxOutputChars: 8000,
857
+ tags: [...TAGS],
858
+ };
859
+ inputSchema = RuntimeSessionsClaimInputSchema;
860
+ constructor(service) {
861
+ this.service = service;
862
+ }
863
+ description() {
864
+ return "Claim ownership of a PulSeed conversation session so delegated work has an explicit owner.";
865
+ }
866
+ async call(input, _context) {
867
+ const started = Date.now();
868
+ try {
869
+ const data = await this.service.claimSession(input.session_id, input.owner_id);
870
+ return {
871
+ success: true,
872
+ data,
873
+ summary: `Claimed session ${data.sessionId} for ${data.ownerId}`,
874
+ durationMs: Date.now() - started,
875
+ };
876
+ }
877
+ catch (error) {
878
+ return {
879
+ success: false,
880
+ data: null,
881
+ summary: `sessions_claim failed: ${error instanceof Error ? error.message : String(error)}`,
882
+ error: error instanceof Error ? error.message : String(error),
883
+ durationMs: Date.now() - started,
884
+ };
885
+ }
886
+ }
887
+ async checkPermissions() {
888
+ return { status: "allowed" };
889
+ }
890
+ isConcurrencySafe() {
891
+ return false;
892
+ }
893
+ }
894
+ export const RuntimeSessionsCancelInputSchema = z.object({
895
+ session_id: z.string().min(1, "session_id is required"),
896
+ reason: z.string().trim().min(1, "reason is required"),
897
+ });
898
+ export class RuntimeSessionsCancelTool {
899
+ service;
900
+ metadata = {
901
+ name: "sessions_cancel",
902
+ aliases: ["cancel_session", "runtime_session_cancel"],
903
+ permissionLevel: WRITE_PERMISSION,
904
+ isReadOnly: false,
905
+ isDestructive: false,
906
+ shouldDefer: false,
907
+ alwaysLoad: false,
908
+ maxConcurrency: 1,
909
+ maxOutputChars: 8000,
910
+ tags: [...TAGS],
911
+ };
912
+ inputSchema = RuntimeSessionsCancelInputSchema;
913
+ constructor(service) {
914
+ this.service = service;
915
+ }
916
+ description() {
917
+ return "Cancel a PulSeed conversation session by marking it failed and notifying its parent if configured.";
918
+ }
919
+ async call(input, _context) {
920
+ const started = Date.now();
921
+ try {
922
+ const data = await this.service.cancelSession(input.session_id, input.reason);
923
+ return {
924
+ success: true,
925
+ data,
926
+ summary: `Canceled session ${data.sessionId}`,
927
+ durationMs: Date.now() - started,
928
+ };
929
+ }
930
+ catch (error) {
931
+ return {
932
+ success: false,
933
+ data: null,
934
+ summary: `sessions_cancel failed: ${error instanceof Error ? error.message : String(error)}`,
935
+ error: error instanceof Error ? error.message : String(error),
936
+ durationMs: Date.now() - started,
937
+ };
938
+ }
939
+ }
940
+ async checkPermissions() {
941
+ return { status: "allowed" };
942
+ }
943
+ isConcurrencySafe() {
944
+ return false;
945
+ }
946
+ }
947
+ export const RuntimeSessionsRetryInputSchema = z.object({
948
+ session_id: z.string().min(1, "session_id is required"),
949
+ message: z.string().trim().min(1).optional(),
950
+ });
951
+ export class RuntimeSessionsRetryTool {
952
+ service;
953
+ metadata = {
954
+ name: "sessions_retry",
955
+ aliases: ["retry_session", "runtime_session_retry"],
956
+ permissionLevel: WRITE_PERMISSION,
957
+ isReadOnly: false,
958
+ isDestructive: false,
959
+ shouldDefer: false,
960
+ alwaysLoad: false,
961
+ maxConcurrency: 1,
962
+ maxOutputChars: 8000,
963
+ tags: [...TAGS],
964
+ };
965
+ inputSchema = RuntimeSessionsRetryInputSchema;
966
+ constructor(service) {
967
+ this.service = service;
968
+ }
969
+ description() {
970
+ return "Re-queue a PulSeed conversation session for another attempt, preserving retry metadata.";
971
+ }
972
+ async call(input, _context) {
973
+ const started = Date.now();
974
+ try {
975
+ const data = await this.service.retrySession(input.session_id, input.message);
976
+ return {
977
+ success: true,
978
+ data,
979
+ summary: `Retried session ${data.sessionId}`,
980
+ durationMs: Date.now() - started,
981
+ };
982
+ }
983
+ catch (error) {
984
+ return {
985
+ success: false,
986
+ data: null,
987
+ summary: `sessions_retry failed: ${error instanceof Error ? error.message : String(error)}`,
988
+ error: error instanceof Error ? error.message : String(error),
989
+ durationMs: Date.now() - started,
990
+ };
991
+ }
992
+ }
993
+ async checkPermissions() {
994
+ return { status: "allowed" };
995
+ }
996
+ isConcurrencySafe() {
997
+ return false;
998
+ }
999
+ }
1000
+ export function createRuntimeSessionTools(stateManager) {
1001
+ const service = new RuntimeSessionToolService(stateManager);
1002
+ return [
1003
+ new RuntimeSessionsListTool(service),
1004
+ new RuntimeSessionsHistoryTool(service),
1005
+ new RuntimeSessionsReadTool(service),
1006
+ new RuntimeSessionsChildrenTool(service),
1007
+ new RuntimeSessionsSpawnTool(service),
1008
+ new RuntimeSessionsSendTool(service),
1009
+ new RuntimeSessionsUpdateTool(service),
1010
+ new RuntimeSessionsClaimTool(service),
1011
+ new RuntimeSessionsCancelTool(service),
1012
+ new RuntimeSessionsRetryTool(service),
1013
+ ];
1014
+ }
1015
+ //# sourceMappingURL=runtime-session-tools.js.map