pulseed 0.5.4 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (561) hide show
  1. package/README.md +13 -9
  2. package/dist/adapters/datasources/artifact-metric-datasource.d.ts +18 -0
  3. package/dist/adapters/datasources/artifact-metric-datasource.d.ts.map +1 -0
  4. package/dist/adapters/datasources/artifact-metric-datasource.js +592 -0
  5. package/dist/adapters/datasources/artifact-metric-datasource.js.map +1 -0
  6. package/dist/adapters/types/mcp.d.ts +6 -6
  7. package/dist/base/types/goal-activation.d.ts +14 -2
  8. package/dist/base/types/goal-activation.d.ts.map +1 -1
  9. package/dist/base/types/goal-activation.js +4 -0
  10. package/dist/base/types/goal-activation.js.map +1 -1
  11. package/dist/index.d.ts +6 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +4 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/interface/chat/chat-runner-commands.d.ts +6 -0
  16. package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -1
  17. package/dist/interface/chat/chat-runner-commands.js +94 -2
  18. package/dist/interface/chat/chat-runner-commands.js.map +1 -1
  19. package/dist/interface/chat/chat-runner-event-bridge.d.ts +8 -1
  20. package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -1
  21. package/dist/interface/chat/chat-runner-event-bridge.js +69 -3
  22. package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -1
  23. package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -1
  24. package/dist/interface/chat/chat-runner-routes.js +23 -7
  25. package/dist/interface/chat/chat-runner-routes.js.map +1 -1
  26. package/dist/interface/chat/chat-runner-support.d.ts +25 -1
  27. package/dist/interface/chat/chat-runner-support.d.ts.map +1 -1
  28. package/dist/interface/chat/chat-runner-support.js +66 -12
  29. package/dist/interface/chat/chat-runner-support.js.map +1 -1
  30. package/dist/interface/chat/chat-runner.d.ts.map +1 -1
  31. package/dist/interface/chat/chat-runner.js +38 -8
  32. package/dist/interface/chat/chat-runner.js.map +1 -1
  33. package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
  34. package/dist/interface/chat/cross-platform-session.js +13 -1
  35. package/dist/interface/chat/cross-platform-session.js.map +1 -1
  36. package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
  37. package/dist/interface/chat/event-subscriber.js +20 -0
  38. package/dist/interface/chat/event-subscriber.js.map +1 -1
  39. package/dist/interface/chat/failure-recovery.d.ts +43 -1
  40. package/dist/interface/chat/failure-recovery.d.ts.map +1 -1
  41. package/dist/interface/chat/failure-recovery.js +259 -89
  42. package/dist/interface/chat/failure-recovery.js.map +1 -1
  43. package/dist/interface/chat/ingress-router.d.ts +2 -1
  44. package/dist/interface/chat/ingress-router.d.ts.map +1 -1
  45. package/dist/interface/chat/ingress-router.js +2 -3
  46. package/dist/interface/chat/ingress-router.js.map +1 -1
  47. package/dist/interface/chat/tend-command.js +1 -0
  48. package/dist/interface/chat/tend-command.js.map +1 -1
  49. package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
  50. package/dist/interface/cli/cli-command-registry.js +19 -3
  51. package/dist/interface/cli/cli-command-registry.js.map +1 -1
  52. package/dist/interface/cli/commands/daemon-shared.d.ts +2 -1
  53. package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -1
  54. package/dist/interface/cli/commands/daemon-shared.js +33 -1
  55. package/dist/interface/cli/commands/daemon-shared.js.map +1 -1
  56. package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
  57. package/dist/interface/cli/commands/daemon.js +59 -8
  58. package/dist/interface/cli/commands/daemon.js.map +1 -1
  59. package/dist/interface/cli/commands/goal-read.d.ts.map +1 -1
  60. package/dist/interface/cli/commands/goal-read.js +10 -3
  61. package/dist/interface/cli/commands/goal-read.js.map +1 -1
  62. package/dist/interface/cli/commands/notify.d.ts.map +1 -1
  63. package/dist/interface/cli/commands/notify.js +7 -1
  64. package/dist/interface/cli/commands/notify.js.map +1 -1
  65. package/dist/interface/cli/commands/run.d.ts.map +1 -1
  66. package/dist/interface/cli/commands/run.js +29 -0
  67. package/dist/interface/cli/commands/run.js.map +1 -1
  68. package/dist/interface/cli/commands/runtime.d.ts +1 -1
  69. package/dist/interface/cli/commands/runtime.d.ts.map +1 -1
  70. package/dist/interface/cli/commands/runtime.js +407 -2
  71. package/dist/interface/cli/commands/runtime.js.map +1 -1
  72. package/dist/interface/cli/data-source-bootstrap.d.ts.map +1 -1
  73. package/dist/interface/cli/data-source-bootstrap.js +25 -12
  74. package/dist/interface/cli/data-source-bootstrap.js.map +1 -1
  75. package/dist/interface/cli/setup.d.ts.map +1 -1
  76. package/dist/interface/cli/setup.js +14 -0
  77. package/dist/interface/cli/setup.js.map +1 -1
  78. package/dist/interface/cli/utils/loop-runner.d.ts.map +1 -1
  79. package/dist/interface/cli/utils/loop-runner.js +2 -1
  80. package/dist/interface/cli/utils/loop-runner.js.map +1 -1
  81. package/dist/interface/cli/utils.d.ts.map +1 -1
  82. package/dist/interface/cli/utils.js +8 -1
  83. package/dist/interface/cli/utils.js.map +1 -1
  84. package/dist/interface/tui/app.d.ts +4 -1
  85. package/dist/interface/tui/app.d.ts.map +1 -1
  86. package/dist/interface/tui/app.js +268 -10
  87. package/dist/interface/tui/app.js.map +1 -1
  88. package/dist/interface/tui/chat-surface.d.ts +2 -0
  89. package/dist/interface/tui/chat-surface.d.ts.map +1 -1
  90. package/dist/interface/tui/chat-surface.js +3 -0
  91. package/dist/interface/tui/chat-surface.js.map +1 -1
  92. package/dist/interface/tui/dashboard.d.ts +37 -1
  93. package/dist/interface/tui/dashboard.d.ts.map +1 -1
  94. package/dist/interface/tui/dashboard.js +264 -1
  95. package/dist/interface/tui/dashboard.js.map +1 -1
  96. package/dist/interface/tui/entry-deps.d.ts +3 -1
  97. package/dist/interface/tui/entry-deps.d.ts.map +1 -1
  98. package/dist/interface/tui/entry-deps.js +19 -1
  99. package/dist/interface/tui/entry-deps.js.map +1 -1
  100. package/dist/interface/tui/entry.d.ts.map +1 -1
  101. package/dist/interface/tui/entry.js +4 -2
  102. package/dist/interface/tui/entry.js.map +1 -1
  103. package/dist/interface/tui/intent-recognizer.d.ts +8 -3
  104. package/dist/interface/tui/intent-recognizer.d.ts.map +1 -1
  105. package/dist/interface/tui/intent-recognizer.js +74 -68
  106. package/dist/interface/tui/intent-recognizer.js.map +1 -1
  107. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
  108. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +41 -0
  109. package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
  110. package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -1
  111. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +1 -1
  112. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -1
  113. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +3 -2
  114. package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
  115. package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts +1 -1
  116. package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts.map +1 -1
  117. package/dist/orchestrator/execution/agent-loop/core-phase-runner.js +10 -1
  118. package/dist/orchestrator/execution/agent-loop/core-phase-runner.js.map +1 -1
  119. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts +2 -0
  120. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts.map +1 -1
  121. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js +4 -0
  122. package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js.map +1 -1
  123. package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts +8 -8
  124. package/dist/orchestrator/execution/task/task-generation.d.ts +3 -1
  125. package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
  126. package/dist/orchestrator/execution/task/task-generation.js +17 -2
  127. package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
  128. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +5 -1
  129. package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -1
  130. package/dist/orchestrator/execution/task/task-lifecycle-runner.js +9 -5
  131. package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -1
  132. package/dist/orchestrator/execution/task/task-lifecycle.d.ts +10 -1
  133. package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
  134. package/dist/orchestrator/execution/task/task-lifecycle.js +108 -7
  135. package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
  136. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts +2 -1
  137. package/dist/orchestrator/execution/task/task-prompt-builder.d.ts.map +1 -1
  138. package/dist/orchestrator/execution/task/task-prompt-builder.js +4 -2
  139. package/dist/orchestrator/execution/task/task-prompt-builder.js.map +1 -1
  140. package/dist/orchestrator/execution/types/pipeline.d.ts +6 -6
  141. package/dist/orchestrator/goal/types/goal.d.ts +282 -0
  142. package/dist/orchestrator/goal/types/goal.d.ts.map +1 -1
  143. package/dist/orchestrator/goal/types/goal.js +20 -0
  144. package/dist/orchestrator/goal/types/goal.js.map +1 -1
  145. package/dist/orchestrator/loop/core-loop/contracts.d.ts +46 -3
  146. package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
  147. package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
  148. package/dist/orchestrator/loop/core-loop/decision-engine.d.ts.map +1 -1
  149. package/dist/orchestrator/loop/core-loop/decision-engine.js +4 -0
  150. package/dist/orchestrator/loop/core-loop/decision-engine.js.map +1 -1
  151. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts +48 -0
  152. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts.map +1 -0
  153. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js +377 -0
  154. package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js.map +1 -0
  155. package/dist/orchestrator/loop/core-loop/evidence-ledger.js +1 -1
  156. package/dist/orchestrator/loop/core-loop/evidence-ledger.js.map +1 -1
  157. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +1 -0
  158. package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
  159. package/dist/orchestrator/loop/core-loop/iteration-kernel.js +492 -1
  160. package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -1
  161. package/dist/orchestrator/loop/core-loop/phase-policy.d.ts.map +1 -1
  162. package/dist/orchestrator/loop/core-loop/phase-policy.js +35 -0
  163. package/dist/orchestrator/loop/core-loop/phase-policy.js.map +1 -1
  164. package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts +2 -0
  165. package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts.map +1 -1
  166. package/dist/orchestrator/loop/core-loop/phase-runtime.js +43 -2
  167. package/dist/orchestrator/loop/core-loop/phase-runtime.js.map +1 -1
  168. package/dist/orchestrator/loop/core-loop/phase-specs.d.ts +969 -2
  169. package/dist/orchestrator/loop/core-loop/phase-specs.d.ts.map +1 -1
  170. package/dist/orchestrator/loop/core-loop/phase-specs.js +198 -0
  171. package/dist/orchestrator/loop/core-loop/phase-specs.js.map +1 -1
  172. package/dist/orchestrator/loop/core-loop/public-research.d.ts +32 -0
  173. package/dist/orchestrator/loop/core-loop/public-research.d.ts.map +1 -0
  174. package/dist/orchestrator/loop/core-loop/public-research.js +112 -0
  175. package/dist/orchestrator/loop/core-loop/public-research.js.map +1 -0
  176. package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -1
  177. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +141 -5
  178. package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -1
  179. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +4 -0
  180. package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
  181. package/dist/orchestrator/loop/core-loop/task-cycle.js +7 -0
  182. package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
  183. package/dist/orchestrator/loop/core-loop.d.ts +15 -5
  184. package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
  185. package/dist/orchestrator/loop/core-loop.js +283 -17
  186. package/dist/orchestrator/loop/core-loop.js.map +1 -1
  187. package/dist/orchestrator/loop/loop-report-helper.d.ts.map +1 -1
  188. package/dist/orchestrator/loop/loop-report-helper.js +4 -0
  189. package/dist/orchestrator/loop/loop-report-helper.js.map +1 -1
  190. package/dist/orchestrator/loop/loop-result-types.d.ts +20 -1
  191. package/dist/orchestrator/loop/loop-result-types.d.ts.map +1 -1
  192. package/dist/orchestrator/loop/loop-result-types.js.map +1 -1
  193. package/dist/orchestrator/loop/post-loop-hooks.d.ts +1 -0
  194. package/dist/orchestrator/loop/post-loop-hooks.d.ts.map +1 -1
  195. package/dist/orchestrator/loop/post-loop-hooks.js +34 -1
  196. package/dist/orchestrator/loop/post-loop-hooks.js.map +1 -1
  197. package/dist/orchestrator/loop/run-policy.d.ts +10 -0
  198. package/dist/orchestrator/loop/run-policy.d.ts.map +1 -0
  199. package/dist/orchestrator/loop/run-policy.js +30 -0
  200. package/dist/orchestrator/loop/run-policy.js.map +1 -0
  201. package/dist/orchestrator/strategy/divergent-exploration.d.ts +37 -0
  202. package/dist/orchestrator/strategy/divergent-exploration.d.ts.map +1 -0
  203. package/dist/orchestrator/strategy/divergent-exploration.js +324 -0
  204. package/dist/orchestrator/strategy/divergent-exploration.js.map +1 -0
  205. package/dist/orchestrator/strategy/strategy-helpers.d.ts +108 -0
  206. package/dist/orchestrator/strategy/strategy-helpers.d.ts.map +1 -1
  207. package/dist/orchestrator/strategy/strategy-helpers.js +34 -2
  208. package/dist/orchestrator/strategy/strategy-helpers.js.map +1 -1
  209. package/dist/orchestrator/strategy/strategy-manager-base.d.ts +20 -1
  210. package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
  211. package/dist/orchestrator/strategy/strategy-manager-base.js +71 -6
  212. package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
  213. package/dist/orchestrator/strategy/types/cross-portfolio.d.ts +2 -2
  214. package/dist/orchestrator/strategy/types/strategy.d.ts +364 -0
  215. package/dist/orchestrator/strategy/types/strategy.d.ts.map +1 -1
  216. package/dist/orchestrator/strategy/types/strategy.js +43 -0
  217. package/dist/orchestrator/strategy/types/strategy.js.map +1 -1
  218. package/dist/platform/dream/dream-activation.d.ts +1 -1
  219. package/dist/platform/dream/dream-event-workflows.d.ts +6 -6
  220. package/dist/platform/dream/dream-types.d.ts +91 -91
  221. package/dist/platform/drive/metric-history.d.ts +61 -0
  222. package/dist/platform/drive/metric-history.d.ts.map +1 -0
  223. package/dist/platform/drive/metric-history.js +206 -0
  224. package/dist/platform/drive/metric-history.js.map +1 -0
  225. package/dist/platform/drive/progress-predictor.d.ts +7 -0
  226. package/dist/platform/drive/progress-predictor.d.ts.map +1 -1
  227. package/dist/platform/drive/progress-predictor.js +23 -0
  228. package/dist/platform/drive/progress-predictor.js.map +1 -1
  229. package/dist/platform/drive/stall-detector.d.ts +3 -1
  230. package/dist/platform/drive/stall-detector.d.ts.map +1 -1
  231. package/dist/platform/drive/stall-detector.js +40 -1
  232. package/dist/platform/drive/stall-detector.js.map +1 -1
  233. package/dist/platform/drive/types/satisficing.d.ts +2 -2
  234. package/dist/platform/drive/types/stall.d.ts +4 -0
  235. package/dist/platform/drive/types/stall.d.ts.map +1 -1
  236. package/dist/platform/drive/types/stall.js +1 -0
  237. package/dist/platform/drive/types/stall.js.map +1 -1
  238. package/dist/platform/knowledge/types/learning.d.ts +2 -2
  239. package/dist/platform/observation/data-source-adapter.d.ts +1 -0
  240. package/dist/platform/observation/data-source-adapter.d.ts.map +1 -1
  241. package/dist/platform/observation/data-source-adapter.js.map +1 -1
  242. package/dist/platform/observation/observation-datasource.d.ts.map +1 -1
  243. package/dist/platform/observation/observation-datasource.js +2 -0
  244. package/dist/platform/observation/observation-datasource.js.map +1 -1
  245. package/dist/platform/observation/types/data-source.d.ts +153 -9
  246. package/dist/platform/observation/types/data-source.d.ts.map +1 -1
  247. package/dist/platform/observation/types/data-source.js +13 -1
  248. package/dist/platform/observation/types/data-source.js.map +1 -1
  249. package/dist/platform/soil/contracts.d.ts +65 -65
  250. package/dist/platform/soil/importer.d.ts +6 -6
  251. package/dist/platform/soil/types.d.ts +8 -8
  252. package/dist/platform/time/deadline-finalization.d.ts +57 -0
  253. package/dist/platform/time/deadline-finalization.d.ts.map +1 -0
  254. package/dist/platform/time/deadline-finalization.js +136 -0
  255. package/dist/platform/time/deadline-finalization.js.map +1 -0
  256. package/dist/platform/time/execution-mode.d.ts +29 -0
  257. package/dist/platform/time/execution-mode.d.ts.map +1 -0
  258. package/dist/platform/time/execution-mode.js +84 -0
  259. package/dist/platform/time/execution-mode.js.map +1 -0
  260. package/dist/platform/traits/types/curiosity.d.ts +9 -9
  261. package/dist/platform/traits/types/guardrail.d.ts +6 -6
  262. package/dist/reporting/report-formatters.d.ts.map +1 -1
  263. package/dist/reporting/report-formatters.js +67 -2
  264. package/dist/reporting/report-formatters.js.map +1 -1
  265. package/dist/reporting/reporting-engine.d.ts.map +1 -1
  266. package/dist/reporting/reporting-engine.js +3 -1
  267. package/dist/reporting/reporting-engine.js.map +1 -1
  268. package/dist/reporting/reporting-types.d.ts +4 -0
  269. package/dist/reporting/reporting-types.d.ts.map +1 -1
  270. package/dist/reporting/types/report.d.ts +59 -0
  271. package/dist/reporting/types/report.d.ts.map +1 -1
  272. package/dist/reporting/types/report.js +9 -0
  273. package/dist/reporting/types/report.js.map +1 -1
  274. package/dist/runtime/command-dispatcher.d.ts +2 -0
  275. package/dist/runtime/command-dispatcher.d.ts.map +1 -1
  276. package/dist/runtime/command-dispatcher.js +16 -0
  277. package/dist/runtime/command-dispatcher.js.map +1 -1
  278. package/dist/runtime/confirmation-decision.d.ts +94 -0
  279. package/dist/runtime/confirmation-decision.d.ts.map +1 -0
  280. package/dist/runtime/confirmation-decision.js +109 -0
  281. package/dist/runtime/confirmation-decision.js.map +1 -0
  282. package/dist/runtime/control/daemon-runtime-control-executor.d.ts.map +1 -1
  283. package/dist/runtime/control/daemon-runtime-control-executor.js +31 -1
  284. package/dist/runtime/control/daemon-runtime-control-executor.js.map +1 -1
  285. package/dist/runtime/control/runtime-control-intent.d.ts +9 -1
  286. package/dist/runtime/control/runtime-control-intent.d.ts.map +1 -1
  287. package/dist/runtime/control/runtime-control-intent.js +82 -16
  288. package/dist/runtime/control/runtime-control-intent.js.map +1 -1
  289. package/dist/runtime/control/runtime-control-service.d.ts +35 -1
  290. package/dist/runtime/control/runtime-control-service.d.ts.map +1 -1
  291. package/dist/runtime/control/runtime-control-service.js +285 -5
  292. package/dist/runtime/control/runtime-control-service.js.map +1 -1
  293. package/dist/runtime/daemon/client.d.ts +12 -0
  294. package/dist/runtime/daemon/client.d.ts.map +1 -1
  295. package/dist/runtime/daemon/client.js +9 -0
  296. package/dist/runtime/daemon/client.js.map +1 -1
  297. package/dist/runtime/daemon/runner-commands.d.ts +6 -2
  298. package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
  299. package/dist/runtime/daemon/runner-commands.js +237 -1
  300. package/dist/runtime/daemon/runner-commands.js.map +1 -1
  301. package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
  302. package/dist/runtime/daemon/runner-goal-cycle.js +59 -1
  303. package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
  304. package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
  305. package/dist/runtime/daemon/runner-startup.js +12 -2
  306. package/dist/runtime/daemon/runner-startup.js.map +1 -1
  307. package/dist/runtime/daemon/runner.d.ts +4 -0
  308. package/dist/runtime/daemon/runner.d.ts.map +1 -1
  309. package/dist/runtime/daemon/runner.js +14 -1
  310. package/dist/runtime/daemon/runner.js.map +1 -1
  311. package/dist/runtime/daemon/runtime-ownership.d.ts +9 -0
  312. package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -1
  313. package/dist/runtime/daemon/runtime-ownership.js +248 -1
  314. package/dist/runtime/daemon/runtime-ownership.js.map +1 -1
  315. package/dist/runtime/dream-sidecar-review.d.ts +92 -0
  316. package/dist/runtime/dream-sidecar-review.d.ts.map +1 -0
  317. package/dist/runtime/dream-sidecar-review.js +495 -0
  318. package/dist/runtime/dream-sidecar-review.js.map +1 -0
  319. package/dist/runtime/event/server-command-handler.d.ts +2 -4
  320. package/dist/runtime/event/server-command-handler.d.ts.map +1 -1
  321. package/dist/runtime/event/server-command-handler.js +36 -6
  322. package/dist/runtime/event/server-command-handler.js.map +1 -1
  323. package/dist/runtime/event/server-snapshot-reader.d.ts +15 -1
  324. package/dist/runtime/event/server-snapshot-reader.d.ts.map +1 -1
  325. package/dist/runtime/event/server-snapshot-reader.js +66 -2
  326. package/dist/runtime/event/server-snapshot-reader.js.map +1 -1
  327. package/dist/runtime/event/server-types.d.ts +7 -0
  328. package/dist/runtime/event/server-types.d.ts.map +1 -1
  329. package/dist/runtime/event/server.d.ts +5 -0
  330. package/dist/runtime/event/server.d.ts.map +1 -1
  331. package/dist/runtime/event/server.js +43 -11
  332. package/dist/runtime/event/server.js.map +1 -1
  333. package/dist/runtime/evidence-answer.d.ts +41 -0
  334. package/dist/runtime/evidence-answer.d.ts.map +1 -0
  335. package/dist/runtime/evidence-answer.js +366 -0
  336. package/dist/runtime/evidence-answer.js.map +1 -0
  337. package/dist/runtime/executor/goal-worker.d.ts +4 -1
  338. package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
  339. package/dist/runtime/executor/goal-worker.js +5 -1
  340. package/dist/runtime/executor/goal-worker.js.map +1 -1
  341. package/dist/runtime/executor/loop-supervisor.d.ts +4 -0
  342. package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
  343. package/dist/runtime/executor/loop-supervisor.js +35 -6
  344. package/dist/runtime/executor/loop-supervisor.js.map +1 -1
  345. package/dist/runtime/guardrails/backpressure-controller.d.ts +32 -0
  346. package/dist/runtime/guardrails/backpressure-controller.d.ts.map +1 -0
  347. package/dist/runtime/guardrails/backpressure-controller.js +88 -0
  348. package/dist/runtime/guardrails/backpressure-controller.js.map +1 -0
  349. package/dist/runtime/guardrails/circuit-breaker.d.ts +32 -0
  350. package/dist/runtime/guardrails/circuit-breaker.d.ts.map +1 -0
  351. package/dist/runtime/guardrails/circuit-breaker.js +88 -0
  352. package/dist/runtime/guardrails/circuit-breaker.js.map +1 -0
  353. package/dist/runtime/guardrails/guardrail-store.d.ts +23 -0
  354. package/dist/runtime/guardrails/guardrail-store.d.ts.map +1 -0
  355. package/dist/runtime/guardrails/guardrail-store.js +95 -0
  356. package/dist/runtime/guardrails/guardrail-store.js.map +1 -0
  357. package/dist/runtime/guardrails/index.d.ts +4 -0
  358. package/dist/runtime/guardrails/index.d.ts.map +1 -0
  359. package/dist/runtime/guardrails/index.js +4 -0
  360. package/dist/runtime/guardrails/index.js.map +1 -0
  361. package/dist/runtime/interactive-automation/browser-session-store.d.ts +43 -0
  362. package/dist/runtime/interactive-automation/browser-session-store.d.ts.map +1 -0
  363. package/dist/runtime/interactive-automation/browser-session-store.js +104 -0
  364. package/dist/runtime/interactive-automation/browser-session-store.js.map +1 -0
  365. package/dist/runtime/interactive-automation/failure-classifier.d.ts +12 -0
  366. package/dist/runtime/interactive-automation/failure-classifier.d.ts.map +1 -0
  367. package/dist/runtime/interactive-automation/failure-classifier.js +50 -0
  368. package/dist/runtime/interactive-automation/failure-classifier.js.map +1 -0
  369. package/dist/runtime/interactive-automation/index.d.ts +2 -0
  370. package/dist/runtime/interactive-automation/index.d.ts.map +1 -1
  371. package/dist/runtime/interactive-automation/index.js +2 -0
  372. package/dist/runtime/interactive-automation/index.js.map +1 -1
  373. package/dist/runtime/interactive-automation/providers/manus-browser.d.ts.map +1 -1
  374. package/dist/runtime/interactive-automation/providers/manus-browser.js +17 -1
  375. package/dist/runtime/interactive-automation/providers/manus-browser.js.map +1 -1
  376. package/dist/runtime/interactive-automation/types.d.ts +4 -0
  377. package/dist/runtime/interactive-automation/types.d.ts.map +1 -1
  378. package/dist/runtime/interactive-automation/types.js.map +1 -1
  379. package/dist/runtime/notification-routing.d.ts +45 -2
  380. package/dist/runtime/notification-routing.d.ts.map +1 -1
  381. package/dist/runtime/notification-routing.js +196 -79
  382. package/dist/runtime/notification-routing.js.map +1 -1
  383. package/dist/runtime/run-spec/confirmation.d.ts +34 -0
  384. package/dist/runtime/run-spec/confirmation.d.ts.map +1 -0
  385. package/dist/runtime/run-spec/confirmation.js +176 -0
  386. package/dist/runtime/run-spec/confirmation.js.map +1 -0
  387. package/dist/runtime/run-spec/derive.d.ts +284 -0
  388. package/dist/runtime/run-spec/derive.d.ts.map +1 -0
  389. package/dist/runtime/run-spec/derive.js +379 -0
  390. package/dist/runtime/run-spec/derive.js.map +1 -0
  391. package/dist/runtime/run-spec/index.d.ts +5 -0
  392. package/dist/runtime/run-spec/index.d.ts.map +1 -0
  393. package/dist/runtime/run-spec/index.js +5 -0
  394. package/dist/runtime/run-spec/index.js.map +1 -0
  395. package/dist/runtime/run-spec/store.d.ts +11 -0
  396. package/dist/runtime/run-spec/store.d.ts.map +1 -0
  397. package/dist/runtime/run-spec/store.js +36 -0
  398. package/dist/runtime/run-spec/store.js.map +1 -0
  399. package/dist/runtime/run-spec/types.d.ts +495 -0
  400. package/dist/runtime/run-spec/types.d.ts.map +1 -0
  401. package/dist/runtime/run-spec/types.js +87 -0
  402. package/dist/runtime/run-spec/types.js.map +1 -0
  403. package/dist/runtime/schedule/engine-execution.d.ts +2 -1
  404. package/dist/runtime/schedule/engine-execution.d.ts.map +1 -1
  405. package/dist/runtime/schedule/engine-execution.js +1 -1
  406. package/dist/runtime/schedule/engine-execution.js.map +1 -1
  407. package/dist/runtime/schedule/engine-layers.d.ts +2 -1
  408. package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
  409. package/dist/runtime/schedule/engine-layers.js +3 -1
  410. package/dist/runtime/schedule/engine-layers.js.map +1 -1
  411. package/dist/runtime/schedule/engine.d.ts +2 -1
  412. package/dist/runtime/schedule/engine.d.ts.map +1 -1
  413. package/dist/runtime/schedule/engine.js.map +1 -1
  414. package/dist/runtime/schedule/history.d.ts +4 -4
  415. package/dist/runtime/session-registry/registry.d.ts.map +1 -1
  416. package/dist/runtime/session-registry/registry.js +2 -0
  417. package/dist/runtime/session-registry/registry.js.map +1 -1
  418. package/dist/runtime/session-registry/types.d.ts +102 -94
  419. package/dist/runtime/session-registry/types.d.ts.map +1 -1
  420. package/dist/runtime/session-registry/types.js +2 -0
  421. package/dist/runtime/session-registry/types.js.map +1 -1
  422. package/dist/runtime/store/artifact-retention.d.ts +44 -0
  423. package/dist/runtime/store/artifact-retention.d.ts.map +1 -0
  424. package/dist/runtime/store/artifact-retention.js +263 -0
  425. package/dist/runtime/store/artifact-retention.js.map +1 -0
  426. package/dist/runtime/store/background-run-store.d.ts +1 -0
  427. package/dist/runtime/store/background-run-store.d.ts.map +1 -1
  428. package/dist/runtime/store/background-run-store.js +1 -0
  429. package/dist/runtime/store/background-run-store.js.map +1 -1
  430. package/dist/runtime/store/budget-store.d.ts +442 -0
  431. package/dist/runtime/store/budget-store.d.ts.map +1 -0
  432. package/dist/runtime/store/budget-store.js +318 -0
  433. package/dist/runtime/store/budget-store.js.map +1 -0
  434. package/dist/runtime/store/dream-checkpoints.d.ts +9 -0
  435. package/dist/runtime/store/dream-checkpoints.d.ts.map +1 -0
  436. package/dist/runtime/store/dream-checkpoints.js +16 -0
  437. package/dist/runtime/store/dream-checkpoints.js.map +1 -0
  438. package/dist/runtime/store/evaluator-results.d.ts +97 -0
  439. package/dist/runtime/store/evaluator-results.d.ts.map +1 -0
  440. package/dist/runtime/store/evaluator-results.js +355 -0
  441. package/dist/runtime/store/evaluator-results.js.map +1 -0
  442. package/dist/runtime/store/evidence-ledger.d.ts +5298 -0
  443. package/dist/runtime/store/evidence-ledger.d.ts.map +1 -0
  444. package/dist/runtime/store/evidence-ledger.js +1452 -0
  445. package/dist/runtime/store/evidence-ledger.js.map +1 -0
  446. package/dist/runtime/store/experiment-queue-store.d.ts +1164 -0
  447. package/dist/runtime/store/experiment-queue-store.d.ts.map +1 -0
  448. package/dist/runtime/store/experiment-queue-store.js +341 -0
  449. package/dist/runtime/store/experiment-queue-store.js.map +1 -0
  450. package/dist/runtime/store/health-store.d.ts.map +1 -1
  451. package/dist/runtime/store/health-store.js +6 -0
  452. package/dist/runtime/store/health-store.js.map +1 -1
  453. package/dist/runtime/store/index.d.ts +25 -2
  454. package/dist/runtime/store/index.d.ts.map +1 -1
  455. package/dist/runtime/store/index.js +13 -1
  456. package/dist/runtime/store/index.js.map +1 -1
  457. package/dist/runtime/store/metric-history.d.ts +10 -0
  458. package/dist/runtime/store/metric-history.d.ts.map +1 -0
  459. package/dist/runtime/store/metric-history.js +56 -0
  460. package/dist/runtime/store/metric-history.js.map +1 -0
  461. package/dist/runtime/store/operator-handoff-store.d.ts +179 -0
  462. package/dist/runtime/store/operator-handoff-store.d.ts.map +1 -0
  463. package/dist/runtime/store/operator-handoff-store.js +120 -0
  464. package/dist/runtime/store/operator-handoff-store.js.map +1 -0
  465. package/dist/runtime/store/postmortem-report.d.ts +485 -0
  466. package/dist/runtime/store/postmortem-report.d.ts.map +1 -0
  467. package/dist/runtime/store/postmortem-report.js +561 -0
  468. package/dist/runtime/store/postmortem-report.js.map +1 -0
  469. package/dist/runtime/store/reproducibility-manifest.d.ts +565 -0
  470. package/dist/runtime/store/reproducibility-manifest.d.ts.map +1 -0
  471. package/dist/runtime/store/reproducibility-manifest.js +392 -0
  472. package/dist/runtime/store/reproducibility-manifest.js.map +1 -0
  473. package/dist/runtime/store/research-evidence.d.ts +8 -0
  474. package/dist/runtime/store/research-evidence.d.ts.map +1 -0
  475. package/dist/runtime/store/research-evidence.js +15 -0
  476. package/dist/runtime/store/research-evidence.js.map +1 -0
  477. package/dist/runtime/store/runtime-operation-schemas.d.ts +70 -24
  478. package/dist/runtime/store/runtime-operation-schemas.d.ts.map +1 -1
  479. package/dist/runtime/store/runtime-operation-schemas.js +16 -1
  480. package/dist/runtime/store/runtime-operation-schemas.js.map +1 -1
  481. package/dist/runtime/store/runtime-paths.d.ts +25 -0
  482. package/dist/runtime/store/runtime-paths.d.ts.map +1 -1
  483. package/dist/runtime/store/runtime-paths.js +73 -0
  484. package/dist/runtime/store/runtime-paths.js.map +1 -1
  485. package/dist/runtime/store/runtime-schemas.d.ts +1936 -17
  486. package/dist/runtime/store/runtime-schemas.d.ts.map +1 -1
  487. package/dist/runtime/store/runtime-schemas.js +201 -0
  488. package/dist/runtime/store/runtime-schemas.js.map +1 -1
  489. package/dist/runtime/store/safe-pause-store.d.ts +28 -0
  490. package/dist/runtime/store/safe-pause-store.d.ts.map +1 -0
  491. package/dist/runtime/store/safe-pause-store.js +103 -0
  492. package/dist/runtime/store/safe-pause-store.js.map +1 -0
  493. package/dist/runtime/types/daemon.d.ts +224 -14
  494. package/dist/runtime/types/daemon.d.ts.map +1 -1
  495. package/dist/runtime/types/daemon.js +27 -2
  496. package/dist/runtime/types/daemon.js.map +1 -1
  497. package/dist/runtime/types/envelope.d.ts +10 -10
  498. package/dist/runtime/types/hook.d.ts +9 -9
  499. package/dist/runtime/types/notification.d.ts +6 -6
  500. package/dist/runtime/types/plugin.d.ts +2 -2
  501. package/dist/runtime/types/schedule.d.ts +97 -54
  502. package/dist/runtime/types/schedule.d.ts.map +1 -1
  503. package/dist/runtime/types/schedule.js +10 -1
  504. package/dist/runtime/types/schedule.js.map +1 -1
  505. package/dist/runtime/types/trigger.d.ts +2 -2
  506. package/dist/tools/automation/InteractiveAutomationTools.d.ts +10 -0
  507. package/dist/tools/automation/InteractiveAutomationTools.d.ts.map +1 -1
  508. package/dist/tools/automation/InteractiveAutomationTools.js +139 -8
  509. package/dist/tools/automation/InteractiveAutomationTools.js.map +1 -1
  510. package/dist/tools/builtin/exports.d.ts +1 -1
  511. package/dist/tools/builtin/exports.d.ts.map +1 -1
  512. package/dist/tools/builtin/exports.js +1 -1
  513. package/dist/tools/builtin/exports.js.map +1 -1
  514. package/dist/tools/builtin/factory.d.ts +5 -0
  515. package/dist/tools/builtin/factory.d.ts.map +1 -1
  516. package/dist/tools/builtin/factory.js +18 -2
  517. package/dist/tools/builtin/factory.js.map +1 -1
  518. package/dist/tools/kaggle/KaggleExperimentTools.d.ts +792 -8
  519. package/dist/tools/kaggle/KaggleExperimentTools.d.ts.map +1 -1
  520. package/dist/tools/kaggle/KaggleExperimentTools.js +284 -19
  521. package/dist/tools/kaggle/KaggleExperimentTools.js.map +1 -1
  522. package/dist/tools/kaggle/KaggleSubmissionTools.d.ts +18 -12
  523. package/dist/tools/kaggle/KaggleSubmissionTools.d.ts.map +1 -1
  524. package/dist/tools/kaggle/KaggleSubmissionTools.js +23 -4
  525. package/dist/tools/kaggle/KaggleSubmissionTools.js.map +1 -1
  526. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts +28 -9
  527. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts.map +1 -1
  528. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js +182 -4
  529. package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js.map +1 -1
  530. package/dist/tools/kaggle/index.d.ts +1 -1
  531. package/dist/tools/kaggle/index.d.ts.map +1 -1
  532. package/dist/tools/kaggle/index.js +1 -1
  533. package/dist/tools/kaggle/index.js.map +1 -1
  534. package/dist/tools/kaggle/metrics.d.ts +845 -4
  535. package/dist/tools/kaggle/metrics.d.ts.map +1 -1
  536. package/dist/tools/kaggle/metrics.js +410 -1
  537. package/dist/tools/kaggle/metrics.js.map +1 -1
  538. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts +6 -0
  539. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts.map +1 -1
  540. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js +9 -2
  541. package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js.map +1 -1
  542. package/dist/tools/mutation/TaskCreateTool/TaskCreateTool.d.ts +4 -4
  543. package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts +4 -4
  544. package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +2 -2
  545. package/dist/tools/query/runtime-dream-review-tool.d.ts +34 -0
  546. package/dist/tools/query/runtime-dream-review-tool.d.ts.map +1 -0
  547. package/dist/tools/query/runtime-dream-review-tool.js +62 -0
  548. package/dist/tools/query/runtime-dream-review-tool.js.map +1 -0
  549. package/dist/tools/query/runtime-session-tools.d.ts.map +1 -1
  550. package/dist/tools/query/runtime-session-tools.js +2 -0
  551. package/dist/tools/query/runtime-session-tools.js.map +1 -1
  552. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +103 -103
  553. package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -1
  554. package/dist/tools/runtime/LongRunningRuntimeTools.js +60 -0
  555. package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -1
  556. package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts +62 -32
  557. package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts.map +1 -1
  558. package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts +78 -44
  559. package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts.map +1 -1
  560. package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts +4 -4
  561. package/package.json +2 -1
@@ -1,3 +1,4 @@
1
+ import * as path from "node:path";
1
2
  import { generateLoopReport } from "../loop-report-helper.js";
2
3
  import { makeEmptyIterationResult } from "../loop-result-types.js";
3
4
  import { loadGoalWithAggregation, observeAndReload, calculateGapOrComplete, scoreDrivesAndCheckKnowledge, phaseAutoDecompose, } from "./preparation.js";
@@ -6,9 +7,14 @@ import { runStateDiffCheck, tryParallelExecution, } from "./control.js";
6
7
  import { handleCapabilityAcquisition } from "./capability.js";
7
8
  import { CoreLoopEvidenceLedger } from "./evidence-ledger.js";
8
9
  import { CorePhaseRuntime } from "./phase-runtime.js";
9
- import { buildKnowledgeRefreshSpec, buildObserveEvidenceSpec, buildReplanningOptionsSpec, buildStallInvestigationSpec, buildWaitObservationSpec, buildVerificationEvidenceSpec, } from "./phase-specs.js";
10
+ import { buildDreamReviewCheckpointSpec, buildKnowledgeRefreshSpec, buildObserveEvidenceSpec, buildPublicResearchSpec, buildReplanningOptionsSpec, buildStallInvestigationSpec, buildWaitObservationSpec, buildVerificationEvidenceSpec, } from "./phase-specs.js";
11
+ import { buildDeadlineFinalizationStatus, normalizeFinalizationPolicy, shouldStopExplorationForFinalization, } from "../../../platform/time/deadline-finalization.js";
12
+ import { deriveExecutionModeFromDeadlineStatus } from "../../../platform/time/execution-mode.js";
10
13
  import { findActiveWaitObservationInput } from "./iteration-kernel-wait.js";
11
14
  import { autoAcquireKnowledgeForDreamStall, autoAcquireKnowledgeForRefresh, } from "./iteration-kernel-knowledge.js";
15
+ import { buildDreamReviewCheckpointRequest, dreamCheckpointRawRefs, formatDreamRunControlRecommendationContext, normalizeDreamReviewCheckpoint, } from "./dream-review-checkpoint.js";
16
+ import { buildPublicResearchRequest, normalizePublicResearchMemo, publicResearchSummary, researchRawRefs, } from "./public-research.js";
17
+ import { RuntimeReproducibilityManifestStore } from "../../../runtime/store/reproducibility-manifest.js";
12
18
  export class CoreIterationKernel {
13
19
  deps;
14
20
  constructor(deps) {
@@ -51,16 +57,97 @@ export class CoreIterationKernel {
51
57
  const result = makeEmptyIterationResult(goalId, loopIndex);
52
58
  const activationContext = this.deps.getActivationContext();
53
59
  const evidenceLedger = new CoreLoopEvidenceLedger();
60
+ const runtimeEvidenceScope = {
61
+ goal_id: goalId,
62
+ ...(activationContext?.backgroundRun?.backgroundRunId
63
+ ? { run_id: activationContext.backgroundRun.backgroundRunId }
64
+ : {}),
65
+ loop_index: loopIndex,
66
+ };
67
+ const appendRuntimeEvidence = async (entry) => {
68
+ if (config.dryRun || !this.deps.deps.evidenceLedger)
69
+ return;
70
+ try {
71
+ await this.deps.deps.evidenceLedger.append({
72
+ ...entry,
73
+ scope: {
74
+ ...runtimeEvidenceScope,
75
+ ...entry.scope,
76
+ },
77
+ });
78
+ }
79
+ catch (err) {
80
+ this.deps.logger?.warn("CoreLoop: failed to append runtime evidence ledger entry", {
81
+ goalId,
82
+ loopIndex,
83
+ kind: entry.kind,
84
+ error: err instanceof Error ? err.message : String(err),
85
+ });
86
+ }
87
+ };
54
88
  const corePhaseRuntime = new CorePhaseRuntime({
55
89
  phaseRunner: this.deps.deps.corePhaseRunner,
56
90
  policyRegistry: this.deps.corePhasePolicyRegistry,
57
91
  });
92
+ let dreamReviewCheckpointRan = false;
58
93
  const rememberPhase = (execution) => {
59
94
  if (execution.status === "skipped")
60
95
  return;
61
96
  evidenceLedger.record(execution);
62
97
  result.corePhaseResults = evidenceLedger.toIterationPhaseResults();
63
98
  };
99
+ const maybeRunDreamReviewCheckpoint = async (input) => {
100
+ if (dreamReviewCheckpointRan)
101
+ return null;
102
+ const evidenceSummary = await loadDreamReviewEvidenceSummary(this.deps.deps.evidenceLedger, goalId);
103
+ const request = buildDreamReviewCheckpointRequest({
104
+ goal: input.goal,
105
+ loopIndex,
106
+ result,
107
+ driveScores: input.driveScores,
108
+ finalizationStatus: input.finalizationStatus,
109
+ executionMode: input.executionMode,
110
+ evidenceSummary,
111
+ recentCheckpoints: evidenceSummary?.dream_checkpoints,
112
+ ...(input.requestedTrigger ? { requestedTrigger: input.requestedTrigger } : {}),
113
+ });
114
+ if (!request)
115
+ return null;
116
+ const dreamReview = await runPhase("dream-review-checkpoint", () => corePhaseRuntime.run({
117
+ ...buildDreamReviewCheckpointSpec(),
118
+ requiredTools: ["soil_query"],
119
+ allowedTools: ["soil_query", "knowledge_query", "memory_recall"],
120
+ budget: {
121
+ maxModelTurns: 3,
122
+ maxToolCalls: 5,
123
+ maxWallClockMs: 45_000,
124
+ maxRepeatedToolCalls: 1,
125
+ },
126
+ }, {
127
+ goalTitle: input.goal.title,
128
+ trigger: request.trigger,
129
+ reason: request.reason,
130
+ activeDimensions: request.activeDimensions,
131
+ ...(request.bestEvidenceSummary ? { bestEvidenceSummary: request.bestEvidenceSummary } : {}),
132
+ recentStrategyFamilies: request.recentStrategyFamilies,
133
+ activeHypotheses: request.activeHypotheses,
134
+ rejectedApproaches: request.rejectedApproaches,
135
+ failedLineages: request.failedLineages,
136
+ ...(request.metricTrendSummary ? { metricTrendSummary: request.metricTrendSummary } : {}),
137
+ ...(request.finalizationReason ? { finalizationReason: request.finalizationReason } : {}),
138
+ ...(request.currentExecutionMode ? { currentExecutionMode: request.currentExecutionMode } : {}),
139
+ runControlPolicy: request.runControlPolicy,
140
+ memoryAuthorityPolicy: request.memoryAuthorityPolicy,
141
+ maxGuidanceItems: request.maxGuidanceItems,
142
+ }, { goalId, stallDetected: result.stallDetected, gapAggregate: input.gapAggregate }));
143
+ rememberPhase(dreamReview);
144
+ const checkpoint = await appendDreamReviewCheckpointEvidence(appendRuntimeEvidence, dreamReview, request, input.goal);
145
+ if (checkpoint?.run_control_recommendations.length) {
146
+ result.dreamRunControlRecommendations = checkpoint.run_control_recommendations;
147
+ }
148
+ dreamReviewCheckpointRan = dreamReview.status !== "skipped";
149
+ return checkpoint;
150
+ };
64
151
  this.deps.logger?.info(`[CoreLoop] iteration ${loopIndex + 1} starting`, { goalId, loopIndex });
65
152
  const loadedGoal = await runPhase("load-goal", () => loadGoalWithAggregation(ctx, goalId, result, startTime));
66
153
  if (!loadedGoal)
@@ -93,6 +180,7 @@ export class CoreIterationKernel {
93
180
  dimensions: goal.dimensions.map((dimension) => dimension.name),
94
181
  }, { goalId, gapAggregate: result.gapAggregate }));
95
182
  rememberPhase(observeEvidence);
183
+ await appendPhaseEvidence(appendRuntimeEvidence, observeEvidence, "observation");
96
184
  goal = await runPhase("observe", () => observeAndReload(ctx, goalId, goal, loopIndex));
97
185
  if (this.deps.stateDiff) {
98
186
  const { shouldSkip } = await runStateDiffCheck(this.deps.stateDiff, this.deps.stateDiffState, goalId, goal, loopIndex, config, this.deps.deps, result, startTime, this.deps.logger);
@@ -106,6 +194,53 @@ export class CoreIterationKernel {
106
194
  this.deps.logger?.info(`[iter ${loopIndex}] gap: ${gapAggregate.toFixed(2)} | ${(gapVector.gaps ?? [])
107
195
  .map((g) => `${g.dimension_name}=${g.normalized_weighted_gap.toFixed(2)}`)
108
196
  .join(", ")}`);
197
+ const finalizationStatus = await runPhase("deadline-finalization", async () => {
198
+ const bestArtifact = await loadBestFinalizationArtifact(this.deps.deps.evidenceLedger, goalId, normalizeFinalizationPolicy(goal.finalization_policy).best_artifact_selection);
199
+ const reproducibilityManifestId = await loadReadyFinalizationManifestId({
200
+ stateManager: this.deps.deps.stateManager,
201
+ goalId,
202
+ runId: runtimeEvidenceScope.run_id,
203
+ bestArtifact,
204
+ requireReproducibilityManifest: normalizeFinalizationPolicy(goal.finalization_policy).require_reproducibility_manifest,
205
+ });
206
+ return buildDeadlineFinalizationStatus({
207
+ goal,
208
+ bestArtifact,
209
+ reproducibilityManifestId,
210
+ });
211
+ });
212
+ result.finalizationStatus = finalizationStatus;
213
+ const executionMode = deriveExecutionModeFromDeadlineStatus(finalizationStatus);
214
+ result.executionMode = executionMode;
215
+ if (shouldStopExplorationForFinalization(finalizationStatus)) {
216
+ await maybeRunDreamReviewCheckpoint({
217
+ goal,
218
+ gapAggregate,
219
+ driveScores: [],
220
+ finalizationStatus,
221
+ executionMode,
222
+ requestedTrigger: "pre_finalization",
223
+ });
224
+ result.skipped = true;
225
+ result.skipReason =
226
+ finalizationStatus.mode === "missed_deadline"
227
+ ? "deadline_missed_finalization"
228
+ : "deadline_finalization";
229
+ await appendRuntimeEvidence({
230
+ kind: "decision",
231
+ summary: finalizationStatus.reason,
232
+ outcome: "blocked",
233
+ decision_reason: finalizationStatus.reason,
234
+ scope: { phase: "deadline_finalization" },
235
+ result: {
236
+ status: finalizationStatus.mode,
237
+ summary: finalizationStatus.finalization_plan?.deliverable_contract ?? finalizationStatus.reason,
238
+ },
239
+ });
240
+ await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
241
+ result.elapsedMs = Date.now() - startTime;
242
+ return result;
243
+ }
109
244
  const activeWait = await findActiveWaitObservationInput(this.deps.deps, goalId, goal.title, activationContext?.waitResume?.strategyId);
110
245
  if (activeWait) {
111
246
  const waitObservationPhase = await runPhase("wait-observation-agentic", () => corePhaseRuntime.run({
@@ -115,6 +250,7 @@ export class CoreIterationKernel {
115
250
  budget: {},
116
251
  }, activeWait, { goalId, gapAggregate }));
117
252
  rememberPhase(waitObservationPhase);
253
+ await appendPhaseEvidence(appendRuntimeEvidence, waitObservationPhase, "observation");
118
254
  }
119
255
  const waitObservationDecision = await runPhase("wait-observation", () => evaluateWaitStrategiesForObserveOnly(ctx, goalId, goal, result, activationContext?.waitResume?.strategyId));
120
256
  if (waitObservationDecision.observeOnly) {
@@ -158,6 +294,8 @@ export class CoreIterationKernel {
158
294
  : null;
159
295
  if (knowledgeRefresh)
160
296
  rememberPhase(knowledgeRefresh);
297
+ if (knowledgeRefresh)
298
+ await appendPhaseEvidence(appendRuntimeEvidence, knowledgeRefresh, "strategy");
161
299
  const replanningOptions = this.deps.coreDecisionEngine.shouldRunReplanningOptions({
162
300
  skipTaskGeneration: Boolean(skipTaskGeneration),
163
301
  taskCycleBlocked: false,
@@ -176,6 +314,8 @@ export class CoreIterationKernel {
176
314
  : null;
177
315
  if (replanningOptions)
178
316
  rememberPhase(replanningOptions);
317
+ if (replanningOptions)
318
+ await appendPhaseEvidence(appendRuntimeEvidence, replanningOptions, "strategy");
179
319
  await runPhase("completion-check", () => checkCompletionAndMilestones(ctx, goalId, goal, result, startTime));
180
320
  if (result.error)
181
321
  return result;
@@ -202,6 +342,8 @@ export class CoreIterationKernel {
202
342
  : null;
203
343
  if (stallInvestigation)
204
344
  rememberPhase(stallInvestigation);
345
+ if (stallInvestigation)
346
+ await appendPhaseEvidence(appendRuntimeEvidence, stallInvestigation, "failure");
205
347
  if (result.stallDetected && result.stallReport) {
206
348
  this.deps.logger?.warn(`[iter ${loopIndex}] stall detected: ${result.stallReport.stall_type}`, {
207
349
  escalation: result.stallReport.escalation_level,
@@ -217,6 +359,48 @@ export class CoreIterationKernel {
217
359
  },
218
360
  });
219
361
  }
362
+ const dreamCheckpoint = await maybeRunDreamReviewCheckpoint({
363
+ goal,
364
+ gapAggregate,
365
+ driveScores,
366
+ finalizationStatus,
367
+ executionMode,
368
+ });
369
+ const dreamRunControlRecommendationContext = formatDreamRunControlRecommendationContext(dreamCheckpoint?.run_control_recommendations);
370
+ const publicResearchRequest = buildPublicResearchRequest({
371
+ goal,
372
+ result,
373
+ gapAggregate,
374
+ driveScores,
375
+ knowledgeRefresh,
376
+ });
377
+ const publicResearch = publicResearchRequest
378
+ ? await runPhase("public-research", () => corePhaseRuntime.run({
379
+ ...buildPublicResearchSpec(),
380
+ requiredTools: ["research_answer_with_sources"],
381
+ allowedTools: ["research_web", "research_answer_with_sources"],
382
+ budget: {
383
+ maxModelTurns: 4,
384
+ maxToolCalls: 4,
385
+ maxWallClockMs: 60_000,
386
+ maxRepeatedToolCalls: 1,
387
+ },
388
+ }, {
389
+ goalTitle: goal.title,
390
+ trigger: publicResearchRequest.trigger,
391
+ question: publicResearchRequest.question,
392
+ targetDimensions: publicResearchRequest.targetDimensions,
393
+ sourcePreference: publicResearchRequest.sourcePreference,
394
+ maxSources: publicResearchRequest.maxSources,
395
+ sensitiveContextPolicy: publicResearchRequest.sensitiveContextPolicy,
396
+ untrustedContentPolicy: publicResearchRequest.untrustedContentPolicy,
397
+ }, { goalId, stallDetected: result.stallDetected, gapAggregate }))
398
+ : null;
399
+ if (publicResearch)
400
+ rememberPhase(publicResearch);
401
+ if (publicResearch && publicResearchRequest) {
402
+ await appendPublicResearchEvidence(appendRuntimeEvidence, publicResearch, publicResearchRequest);
403
+ }
220
404
  const knowledgeAcquisitionDecision = this.deps.coreDecisionEngine.evaluateKnowledgeAcquisition({
221
405
  phase: knowledgeRefresh,
222
406
  hasKnowledgeManager: !!this.deps.deps.knowledgeManager,
@@ -235,6 +419,7 @@ export class CoreIterationKernel {
235
419
  goalDimensions: goal.dimensions.map((dimension) => dimension.name),
236
420
  fallbackFocusDimension: driveScores[0]?.dimension_name ?? pendingDirective?.focusDimension,
237
421
  });
422
+ await appendDecisionEvidence(appendRuntimeEvidence, result.nextIterationDirective, "knowledge_refresh_auto_acquire");
238
423
  this.deps.logger?.info("CoreLoop: knowledge_refresh auto-acquired knowledge and skipped execution", {
239
424
  goalId,
240
425
  acquiredCount,
@@ -279,6 +464,7 @@ export class CoreIterationKernel {
279
464
  goalDimensions: goal.dimensions.map((dimension) => dimension.name),
280
465
  fallbackFocusDimension: driveScores[0]?.dimension_name ?? pendingDirective?.focusDimension,
281
466
  });
467
+ await appendDecisionEvidence(appendRuntimeEvidence, result.nextIterationDirective, "skip_task_generation");
282
468
  await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
283
469
  result.elapsedMs = Date.now() - startTime;
284
470
  return result;
@@ -295,9 +481,20 @@ export class CoreIterationKernel {
295
481
  phase: replanningOptions,
296
482
  goalDimensions: goal.dimensions.map((dimension) => dimension.name),
297
483
  });
484
+ const runtimeBudgetContext = await this.deps.getRuntimeBudgetContext?.().catch((err) => {
485
+ this.deps.logger?.warn("CoreLoop: failed to load runtime budget context", {
486
+ goalId,
487
+ loopIndex,
488
+ error: err instanceof Error ? err.message : String(err),
489
+ });
490
+ return undefined;
491
+ });
298
492
  const mergedTaskGenerationHints = {
299
493
  targetDimensionOverride: taskGenerationHints.targetDimensionOverride ?? pendingDirective?.focusDimension,
300
494
  knowledgeContextPrefix: taskGenerationHints.knowledgeContextPrefix,
495
+ budgetContext: runtimeBudgetContext,
496
+ executionMode,
497
+ runControlRecommendationContext: dreamRunControlRecommendationContext,
301
498
  };
302
499
  if (!shouldPreferReplanningContext && replanningOptions?.status === "completed") {
303
500
  this.deps.logger?.debug("CoreLoop: replanning evidence collected but not adopted as preferred context", {
@@ -314,6 +511,9 @@ export class CoreIterationKernel {
314
511
  if (!taskCycleOk)
315
512
  return result;
316
513
  const completedTaskResult = result.taskResult;
514
+ if (completedTaskResult) {
515
+ await appendTaskCycleEvidence(appendRuntimeEvidence, completedTaskResult);
516
+ }
317
517
  if (this.deps.coreDecisionEngine.shouldRunVerificationEvidence(result) && completedTaskResult) {
318
518
  const verificationPhase = await runPhase("verification-evidence", () => corePhaseRuntime.run({
319
519
  ...buildVerificationEvidenceSpec(),
@@ -329,6 +529,9 @@ export class CoreIterationKernel {
329
529
  hasTaskResult: true,
330
530
  }));
331
531
  rememberPhase(verificationPhase);
532
+ await appendPhaseEvidence(appendRuntimeEvidence, verificationPhase, "verification", {
533
+ task_id: completedTaskResult.task.id,
534
+ });
332
535
  }
333
536
  result.nextIterationDirective = this.deps.coreDecisionEngine.buildNextIterationDirective({
334
537
  knowledgeRefreshPhase: knowledgeRefresh,
@@ -336,9 +539,297 @@ export class CoreIterationKernel {
336
539
  goalDimensions: goal.dimensions.map((dimension) => dimension.name),
337
540
  fallbackFocusDimension: driveScores[0]?.dimension_name ?? pendingDirective?.focusDimension,
338
541
  });
542
+ await appendDecisionEvidence(appendRuntimeEvidence, result.nextIterationDirective, "next_iteration_directive");
339
543
  await generateLoopReport(goalId, loopIndex, result, goal, this.deps.deps.reportingEngine, this.deps.logger);
340
544
  result.elapsedMs = Date.now() - startTime;
341
545
  return result;
342
546
  }
343
547
  }
548
+ async function appendPublicResearchEvidence(appendRuntimeEvidence, execution, request) {
549
+ if (execution.status === "skipped")
550
+ return;
551
+ const output = buildPublicResearchSpec().outputSchema.safeParse(execution.output);
552
+ if (!output.success) {
553
+ await appendRuntimeEvidence({
554
+ kind: "research",
555
+ scope: { phase: execution.phase },
556
+ summary: execution.summary ?? request.reason,
557
+ outcome: "inconclusive",
558
+ result: {
559
+ status: execution.status,
560
+ summary: request.reason,
561
+ error: output.error.issues.map((issue) => issue.message).join("; "),
562
+ },
563
+ });
564
+ return;
565
+ }
566
+ const memo = normalizePublicResearchMemo(output.data, request);
567
+ await appendRuntimeEvidence({
568
+ kind: "research",
569
+ scope: { phase: execution.phase },
570
+ summary: publicResearchSummary(memo),
571
+ outcome: phaseStatusToOutcome(execution.status),
572
+ research: [memo],
573
+ result: {
574
+ status: execution.status,
575
+ summary: memo.summary,
576
+ ...(execution.error ? { error: execution.error } : {}),
577
+ },
578
+ raw_refs: [
579
+ ...researchRawRefs(memo),
580
+ ...(execution.traceId ? [{ kind: "agentloop_trace", id: execution.traceId }] : []),
581
+ ...(execution.sessionId ? [{ kind: "agentloop_state", id: execution.sessionId }] : []),
582
+ ...(execution.turnId ? [{ kind: "agentloop_turn", id: execution.turnId }] : []),
583
+ ],
584
+ });
585
+ }
586
+ async function appendDreamReviewCheckpointEvidence(appendRuntimeEvidence, execution, request, goal) {
587
+ if (execution.status === "skipped")
588
+ return null;
589
+ const output = buildDreamReviewCheckpointSpec().outputSchema.safeParse(execution.output);
590
+ if (!output.success) {
591
+ await appendRuntimeEvidence({
592
+ kind: "dream_checkpoint",
593
+ scope: { phase: execution.phase },
594
+ summary: execution.summary ?? request.reason,
595
+ outcome: "inconclusive",
596
+ result: {
597
+ status: execution.status,
598
+ summary: request.reason,
599
+ error: output.error.issues.map((issue) => issue.message).join("; "),
600
+ },
601
+ });
602
+ return null;
603
+ }
604
+ const checkpoint = normalizeDreamReviewCheckpoint(output.data, request, goal);
605
+ await appendRuntimeEvidence({
606
+ kind: "dream_checkpoint",
607
+ scope: { phase: execution.phase },
608
+ summary: checkpoint.summary,
609
+ outcome: phaseStatusToOutcome(execution.status),
610
+ dream_checkpoints: [checkpoint],
611
+ result: {
612
+ status: execution.status,
613
+ summary: checkpoint.guidance,
614
+ ...(execution.error ? { error: execution.error } : {}),
615
+ },
616
+ raw_refs: [
617
+ ...dreamCheckpointRawRefs(checkpoint),
618
+ ...(execution.traceId ? [{ kind: "agentloop_trace", id: execution.traceId }] : []),
619
+ ...(execution.sessionId ? [{ kind: "agentloop_state", id: execution.sessionId }] : []),
620
+ ...(execution.turnId ? [{ kind: "agentloop_turn", id: execution.turnId }] : []),
621
+ ],
622
+ });
623
+ return checkpoint;
624
+ }
625
+ async function loadDreamReviewEvidenceSummary(evidenceLedger, goalId) {
626
+ if (!evidenceLedger?.summarizeGoal)
627
+ return null;
628
+ try {
629
+ return await evidenceLedger.summarizeGoal(goalId);
630
+ }
631
+ catch {
632
+ return null;
633
+ }
634
+ }
635
+ async function loadBestFinalizationArtifact(evidenceLedger, goalId, selection) {
636
+ if (!evidenceLedger)
637
+ return null;
638
+ try {
639
+ if (selection === "best_evidence") {
640
+ const summary = await evidenceLedger.summarizeGoal?.(goalId);
641
+ return summary?.best_evidence ? bestArtifactFromEvidence(summary.best_evidence) : null;
642
+ }
643
+ const entries = evidenceLedger.readByGoal
644
+ ? (await evidenceLedger.readByGoal(goalId)).entries
645
+ : (await evidenceLedger.summarizeGoal?.(goalId))?.recent_entries ?? [];
646
+ const newestFirst = [...entries].sort((a, b) => b.occurred_at.localeCompare(a.occurred_at));
647
+ const selected = selection === "latest_artifact"
648
+ ? newestFirst.find((entry) => entry.artifacts.length > 0 || entry.kind === "artifact")
649
+ : selectLatestVerifiedArtifact(newestFirst);
650
+ return selected ? bestArtifactFromEvidence(selected) : null;
651
+ }
652
+ catch {
653
+ return null;
654
+ }
655
+ }
656
+ async function loadReadyFinalizationManifestId(input) {
657
+ if (!input.requireReproducibilityManifest)
658
+ return null;
659
+ if (!input.bestArtifact)
660
+ return null;
661
+ try {
662
+ const store = new RuntimeReproducibilityManifestStore(path.join(input.stateManager.getBaseDir(), "runtime"));
663
+ const manifest = await store.findReadyForFinalization({
664
+ goalId: input.goalId,
665
+ runId: input.runId,
666
+ deliverable: input.bestArtifact
667
+ ? {
668
+ ...(input.bestArtifact.id ? { id: input.bestArtifact.id } : {}),
669
+ label: input.bestArtifact.label,
670
+ ...(input.bestArtifact.path ? { path: input.bestArtifact.path } : {}),
671
+ ...(input.bestArtifact.state_relative_path ? { state_relative_path: input.bestArtifact.state_relative_path } : {}),
672
+ ...(input.bestArtifact.url ? { url: input.bestArtifact.url } : {}),
673
+ }
674
+ : null,
675
+ });
676
+ return manifest?.manifest_id ?? null;
677
+ }
678
+ catch {
679
+ return null;
680
+ }
681
+ }
682
+ function selectLatestVerifiedArtifact(entriesNewestFirst) {
683
+ for (const verification of entriesNewestFirst) {
684
+ const verified = verification.verification?.verdict === "pass"
685
+ || (verification.kind === "verification" && verification.outcome === "improved");
686
+ if (!verified)
687
+ continue;
688
+ if (verification.artifacts.length > 0)
689
+ return verification;
690
+ const taskId = verification.scope.task_id;
691
+ if (!taskId)
692
+ continue;
693
+ const matchedArtifact = entriesNewestFirst.find((entry) => entry.scope.task_id === taskId
694
+ && entry.occurred_at <= verification.occurred_at
695
+ && entry.artifacts.length > 0);
696
+ if (matchedArtifact)
697
+ return matchedArtifact;
698
+ }
699
+ return undefined;
700
+ }
701
+ function bestArtifactFromEvidence(entry) {
702
+ const primaryArtifact = entry.artifacts[0];
703
+ return {
704
+ id: primaryArtifact?.label ?? entry.id,
705
+ label: primaryArtifact?.label ?? entry.summary ?? entry.result?.summary ?? entry.id,
706
+ kind: primaryArtifact?.kind ?? entry.kind,
707
+ summary: entry.summary ?? entry.result?.summary ?? entry.verification?.summary,
708
+ path: primaryArtifact?.path,
709
+ state_relative_path: primaryArtifact?.state_relative_path,
710
+ url: primaryArtifact?.url,
711
+ occurred_at: entry.occurred_at,
712
+ source: "runtime_evidence_ledger",
713
+ };
714
+ }
715
+ async function appendPhaseEvidence(appendRuntimeEvidence, execution, kind, scope) {
716
+ if (execution.status === "skipped")
717
+ return;
718
+ await appendRuntimeEvidence({
719
+ kind,
720
+ scope: { ...scope, phase: execution.phase },
721
+ summary: execution.summary ?? `${execution.phase} ${execution.status}`,
722
+ outcome: phaseStatusToOutcome(execution.status),
723
+ result: {
724
+ status: execution.status,
725
+ ...(execution.error ? { error: execution.error } : {}),
726
+ ...(execution.summary ? { summary: execution.summary } : {}),
727
+ },
728
+ raw_refs: [
729
+ ...(execution.traceId ? [{ kind: "agentloop_trace", id: execution.traceId }] : []),
730
+ ...(execution.sessionId ? [{ kind: "agentloop_state", id: execution.sessionId }] : []),
731
+ ...(execution.turnId ? [{ kind: "agentloop_turn", id: execution.turnId }] : []),
732
+ ],
733
+ });
734
+ }
735
+ async function appendDecisionEvidence(appendRuntimeEvidence, directive, fallbackReason) {
736
+ if (!directive)
737
+ return;
738
+ await appendRuntimeEvidence({
739
+ kind: "decision",
740
+ summary: directive.reason,
741
+ strategy: directive.preferredAction,
742
+ outcome: "continued",
743
+ decision_reason: directive.reason,
744
+ scope: { phase: directive.sourcePhase },
745
+ result: {
746
+ status: fallbackReason,
747
+ summary: directive.reason,
748
+ },
749
+ });
750
+ }
751
+ async function appendTaskCycleEvidence(appendRuntimeEvidence, taskResult) {
752
+ const task = taskResult.task;
753
+ await appendRuntimeEvidence({
754
+ kind: "task_generation",
755
+ scope: { task_id: task.id },
756
+ hypothesis: task.rationale,
757
+ strategy: task.approach,
758
+ task: {
759
+ id: task.id,
760
+ description: task.work_description,
761
+ primary_dimension: task.primary_dimension,
762
+ },
763
+ summary: task.work_description,
764
+ outcome: "continued",
765
+ decision_reason: task.rationale,
766
+ });
767
+ await appendRuntimeEvidence({
768
+ kind: taskResult.action === "completed" ? "execution" : "failure",
769
+ scope: { task_id: task.id },
770
+ task: {
771
+ id: task.id,
772
+ description: task.work_description,
773
+ action: taskResult.action,
774
+ primary_dimension: task.primary_dimension,
775
+ },
776
+ artifacts: taskResult.verificationResult.file_diffs?.map((diff) => ({
777
+ label: diff.path,
778
+ path: diff.path,
779
+ kind: "diff",
780
+ })) ?? [],
781
+ result: {
782
+ status: taskResult.action,
783
+ ...(task.execution_output ? { summary: truncateOneLine(task.execution_output, 500) } : {}),
784
+ },
785
+ outcome: taskActionToOutcome(taskResult.action),
786
+ summary: `Task ${task.id} ${taskResult.action}`,
787
+ });
788
+ await appendRuntimeEvidence({
789
+ kind: taskResult.verificationResult.verdict === "pass" ? "verification" : "failure",
790
+ scope: { task_id: task.id },
791
+ verification: {
792
+ verdict: taskResult.verificationResult.verdict,
793
+ confidence: taskResult.verificationResult.confidence,
794
+ summary: summarizeVerificationEvidence(taskResult.verificationResult.evidence),
795
+ },
796
+ result: {
797
+ status: taskResult.verificationResult.verdict,
798
+ summary: summarizeVerificationEvidence(taskResult.verificationResult.evidence),
799
+ },
800
+ outcome: verificationToOutcome(taskResult.verificationResult.verdict),
801
+ summary: `Verification ${taskResult.verificationResult.verdict} for ${task.id}`,
802
+ });
803
+ }
804
+ function phaseStatusToOutcome(status) {
805
+ if (status === "completed")
806
+ return "continued";
807
+ if (status === "failed")
808
+ return "failed";
809
+ return "inconclusive";
810
+ }
811
+ function taskActionToOutcome(action) {
812
+ if (action === "completed")
813
+ return "improved";
814
+ if (action === "approval_denied" || action === "capability_acquiring")
815
+ return "blocked";
816
+ if (action === "discard" || action === "escalate")
817
+ return "failed";
818
+ return "inconclusive";
819
+ }
820
+ function verificationToOutcome(verdict) {
821
+ if (verdict === "pass")
822
+ return "improved";
823
+ if (verdict === "fail")
824
+ return "failed";
825
+ return "inconclusive";
826
+ }
827
+ function summarizeVerificationEvidence(evidence) {
828
+ const summary = evidence.map((item) => item.description).filter(Boolean).join("; ");
829
+ return summary ? truncateOneLine(summary, 500) : undefined;
830
+ }
831
+ function truncateOneLine(value, maxLength) {
832
+ const normalized = value.replace(/\s+/g, " ").trim();
833
+ return normalized.length > maxLength ? `${normalized.slice(0, maxLength - 3)}...` : normalized;
834
+ }
344
835
  //# sourceMappingURL=iteration-kernel.js.map