pulseed 0.4.0 → 0.4.2
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/dist/base/state/state-manager-goal-write.d.ts +22 -0
- package/dist/base/state/state-manager-goal-write.d.ts.map +1 -0
- package/dist/base/state/state-manager-goal-write.js +74 -0
- package/dist/base/state/state-manager-goal-write.js.map +1 -0
- package/dist/base/state/state-manager-wal.d.ts +11 -0
- package/dist/base/state/state-manager-wal.d.ts.map +1 -0
- package/dist/base/state/state-manager-wal.js +89 -0
- package/dist/base/state/state-manager-wal.js.map +1 -0
- package/dist/base/state/state-manager.d.ts +1 -4
- package/dist/base/state/state-manager.d.ts.map +1 -1
- package/dist/base/state/state-manager.js +18 -127
- package/dist/base/state/state-manager.js.map +1 -1
- package/dist/interface/chat/chat-runner.d.ts +1 -1
- package/dist/interface/chat/event-subscriber.d.ts +4 -0
- package/dist/interface/chat/event-subscriber.d.ts.map +1 -1
- package/dist/interface/chat/event-subscriber.js +49 -2
- package/dist/interface/chat/event-subscriber.js.map +1 -1
- package/dist/interface/chat/tend-command.d.ts +1 -1
- package/dist/interface/cli/cli-command-registry.js +1 -1
- package/dist/interface/cli/cli-command-registry.js.map +1 -1
- package/dist/interface/cli/commands/chat.js +2 -2
- package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon.js +87 -44
- package/dist/interface/cli/commands/daemon.js.map +1 -1
- package/dist/interface/cli/commands/schedule.js +2 -2
- package/dist/interface/cli/commands/setup/steps-runtime.js +1 -1
- package/dist/interface/cli/ensure-api-key.d.ts +4 -1
- package/dist/interface/cli/ensure-api-key.d.ts.map +1 -1
- package/dist/interface/cli/ensure-api-key.js +52 -15
- package/dist/interface/cli/ensure-api-key.js.map +1 -1
- package/dist/interface/tui/app.d.ts +1 -1
- package/dist/interface/tui/chat/scroll.d.ts +14 -0
- package/dist/interface/tui/chat/scroll.d.ts.map +1 -0
- package/dist/interface/tui/chat/scroll.js +46 -0
- package/dist/interface/tui/chat/scroll.js.map +1 -0
- package/dist/interface/tui/chat/suggestions.d.ts +8 -0
- package/dist/interface/tui/chat/suggestions.d.ts.map +1 -0
- package/dist/interface/tui/chat/suggestions.js +112 -0
- package/dist/interface/tui/chat/suggestions.js.map +1 -0
- package/dist/interface/tui/chat/types.d.ts +31 -0
- package/dist/interface/tui/chat/types.d.ts.map +1 -0
- package/dist/interface/tui/chat/types.js +2 -0
- package/dist/interface/tui/chat/types.js.map +1 -0
- package/dist/interface/tui/chat/viewport.d.ts +3 -0
- package/dist/interface/tui/chat/viewport.d.ts.map +1 -0
- package/dist/interface/tui/chat/viewport.js +78 -0
- package/dist/interface/tui/chat/viewport.js.map +1 -0
- package/dist/interface/tui/chat.d.ts +5 -49
- package/dist/interface/tui/chat.d.ts.map +1 -1
- package/dist/interface/tui/chat.js +7 -236
- package/dist/interface/tui/chat.js.map +1 -1
- package/dist/interface/tui/entry.js +3 -3
- package/dist/interface/tui/use-loop.d.ts +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts +3 -0
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.js +3 -0
- package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-rules.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-rules.js +34 -2
- package/dist/orchestrator/execution/task/task-verifier-rules.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-types.d.ts +2 -0
- package/dist/orchestrator/execution/task/task-verifier-types.d.ts.map +1 -1
- package/dist/orchestrator/loop/checkpoint-manager-loop.d.ts +1 -1
- package/dist/orchestrator/loop/checkpoint-manager-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/capability.d.ts +22 -0
- package/dist/orchestrator/loop/core-loop/capability.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/capability.js +151 -0
- package/dist/orchestrator/loop/core-loop/capability.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/contracts.d.ts +245 -0
- package/dist/orchestrator/loop/core-loop/contracts.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/contracts.js +40 -0
- package/dist/orchestrator/loop/core-loop/contracts.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/control.d.ts +27 -0
- package/dist/orchestrator/loop/core-loop/control.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/control.js +72 -0
- package/dist/orchestrator/loop/core-loop/control.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/learning.d.ts +31 -0
- package/dist/orchestrator/loop/core-loop/learning.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/learning.js +92 -0
- package/dist/orchestrator/loop/core-loop/learning.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/preparation.d.ts +63 -0
- package/dist/orchestrator/loop/core-loop/preparation.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/preparation.js +362 -0
- package/dist/orchestrator/loop/core-loop/preparation.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +29 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.js +674 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -0
- package/dist/orchestrator/loop/core-loop-capability.d.ts +1 -24
- package/dist/orchestrator/loop/core-loop-capability.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-capability.js +1 -153
- package/dist/orchestrator/loop/core-loop-capability.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-learning.d.ts +1 -34
- package/dist/orchestrator/loop/core-loop-learning.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-learning.js +1 -95
- package/dist/orchestrator/loop/core-loop-learning.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-b.d.ts +1 -31
- package/dist/orchestrator/loop/core-loop-phases-b.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-b.js +1 -669
- package/dist/orchestrator/loop/core-loop-phases-b.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-c.d.ts +1 -26
- package/dist/orchestrator/loop/core-loop-phases-c.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases-c.js +1 -71
- package/dist/orchestrator/loop/core-loop-phases-c.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases.d.ts +1 -68
- package/dist/orchestrator/loop/core-loop-phases.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-phases.js +1 -367
- package/dist/orchestrator/loop/core-loop-phases.js.map +1 -1
- package/dist/orchestrator/loop/core-loop-types.d.ts +1 -244
- package/dist/orchestrator/loop/core-loop-types.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop-types.js +1 -39
- package/dist/orchestrator/loop/core-loop-types.js.map +1 -1
- package/dist/orchestrator/loop/core-loop.d.ts +3 -3
- package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop.js +6 -6
- package/dist/orchestrator/loop/core-loop.js.map +1 -1
- package/dist/orchestrator/loop/loop-report-helper.d.ts +1 -1
- package/dist/orchestrator/loop/loop-report-helper.d.ts.map +1 -1
- package/dist/orchestrator/loop/parallel-dispatch.d.ts +2 -2
- package/dist/orchestrator/loop/parallel-dispatch.d.ts.map +1 -1
- package/dist/orchestrator/loop/post-loop-hooks.d.ts +1 -1
- package/dist/orchestrator/loop/post-loop-hooks.d.ts.map +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.d.ts +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.js +1 -1
- package/dist/orchestrator/loop/tree-loop-runner.js.map +1 -1
- package/dist/platform/dream/dream-schedule-suggestions.d.ts +1 -1
- package/dist/platform/drive/drive-system.d.ts +8 -0
- package/dist/platform/drive/drive-system.d.ts.map +1 -1
- package/dist/platform/drive/drive-system.js +39 -22
- package/dist/platform/drive/drive-system.js.map +1 -1
- package/dist/platform/observation/engine/observe-context.d.ts +4 -0
- package/dist/platform/observation/engine/observe-context.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-context.js +26 -0
- package/dist/platform/observation/engine/observe-context.js.map +1 -0
- package/dist/platform/observation/engine/observe-datasource-stage.d.ts +33 -0
- package/dist/platform/observation/engine/observe-datasource-stage.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-datasource-stage.js +66 -0
- package/dist/platform/observation/engine/observe-datasource-stage.js.map +1 -0
- package/dist/platform/observation/engine/observe-llm-stage.d.ts +25 -0
- package/dist/platform/observation/engine/observe-llm-stage.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-llm-stage.js +79 -0
- package/dist/platform/observation/engine/observe-llm-stage.js.map +1 -0
- package/dist/platform/observation/engine/observe-precheck.d.ts +21 -0
- package/dist/platform/observation/engine/observe-precheck.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-precheck.js +51 -0
- package/dist/platform/observation/engine/observe-precheck.js.map +1 -0
- package/dist/platform/observation/engine/observe-self-report.d.ts +18 -0
- package/dist/platform/observation/engine/observe-self-report.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-self-report.js +26 -0
- package/dist/platform/observation/engine/observe-self-report.js.map +1 -0
- package/dist/platform/observation/engine/observe-tool-stage.d.ts +21 -0
- package/dist/platform/observation/engine/observe-tool-stage.d.ts.map +1 -0
- package/dist/platform/observation/engine/observe-tool-stage.js +49 -0
- package/dist/platform/observation/engine/observe-tool-stage.js.map +1 -0
- package/dist/platform/observation/observation-engine.d.ts.map +1 -1
- package/dist/platform/observation/observation-engine.js +67 -246
- package/dist/platform/observation/observation-engine.js.map +1 -1
- package/dist/prompt/context-assembler.d.ts +61 -13
- package/dist/prompt/context-assembler.d.ts.map +1 -1
- package/dist/prompt/context-assembler.js +18 -3
- package/dist/prompt/context-assembler.js.map +1 -1
- package/dist/runtime/approval-broker.d.ts.map +1 -1
- package/dist/runtime/approval-broker.js +1 -0
- package/dist/runtime/approval-broker.js.map +1 -1
- package/dist/runtime/command-dispatcher.d.ts +35 -0
- package/dist/runtime/command-dispatcher.d.ts.map +1 -0
- package/dist/runtime/command-dispatcher.js +145 -0
- package/dist/runtime/command-dispatcher.js.map +1 -0
- package/dist/runtime/daemon/client.d.ts +67 -0
- package/dist/runtime/daemon/client.d.ts.map +1 -0
- package/dist/runtime/daemon/client.js +330 -0
- package/dist/runtime/daemon/client.js.map +1 -0
- package/dist/runtime/daemon/health.d.ts +31 -0
- package/dist/runtime/daemon/health.d.ts.map +1 -0
- package/dist/runtime/daemon/health.js +113 -0
- package/dist/runtime/daemon/health.js.map +1 -0
- package/dist/runtime/daemon/index.d.ts +9 -0
- package/dist/runtime/daemon/index.d.ts.map +1 -0
- package/dist/runtime/daemon/index.js +8 -0
- package/dist/runtime/daemon/index.js.map +1 -0
- package/dist/runtime/daemon/maintenance.d.ts +47 -0
- package/dist/runtime/daemon/maintenance.d.ts.map +1 -0
- package/dist/runtime/daemon/maintenance.js +230 -0
- package/dist/runtime/daemon/maintenance.js.map +1 -0
- package/dist/runtime/daemon/persistence.d.ts +20 -0
- package/dist/runtime/daemon/persistence.d.ts.map +1 -0
- package/dist/runtime/daemon/persistence.js +112 -0
- package/dist/runtime/daemon/persistence.js.map +1 -0
- package/dist/runtime/daemon/runner-lifecycle.d.ts +29 -0
- package/dist/runtime/daemon/runner-lifecycle.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-lifecycle.js +56 -0
- package/dist/runtime/daemon/runner-lifecycle.js.map +1 -0
- package/dist/runtime/daemon/runner.d.ts +229 -0
- package/dist/runtime/daemon/runner.d.ts.map +1 -0
- package/dist/runtime/daemon/runner.js +875 -0
- package/dist/runtime/daemon/runner.js.map +1 -0
- package/dist/runtime/daemon/runtime-ownership.d.ts +30 -0
- package/dist/runtime/daemon/runtime-ownership.d.ts.map +1 -0
- package/dist/runtime/daemon/runtime-ownership.js +132 -0
- package/dist/runtime/daemon/runtime-ownership.js.map +1 -0
- package/dist/runtime/daemon/signals.d.ts +17 -0
- package/dist/runtime/daemon/signals.d.ts.map +1 -0
- package/dist/runtime/daemon/signals.js +31 -0
- package/dist/runtime/daemon/signals.js.map +1 -0
- package/dist/runtime/daemon/types.d.ts +8 -0
- package/dist/runtime/daemon/types.d.ts.map +1 -0
- package/dist/runtime/daemon/types.js +2 -0
- package/dist/runtime/daemon/types.js.map +1 -0
- package/dist/runtime/daemon-client.d.ts +1 -55
- package/dist/runtime/daemon-client.d.ts.map +1 -1
- package/dist/runtime/daemon-client.js +1 -297
- package/dist/runtime/daemon-client.js.map +1 -1
- package/dist/runtime/daemon-health.d.ts +1 -30
- package/dist/runtime/daemon-health.d.ts.map +1 -1
- package/dist/runtime/daemon-health.js +1 -112
- package/dist/runtime/daemon-health.js.map +1 -1
- package/dist/runtime/daemon-runner-lifecycle.d.ts +2 -0
- package/dist/runtime/daemon-runner-lifecycle.d.ts.map +1 -0
- package/dist/runtime/daemon-runner-lifecycle.js +2 -0
- package/dist/runtime/daemon-runner-lifecycle.js.map +1 -0
- package/dist/runtime/daemon-runner.d.ts +1 -231
- package/dist/runtime/daemon-runner.d.ts.map +1 -1
- package/dist/runtime/daemon-runner.js +1 -1042
- package/dist/runtime/daemon-runner.js.map +1 -1
- package/dist/runtime/daemon-runtime-ownership.d.ts +2 -0
- package/dist/runtime/daemon-runtime-ownership.d.ts.map +1 -0
- package/dist/runtime/daemon-runtime-ownership.js +2 -0
- package/dist/runtime/daemon-runtime-ownership.js.map +1 -0
- package/dist/runtime/daemon-signals.d.ts +1 -16
- package/dist/runtime/daemon-signals.d.ts.map +1 -1
- package/dist/runtime/daemon-signals.js +1 -30
- package/dist/runtime/daemon-signals.js.map +1 -1
- package/dist/runtime/event/dispatcher.d.ts +34 -0
- package/dist/runtime/event/dispatcher.d.ts.map +1 -0
- package/dist/runtime/event/dispatcher.js +124 -0
- package/dist/runtime/event/dispatcher.js.map +1 -0
- package/dist/runtime/event/index.d.ts +5 -0
- package/dist/runtime/event/index.d.ts.map +1 -0
- package/dist/runtime/event/index.js +5 -0
- package/dist/runtime/event/index.js.map +1 -0
- package/dist/runtime/event/server-snapshot-reader.d.ts +31 -0
- package/dist/runtime/event/server-snapshot-reader.d.ts.map +1 -0
- package/dist/runtime/event/server-snapshot-reader.js +94 -0
- package/dist/runtime/event/server-snapshot-reader.js.map +1 -0
- package/dist/runtime/event/server-sse.d.ts +25 -0
- package/dist/runtime/event/server-sse.d.ts.map +1 -0
- package/dist/runtime/event/server-sse.js +149 -0
- package/dist/runtime/event/server-sse.js.map +1 -0
- package/dist/runtime/event/server.d.ts +114 -0
- package/dist/runtime/event/server.d.ts.map +1 -0
- package/dist/runtime/event/server.js +651 -0
- package/dist/runtime/event/server.js.map +1 -0
- package/dist/runtime/event-dispatcher.d.ts +2 -0
- package/dist/runtime/event-dispatcher.d.ts.map +1 -0
- package/dist/runtime/event-dispatcher.js +2 -0
- package/dist/runtime/event-dispatcher.js.map +1 -0
- package/dist/runtime/event-server-snapshot-reader.d.ts +2 -0
- package/dist/runtime/event-server-snapshot-reader.d.ts.map +1 -0
- package/dist/runtime/event-server-snapshot-reader.js +2 -0
- package/dist/runtime/event-server-snapshot-reader.js.map +1 -0
- package/dist/runtime/event-server-sse.d.ts +2 -0
- package/dist/runtime/event-server-sse.d.ts.map +1 -0
- package/dist/runtime/event-server-sse.js +2 -0
- package/dist/runtime/event-server-sse.js.map +1 -0
- package/dist/runtime/event-server.d.ts +1 -91
- package/dist/runtime/event-server.d.ts.map +1 -1
- package/dist/runtime/event-server.js +1 -698
- package/dist/runtime/event-server.js.map +1 -1
- package/dist/runtime/executor/loop-supervisor.d.ts +9 -5
- package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
- package/dist/runtime/executor/loop-supervisor.js +59 -76
- package/dist/runtime/executor/loop-supervisor.js.map +1 -1
- package/dist/runtime/gateway/http-channel-adapter.d.ts +1 -1
- package/dist/runtime/plugin-loader.d.ts +1 -1
- package/dist/runtime/queue/index.d.ts +0 -4
- package/dist/runtime/queue/index.d.ts.map +1 -1
- package/dist/runtime/queue/index.js +0 -2
- package/dist/runtime/queue/index.js.map +1 -1
- package/dist/runtime/queue/journal-backed-queue.d.ts.map +1 -1
- package/dist/runtime/queue/journal-backed-queue.js +2 -0
- package/dist/runtime/queue/journal-backed-queue.js.map +1 -1
- package/dist/runtime/schedule/engine-layers.d.ts +44 -0
- package/dist/runtime/schedule/engine-layers.d.ts.map +1 -0
- package/dist/runtime/schedule/engine-layers.js +433 -0
- package/dist/runtime/schedule/engine-layers.js.map +1 -0
- package/dist/runtime/schedule/engine.d.ts +82 -0
- package/dist/runtime/schedule/engine.d.ts.map +1 -0
- package/dist/runtime/schedule/engine.js +480 -0
- package/dist/runtime/schedule/engine.js.map +1 -0
- package/dist/runtime/schedule/index.d.ts +5 -0
- package/dist/runtime/schedule/index.d.ts.map +1 -0
- package/dist/runtime/schedule/index.js +5 -0
- package/dist/runtime/schedule/index.js.map +1 -0
- package/dist/runtime/schedule/presets.d.ts +536 -0
- package/dist/runtime/schedule/presets.d.ts.map +1 -0
- package/dist/runtime/schedule/presets.js +166 -0
- package/dist/runtime/schedule/presets.js.map +1 -0
- package/dist/runtime/schedule/source.d.ts +65 -0
- package/dist/runtime/schedule/source.d.ts.map +1 -0
- package/dist/runtime/schedule/source.js +16 -0
- package/dist/runtime/schedule/source.js.map +1 -0
- package/dist/runtime/schedule-engine-layers.d.ts +1 -43
- package/dist/runtime/schedule-engine-layers.d.ts.map +1 -1
- package/dist/runtime/schedule-engine-layers.js +1 -432
- package/dist/runtime/schedule-engine-layers.js.map +1 -1
- package/dist/runtime/schedule-engine.d.ts +1 -81
- package/dist/runtime/schedule-engine.d.ts.map +1 -1
- package/dist/runtime/schedule-engine.js +1 -479
- package/dist/runtime/schedule-engine.js.map +1 -1
- package/dist/runtime/schedule-presets.d.ts +1 -535
- package/dist/runtime/schedule-presets.d.ts.map +1 -1
- package/dist/runtime/schedule-presets.js +1 -165
- package/dist/runtime/schedule-presets.js.map +1 -1
- package/dist/runtime/schedule-source.d.ts +1 -64
- package/dist/runtime/schedule-source.d.ts.map +1 -1
- package/dist/runtime/schedule-source.js +1 -15
- package/dist/runtime/schedule-source.js.map +1 -1
- package/dist/runtime/types/daemon.d.ts.map +1 -1
- package/dist/runtime/types/daemon.js +2 -1
- package/dist/runtime/types/daemon.js.map +1 -1
- package/dist/runtime/watchdog.d.ts +44 -0
- package/dist/runtime/watchdog.d.ts.map +1 -0
- package/dist/runtime/watchdog.js +185 -0
- package/dist/runtime/watchdog.js.map +1 -0
- package/dist/tools/builtin/index.d.ts +1 -1
- package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/CreateScheduleTool/CreateScheduleTool.js +1 -1
- package/dist/tools/schedule/GetScheduleTool/GetScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/ListSchedulesTool/ListSchedulesTool.d.ts +1 -1
- package/dist/tools/schedule/PauseScheduleTool/PauseScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/RemoveScheduleTool/RemoveScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/ResumeScheduleTool/ResumeScheduleTool.d.ts +1 -1
- package/dist/tools/schedule/UpdateScheduleTool/UpdateScheduleTool.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Learning and transfer state that spans CoreLoop iterations.
|
|
3
|
+
*/
|
|
4
|
+
import type { Logger } from "../../../runtime/logger.js";
|
|
5
|
+
import type { CoreLoopDeps } from "./contracts.js";
|
|
6
|
+
import type { ToolExecutor } from "../../../tools/executor.js";
|
|
7
|
+
export declare class CoreLoopLearning {
|
|
8
|
+
private lastLearningReviewAt;
|
|
9
|
+
private transferCheckCounter;
|
|
10
|
+
/** Tracks consecutive capability acquisition failures per capability name */
|
|
11
|
+
private capabilityAcquisitionFailures;
|
|
12
|
+
getCapabilityFailures(): Map<string, number>;
|
|
13
|
+
incrementTransferCounter(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the periodic learning review interval in milliseconds based on
|
|
16
|
+
* how much time remains until the goal's target_date.
|
|
17
|
+
*/
|
|
18
|
+
getPeriodicReviewInterval(goalId: string, stateManager: CoreLoopDeps["stateManager"]): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* Checks whether it is time to run a periodic learning review and, if so,
|
|
21
|
+
* calls learningPipeline.onPeriodicReview(). Non-fatal — errors are logged
|
|
22
|
+
* but do not bubble up.
|
|
23
|
+
*/
|
|
24
|
+
checkPeriodicReview(goalId: string, deps: CoreLoopDeps, logger: Logger | undefined, toolExecutor?: ToolExecutor): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Called after the run loop completes with finalStatus === "completed".
|
|
27
|
+
* Triggers learningPipeline.onGoalCompleted(). Non-fatal.
|
|
28
|
+
*/
|
|
29
|
+
onGoalCompleted(goalId: string, deps: CoreLoopDeps, logger: Logger | undefined, toolExecutor?: ToolExecutor): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=learning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learning.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/learning.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,oBAAoB,CAAa;IACzC,6EAA6E;IAC7E,OAAO,CAAC,6BAA6B,CAAkC;IAEvE,qBAAqB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAI5C,wBAAwB,IAAI,MAAM;IAIlC;;;OAGG;IACG,yBAAyB,CAC7B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,GACzC,OAAO,CAAC,MAAM,CAAC;IAYlB;;;;OAIG;IACG,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,IAAI,CAAC;IA2BhB;;;OAGG;IACG,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,IAAI,CAAC;CAsBjB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Learning and transfer state that spans CoreLoop iterations.
|
|
3
|
+
*/
|
|
4
|
+
import { gatherLearningEvidence } from "../learning-evidence.js";
|
|
5
|
+
export class CoreLoopLearning {
|
|
6
|
+
lastLearningReviewAt = Date.now();
|
|
7
|
+
transferCheckCounter = 0;
|
|
8
|
+
/** Tracks consecutive capability acquisition failures per capability name */
|
|
9
|
+
capabilityAcquisitionFailures = new Map();
|
|
10
|
+
getCapabilityFailures() {
|
|
11
|
+
return this.capabilityAcquisitionFailures;
|
|
12
|
+
}
|
|
13
|
+
incrementTransferCounter() {
|
|
14
|
+
return ++this.transferCheckCounter;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns the periodic learning review interval in milliseconds based on
|
|
18
|
+
* how much time remains until the goal's target_date.
|
|
19
|
+
*/
|
|
20
|
+
async getPeriodicReviewInterval(goalId, stateManager) {
|
|
21
|
+
const goal = await stateManager.loadGoal(goalId);
|
|
22
|
+
if (!goal?.target_date) {
|
|
23
|
+
return 72 * 3600 * 1000; // default: 72 hours
|
|
24
|
+
}
|
|
25
|
+
const remainingDays = (new Date(goal.target_date).getTime() - Date.now()) / (1000 * 60 * 60 * 24);
|
|
26
|
+
if (remainingDays <= 30)
|
|
27
|
+
return 72 * 3600 * 1000; // 短期: 72h
|
|
28
|
+
if (remainingDays <= 180)
|
|
29
|
+
return 168 * 3600 * 1000; // 中期: 1week
|
|
30
|
+
return 336 * 3600 * 1000; // 長期: 2weeks
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks whether it is time to run a periodic learning review and, if so,
|
|
34
|
+
* calls learningPipeline.onPeriodicReview(). Non-fatal — errors are logged
|
|
35
|
+
* but do not bubble up.
|
|
36
|
+
*/
|
|
37
|
+
async checkPeriodicReview(goalId, deps, logger, toolExecutor) {
|
|
38
|
+
if (!deps.learningPipeline)
|
|
39
|
+
return;
|
|
40
|
+
const now = Date.now();
|
|
41
|
+
const intervalMs = await this.getPeriodicReviewInterval(goalId, deps.stateManager);
|
|
42
|
+
if (now - this.lastLearningReviewAt >= intervalMs) {
|
|
43
|
+
try {
|
|
44
|
+
if (toolExecutor) {
|
|
45
|
+
const toolCtx = { cwd: ".", goalId, trustBalance: 0, preApproved: true, approvalFn: async () => false };
|
|
46
|
+
const evidence = await gatherLearningEvidence(toolExecutor, toolCtx);
|
|
47
|
+
if (evidence.errors.length > 0) {
|
|
48
|
+
logger?.warn("CoreLoop: evidence gathering errors", { goalId, errors: evidence.errors });
|
|
49
|
+
}
|
|
50
|
+
logger?.debug("CoreLoop: periodic review evidence", { goalId, artifactCount: evidence.artifactCount, changesLen: evidence.recentChanges.length });
|
|
51
|
+
}
|
|
52
|
+
await deps.learningPipeline.onPeriodicReview(goalId);
|
|
53
|
+
this.lastLearningReviewAt = now;
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
// non-fatal: learning pipeline failure should not block main loop
|
|
57
|
+
logger?.warn("CoreLoop: learningPipeline.onPeriodicReview failed", {
|
|
58
|
+
goalId,
|
|
59
|
+
error: err instanceof Error ? err.message : String(err),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Called after the run loop completes with finalStatus === "completed".
|
|
66
|
+
* Triggers learningPipeline.onGoalCompleted(). Non-fatal.
|
|
67
|
+
*/
|
|
68
|
+
async onGoalCompleted(goalId, deps, logger, toolExecutor) {
|
|
69
|
+
if (!deps.learningPipeline)
|
|
70
|
+
return;
|
|
71
|
+
try {
|
|
72
|
+
if (toolExecutor) {
|
|
73
|
+
const toolCtx = { cwd: ".", goalId, trustBalance: 0, preApproved: true, approvalFn: async () => false };
|
|
74
|
+
const evidence = await gatherLearningEvidence(toolExecutor, toolCtx);
|
|
75
|
+
if (evidence.errors.length > 0) {
|
|
76
|
+
logger?.warn("CoreLoop: evidence gathering errors", { goalId, errors: evidence.errors });
|
|
77
|
+
}
|
|
78
|
+
// Evidence is informational — log artifact count for observability
|
|
79
|
+
logger?.debug("CoreLoop: goal completed evidence", { goalId, artifactCount: evidence.artifactCount });
|
|
80
|
+
}
|
|
81
|
+
await deps.learningPipeline.onGoalCompleted(goalId);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
// non-fatal
|
|
85
|
+
logger?.warn("CoreLoop: learningPipeline.onGoalCompleted failed", {
|
|
86
|
+
goalId,
|
|
87
|
+
error: err instanceof Error ? err.message : String(err),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=learning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learning.js","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/learning.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,OAAO,gBAAgB;IACnB,oBAAoB,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;IAC1C,oBAAoB,GAAW,CAAC,CAAC;IACzC,6EAA6E;IACrE,6BAA6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,CAAC;YACH,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;gBACxG,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;gBACrE,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC/B,MAAM,EAAE,IAAI,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC3F,CAAC;gBACD,mEAAmE;gBACnE,MAAM,EAAE,KAAK,CAAC,mCAAmC,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;YACxG,CAAC;YACD,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,YAAY;YACZ,MAAM,EAAE,IAAI,CAAC,mDAAmD,EAAE;gBAChE,MAAM;gBACN,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACxD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preparation and scoring steps for a single CoreLoop iteration.
|
|
3
|
+
*/
|
|
4
|
+
import type { Logger } from "../../../runtime/logger.js";
|
|
5
|
+
import type { ToolExecutor } from "../../../tools/executor.js";
|
|
6
|
+
import type { Goal } from "../../../base/types/goal.js";
|
|
7
|
+
import type { GapVector } from "../../../base/types/gap.js";
|
|
8
|
+
import type { DriveScore } from "../../../base/types/drive.js";
|
|
9
|
+
import { type CoreLoopDeps, type ResolvedLoopConfig, type LoopIterationResult } from "./contracts.js";
|
|
10
|
+
/** Minimal context passed to every phase function. */
|
|
11
|
+
export interface PhaseCtx {
|
|
12
|
+
deps: CoreLoopDeps;
|
|
13
|
+
config: ResolvedLoopConfig;
|
|
14
|
+
logger: Logger | undefined;
|
|
15
|
+
toolExecutor?: ToolExecutor;
|
|
16
|
+
/**
|
|
17
|
+
* Optional TimeHorizonEngine for canAffordWait gate in rebalancePortfolio (Gap 1).
|
|
18
|
+
* When present, WaitStrategy processing is skipped if the engine reports the goal
|
|
19
|
+
* cannot afford to wait given the remaining time budget.
|
|
20
|
+
*/
|
|
21
|
+
timeHorizonEngine?: import("../../../platform/time/time-horizon-engine.js").ITimeHorizonEngine;
|
|
22
|
+
}
|
|
23
|
+
/** Load goal from state, apply tree aggregation if applicable.
|
|
24
|
+
* Returns the loaded Goal, or null if an error occurred (result is mutated). */
|
|
25
|
+
export declare function loadGoalWithAggregation(ctx: PhaseCtx, goalId: string, result: LoopIterationResult, startTime: number): Promise<Goal | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Automatically decompose an abstract goal into sub-goals using
|
|
28
|
+
* TreeLoopOrchestrator.ensureGoalRefined(). Skipped when disabled,
|
|
29
|
+
* when the goal already has children, or when the goal is a leaf.
|
|
30
|
+
* Only root goals (decomposition_depth === 0) are auto-decomposed to
|
|
31
|
+
* prevent recursive decomposition of child nodes.
|
|
32
|
+
* Specificity checks are delegated to ensureGoalRefined internally.
|
|
33
|
+
*
|
|
34
|
+
* @param decomposedGoals - Set of goal IDs already decomposed this run.
|
|
35
|
+
* When provided, goals already in the set are skipped and the goal ID is
|
|
36
|
+
* added to the set after a successful decomposition attempt.
|
|
37
|
+
*/
|
|
38
|
+
export declare function phaseAutoDecompose(goalId: string, goal: Goal, deps: CoreLoopDeps, config: ResolvedLoopConfig, logger: Logger | undefined, decomposedGoals?: Set<string>, isFirstIteration?: boolean): Promise<void>;
|
|
39
|
+
/** Build a ToolCallContext from PhaseCtx for CoreLoop autonomous tool calls. */
|
|
40
|
+
export declare function buildLoopToolContext(ctx: PhaseCtx, goalId: string): Promise<import("../../../tools/types.js").ToolCallContext>;
|
|
41
|
+
/** Run observation engine, reload goal after observation.
|
|
42
|
+
* Observation failure is non-fatal — returns current goal state.
|
|
43
|
+
* When ctx.toolExecutor is present, routes through the observe-goal tool first
|
|
44
|
+
* and falls back to direct engine.observe() on tool failure. */
|
|
45
|
+
export declare function observeAndReload(ctx: PhaseCtx, goalId: string, goal: Goal, loopIndex: number): Promise<Goal>;
|
|
46
|
+
/** Calculate gap vector and aggregate.
|
|
47
|
+
* Returns null on error.
|
|
48
|
+
* When gap === 0, returns the gap result with skipTaskGeneration=true so the
|
|
49
|
+
* caller continues to Phase 5 (SatisficingJudge) instead of short-circuiting.
|
|
50
|
+
*/
|
|
51
|
+
export declare function calculateGapOrComplete(ctx: PhaseCtx, goalId: string, goal: Goal, loopIndex: number, result: LoopIterationResult, startTime: number): Promise<{
|
|
52
|
+
gapVector: GapVector;
|
|
53
|
+
gapAggregate: number;
|
|
54
|
+
skipTaskGeneration?: boolean;
|
|
55
|
+
} | null>;
|
|
56
|
+
/** Score drives, update DriveScoreAdapter, check knowledge gap.
|
|
57
|
+
* Returns ranked DriveScores with highDissatisfactionDimensions, or null if the caller should
|
|
58
|
+
* return result early (knowledge gap task generated or drive scoring failed). */
|
|
59
|
+
export declare function scoreDrivesAndCheckKnowledge(ctx: PhaseCtx, goalId: string, goal: Goal, gapVector: GapVector, loopIndex: number, result: LoopIterationResult, startTime: number, tryGenerateReport: (goalId: string, loopIndex: number, result: LoopIterationResult, goal: Goal) => void): Promise<{
|
|
60
|
+
driveScores: DriveScore[];
|
|
61
|
+
highDissatisfactionDimensions: string[];
|
|
62
|
+
} | null>;
|
|
63
|
+
//# sourceMappingURL=preparation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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racts.js";
|
|
5
|
+
import { logRewardComputation } from "../../../platform/drive/reward-log.js";
|
|
6
|
+
// ─── Phase 1 ───
|
|
7
|
+
/** Load goal from state, apply tree aggregation if applicable.
|
|
8
|
+
* Returns the loaded Goal, or null if an error occurred (result is mutated). */
|
|
9
|
+
export async function loadGoalWithAggregation(ctx, goalId, result, startTime) {
|
|
10
|
+
let goal;
|
|
11
|
+
try {
|
|
12
|
+
const loaded = await ctx.deps.stateManager.loadGoal(goalId);
|
|
13
|
+
if (!loaded) {
|
|
14
|
+
result.error = `Goal "${goalId}" not found`;
|
|
15
|
+
result.elapsedMs = Date.now() - startTime;
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
goal = loaded;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
result.error = `Failed to load goal: ${err instanceof Error ? err.message : String(err)}`;
|
|
22
|
+
ctx.logger?.error(`CoreLoop: ${result.error}`, { goalId });
|
|
23
|
+
result.elapsedMs = Date.now() - startTime;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
// Tree aggregation
|
|
27
|
+
if (ctx.deps.stateAggregator && goal.children_ids.length > 0) {
|
|
28
|
+
try {
|
|
29
|
+
await ctx.deps.stateAggregator.aggregateChildStates(goalId);
|
|
30
|
+
const reloaded = await ctx.deps.stateManager.loadGoal(goalId);
|
|
31
|
+
if (reloaded)
|
|
32
|
+
goal = reloaded;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Tree aggregation failure is non-fatal
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return goal;
|
|
39
|
+
}
|
|
40
|
+
// ─── Phase 1b: Auto-decompose ───
|
|
41
|
+
/**
|
|
42
|
+
* Automatically decompose an abstract goal into sub-goals using
|
|
43
|
+
* TreeLoopOrchestrator.ensureGoalRefined(). Skipped when disabled,
|
|
44
|
+
* when the goal already has children, or when the goal is a leaf.
|
|
45
|
+
* Only root goals (decomposition_depth === 0) are auto-decomposed to
|
|
46
|
+
* prevent recursive decomposition of child nodes.
|
|
47
|
+
* Specificity checks are delegated to ensureGoalRefined internally.
|
|
48
|
+
*
|
|
49
|
+
* @param decomposedGoals - Set of goal IDs already decomposed this run.
|
|
50
|
+
* When provided, goals already in the set are skipped and the goal ID is
|
|
51
|
+
* added to the set after a successful decomposition attempt.
|
|
52
|
+
*/
|
|
53
|
+
export async function phaseAutoDecompose(goalId, goal, deps, config, logger, decomposedGoals, isFirstIteration) {
|
|
54
|
+
if (config.autoDecompose === false)
|
|
55
|
+
return;
|
|
56
|
+
if (!deps.treeLoopOrchestrator)
|
|
57
|
+
return;
|
|
58
|
+
if (goal.children_ids.length > 0) {
|
|
59
|
+
logger?.debug("[CoreLoop] phaseAutoDecompose: skipped — goal already has children", { goalId });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (goal.node_type === "leaf") {
|
|
63
|
+
logger?.debug("[CoreLoop] phaseAutoDecompose: skipped — goal is leaf", { goalId });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// Only auto-decompose root goals — prevent recursive decomposition of children
|
|
67
|
+
if ((goal.decomposition_depth ?? 0) > 0) {
|
|
68
|
+
logger?.debug("[CoreLoop] phaseAutoDecompose: skipped — non-root goal (depth > 0)", { goalId, depth: goal.decomposition_depth });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Skip if already decomposed this run
|
|
72
|
+
if (decomposedGoals?.has(goalId)) {
|
|
73
|
+
logger?.debug("[CoreLoop] phaseAutoDecompose: skipped — already decomposed this run", { goalId });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const force = isFirstIteration === true;
|
|
77
|
+
if (force) {
|
|
78
|
+
logger?.info("[decompose] forcing goal decomposition on first iteration", { goalId });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
logger?.info("[CoreLoop] phaseAutoDecompose: decomposing abstract goal", { goalId });
|
|
82
|
+
}
|
|
83
|
+
decomposedGoals?.add(goalId);
|
|
84
|
+
try {
|
|
85
|
+
await deps.treeLoopOrchestrator.ensureGoalRefined(goalId, { force });
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
logger?.warn("[CoreLoop] phaseAutoDecompose: ensureGoalRefined failed (non-fatal)", {
|
|
89
|
+
goalId,
|
|
90
|
+
error: err instanceof Error ? err.message : String(err),
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
logger?.info("[CoreLoop] phaseAutoDecompose: decomposition complete", { goalId });
|
|
95
|
+
}
|
|
96
|
+
// ─── Phase 2 helpers ───
|
|
97
|
+
/** Build a ToolCallContext from PhaseCtx for CoreLoop autonomous tool calls. */
|
|
98
|
+
export async function buildLoopToolContext(ctx, goalId) {
|
|
99
|
+
let trustBalance = 0;
|
|
100
|
+
if (ctx.deps.trustManager) {
|
|
101
|
+
try {
|
|
102
|
+
const balance = await ctx.deps.trustManager.getBalance(goalId);
|
|
103
|
+
trustBalance = balance.balance;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// Non-fatal — default to 0
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
cwd: process.cwd(),
|
|
111
|
+
goalId,
|
|
112
|
+
trustBalance,
|
|
113
|
+
preApproved: true,
|
|
114
|
+
approvalFn: async () => false,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// ─── Phase 2 ───
|
|
118
|
+
/** Run observation engine, reload goal after observation.
|
|
119
|
+
* Observation failure is non-fatal — returns current goal state.
|
|
120
|
+
* When ctx.toolExecutor is present, routes through the observe-goal tool first
|
|
121
|
+
* and falls back to direct engine.observe() on tool failure. */
|
|
122
|
+
export async function observeAndReload(ctx, goalId, goal, loopIndex) {
|
|
123
|
+
ctx.deps.onProgress?.({
|
|
124
|
+
iteration: loopIndex + 1,
|
|
125
|
+
maxIterations: ctx.config.maxIterations,
|
|
126
|
+
phase: "Observing...",
|
|
127
|
+
});
|
|
128
|
+
// Tool path: route through ToolExecutor when available
|
|
129
|
+
if (ctx.toolExecutor) {
|
|
130
|
+
try {
|
|
131
|
+
const toolCtx = await buildLoopToolContext(ctx, goalId);
|
|
132
|
+
const toolResult = await ctx.toolExecutor.execute("observe-goal", { goal_id: goalId }, toolCtx);
|
|
133
|
+
if (toolResult.success) {
|
|
134
|
+
const reloaded = await ctx.deps.stateManager.loadGoal(goalId);
|
|
135
|
+
if (reloaded)
|
|
136
|
+
return reloaded;
|
|
137
|
+
return goal;
|
|
138
|
+
}
|
|
139
|
+
ctx.logger?.warn(`CoreLoop: observe-goal tool failed: ${toolResult.error}, falling back to direct call`);
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
ctx.logger?.warn("CoreLoop: observe-goal tool threw (falling back to direct call)", { error: err instanceof Error ? err.message : String(err) });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Direct path: fallback (or when toolExecutor is absent)
|
|
146
|
+
try {
|
|
147
|
+
const engine = ctx.deps.observationEngine;
|
|
148
|
+
ctx.logger?.debug("CoreLoop: engine.getDataSources exists", { exists: true });
|
|
149
|
+
const dataSources = engine.getDataSources();
|
|
150
|
+
ctx.logger?.debug("CoreLoop: observation setup", { dataSourceCount: dataSources.length });
|
|
151
|
+
await engine.observe(goalId, []);
|
|
152
|
+
const reloaded = await ctx.deps.stateManager.loadGoal(goalId);
|
|
153
|
+
if (reloaded)
|
|
154
|
+
return reloaded;
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
ctx.logger?.warn("CoreLoop: observation failed (non-fatal)", { error: err instanceof Error ? err.message : String(err) });
|
|
158
|
+
}
|
|
159
|
+
return goal;
|
|
160
|
+
}
|
|
161
|
+
// ─── Phase 3 ───
|
|
162
|
+
/** Calculate gap vector and aggregate.
|
|
163
|
+
* Returns null on error.
|
|
164
|
+
* When gap === 0, returns the gap result with skipTaskGeneration=true so the
|
|
165
|
+
* caller continues to Phase 5 (SatisficingJudge) instead of short-circuiting.
|
|
166
|
+
*/
|
|
167
|
+
export async function calculateGapOrComplete(ctx, goalId, goal, loopIndex, result, startTime) {
|
|
168
|
+
let gapVector;
|
|
169
|
+
let gapAggregate;
|
|
170
|
+
try {
|
|
171
|
+
// Refresh stale dimensions via tool measurement before gap calculation
|
|
172
|
+
if (ctx.toolExecutor && goal.dimensions) {
|
|
173
|
+
const { needsDirectMeasurement, measureDirectly } = await import("../../../platform/drive/gap-calculator-tools.js");
|
|
174
|
+
let anyRefreshed = false;
|
|
175
|
+
for (const dim of goal.dimensions) {
|
|
176
|
+
if (needsDirectMeasurement(dim)) {
|
|
177
|
+
try {
|
|
178
|
+
const refreshed = await measureDirectly(dim, ctx.toolExecutor, {
|
|
179
|
+
cwd: process.cwd(),
|
|
180
|
+
goalId,
|
|
181
|
+
trustBalance: 0,
|
|
182
|
+
preApproved: true,
|
|
183
|
+
approvalFn: async () => false,
|
|
184
|
+
});
|
|
185
|
+
if (refreshed !== null) {
|
|
186
|
+
dim.current_value = refreshed.value;
|
|
187
|
+
dim.confidence = refreshed.confidence;
|
|
188
|
+
anyRefreshed = true;
|
|
189
|
+
ctx.logger?.debug(`[GapRefresh] Refreshed stale dimension ${dim.name}: confidence ${dim.confidence}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
ctx.logger?.warn(`[GapRefresh] Failed to refresh ${dim.name}: ${err instanceof Error ? err.message : String(err)}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Persist refreshed dimension values to avoid re-measuring on the next iteration
|
|
198
|
+
if (anyRefreshed) {
|
|
199
|
+
try {
|
|
200
|
+
await ctx.deps.stateManager.saveGoal(goal);
|
|
201
|
+
ctx.logger?.debug('[GapRefresh] Persisted refreshed dimensions for goal ' + goalId);
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
ctx.logger?.warn?.('[GapRefresh] Failed to persist refreshed dimensions: ' + String(err));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
gapVector = ctx.deps.gapCalculator.calculateGapVector(goalId, goal.dimensions, goal.uncertainty_weight);
|
|
209
|
+
const gapValues = gapVector.gaps.map((g) => g.normalized_weighted_gap);
|
|
210
|
+
gapAggregate = ctx.deps.gapCalculator.aggregateGaps(gapValues, goal.gap_aggregation);
|
|
211
|
+
result.gapAggregate = gapAggregate;
|
|
212
|
+
await ctx.deps.stateManager.appendGapHistoryEntry(goalId, {
|
|
213
|
+
iteration: loopIndex,
|
|
214
|
+
timestamp: new Date().toISOString(),
|
|
215
|
+
gap_vector: gapVector.gaps.map((g) => ({
|
|
216
|
+
dimension_name: g.dimension_name,
|
|
217
|
+
normalized_weighted_gap: g.normalized_weighted_gap,
|
|
218
|
+
})),
|
|
219
|
+
confidence_vector: gapVector.gaps.map((g) => ({
|
|
220
|
+
dimension_name: g.dimension_name,
|
|
221
|
+
confidence: g.confidence,
|
|
222
|
+
})),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
result.error = `Gap calculation failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
227
|
+
ctx.logger?.error(`CoreLoop: ${result.error}`, { goalId });
|
|
228
|
+
result.elapsedMs = Date.now() - startTime;
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
// Gap zero check — gap is satisfied; skip task generation but continue to
|
|
232
|
+
// Phase 5 so SatisficingJudge can enforce confidence and double-confirmation.
|
|
233
|
+
if (gapAggregate === 0) {
|
|
234
|
+
ctx.logger?.info(`[CoreLoop] gap=0 for goal ${goalId} — skipping task generation, deferring to SatisficingJudge`);
|
|
235
|
+
return { gapVector, gapAggregate, skipTaskGeneration: true };
|
|
236
|
+
}
|
|
237
|
+
const avgConf = gapVector.gaps.length > 0
|
|
238
|
+
? gapVector.gaps.reduce((s, g) => s + g.confidence, 0) / gapVector.gaps.length
|
|
239
|
+
: undefined;
|
|
240
|
+
ctx.deps.onProgress?.({
|
|
241
|
+
iteration: loopIndex + 1,
|
|
242
|
+
maxIterations: ctx.config.maxIterations,
|
|
243
|
+
phase: "Generating task...",
|
|
244
|
+
gap: gapAggregate,
|
|
245
|
+
confidence: avgConf,
|
|
246
|
+
});
|
|
247
|
+
return { gapVector, gapAggregate };
|
|
248
|
+
}
|
|
249
|
+
// ─── Phase 4 ───
|
|
250
|
+
/** Score drives, update DriveScoreAdapter, check knowledge gap.
|
|
251
|
+
* Returns ranked DriveScores with highDissatisfactionDimensions, or null if the caller should
|
|
252
|
+
* return result early (knowledge gap task generated or drive scoring failed). */
|
|
253
|
+
export async function scoreDrivesAndCheckKnowledge(ctx, goalId, goal, gapVector, loopIndex, result, startTime, tryGenerateReport) {
|
|
254
|
+
let driveScores;
|
|
255
|
+
let highDissatisfactionDimensions = [];
|
|
256
|
+
try {
|
|
257
|
+
const driveContext = buildDriveContext(goal);
|
|
258
|
+
driveScores = ctx.deps.driveScorer.scoreAllDimensions(gapVector, driveContext);
|
|
259
|
+
const rankedScores = ctx.deps.driveScorer.rankDimensions(driveScores);
|
|
260
|
+
result.driveScores = rankedScores;
|
|
261
|
+
driveScores = rankedScores;
|
|
262
|
+
if (ctx.deps.driveScoreAdapter) {
|
|
263
|
+
ctx.deps.driveScoreAdapter.update(driveScores);
|
|
264
|
+
}
|
|
265
|
+
// Extract dimensions with high dissatisfaction (> 0.7) for memory tier promotion
|
|
266
|
+
highDissatisfactionDimensions = driveScores
|
|
267
|
+
.filter((s) => s.dissatisfaction > 0.7)
|
|
268
|
+
.map((s) => s.dimension_name);
|
|
269
|
+
// Consolidated reward computation log (PULSEED_REWARD_LOG=1 to enable)
|
|
270
|
+
const confidenceAvg = gapVector.gaps.reduce((sum, g) => sum + g.confidence, 0) /
|
|
271
|
+
Math.max(gapVector.gaps.length, 1);
|
|
272
|
+
let trustScore = null;
|
|
273
|
+
if (ctx.deps.trustManager) {
|
|
274
|
+
try {
|
|
275
|
+
const balance = await ctx.deps.trustManager.getBalance(ctx.config.adapterType);
|
|
276
|
+
trustScore = balance.balance;
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
// Non-fatal: trust score is diagnostic-only
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
logRewardComputation({
|
|
283
|
+
goalId,
|
|
284
|
+
iteration: loopIndex,
|
|
285
|
+
gapAggregate: result.gapAggregate ?? 0,
|
|
286
|
+
confidenceAvg,
|
|
287
|
+
trustScore,
|
|
288
|
+
driveScores,
|
|
289
|
+
completionJudgment: null,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
result.error = `Drive scoring failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
294
|
+
ctx.logger?.error(`CoreLoop: ${result.error}`, { goalId });
|
|
295
|
+
result.elapsedMs = Date.now() - startTime;
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
// Knowledge gap check
|
|
299
|
+
if (ctx.deps.knowledgeManager) {
|
|
300
|
+
try {
|
|
301
|
+
let strategies = null;
|
|
302
|
+
try {
|
|
303
|
+
const portfolio = await ctx.deps.strategyManager.getPortfolio(goalId);
|
|
304
|
+
strategies = portfolio !== null ? portfolio.strategies : null;
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
// If strategy loading fails, leave as null
|
|
308
|
+
}
|
|
309
|
+
const observationContext = {
|
|
310
|
+
observations: goal.dimensions.map((d) => ({
|
|
311
|
+
name: d.name,
|
|
312
|
+
current_value: d.current_value,
|
|
313
|
+
confidence: d.confidence,
|
|
314
|
+
})),
|
|
315
|
+
strategies,
|
|
316
|
+
confidence: gapVector.gaps.reduce((sum, g) => sum + g.confidence, 0) /
|
|
317
|
+
Math.max(gapVector.gaps.length, 1),
|
|
318
|
+
};
|
|
319
|
+
// Skip knowledge gap detection when:
|
|
320
|
+
// 1. Observations are purely self-report (confidence <= 0.3, no data sources)
|
|
321
|
+
// 2. Not the first iteration — prevents repeated gap detection from blocking
|
|
322
|
+
// task execution every loop. Gap detection runs once; after that, let the
|
|
323
|
+
// normal task cycle proceed.
|
|
324
|
+
const skipGapDetection = observationContext.confidence <= 0.3 ||
|
|
325
|
+
!Number.isFinite(observationContext.confidence) ||
|
|
326
|
+
loopIndex > 0;
|
|
327
|
+
const gapSignal = skipGapDetection
|
|
328
|
+
? null
|
|
329
|
+
: await ctx.deps.knowledgeManager.detectKnowledgeGap(observationContext);
|
|
330
|
+
if (gapSignal !== null) {
|
|
331
|
+
const acquisitionTask = await ctx.deps.knowledgeManager.generateAcquisitionTask(gapSignal, goalId);
|
|
332
|
+
const acquisitionVerification = {
|
|
333
|
+
task_id: acquisitionTask.id,
|
|
334
|
+
verdict: "pass",
|
|
335
|
+
confidence: 0.9,
|
|
336
|
+
evidence: [
|
|
337
|
+
{
|
|
338
|
+
layer: "mechanical",
|
|
339
|
+
description: "Knowledge acquisition task generated for gap: " + gapSignal.signal_type,
|
|
340
|
+
confidence: 0.9,
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
dimension_updates: [],
|
|
344
|
+
timestamp: new Date().toISOString(),
|
|
345
|
+
};
|
|
346
|
+
result.taskResult = {
|
|
347
|
+
task: acquisitionTask,
|
|
348
|
+
verificationResult: acquisitionVerification,
|
|
349
|
+
action: "completed",
|
|
350
|
+
};
|
|
351
|
+
tryGenerateReport(goalId, loopIndex, result, goal);
|
|
352
|
+
result.elapsedMs = Date.now() - startTime;
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
// Knowledge gap detection failure is non-fatal
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return { driveScores, highDissatisfactionDimensions };
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=preparation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.js","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/preparation.ts"],"names":[],"m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AE,EAAE;oBACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;gBACF,MAAM,CAAC,UAAU,GAAG;oBAClB,IAAI,EAAE,eAAe;oBACrB,kBAAkB,EAAE,uBAAuB;oBAC3C,MAAM,EAAE,WAAW;iBACpB,CAAC;gBACF,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBACnD,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;gBAC1C,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,+CAA+C;QACjD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion checks, stall handling, and task execution for a CoreLoop iteration.
|
|
3
|
+
*/
|
|
4
|
+
import type { Goal } from "../../../base/types/goal.js";
|
|
5
|
+
import type { GapVector } from "../../../base/types/gap.js";
|
|
6
|
+
import type { DriveScore } from "../../../base/types/drive.js";
|
|
7
|
+
import { type LoopIterationResult } from "./contracts.js";
|
|
8
|
+
import type { PhaseCtx } from "./preparation.js";
|
|
9
|
+
import type { CapabilityAcquisitionOutcome } from "./capability.js";
|
|
10
|
+
/** Completion check + milestone deadline check.
|
|
11
|
+
* Sets result.error on fatal failure, sets result.completionJudgment. */
|
|
12
|
+
export declare function checkCompletionAndMilestones(ctx: PhaseCtx, goalId: string, goal: Goal, result: LoopIterationResult, startTime: number): Promise<void>;
|
|
13
|
+
/** Stall detection per-dimension and globally, plus portfolio rebalance. */
|
|
14
|
+
export declare function detectStallsAndRebalance(ctx: PhaseCtx, goalId: string, goal: Goal, result: LoopIterationResult): Promise<void>;
|
|
15
|
+
/** Check dependency graph block.
|
|
16
|
+
* Returns true if goal is blocked (result.error set, caller should return). */
|
|
17
|
+
export declare function checkDependencyBlock(ctx: PhaseCtx, goalId: string, result: LoopIterationResult): boolean;
|
|
18
|
+
/** Callbacks passed to runTaskCycleWithContext to keep mutable state and side-effects on CoreLoop. */
|
|
19
|
+
export interface LoopCallbacks {
|
|
20
|
+
handleCapabilityAcquisition: (task: unknown, goalId: string, adapter: unknown) => Promise<CapabilityAcquisitionOutcome | void>;
|
|
21
|
+
incrementTransferCounter: () => number;
|
|
22
|
+
tryGenerateReport: (goalId: string, loopIndex: number, result: LoopIterationResult, goal: Goal) => void;
|
|
23
|
+
}
|
|
24
|
+
/** Collect context, run task cycle, handle capability acquisition,
|
|
25
|
+
* transfer detection, and post-task completion re-check.
|
|
26
|
+
* Returns true on success, false if the caller should return result early.
|
|
27
|
+
* `transferCheckCounter` is incremented via the callback to keep mutable state on CoreLoop. */
|
|
28
|
+
export declare function runTaskCycleWithContext(ctx: PhaseCtx, goalId: string, goal: Goal, gapVector: GapVector, driveScores: DriveScore[], highDissatisfactionDimensions: string[], loopIndex: number, result: LoopIterationResult, startTime: number, callbacks: LoopCallbacks): Promise<boolean>;
|
|
29
|
+
//# sourceMappingURL=task-cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-cycle.d.ts","sourceRoot":"","sources":["../../../../src/orchestrator/loop/core-loop/task-cycle.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,4BAA4B,CAAC;AAE7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAYjD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAIpE;yEACyE;AAC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