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.
- package/README.md +13 -9
- package/dist/adapters/datasources/artifact-metric-datasource.d.ts +18 -0
- package/dist/adapters/datasources/artifact-metric-datasource.d.ts.map +1 -0
- package/dist/adapters/datasources/artifact-metric-datasource.js +592 -0
- package/dist/adapters/datasources/artifact-metric-datasource.js.map +1 -0
- package/dist/adapters/types/mcp.d.ts +6 -6
- package/dist/base/types/goal-activation.d.ts +14 -2
- package/dist/base/types/goal-activation.d.ts.map +1 -1
- package/dist/base/types/goal-activation.js +4 -0
- package/dist/base/types/goal-activation.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/chat/chat-runner-commands.d.ts +6 -0
- package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-commands.js +94 -2
- package/dist/interface/chat/chat-runner-commands.js.map +1 -1
- package/dist/interface/chat/chat-runner-event-bridge.d.ts +8 -1
- package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-event-bridge.js +69 -3
- package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -1
- package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-routes.js +23 -7
- package/dist/interface/chat/chat-runner-routes.js.map +1 -1
- package/dist/interface/chat/chat-runner-support.d.ts +25 -1
- package/dist/interface/chat/chat-runner-support.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner-support.js +66 -12
- package/dist/interface/chat/chat-runner-support.js.map +1 -1
- package/dist/interface/chat/chat-runner.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner.js +38 -8
- package/dist/interface/chat/chat-runner.js.map +1 -1
- package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
- package/dist/interface/chat/cross-platform-session.js +13 -1
- package/dist/interface/chat/cross-platform-session.js.map +1 -1
- package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
- package/dist/interface/chat/event-subscriber.js +20 -0
- package/dist/interface/chat/event-subscriber.js.map +1 -1
- package/dist/interface/chat/failure-recovery.d.ts +43 -1
- package/dist/interface/chat/failure-recovery.d.ts.map +1 -1
- package/dist/interface/chat/failure-recovery.js +259 -89
- package/dist/interface/chat/failure-recovery.js.map +1 -1
- package/dist/interface/chat/ingress-router.d.ts +2 -1
- package/dist/interface/chat/ingress-router.d.ts.map +1 -1
- package/dist/interface/chat/ingress-router.js +2 -3
- package/dist/interface/chat/ingress-router.js.map +1 -1
- package/dist/interface/chat/tend-command.js +1 -0
- package/dist/interface/chat/tend-command.js.map +1 -1
- package/dist/interface/cli/cli-command-registry.d.ts.map +1 -1
- package/dist/interface/cli/cli-command-registry.js +19 -3
- package/dist/interface/cli/cli-command-registry.js.map +1 -1
- package/dist/interface/cli/commands/daemon-shared.d.ts +2 -1
- package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon-shared.js +33 -1
- package/dist/interface/cli/commands/daemon-shared.js.map +1 -1
- package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon.js +59 -8
- package/dist/interface/cli/commands/daemon.js.map +1 -1
- package/dist/interface/cli/commands/goal-read.d.ts.map +1 -1
- package/dist/interface/cli/commands/goal-read.js +10 -3
- package/dist/interface/cli/commands/goal-read.js.map +1 -1
- package/dist/interface/cli/commands/notify.d.ts.map +1 -1
- package/dist/interface/cli/commands/notify.js +7 -1
- package/dist/interface/cli/commands/notify.js.map +1 -1
- package/dist/interface/cli/commands/run.d.ts.map +1 -1
- package/dist/interface/cli/commands/run.js +29 -0
- package/dist/interface/cli/commands/run.js.map +1 -1
- package/dist/interface/cli/commands/runtime.d.ts +1 -1
- package/dist/interface/cli/commands/runtime.d.ts.map +1 -1
- package/dist/interface/cli/commands/runtime.js +407 -2
- package/dist/interface/cli/commands/runtime.js.map +1 -1
- package/dist/interface/cli/data-source-bootstrap.d.ts.map +1 -1
- package/dist/interface/cli/data-source-bootstrap.js +25 -12
- package/dist/interface/cli/data-source-bootstrap.js.map +1 -1
- package/dist/interface/cli/setup.d.ts.map +1 -1
- package/dist/interface/cli/setup.js +14 -0
- package/dist/interface/cli/setup.js.map +1 -1
- package/dist/interface/cli/utils/loop-runner.d.ts.map +1 -1
- package/dist/interface/cli/utils/loop-runner.js +2 -1
- package/dist/interface/cli/utils/loop-runner.js.map +1 -1
- package/dist/interface/cli/utils.d.ts.map +1 -1
- package/dist/interface/cli/utils.js +8 -1
- package/dist/interface/cli/utils.js.map +1 -1
- package/dist/interface/tui/app.d.ts +4 -1
- package/dist/interface/tui/app.d.ts.map +1 -1
- package/dist/interface/tui/app.js +268 -10
- package/dist/interface/tui/app.js.map +1 -1
- package/dist/interface/tui/chat-surface.d.ts +2 -0
- package/dist/interface/tui/chat-surface.d.ts.map +1 -1
- package/dist/interface/tui/chat-surface.js +3 -0
- package/dist/interface/tui/chat-surface.js.map +1 -1
- package/dist/interface/tui/dashboard.d.ts +37 -1
- package/dist/interface/tui/dashboard.d.ts.map +1 -1
- package/dist/interface/tui/dashboard.js +264 -1
- package/dist/interface/tui/dashboard.js.map +1 -1
- package/dist/interface/tui/entry-deps.d.ts +3 -1
- package/dist/interface/tui/entry-deps.d.ts.map +1 -1
- package/dist/interface/tui/entry-deps.js +19 -1
- package/dist/interface/tui/entry-deps.js.map +1 -1
- package/dist/interface/tui/entry.d.ts.map +1 -1
- package/dist/interface/tui/entry.js +4 -2
- package/dist/interface/tui/entry.js.map +1 -1
- package/dist/interface/tui/intent-recognizer.d.ts +8 -3
- package/dist/interface/tui/intent-recognizer.d.ts.map +1 -1
- package/dist/interface/tui/intent-recognizer.js +74 -68
- package/dist/interface/tui/intent-recognizer.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js +41 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -1
- package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +1 -1
- package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js +3 -2
- package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts +1 -1
- package/dist/orchestrator/execution/agent-loop/core-phase-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/core-phase-runner.js +10 -1
- package/dist/orchestrator/execution/agent-loop/core-phase-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts +2 -0
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js +4 -0
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/task-agent-loop-result.d.ts +8 -8
- package/dist/orchestrator/execution/task/task-generation.d.ts +3 -1
- package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-generation.js +17 -2
- package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +5 -1
- package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle-runner.js +9 -5
- package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts +10 -1
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.js +108 -7
- package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
- package/dist/orchestrator/execution/task/task-prompt-builder.d.ts +2 -1
- package/dist/orchestrator/execution/task/task-prompt-builder.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-prompt-builder.js +4 -2
- package/dist/orchestrator/execution/task/task-prompt-builder.js.map +1 -1
- package/dist/orchestrator/execution/types/pipeline.d.ts +6 -6
- package/dist/orchestrator/goal/types/goal.d.ts +282 -0
- package/dist/orchestrator/goal/types/goal.d.ts.map +1 -1
- package/dist/orchestrator/goal/types/goal.js +20 -0
- package/dist/orchestrator/goal/types/goal.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/contracts.d.ts +46 -3
- package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/decision-engine.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/decision-engine.js +4 -0
- package/dist/orchestrator/loop/core-loop/decision-engine.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts +48 -0
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js +377 -0
- package/dist/orchestrator/loop/core-loop/dream-review-checkpoint.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/evidence-ledger.js +1 -1
- package/dist/orchestrator/loop/core-loop/evidence-ledger.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +1 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/iteration-kernel.js +492 -1
- package/dist/orchestrator/loop/core-loop/iteration-kernel.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-policy.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-policy.js +35 -0
- package/dist/orchestrator/loop/core-loop/phase-policy.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts +2 -0
- package/dist/orchestrator/loop/core-loop/phase-runtime.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-runtime.js +43 -2
- package/dist/orchestrator/loop/core-loop/phase-runtime.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-specs.d.ts +969 -2
- package/dist/orchestrator/loop/core-loop/phase-specs.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-specs.js +198 -0
- package/dist/orchestrator/loop/core-loop/phase-specs.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/public-research.d.ts +32 -0
- package/dist/orchestrator/loop/core-loop/public-research.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/public-research.js +112 -0
- package/dist/orchestrator/loop/core-loop/public-research.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +141 -5
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +4 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle.js +7 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
- package/dist/orchestrator/loop/core-loop.d.ts +15 -5
- package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop.js +283 -17
- package/dist/orchestrator/loop/core-loop.js.map +1 -1
- package/dist/orchestrator/loop/loop-report-helper.d.ts.map +1 -1
- package/dist/orchestrator/loop/loop-report-helper.js +4 -0
- package/dist/orchestrator/loop/loop-report-helper.js.map +1 -1
- package/dist/orchestrator/loop/loop-result-types.d.ts +20 -1
- package/dist/orchestrator/loop/loop-result-types.d.ts.map +1 -1
- package/dist/orchestrator/loop/loop-result-types.js.map +1 -1
- package/dist/orchestrator/loop/post-loop-hooks.d.ts +1 -0
- package/dist/orchestrator/loop/post-loop-hooks.d.ts.map +1 -1
- package/dist/orchestrator/loop/post-loop-hooks.js +34 -1
- package/dist/orchestrator/loop/post-loop-hooks.js.map +1 -1
- package/dist/orchestrator/loop/run-policy.d.ts +10 -0
- package/dist/orchestrator/loop/run-policy.d.ts.map +1 -0
- package/dist/orchestrator/loop/run-policy.js +30 -0
- package/dist/orchestrator/loop/run-policy.js.map +1 -0
- package/dist/orchestrator/strategy/divergent-exploration.d.ts +37 -0
- package/dist/orchestrator/strategy/divergent-exploration.d.ts.map +1 -0
- package/dist/orchestrator/strategy/divergent-exploration.js +324 -0
- package/dist/orchestrator/strategy/divergent-exploration.js.map +1 -0
- package/dist/orchestrator/strategy/strategy-helpers.d.ts +108 -0
- package/dist/orchestrator/strategy/strategy-helpers.d.ts.map +1 -1
- package/dist/orchestrator/strategy/strategy-helpers.js +34 -2
- package/dist/orchestrator/strategy/strategy-helpers.js.map +1 -1
- package/dist/orchestrator/strategy/strategy-manager-base.d.ts +20 -1
- package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
- package/dist/orchestrator/strategy/strategy-manager-base.js +71 -6
- package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
- package/dist/orchestrator/strategy/types/cross-portfolio.d.ts +2 -2
- package/dist/orchestrator/strategy/types/strategy.d.ts +364 -0
- package/dist/orchestrator/strategy/types/strategy.d.ts.map +1 -1
- package/dist/orchestrator/strategy/types/strategy.js +43 -0
- package/dist/orchestrator/strategy/types/strategy.js.map +1 -1
- package/dist/platform/dream/dream-activation.d.ts +1 -1
- package/dist/platform/dream/dream-event-workflows.d.ts +6 -6
- package/dist/platform/dream/dream-types.d.ts +91 -91
- package/dist/platform/drive/metric-history.d.ts +61 -0
- package/dist/platform/drive/metric-history.d.ts.map +1 -0
- package/dist/platform/drive/metric-history.js +206 -0
- package/dist/platform/drive/metric-history.js.map +1 -0
- package/dist/platform/drive/progress-predictor.d.ts +7 -0
- package/dist/platform/drive/progress-predictor.d.ts.map +1 -1
- package/dist/platform/drive/progress-predictor.js +23 -0
- package/dist/platform/drive/progress-predictor.js.map +1 -1
- package/dist/platform/drive/stall-detector.d.ts +3 -1
- package/dist/platform/drive/stall-detector.d.ts.map +1 -1
- package/dist/platform/drive/stall-detector.js +40 -1
- package/dist/platform/drive/stall-detector.js.map +1 -1
- package/dist/platform/drive/types/satisficing.d.ts +2 -2
- package/dist/platform/drive/types/stall.d.ts +4 -0
- package/dist/platform/drive/types/stall.d.ts.map +1 -1
- package/dist/platform/drive/types/stall.js +1 -0
- package/dist/platform/drive/types/stall.js.map +1 -1
- package/dist/platform/knowledge/types/learning.d.ts +2 -2
- package/dist/platform/observation/data-source-adapter.d.ts +1 -0
- package/dist/platform/observation/data-source-adapter.d.ts.map +1 -1
- package/dist/platform/observation/data-source-adapter.js.map +1 -1
- package/dist/platform/observation/observation-datasource.d.ts.map +1 -1
- package/dist/platform/observation/observation-datasource.js +2 -0
- package/dist/platform/observation/observation-datasource.js.map +1 -1
- package/dist/platform/observation/types/data-source.d.ts +153 -9
- package/dist/platform/observation/types/data-source.d.ts.map +1 -1
- package/dist/platform/observation/types/data-source.js +13 -1
- package/dist/platform/observation/types/data-source.js.map +1 -1
- package/dist/platform/soil/contracts.d.ts +65 -65
- package/dist/platform/soil/importer.d.ts +6 -6
- package/dist/platform/soil/types.d.ts +8 -8
- package/dist/platform/time/deadline-finalization.d.ts +57 -0
- package/dist/platform/time/deadline-finalization.d.ts.map +1 -0
- package/dist/platform/time/deadline-finalization.js +136 -0
- package/dist/platform/time/deadline-finalization.js.map +1 -0
- package/dist/platform/time/execution-mode.d.ts +29 -0
- package/dist/platform/time/execution-mode.d.ts.map +1 -0
- package/dist/platform/time/execution-mode.js +84 -0
- package/dist/platform/time/execution-mode.js.map +1 -0
- package/dist/platform/traits/types/curiosity.d.ts +9 -9
- package/dist/platform/traits/types/guardrail.d.ts +6 -6
- package/dist/reporting/report-formatters.d.ts.map +1 -1
- package/dist/reporting/report-formatters.js +67 -2
- package/dist/reporting/report-formatters.js.map +1 -1
- package/dist/reporting/reporting-engine.d.ts.map +1 -1
- package/dist/reporting/reporting-engine.js +3 -1
- package/dist/reporting/reporting-engine.js.map +1 -1
- package/dist/reporting/reporting-types.d.ts +4 -0
- package/dist/reporting/reporting-types.d.ts.map +1 -1
- package/dist/reporting/types/report.d.ts +59 -0
- package/dist/reporting/types/report.d.ts.map +1 -1
- package/dist/reporting/types/report.js +9 -0
- package/dist/reporting/types/report.js.map +1 -1
- package/dist/runtime/command-dispatcher.d.ts +2 -0
- package/dist/runtime/command-dispatcher.d.ts.map +1 -1
- package/dist/runtime/command-dispatcher.js +16 -0
- package/dist/runtime/command-dispatcher.js.map +1 -1
- package/dist/runtime/confirmation-decision.d.ts +94 -0
- package/dist/runtime/confirmation-decision.d.ts.map +1 -0
- package/dist/runtime/confirmation-decision.js +109 -0
- package/dist/runtime/confirmation-decision.js.map +1 -0
- package/dist/runtime/control/daemon-runtime-control-executor.d.ts.map +1 -1
- package/dist/runtime/control/daemon-runtime-control-executor.js +31 -1
- package/dist/runtime/control/daemon-runtime-control-executor.js.map +1 -1
- package/dist/runtime/control/runtime-control-intent.d.ts +9 -1
- package/dist/runtime/control/runtime-control-intent.d.ts.map +1 -1
- package/dist/runtime/control/runtime-control-intent.js +82 -16
- package/dist/runtime/control/runtime-control-intent.js.map +1 -1
- package/dist/runtime/control/runtime-control-service.d.ts +35 -1
- package/dist/runtime/control/runtime-control-service.d.ts.map +1 -1
- package/dist/runtime/control/runtime-control-service.js +285 -5
- package/dist/runtime/control/runtime-control-service.js.map +1 -1
- package/dist/runtime/daemon/client.d.ts +12 -0
- package/dist/runtime/daemon/client.d.ts.map +1 -1
- package/dist/runtime/daemon/client.js +9 -0
- package/dist/runtime/daemon/client.js.map +1 -1
- package/dist/runtime/daemon/runner-commands.d.ts +6 -2
- package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-commands.js +237 -1
- package/dist/runtime/daemon/runner-commands.js.map +1 -1
- package/dist/runtime/daemon/runner-goal-cycle.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-goal-cycle.js +59 -1
- package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
- package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-startup.js +12 -2
- package/dist/runtime/daemon/runner-startup.js.map +1 -1
- package/dist/runtime/daemon/runner.d.ts +4 -0
- package/dist/runtime/daemon/runner.d.ts.map +1 -1
- package/dist/runtime/daemon/runner.js +14 -1
- package/dist/runtime/daemon/runner.js.map +1 -1
- package/dist/runtime/daemon/runtime-ownership.d.ts +9 -0
- package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -1
- package/dist/runtime/daemon/runtime-ownership.js +248 -1
- package/dist/runtime/daemon/runtime-ownership.js.map +1 -1
- package/dist/runtime/dream-sidecar-review.d.ts +92 -0
- package/dist/runtime/dream-sidecar-review.d.ts.map +1 -0
- package/dist/runtime/dream-sidecar-review.js +495 -0
- package/dist/runtime/dream-sidecar-review.js.map +1 -0
- package/dist/runtime/event/server-command-handler.d.ts +2 -4
- package/dist/runtime/event/server-command-handler.d.ts.map +1 -1
- package/dist/runtime/event/server-command-handler.js +36 -6
- package/dist/runtime/event/server-command-handler.js.map +1 -1
- package/dist/runtime/event/server-snapshot-reader.d.ts +15 -1
- package/dist/runtime/event/server-snapshot-reader.d.ts.map +1 -1
- package/dist/runtime/event/server-snapshot-reader.js +66 -2
- package/dist/runtime/event/server-snapshot-reader.js.map +1 -1
- package/dist/runtime/event/server-types.d.ts +7 -0
- package/dist/runtime/event/server-types.d.ts.map +1 -1
- package/dist/runtime/event/server.d.ts +5 -0
- package/dist/runtime/event/server.d.ts.map +1 -1
- package/dist/runtime/event/server.js +43 -11
- package/dist/runtime/event/server.js.map +1 -1
- package/dist/runtime/evidence-answer.d.ts +41 -0
- package/dist/runtime/evidence-answer.d.ts.map +1 -0
- package/dist/runtime/evidence-answer.js +366 -0
- package/dist/runtime/evidence-answer.js.map +1 -0
- package/dist/runtime/executor/goal-worker.d.ts +4 -1
- package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
- package/dist/runtime/executor/goal-worker.js +5 -1
- package/dist/runtime/executor/goal-worker.js.map +1 -1
- package/dist/runtime/executor/loop-supervisor.d.ts +4 -0
- package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
- package/dist/runtime/executor/loop-supervisor.js +35 -6
- package/dist/runtime/executor/loop-supervisor.js.map +1 -1
- package/dist/runtime/guardrails/backpressure-controller.d.ts +32 -0
- package/dist/runtime/guardrails/backpressure-controller.d.ts.map +1 -0
- package/dist/runtime/guardrails/backpressure-controller.js +88 -0
- package/dist/runtime/guardrails/backpressure-controller.js.map +1 -0
- package/dist/runtime/guardrails/circuit-breaker.d.ts +32 -0
- package/dist/runtime/guardrails/circuit-breaker.d.ts.map +1 -0
- package/dist/runtime/guardrails/circuit-breaker.js +88 -0
- package/dist/runtime/guardrails/circuit-breaker.js.map +1 -0
- package/dist/runtime/guardrails/guardrail-store.d.ts +23 -0
- package/dist/runtime/guardrails/guardrail-store.d.ts.map +1 -0
- package/dist/runtime/guardrails/guardrail-store.js +95 -0
- package/dist/runtime/guardrails/guardrail-store.js.map +1 -0
- package/dist/runtime/guardrails/index.d.ts +4 -0
- package/dist/runtime/guardrails/index.d.ts.map +1 -0
- package/dist/runtime/guardrails/index.js +4 -0
- package/dist/runtime/guardrails/index.js.map +1 -0
- package/dist/runtime/interactive-automation/browser-session-store.d.ts +43 -0
- package/dist/runtime/interactive-automation/browser-session-store.d.ts.map +1 -0
- package/dist/runtime/interactive-automation/browser-session-store.js +104 -0
- package/dist/runtime/interactive-automation/browser-session-store.js.map +1 -0
- package/dist/runtime/interactive-automation/failure-classifier.d.ts +12 -0
- package/dist/runtime/interactive-automation/failure-classifier.d.ts.map +1 -0
- package/dist/runtime/interactive-automation/failure-classifier.js +50 -0
- package/dist/runtime/interactive-automation/failure-classifier.js.map +1 -0
- package/dist/runtime/interactive-automation/index.d.ts +2 -0
- package/dist/runtime/interactive-automation/index.d.ts.map +1 -1
- package/dist/runtime/interactive-automation/index.js +2 -0
- package/dist/runtime/interactive-automation/index.js.map +1 -1
- package/dist/runtime/interactive-automation/providers/manus-browser.d.ts.map +1 -1
- package/dist/runtime/interactive-automation/providers/manus-browser.js +17 -1
- package/dist/runtime/interactive-automation/providers/manus-browser.js.map +1 -1
- package/dist/runtime/interactive-automation/types.d.ts +4 -0
- package/dist/runtime/interactive-automation/types.d.ts.map +1 -1
- package/dist/runtime/interactive-automation/types.js.map +1 -1
- package/dist/runtime/notification-routing.d.ts +45 -2
- package/dist/runtime/notification-routing.d.ts.map +1 -1
- package/dist/runtime/notification-routing.js +196 -79
- package/dist/runtime/notification-routing.js.map +1 -1
- package/dist/runtime/run-spec/confirmation.d.ts +34 -0
- package/dist/runtime/run-spec/confirmation.d.ts.map +1 -0
- package/dist/runtime/run-spec/confirmation.js +176 -0
- package/dist/runtime/run-spec/confirmation.js.map +1 -0
- package/dist/runtime/run-spec/derive.d.ts +284 -0
- package/dist/runtime/run-spec/derive.d.ts.map +1 -0
- package/dist/runtime/run-spec/derive.js +379 -0
- package/dist/runtime/run-spec/derive.js.map +1 -0
- package/dist/runtime/run-spec/index.d.ts +5 -0
- package/dist/runtime/run-spec/index.d.ts.map +1 -0
- package/dist/runtime/run-spec/index.js +5 -0
- package/dist/runtime/run-spec/index.js.map +1 -0
- package/dist/runtime/run-spec/store.d.ts +11 -0
- package/dist/runtime/run-spec/store.d.ts.map +1 -0
- package/dist/runtime/run-spec/store.js +36 -0
- package/dist/runtime/run-spec/store.js.map +1 -0
- package/dist/runtime/run-spec/types.d.ts +495 -0
- package/dist/runtime/run-spec/types.d.ts.map +1 -0
- package/dist/runtime/run-spec/types.js +87 -0
- package/dist/runtime/run-spec/types.js.map +1 -0
- package/dist/runtime/schedule/engine-execution.d.ts +2 -1
- package/dist/runtime/schedule/engine-execution.d.ts.map +1 -1
- package/dist/runtime/schedule/engine-execution.js +1 -1
- package/dist/runtime/schedule/engine-execution.js.map +1 -1
- package/dist/runtime/schedule/engine-layers.d.ts +2 -1
- package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
- package/dist/runtime/schedule/engine-layers.js +3 -1
- package/dist/runtime/schedule/engine-layers.js.map +1 -1
- package/dist/runtime/schedule/engine.d.ts +2 -1
- package/dist/runtime/schedule/engine.d.ts.map +1 -1
- package/dist/runtime/schedule/engine.js.map +1 -1
- package/dist/runtime/schedule/history.d.ts +4 -4
- package/dist/runtime/session-registry/registry.d.ts.map +1 -1
- package/dist/runtime/session-registry/registry.js +2 -0
- package/dist/runtime/session-registry/registry.js.map +1 -1
- package/dist/runtime/session-registry/types.d.ts +102 -94
- package/dist/runtime/session-registry/types.d.ts.map +1 -1
- package/dist/runtime/session-registry/types.js +2 -0
- package/dist/runtime/session-registry/types.js.map +1 -1
- package/dist/runtime/store/artifact-retention.d.ts +44 -0
- package/dist/runtime/store/artifact-retention.d.ts.map +1 -0
- package/dist/runtime/store/artifact-retention.js +263 -0
- package/dist/runtime/store/artifact-retention.js.map +1 -0
- package/dist/runtime/store/background-run-store.d.ts +1 -0
- package/dist/runtime/store/background-run-store.d.ts.map +1 -1
- package/dist/runtime/store/background-run-store.js +1 -0
- package/dist/runtime/store/background-run-store.js.map +1 -1
- package/dist/runtime/store/budget-store.d.ts +442 -0
- package/dist/runtime/store/budget-store.d.ts.map +1 -0
- package/dist/runtime/store/budget-store.js +318 -0
- package/dist/runtime/store/budget-store.js.map +1 -0
- package/dist/runtime/store/dream-checkpoints.d.ts +9 -0
- package/dist/runtime/store/dream-checkpoints.d.ts.map +1 -0
- package/dist/runtime/store/dream-checkpoints.js +16 -0
- package/dist/runtime/store/dream-checkpoints.js.map +1 -0
- package/dist/runtime/store/evaluator-results.d.ts +97 -0
- package/dist/runtime/store/evaluator-results.d.ts.map +1 -0
- package/dist/runtime/store/evaluator-results.js +355 -0
- package/dist/runtime/store/evaluator-results.js.map +1 -0
- package/dist/runtime/store/evidence-ledger.d.ts +5298 -0
- package/dist/runtime/store/evidence-ledger.d.ts.map +1 -0
- package/dist/runtime/store/evidence-ledger.js +1452 -0
- package/dist/runtime/store/evidence-ledger.js.map +1 -0
- package/dist/runtime/store/experiment-queue-store.d.ts +1164 -0
- package/dist/runtime/store/experiment-queue-store.d.ts.map +1 -0
- package/dist/runtime/store/experiment-queue-store.js +341 -0
- package/dist/runtime/store/experiment-queue-store.js.map +1 -0
- package/dist/runtime/store/health-store.d.ts.map +1 -1
- package/dist/runtime/store/health-store.js +6 -0
- package/dist/runtime/store/health-store.js.map +1 -1
- package/dist/runtime/store/index.d.ts +25 -2
- package/dist/runtime/store/index.d.ts.map +1 -1
- package/dist/runtime/store/index.js +13 -1
- package/dist/runtime/store/index.js.map +1 -1
- package/dist/runtime/store/metric-history.d.ts +10 -0
- package/dist/runtime/store/metric-history.d.ts.map +1 -0
- package/dist/runtime/store/metric-history.js +56 -0
- package/dist/runtime/store/metric-history.js.map +1 -0
- package/dist/runtime/store/operator-handoff-store.d.ts +179 -0
- package/dist/runtime/store/operator-handoff-store.d.ts.map +1 -0
- package/dist/runtime/store/operator-handoff-store.js +120 -0
- package/dist/runtime/store/operator-handoff-store.js.map +1 -0
- package/dist/runtime/store/postmortem-report.d.ts +485 -0
- package/dist/runtime/store/postmortem-report.d.ts.map +1 -0
- package/dist/runtime/store/postmortem-report.js +561 -0
- package/dist/runtime/store/postmortem-report.js.map +1 -0
- package/dist/runtime/store/reproducibility-manifest.d.ts +565 -0
- package/dist/runtime/store/reproducibility-manifest.d.ts.map +1 -0
- package/dist/runtime/store/reproducibility-manifest.js +392 -0
- package/dist/runtime/store/reproducibility-manifest.js.map +1 -0
- package/dist/runtime/store/research-evidence.d.ts +8 -0
- package/dist/runtime/store/research-evidence.d.ts.map +1 -0
- package/dist/runtime/store/research-evidence.js +15 -0
- package/dist/runtime/store/research-evidence.js.map +1 -0
- package/dist/runtime/store/runtime-operation-schemas.d.ts +70 -24
- package/dist/runtime/store/runtime-operation-schemas.d.ts.map +1 -1
- package/dist/runtime/store/runtime-operation-schemas.js +16 -1
- package/dist/runtime/store/runtime-operation-schemas.js.map +1 -1
- package/dist/runtime/store/runtime-paths.d.ts +25 -0
- package/dist/runtime/store/runtime-paths.d.ts.map +1 -1
- package/dist/runtime/store/runtime-paths.js +73 -0
- package/dist/runtime/store/runtime-paths.js.map +1 -1
- package/dist/runtime/store/runtime-schemas.d.ts +1936 -17
- package/dist/runtime/store/runtime-schemas.d.ts.map +1 -1
- package/dist/runtime/store/runtime-schemas.js +201 -0
- package/dist/runtime/store/runtime-schemas.js.map +1 -1
- package/dist/runtime/store/safe-pause-store.d.ts +28 -0
- package/dist/runtime/store/safe-pause-store.d.ts.map +1 -0
- package/dist/runtime/store/safe-pause-store.js +103 -0
- package/dist/runtime/store/safe-pause-store.js.map +1 -0
- package/dist/runtime/types/daemon.d.ts +224 -14
- package/dist/runtime/types/daemon.d.ts.map +1 -1
- package/dist/runtime/types/daemon.js +27 -2
- package/dist/runtime/types/daemon.js.map +1 -1
- package/dist/runtime/types/envelope.d.ts +10 -10
- package/dist/runtime/types/hook.d.ts +9 -9
- package/dist/runtime/types/notification.d.ts +6 -6
- package/dist/runtime/types/plugin.d.ts +2 -2
- package/dist/runtime/types/schedule.d.ts +97 -54
- package/dist/runtime/types/schedule.d.ts.map +1 -1
- package/dist/runtime/types/schedule.js +10 -1
- package/dist/runtime/types/schedule.js.map +1 -1
- package/dist/runtime/types/trigger.d.ts +2 -2
- package/dist/tools/automation/InteractiveAutomationTools.d.ts +10 -0
- package/dist/tools/automation/InteractiveAutomationTools.d.ts.map +1 -1
- package/dist/tools/automation/InteractiveAutomationTools.js +139 -8
- package/dist/tools/automation/InteractiveAutomationTools.js.map +1 -1
- package/dist/tools/builtin/exports.d.ts +1 -1
- package/dist/tools/builtin/exports.d.ts.map +1 -1
- package/dist/tools/builtin/exports.js +1 -1
- package/dist/tools/builtin/exports.js.map +1 -1
- package/dist/tools/builtin/factory.d.ts +5 -0
- package/dist/tools/builtin/factory.d.ts.map +1 -1
- package/dist/tools/builtin/factory.js +18 -2
- package/dist/tools/builtin/factory.js.map +1 -1
- package/dist/tools/kaggle/KaggleExperimentTools.d.ts +792 -8
- package/dist/tools/kaggle/KaggleExperimentTools.d.ts.map +1 -1
- package/dist/tools/kaggle/KaggleExperimentTools.js +284 -19
- package/dist/tools/kaggle/KaggleExperimentTools.js.map +1 -1
- package/dist/tools/kaggle/KaggleSubmissionTools.d.ts +18 -12
- package/dist/tools/kaggle/KaggleSubmissionTools.d.ts.map +1 -1
- package/dist/tools/kaggle/KaggleSubmissionTools.js +23 -4
- package/dist/tools/kaggle/KaggleSubmissionTools.js.map +1 -1
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts +28 -9
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts.map +1 -1
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js +182 -4
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js.map +1 -1
- package/dist/tools/kaggle/index.d.ts +1 -1
- package/dist/tools/kaggle/index.d.ts.map +1 -1
- package/dist/tools/kaggle/index.js +1 -1
- package/dist/tools/kaggle/index.js.map +1 -1
- package/dist/tools/kaggle/metrics.d.ts +845 -4
- package/dist/tools/kaggle/metrics.d.ts.map +1 -1
- package/dist/tools/kaggle/metrics.js +410 -1
- package/dist/tools/kaggle/metrics.js.map +1 -1
- package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts +6 -0
- package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.d.ts.map +1 -1
- package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js +9 -2
- package/dist/tools/mutation/ConfigureNotificationRoutingTool/ConfigureNotificationRoutingTool.js.map +1 -1
- package/dist/tools/mutation/TaskCreateTool/TaskCreateTool.d.ts +4 -4
- package/dist/tools/network/McpStdioTool/McpStdioTool.d.ts +4 -4
- package/dist/tools/query/MemoryRecallTool/MemoryRecallTool.d.ts +2 -2
- package/dist/tools/query/runtime-dream-review-tool.d.ts +34 -0
- package/dist/tools/query/runtime-dream-review-tool.d.ts.map +1 -0
- package/dist/tools/query/runtime-dream-review-tool.js +62 -0
- package/dist/tools/query/runtime-dream-review-tool.js.map +1 -0
- package/dist/tools/query/runtime-session-tools.d.ts.map +1 -1
- package/dist/tools/query/runtime-session-tools.js +2 -0
- package/dist/tools/query/runtime-session-tools.js.map +1 -1
- package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +103 -103
- package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -1
- package/dist/tools/runtime/LongRunningRuntimeTools.js +60 -0
- package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -1
- package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts +62 -32
- package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts.map +1 -1
- package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts +78 -44
- package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts.map +1 -1
- package/dist/tools/system/TestRunnerTool/TestRunnerTool.d.ts +4 -4
- 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
|