pulseed 0.4.4 → 0.4.6

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 (729) hide show
  1. package/README.md +27 -103
  2. package/dist/adapters/agents/native-agent-loop.d.ts +7 -0
  3. package/dist/adapters/agents/native-agent-loop.d.ts.map +1 -0
  4. package/dist/adapters/agents/native-agent-loop.js +19 -0
  5. package/dist/adapters/agents/native-agent-loop.js.map +1 -0
  6. package/dist/adapters/agents/openai-codex.d.ts +3 -0
  7. package/dist/adapters/agents/openai-codex.d.ts.map +1 -1
  8. package/dist/adapters/agents/openai-codex.js +7 -1
  9. package/dist/adapters/agents/openai-codex.js.map +1 -1
  10. package/dist/adapters/datasources/github-issue-datasource.d.ts +13 -0
  11. package/dist/adapters/datasources/github-issue-datasource.d.ts.map +1 -1
  12. package/dist/adapters/datasources/github-issue-datasource.js +114 -134
  13. package/dist/adapters/datasources/github-issue-datasource.js.map +1 -1
  14. package/dist/adapters/spawn-helper.js +3 -3
  15. package/dist/adapters/spawn-helper.js.map +1 -1
  16. package/dist/base/llm/provider-config.d.ts +11 -2
  17. package/dist/base/llm/provider-config.d.ts.map +1 -1
  18. package/dist/base/llm/provider-config.js +13 -7
  19. package/dist/base/llm/provider-config.js.map +1 -1
  20. package/dist/base/llm/provider-factory.d.ts +2 -2
  21. package/dist/base/llm/provider-factory.js +4 -4
  22. package/dist/base/llm/provider-factory.js.map +1 -1
  23. package/dist/base/state/state-manager.d.ts +12 -0
  24. package/dist/base/state/state-manager.d.ts.map +1 -1
  25. package/dist/base/state/state-manager.js +112 -109
  26. package/dist/base/state/state-manager.js.map +1 -1
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +6 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/interface/chat/chat-history.d.ts +3 -2
  32. package/dist/interface/chat/chat-history.d.ts.map +1 -1
  33. package/dist/interface/chat/chat-history.js +3 -0
  34. package/dist/interface/chat/chat-history.js.map +1 -1
  35. package/dist/interface/chat/chat-runner.d.ts +9 -0
  36. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  37. package/dist/interface/chat/chat-runner.js +295 -44
  38. package/dist/interface/chat/chat-runner.js.map +1 -1
  39. package/dist/interface/chat/cross-platform-session.d.ts +78 -0
  40. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -0
  41. package/dist/interface/chat/cross-platform-session.js +213 -0
  42. package/dist/interface/chat/cross-platform-session.js.map +1 -0
  43. package/dist/interface/chat/event-subscriber.d.ts +3 -1
  44. package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
  45. package/dist/interface/chat/event-subscriber.js +13 -3
  46. package/dist/interface/chat/event-subscriber.js.map +1 -1
  47. package/dist/interface/cli/commands/chat.d.ts.map +1 -1
  48. package/dist/interface/cli/commands/chat.js +48 -3
  49. package/dist/interface/cli/commands/chat.js.map +1 -1
  50. package/dist/interface/cli/commands/config.d.ts.map +1 -1
  51. package/dist/interface/cli/commands/config.js +30 -1
  52. package/dist/interface/cli/commands/config.js.map +1 -1
  53. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  54. package/dist/interface/cli/commands/daemon.js +15 -6
  55. package/dist/interface/cli/commands/daemon.js.map +1 -1
  56. package/dist/interface/cli/commands/doctor.d.ts +1 -0
  57. package/dist/interface/cli/commands/doctor.d.ts.map +1 -1
  58. package/dist/interface/cli/commands/doctor.js +36 -0
  59. package/dist/interface/cli/commands/doctor.js.map +1 -1
  60. package/dist/interface/cli/commands/install.d.ts +1 -0
  61. package/dist/interface/cli/commands/install.d.ts.map +1 -1
  62. package/dist/interface/cli/commands/install.js +6 -1
  63. package/dist/interface/cli/commands/install.js.map +1 -1
  64. package/dist/interface/cli/commands/notify.d.ts.map +1 -1
  65. package/dist/interface/cli/commands/notify.js +33 -21
  66. package/dist/interface/cli/commands/notify.js.map +1 -1
  67. package/dist/interface/cli/commands/setup/steps-notification.d.ts.map +1 -1
  68. package/dist/interface/cli/commands/setup/steps-notification.js +3 -2
  69. package/dist/interface/cli/commands/setup/steps-notification.js.map +1 -1
  70. package/dist/interface/cli/commands/setup-shared.js +6 -6
  71. package/dist/interface/cli/commands/setup-shared.js.map +1 -1
  72. package/dist/interface/cli/commands/setup.d.ts.map +1 -1
  73. package/dist/interface/cli/commands/setup.js +38 -1
  74. package/dist/interface/cli/commands/setup.js.map +1 -1
  75. package/dist/interface/cli/commands/telegram.d.ts.map +1 -1
  76. package/dist/interface/cli/commands/telegram.js +15 -1
  77. package/dist/interface/cli/commands/telegram.js.map +1 -1
  78. package/dist/interface/cli/setup.d.ts +12 -1
  79. package/dist/interface/cli/setup.d.ts.map +1 -1
  80. package/dist/interface/cli/setup.js +145 -16
  81. package/dist/interface/cli/setup.js.map +1 -1
  82. package/dist/interface/cli/utils.js +1 -1
  83. package/dist/interface/tui/entry.d.ts.map +1 -1
  84. package/dist/interface/tui/entry.js +69 -17
  85. package/dist/interface/tui/entry.js.map +1 -1
  86. package/dist/orchestrator/execution/adapter-layer.d.ts +19 -0
  87. package/dist/orchestrator/execution/adapter-layer.d.ts.map +1 -1
  88. package/dist/orchestrator/execution/adapter-layer.js.map +1 -1
  89. package/dist/orchestrator/execution/agent-loop/agent-loop-budget.d.ts +15 -0
  90. package/dist/orchestrator/execution/agent-loop/agent-loop-budget.d.ts.map +1 -0
  91. package/dist/orchestrator/execution/agent-loop/agent-loop-budget.js +12 -0
  92. package/dist/orchestrator/execution/agent-loop/agent-loop-budget.js.map +1 -0
  93. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.d.ts +9 -0
  94. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.d.ts.map +1 -0
  95. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.js +40 -0
  96. package/dist/orchestrator/execution/agent-loop/agent-loop-command-classifier.js.map +1 -0
  97. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.d.ts +33 -0
  98. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.d.ts.map +1 -0
  99. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.js +68 -0
  100. package/dist/orchestrator/execution/agent-loop/agent-loop-compactor.js.map +1 -0
  101. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts +38 -0
  102. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts.map +1 -0
  103. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js +109 -0
  104. package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js.map +1 -0
  105. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.d.ts +76 -0
  106. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.d.ts.map +1 -0
  107. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.js +164 -0
  108. package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.js.map +1 -0
  109. package/dist/orchestrator/execution/agent-loop/agent-loop-evaluator.d.ts +46 -0
  110. package/dist/orchestrator/execution/agent-loop/agent-loop-evaluator.d.ts.map +1 -0
  111. package/dist/orchestrator/execution/agent-loop/agent-loop-evaluator.js +75 -0
  112. package/dist/orchestrator/execution/agent-loop/agent-loop-evaluator.js.map +1 -0
  113. package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts +98 -0
  114. package/dist/orchestrator/execution/agent-loop/agent-loop-events.d.ts.map +1 -0
  115. package/dist/orchestrator/execution/agent-loop/agent-loop-events.js +6 -0
  116. package/dist/orchestrator/execution/agent-loop/agent-loop-events.js.map +1 -0
  117. package/dist/orchestrator/execution/agent-loop/agent-loop-history.d.ts +8 -0
  118. package/dist/orchestrator/execution/agent-loop/agent-loop-history.d.ts.map +1 -0
  119. package/dist/orchestrator/execution/agent-loop/agent-loop-history.js +7 -0
  120. package/dist/orchestrator/execution/agent-loop/agent-loop-history.js.map +1 -0
  121. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client-factory.d.ts +9 -0
  122. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client-factory.d.ts.map +1 -0
  123. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client-factory.js +19 -0
  124. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client-factory.js.map +1 -0
  125. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.d.ts +13 -0
  126. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.d.ts.map +1 -0
  127. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.js +72 -0
  128. package/dist/orchestrator/execution/agent-loop/agent-loop-model-client.js.map +1 -0
  129. package/dist/orchestrator/execution/agent-loop/agent-loop-model-registry.d.ts +10 -0
  130. package/dist/orchestrator/execution/agent-loop/agent-loop-model-registry.d.ts.map +1 -0
  131. package/dist/orchestrator/execution/agent-loop/agent-loop-model-registry.js +26 -0
  132. package/dist/orchestrator/execution/agent-loop/agent-loop-model-registry.js.map +1 -0
  133. package/dist/orchestrator/execution/agent-loop/agent-loop-model.d.ts +87 -0
  134. package/dist/orchestrator/execution/agent-loop/agent-loop-model.d.ts.map +1 -0
  135. package/dist/orchestrator/execution/agent-loop/agent-loop-model.js +22 -0
  136. package/dist/orchestrator/execution/agent-loop/agent-loop-model.js.map +1 -0
  137. package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.d.ts +5 -0
  138. package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.d.ts.map +1 -0
  139. package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.js +18 -0
  140. package/dist/orchestrator/execution/agent-loop/agent-loop-prompts.js.map +1 -0
  141. package/dist/orchestrator/execution/agent-loop/agent-loop-real-dogfood.d.ts +2 -0
  142. package/dist/orchestrator/execution/agent-loop/agent-loop-real-dogfood.d.ts.map +1 -0
  143. package/dist/orchestrator/execution/agent-loop/agent-loop-real-dogfood.js +362 -0
  144. package/dist/orchestrator/execution/agent-loop/agent-loop-real-dogfood.js.map +1 -0
  145. package/dist/orchestrator/execution/agent-loop/agent-loop-result.d.ts +42 -0
  146. package/dist/orchestrator/execution/agent-loop/agent-loop-result.d.ts.map +1 -0
  147. package/dist/orchestrator/execution/agent-loop/agent-loop-result.js +2 -0
  148. package/dist/orchestrator/execution/agent-loop/agent-loop-result.js.map +1 -0
  149. package/dist/orchestrator/execution/agent-loop/agent-loop-session-factory.d.ts +15 -0
  150. package/dist/orchestrator/execution/agent-loop/agent-loop-session-factory.d.ts.map +1 -0
  151. package/dist/orchestrator/execution/agent-loop/agent-loop-session-factory.js +26 -0
  152. package/dist/orchestrator/execution/agent-loop/agent-loop-session-factory.js.map +1 -0
  153. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.d.ts +39 -0
  154. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.d.ts.map +1 -0
  155. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.js +35 -0
  156. package/dist/orchestrator/execution/agent-loop/agent-loop-session-state.js.map +1 -0
  157. package/dist/orchestrator/execution/agent-loop/agent-loop-session.d.ts +21 -0
  158. package/dist/orchestrator/execution/agent-loop/agent-loop-session.d.ts.map +1 -0
  159. package/dist/orchestrator/execution/agent-loop/agent-loop-session.js +16 -0
  160. package/dist/orchestrator/execution/agent-loop/agent-loop-session.js.map +1 -0
  161. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-output.d.ts +21 -0
  162. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-output.d.ts.map +1 -0
  163. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-output.js +2 -0
  164. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-output.js.map +1 -0
  165. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts +19 -0
  166. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts.map +1 -0
  167. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js +34 -0
  168. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js.map +1 -0
  169. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +21 -0
  170. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -0
  171. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +114 -0
  172. package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -0
  173. package/dist/orchestrator/execution/agent-loop/agent-loop-trace-store.d.ts +18 -0
  174. package/dist/orchestrator/execution/agent-loop/agent-loop-trace-store.d.ts.map +1 -0
  175. package/dist/orchestrator/execution/agent-loop/agent-loop-trace-store.js +31 -0
  176. package/dist/orchestrator/execution/agent-loop/agent-loop-trace-store.js.map +1 -0
  177. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +39 -0
  178. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -0
  179. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js +5 -0
  180. package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -0
  181. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.d.ts +23 -0
  182. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.d.ts.map +1 -0
  183. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.js +156 -0
  184. package/dist/orchestrator/execution/agent-loop/anthropic-messages-agent-loop-model-client.js.map +1 -0
  185. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +38 -0
  186. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -0
  187. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +479 -0
  188. package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -0
  189. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +67 -0
  190. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -0
  191. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +113 -0
  192. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -0
  193. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +33 -0
  194. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -0
  195. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +89 -0
  196. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -0
  197. package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts +32 -0
  198. package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts.map +1 -0
  199. package/dist/orchestrator/execution/agent-loop/core-phase-runner.js +40 -0
  200. package/dist/orchestrator/execution/agent-loop/core-phase-runner.js.map +1 -0
  201. package/dist/orchestrator/execution/agent-loop/index.d.ts +35 -0
  202. package/dist/orchestrator/execution/agent-loop/index.d.ts.map +1 -0
  203. package/dist/orchestrator/execution/agent-loop/index.js +35 -0
  204. package/dist/orchestrator/execution/agent-loop/index.js.map +1 -0
  205. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.d.ts +18 -0
  206. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.d.ts.map +1 -0
  207. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.js +148 -0
  208. package/dist/orchestrator/execution/agent-loop/openai-responses-agent-loop-model-client.js.map +1 -0
  209. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.d.ts +26 -0
  210. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.d.ts.map +1 -0
  211. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.js +79 -0
  212. package/dist/orchestrator/execution/agent-loop/task-agent-loop-context.js.map +1 -0
  213. package/dist/orchestrator/execution/agent-loop/task-agent-loop-factory.d.ts +28 -0
  214. package/dist/orchestrator/execution/agent-loop/task-agent-loop-factory.d.ts.map +1 -0
  215. package/dist/orchestrator/execution/agent-loop/task-agent-loop-factory.js +96 -0
  216. package/dist/orchestrator/execution/agent-loop/task-agent-loop-factory.js.map +1 -0
  217. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts +54 -0
  218. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts.map +1 -0
  219. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.js +61 -0
  220. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.js.map +1 -0
  221. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.d.ts +46 -0
  222. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.d.ts.map +1 -0
  223. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.js +70 -0
  224. package/dist/orchestrator/execution/agent-loop/task-agent-loop-runner.js.map +1 -0
  225. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.d.ts +5 -0
  226. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.d.ts.map +1 -0
  227. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.js +94 -0
  228. package/dist/orchestrator/execution/agent-loop/task-agent-loop-verification.js.map +1 -0
  229. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.d.ts +23 -0
  230. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.d.ts.map +1 -0
  231. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.js +145 -0
  232. package/dist/orchestrator/execution/agent-loop/task-agent-loop-worktree.js.map +1 -0
  233. package/dist/orchestrator/execution/context/dimension-selector.d.ts +5 -1
  234. package/dist/orchestrator/execution/context/dimension-selector.d.ts.map +1 -1
  235. package/dist/orchestrator/execution/context/dimension-selector.js +9 -5
  236. package/dist/orchestrator/execution/context/dimension-selector.js.map +1 -1
  237. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  238. package/dist/orchestrator/execution/task/task-generation.js +46 -6
  239. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  240. package/dist/orchestrator/execution/task/task-health-check.d.ts +1 -1
  241. package/dist/orchestrator/execution/task/task-health-check.d.ts.map +1 -1
  242. package/dist/orchestrator/execution/task/task-health-check.js +8 -8
  243. package/dist/orchestrator/execution/task/task-health-check.js.map +1 -1
  244. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +22 -3
  245. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  246. package/dist/orchestrator/execution/task/task-lifecycle.js +155 -25
  247. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  248. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts.map +1 -1
  249. package/dist/orchestrator/execution/task/task-prompt-builder.js +63 -3
  250. package/dist/orchestrator/execution/task/task-prompt-builder.js.map +1 -1
  251. package/dist/orchestrator/execution/task/task-verifier-llm.d.ts.map +1 -1
  252. package/dist/orchestrator/execution/task/task-verifier-llm.js +19 -1
  253. package/dist/orchestrator/execution/task/task-verifier-llm.js.map +1 -1
  254. package/dist/orchestrator/execution/task/task-verifier-rules.d.ts.map +1 -1
  255. package/dist/orchestrator/execution/task/task-verifier-rules.js +96 -44
  256. package/dist/orchestrator/execution/task/task-verifier-rules.js.map +1 -1
  257. package/dist/orchestrator/execution/task/task-verifier-types.d.ts +8 -0
  258. package/dist/orchestrator/execution/task/task-verifier-types.d.ts.map +1 -1
  259. package/dist/orchestrator/execution/task/task-verifier-types.js.map +1 -1
  260. package/dist/orchestrator/execution/task/task-verifier.d.ts.map +1 -1
  261. package/dist/orchestrator/execution/task/task-verifier.js +19 -1
  262. package/dist/orchestrator/execution/task/task-verifier.js.map +1 -1
  263. package/dist/orchestrator/goal/tree-loop-orchestrator.d.ts +9 -0
  264. package/dist/orchestrator/goal/tree-loop-orchestrator.d.ts.map +1 -1
  265. package/dist/orchestrator/goal/tree-loop-orchestrator.js +32 -0
  266. package/dist/orchestrator/goal/tree-loop-orchestrator.js.map +1 -1
  267. package/dist/orchestrator/loop/core-loop/contracts.d.ts +9 -0
  268. package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
  269. package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
  270. package/dist/orchestrator/loop/core-loop/decision-engine.d.ts +79 -0
  271. package/dist/orchestrator/loop/core-loop/decision-engine.d.ts.map +1 -0
  272. package/dist/orchestrator/loop/core-loop/decision-engine.js +141 -0
  273. package/dist/orchestrator/loop/core-loop/decision-engine.js.map +1 -0
  274. package/dist/orchestrator/loop/core-loop/evidence-ledger.d.ts +22 -0
  275. package/dist/orchestrator/loop/core-loop/evidence-ledger.d.ts.map +1 -0
  276. package/dist/orchestrator/loop/core-loop/evidence-ledger.js +36 -0
  277. package/dist/orchestrator/loop/core-loop/evidence-ledger.js.map +1 -0
  278. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +34 -0
  279. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -0
  280. package/dist/orchestrator/loop/core-loop/iteration-kernel.js +356 -0
  281. package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -0
  282. package/dist/orchestrator/loop/core-loop/phase-policy.d.ts +20 -0
  283. package/dist/orchestrator/loop/core-loop/phase-policy.d.ts.map +1 -0
  284. package/dist/orchestrator/loop/core-loop/phase-policy.js +96 -0
  285. package/dist/orchestrator/loop/core-loop/phase-policy.js.map +1 -0
  286. package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts +29 -0
  287. package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts.map +1 -0
  288. package/dist/orchestrator/loop/core-loop/phase-runtime.js +62 -0
  289. package/dist/orchestrator/loop/core-loop/phase-runtime.js.map +1 -0
  290. package/dist/orchestrator/loop/core-loop/phase-specs.d.ts +180 -0
  291. package/dist/orchestrator/loop/core-loop/phase-specs.d.ts.map +1 -0
  292. package/dist/orchestrator/loop/core-loop/phase-specs.js +116 -0
  293. package/dist/orchestrator/loop/core-loop/phase-specs.js.map +1 -0
  294. package/dist/orchestrator/loop/core-loop/preparation.d.ts +1 -5
  295. package/dist/orchestrator/loop/core-loop/preparation.d.ts.map +1 -1
  296. package/dist/orchestrator/loop/core-loop/preparation.js +2 -1
  297. package/dist/orchestrator/loop/core-loop/preparation.js.map +1 -1
  298. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +10 -2
  299. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
  300. package/dist/orchestrator/loop/core-loop/task-cycle.js +37 -54
  301. package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
  302. package/dist/orchestrator/loop/core-loop.d.ts +3 -0
  303. package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
  304. package/dist/orchestrator/loop/core-loop.js +58 -217
  305. package/dist/orchestrator/loop/core-loop.js.map +1 -1
  306. package/dist/orchestrator/loop/loop-result-types.d.ts +23 -0
  307. package/dist/orchestrator/loop/loop-result-types.d.ts.map +1 -1
  308. package/dist/orchestrator/loop/loop-result-types.js.map +1 -1
  309. package/dist/orchestrator/loop/tree-loop-runner.d.ts +6 -2
  310. package/dist/orchestrator/loop/tree-loop-runner.d.ts.map +1 -1
  311. package/dist/orchestrator/loop/tree-loop-runner.js +62 -6
  312. package/dist/orchestrator/loop/tree-loop-runner.js.map +1 -1
  313. package/dist/orchestrator/strategy/portfolio-manager.d.ts +3 -3
  314. package/dist/orchestrator/strategy/portfolio-manager.d.ts.map +1 -1
  315. package/dist/orchestrator/strategy/portfolio-manager.js +3 -3
  316. package/dist/orchestrator/strategy/portfolio-manager.js.map +1 -1
  317. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts +3 -3
  318. package/dist/orchestrator/strategy/portfolio-rebalance.d.ts.map +1 -1
  319. package/dist/orchestrator/strategy/portfolio-rebalance.js +14 -7
  320. package/dist/orchestrator/strategy/portfolio-rebalance.js.map +1 -1
  321. package/dist/orchestrator/strategy/strategy-manager.d.ts +11 -1
  322. package/dist/orchestrator/strategy/strategy-manager.d.ts.map +1 -1
  323. package/dist/orchestrator/strategy/strategy-manager.js +23 -2
  324. package/dist/orchestrator/strategy/strategy-manager.js.map +1 -1
  325. package/dist/platform/dream/dream-activation-artifacts.d.ts +5 -0
  326. package/dist/platform/dream/dream-activation-artifacts.d.ts.map +1 -0
  327. package/dist/platform/dream/dream-activation-artifacts.js +35 -0
  328. package/dist/platform/dream/dream-activation-artifacts.js.map +1 -0
  329. package/dist/platform/dream/dream-activation.d.ts +7 -0
  330. package/dist/platform/dream/dream-activation.d.ts.map +1 -1
  331. package/dist/platform/dream/dream-activation.js +41 -0
  332. package/dist/platform/dream/dream-activation.js.map +1 -1
  333. package/dist/platform/dream/dream-consolidator.d.ts +51 -1
  334. package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
  335. package/dist/platform/dream/dream-consolidator.js +425 -74
  336. package/dist/platform/dream/dream-consolidator.js.map +1 -1
  337. package/dist/platform/dream/dream-event-workflows.d.ts +115 -0
  338. package/dist/platform/dream/dream-event-workflows.d.ts.map +1 -0
  339. package/dist/platform/dream/dream-event-workflows.js +328 -0
  340. package/dist/platform/dream/dream-event-workflows.js.map +1 -0
  341. package/dist/platform/dream/dream-soil-mutation.d.ts +28 -0
  342. package/dist/platform/dream/dream-soil-mutation.d.ts.map +1 -0
  343. package/dist/platform/dream/dream-soil-mutation.js +605 -0
  344. package/dist/platform/dream/dream-soil-mutation.js.map +1 -0
  345. package/dist/platform/dream/dream-soil-sync.d.ts +30 -0
  346. package/dist/platform/dream/dream-soil-sync.d.ts.map +1 -0
  347. package/dist/platform/dream/dream-soil-sync.js +87 -0
  348. package/dist/platform/dream/dream-soil-sync.js.map +1 -0
  349. package/dist/platform/dream/dream-types.d.ts +635 -50
  350. package/dist/platform/dream/dream-types.d.ts.map +1 -1
  351. package/dist/platform/dream/dream-types.js +70 -0
  352. package/dist/platform/dream/dream-types.js.map +1 -1
  353. package/dist/platform/dream/index.d.ts +4 -0
  354. package/dist/platform/dream/index.d.ts.map +1 -1
  355. package/dist/platform/dream/index.js +4 -0
  356. package/dist/platform/dream/index.js.map +1 -1
  357. package/dist/platform/knowledge/knowledge-decisions.d.ts.map +1 -1
  358. package/dist/platform/knowledge/knowledge-decisions.js +32 -0
  359. package/dist/platform/knowledge/knowledge-decisions.js.map +1 -1
  360. package/dist/platform/knowledge/knowledge-manager-lint.d.ts +1 -0
  361. package/dist/platform/knowledge/knowledge-manager-lint.d.ts.map +1 -1
  362. package/dist/platform/knowledge/knowledge-manager-lint.js +16 -3
  363. package/dist/platform/knowledge/knowledge-manager-lint.js.map +1 -1
  364. package/dist/platform/knowledge/knowledge-manager.d.ts +3 -0
  365. package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
  366. package/dist/platform/knowledge/knowledge-manager.js +38 -0
  367. package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
  368. package/dist/platform/observation/workspace-context.d.ts.map +1 -1
  369. package/dist/platform/observation/workspace-context.js +12 -6
  370. package/dist/platform/observation/workspace-context.js.map +1 -1
  371. package/dist/platform/soil/checksum.d.ts +2 -0
  372. package/dist/platform/soil/checksum.d.ts.map +1 -0
  373. package/dist/platform/soil/checksum.js +17 -0
  374. package/dist/platform/soil/checksum.js.map +1 -0
  375. package/dist/platform/soil/compiler.d.ts +27 -0
  376. package/dist/platform/soil/compiler.d.ts.map +1 -0
  377. package/dist/platform/soil/compiler.js +78 -0
  378. package/dist/platform/soil/compiler.js.map +1 -0
  379. package/dist/platform/soil/config.d.ts +16 -0
  380. package/dist/platform/soil/config.d.ts.map +1 -0
  381. package/dist/platform/soil/config.js +30 -0
  382. package/dist/platform/soil/config.js.map +1 -0
  383. package/dist/platform/soil/content-projections.d.ts +24 -0
  384. package/dist/platform/soil/content-projections.d.ts.map +1 -0
  385. package/dist/platform/soil/content-projections.js +489 -0
  386. package/dist/platform/soil/content-projections.js.map +1 -0
  387. package/dist/platform/soil/contracts.d.ts +1127 -0
  388. package/dist/platform/soil/contracts.d.ts.map +1 -0
  389. package/dist/platform/soil/contracts.js +194 -0
  390. package/dist/platform/soil/contracts.js.map +1 -0
  391. package/dist/platform/soil/ddl.d.ts +8 -0
  392. package/dist/platform/soil/ddl.d.ts.map +1 -0
  393. package/dist/platform/soil/ddl.js +150 -0
  394. package/dist/platform/soil/ddl.js.map +1 -0
  395. package/dist/platform/soil/doctor.d.ts +34 -0
  396. package/dist/platform/soil/doctor.d.ts.map +1 -0
  397. package/dist/platform/soil/doctor.js +380 -0
  398. package/dist/platform/soil/doctor.js.map +1 -0
  399. package/dist/platform/soil/frontmatter.d.ts +15 -0
  400. package/dist/platform/soil/frontmatter.d.ts.map +1 -0
  401. package/dist/platform/soil/frontmatter.js +82 -0
  402. package/dist/platform/soil/frontmatter.js.map +1 -0
  403. package/dist/platform/soil/importer.d.ts +118 -0
  404. package/dist/platform/soil/importer.d.ts.map +1 -0
  405. package/dist/platform/soil/importer.js +145 -0
  406. package/dist/platform/soil/importer.js.map +1 -0
  407. package/dist/platform/soil/index-store.d.ts +89 -0
  408. package/dist/platform/soil/index-store.d.ts.map +1 -0
  409. package/dist/platform/soil/index-store.js +399 -0
  410. package/dist/platform/soil/index-store.js.map +1 -0
  411. package/dist/platform/soil/index.d.ts +20 -0
  412. package/dist/platform/soil/index.d.ts.map +1 -0
  413. package/dist/platform/soil/index.js +20 -0
  414. package/dist/platform/soil/index.js.map +1 -0
  415. package/dist/platform/soil/io.d.ts +18 -0
  416. package/dist/platform/soil/io.d.ts.map +1 -0
  417. package/dist/platform/soil/io.js +56 -0
  418. package/dist/platform/soil/io.js.map +1 -0
  419. package/dist/platform/soil/open.d.ts +32 -0
  420. package/dist/platform/soil/open.d.ts.map +1 -0
  421. package/dist/platform/soil/open.js +78 -0
  422. package/dist/platform/soil/open.js.map +1 -0
  423. package/dist/platform/soil/paths.d.ts +9 -0
  424. package/dist/platform/soil/paths.d.ts.map +1 -0
  425. package/dist/platform/soil/paths.js +78 -0
  426. package/dist/platform/soil/paths.js.map +1 -0
  427. package/dist/platform/soil/projections.d.ts +16 -0
  428. package/dist/platform/soil/projections.d.ts.map +1 -0
  429. package/dist/platform/soil/projections.js +265 -0
  430. package/dist/platform/soil/projections.js.map +1 -0
  431. package/dist/platform/soil/publish/apple-notes.d.ts +15 -0
  432. package/dist/platform/soil/publish/apple-notes.d.ts.map +1 -0
  433. package/dist/platform/soil/publish/apple-notes.js +58 -0
  434. package/dist/platform/soil/publish/apple-notes.js.map +1 -0
  435. package/dist/platform/soil/publish/config.d.ts +14 -0
  436. package/dist/platform/soil/publish/config.d.ts.map +1 -0
  437. package/dist/platform/soil/publish/config.js +59 -0
  438. package/dist/platform/soil/publish/config.js.map +1 -0
  439. package/dist/platform/soil/publish/index.d.ts +7 -0
  440. package/dist/platform/soil/publish/index.d.ts.map +1 -0
  441. package/dist/platform/soil/publish/index.js +7 -0
  442. package/dist/platform/soil/publish/index.js.map +1 -0
  443. package/dist/platform/soil/publish/notion.d.ts +51 -0
  444. package/dist/platform/soil/publish/notion.d.ts.map +1 -0
  445. package/dist/platform/soil/publish/notion.js +201 -0
  446. package/dist/platform/soil/publish/notion.js.map +1 -0
  447. package/dist/platform/soil/publish/publisher.d.ts +13 -0
  448. package/dist/platform/soil/publish/publisher.d.ts.map +1 -0
  449. package/dist/platform/soil/publish/publisher.js +55 -0
  450. package/dist/platform/soil/publish/publisher.js.map +1 -0
  451. package/dist/platform/soil/publish/snapshot.d.ts +4 -0
  452. package/dist/platform/soil/publish/snapshot.d.ts.map +1 -0
  453. package/dist/platform/soil/publish/snapshot.js +40 -0
  454. package/dist/platform/soil/publish/snapshot.js.map +1 -0
  455. package/dist/platform/soil/publish/types.d.ts +169 -0
  456. package/dist/platform/soil/publish/types.d.ts.map +1 -0
  457. package/dist/platform/soil/publish/types.js +32 -0
  458. package/dist/platform/soil/publish/types.js.map +1 -0
  459. package/dist/platform/soil/retriever.d.ts +52 -0
  460. package/dist/platform/soil/retriever.d.ts.map +1 -0
  461. package/dist/platform/soil/retriever.js +262 -0
  462. package/dist/platform/soil/retriever.js.map +1 -0
  463. package/dist/platform/soil/runtime-rebuild.d.ts +33 -0
  464. package/dist/platform/soil/runtime-rebuild.d.ts.map +1 -0
  465. package/dist/platform/soil/runtime-rebuild.js +201 -0
  466. package/dist/platform/soil/runtime-rebuild.js.map +1 -0
  467. package/dist/platform/soil/sqlite-repository.d.ts +25 -0
  468. package/dist/platform/soil/sqlite-repository.d.ts.map +1 -0
  469. package/dist/platform/soil/sqlite-repository.js +893 -0
  470. package/dist/platform/soil/sqlite-repository.js.map +1 -0
  471. package/dist/platform/soil/types.d.ts +506 -0
  472. package/dist/platform/soil/types.d.ts.map +1 -0
  473. package/dist/platform/soil/types.js +146 -0
  474. package/dist/platform/soil/types.js.map +1 -0
  475. package/dist/reflection/types.d.ts +2 -2
  476. package/dist/reporting/reporting-engine.d.ts.map +1 -1
  477. package/dist/reporting/reporting-engine.js +10 -0
  478. package/dist/reporting/reporting-engine.js.map +1 -1
  479. package/dist/runtime/approval-broker.d.ts.map +1 -1
  480. package/dist/runtime/approval-broker.js +32 -9
  481. package/dist/runtime/approval-broker.js.map +1 -1
  482. package/dist/runtime/daemon/client.d.ts +13 -0
  483. package/dist/runtime/daemon/client.d.ts.map +1 -1
  484. package/dist/runtime/daemon/client.js +41 -2
  485. package/dist/runtime/daemon/client.js.map +1 -1
  486. package/dist/runtime/daemon/runner-errors.d.ts +28 -0
  487. package/dist/runtime/daemon/runner-errors.d.ts.map +1 -0
  488. package/dist/runtime/daemon/runner-errors.js +41 -0
  489. package/dist/runtime/daemon/runner-errors.js.map +1 -0
  490. package/dist/runtime/daemon/runner-recovery.d.ts +12 -0
  491. package/dist/runtime/daemon/runner-recovery.d.ts.map +1 -0
  492. package/dist/runtime/daemon/runner-recovery.js +146 -0
  493. package/dist/runtime/daemon/runner-recovery.js.map +1 -0
  494. package/dist/runtime/daemon/runner.d.ts +6 -3
  495. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  496. package/dist/runtime/daemon/runner.js +143 -172
  497. package/dist/runtime/daemon/runner.js.map +1 -1
  498. package/dist/runtime/event/server-sse.d.ts.map +1 -1
  499. package/dist/runtime/event/server-sse.js +0 -1
  500. package/dist/runtime/event/server-sse.js.map +1 -1
  501. package/dist/runtime/event/server.d.ts +27 -0
  502. package/dist/runtime/event/server.d.ts.map +1 -1
  503. package/dist/runtime/event/server.js +305 -71
  504. package/dist/runtime/event/server.js.map +1 -1
  505. package/dist/runtime/leader-lock-manager.d.ts.map +1 -1
  506. package/dist/runtime/leader-lock-manager.js +2 -1
  507. package/dist/runtime/leader-lock-manager.js.map +1 -1
  508. package/dist/runtime/notification-dispatcher.d.ts +7 -0
  509. package/dist/runtime/notification-dispatcher.d.ts.map +1 -1
  510. package/dist/runtime/notification-dispatcher.js +43 -1
  511. package/dist/runtime/notification-dispatcher.js.map +1 -1
  512. package/dist/runtime/notification-routing.d.ts +16 -0
  513. package/dist/runtime/notification-routing.d.ts.map +1 -0
  514. package/dist/runtime/notification-routing.js +147 -0
  515. package/dist/runtime/notification-routing.js.map +1 -0
  516. package/dist/runtime/plugin-loader.d.ts +2 -0
  517. package/dist/runtime/plugin-loader.d.ts.map +1 -1
  518. package/dist/runtime/plugin-loader.js +34 -2
  519. package/dist/runtime/plugin-loader.js.map +1 -1
  520. package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
  521. package/dist/runtime/schedule/engine-layers.js +106 -6
  522. package/dist/runtime/schedule/engine-layers.js.map +1 -1
  523. package/dist/runtime/schedule/engine.d.ts +2 -0
  524. package/dist/runtime/schedule/engine.d.ts.map +1 -1
  525. package/dist/runtime/schedule/engine.js +28 -0
  526. package/dist/runtime/schedule/engine.js.map +1 -1
  527. package/dist/runtime/schedule/history.d.ts +3 -3
  528. package/dist/runtime/schedule/presets.d.ts +128 -15
  529. package/dist/runtime/schedule/presets.d.ts.map +1 -1
  530. package/dist/runtime/schedule/presets.js +24 -0
  531. package/dist/runtime/schedule/presets.js.map +1 -1
  532. package/dist/runtime/schedule/source.d.ts +2 -2
  533. package/dist/runtime/types/cron.d.ts +4 -4
  534. package/dist/runtime/types/daemon.d.ts +3 -0
  535. package/dist/runtime/types/daemon.d.ts.map +1 -1
  536. package/dist/runtime/types/daemon.js +1 -0
  537. package/dist/runtime/types/daemon.js.map +1 -1
  538. package/dist/runtime/types/notification.d.ts +91 -0
  539. package/dist/runtime/types/notification.d.ts.map +1 -1
  540. package/dist/runtime/types/notification.js +10 -0
  541. package/dist/runtime/types/notification.js.map +1 -1
  542. package/dist/runtime/types/schedule.d.ts +60 -60
  543. package/dist/runtime/types/schedule.js +1 -1
  544. package/dist/runtime/types/schedule.js.map +1 -1
  545. package/dist/runtime/types/trigger.d.ts +6 -6
  546. package/dist/runtime/watchdog.d.ts +22 -0
  547. package/dist/runtime/watchdog.d.ts.map +1 -1
  548. package/dist/runtime/watchdog.js +47 -3
  549. package/dist/runtime/watchdog.js.map +1 -1
  550. package/dist/tools/builtin/index.d.ts +17 -0
  551. package/dist/tools/builtin/index.d.ts.map +1 -1
  552. package/dist/tools/builtin/index.js +46 -3
  553. package/dist/tools/builtin/index.js.map +1 -1
  554. package/dist/tools/execution/SoilDoctorTool/SoilDoctorTool.d.ts +43 -0
  555. package/dist/tools/execution/SoilDoctorTool/SoilDoctorTool.d.ts.map +1 -0
  556. package/dist/tools/execution/SoilDoctorTool/SoilDoctorTool.js +83 -0
  557. package/dist/tools/execution/SoilDoctorTool/SoilDoctorTool.js.map +1 -0
  558. package/dist/tools/execution/SoilDoctorTool/constants.d.ts +8 -0
  559. package/dist/tools/execution/SoilDoctorTool/constants.d.ts.map +1 -0
  560. package/dist/tools/execution/SoilDoctorTool/constants.js +8 -0
  561. package/dist/tools/execution/SoilDoctorTool/constants.js.map +1 -0
  562. package/dist/tools/execution/SoilDoctorTool/prompt.d.ts +2 -0
  563. package/dist/tools/execution/SoilDoctorTool/prompt.d.ts.map +1 -0
  564. package/dist/tools/execution/SoilDoctorTool/prompt.js +2 -0
  565. package/dist/tools/execution/SoilDoctorTool/prompt.js.map +1 -0
  566. package/dist/tools/execution/SoilImportTool/SoilImportTool.d.ts +109 -0
  567. package/dist/tools/execution/SoilImportTool/SoilImportTool.d.ts.map +1 -0
  568. package/dist/tools/execution/SoilImportTool/SoilImportTool.js +72 -0
  569. package/dist/tools/execution/SoilImportTool/SoilImportTool.js.map +1 -0
  570. package/dist/tools/execution/SoilImportTool/constants.d.ts +6 -0
  571. package/dist/tools/execution/SoilImportTool/constants.d.ts.map +1 -0
  572. package/dist/tools/execution/SoilImportTool/constants.js +6 -0
  573. package/dist/tools/execution/SoilImportTool/constants.js.map +1 -0
  574. package/dist/tools/execution/SoilImportTool/prompt.d.ts +2 -0
  575. package/dist/tools/execution/SoilImportTool/prompt.d.ts.map +1 -0
  576. package/dist/tools/execution/SoilImportTool/prompt.js +2 -0
  577. package/dist/tools/execution/SoilImportTool/prompt.js.map +1 -0
  578. package/dist/tools/execution/SoilOpenTool/SoilOpenTool.d.ts +46 -0
  579. package/dist/tools/execution/SoilOpenTool/SoilOpenTool.d.ts.map +1 -0
  580. package/dist/tools/execution/SoilOpenTool/SoilOpenTool.js +64 -0
  581. package/dist/tools/execution/SoilOpenTool/SoilOpenTool.js.map +1 -0
  582. package/dist/tools/execution/SoilOpenTool/constants.d.ts +6 -0
  583. package/dist/tools/execution/SoilOpenTool/constants.d.ts.map +1 -0
  584. package/dist/tools/execution/SoilOpenTool/constants.js +6 -0
  585. package/dist/tools/execution/SoilOpenTool/constants.js.map +1 -0
  586. package/dist/tools/execution/SoilOpenTool/prompt.d.ts +2 -0
  587. package/dist/tools/execution/SoilOpenTool/prompt.d.ts.map +1 -0
  588. package/dist/tools/execution/SoilOpenTool/prompt.js +2 -0
  589. package/dist/tools/execution/SoilOpenTool/prompt.js.map +1 -0
  590. package/dist/tools/execution/SoilPublishTool/SoilPublishTool.d.ts +49 -0
  591. package/dist/tools/execution/SoilPublishTool/SoilPublishTool.d.ts.map +1 -0
  592. package/dist/tools/execution/SoilPublishTool/SoilPublishTool.js +71 -0
  593. package/dist/tools/execution/SoilPublishTool/SoilPublishTool.js.map +1 -0
  594. package/dist/tools/execution/SoilPublishTool/constants.d.ts +6 -0
  595. package/dist/tools/execution/SoilPublishTool/constants.d.ts.map +1 -0
  596. package/dist/tools/execution/SoilPublishTool/constants.js +6 -0
  597. package/dist/tools/execution/SoilPublishTool/constants.js.map +1 -0
  598. package/dist/tools/execution/SoilPublishTool/prompt.d.ts +2 -0
  599. package/dist/tools/execution/SoilPublishTool/prompt.d.ts.map +1 -0
  600. package/dist/tools/execution/SoilPublishTool/prompt.js +2 -0
  601. package/dist/tools/execution/SoilPublishTool/prompt.js.map +1 -0
  602. package/dist/tools/execution/SoilRebuildTool/SoilRebuildTool.d.ts +34 -0
  603. package/dist/tools/execution/SoilRebuildTool/SoilRebuildTool.d.ts.map +1 -0
  604. package/dist/tools/execution/SoilRebuildTool/SoilRebuildTool.js +66 -0
  605. package/dist/tools/execution/SoilRebuildTool/SoilRebuildTool.js.map +1 -0
  606. package/dist/tools/execution/SoilRebuildTool/constants.d.ts +6 -0
  607. package/dist/tools/execution/SoilRebuildTool/constants.d.ts.map +1 -0
  608. package/dist/tools/execution/SoilRebuildTool/constants.js +6 -0
  609. package/dist/tools/execution/SoilRebuildTool/constants.js.map +1 -0
  610. package/dist/tools/execution/SoilRebuildTool/prompt.d.ts +2 -0
  611. package/dist/tools/execution/SoilRebuildTool/prompt.d.ts.map +1 -0
  612. package/dist/tools/execution/SoilRebuildTool/prompt.js +2 -0
  613. package/dist/tools/execution/SoilRebuildTool/prompt.js.map +1 -0
  614. package/dist/tools/executor.d.ts.map +1 -1
  615. package/dist/tools/executor.js +5 -2
  616. package/dist/tools/executor.js.map +1 -1
  617. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.d.ts +38 -0
  618. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.d.ts.map +1 -0
  619. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js +247 -0
  620. package/dist/tools/fs/ApplyPatchTool/ApplyPatchTool.js.map +1 -0
  621. package/dist/tools/fs/FileValidationTool/FileValidationTool.d.ts.map +1 -1
  622. package/dist/tools/fs/FileValidationTool/FileValidationTool.js +3 -2
  623. package/dist/tools/fs/FileValidationTool/FileValidationTool.js.map +1 -1
  624. package/dist/tools/fs/GlobTool/GlobTool.d.ts +1 -1
  625. package/dist/tools/fs/GlobTool/GlobTool.d.ts.map +1 -1
  626. package/dist/tools/fs/GlobTool/GlobTool.js +12 -1
  627. package/dist/tools/fs/GlobTool/GlobTool.js.map +1 -1
  628. package/dist/tools/fs/GrepTool/GrepTool.d.ts +1 -1
  629. package/dist/tools/fs/GrepTool/GrepTool.d.ts.map +1 -1
  630. package/dist/tools/fs/GrepTool/GrepTool.js +10 -3
  631. package/dist/tools/fs/GrepTool/GrepTool.js.map +1 -1
  632. package/dist/tools/fs/JsonQueryTool/JsonQueryTool.d.ts +1 -1
  633. package/dist/tools/fs/JsonQueryTool/JsonQueryTool.d.ts.map +1 -1
  634. package/dist/tools/fs/JsonQueryTool/JsonQueryTool.js +8 -1
  635. package/dist/tools/fs/JsonQueryTool/JsonQueryTool.js.map +1 -1
  636. package/dist/tools/fs/ListDirTool/ListDirTool.d.ts +2 -2
  637. package/dist/tools/fs/ListDirTool/ListDirTool.d.ts.map +1 -1
  638. package/dist/tools/fs/ListDirTool/ListDirTool.js +13 -5
  639. package/dist/tools/fs/ListDirTool/ListDirTool.js.map +1 -1
  640. package/dist/tools/fs/ReadTool/ReadTool.d.ts +1 -1
  641. package/dist/tools/fs/ReadTool/ReadTool.d.ts.map +1 -1
  642. package/dist/tools/fs/ReadTool/ReadTool.js +8 -1
  643. package/dist/tools/fs/ReadTool/ReadTool.js.map +1 -1
  644. package/dist/tools/index.d.ts +2 -0
  645. package/dist/tools/index.d.ts.map +1 -1
  646. package/dist/tools/index.js +1 -0
  647. package/dist/tools/index.js.map +1 -1
  648. package/dist/tools/media/ViewImageTool/ViewImageTool.d.ts +31 -0
  649. package/dist/tools/media/ViewImageTool/ViewImageTool.d.ts.map +1 -0
  650. package/dist/tools/media/ViewImageTool/ViewImageTool.js +53 -0
  651. package/dist/tools/media/ViewImageTool/ViewImageTool.js.map +1 -0
  652. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts +25 -0
  653. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts.map +1 -0
  654. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js +59 -0
  655. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js.map +1 -0
  656. package/dist/tools/mutation/ConfigureNotificationRoutingTool/constants.d.ts +5 -0
  657. package/dist/tools/mutation/ConfigureNotificationRoutingTool/constants.d.ts.map +1 -0
  658. package/dist/tools/mutation/ConfigureNotificationRoutingTool/constants.js +5 -0
  659. package/dist/tools/mutation/ConfigureNotificationRoutingTool/constants.js.map +1 -0
  660. package/dist/tools/mutation/ConfigureNotificationRoutingTool/prompt.d.ts +2 -0
  661. package/dist/tools/mutation/ConfigureNotificationRoutingTool/prompt.d.ts.map +1 -0
  662. package/dist/tools/mutation/ConfigureNotificationRoutingTool/prompt.js +5 -0
  663. package/dist/tools/mutation/ConfigureNotificationRoutingTool/prompt.js.map +1 -0
  664. package/dist/tools/mutation/TaskCreateTool/TaskCreateTool.d.ts +4 -4
  665. package/dist/tools/mutation/TaskOutputTool/TaskOutputTool.d.ts +2 -2
  666. package/dist/tools/network/GitHubCliTool/GitHubCliTool.d.ts +144 -0
  667. package/dist/tools/network/GitHubCliTool/GitHubCliTool.d.ts.map +1 -0
  668. package/dist/tools/network/GitHubCliTool/GitHubCliTool.js +245 -0
  669. package/dist/tools/network/GitHubCliTool/GitHubCliTool.js.map +1 -0
  670. package/dist/tools/network/HttpFetchTool/HttpFetchTool.d.ts +16 -0
  671. package/dist/tools/network/HttpFetchTool/HttpFetchTool.d.ts.map +1 -1
  672. package/dist/tools/network/HttpFetchTool/HttpFetchTool.js +252 -13
  673. package/dist/tools/network/HttpFetchTool/HttpFetchTool.js.map +1 -1
  674. package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts +109 -0
  675. package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts.map +1 -0
  676. package/dist/tools/network/McpStdioTool/McpStdioTool.js +121 -0
  677. package/dist/tools/network/McpStdioTool/McpStdioTool.js.map +1 -0
  678. package/dist/tools/query/GoalStateTool/GoalStateTool.js +1 -1
  679. package/dist/tools/query/GoalStateTool/GoalStateTool.js.map +1 -1
  680. package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +4 -4
  681. package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts +118 -0
  682. package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -0
  683. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +335 -0
  684. package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -0
  685. package/dist/tools/query/SoilQueryTool/constants.d.ts +8 -0
  686. package/dist/tools/query/SoilQueryTool/constants.d.ts.map +1 -0
  687. package/dist/tools/query/SoilQueryTool/constants.js +8 -0
  688. package/dist/tools/query/SoilQueryTool/constants.js.map +1 -0
  689. package/dist/tools/query/SoilQueryTool/prompt.d.ts +2 -0
  690. package/dist/tools/query/SoilQueryTool/prompt.d.ts.map +1 -0
  691. package/dist/tools/query/SoilQueryTool/prompt.js +2 -0
  692. package/dist/tools/query/SoilQueryTool/prompt.js.map +1 -0
  693. package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts +164 -52
  694. package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts.map +1 -1
  695. package/dist/tools/schedule/ListSchedulesTool/ListSchedulesTool.d.ts +4 -4
  696. package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts +76 -76
  697. package/dist/tools/system/GitLogTool/GitLogTool.d.ts +4 -4
  698. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts +220 -0
  699. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts.map +1 -0
  700. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js +354 -0
  701. package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js.map +1 -0
  702. package/dist/tools/system/ShellCommandTool/ShellCommandTool.d.ts +44 -0
  703. package/dist/tools/system/ShellCommandTool/ShellCommandTool.d.ts.map +1 -0
  704. package/dist/tools/system/ShellCommandTool/ShellCommandTool.js +40 -0
  705. package/dist/tools/system/ShellCommandTool/ShellCommandTool.js.map +1 -0
  706. package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.d.ts +61 -0
  707. package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.d.ts.map +1 -0
  708. package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.js +42 -0
  709. package/dist/tools/system/UpdatePlanTool/UpdatePlanTool.js.map +1 -0
  710. package/dist/tools/types.d.ts +6 -2
  711. package/dist/tools/types.d.ts.map +1 -1
  712. package/dist/tools/types.js.map +1 -1
  713. package/package.json +7 -1
  714. package/dist/adapters/agents/browser-use-cli.d.ts +0 -19
  715. package/dist/adapters/agents/browser-use-cli.d.ts.map +0 -1
  716. package/dist/adapters/agents/browser-use-cli.js +0 -74
  717. package/dist/adapters/agents/browser-use-cli.js.map +0 -1
  718. package/dist/adapters/agents/openclaw-acp.d.ts +0 -32
  719. package/dist/adapters/agents/openclaw-acp.d.ts.map +0 -1
  720. package/dist/adapters/agents/openclaw-acp.js +0 -212
  721. package/dist/adapters/agents/openclaw-acp.js.map +0 -1
  722. package/dist/adapters/datasources/openclaw-datasource.d.ts +0 -33
  723. package/dist/adapters/datasources/openclaw-datasource.d.ts.map +0 -1
  724. package/dist/adapters/datasources/openclaw-datasource.js +0 -176
  725. package/dist/adapters/datasources/openclaw-datasource.js.map +0 -1
  726. package/dist/orchestrator/knowledge/memory/memory-lifecycle.d.ts +0 -2
  727. package/dist/orchestrator/knowledge/memory/memory-lifecycle.d.ts.map +0 -1
  728. package/dist/orchestrator/knowledge/memory/memory-lifecycle.js +0 -2
  729. package/dist/orchestrator/knowledge/memory/memory-lifecycle.js.map +0 -1
@@ -0,0 +1,356 @@
1
+ import { generateLoopReport } from "../loop-report-helper.js";
2
+ import { makeEmptyIterationResult } from "../loop-result-types.js";
3
+ import { loadGoalWithAggregation, observeAndReload, calculateGapOrComplete, scoreDrivesAndCheckKnowledge, phaseAutoDecompose, } from "./preparation.js";
4
+ import { checkCompletionAndMilestones, detectStallsAndRebalance, checkDependencyBlock, runTaskCycleWithContext, } from "./task-cycle.js";
5
+ import { runStateDiffCheck, tryParallelExecution, } from "./control.js";
6
+ import { handleCapabilityAcquisition } from "./capability.js";
7
+ import { loadDreamActivationState } from "../../../platform/dream/dream-activation.js";
8
+ import { CoreLoopEvidenceLedger } from "./evidence-ledger.js";
9
+ import { CorePhaseRuntime } from "./phase-runtime.js";
10
+ import { buildKnowledgeRefreshSpec, buildObserveEvidenceSpec, buildReplanningOptionsSpec, buildStallInvestigationSpec, buildVerificationEvidenceSpec, } from "./phase-specs.js";
11
+ export class CoreIterationKernel {
12
+ deps;
13
+ constructor(deps) {
14
+ this.deps = deps;
15
+ }
16
+ async run(input) {
17
+ const { goalId, loopIndex, isFirstIteration } = input;
18
+ const startTime = Date.now();
19
+ let config = this.deps.getConfig();
20
+ const pendingDirective = this.deps.getPendingDirective(goalId);
21
+ const ctx = {
22
+ deps: this.deps.deps,
23
+ config,
24
+ logger: this.deps.logger,
25
+ toolExecutor: this.deps.deps.toolExecutor,
26
+ timeHorizonEngine: this.deps.timeHorizonEngine,
27
+ };
28
+ const runPhase = async (phase, work) => {
29
+ const phaseStartedAt = Date.now();
30
+ this.deps.logger?.info(`[CoreLoop] phase ${phase} starting`, { goalId, loopIndex });
31
+ try {
32
+ const value = await work();
33
+ this.deps.logger?.info(`[CoreLoop] phase ${phase} completed`, {
34
+ goalId,
35
+ loopIndex,
36
+ duration_ms: Date.now() - phaseStartedAt,
37
+ });
38
+ return value;
39
+ }
40
+ catch (err) {
41
+ this.deps.logger?.warn(`[CoreLoop] phase ${phase} failed`, {
42
+ goalId,
43
+ loopIndex,
44
+ duration_ms: Date.now() - phaseStartedAt,
45
+ error: err instanceof Error ? err.message : String(err),
46
+ });
47
+ throw err;
48
+ }
49
+ };
50
+ const result = makeEmptyIterationResult(goalId, loopIndex);
51
+ const evidenceLedger = new CoreLoopEvidenceLedger();
52
+ const corePhaseRuntime = new CorePhaseRuntime({
53
+ phaseRunner: this.deps.deps.corePhaseRunner,
54
+ policyRegistry: this.deps.corePhasePolicyRegistry,
55
+ });
56
+ const rememberPhase = (execution) => {
57
+ if (execution.status === "skipped")
58
+ return;
59
+ evidenceLedger.record(execution);
60
+ result.corePhaseResults = evidenceLedger.toIterationPhaseResults();
61
+ };
62
+ this.deps.logger?.info(`[CoreLoop] iteration ${loopIndex + 1} starting`, { goalId, loopIndex });
63
+ const loadedGoal = await runPhase("load-goal", () => loadGoalWithAggregation(ctx, goalId, result, startTime));
64
+ if (!loadedGoal)
65
+ return result;
66
+ let goal = loadedGoal;
67
+ await runPhase("auto-decompose", () => phaseAutoDecompose(goalId, goal, this.deps.deps, config, this.deps.logger, this.deps.decomposedGoals, isFirstIteration));
68
+ if (!goal.children_ids.length) {
69
+ const reloadedAfterDecompose = await this.deps.deps.stateManager.loadGoal(goalId);
70
+ if (reloadedAfterDecompose && reloadedAfterDecompose.children_ids.length > 0) {
71
+ goal = reloadedAfterDecompose;
72
+ if (this.deps.deps.treeLoopOrchestrator) {
73
+ config = { ...config, treeMode: true };
74
+ this.deps.setConfig(config);
75
+ ctx.config = config;
76
+ this.deps.logger?.info("[CoreLoop] treeMode enabled after auto-decomposition", {
77
+ goalId,
78
+ childrenCount: goal.children_ids.length,
79
+ });
80
+ }
81
+ }
82
+ }
83
+ const observeEvidence = await runPhase("observe-evidence", () => corePhaseRuntime.run({
84
+ ...buildObserveEvidenceSpec(),
85
+ requiredTools: [],
86
+ allowedTools: [],
87
+ budget: {},
88
+ }, {
89
+ goalTitle: goal.title,
90
+ goalDescription: goal.description,
91
+ dimensions: goal.dimensions.map((dimension) => dimension.name),
92
+ }, { goalId, gapAggregate: result.gapAggregate }));
93
+ rememberPhase(observeEvidence);
94
+ goal = await runPhase("observe", () => observeAndReload(ctx, goalId, goal, loopIndex));
95
+ if (this.deps.stateDiff) {
96
+ const { shouldSkip } = await runStateDiffCheck(this.deps.stateDiff, this.deps.stateDiffState, goalId, goal, loopIndex, config, this.deps.deps, result, startTime, this.deps.logger);
97
+ if (shouldSkip)
98
+ return result;
99
+ }
100
+ const gapResult = await runPhase("gap-analysis", () => calculateGapOrComplete(ctx, goalId, goal, loopIndex, result, startTime));
101
+ if (!gapResult)
102
+ return result;
103
+ const { gapVector, gapAggregate, skipTaskGeneration } = gapResult;
104
+ this.deps.logger?.info(`[iter ${loopIndex}] gap: ${gapAggregate.toFixed(2)} | ${(gapVector.gaps ?? [])
105
+ .map((g) => `${g.dimension_name}=${g.normalized_weighted_gap.toFixed(2)}`)
106
+ .join(", ")}`);
107
+ let driveScores = [];
108
+ let highDissatisfactionDimensions = [];
109
+ if (!skipTaskGeneration) {
110
+ const driveResult = await runPhase("drive-scoring", () => scoreDrivesAndCheckKnowledge(ctx, goalId, goal, gapVector, loopIndex, result, startTime, (id, idx, r, g) => generateLoopReport(id, idx, r, g, this.deps.deps.reportingEngine, this.deps.logger)));
111
+ if (!driveResult)
112
+ return result;
113
+ driveScores = driveResult.driveScores;
114
+ highDissatisfactionDimensions = driveResult.highDissatisfactionDimensions;
115
+ }
116
+ const knowledgeRefresh = !skipTaskGeneration
117
+ ? await runPhase("knowledge-refresh", () => corePhaseRuntime.run({
118
+ ...buildKnowledgeRefreshSpec(),
119
+ requiredTools: [],
120
+ allowedTools: [],
121
+ budget: {},
122
+ }, {
123
+ goalTitle: goal.title,
124
+ topDimensions: highDissatisfactionDimensions.length > 0
125
+ ? [
126
+ ...(pendingDirective?.focusDimension ? [pendingDirective.focusDimension] : []),
127
+ ...highDissatisfactionDimensions,
128
+ ].filter((value, index, values) => values.indexOf(value) === index)
129
+ : [
130
+ ...(pendingDirective?.focusDimension ? [pendingDirective.focusDimension] : []),
131
+ ...driveScores.map((score) => score.dimension_name),
132
+ ].filter((value, index, values) => values.indexOf(value) === index),
133
+ gapAggregate,
134
+ }, { goalId, gapAggregate }))
135
+ : null;
136
+ if (knowledgeRefresh)
137
+ rememberPhase(knowledgeRefresh);
138
+ const replanningOptions = this.deps.coreDecisionEngine.shouldRunReplanningOptions({
139
+ skipTaskGeneration: Boolean(skipTaskGeneration),
140
+ taskCycleBlocked: false,
141
+ gapAggregate,
142
+ })
143
+ ? await runPhase("replanning-options", () => corePhaseRuntime.run({
144
+ ...buildReplanningOptionsSpec(),
145
+ requiredTools: [],
146
+ allowedTools: [],
147
+ budget: {},
148
+ }, {
149
+ goalTitle: goal.title,
150
+ targetDimensions: driveScores.map((score) => score.dimension_name),
151
+ gapAggregate,
152
+ }, { goalId, gapAggregate }))
153
+ : null;
154
+ if (replanningOptions)
155
+ rememberPhase(replanningOptions);
156
+ await runPhase("completion-check", () => checkCompletionAndMilestones(ctx, goalId, goal, result, startTime));
157
+ if (result.error)
158
+ return result;
159
+ const stallActionHints = this.deps.coreDecisionEngine.buildStallActionHints({
160
+ phase: replanningOptions,
161
+ });
162
+ await runPhase("stall-detection", () => detectStallsAndRebalance(ctx, goalId, goal, result, stallActionHints.recommendedAction
163
+ ? stallActionHints
164
+ : pendingDirective?.preferredAction
165
+ ? { recommendedAction: pendingDirective.preferredAction }
166
+ : undefined));
167
+ const stallInvestigation = this.deps.coreDecisionEngine.shouldRunStallInvestigation(result)
168
+ ? await runPhase("stall-investigation", () => corePhaseRuntime.run({
169
+ ...buildStallInvestigationSpec(),
170
+ requiredTools: [],
171
+ allowedTools: [],
172
+ budget: {},
173
+ }, {
174
+ goalTitle: goal.title,
175
+ stallType: result.stallReport?.stall_type ?? "unknown",
176
+ ...(result.stallReport?.dimension_name ? { dimensionName: result.stallReport.dimension_name } : {}),
177
+ ...(result.stallReport?.suggested_cause ? { suggestedCause: result.stallReport.suggested_cause } : {}),
178
+ }, { goalId, stallDetected: result.stallDetected, gapAggregate }))
179
+ : null;
180
+ if (stallInvestigation)
181
+ rememberPhase(stallInvestigation);
182
+ if (result.stallDetected && result.stallReport) {
183
+ this.deps.logger?.warn(`[iter ${loopIndex}] stall detected: ${result.stallReport.stall_type}`, {
184
+ escalation: result.stallReport.escalation_level,
185
+ });
186
+ void this.deps.deps.hookManager?.emit("StallDetected", {
187
+ goal_id: goalId,
188
+ dimension: result.stallReport.dimension_name ?? undefined,
189
+ data: {
190
+ stall_type: result.stallReport.stall_type,
191
+ escalation_level: result.stallReport.escalation_level,
192
+ suggested_cause: result.stallReport.suggested_cause,
193
+ task_id: result.stallReport.task_id ?? undefined,
194
+ },
195
+ });
196
+ }
197
+ const knowledgeAcquisitionDecision = this.deps.coreDecisionEngine.evaluateKnowledgeAcquisition({
198
+ phase: knowledgeRefresh,
199
+ hasKnowledgeManager: !!this.deps.deps.knowledgeManager,
200
+ hasToolExecutor: !!this.deps.deps.toolExecutor,
201
+ });
202
+ if (knowledgeAcquisitionDecision.shouldAcquire &&
203
+ knowledgeAcquisitionDecision.question &&
204
+ this.deps.deps.knowledgeManager &&
205
+ this.deps.deps.toolExecutor) {
206
+ try {
207
+ const acquired = await this.deps.deps.knowledgeManager.acquireWithTools(knowledgeAcquisitionDecision.question, goalId, this.deps.deps.toolExecutor, {
208
+ cwd: process.cwd(),
209
+ goalId,
210
+ trustBalance: 0,
211
+ preApproved: true,
212
+ approvalFn: async () => false,
213
+ });
214
+ for (const entry of acquired) {
215
+ await this.deps.deps.knowledgeManager.saveKnowledge(goalId, entry);
216
+ }
217
+ if (acquired.length > 0) {
218
+ result.nextIterationDirective = this.deps.coreDecisionEngine.buildNextIterationDirective({
219
+ knowledgeRefreshPhase: knowledgeRefresh,
220
+ replanningPhase: replanningOptions,
221
+ goalDimensions: goal.dimensions.map((dimension) => dimension.name),
222
+ fallbackFocusDimension: driveScores[0]?.dimension_name ?? pendingDirective?.focusDimension,
223
+ });
224
+ this.deps.logger?.info("CoreLoop: knowledge_refresh auto-acquired knowledge and skipped execution", {
225
+ goalId,
226
+ acquiredCount: acquired.length,
227
+ });
228
+ await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
229
+ result.skipped = true;
230
+ result.skipReason = "knowledge_refresh_auto_acquire";
231
+ result.elapsedMs = Date.now() - startTime;
232
+ return result;
233
+ }
234
+ }
235
+ catch (err) {
236
+ this.deps.logger?.warn("CoreLoop: knowledge_refresh auto acquisition failed (non-fatal)", {
237
+ goalId,
238
+ error: err instanceof Error ? err.message : String(err),
239
+ });
240
+ }
241
+ }
242
+ if (result.stallDetected && this.deps.deps.knowledgeManager && this.deps.deps.toolExecutor) {
243
+ try {
244
+ const activation = await loadDreamActivationState(this.deps.deps.stateManager.getBaseDir());
245
+ if (activation.flags.autoAcquireKnowledge) {
246
+ const portfolio = await Promise.resolve(this.deps.deps.strategyManager.getPortfolio(goalId)).catch(() => null);
247
+ const observationContext = {
248
+ observations: goal.dimensions.map((dimension) => ({
249
+ name: dimension.name,
250
+ current_value: dimension.current_value,
251
+ confidence: dimension.confidence,
252
+ })),
253
+ strategies: portfolio?.strategies ?? null,
254
+ confidence: gapVector.gaps.reduce((sum, gap) => sum + gap.confidence, 0) /
255
+ Math.max(gapVector.gaps.length, 1),
256
+ };
257
+ const gapSignal = await this.deps.deps.knowledgeManager.detectKnowledgeGap(observationContext);
258
+ if (gapSignal) {
259
+ const acquired = await this.deps.deps.knowledgeManager.acquireWithTools(gapSignal.missing_knowledge, goalId, this.deps.deps.toolExecutor, {
260
+ cwd: process.cwd(),
261
+ goalId,
262
+ trustBalance: 0,
263
+ preApproved: true,
264
+ approvalFn: async () => false,
265
+ });
266
+ for (const entry of acquired) {
267
+ await this.deps.deps.knowledgeManager.saveKnowledge(goalId, entry);
268
+ }
269
+ if (acquired.length > 0) {
270
+ this.deps.logger?.info("CoreLoop: dream auto-acquired knowledge and skipped execution for context refresh", { goalId, acquiredCount: acquired.length });
271
+ await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
272
+ result.skipped = true;
273
+ result.skipReason = "dream_auto_acquire_knowledge";
274
+ result.elapsedMs = Date.now() - startTime;
275
+ return result;
276
+ }
277
+ }
278
+ }
279
+ }
280
+ catch (err) {
281
+ this.deps.logger?.warn("CoreLoop: autoAcquireKnowledge failed (non-fatal)", {
282
+ goalId,
283
+ error: err instanceof Error ? err.message : String(err),
284
+ });
285
+ }
286
+ }
287
+ if (skipTaskGeneration) {
288
+ result.nextIterationDirective = this.deps.coreDecisionEngine.buildNextIterationDirective({
289
+ knowledgeRefreshPhase: knowledgeRefresh,
290
+ replanningPhase: replanningOptions,
291
+ goalDimensions: goal.dimensions.map((dimension) => dimension.name),
292
+ fallbackFocusDimension: driveScores[0]?.dimension_name ?? pendingDirective?.focusDimension,
293
+ });
294
+ await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
295
+ result.elapsedMs = Date.now() - startTime;
296
+ return result;
297
+ }
298
+ if (checkDependencyBlock(ctx, goalId, result))
299
+ return result;
300
+ const tookParallelPath = await tryParallelExecution(goalId, goal, gapAggregate, result, startTime, this.deps.deps, loopIndex, this.deps.logger);
301
+ if (tookParallelPath)
302
+ return result;
303
+ const shouldPreferReplanningContext = this.deps.coreDecisionEngine.shouldPreferReplanningContext({
304
+ phase: replanningOptions,
305
+ });
306
+ const taskGenerationHints = this.deps.coreDecisionEngine.buildTaskGenerationHints({
307
+ phase: replanningOptions,
308
+ goalDimensions: goal.dimensions.map((dimension) => dimension.name),
309
+ });
310
+ const mergedTaskGenerationHints = {
311
+ targetDimensionOverride: taskGenerationHints.targetDimensionOverride ?? pendingDirective?.focusDimension,
312
+ knowledgeContextPrefix: taskGenerationHints.knowledgeContextPrefix,
313
+ };
314
+ if (!shouldPreferReplanningContext && replanningOptions?.status === "completed") {
315
+ this.deps.logger?.debug("CoreLoop: replanning evidence collected but not adopted as preferred context", {
316
+ goalId,
317
+ loopIndex,
318
+ });
319
+ }
320
+ const loopCallbacks = {
321
+ handleCapabilityAcquisition: (task, gId, adapter) => handleCapabilityAcquisition(task, gId, adapter, this.deps.deps.capabilityDetector, this.deps.capabilityFailures, this.deps.logger),
322
+ incrementTransferCounter: () => this.deps.incrementTransferCounter(),
323
+ tryGenerateReport: (id, idx, r, g) => generateLoopReport(id, idx, r, g, this.deps.deps.reportingEngine, this.deps.logger),
324
+ };
325
+ const taskCycleOk = await runTaskCycleWithContext(ctx, goalId, goal, gapVector, driveScores, highDissatisfactionDimensions, loopIndex, result, startTime, loopCallbacks, evidenceLedger, mergedTaskGenerationHints);
326
+ if (!taskCycleOk)
327
+ return result;
328
+ const completedTaskResult = result.taskResult;
329
+ if (this.deps.coreDecisionEngine.shouldRunVerificationEvidence(result) && completedTaskResult) {
330
+ const verificationPhase = await runPhase("verification-evidence", () => corePhaseRuntime.run({
331
+ ...buildVerificationEvidenceSpec(),
332
+ budget: {},
333
+ }, {
334
+ taskId: completedTaskResult.task.id,
335
+ taskDescription: completedTaskResult.task.work_description,
336
+ successCriteria: completedTaskResult.task.success_criteria.map((criterion) => criterion.description),
337
+ executionAction: completedTaskResult.action,
338
+ }, {
339
+ goalId,
340
+ taskId: completedTaskResult.task.id,
341
+ hasTaskResult: true,
342
+ }));
343
+ rememberPhase(verificationPhase);
344
+ }
345
+ result.nextIterationDirective = this.deps.coreDecisionEngine.buildNextIterationDirective({
346
+ knowledgeRefreshPhase: knowledgeRefresh,
347
+ replanningPhase: replanningOptions,
348
+ goalDimensions: goal.dimensions.map((dimension) => dimension.name),
349
+ fallbackFocusDimension: driveScores[0]?.dimension_name ?? pendingDirective?.focusDimension,
350
+ });
351
+ await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
352
+ result.elapsedMs = Date.now() - startTime;
353
+ return result;
354
+ }
355
+ }
356
+ //# sourceMappingURL=iteration-kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iteration-kernel.js","sourceRoot":"","sources":["../../../../src/orchestrator/loop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ACE,MAAM;gBACN,MAAM,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAAE;gBACnC,aAAa,EAAE,IAAI;aACpB,CACF,CACF,CAAC;YACF,aAAa,CAAC,iBAAiB,CAAC,CAAC;QACnC,CAAC;QAED,MAAM,CAAC,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,2BAA2B,CAAC;YACvF,qBAAqB,EAAE,gBAAgB;YACvC,eAAe,EAAE,iBAAiB;YAClC,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;YAClE,sBAAsB,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,cAAc,IAAI,gBAAgB,EAAE,cAAc;SAC3F,CAAC,CAAC;QAEH,MAAM,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE5G,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAC1C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import type { CorePhaseKind } from "../../execution/agent-loop/core-phase-runner.js";
2
+ import type { AgentLoopBudget } from "../../execution/agent-loop/agent-loop-budget.js";
3
+ export interface CorePhasePolicy {
4
+ enabled: boolean;
5
+ maxInvocationsPerIteration: number;
6
+ budget: Partial<AgentLoopBudget>;
7
+ allowedTools: readonly string[];
8
+ requiredTools: readonly string[];
9
+ failPolicy: "return_low_confidence" | "fallback_deterministic" | "fail_cycle";
10
+ }
11
+ export interface CorePhasePolicyRegistry {
12
+ get(phase: CorePhaseKind): CorePhasePolicy;
13
+ }
14
+ export declare const defaultCorePhasePolicies: Record<CorePhaseKind, CorePhasePolicy>;
15
+ export declare class StaticCorePhasePolicyRegistry implements CorePhasePolicyRegistry {
16
+ private readonly policies;
17
+ constructor(policies?: Partial<Record<CorePhaseKind, CorePhasePolicy>>);
18
+ get(phase: CorePhaseKind): CorePhasePolicy;
19
+ }
20
+ //# sourceMappingURL=phase-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-policy.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/phase-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAEvF,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,0BAA0B,EAAE,MAAM,CAAC;IACnC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,UAAU,EAAE,uBAAuB,GAAG,wBAAwB,GAAG,YAAY,CAAC;CAC/E;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe,CAAC;CAC5C;AAqBD,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAmE3E,CAAC;AAEF,qBAAa,6BAA8B,YAAW,uBAAuB;IAEzE,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,GAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,eAAe,CAAC,CAA4B;IAGvG,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,eAAe;CAG3C"}
@@ -0,0 +1,96 @@
1
+ const DEFAULT_POLICY = {
2
+ enabled: false,
3
+ maxInvocationsPerIteration: 1,
4
+ budget: {
5
+ maxModelTurns: 6,
6
+ maxToolCalls: 12,
7
+ maxWallClockMs: 90_000,
8
+ maxConsecutiveToolErrors: 2,
9
+ maxRepeatedToolCalls: 2,
10
+ maxSchemaRepairAttempts: 1,
11
+ maxCompletionValidationAttempts: 1,
12
+ maxCompactions: 1,
13
+ compactionMaxMessages: 6,
14
+ },
15
+ allowedTools: [],
16
+ requiredTools: [],
17
+ failPolicy: "fallback_deterministic",
18
+ };
19
+ export const defaultCorePhasePolicies = {
20
+ observe_evidence: {
21
+ ...DEFAULT_POLICY,
22
+ enabled: true,
23
+ allowedTools: [
24
+ "read_pulseed_file",
25
+ "glob",
26
+ "grep",
27
+ "git_log",
28
+ "shell_command",
29
+ "soil_query",
30
+ "tool_search",
31
+ ],
32
+ },
33
+ knowledge_refresh: {
34
+ ...DEFAULT_POLICY,
35
+ enabled: true,
36
+ allowedTools: [
37
+ "soil_query",
38
+ "knowledge_query",
39
+ "memory_recall",
40
+ "glob",
41
+ "grep",
42
+ "read_pulseed_file",
43
+ ],
44
+ requiredTools: ["soil_query"],
45
+ failPolicy: "return_low_confidence",
46
+ },
47
+ stall_investigation: {
48
+ ...DEFAULT_POLICY,
49
+ enabled: true,
50
+ allowedTools: [
51
+ "progress_history",
52
+ "session_history",
53
+ "git_log",
54
+ "shell_command",
55
+ "soil_query",
56
+ "task_get",
57
+ ],
58
+ failPolicy: "return_low_confidence",
59
+ },
60
+ replanning_options: {
61
+ ...DEFAULT_POLICY,
62
+ enabled: false,
63
+ allowedTools: [
64
+ "task_get",
65
+ "goal_state",
66
+ "soil_query",
67
+ "read_plan",
68
+ "session_history",
69
+ "memory_recall",
70
+ ],
71
+ failPolicy: "fallback_deterministic",
72
+ },
73
+ verification_evidence: {
74
+ ...DEFAULT_POLICY,
75
+ enabled: true,
76
+ allowedTools: [
77
+ "test_runner",
78
+ "shell_command",
79
+ "git_diff",
80
+ "read_pulseed_file",
81
+ "grep",
82
+ "soil_query",
83
+ ],
84
+ failPolicy: "fallback_deterministic",
85
+ },
86
+ };
87
+ export class StaticCorePhasePolicyRegistry {
88
+ policies;
89
+ constructor(policies = defaultCorePhasePolicies) {
90
+ this.policies = policies;
91
+ }
92
+ get(phase) {
93
+ return this.policies[phase] ?? DEFAULT_POLICY;
94
+ }
95
+ }
96
+ //# sourceMappingURL=phase-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-policy.js","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/phase-policy.ts"],"names":[],"mappings":"AAgBA,MAAM,cAAc,GAAoB;IACtC,OAAO,EAAE,KAAK;IACd,0BAA0B,EAAE,CAAC;IAC7B,MAAM,EAAE;QACN,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,MAAM;QACtB,wBAAwB,EAAE,CAAC;QAC3B,oBAAoB,EAAE,CAAC;QACvB,uBAAuB,EAAE,CAAC;QAC1B,+BAA+B,EAAE,CAAC;QAClC,cAAc,EAAE,CAAC;QACjB,qBAAqB,EAAE,CAAC;KACzB;IACD,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE,EAAE;IACjB,UAAU,EAAE,wBAAwB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAA2C;IAC9E,gBAAgB,EAAE;QAChB,GAAG,cAAc;QACjB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE;YACZ,mBAAmB;YACnB,MAAM;YACN,MAAM;YACN,SAAS;YACT,eAAe;YACf,YAAY;YACZ,aAAa;SACd;KACF;IACD,iBAAiB,EAAE;QACjB,GAAG,cAAc;QACjB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE;YACZ,YAAY;YACZ,iBAAiB;YACjB,eAAe;YACf,MAAM;YACN,MAAM;YACN,mBAAmB;SACpB;QACD,aAAa,EAAE,CAAC,YAAY,CAAC;QAC7B,UAAU,EAAE,uBAAuB;KACpC;IACD,mBAAmB,EAAE;QACnB,GAAG,cAAc;QACjB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE;YACZ,kBAAkB;YAClB,iBAAiB;YACjB,SAAS;YACT,eAAe;YACf,YAAY;YACZ,UAAU;SACX;QACD,UAAU,EAAE,uBAAuB;KACpC;IACD,kBAAkB,EAAE;QAClB,GAAG,cAAc;QACjB,OAAO,EAAE,KAAK;QACd,YAAY,EAAE;YACZ,UAAU;YACV,YAAY;YACZ,YAAY;YACZ,WAAW;YACX,iBAAiB;YACjB,eAAe;SAChB;QACD,UAAU,EAAE,wBAAwB;KACrC;IACD,qBAAqB,EAAE;QACrB,GAAG,cAAc;QACjB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE;YACZ,aAAa;YACb,eAAe;YACf,UAAU;YACV,mBAAmB;YACnB,MAAM;YACN,YAAY;SACb;QACD,UAAU,EAAE,wBAAwB;KACrC;CACF,CAAC;AAEF,MAAM,OAAO,6BAA6B;IAErB;IADnB,YACmB,WAA4D,wBAAwB;QAApF,aAAQ,GAAR,QAAQ,CAA4E;IACpG,CAAC;IAEJ,GAAG,CAAC,KAAoB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ import type { CorePhaseRunner, CorePhaseSpec } from "../../execution/agent-loop/core-phase-runner.js";
2
+ import type { CorePhasePolicyRegistry } from "./phase-policy.js";
3
+ import type { CorePhaseInvocationContext } from "./phase-specs.js";
4
+ export interface CorePhaseExecution<TOutput> {
5
+ phase: CorePhaseSpec<unknown, TOutput>["phase"];
6
+ status: "skipped" | "completed" | "low_confidence" | "failed";
7
+ output?: TOutput;
8
+ summary?: string;
9
+ lowConfidence?: boolean;
10
+ error?: string;
11
+ traceId?: string;
12
+ sessionId?: string;
13
+ turnId?: string;
14
+ stopReason?: string;
15
+ }
16
+ export interface CorePhaseRuntimeDeps {
17
+ phaseRunner?: CorePhaseRunner;
18
+ policyRegistry: CorePhasePolicyRegistry;
19
+ }
20
+ export declare class CorePhaseRuntime {
21
+ private readonly deps;
22
+ constructor(deps: CorePhaseRuntimeDeps);
23
+ run<TInput, TOutput>(spec: CorePhaseSpec<TInput, TOutput> & {
24
+ runWhen?: (ctx: CorePhaseInvocationContext) => boolean;
25
+ }, input: TInput, context: CorePhaseInvocationContext): Promise<CorePhaseExecution<TOutput>>;
26
+ private summarize;
27
+ private isLowConfidence;
28
+ }
29
+ //# sourceMappingURL=phase-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-runtime.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/phase-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEtG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,WAAW,kBAAkB,CAAC,OAAO;IACzC,KAAK,EAAE,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,QAAQ,CAAC;IAC9D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,cAAc,EAAE,uBAAuB,CAAC;CACzC;AAED,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEjD,GAAG,CAAC,MAAM,EAAE,OAAO,EACvB,IAAI,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,OAAO,CAAA;KAAE,EACjG,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IA8CvC,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,eAAe;CAKxB"}
@@ -0,0 +1,62 @@
1
+ export class CorePhaseRuntime {
2
+ deps;
3
+ constructor(deps) {
4
+ this.deps = deps;
5
+ }
6
+ async run(spec, input, context) {
7
+ const policy = this.deps.policyRegistry.get(spec.phase);
8
+ if (!this.deps.phaseRunner || !policy.enabled || (spec.runWhen && !spec.runWhen(context))) {
9
+ return { phase: spec.phase, status: "skipped" };
10
+ }
11
+ const toolPolicy = {
12
+ allowedTools: policy.allowedTools.length > 0 ? policy.allowedTools : spec.allowedTools,
13
+ requiredTools: policy.requiredTools.length > 0 ? policy.requiredTools : spec.requiredTools,
14
+ };
15
+ try {
16
+ const result = await this.deps.phaseRunner.run({
17
+ ...spec,
18
+ allowedTools: toolPolicy.allowedTools ?? [],
19
+ requiredTools: toolPolicy.requiredTools ?? [],
20
+ budget: policy.budget,
21
+ failPolicy: policy.failPolicy,
22
+ }, input, { goalId: context.goalId, ...(context.taskId ? { taskId: context.taskId } : {}), toolPolicy });
23
+ const summary = this.summarize(result.output);
24
+ const lowConfidence = this.isLowConfidence(result.output);
25
+ return {
26
+ phase: spec.phase,
27
+ status: lowConfidence ? "low_confidence" : result.success ? "completed" : "failed",
28
+ ...(result.output ? { output: result.output } : {}),
29
+ ...(summary ? { summary } : {}),
30
+ ...(lowConfidence ? { lowConfidence } : {}),
31
+ traceId: result.traceId,
32
+ sessionId: result.sessionId,
33
+ turnId: result.turnId,
34
+ stopReason: result.stopReason,
35
+ };
36
+ }
37
+ catch (err) {
38
+ return {
39
+ phase: spec.phase,
40
+ status: policy.failPolicy === "return_low_confidence" ? "low_confidence" : "failed",
41
+ lowConfidence: policy.failPolicy === "return_low_confidence",
42
+ error: err instanceof Error ? err.message : String(err),
43
+ };
44
+ }
45
+ }
46
+ summarize(output) {
47
+ if (!output || typeof output !== "object")
48
+ return undefined;
49
+ const candidate = output;
50
+ if (typeof candidate["summary"] === "string" && candidate["summary"].trim().length > 0) {
51
+ return candidate["summary"];
52
+ }
53
+ return JSON.stringify(output);
54
+ }
55
+ isLowConfidence(output) {
56
+ if (!output || typeof output !== "object")
57
+ return false;
58
+ const value = output["confidence"];
59
+ return typeof value === "number" && value < 0.5;
60
+ }
61
+ }
62
+ //# sourceMappingURL=phase-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-runtime.js","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/phase-runtime.ts"],"names":[],"mappings":"AAuBA,MAAM,OAAO,gBAAgB;IACE;IAA7B,YAA6B,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAAG,CAAC;IAE3D,KAAK,CAAC,GAAG,CACP,IAAiG,EACjG,KAAa,EACb,OAAmC;QAEnC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;YAC1F,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAClD,CAAC;QAED,MAAM,UAAU,GAAwB;YACtC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY;YACtF,aAAa,EAAE,MAAM,CAAC,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