pulseed 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/state/state-manager-goal-state.d.ts +40 -0
- package/dist/base/state/state-manager-goal-state.d.ts.map +1 -0
- package/dist/base/state/state-manager-goal-state.js +235 -0
- package/dist/base/state/state-manager-goal-state.js.map +1 -0
- package/dist/base/state/state-manager.d.ts +0 -5
- package/dist/base/state/state-manager.d.ts.map +1 -1
- package/dist/base/state/state-manager.js +27 -273
- package/dist/base/state/state-manager.js.map +1 -1
- package/dist/base/types/goal-activation.d.ts +25 -0
- package/dist/base/types/goal-activation.d.ts.map +1 -0
- package/dist/base/types/goal-activation.js +9 -0
- package/dist/base/types/goal-activation.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/chat/chat-event-state.d.ts +10 -0
- package/dist/interface/chat/chat-event-state.d.ts.map +1 -1
- package/dist/interface/chat/chat-event-state.js +184 -9
- package/dist/interface/chat/chat-event-state.js.map +1 -1
- package/dist/interface/chat/chat-events.d.ts +3 -1
- package/dist/interface/chat/chat-events.d.ts.map +1 -1
- package/dist/interface/chat/chat-history.d.ts +129 -0
- package/dist/interface/chat/chat-history.d.ts.map +1 -1
- package/dist/interface/chat/chat-history.js +135 -0
- package/dist/interface/chat/chat-history.js.map +1 -1
- package/dist/interface/chat/chat-runner-command-helpers.d.ts +50 -0
- package/dist/interface/chat/chat-runner-command-helpers.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-command-helpers.js +189 -0
- package/dist/interface/chat/chat-runner-command-helpers.js.map +1 -0
- package/dist/interface/chat/chat-runner-commands.d.ts +76 -0
- package/dist/interface/chat/chat-runner-commands.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-commands.js +814 -0
- package/dist/interface/chat/chat-runner-commands.js.map +1 -0
- package/dist/interface/chat/chat-runner-event-bridge.d.ts +53 -0
- package/dist/interface/chat/chat-runner-event-bridge.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-event-bridge.js +311 -0
- package/dist/interface/chat/chat-runner-event-bridge.js.map +1 -0
- package/dist/interface/chat/chat-runner-routes.d.ts +67 -0
- package/dist/interface/chat/chat-runner-routes.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-routes.js +594 -0
- package/dist/interface/chat/chat-runner-routes.js.map +1 -0
- package/dist/interface/chat/chat-runner-runtime.d.ts +37 -0
- package/dist/interface/chat/chat-runner-runtime.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-runtime.js +236 -0
- package/dist/interface/chat/chat-runner-runtime.js.map +1 -0
- package/dist/interface/chat/chat-runner-state.d.ts +20 -0
- package/dist/interface/chat/chat-runner-state.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-state.js +157 -0
- package/dist/interface/chat/chat-runner-state.js.map +1 -0
- package/dist/interface/chat/chat-runner-support.d.ts +15 -0
- package/dist/interface/chat/chat-runner-support.d.ts.map +1 -0
- package/dist/interface/chat/chat-runner-support.js +116 -0
- package/dist/interface/chat/chat-runner-support.js.map +1 -0
- package/dist/interface/chat/chat-runner.d.ts +13 -133
- package/dist/interface/chat/chat-runner.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner.js +242 -1974
- package/dist/interface/chat/chat-runner.js.map +1 -1
- package/dist/interface/chat/chat-session-store.d.ts +32 -0
- package/dist/interface/chat/chat-session-store.d.ts.map +1 -1
- package/dist/interface/chat/chat-session-store.js +100 -10
- package/dist/interface/chat/chat-session-store.js.map +1 -1
- package/dist/interface/chat/chat-verifier.d.ts +3 -1
- package/dist/interface/chat/chat-verifier.d.ts.map +1 -1
- package/dist/interface/chat/chat-verifier.js +2 -2
- package/dist/interface/chat/chat-verifier.js.map +1 -1
- package/dist/interface/chat/cross-platform-session.d.ts +1 -0
- package/dist/interface/chat/cross-platform-session.d.ts.map +1 -1
- package/dist/interface/chat/cross-platform-session.js +23 -2
- 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 +41 -0
- package/dist/interface/chat/event-subscriber.js.map +1 -1
- package/dist/interface/chat/failure-recovery.d.ts +11 -0
- package/dist/interface/chat/failure-recovery.d.ts.map +1 -0
- package/dist/interface/chat/failure-recovery.js +115 -0
- package/dist/interface/chat/failure-recovery.js.map +1 -0
- package/dist/interface/chat/ingress-router.d.ts +0 -16
- package/dist/interface/chat/ingress-router.d.ts.map +1 -1
- package/dist/interface/chat/ingress-router.js +12 -51
- package/dist/interface/chat/ingress-router.js.map +1 -1
- package/dist/interface/chat/tend-command.d.ts +8 -0
- package/dist/interface/chat/tend-command.d.ts.map +1 -1
- package/dist/interface/chat/tend-command.js +82 -4
- 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 +4 -0
- package/dist/interface/cli/cli-command-registry.js.map +1 -1
- package/dist/interface/cli/commands/daemon-shared.d.ts +32 -0
- package/dist/interface/cli/commands/daemon-shared.d.ts.map +1 -0
- package/dist/interface/cli/commands/daemon-shared.js +120 -0
- package/dist/interface/cli/commands/daemon-shared.js.map +1 -0
- package/dist/interface/cli/commands/daemon.d.ts +2 -2
- package/dist/interface/cli/commands/daemon.d.ts.map +1 -1
- package/dist/interface/cli/commands/daemon.js +4 -120
- package/dist/interface/cli/commands/daemon.js.map +1 -1
- package/dist/interface/cli/commands/runtime.d.ts +3 -0
- package/dist/interface/cli/commands/runtime.d.ts.map +1 -0
- package/dist/interface/cli/commands/runtime.js +231 -0
- package/dist/interface/cli/commands/runtime.js.map +1 -0
- package/dist/interface/cli/commands/schedule/history.d.ts.map +1 -1
- package/dist/interface/cli/commands/schedule/history.js +5 -1
- package/dist/interface/cli/commands/schedule/history.js.map +1 -1
- package/dist/interface/cli/commands/schedule.js +34 -4
- package/dist/interface/cli/commands/schedule.js.map +1 -1
- package/dist/interface/cli/utils.d.ts.map +1 -1
- package/dist/interface/cli/utils.js +4 -0
- package/dist/interface/cli/utils.js.map +1 -1
- package/dist/interface/tui/app.d.ts.map +1 -1
- package/dist/interface/tui/app.js +35 -1
- package/dist/interface/tui/app.js.map +1 -1
- package/dist/interface/tui/chat/scroll.d.ts +3 -0
- package/dist/interface/tui/chat/scroll.d.ts.map +1 -1
- package/dist/interface/tui/chat/scroll.js +15 -0
- package/dist/interface/tui/chat/scroll.js.map +1 -1
- package/dist/interface/tui/chat/suggestions.d.ts.map +1 -1
- package/dist/interface/tui/chat/suggestions.js +118 -4
- package/dist/interface/tui/chat/suggestions.js.map +1 -1
- package/dist/interface/tui/chat/types.d.ts +1 -1
- package/dist/interface/tui/chat/types.d.ts.map +1 -1
- package/dist/interface/tui/chat/viewport.d.ts.map +1 -1
- package/dist/interface/tui/chat/viewport.js +8 -2
- package/dist/interface/tui/chat/viewport.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 +11 -0
- package/dist/interface/tui/chat-surface.js.map +1 -1
- package/dist/interface/tui/chat.d.ts.map +1 -1
- package/dist/interface/tui/chat.js +15 -7
- package/dist/interface/tui/chat.js.map +1 -1
- package/dist/interface/tui/clipboard.d.ts +6 -1
- package/dist/interface/tui/clipboard.d.ts.map +1 -1
- package/dist/interface/tui/clipboard.js +24 -5
- package/dist/interface/tui/clipboard.js.map +1 -1
- package/dist/interface/tui/entry-approval.d.ts +8 -0
- package/dist/interface/tui/entry-approval.d.ts.map +1 -0
- package/dist/interface/tui/entry-approval.js +59 -0
- package/dist/interface/tui/entry-approval.js.map +1 -0
- package/dist/interface/tui/entry-daemon.d.ts +12 -0
- package/dist/interface/tui/entry-daemon.d.ts.map +1 -0
- package/dist/interface/tui/entry-daemon.js +74 -0
- package/dist/interface/tui/entry-daemon.js.map +1 -0
- package/dist/interface/tui/entry-deps.d.ts +22 -0
- package/dist/interface/tui/entry-deps.d.ts.map +1 -0
- package/dist/interface/tui/entry-deps.js +409 -0
- package/dist/interface/tui/entry-deps.js.map +1 -0
- package/dist/interface/tui/entry.d.ts +2 -4
- package/dist/interface/tui/entry.d.ts.map +1 -1
- package/dist/interface/tui/entry.js +15 -550
- package/dist/interface/tui/entry.js.map +1 -1
- package/dist/interface/tui/flicker/MouseTracking.d.ts +1 -1
- package/dist/interface/tui/flicker/MouseTracking.d.ts.map +1 -1
- package/dist/interface/tui/flicker/MouseTracking.js +8 -4
- package/dist/interface/tui/flicker/MouseTracking.js.map +1 -1
- package/dist/interface/tui/fullscreen-chat-render.d.ts +127 -0
- package/dist/interface/tui/fullscreen-chat-render.d.ts.map +1 -0
- package/dist/interface/tui/fullscreen-chat-render.js +667 -0
- package/dist/interface/tui/fullscreen-chat-render.js.map +1 -0
- package/dist/interface/tui/fullscreen-chat.d.ts +1 -29
- package/dist/interface/tui/fullscreen-chat.d.ts.map +1 -1
- package/dist/interface/tui/fullscreen-chat.js +306 -411
- package/dist/interface/tui/fullscreen-chat.js.map +1 -1
- package/dist/interface/tui/help-overlay.d.ts.map +1 -1
- package/dist/interface/tui/help-overlay.js +1 -1
- package/dist/interface/tui/help-overlay.js.map +1 -1
- package/dist/interface/tui/intent-recognizer.js +2 -2
- package/dist/interface/tui/intent-recognizer.js.map +1 -1
- package/dist/interface/tui/markdown-renderer.d.ts.map +1 -1
- package/dist/interface/tui/markdown-renderer.js +40 -12
- package/dist/interface/tui/markdown-renderer.js.map +1 -1
- package/dist/interface/tui/test-entry.js +1 -1
- package/dist/interface/tui/test-entry.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.js +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-context-assembler.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 +35 -13
- package/dist/orchestrator/execution/agent-loop/agent-loop-default-profile.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.js +7 -4
- package/dist/orchestrator/execution/agent-loop/agent-loop-dogfood-benchmark.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js +2 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-router.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts +2 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js +31 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-tool-runtime.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/agent-loop-turn-context.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +42 -2
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js +3 -1
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.d.ts +19 -0
- 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 +164 -14
- package/dist/orchestrator/execution/agent-loop/core-loop-control-tools.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/index.d.ts +1 -0
- package/dist/orchestrator/execution/agent-loop/index.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/index.js +1 -0
- package/dist/orchestrator/execution/agent-loop/index.js.map +1 -1
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts +34 -0
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.d.ts.map +1 -0
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js +54 -0
- package/dist/orchestrator/execution/agent-loop/kaggle-training-benchmark.js.map +1 -0
- package/dist/orchestrator/execution/reflection-generator.d.ts +1 -0
- package/dist/orchestrator/execution/reflection-generator.d.ts.map +1 -1
- package/dist/orchestrator/execution/reflection-generator.js +10 -1
- package/dist/orchestrator/execution/reflection-generator.js.map +1 -1
- package/dist/orchestrator/execution/task/task-context-enricher.d.ts +2 -0
- package/dist/orchestrator/execution/task/task-context-enricher.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-context-enricher.js +9 -4
- package/dist/orchestrator/execution/task/task-context-enricher.js.map +1 -1
- package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts +5 -0
- package/dist/orchestrator/execution/task/task-execution-helpers-internal.d.ts.map +1 -0
- package/dist/orchestrator/execution/task/task-execution-helpers-internal.js +6 -0
- package/dist/orchestrator/execution/task/task-execution-helpers-internal.js.map +1 -0
- package/dist/orchestrator/execution/task/task-generation.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-generation.js +8 -3
- package/dist/orchestrator/execution/task/task-generation.js.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts +73 -0
- package/dist/orchestrator/execution/task/task-lifecycle-runner.d.ts.map +1 -0
- package/dist/orchestrator/execution/task/task-lifecycle-runner.js +184 -0
- package/dist/orchestrator/execution/task/task-lifecycle-runner.js.map +1 -0
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts +7 -7
- package/dist/orchestrator/execution/task/task-lifecycle.d.ts.map +1 -1
- package/dist/orchestrator/execution/task/task-lifecycle.js +37 -181
- package/dist/orchestrator/execution/task/task-lifecycle.js.map +1 -1
- package/dist/orchestrator/execution/task/task-verifier-internal.d.ts +2 -0
- package/dist/orchestrator/execution/task/task-verifier-internal.d.ts.map +1 -0
- package/dist/orchestrator/execution/task/task-verifier-internal.js +2 -0
- package/dist/orchestrator/execution/task/task-verifier-internal.js.map +1 -0
- package/dist/orchestrator/goal/goal-negotiator.d.ts.map +1 -1
- package/dist/orchestrator/goal/goal-negotiator.js +23 -3
- package/dist/orchestrator/goal/goal-negotiator.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/contracts.d.ts +1 -0
- 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/iteration-kernel-knowledge.d.ts +7 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js +43 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-knowledge.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts +14 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js +41 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel-wait.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts +3 -2
- package/dist/orchestrator/loop/core-loop/iteration-kernel.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/iteration-kernel.js +16 -87
- 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 +8 -5
- package/dist/orchestrator/loop/core-loop/phase-policy.js.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts +9 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.js +297 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-stall.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts +11 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-wait.d.ts.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-wait.js +176 -0
- package/dist/orchestrator/loop/core-loop/task-cycle-wait.js.map +1 -0
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts +3 -15
- package/dist/orchestrator/loop/core-loop/task-cycle.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/task-cycle.js +10 -444
- package/dist/orchestrator/loop/core-loop/task-cycle.js.map +1 -1
- package/dist/orchestrator/loop/core-loop.d.ts +3 -0
- package/dist/orchestrator/loop/core-loop.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop.js +4 -0
- package/dist/orchestrator/loop/core-loop.js.map +1 -1
- package/dist/orchestrator/strategy/portfolio-manager.d.ts +3 -2
- package/dist/orchestrator/strategy/portfolio-manager.d.ts.map +1 -1
- package/dist/orchestrator/strategy/portfolio-manager.js +16 -11
- package/dist/orchestrator/strategy/portfolio-manager.js.map +1 -1
- package/dist/orchestrator/strategy/portfolio-rebalance.d.ts +1 -1
- package/dist/orchestrator/strategy/portfolio-rebalance.d.ts.map +1 -1
- package/dist/orchestrator/strategy/portfolio-rebalance.js +31 -9
- package/dist/orchestrator/strategy/portfolio-rebalance.js.map +1 -1
- package/dist/orchestrator/strategy/strategy-manager-base.d.ts +12 -2
- package/dist/orchestrator/strategy/strategy-manager-base.d.ts.map +1 -1
- package/dist/orchestrator/strategy/strategy-manager-base.js +23 -7
- package/dist/orchestrator/strategy/strategy-manager-base.js.map +1 -1
- package/dist/orchestrator/strategy/strategy-manager.d.ts +1 -11
- package/dist/orchestrator/strategy/strategy-manager.d.ts.map +1 -1
- package/dist/orchestrator/strategy/strategy-manager.js +78 -19
- package/dist/orchestrator/strategy/strategy-manager.js.map +1 -1
- package/dist/platform/code-search/candidate-normalizer.d.ts +3 -0
- package/dist/platform/code-search/candidate-normalizer.d.ts.map +1 -0
- package/dist/platform/code-search/candidate-normalizer.js +61 -0
- package/dist/platform/code-search/candidate-normalizer.js.map +1 -0
- package/dist/platform/code-search/candidate.d.ts +25 -0
- package/dist/platform/code-search/candidate.d.ts.map +1 -0
- package/dist/platform/code-search/candidate.js +61 -0
- package/dist/platform/code-search/candidate.js.map +1 -0
- package/dist/platform/code-search/contracts.d.ts +275 -0
- package/dist/platform/code-search/contracts.d.ts.map +1 -0
- package/dist/platform/code-search/contracts.js +22 -0
- package/dist/platform/code-search/contracts.js.map +1 -0
- package/dist/platform/code-search/eval/fixtures.d.ts +14 -0
- package/dist/platform/code-search/eval/fixtures.d.ts.map +1 -0
- package/dist/platform/code-search/eval/fixtures.js +24 -0
- package/dist/platform/code-search/eval/fixtures.js.map +1 -0
- package/dist/platform/code-search/eval/metrics.d.ts +10 -0
- package/dist/platform/code-search/eval/metrics.d.ts.map +1 -0
- package/dist/platform/code-search/eval/metrics.js +20 -0
- package/dist/platform/code-search/eval/metrics.js.map +1 -0
- package/dist/platform/code-search/eval/runner.d.ts +3 -0
- package/dist/platform/code-search/eval/runner.d.ts.map +1 -0
- package/dist/platform/code-search/eval/runner.js +13 -0
- package/dist/platform/code-search/eval/runner.js.map +1 -0
- package/dist/platform/code-search/fusion.d.ts +6 -0
- package/dist/platform/code-search/fusion.d.ts.map +1 -0
- package/dist/platform/code-search/fusion.js +12 -0
- package/dist/platform/code-search/fusion.js.map +1 -0
- package/dist/platform/code-search/generated-detector.d.ts +15 -0
- package/dist/platform/code-search/generated-detector.d.ts.map +1 -0
- package/dist/platform/code-search/generated-detector.js +42 -0
- package/dist/platform/code-search/generated-detector.js.map +1 -0
- package/dist/platform/code-search/indexes/call-graph.d.ts +3 -0
- package/dist/platform/code-search/indexes/call-graph.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/call-graph.js +13 -0
- package/dist/platform/code-search/indexes/call-graph.js.map +1 -0
- package/dist/platform/code-search/indexes/config-index.d.ts +3 -0
- package/dist/platform/code-search/indexes/config-index.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/config-index.js +7 -0
- package/dist/platform/code-search/indexes/config-index.js.map +1 -0
- package/dist/platform/code-search/indexes/file-index.d.ts +5 -0
- package/dist/platform/code-search/indexes/file-index.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/file-index.js +106 -0
- package/dist/platform/code-search/indexes/file-index.js.map +1 -0
- package/dist/platform/code-search/indexes/index-store.d.ts +6 -0
- package/dist/platform/code-search/indexes/index-store.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/index-store.js +14 -0
- package/dist/platform/code-search/indexes/index-store.js.map +1 -0
- package/dist/platform/code-search/indexes/indexer.d.ts +3 -0
- package/dist/platform/code-search/indexes/indexer.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/indexer.js +27 -0
- package/dist/platform/code-search/indexes/indexer.js.map +1 -0
- package/dist/platform/code-search/indexes/package-graph.d.ts +3 -0
- package/dist/platform/code-search/indexes/package-graph.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/package-graph.js +26 -0
- package/dist/platform/code-search/indexes/package-graph.js.map +1 -0
- package/dist/platform/code-search/indexes/repo-map-index.d.ts +3 -0
- package/dist/platform/code-search/indexes/repo-map-index.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/repo-map-index.js +26 -0
- package/dist/platform/code-search/indexes/repo-map-index.js.map +1 -0
- package/dist/platform/code-search/indexes/semantic-index.d.ts +3 -0
- package/dist/platform/code-search/indexes/semantic-index.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/semantic-index.js +4 -0
- package/dist/platform/code-search/indexes/semantic-index.js.map +1 -0
- package/dist/platform/code-search/indexes/symbol-index.d.ts +3 -0
- package/dist/platform/code-search/indexes/symbol-index.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/symbol-index.js +84 -0
- package/dist/platform/code-search/indexes/symbol-index.js.map +1 -0
- package/dist/platform/code-search/indexes/test-index.d.ts +3 -0
- package/dist/platform/code-search/indexes/test-index.d.ts.map +1 -0
- package/dist/platform/code-search/indexes/test-index.js +22 -0
- package/dist/platform/code-search/indexes/test-index.js.map +1 -0
- package/dist/platform/code-search/orchestrator.d.ts +9 -0
- package/dist/platform/code-search/orchestrator.d.ts.map +1 -0
- package/dist/platform/code-search/orchestrator.js +81 -0
- package/dist/platform/code-search/orchestrator.js.map +1 -0
- package/dist/platform/code-search/path-policy.d.ts +6 -0
- package/dist/platform/code-search/path-policy.d.ts.map +1 -0
- package/dist/platform/code-search/path-policy.js +60 -0
- package/dist/platform/code-search/path-policy.js.map +1 -0
- package/dist/platform/code-search/progressive-reader.d.ts +8 -0
- package/dist/platform/code-search/progressive-reader.d.ts.map +1 -0
- package/dist/platform/code-search/progressive-reader.js +173 -0
- package/dist/platform/code-search/progressive-reader.js.map +1 -0
- package/dist/platform/code-search/query-planner.d.ts +4 -0
- package/dist/platform/code-search/query-planner.d.ts.map +1 -0
- package/dist/platform/code-search/query-planner.js +107 -0
- package/dist/platform/code-search/query-planner.js.map +1 -0
- package/dist/platform/code-search/reranker.d.ts +4 -0
- package/dist/platform/code-search/reranker.d.ts.map +1 -0
- package/dist/platform/code-search/reranker.js +57 -0
- package/dist/platform/code-search/reranker.js.map +1 -0
- package/dist/platform/code-search/retrievers/callgraph-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/callgraph-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/callgraph-retriever.js +31 -0
- package/dist/platform/code-search/retrievers/callgraph-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/config-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/config-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/config-retriever.js +23 -0
- package/dist/platform/code-search/retrievers/config-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/lexical-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/lexical-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/lexical-retriever.js +49 -0
- package/dist/platform/code-search/retrievers/lexical-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/package-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/package-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/package-retriever.js +29 -0
- package/dist/platform/code-search/retrievers/package-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/repo-map-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/repo-map-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/repo-map-retriever.js +30 -0
- package/dist/platform/code-search/retrievers/repo-map-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/semantic-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/semantic-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/semantic-retriever.js +18 -0
- package/dist/platform/code-search/retrievers/semantic-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/stacktrace-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/stacktrace-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/stacktrace-retriever.js +30 -0
- package/dist/platform/code-search/retrievers/stacktrace-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/symbol-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/symbol-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/symbol-retriever.js +32 -0
- package/dist/platform/code-search/retrievers/symbol-retriever.js.map +1 -0
- package/dist/platform/code-search/retrievers/test-retriever.d.ts +6 -0
- package/dist/platform/code-search/retrievers/test-retriever.d.ts.map +1 -0
- package/dist/platform/code-search/retrievers/test-retriever.js +30 -0
- package/dist/platform/code-search/retrievers/test-retriever.js.map +1 -0
- package/dist/platform/code-search/session-store.d.ts +11 -0
- package/dist/platform/code-search/session-store.d.ts.map +1 -0
- package/dist/platform/code-search/session-store.js +41 -0
- package/dist/platform/code-search/session-store.js.map +1 -0
- package/dist/platform/code-search/trace.d.ts +9 -0
- package/dist/platform/code-search/trace.d.ts.map +1 -0
- package/dist/platform/code-search/trace.js +25 -0
- package/dist/platform/code-search/trace.js.map +1 -0
- package/dist/platform/code-search/verification-retrieval.d.ts +3 -0
- package/dist/platform/code-search/verification-retrieval.d.ts.map +1 -0
- package/dist/platform/code-search/verification-retrieval.js +33 -0
- package/dist/platform/code-search/verification-retrieval.js.map +1 -0
- package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts +18 -0
- package/dist/platform/dream/dream-consolidator/fs-metrics.d.ts.map +1 -0
- package/dist/platform/dream/dream-consolidator/fs-metrics.js +130 -0
- package/dist/platform/dream/dream-consolidator/fs-metrics.js.map +1 -0
- package/dist/platform/dream/dream-consolidator.d.ts +4 -14
- package/dist/platform/dream/dream-consolidator.d.ts.map +1 -1
- package/dist/platform/dream/dream-consolidator.js +46 -166
- package/dist/platform/dream/dream-consolidator.js.map +1 -1
- package/dist/platform/dream/dream-soil-sync.d.ts +1 -0
- package/dist/platform/dream/dream-soil-sync.d.ts.map +1 -1
- package/dist/platform/dream/dream-soil-sync.js +8 -1
- package/dist/platform/dream/dream-soil-sync.js.map +1 -1
- package/dist/platform/dream/dream-types.d.ts +5 -0
- package/dist/platform/dream/dream-types.d.ts.map +1 -1
- package/dist/platform/dream/dream-types.js +1 -0
- package/dist/platform/dream/dream-types.js.map +1 -1
- package/dist/platform/dream/playbook-memory.d.ts +4 -4
- package/dist/platform/drive/stall-detector/analysis.d.ts +5 -0
- package/dist/platform/drive/stall-detector/analysis.d.ts.map +1 -0
- package/dist/platform/drive/stall-detector/analysis.js +55 -0
- package/dist/platform/drive/stall-detector/analysis.js.map +1 -0
- package/dist/platform/drive/stall-detector/repetitive.d.ts +3 -0
- package/dist/platform/drive/stall-detector/repetitive.d.ts.map +1 -0
- package/dist/platform/drive/stall-detector/repetitive.js +72 -0
- package/dist/platform/drive/stall-detector/repetitive.js.map +1 -0
- package/dist/platform/drive/stall-detector/thresholds.d.ts +10 -0
- package/dist/platform/drive/stall-detector/thresholds.d.ts.map +1 -0
- package/dist/platform/drive/stall-detector/thresholds.js +61 -0
- package/dist/platform/drive/stall-detector/thresholds.js.map +1 -0
- package/dist/platform/drive/stall-detector.d.ts +2 -20
- package/dist/platform/drive/stall-detector.d.ts.map +1 -1
- package/dist/platform/drive/stall-detector.js +9 -202
- package/dist/platform/drive/stall-detector.js.map +1 -1
- package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts +55 -0
- package/dist/platform/knowledge/knowledge-manager-agent-memory.d.ts.map +1 -0
- package/dist/platform/knowledge/knowledge-manager-agent-memory.js +232 -0
- package/dist/platform/knowledge/knowledge-manager-agent-memory.js.map +1 -0
- package/dist/platform/knowledge/knowledge-manager-internals.d.ts +10 -0
- package/dist/platform/knowledge/knowledge-manager-internals.d.ts.map +1 -0
- package/dist/platform/knowledge/knowledge-manager-internals.js +43 -0
- package/dist/platform/knowledge/knowledge-manager-internals.js.map +1 -0
- package/dist/platform/knowledge/knowledge-manager-store.d.ts +13 -0
- package/dist/platform/knowledge/knowledge-manager-store.d.ts.map +1 -0
- package/dist/platform/knowledge/knowledge-manager-store.js +67 -0
- package/dist/platform/knowledge/knowledge-manager-store.js.map +1 -0
- package/dist/platform/knowledge/knowledge-manager.d.ts +6 -2
- package/dist/platform/knowledge/knowledge-manager.d.ts.map +1 -1
- package/dist/platform/knowledge/knowledge-manager.js +43 -344
- package/dist/platform/knowledge/knowledge-manager.js.map +1 -1
- package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts +4 -0
- package/dist/platform/knowledge/memory/memory-lifecycle-storage.d.ts.map +1 -0
- package/dist/platform/knowledge/memory/memory-lifecycle-storage.js +106 -0
- package/dist/platform/knowledge/memory/memory-lifecycle-storage.js.map +1 -0
- package/dist/platform/knowledge/memory/memory-lifecycle.d.ts.map +1 -1
- package/dist/platform/knowledge/memory/memory-lifecycle.js +6 -112
- package/dist/platform/knowledge/memory/memory-lifecycle.js.map +1 -1
- package/dist/platform/observation/capability-detector/prompts.d.ts +18 -0
- package/dist/platform/observation/capability-detector/prompts.d.ts.map +1 -0
- package/dist/platform/observation/capability-detector/prompts.js +80 -0
- package/dist/platform/observation/capability-detector/prompts.js.map +1 -0
- package/dist/platform/observation/capability-detector/recommendations.d.ts +5 -0
- package/dist/platform/observation/capability-detector/recommendations.d.ts.map +1 -0
- package/dist/platform/observation/capability-detector/recommendations.js +76 -0
- package/dist/platform/observation/capability-detector/recommendations.js.map +1 -0
- package/dist/platform/observation/capability-detector/types.d.ts +112 -0
- package/dist/platform/observation/capability-detector/types.d.ts.map +1 -0
- package/dist/platform/observation/capability-detector/types.js +75 -0
- package/dist/platform/observation/capability-detector/types.js.map +1 -0
- package/dist/platform/observation/capability-detector.d.ts +4 -9
- package/dist/platform/observation/capability-detector.d.ts.map +1 -1
- package/dist/platform/observation/capability-detector.js +12 -212
- package/dist/platform/observation/capability-detector.js.map +1 -1
- package/dist/platform/observation/context-provider/collector.d.ts +13 -0
- package/dist/platform/observation/context-provider/collector.d.ts.map +1 -0
- package/dist/platform/observation/context-provider/collector.js +259 -0
- package/dist/platform/observation/context-provider/collector.js.map +1 -0
- package/dist/platform/observation/context-provider/search-terms.d.ts +2 -0
- package/dist/platform/observation/context-provider/search-terms.d.ts.map +1 -0
- package/dist/platform/observation/context-provider/search-terms.js +24 -0
- package/dist/platform/observation/context-provider/search-terms.js.map +1 -0
- package/dist/platform/observation/context-provider/shared.d.ts +17 -0
- package/dist/platform/observation/context-provider/shared.d.ts.map +1 -0
- package/dist/platform/observation/context-provider/shared.js +87 -0
- package/dist/platform/observation/context-provider/shared.js.map +1 -0
- package/dist/platform/observation/context-provider.d.ts +3 -28
- package/dist/platform/observation/context-provider.d.ts.map +1 -1
- package/dist/platform/observation/context-provider.js +7 -358
- package/dist/platform/observation/context-provider.js.map +1 -1
- package/dist/platform/observation/workspace-context.d.ts.map +1 -1
- package/dist/platform/observation/workspace-context.js +27 -0
- package/dist/platform/observation/workspace-context.js.map +1 -1
- package/dist/platform/soil/compiled-memory-projections.d.ts +2 -0
- package/dist/platform/soil/compiled-memory-projections.d.ts.map +1 -1
- package/dist/platform/soil/compiled-memory-projections.js +59 -0
- package/dist/platform/soil/compiled-memory-projections.js.map +1 -1
- package/dist/platform/soil/contracts.d.ts +2 -2
- package/dist/platform/soil/retriever.d.ts +25 -0
- package/dist/platform/soil/retriever.d.ts.map +1 -1
- package/dist/platform/soil/retriever.js +94 -5
- package/dist/platform/soil/retriever.js.map +1 -1
- package/dist/platform/soil/sqlite-repository-helpers.d.ts +80 -0
- package/dist/platform/soil/sqlite-repository-helpers.d.ts.map +1 -0
- package/dist/platform/soil/sqlite-repository-helpers.js +143 -0
- package/dist/platform/soil/sqlite-repository-helpers.js.map +1 -0
- package/dist/platform/soil/sqlite-repository-search.d.ts +8 -0
- package/dist/platform/soil/sqlite-repository-search.d.ts.map +1 -0
- package/dist/platform/soil/sqlite-repository-search.js +367 -0
- package/dist/platform/soil/sqlite-repository-search.js.map +1 -0
- package/dist/platform/soil/sqlite-repository-storage.d.ts +8 -0
- package/dist/platform/soil/sqlite-repository-storage.d.ts.map +1 -0
- package/dist/platform/soil/sqlite-repository-storage.js +278 -0
- package/dist/platform/soil/sqlite-repository-storage.js.map +1 -0
- package/dist/platform/soil/sqlite-repository.d.ts +1 -4
- package/dist/platform/soil/sqlite-repository.d.ts.map +1 -1
- package/dist/platform/soil/sqlite-repository.js +26 -820
- package/dist/platform/soil/sqlite-repository.js.map +1 -1
- package/dist/runtime/daemon/client.d.ts +13 -1
- package/dist/runtime/daemon/client.d.ts.map +1 -1
- package/dist/runtime/daemon/client.js +2 -2
- package/dist/runtime/daemon/client.js.map +1 -1
- package/dist/runtime/daemon/index.d.ts +1 -1
- package/dist/runtime/daemon/index.d.ts.map +1 -1
- package/dist/runtime/daemon/index.js +1 -1
- package/dist/runtime/daemon/index.js.map +1 -1
- package/dist/runtime/daemon/maintenance.d.ts +2 -10
- package/dist/runtime/daemon/maintenance.d.ts.map +1 -1
- package/dist/runtime/daemon/maintenance.js +14 -45
- package/dist/runtime/daemon/maintenance.js.map +1 -1
- package/dist/runtime/daemon/runner-bootstrap.d.ts +25 -0
- package/dist/runtime/daemon/runner-bootstrap.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-bootstrap.js +77 -0
- package/dist/runtime/daemon/runner-bootstrap.js.map +1 -0
- package/dist/runtime/daemon/runner-commands.d.ts +14 -6
- package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-commands.js +63 -17
- 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 +3 -5
- package/dist/runtime/daemon/runner-goal-cycle.js.map +1 -1
- package/dist/runtime/daemon/runner-resident-curiosity.d.ts +12 -0
- package/dist/runtime/daemon/runner-resident-curiosity.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-resident-curiosity.js +155 -0
- package/dist/runtime/daemon/runner-resident-curiosity.js.map +1 -0
- package/dist/runtime/daemon/runner-resident-dream.d.ts +20 -0
- package/dist/runtime/daemon/runner-resident-dream.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-resident-dream.js +148 -0
- package/dist/runtime/daemon/runner-resident-dream.js.map +1 -0
- package/dist/runtime/daemon/runner-resident-proactive.d.ts +4 -0
- package/dist/runtime/daemon/runner-resident-proactive.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-resident-proactive.js +113 -0
- package/dist/runtime/daemon/runner-resident-proactive.js.map +1 -0
- package/dist/runtime/daemon/runner-resident-shared.d.ts +40 -0
- package/dist/runtime/daemon/runner-resident-shared.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-resident-shared.js +101 -0
- package/dist/runtime/daemon/runner-resident-shared.js.map +1 -0
- package/dist/runtime/daemon/runner-resident.d.ts +4 -68
- package/dist/runtime/daemon/runner-resident.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-resident.js +4 -506
- package/dist/runtime/daemon/runner-resident.js.map +1 -1
- package/dist/runtime/daemon/runner-runtime.d.ts +12 -0
- package/dist/runtime/daemon/runner-runtime.d.ts.map +1 -0
- package/dist/runtime/daemon/runner-runtime.js +43 -0
- package/dist/runtime/daemon/runner-runtime.js.map +1 -0
- package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-startup.js +23 -3
- package/dist/runtime/daemon/runner-startup.js.map +1 -1
- package/dist/runtime/daemon/runner.d.ts +10 -23
- package/dist/runtime/daemon/runner.d.ts.map +1 -1
- package/dist/runtime/daemon/runner.js +29 -111
- package/dist/runtime/daemon/runner.js.map +1 -1
- package/dist/runtime/daemon/runtime-root.d.ts +5 -0
- package/dist/runtime/daemon/runtime-root.d.ts.map +1 -0
- package/dist/runtime/daemon/runtime-root.js +60 -0
- package/dist/runtime/daemon/runtime-root.js.map +1 -0
- package/dist/runtime/daemon/wait-deadline-resolver.d.ts +5 -2
- package/dist/runtime/daemon/wait-deadline-resolver.d.ts.map +1 -1
- package/dist/runtime/daemon/wait-deadline-resolver.js +55 -35
- package/dist/runtime/daemon/wait-deadline-resolver.js.map +1 -1
- package/dist/runtime/event/dispatcher.d.ts +0 -2
- package/dist/runtime/event/dispatcher.d.ts.map +1 -1
- package/dist/runtime/event/dispatcher.js +0 -4
- package/dist/runtime/event/dispatcher.js.map +1 -1
- package/dist/runtime/event/server-command-handler.d.ts.map +1 -1
- package/dist/runtime/event/server-command-handler.js +47 -3
- package/dist/runtime/event/server-command-handler.js.map +1 -1
- package/dist/runtime/executor/goal-worker.d.ts +3 -1
- package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
- package/dist/runtime/executor/goal-worker.js +3 -1
- package/dist/runtime/executor/goal-worker.js.map +1 -1
- package/dist/runtime/executor/loop-supervisor.d.ts +27 -1
- package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
- package/dist/runtime/executor/loop-supervisor.js +218 -13
- package/dist/runtime/executor/loop-supervisor.js.map +1 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.d.ts.map +1 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.js +2 -1
- package/dist/runtime/gateway/telegram-gateway-adapter.js.map +1 -1
- package/dist/runtime/schedule/engine-cron-reflection.d.ts +31 -0
- package/dist/runtime/schedule/engine-cron-reflection.d.ts.map +1 -0
- package/dist/runtime/schedule/engine-cron-reflection.js +229 -0
- package/dist/runtime/schedule/engine-cron-reflection.js.map +1 -0
- package/dist/runtime/schedule/engine-execution.d.ts +47 -0
- package/dist/runtime/schedule/engine-execution.d.ts.map +1 -0
- package/dist/runtime/schedule/engine-execution.js +424 -0
- package/dist/runtime/schedule/engine-execution.js.map +1 -0
- package/dist/runtime/schedule/engine-heartbeat.d.ts +5 -0
- package/dist/runtime/schedule/engine-heartbeat.d.ts.map +1 -0
- package/dist/runtime/schedule/engine-heartbeat.js +104 -0
- package/dist/runtime/schedule/engine-heartbeat.js.map +1 -0
- package/dist/runtime/schedule/engine-layers.d.ts +2 -0
- package/dist/runtime/schedule/engine-layers.d.ts.map +1 -1
- package/dist/runtime/schedule/engine-layers.js +12 -228
- package/dist/runtime/schedule/engine-layers.js.map +1 -1
- package/dist/runtime/schedule/engine-mutations.d.ts +37 -0
- package/dist/runtime/schedule/engine-mutations.d.ts.map +1 -0
- package/dist/runtime/schedule/engine-mutations.js +263 -0
- package/dist/runtime/schedule/engine-mutations.js.map +1 -0
- package/dist/runtime/schedule/engine.d.ts +11 -38
- package/dist/runtime/schedule/engine.d.ts.map +1 -1
- package/dist/runtime/schedule/engine.js +65 -810
- package/dist/runtime/schedule/engine.js.map +1 -1
- package/dist/runtime/schedule/history.d.ts +16 -0
- package/dist/runtime/schedule/history.d.ts.map +1 -1
- package/dist/runtime/schedule/history.js +8 -0
- package/dist/runtime/schedule/history.js.map +1 -1
- package/dist/runtime/schedule/index.d.ts +1 -0
- package/dist/runtime/schedule/index.d.ts.map +1 -1
- package/dist/runtime/schedule/index.js +1 -0
- package/dist/runtime/schedule/index.js.map +1 -1
- package/dist/runtime/schedule/legacy-cron-migration.d.ts +9 -0
- package/dist/runtime/schedule/legacy-cron-migration.d.ts.map +1 -0
- package/dist/runtime/schedule/legacy-cron-migration.js +89 -0
- package/dist/runtime/schedule/legacy-cron-migration.js.map +1 -0
- package/dist/runtime/schedule/wait-projection.d.ts +6 -0
- package/dist/runtime/schedule/wait-projection.d.ts.map +1 -0
- package/dist/runtime/schedule/wait-projection.js +102 -0
- package/dist/runtime/schedule/wait-projection.js.map +1 -0
- package/dist/runtime/session-registry/index.d.ts +3 -0
- package/dist/runtime/session-registry/index.d.ts.map +1 -0
- package/dist/runtime/session-registry/index.js +3 -0
- package/dist/runtime/session-registry/index.js.map +1 -0
- package/dist/runtime/session-registry/registry-helpers.d.ts +34 -0
- package/dist/runtime/session-registry/registry-helpers.d.ts.map +1 -0
- package/dist/runtime/session-registry/registry-helpers.js +241 -0
- package/dist/runtime/session-registry/registry-helpers.js.map +1 -0
- package/dist/runtime/session-registry/registry.d.ts +39 -0
- package/dist/runtime/session-registry/registry.d.ts.map +1 -0
- package/dist/runtime/session-registry/registry.js +532 -0
- package/dist/runtime/session-registry/registry.js.map +1 -0
- package/dist/runtime/session-registry/types.d.ts +985 -0
- package/dist/runtime/session-registry/types.d.ts.map +1 -0
- package/dist/runtime/session-registry/types.js +108 -0
- package/dist/runtime/session-registry/types.js.map +1 -0
- package/dist/runtime/store/background-run-store.d.ts +75 -0
- package/dist/runtime/store/background-run-store.d.ts.map +1 -0
- package/dist/runtime/store/background-run-store.js +157 -0
- package/dist/runtime/store/background-run-store.js.map +1 -0
- package/dist/runtime/store/index.d.ts +2 -0
- package/dist/runtime/store/index.d.ts.map +1 -1
- package/dist/runtime/store/index.js +1 -0
- package/dist/runtime/store/index.js.map +1 -1
- package/dist/runtime/store/runtime-operation-schemas.d.ts +12 -12
- package/dist/runtime/store/runtime-paths.d.ts +2 -0
- package/dist/runtime/store/runtime-paths.d.ts.map +1 -1
- package/dist/runtime/store/runtime-paths.js +6 -0
- package/dist/runtime/store/runtime-paths.js.map +1 -1
- package/dist/runtime/store/runtime-schemas.d.ts +2 -2
- package/dist/runtime/types/daemon.d.ts +13 -0
- package/dist/runtime/types/daemon.d.ts.map +1 -1
- package/dist/runtime/types/daemon.js +3 -0
- package/dist/runtime/types/daemon.js.map +1 -1
- package/dist/runtime/types/schedule.d.ts +65 -0
- package/dist/runtime/types/schedule.d.ts.map +1 -1
- package/dist/runtime/types/schedule.js +5 -0
- package/dist/runtime/types/schedule.js.map +1 -1
- package/dist/tools/builtin/exports.d.ts +5 -0
- package/dist/tools/builtin/exports.d.ts.map +1 -1
- package/dist/tools/builtin/exports.js +5 -0
- package/dist/tools/builtin/exports.js.map +1 -1
- package/dist/tools/builtin/factory.d.ts +2 -0
- package/dist/tools/builtin/factory.d.ts.map +1 -1
- package/dist/tools/builtin/factory.js +26 -1
- package/dist/tools/builtin/factory.js.map +1 -1
- package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts +1 -0
- package/dist/tools/fs/FileValidationTool/protected-path-policy.d.ts.map +1 -1
- package/dist/tools/fs/FileValidationTool/protected-path-policy.js +17 -4
- package/dist/tools/fs/FileValidationTool/protected-path-policy.js.map +1 -1
- package/dist/tools/fs/GlobTool/GlobTool.js +2 -2
- package/dist/tools/fs/GlobTool/GlobTool.js.map +1 -1
- package/dist/tools/fs/GrepTool/GrepTool.js +2 -2
- package/dist/tools/fs/GrepTool/GrepTool.js.map +1 -1
- package/dist/tools/fs/ListDirTool/ListDirTool.js +1 -1
- package/dist/tools/fs/ListDirTool/ListDirTool.js.map +1 -1
- package/dist/tools/fs/ReadTool/ReadTool.js +2 -2
- package/dist/tools/fs/ReadTool/ReadTool.js.map +1 -1
- package/dist/tools/kaggle/KaggleExperimentTools.d.ts +395 -0
- package/dist/tools/kaggle/KaggleExperimentTools.d.ts.map +1 -0
- package/dist/tools/kaggle/KaggleExperimentTools.js +923 -0
- package/dist/tools/kaggle/KaggleExperimentTools.js.map +1 -0
- package/dist/tools/kaggle/KaggleSubmissionTools.d.ts +241 -0
- package/dist/tools/kaggle/KaggleSubmissionTools.d.ts.map +1 -0
- package/dist/tools/kaggle/KaggleSubmissionTools.js +558 -0
- package/dist/tools/kaggle/KaggleSubmissionTools.js.map +1 -0
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts +105 -0
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.d.ts.map +1 -0
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js +135 -0
- package/dist/tools/kaggle/KaggleWorkspacePrepareTool.js.map +1 -0
- package/dist/tools/kaggle/index.d.ts +6 -0
- package/dist/tools/kaggle/index.d.ts.map +1 -0
- package/dist/tools/kaggle/index.js +6 -0
- package/dist/tools/kaggle/index.js.map +1 -0
- package/dist/tools/kaggle/metrics.d.ts +89 -0
- package/dist/tools/kaggle/metrics.d.ts.map +1 -0
- package/dist/tools/kaggle/metrics.js +51 -0
- package/dist/tools/kaggle/metrics.js.map +1 -0
- package/dist/tools/kaggle/paths.d.ts +15 -0
- package/dist/tools/kaggle/paths.d.ts.map +1 -0
- package/dist/tools/kaggle/paths.js +142 -0
- package/dist/tools/kaggle/paths.js.map +1 -0
- package/dist/tools/network/GitHubCliTool/GitHubCliTool.d.ts +2 -2
- package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.d.ts +801 -0
- package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.d.ts.map +1 -0
- package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.js +147 -0
- package/dist/tools/query/CodeReadContextTool/CodeReadContextTool.js.map +1 -0
- package/dist/tools/query/CodeReadContextTool/constants.d.ts +5 -0
- package/dist/tools/query/CodeReadContextTool/constants.d.ts.map +1 -0
- package/dist/tools/query/CodeReadContextTool/constants.js +5 -0
- package/dist/tools/query/CodeReadContextTool/constants.js.map +1 -0
- package/dist/tools/query/CodeReadContextTool/prompt.d.ts +2 -0
- package/dist/tools/query/CodeReadContextTool/prompt.d.ts.map +1 -0
- package/dist/tools/query/CodeReadContextTool/prompt.js +6 -0
- package/dist/tools/query/CodeReadContextTool/prompt.js.map +1 -0
- package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts +125 -0
- package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.d.ts.map +1 -0
- package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js +118 -0
- package/dist/tools/query/CodeSearchRepairTool/CodeSearchRepairTool.js.map +1 -0
- package/dist/tools/query/CodeSearchRepairTool/constants.d.ts +5 -0
- package/dist/tools/query/CodeSearchRepairTool/constants.d.ts.map +1 -0
- package/dist/tools/query/CodeSearchRepairTool/constants.js +5 -0
- package/dist/tools/query/CodeSearchRepairTool/constants.js.map +1 -0
- package/dist/tools/query/CodeSearchRepairTool/prompt.d.ts +2 -0
- package/dist/tools/query/CodeSearchRepairTool/prompt.d.ts.map +1 -0
- package/dist/tools/query/CodeSearchRepairTool/prompt.js +5 -0
- package/dist/tools/query/CodeSearchRepairTool/prompt.js.map +1 -0
- package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts +123 -0
- package/dist/tools/query/CodeSearchTool/CodeSearchTool.d.ts.map +1 -0
- package/dist/tools/query/CodeSearchTool/CodeSearchTool.js +117 -0
- package/dist/tools/query/CodeSearchTool/CodeSearchTool.js.map +1 -0
- package/dist/tools/query/CodeSearchTool/constants.d.ts +5 -0
- package/dist/tools/query/CodeSearchTool/constants.d.ts.map +1 -0
- package/dist/tools/query/CodeSearchTool/constants.js +5 -0
- package/dist/tools/query/CodeSearchTool/constants.js.map +1 -0
- package/dist/tools/query/CodeSearchTool/prompt.d.ts +2 -0
- package/dist/tools/query/CodeSearchTool/prompt.d.ts.map +1 -0
- package/dist/tools/query/CodeSearchTool/prompt.js +6 -0
- package/dist/tools/query/CodeSearchTool/prompt.js.map +1 -0
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.d.ts.map +1 -1
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.js +43 -9
- package/dist/tools/query/SoilQueryTool/SoilQueryTool.js.map +1 -1
- package/dist/tools/query/code-search-root.d.ts +8 -0
- package/dist/tools/query/code-search-root.d.ts.map +1 -0
- package/dist/tools/query/code-search-root.js +41 -0
- package/dist/tools/query/code-search-root.js.map +1 -0
- package/dist/tools/query/runtime-session-tools.d.ts +560 -0
- package/dist/tools/query/runtime-session-tools.d.ts.map +1 -0
- package/dist/tools/query/runtime-session-tools.js +1015 -0
- package/dist/tools/query/runtime-session-tools.js.map +1 -0
- package/dist/tools/runtime/LongRunningRuntimeTools.d.ts +821 -0
- package/dist/tools/runtime/LongRunningRuntimeTools.d.ts.map +1 -0
- package/dist/tools/runtime/LongRunningRuntimeTools.js +845 -0
- package/dist/tools/runtime/LongRunningRuntimeTools.js.map +1 -0
- package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts +1 -0
- package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.d.ts.map +1 -1
- package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js +11 -0
- package/dist/tools/system/ProcessSessionTool/ProcessSessionTool.js.map +1 -1
- package/dist/tools/system/ShellTool/ShellTool.d.ts.map +1 -1
- package/dist/tools/system/ShellTool/ShellTool.js +2 -1
- package/dist/tools/system/ShellTool/ShellTool.js.map +1 -1
- package/dist/tools/types.d.ts +2 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/package.json +2 -1
- package/dist/base/types/cron.d.ts +0 -2
- package/dist/base/types/cron.d.ts.map +0 -1
- package/dist/base/types/cron.js +0 -3
- package/dist/base/types/cron.js.map +0 -1
- package/dist/runtime/cron-scheduler.d.ts +0 -13
- package/dist/runtime/cron-scheduler.d.ts.map +0 -1
- package/dist/runtime/cron-scheduler.js +0 -90
- package/dist/runtime/cron-scheduler.js.map +0 -1
- package/dist/runtime/types/cron.d.ts +0 -59
- package/dist/runtime/types/cron.d.ts.map +0 -1
- package/dist/runtime/types/cron.js +0 -13
- package/dist/runtime/types/cron.js.map +0 -1
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { getPulseedDirPath } from "../../base/utils/paths.js";
|
|
5
|
+
import { BackgroundRunLedger } from "../../runtime/store/background-run-store.js";
|
|
6
|
+
import { defaultProcessSessionManager, } from "../system/ProcessSessionTool/ProcessSessionTool.js";
|
|
7
|
+
const SAFE_SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
8
|
+
export const LongRunningStatusSchema = z.enum([
|
|
9
|
+
"running",
|
|
10
|
+
"succeeded",
|
|
11
|
+
"failed",
|
|
12
|
+
"timed_out",
|
|
13
|
+
"cancelled",
|
|
14
|
+
"blocked",
|
|
15
|
+
"unknown",
|
|
16
|
+
]);
|
|
17
|
+
export const LongRunningNextActionTypeSchema = z.enum([
|
|
18
|
+
"continue",
|
|
19
|
+
"retry",
|
|
20
|
+
"investigate",
|
|
21
|
+
"wait",
|
|
22
|
+
"stop",
|
|
23
|
+
"ask_user",
|
|
24
|
+
]);
|
|
25
|
+
export const LongRunningNextActionSchema = z.object({
|
|
26
|
+
type: LongRunningNextActionTypeSchema,
|
|
27
|
+
summary: z.string().min(1),
|
|
28
|
+
reason: z.string().min(1).optional(),
|
|
29
|
+
command: z.string().min(1).optional(),
|
|
30
|
+
due_at: z.string().datetime().optional(),
|
|
31
|
+
owner: z.string().min(1).optional(),
|
|
32
|
+
}).strict();
|
|
33
|
+
export const LongRunningArtifactRefSchema = z.object({
|
|
34
|
+
label: z.string().min(1),
|
|
35
|
+
path: z.string().min(1).optional(),
|
|
36
|
+
state_relative_path: z.string().min(1).optional(),
|
|
37
|
+
url: z.string().url().optional(),
|
|
38
|
+
kind: z.enum(["log", "metrics", "report", "diff", "url", "other"]).default("other"),
|
|
39
|
+
}).strict();
|
|
40
|
+
export const LongRunningEvidenceSchema = z.object({
|
|
41
|
+
kind: z.enum(["metric", "log", "artifact", "observation", "error", "other"]),
|
|
42
|
+
label: z.string().min(1),
|
|
43
|
+
value: z.union([z.string(), z.number(), z.boolean(), z.null()]).optional(),
|
|
44
|
+
unit: z.string().min(1).optional(),
|
|
45
|
+
path: z.string().min(1).optional(),
|
|
46
|
+
summary: z.string().min(1).optional(),
|
|
47
|
+
confidence: z.number().min(0).max(1).optional(),
|
|
48
|
+
}).strict();
|
|
49
|
+
export const LongRunningResultSchema = z.object({
|
|
50
|
+
schema_version: z.literal("long-running-result-v1"),
|
|
51
|
+
objective: z.string().min(1),
|
|
52
|
+
status: LongRunningStatusSchema,
|
|
53
|
+
evidence: z.array(LongRunningEvidenceSchema).default([]),
|
|
54
|
+
artifacts: z.array(LongRunningArtifactRefSchema).default([]),
|
|
55
|
+
failures: z.array(z.string().min(1)).default([]),
|
|
56
|
+
next_action: LongRunningNextActionSchema,
|
|
57
|
+
source: z.object({
|
|
58
|
+
kind: z.string().min(1).default("manual"),
|
|
59
|
+
path: z.string().min(1).optional(),
|
|
60
|
+
process_session_id: z.string().min(1).optional(),
|
|
61
|
+
background_run_id: z.string().min(1).optional(),
|
|
62
|
+
}).strict().default({ kind: "manual" }),
|
|
63
|
+
created_at: z.string().datetime(),
|
|
64
|
+
}).strict();
|
|
65
|
+
const RuntimeReportWriteInputSchema = z.object({
|
|
66
|
+
objective: z.string().min(1).optional(),
|
|
67
|
+
status: LongRunningStatusSchema.optional(),
|
|
68
|
+
evidence: z.array(LongRunningEvidenceSchema).optional(),
|
|
69
|
+
artifacts: z.array(LongRunningArtifactRefSchema).optional(),
|
|
70
|
+
failures: z.array(z.string().min(1)).optional(),
|
|
71
|
+
next_action: LongRunningNextActionSchema.optional(),
|
|
72
|
+
result_json_path: z.string().min(1).optional(),
|
|
73
|
+
run_id: z.string().min(1).optional(),
|
|
74
|
+
process_session_id: z.string().min(1).optional(),
|
|
75
|
+
background_run_id: z.string().min(1).optional(),
|
|
76
|
+
}).strict();
|
|
77
|
+
const RuntimeResultNormalizeInputSchema = z.object({
|
|
78
|
+
objective: z.string().min(1),
|
|
79
|
+
source_json_path: z.string().min(1).optional(),
|
|
80
|
+
value: z.unknown().optional(),
|
|
81
|
+
profile: z.enum(["generic", "kaggle_metrics"]).default("generic"),
|
|
82
|
+
status: LongRunningStatusSchema.optional(),
|
|
83
|
+
metric_name: z.string().min(1).optional(),
|
|
84
|
+
metric_direction: z.enum(["maximize", "minimize"]).optional(),
|
|
85
|
+
next_action: LongRunningNextActionSchema.optional(),
|
|
86
|
+
run_id: z.string().min(1).optional(),
|
|
87
|
+
process_session_id: z.string().min(1).optional(),
|
|
88
|
+
background_run_id: z.string().min(1).optional(),
|
|
89
|
+
}).strict().refine((input) => input.source_json_path || input.value !== undefined, {
|
|
90
|
+
message: "source_json_path or value is required",
|
|
91
|
+
});
|
|
92
|
+
const WorkspaceImportInputSchema = z.object({
|
|
93
|
+
source_path: z.string().min(1),
|
|
94
|
+
workspace_id: z.string().min(1).optional(),
|
|
95
|
+
overwrite: z.boolean().default(false),
|
|
96
|
+
}).strict();
|
|
97
|
+
export class RuntimeReportWriteTool {
|
|
98
|
+
processSessionManager;
|
|
99
|
+
constructor(processSessionManager = defaultProcessSessionManager) {
|
|
100
|
+
this.processSessionManager = processSessionManager;
|
|
101
|
+
}
|
|
102
|
+
metadata = {
|
|
103
|
+
name: "runtime_report_write",
|
|
104
|
+
aliases: ["long_running_report_write", "run_report_write"],
|
|
105
|
+
permissionLevel: "write_local",
|
|
106
|
+
isReadOnly: false,
|
|
107
|
+
isDestructive: false,
|
|
108
|
+
shouldDefer: false,
|
|
109
|
+
alwaysLoad: false,
|
|
110
|
+
maxConcurrency: 1,
|
|
111
|
+
maxOutputChars: 12000,
|
|
112
|
+
tags: ["runtime", "long-running", "artifact", "report"],
|
|
113
|
+
};
|
|
114
|
+
inputSchema = RuntimeReportWriteInputSchema;
|
|
115
|
+
description(_context) {
|
|
116
|
+
return [
|
|
117
|
+
"Persist a durable summary.md, result.json, and next-action.json for a long-running workflow.",
|
|
118
|
+
"Can link the artifacts to an existing process session or background run so runtime CLI/TUI surfaces can display them.",
|
|
119
|
+
].join(" ");
|
|
120
|
+
}
|
|
121
|
+
async call(input, context) {
|
|
122
|
+
const startTime = Date.now();
|
|
123
|
+
try {
|
|
124
|
+
const loaded = input.result_json_path
|
|
125
|
+
? await loadCanonicalResult(resolveReadablePath(input.result_json_path, context.cwd))
|
|
126
|
+
: null;
|
|
127
|
+
const result = makeResultFromReportInput(input, loaded);
|
|
128
|
+
const output = await writeReportArtifacts(result, input.run_id);
|
|
129
|
+
const warnings = [];
|
|
130
|
+
if (input.process_session_id || result.source.process_session_id) {
|
|
131
|
+
const sessionId = input.process_session_id ?? result.source.process_session_id;
|
|
132
|
+
const warning = await linkProcessSessionArtifacts(this.processSessionManager, sessionId, [
|
|
133
|
+
output.files.summary,
|
|
134
|
+
output.files.result,
|
|
135
|
+
output.files.next_action,
|
|
136
|
+
]);
|
|
137
|
+
if (warning)
|
|
138
|
+
warnings.push(warning);
|
|
139
|
+
}
|
|
140
|
+
if (input.background_run_id || result.source.background_run_id) {
|
|
141
|
+
const runId = input.background_run_id ?? result.source.background_run_id;
|
|
142
|
+
const warning = await linkBackgroundRunArtifacts(runId, result, output);
|
|
143
|
+
if (warning)
|
|
144
|
+
warnings.push(warning);
|
|
145
|
+
}
|
|
146
|
+
const data = {
|
|
147
|
+
result,
|
|
148
|
+
files: output.files,
|
|
149
|
+
linked: {
|
|
150
|
+
process_session_id: input.process_session_id ?? result.source.process_session_id ?? null,
|
|
151
|
+
background_run_id: input.background_run_id ?? result.source.background_run_id ?? null,
|
|
152
|
+
},
|
|
153
|
+
warnings,
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
success: true,
|
|
157
|
+
data,
|
|
158
|
+
summary: `Wrote long-running run report at ${output.files.state_relative_directory}`,
|
|
159
|
+
durationMs: Date.now() - startTime,
|
|
160
|
+
artifacts: [output.files.summary, output.files.result, output.files.next_action],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
catch (err) {
|
|
164
|
+
return failureResult(`Failed to write long-running run report: ${messageFromError(err)}`, startTime);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async checkPermissions(_input, _context) {
|
|
168
|
+
return { status: "allowed" };
|
|
169
|
+
}
|
|
170
|
+
isConcurrencySafe(_input) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export class RuntimeResultNormalizeTool {
|
|
175
|
+
metadata = {
|
|
176
|
+
name: "runtime_result_normalize",
|
|
177
|
+
aliases: ["long_running_result_normalize", "normalize_run_result"],
|
|
178
|
+
permissionLevel: "write_local",
|
|
179
|
+
isReadOnly: false,
|
|
180
|
+
isDestructive: false,
|
|
181
|
+
shouldDefer: false,
|
|
182
|
+
alwaysLoad: false,
|
|
183
|
+
maxConcurrency: 1,
|
|
184
|
+
maxOutputChars: 12000,
|
|
185
|
+
tags: ["runtime", "long-running", "artifact", "metrics"],
|
|
186
|
+
};
|
|
187
|
+
inputSchema = RuntimeResultNormalizeInputSchema;
|
|
188
|
+
description(_context) {
|
|
189
|
+
return [
|
|
190
|
+
"Normalize loose JSON from an external workflow into PulSeed's canonical long-running result/evidence schema.",
|
|
191
|
+
"Use profile=kaggle_metrics to map Kaggle-style metric JSON without weakening the strict Kaggle internal schema.",
|
|
192
|
+
].join(" ");
|
|
193
|
+
}
|
|
194
|
+
async call(input, context) {
|
|
195
|
+
const startTime = Date.now();
|
|
196
|
+
try {
|
|
197
|
+
const sourcePath = input.source_json_path ? resolveReadablePath(input.source_json_path, context.cwd) : null;
|
|
198
|
+
const value = sourcePath ? await readJson(sourcePath) : input.value;
|
|
199
|
+
const result = normalizeLooseResult(input, value, sourcePath);
|
|
200
|
+
const directory = await resolveArtifactDirectory(input.run_id);
|
|
201
|
+
const resultPath = path.join(directory, "result.json");
|
|
202
|
+
await fs.writeFile(resultPath, `${JSON.stringify(result, null, 2)}\n`, "utf8");
|
|
203
|
+
const data = {
|
|
204
|
+
result,
|
|
205
|
+
files: {
|
|
206
|
+
directory,
|
|
207
|
+
state_relative_directory: stateRelativePath(directory),
|
|
208
|
+
result: resultPath,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
success: true,
|
|
213
|
+
data,
|
|
214
|
+
summary: `Normalized long-running result at ${stateRelativePath(resultPath)}`,
|
|
215
|
+
durationMs: Date.now() - startTime,
|
|
216
|
+
artifacts: [resultPath],
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
return failureResult(`Failed to normalize long-running result: ${messageFromError(err)}`, startTime);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async checkPermissions(_input, _context) {
|
|
224
|
+
return { status: "allowed" };
|
|
225
|
+
}
|
|
226
|
+
isConcurrencySafe(_input) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export class WorkspaceImportTool {
|
|
231
|
+
metadata = {
|
|
232
|
+
name: "workspace_import",
|
|
233
|
+
aliases: ["runtime_workspace_import", "materialize_workspace"],
|
|
234
|
+
permissionLevel: "write_local",
|
|
235
|
+
isReadOnly: false,
|
|
236
|
+
isDestructive: false,
|
|
237
|
+
shouldDefer: false,
|
|
238
|
+
alwaysLoad: false,
|
|
239
|
+
maxConcurrency: 1,
|
|
240
|
+
maxOutputChars: 8000,
|
|
241
|
+
tags: ["runtime", "workspace", "filesystem", "long-running"],
|
|
242
|
+
};
|
|
243
|
+
inputSchema = WorkspaceImportInputSchema;
|
|
244
|
+
description(_context) {
|
|
245
|
+
return [
|
|
246
|
+
"Safely materialize an existing local workspace into PulSeed state under runtime/workspaces/imports.",
|
|
247
|
+
"The import rejects symlinks and never relaxes PulSeed state-root path policy.",
|
|
248
|
+
].join(" ");
|
|
249
|
+
}
|
|
250
|
+
async call(input, context) {
|
|
251
|
+
const startTime = Date.now();
|
|
252
|
+
try {
|
|
253
|
+
const sourcePath = path.isAbsolute(input.source_path)
|
|
254
|
+
? path.resolve(input.source_path)
|
|
255
|
+
: path.resolve(context.cwd, input.source_path);
|
|
256
|
+
const sourceStat = await fs.lstat(sourcePath);
|
|
257
|
+
if (sourceStat.isSymbolicLink()) {
|
|
258
|
+
throw new Error("source_path must not be a symlink");
|
|
259
|
+
}
|
|
260
|
+
if (!sourceStat.isDirectory() && !sourceStat.isFile()) {
|
|
261
|
+
throw new Error("source_path must be a file or directory");
|
|
262
|
+
}
|
|
263
|
+
await assertTreeHasNoSymlinks(sourcePath);
|
|
264
|
+
const workspaceId = validateSafeSegment(input.workspace_id ?? path.basename(sourcePath), "workspace_id");
|
|
265
|
+
const destination = path.join(getPulseedDirPath(), "runtime", "workspaces", "imports", workspaceId);
|
|
266
|
+
assertNotNestedImport(sourcePath, destination);
|
|
267
|
+
await ensureDirectoryWithinStateRoot(path.dirname(destination));
|
|
268
|
+
if (!input.overwrite && await exists(destination)) {
|
|
269
|
+
throw new Error(`workspace import destination already exists: ${stateRelativePath(destination)}`);
|
|
270
|
+
}
|
|
271
|
+
if (input.overwrite) {
|
|
272
|
+
await fs.rm(destination, { recursive: true, force: true });
|
|
273
|
+
}
|
|
274
|
+
await copyWithoutSymlinks(sourcePath, destination, sourceStat);
|
|
275
|
+
const copiedEntries = await countEntries(destination);
|
|
276
|
+
const data = {
|
|
277
|
+
source_path: sourcePath,
|
|
278
|
+
workspace: {
|
|
279
|
+
path: destination,
|
|
280
|
+
state_relative_path: stateRelativePath(destination),
|
|
281
|
+
},
|
|
282
|
+
copied_entries: copiedEntries,
|
|
283
|
+
};
|
|
284
|
+
return {
|
|
285
|
+
success: true,
|
|
286
|
+
data,
|
|
287
|
+
summary: `Imported workspace into ${data.workspace.state_relative_path}`,
|
|
288
|
+
durationMs: Date.now() - startTime,
|
|
289
|
+
artifacts: [destination],
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
catch (err) {
|
|
293
|
+
return failureResult(`Failed to import workspace: ${messageFromError(err)}`, startTime);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async checkPermissions(_input, _context) {
|
|
297
|
+
return { status: "allowed" };
|
|
298
|
+
}
|
|
299
|
+
isConcurrencySafe(_input) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function makeResultFromReportInput(input, loaded) {
|
|
304
|
+
const objective = input.objective ?? loaded?.objective;
|
|
305
|
+
const status = input.status ?? loaded?.status;
|
|
306
|
+
const nextAction = input.next_action ?? loaded?.next_action;
|
|
307
|
+
if (!objective)
|
|
308
|
+
throw new Error("objective is required when result_json_path is not supplied");
|
|
309
|
+
if (!status)
|
|
310
|
+
throw new Error("status is required when result_json_path is not supplied");
|
|
311
|
+
if (!nextAction)
|
|
312
|
+
throw new Error("next_action is required when result_json_path is not supplied");
|
|
313
|
+
const source = {
|
|
314
|
+
...(loaded?.source ?? { kind: "manual" }),
|
|
315
|
+
...(input.process_session_id ? { process_session_id: input.process_session_id } : {}),
|
|
316
|
+
...(input.background_run_id ? { background_run_id: input.background_run_id } : {}),
|
|
317
|
+
};
|
|
318
|
+
return LongRunningResultSchema.parse({
|
|
319
|
+
schema_version: "long-running-result-v1",
|
|
320
|
+
objective,
|
|
321
|
+
status,
|
|
322
|
+
evidence: input.evidence ?? loaded?.evidence ?? [],
|
|
323
|
+
artifacts: input.artifacts ?? loaded?.artifacts ?? [],
|
|
324
|
+
failures: input.failures ?? loaded?.failures ?? [],
|
|
325
|
+
next_action: nextAction,
|
|
326
|
+
source,
|
|
327
|
+
created_at: loaded?.created_at ?? new Date().toISOString(),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function normalizeLooseResult(input, value, sourcePath) {
|
|
331
|
+
const source = {
|
|
332
|
+
kind: input.profile,
|
|
333
|
+
...(sourcePath ? { path: sourcePath } : {}),
|
|
334
|
+
...(input.process_session_id ? { process_session_id: input.process_session_id } : {}),
|
|
335
|
+
...(input.background_run_id ? { background_run_id: input.background_run_id } : {}),
|
|
336
|
+
};
|
|
337
|
+
const objectValue = isObject(value) ? value : {};
|
|
338
|
+
const evidence = input.profile === "kaggle_metrics"
|
|
339
|
+
? normalizeKaggleMetricEvidence(objectValue, input)
|
|
340
|
+
: normalizeGenericEvidence(value);
|
|
341
|
+
const artifacts = normalizeArtifactRefs(objectValue);
|
|
342
|
+
const status = input.status ?? inferStatus(objectValue);
|
|
343
|
+
const nextAction = input.next_action ?? defaultNextAction(status);
|
|
344
|
+
return LongRunningResultSchema.parse({
|
|
345
|
+
schema_version: "long-running-result-v1",
|
|
346
|
+
objective: input.objective,
|
|
347
|
+
status,
|
|
348
|
+
evidence,
|
|
349
|
+
artifacts,
|
|
350
|
+
failures: normalizeFailures(objectValue),
|
|
351
|
+
next_action: nextAction,
|
|
352
|
+
source,
|
|
353
|
+
created_at: new Date().toISOString(),
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function normalizeKaggleMetricEvidence(value, input) {
|
|
357
|
+
const evidence = [];
|
|
358
|
+
const metricName = input.metric_name ?? stringField(value, "metric_name");
|
|
359
|
+
const score = numberField(value, "cv_score")
|
|
360
|
+
?? numberField(value, "score")
|
|
361
|
+
?? (metricName ? numberField(value, metricName) : null)
|
|
362
|
+
?? numberField(value, "balanced_accuracy")
|
|
363
|
+
?? numberField(value, "accuracy");
|
|
364
|
+
const resolvedMetricName = metricName
|
|
365
|
+
?? (numberField(value, "balanced_accuracy") !== null ? "balanced_accuracy" : null)
|
|
366
|
+
?? (numberField(value, "accuracy") !== null ? "accuracy" : null)
|
|
367
|
+
?? "score";
|
|
368
|
+
if (score !== null) {
|
|
369
|
+
evidence.push({
|
|
370
|
+
kind: "metric",
|
|
371
|
+
label: resolvedMetricName,
|
|
372
|
+
value: score,
|
|
373
|
+
summary: input.metric_direction ? `direction=${input.metric_direction}` : "normalized metric",
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
const cvStd = numberField(value, "cv_std");
|
|
377
|
+
if (cvStd !== null) {
|
|
378
|
+
evidence.push({ kind: "metric", label: `${resolvedMetricName}_std`, value: cvStd });
|
|
379
|
+
}
|
|
380
|
+
const holdout = numberField(value, "holdout_score");
|
|
381
|
+
if (holdout !== null) {
|
|
382
|
+
evidence.push({ kind: "metric", label: "holdout_score", value: holdout });
|
|
383
|
+
}
|
|
384
|
+
return evidence.length > 0 ? evidence : normalizeGenericEvidence(value);
|
|
385
|
+
}
|
|
386
|
+
function normalizeGenericEvidence(value) {
|
|
387
|
+
if (!isObject(value)) {
|
|
388
|
+
return [{ kind: "observation", label: "result", value: primitiveValue(value), summary: "loose result value" }];
|
|
389
|
+
}
|
|
390
|
+
const evidenceValue = value["evidence"];
|
|
391
|
+
if (Array.isArray(evidenceValue)) {
|
|
392
|
+
const parsed = z.array(LongRunningEvidenceSchema).safeParse(evidenceValue);
|
|
393
|
+
if (parsed.success)
|
|
394
|
+
return parsed.data;
|
|
395
|
+
}
|
|
396
|
+
const metrics = value["metrics"];
|
|
397
|
+
if (isObject(metrics)) {
|
|
398
|
+
return Object.entries(metrics).flatMap(([label, metricValue]) => {
|
|
399
|
+
if (!isPrimitive(metricValue))
|
|
400
|
+
return [];
|
|
401
|
+
return [{
|
|
402
|
+
kind: "metric",
|
|
403
|
+
label,
|
|
404
|
+
value: metricValue,
|
|
405
|
+
}];
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
return Object.entries(value).flatMap(([label, field]) => {
|
|
409
|
+
if (!isPrimitive(field) || ["status", "failures", "artifacts", "next_action"].includes(label))
|
|
410
|
+
return [];
|
|
411
|
+
return [{
|
|
412
|
+
kind: typeof field === "number" ? "metric" : "observation",
|
|
413
|
+
label,
|
|
414
|
+
value: field,
|
|
415
|
+
}];
|
|
416
|
+
}).slice(0, 20);
|
|
417
|
+
}
|
|
418
|
+
function normalizeArtifactRefs(value) {
|
|
419
|
+
const artifacts = value["artifacts"];
|
|
420
|
+
if (Array.isArray(artifacts)) {
|
|
421
|
+
return artifacts.flatMap((artifact) => {
|
|
422
|
+
const parsed = LongRunningArtifactRefSchema.safeParse(artifact);
|
|
423
|
+
return parsed.success ? [parsed.data] : [];
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
if (isObject(artifacts)) {
|
|
427
|
+
return Object.entries(artifacts).flatMap(([label, artifactPath]) => {
|
|
428
|
+
if (typeof artifactPath !== "string" || artifactPath.length === 0)
|
|
429
|
+
return [];
|
|
430
|
+
return [artifactRef(label, artifactPath)];
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
return [];
|
|
434
|
+
}
|
|
435
|
+
function normalizeFailures(value) {
|
|
436
|
+
const failures = value["failures"];
|
|
437
|
+
if (Array.isArray(failures)) {
|
|
438
|
+
return failures.filter((failure) => typeof failure === "string" && failure.length > 0);
|
|
439
|
+
}
|
|
440
|
+
const error = typeof value["error"] === "string" ? value["error"] : typeof value["message"] === "string" ? value["message"] : null;
|
|
441
|
+
return error ? [error] : [];
|
|
442
|
+
}
|
|
443
|
+
function inferStatus(value) {
|
|
444
|
+
const status = typeof value["status"] === "string" ? value["status"] : null;
|
|
445
|
+
if (status === "succeeded" || status === "completed" || status === "complete" || status === "success")
|
|
446
|
+
return "succeeded";
|
|
447
|
+
if (status === "failed" || status === "error")
|
|
448
|
+
return "failed";
|
|
449
|
+
if (status === "running")
|
|
450
|
+
return "running";
|
|
451
|
+
if (status === "timed_out" || status === "timeout")
|
|
452
|
+
return "timed_out";
|
|
453
|
+
if (status === "cancelled" || status === "canceled")
|
|
454
|
+
return "cancelled";
|
|
455
|
+
return "unknown";
|
|
456
|
+
}
|
|
457
|
+
function defaultNextAction(status) {
|
|
458
|
+
if (status === "succeeded") {
|
|
459
|
+
return { type: "continue", summary: "Review the result and choose the next experiment or follow-up step." };
|
|
460
|
+
}
|
|
461
|
+
if (status === "running") {
|
|
462
|
+
return { type: "wait", summary: "Wait for the workflow to produce additional evidence." };
|
|
463
|
+
}
|
|
464
|
+
if (status === "failed" || status === "timed_out" || status === "blocked") {
|
|
465
|
+
return { type: "investigate", summary: "Inspect failures and decide whether to retry or change the workflow." };
|
|
466
|
+
}
|
|
467
|
+
return { type: "investigate", summary: "Inspect the result and decide the next action." };
|
|
468
|
+
}
|
|
469
|
+
async function writeReportArtifacts(result, runId) {
|
|
470
|
+
const directory = await resolveArtifactDirectory(runId);
|
|
471
|
+
const resultPath = path.join(directory, "result.json");
|
|
472
|
+
const summaryPath = path.join(directory, "summary.md");
|
|
473
|
+
const nextActionPath = path.join(directory, "next-action.json");
|
|
474
|
+
await Promise.all([
|
|
475
|
+
fs.writeFile(resultPath, `${JSON.stringify(result, null, 2)}\n`, "utf8"),
|
|
476
|
+
fs.writeFile(summaryPath, renderSummaryMarkdown(result), "utf8"),
|
|
477
|
+
fs.writeFile(nextActionPath, `${JSON.stringify({
|
|
478
|
+
schema_version: "long-running-next-action-v1",
|
|
479
|
+
created_at: new Date().toISOString(),
|
|
480
|
+
source: result.source,
|
|
481
|
+
action: result.next_action,
|
|
482
|
+
}, null, 2)}\n`, "utf8"),
|
|
483
|
+
]);
|
|
484
|
+
return {
|
|
485
|
+
files: {
|
|
486
|
+
directory,
|
|
487
|
+
state_relative_directory: stateRelativePath(directory),
|
|
488
|
+
summary: summaryPath,
|
|
489
|
+
result: resultPath,
|
|
490
|
+
next_action: nextActionPath,
|
|
491
|
+
},
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
function renderSummaryMarkdown(result) {
|
|
495
|
+
const lines = [
|
|
496
|
+
"# Long-Running Run Summary",
|
|
497
|
+
"",
|
|
498
|
+
"## Objective",
|
|
499
|
+
result.objective,
|
|
500
|
+
"",
|
|
501
|
+
"## Status",
|
|
502
|
+
result.status,
|
|
503
|
+
"",
|
|
504
|
+
"## Evidence",
|
|
505
|
+
...renderEvidence(result.evidence),
|
|
506
|
+
"",
|
|
507
|
+
"## Artifacts",
|
|
508
|
+
...renderArtifacts(result.artifacts),
|
|
509
|
+
"",
|
|
510
|
+
"## Failures",
|
|
511
|
+
...(result.failures.length > 0 ? result.failures.map((failure) => `- ${failure}`) : ["- none"]),
|
|
512
|
+
"",
|
|
513
|
+
"## Next Action",
|
|
514
|
+
`- Type: ${result.next_action.type}`,
|
|
515
|
+
`- Summary: ${result.next_action.summary}`,
|
|
516
|
+
];
|
|
517
|
+
if (result.next_action.reason)
|
|
518
|
+
lines.push(`- Reason: ${result.next_action.reason}`);
|
|
519
|
+
if (result.next_action.command)
|
|
520
|
+
lines.push(`- Command: ${result.next_action.command}`);
|
|
521
|
+
if (result.next_action.due_at)
|
|
522
|
+
lines.push(`- Due at: ${result.next_action.due_at}`);
|
|
523
|
+
if (result.next_action.owner)
|
|
524
|
+
lines.push(`- Owner: ${result.next_action.owner}`);
|
|
525
|
+
lines.push("");
|
|
526
|
+
return `${lines.join("\n")}`;
|
|
527
|
+
}
|
|
528
|
+
function renderEvidence(evidence) {
|
|
529
|
+
if (evidence.length === 0)
|
|
530
|
+
return ["- none"];
|
|
531
|
+
return evidence.map((item) => {
|
|
532
|
+
const value = item.value === undefined ? "" : `: ${String(item.value)}`;
|
|
533
|
+
const summary = item.summary ? ` (${item.summary})` : "";
|
|
534
|
+
const evidencePath = item.path ? ` [${item.path}]` : "";
|
|
535
|
+
return `- ${item.kind} ${item.label}${value}${summary}${evidencePath}`;
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
function renderArtifacts(artifacts) {
|
|
539
|
+
if (artifacts.length === 0)
|
|
540
|
+
return ["- none"];
|
|
541
|
+
return artifacts.map((artifact) => {
|
|
542
|
+
const target = artifact.state_relative_path ?? artifact.path ?? artifact.url ?? "";
|
|
543
|
+
return `- ${artifact.label}: ${target}`;
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
async function resolveArtifactDirectory(runId) {
|
|
547
|
+
const safeId = validateSafeSegment(runId ?? `run-${compactTimestamp(new Date())}`, "run_id");
|
|
548
|
+
const directory = path.join(getPulseedDirPath(), "runtime", "artifacts", safeId);
|
|
549
|
+
await ensureDirectoryWithinStateRoot(directory);
|
|
550
|
+
return directory;
|
|
551
|
+
}
|
|
552
|
+
async function linkProcessSessionArtifacts(processSessionManager, sessionId, artifactPaths) {
|
|
553
|
+
try {
|
|
554
|
+
const metadataPath = path.join(getPulseedDirPath(), "runtime", "process-sessions", `${sessionId}.json`);
|
|
555
|
+
const value = await readJson(metadataPath);
|
|
556
|
+
if (!isObject(value))
|
|
557
|
+
throw new Error("process session metadata is not an object");
|
|
558
|
+
const existing = Array.isArray(value["artifactRefs"])
|
|
559
|
+
? value["artifactRefs"].filter((ref) => typeof ref === "string")
|
|
560
|
+
: [];
|
|
561
|
+
const artifactRefs = [...new Set([...existing, ...artifactPaths])];
|
|
562
|
+
await fs.writeFile(metadataPath, `${JSON.stringify({ ...value, artifactRefs }, null, 2)}\n`, "utf8");
|
|
563
|
+
processSessionManager.linkArtifacts(sessionId, artifactPaths);
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
catch (err) {
|
|
567
|
+
return `Could not link artifacts to process session ${sessionId}: ${messageFromError(err)}`;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
async function linkBackgroundRunArtifacts(runId, result, output) {
|
|
571
|
+
try {
|
|
572
|
+
const ledger = new BackgroundRunLedger();
|
|
573
|
+
const existing = await ledger.load(runId);
|
|
574
|
+
if (!existing)
|
|
575
|
+
throw new Error("background run not found");
|
|
576
|
+
const artifacts = dedupeRuntimeArtifacts([
|
|
577
|
+
...existing.artifacts,
|
|
578
|
+
runtimeArtifact("summary.md", output.files.summary, "report"),
|
|
579
|
+
runtimeArtifact("result.json", output.files.result, "metrics"),
|
|
580
|
+
runtimeArtifact("next-action.json", output.files.next_action, "other"),
|
|
581
|
+
]);
|
|
582
|
+
const sourceRefs = dedupeSourceRefs([
|
|
583
|
+
...existing.source_refs,
|
|
584
|
+
sourceRef("artifact", "summary.md", output.files.summary),
|
|
585
|
+
sourceRef("artifact", "result.json", output.files.result),
|
|
586
|
+
sourceRef("artifact", "next-action.json", output.files.next_action),
|
|
587
|
+
]);
|
|
588
|
+
await ledger.save({
|
|
589
|
+
...existing,
|
|
590
|
+
status: mapResultStatusToBackgroundStatus(existing, result.status),
|
|
591
|
+
updated_at: new Date().toISOString(),
|
|
592
|
+
completed_at: completedAtForLinkedRun(existing, result.status),
|
|
593
|
+
summary: result.next_action.summary,
|
|
594
|
+
error: result.failures[0] ?? existing.error,
|
|
595
|
+
artifacts,
|
|
596
|
+
source_refs: sourceRefs,
|
|
597
|
+
});
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
catch (err) {
|
|
601
|
+
return `Could not link artifacts to background run ${runId}: ${messageFromError(err)}`;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function mapResultStatusToBackgroundStatus(existing, status) {
|
|
605
|
+
if (existing.status === "succeeded" || existing.status === "failed" || existing.status === "timed_out" || existing.status === "cancelled" || existing.status === "lost") {
|
|
606
|
+
return existing.status;
|
|
607
|
+
}
|
|
608
|
+
if (status === "succeeded")
|
|
609
|
+
return "succeeded";
|
|
610
|
+
if (status === "failed" || status === "blocked")
|
|
611
|
+
return "failed";
|
|
612
|
+
if (status === "timed_out")
|
|
613
|
+
return "timed_out";
|
|
614
|
+
if (status === "cancelled")
|
|
615
|
+
return "cancelled";
|
|
616
|
+
if (status === "running")
|
|
617
|
+
return "running";
|
|
618
|
+
return existing.status;
|
|
619
|
+
}
|
|
620
|
+
function completedAtForLinkedRun(existing, status) {
|
|
621
|
+
if (existing.completed_at)
|
|
622
|
+
return existing.completed_at;
|
|
623
|
+
if (status === "succeeded" || status === "failed" || status === "timed_out" || status === "cancelled" || status === "blocked") {
|
|
624
|
+
return new Date().toISOString();
|
|
625
|
+
}
|
|
626
|
+
return existing.completed_at;
|
|
627
|
+
}
|
|
628
|
+
function runtimeArtifact(label, artifactPath, kind) {
|
|
629
|
+
return { label, path: artifactPath, url: null, kind };
|
|
630
|
+
}
|
|
631
|
+
function sourceRef(kind, id, absolutePath) {
|
|
632
|
+
return {
|
|
633
|
+
kind,
|
|
634
|
+
id,
|
|
635
|
+
path: absolutePath,
|
|
636
|
+
relative_path: stateRelativePath(absolutePath),
|
|
637
|
+
updated_at: new Date().toISOString(),
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function dedupeRuntimeArtifacts(artifacts) {
|
|
641
|
+
const seen = new Set();
|
|
642
|
+
return artifacts.filter((artifact) => {
|
|
643
|
+
const key = `${artifact.kind}:${artifact.path ?? artifact.url ?? artifact.label}`;
|
|
644
|
+
if (seen.has(key))
|
|
645
|
+
return false;
|
|
646
|
+
seen.add(key);
|
|
647
|
+
return true;
|
|
648
|
+
});
|
|
649
|
+
}
|
|
650
|
+
function dedupeSourceRefs(refs) {
|
|
651
|
+
const seen = new Set();
|
|
652
|
+
return refs.filter((ref) => {
|
|
653
|
+
const key = `${ref.kind}:${ref.id ?? ""}:${ref.path ?? ""}`;
|
|
654
|
+
if (seen.has(key))
|
|
655
|
+
return false;
|
|
656
|
+
seen.add(key);
|
|
657
|
+
return true;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function artifactRef(label, artifactPath) {
|
|
661
|
+
const absolute = path.isAbsolute(artifactPath) ? artifactPath : undefined;
|
|
662
|
+
let stateRelative;
|
|
663
|
+
if (absolute) {
|
|
664
|
+
try {
|
|
665
|
+
stateRelative = stateRelativePath(absolute);
|
|
666
|
+
}
|
|
667
|
+
catch {
|
|
668
|
+
stateRelative = undefined;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return LongRunningArtifactRefSchema.parse({
|
|
672
|
+
label,
|
|
673
|
+
path: artifactPath,
|
|
674
|
+
...(stateRelative ? { state_relative_path: stateRelative } : {}),
|
|
675
|
+
kind: classifyArtifactKind(artifactPath),
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
function classifyArtifactKind(artifactPath) {
|
|
679
|
+
const basename = path.basename(artifactPath).toLowerCase();
|
|
680
|
+
if (basename.endsWith(".log") || basename.includes("log"))
|
|
681
|
+
return "log";
|
|
682
|
+
if (basename.endsWith(".json") && (basename.includes("metric") || basename.includes("score") || basename.includes("result")))
|
|
683
|
+
return "metrics";
|
|
684
|
+
if (basename.endsWith(".md") || basename.endsWith(".txt"))
|
|
685
|
+
return "report";
|
|
686
|
+
if (basename.endsWith(".diff") || basename.endsWith(".patch"))
|
|
687
|
+
return "diff";
|
|
688
|
+
return "other";
|
|
689
|
+
}
|
|
690
|
+
async function loadCanonicalResult(filePath) {
|
|
691
|
+
return LongRunningResultSchema.parse(await readJson(filePath));
|
|
692
|
+
}
|
|
693
|
+
async function readJson(filePath) {
|
|
694
|
+
return JSON.parse(await fs.readFile(filePath, "utf8"));
|
|
695
|
+
}
|
|
696
|
+
function resolveReadablePath(candidate, cwd) {
|
|
697
|
+
return path.isAbsolute(candidate) ? path.resolve(candidate) : path.resolve(cwd, candidate);
|
|
698
|
+
}
|
|
699
|
+
async function ensureDirectoryWithinStateRoot(dirPath) {
|
|
700
|
+
const stateRoot = path.resolve(getPulseedDirPath());
|
|
701
|
+
await fs.mkdir(stateRoot, { recursive: true });
|
|
702
|
+
const realStateRoot = await fs.realpath(stateRoot);
|
|
703
|
+
assertWithin(stateRoot, dirPath, "directory");
|
|
704
|
+
const relativeParts = path.relative(stateRoot, path.resolve(dirPath)).split(path.sep).filter(Boolean);
|
|
705
|
+
let current = stateRoot;
|
|
706
|
+
for (const part of relativeParts) {
|
|
707
|
+
current = path.join(current, part);
|
|
708
|
+
const existingRealPath = await realpathIfExists(current);
|
|
709
|
+
if (existingRealPath) {
|
|
710
|
+
const stat = await fs.lstat(current);
|
|
711
|
+
if (stat.isSymbolicLink()) {
|
|
712
|
+
throw new Error(`state path component must not be a symlink: ${stateRelativePath(current)}`);
|
|
713
|
+
}
|
|
714
|
+
assertWithin(realStateRoot, existingRealPath, "directory realpath");
|
|
715
|
+
if (!stat.isDirectory()) {
|
|
716
|
+
throw new Error(`state path component is not a directory: ${stateRelativePath(current)}`);
|
|
717
|
+
}
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
await fs.mkdir(current);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
async function realpathIfExists(candidate) {
|
|
724
|
+
try {
|
|
725
|
+
return await fs.realpath(candidate);
|
|
726
|
+
}
|
|
727
|
+
catch (err) {
|
|
728
|
+
if (err.code === "ENOENT")
|
|
729
|
+
return null;
|
|
730
|
+
throw err;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
function stateRelativePath(absolutePath) {
|
|
734
|
+
const stateRoot = path.resolve(getPulseedDirPath());
|
|
735
|
+
const relativePath = path.relative(stateRoot, path.resolve(absolutePath));
|
|
736
|
+
if (relativePath === "" || relativePath.startsWith("..") || path.isAbsolute(relativePath)) {
|
|
737
|
+
throw new Error("path must stay within the PulSeed state root");
|
|
738
|
+
}
|
|
739
|
+
return relativePath.split(path.sep).join("/");
|
|
740
|
+
}
|
|
741
|
+
function assertWithin(parent, candidate, label) {
|
|
742
|
+
const relativePath = path.relative(path.resolve(parent), path.resolve(candidate));
|
|
743
|
+
if (relativePath === "" || (!relativePath.startsWith("..") && !path.isAbsolute(relativePath)))
|
|
744
|
+
return;
|
|
745
|
+
throw new Error(`${label} must stay within ${parent}`);
|
|
746
|
+
}
|
|
747
|
+
function assertNotNestedImport(sourcePath, destination) {
|
|
748
|
+
const relativeDestination = path.relative(path.resolve(sourcePath), path.resolve(destination));
|
|
749
|
+
if (relativeDestination === "" || (!relativeDestination.startsWith("..") && !path.isAbsolute(relativeDestination))) {
|
|
750
|
+
throw new Error("workspace import destination must not be inside source_path");
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
async function assertTreeHasNoSymlinks(sourcePath) {
|
|
754
|
+
const stat = await fs.lstat(sourcePath);
|
|
755
|
+
if (stat.isSymbolicLink())
|
|
756
|
+
throw new Error(`workspace import rejects symlink: ${sourcePath}`);
|
|
757
|
+
if (!stat.isDirectory())
|
|
758
|
+
return;
|
|
759
|
+
const entries = await fs.readdir(sourcePath, { withFileTypes: true });
|
|
760
|
+
await Promise.all(entries.map((entry) => assertTreeHasNoSymlinks(path.join(sourcePath, entry.name))));
|
|
761
|
+
}
|
|
762
|
+
async function copyWithoutSymlinks(sourcePath, destination, sourceStat) {
|
|
763
|
+
if (sourceStat.isFile()) {
|
|
764
|
+
await ensureDirectoryWithinStateRoot(path.dirname(destination));
|
|
765
|
+
await fs.copyFile(sourcePath, destination);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
await ensureDirectoryWithinStateRoot(destination);
|
|
769
|
+
const entries = await fs.readdir(sourcePath, { withFileTypes: true });
|
|
770
|
+
for (const entry of entries) {
|
|
771
|
+
const childSource = path.join(sourcePath, entry.name);
|
|
772
|
+
const childDestination = path.join(destination, entry.name);
|
|
773
|
+
const stat = await fs.lstat(childSource);
|
|
774
|
+
if (stat.isSymbolicLink())
|
|
775
|
+
throw new Error(`workspace import rejects symlink: ${childSource}`);
|
|
776
|
+
if (stat.isDirectory()) {
|
|
777
|
+
await copyWithoutSymlinks(childSource, childDestination, stat);
|
|
778
|
+
}
|
|
779
|
+
else if (stat.isFile()) {
|
|
780
|
+
await ensureDirectoryWithinStateRoot(path.dirname(childDestination));
|
|
781
|
+
await fs.copyFile(childSource, childDestination);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
async function countEntries(root) {
|
|
786
|
+
const stat = await fs.lstat(root);
|
|
787
|
+
if (!stat.isDirectory())
|
|
788
|
+
return 1;
|
|
789
|
+
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
790
|
+
let count = entries.length;
|
|
791
|
+
for (const entry of entries) {
|
|
792
|
+
if (entry.isDirectory()) {
|
|
793
|
+
count += await countEntries(path.join(root, entry.name));
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
return count;
|
|
797
|
+
}
|
|
798
|
+
async function exists(candidate) {
|
|
799
|
+
try {
|
|
800
|
+
await fs.access(candidate);
|
|
801
|
+
return true;
|
|
802
|
+
}
|
|
803
|
+
catch {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
function validateSafeSegment(value, label) {
|
|
808
|
+
if (!SAFE_SEGMENT_PATTERN.test(value) || value === "." || value === "..") {
|
|
809
|
+
throw new Error(`${label} must be a safe path segment`);
|
|
810
|
+
}
|
|
811
|
+
return value;
|
|
812
|
+
}
|
|
813
|
+
function compactTimestamp(date) {
|
|
814
|
+
return date.toISOString().replace(/[-:.TZ]/g, "").slice(0, 14);
|
|
815
|
+
}
|
|
816
|
+
function isObject(value) {
|
|
817
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
818
|
+
}
|
|
819
|
+
function stringField(value, key) {
|
|
820
|
+
const field = value[key];
|
|
821
|
+
return typeof field === "string" && field.length > 0 ? field : null;
|
|
822
|
+
}
|
|
823
|
+
function numberField(value, key) {
|
|
824
|
+
const field = value[key];
|
|
825
|
+
return typeof field === "number" && Number.isFinite(field) ? field : null;
|
|
826
|
+
}
|
|
827
|
+
function isPrimitive(value) {
|
|
828
|
+
return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
829
|
+
}
|
|
830
|
+
function primitiveValue(value) {
|
|
831
|
+
return isPrimitive(value) ? value : JSON.stringify(value);
|
|
832
|
+
}
|
|
833
|
+
function messageFromError(err) {
|
|
834
|
+
return err instanceof Error ? err.message : String(err);
|
|
835
|
+
}
|
|
836
|
+
function failureResult(message, startTime) {
|
|
837
|
+
return {
|
|
838
|
+
success: false,
|
|
839
|
+
data: null,
|
|
840
|
+
summary: message,
|
|
841
|
+
error: message,
|
|
842
|
+
durationMs: Date.now() - startTime,
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
//# sourceMappingURL=LongRunningRuntimeTools.js.map
|