pulseed 0.5.2 → 0.5.3
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/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-runner.d.ts +24 -1
- package/dist/interface/chat/chat-runner.d.ts.map +1 -1
- package/dist/interface/chat/chat-runner.js +678 -67
- package/dist/interface/chat/chat-runner.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 +24 -0
- package/dist/interface/chat/cross-platform-session.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 +9 -0
- package/dist/interface/chat/ingress-router.d.ts.map +1 -1
- package/dist/interface/chat/ingress-router.js +35 -1
- 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 +80 -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/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/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 +22 -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/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.d.ts.map +1 -1
- package/dist/interface/tui/entry.js +14 -2
- 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.d.ts +86 -5
- package/dist/interface/tui/fullscreen-chat.d.ts.map +1 -1
- package/dist/interface/tui/fullscreen-chat.js +586 -32
- 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/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 +27 -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/bounded-agent-loop-runner.d.ts.map +1 -1
- package/dist/orchestrator/execution/agent-loop/bounded-agent-loop-runner.js +6 -0
- 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 +1 -0
- package/dist/orchestrator/execution/agent-loop/chat-agent-loop-runner.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/loop/core-loop/phase-policy.d.ts.map +1 -1
- package/dist/orchestrator/loop/core-loop/phase-policy.js +3 -0
- package/dist/orchestrator/loop/core-loop/phase-policy.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/observation/context-provider.d.ts.map +1 -1
- package/dist/platform/observation/context-provider.js +37 -0
- 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/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/runner-commands.d.ts +9 -1
- package/dist/runtime/daemon/runner-commands.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-commands.js +33 -2
- package/dist/runtime/daemon/runner-commands.js.map +1 -1
- package/dist/runtime/daemon/runner-startup.d.ts.map +1 -1
- package/dist/runtime/daemon/runner-startup.js +22 -1
- package/dist/runtime/daemon/runner-startup.js.map +1 -1
- package/dist/runtime/daemon/runner.d.ts.map +1 -1
- package/dist/runtime/daemon/runner.js +3 -2
- 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/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 +1 -0
- package/dist/runtime/executor/goal-worker.d.ts.map +1 -1
- package/dist/runtime/executor/goal-worker.js +1 -0
- package/dist/runtime/executor/goal-worker.js.map +1 -1
- package/dist/runtime/executor/loop-supervisor.d.ts +24 -1
- package/dist/runtime/executor/loop-supervisor.d.ts.map +1 -1
- package/dist/runtime/executor/loop-supervisor.js +191 -12
- 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/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.d.ts +39 -0
- package/dist/runtime/session-registry/registry.d.ts.map +1 -0
- package/dist/runtime/session-registry/registry.js +761 -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 +24 -24
- 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/types/daemon.d.ts +3 -0
- package/dist/runtime/types/daemon.d.ts.map +1 -1
- package/dist/runtime/types/daemon.js +1 -0
- package/dist/runtime/types/daemon.js.map +1 -1
- package/dist/tools/builtin/exports.d.ts +4 -0
- package/dist/tools/builtin/exports.d.ts.map +1 -1
- package/dist/tools/builtin/exports.js +4 -0
- package/dist/tools/builtin/exports.js.map +1 -1
- package/dist/tools/builtin/factory.d.ts.map +1 -1
- package/dist/tools/builtin/factory.js +18 -0
- package/dist/tools/builtin/factory.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/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 +136 -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 +97 -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 +95 -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/package.json +2 -1
|
@@ -0,0 +1,761 @@
|
|
|
1
|
+
import * as fsp from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { ChatSessionCatalog } from "../../interface/chat/chat-session-store.js";
|
|
4
|
+
import { normalizeAgentLoopSessionState } from "../../orchestrator/execution/agent-loop/agent-loop-session-state.js";
|
|
5
|
+
import { BackgroundRunLedger } from "../store/background-run-store.js";
|
|
6
|
+
import { BackgroundRunSchema, RuntimeSessionRegistrySnapshotSchema, } from "./types.js";
|
|
7
|
+
const PROCESS_SESSION_DIR = path.join("runtime", "process-sessions");
|
|
8
|
+
export class RuntimeSessionRegistry {
|
|
9
|
+
stateManager;
|
|
10
|
+
stateBaseDir;
|
|
11
|
+
chatCatalog;
|
|
12
|
+
processSessionManager;
|
|
13
|
+
backgroundRunLedger;
|
|
14
|
+
now;
|
|
15
|
+
isPidAlive;
|
|
16
|
+
constructor(deps) {
|
|
17
|
+
this.stateManager = deps.stateManager;
|
|
18
|
+
this.stateBaseDir = deps.stateBaseDir ?? deps.stateManager.getBaseDir();
|
|
19
|
+
this.chatCatalog = new ChatSessionCatalog(this.stateManager);
|
|
20
|
+
this.processSessionManager = deps.processSessionManager;
|
|
21
|
+
this.backgroundRunLedger = deps.backgroundRunLedger ?? new BackgroundRunLedger(path.join(this.stateBaseDir, "runtime"));
|
|
22
|
+
this.now = deps.now ?? (() => new Date());
|
|
23
|
+
this.isPidAlive = deps.isPidAlive ?? defaultIsPidAlive;
|
|
24
|
+
}
|
|
25
|
+
async snapshot() {
|
|
26
|
+
const generatedAt = this.now().toISOString();
|
|
27
|
+
const sessions = [];
|
|
28
|
+
const backgroundRuns = [];
|
|
29
|
+
const warnings = [];
|
|
30
|
+
await this.projectChatAndAgentSessions(sessions, backgroundRuns, warnings);
|
|
31
|
+
await this.projectSupervisorState(sessions, backgroundRuns, warnings);
|
|
32
|
+
await this.projectProcessSessions(backgroundRuns, warnings);
|
|
33
|
+
await this.projectLedgerRuns(sessions, backgroundRuns, warnings);
|
|
34
|
+
sessions.sort(compareByUpdatedAtThenId);
|
|
35
|
+
backgroundRuns.sort(compareByUpdatedAtThenId);
|
|
36
|
+
return RuntimeSessionRegistrySnapshotSchema.parse({
|
|
37
|
+
schema_version: "runtime-session-registry-v1",
|
|
38
|
+
generated_at: generatedAt,
|
|
39
|
+
sessions,
|
|
40
|
+
background_runs: backgroundRuns,
|
|
41
|
+
warnings,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async listSessions(filter = {}) {
|
|
45
|
+
return filterSessions((await this.snapshot()).sessions, filter);
|
|
46
|
+
}
|
|
47
|
+
async listRuns(filter = {}) {
|
|
48
|
+
return filterRuns((await this.snapshot()).background_runs, filter);
|
|
49
|
+
}
|
|
50
|
+
async getSession(id) {
|
|
51
|
+
return (await this.snapshot()).sessions.find((session) => session.id === id) ?? null;
|
|
52
|
+
}
|
|
53
|
+
async getRun(id) {
|
|
54
|
+
return (await this.snapshot()).background_runs.find((run) => run.id === id) ?? null;
|
|
55
|
+
}
|
|
56
|
+
async projectChatAndAgentSessions(sessions, backgroundRuns, warnings) {
|
|
57
|
+
let chatSessions;
|
|
58
|
+
try {
|
|
59
|
+
chatSessions = await this.chatCatalog.listSessions();
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
warnings.push({
|
|
63
|
+
code: "source_unavailable",
|
|
64
|
+
source: sourceRef("chat_session", null, null, null, null),
|
|
65
|
+
message: `Failed to list chat sessions: ${messageFromError(error)}`,
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const linkedAgentStatePaths = new Set();
|
|
70
|
+
for (const chat of chatSessions) {
|
|
71
|
+
const conversationId = conversationSessionId(chat.id);
|
|
72
|
+
const chatSource = sourceRef("chat_session", chat.id, null, path.join("chat", "sessions", `${chat.id}.json`), chat.updatedAt);
|
|
73
|
+
sessions.push({
|
|
74
|
+
schema_version: "runtime-session-v1",
|
|
75
|
+
id: conversationId,
|
|
76
|
+
kind: "conversation",
|
|
77
|
+
parent_session_id: null,
|
|
78
|
+
title: chat.title,
|
|
79
|
+
workspace: chat.cwd,
|
|
80
|
+
status: "idle",
|
|
81
|
+
created_at: chat.createdAt,
|
|
82
|
+
updated_at: chat.updatedAt,
|
|
83
|
+
last_event_at: chat.updatedAt,
|
|
84
|
+
transcript_ref: chatSource,
|
|
85
|
+
state_ref: null,
|
|
86
|
+
reply_target: null,
|
|
87
|
+
resumable: true,
|
|
88
|
+
attachable: false,
|
|
89
|
+
source_refs: [chatSource],
|
|
90
|
+
});
|
|
91
|
+
if (chat.agentLoopStatePath && chat.agentLoopStatus !== "missing") {
|
|
92
|
+
linkedAgentStatePaths.add(chat.agentLoopStatePath);
|
|
93
|
+
const agentProjection = await this.projectAgentSession(chat, conversationId, chatSource, warnings);
|
|
94
|
+
sessions.push(agentProjection.session);
|
|
95
|
+
backgroundRuns.push(agentProjection.run);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
await this.projectOrphanAgentSessions(linkedAgentStatePaths, sessions, backgroundRuns, warnings);
|
|
99
|
+
}
|
|
100
|
+
async projectAgentSession(chat, conversationId, chatSource, warnings) {
|
|
101
|
+
const stateRef = sourceRef("agentloop_state", null, null, chat.agentLoopStatePath, null);
|
|
102
|
+
let agentLoopSessionId = null;
|
|
103
|
+
let traceId = null;
|
|
104
|
+
let stateUpdatedAt = null;
|
|
105
|
+
let normalizedStatus = chat.agentLoopStatus;
|
|
106
|
+
try {
|
|
107
|
+
const raw = await this.stateManager.readRaw(chat.agentLoopStatePath);
|
|
108
|
+
const state = normalizeAgentLoopSessionState(raw);
|
|
109
|
+
if (state) {
|
|
110
|
+
agentLoopSessionId = state.sessionId;
|
|
111
|
+
traceId = state.traceId;
|
|
112
|
+
stateUpdatedAt = state.updatedAt;
|
|
113
|
+
normalizedStatus = state.status;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
warnings.push({
|
|
117
|
+
code: "source_parse_failed",
|
|
118
|
+
source: stateRef,
|
|
119
|
+
message: `AgentLoop state could not be normalized: ${chat.agentLoopStatePath}`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
warnings.push({
|
|
125
|
+
code: "source_parse_failed",
|
|
126
|
+
source: stateRef,
|
|
127
|
+
message: `Failed to read AgentLoop state ${chat.agentLoopStatePath}: ${messageFromError(error)}`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const stableAgentId = agentLoopSessionId ?? path.basename(chat.agentLoopStatePath, ".state.json");
|
|
131
|
+
const sessionId = agentSessionId(stableAgentId);
|
|
132
|
+
const updatedAt = stateUpdatedAt ?? chat.updatedAt;
|
|
133
|
+
const agentStateRef = { ...stateRef, id: agentLoopSessionId, updated_at: stateUpdatedAt };
|
|
134
|
+
const traceRef = traceId
|
|
135
|
+
? sourceRef("agentloop_trace", traceId, null, null, stateUpdatedAt)
|
|
136
|
+
: null;
|
|
137
|
+
const sourceRefs = [chatSource, agentStateRef, ...(traceRef ? [traceRef] : [])];
|
|
138
|
+
return {
|
|
139
|
+
session: {
|
|
140
|
+
schema_version: "runtime-session-v1",
|
|
141
|
+
id: sessionId,
|
|
142
|
+
kind: "agent",
|
|
143
|
+
parent_session_id: conversationId,
|
|
144
|
+
title: chat.title ?? stableAgentId,
|
|
145
|
+
workspace: chat.cwd,
|
|
146
|
+
status: agentStatusToSessionStatus(normalizedStatus),
|
|
147
|
+
created_at: chat.createdAt,
|
|
148
|
+
updated_at: updatedAt,
|
|
149
|
+
last_event_at: updatedAt,
|
|
150
|
+
transcript_ref: null,
|
|
151
|
+
state_ref: agentStateRef,
|
|
152
|
+
reply_target: null,
|
|
153
|
+
resumable: chat.agentLoopResumable,
|
|
154
|
+
attachable: false,
|
|
155
|
+
source_refs: sourceRefs,
|
|
156
|
+
},
|
|
157
|
+
run: BackgroundRunSchema.parse({
|
|
158
|
+
schema_version: "background-run-v1",
|
|
159
|
+
id: agentRunId(stableAgentId),
|
|
160
|
+
kind: "agent_run",
|
|
161
|
+
parent_session_id: conversationId,
|
|
162
|
+
child_session_id: sessionId,
|
|
163
|
+
process_session_id: null,
|
|
164
|
+
status: agentStatusToRunStatus(normalizedStatus),
|
|
165
|
+
notify_policy: "done_only",
|
|
166
|
+
reply_target_source: "none",
|
|
167
|
+
pinned_reply_target: null,
|
|
168
|
+
title: chat.title ?? stableAgentId,
|
|
169
|
+
workspace: chat.cwd,
|
|
170
|
+
created_at: chat.createdAt,
|
|
171
|
+
started_at: chat.createdAt,
|
|
172
|
+
updated_at: updatedAt,
|
|
173
|
+
completed_at: normalizedStatus === "completed" || normalizedStatus === "failed" ? updatedAt : null,
|
|
174
|
+
summary: null,
|
|
175
|
+
error: normalizedStatus === "failed" ? "AgentLoop session failed." : null,
|
|
176
|
+
artifacts: [],
|
|
177
|
+
source_refs: sourceRefs,
|
|
178
|
+
}),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
async projectOrphanAgentSessions(linkedAgentStatePaths, sessions, backgroundRuns, warnings) {
|
|
182
|
+
const dir = path.join(this.stateBaseDir, "chat", "agentloop");
|
|
183
|
+
let entries;
|
|
184
|
+
try {
|
|
185
|
+
entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
if (error.code === "ENOENT")
|
|
189
|
+
return;
|
|
190
|
+
warnings.push({
|
|
191
|
+
code: "source_unavailable",
|
|
192
|
+
source: sourceRef("agentloop_state", null, dir, path.join("chat", "agentloop"), null),
|
|
193
|
+
message: `Failed to list AgentLoop state files: ${messageFromError(error)}`,
|
|
194
|
+
});
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
for (const entry of entries) {
|
|
198
|
+
if (!entry.isFile() || !entry.name.endsWith(".state.json"))
|
|
199
|
+
continue;
|
|
200
|
+
const relativePath = path.join("chat", "agentloop", entry.name);
|
|
201
|
+
if (linkedAgentStatePaths.has(relativePath))
|
|
202
|
+
continue;
|
|
203
|
+
const stateRef = sourceRef("agentloop_state", null, null, relativePath, null);
|
|
204
|
+
try {
|
|
205
|
+
const raw = await this.stateManager.readRaw(relativePath);
|
|
206
|
+
const state = normalizeAgentLoopSessionState(raw);
|
|
207
|
+
if (!state) {
|
|
208
|
+
warnings.push({
|
|
209
|
+
code: "source_parse_failed",
|
|
210
|
+
source: stateRef,
|
|
211
|
+
message: `AgentLoop state could not be normalized: ${relativePath}`,
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const sessionId = agentSessionId(state.sessionId);
|
|
216
|
+
const agentStateRef = { ...stateRef, id: state.sessionId, updated_at: state.updatedAt };
|
|
217
|
+
warnings.push({
|
|
218
|
+
code: "missing_parent_join",
|
|
219
|
+
source: agentStateRef,
|
|
220
|
+
message: `AgentLoop state ${relativePath} has no owning chat session agentLoopStatePath join.`,
|
|
221
|
+
});
|
|
222
|
+
sessions.push({
|
|
223
|
+
schema_version: "runtime-session-v1",
|
|
224
|
+
id: sessionId,
|
|
225
|
+
kind: "agent",
|
|
226
|
+
parent_session_id: null,
|
|
227
|
+
title: state.taskId ?? state.goalId,
|
|
228
|
+
workspace: state.cwd,
|
|
229
|
+
status: agentStatusToSessionStatus(state.status),
|
|
230
|
+
created_at: null,
|
|
231
|
+
updated_at: state.updatedAt,
|
|
232
|
+
last_event_at: state.updatedAt,
|
|
233
|
+
transcript_ref: null,
|
|
234
|
+
state_ref: agentStateRef,
|
|
235
|
+
reply_target: null,
|
|
236
|
+
resumable: state.status !== "completed",
|
|
237
|
+
attachable: false,
|
|
238
|
+
source_refs: [
|
|
239
|
+
agentStateRef,
|
|
240
|
+
sourceRef("agentloop_trace", state.traceId, null, null, state.updatedAt),
|
|
241
|
+
],
|
|
242
|
+
});
|
|
243
|
+
backgroundRuns.push(BackgroundRunSchema.parse({
|
|
244
|
+
schema_version: "background-run-v1",
|
|
245
|
+
id: agentRunId(state.sessionId),
|
|
246
|
+
kind: "agent_run",
|
|
247
|
+
parent_session_id: null,
|
|
248
|
+
child_session_id: sessionId,
|
|
249
|
+
process_session_id: null,
|
|
250
|
+
status: agentStatusToRunStatus(state.status),
|
|
251
|
+
notify_policy: "done_only",
|
|
252
|
+
reply_target_source: "none",
|
|
253
|
+
pinned_reply_target: null,
|
|
254
|
+
title: state.taskId ?? state.goalId,
|
|
255
|
+
workspace: state.cwd,
|
|
256
|
+
created_at: null,
|
|
257
|
+
started_at: null,
|
|
258
|
+
updated_at: state.updatedAt,
|
|
259
|
+
completed_at: state.status === "completed" || state.status === "failed" ? state.updatedAt : null,
|
|
260
|
+
summary: null,
|
|
261
|
+
error: state.status === "failed" ? "AgentLoop session failed." : null,
|
|
262
|
+
artifacts: [],
|
|
263
|
+
source_refs: [agentStateRef],
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
warnings.push({
|
|
268
|
+
code: "source_parse_failed",
|
|
269
|
+
source: stateRef,
|
|
270
|
+
message: `Failed to read AgentLoop state ${relativePath}: ${messageFromError(error)}`,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
async projectSupervisorState(sessions, backgroundRuns, warnings) {
|
|
276
|
+
const relativePath = await this.findSupervisorStatePath();
|
|
277
|
+
if (!relativePath)
|
|
278
|
+
return;
|
|
279
|
+
const source = sourceRef("supervisor_state", null, null, relativePath, null);
|
|
280
|
+
let raw;
|
|
281
|
+
try {
|
|
282
|
+
raw = await this.stateManager.readRaw(relativePath);
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
warnings.push({
|
|
286
|
+
code: "source_parse_failed",
|
|
287
|
+
source,
|
|
288
|
+
message: `Failed to read supervisor state: ${messageFromError(error)}`,
|
|
289
|
+
});
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (!raw)
|
|
293
|
+
return;
|
|
294
|
+
const state = raw;
|
|
295
|
+
const workers = Array.isArray(state.workers) ? state.workers : [];
|
|
296
|
+
const updatedAt = numberToIso(state.updatedAt) ?? null;
|
|
297
|
+
const supervisorSource = { ...source, updated_at: updatedAt };
|
|
298
|
+
for (const worker of workers) {
|
|
299
|
+
if (!isObject(worker))
|
|
300
|
+
continue;
|
|
301
|
+
const workerId = stringField(worker, "workerId");
|
|
302
|
+
if (!workerId)
|
|
303
|
+
continue;
|
|
304
|
+
const goalId = stringField(worker, "goalId");
|
|
305
|
+
if (!goalId)
|
|
306
|
+
continue;
|
|
307
|
+
const startedAt = numberToIso(worker["startedAt"]) ?? updatedAt;
|
|
308
|
+
const sessionId = stringField(worker, "sessionId") ?? coreLoopSessionId(workerId);
|
|
309
|
+
const runId = stringField(worker, "backgroundRunId") ?? coreLoopRunId(workerId);
|
|
310
|
+
const parentSessionId = stringField(worker, "parentSessionId");
|
|
311
|
+
const title = goalId ? `CoreLoop goal ${goalId}` : `CoreLoop worker ${workerId}`;
|
|
312
|
+
sessions.push({
|
|
313
|
+
schema_version: "runtime-session-v1",
|
|
314
|
+
id: sessionId,
|
|
315
|
+
kind: "coreloop",
|
|
316
|
+
parent_session_id: parentSessionId,
|
|
317
|
+
title,
|
|
318
|
+
workspace: null,
|
|
319
|
+
status: "active",
|
|
320
|
+
created_at: startedAt,
|
|
321
|
+
updated_at: updatedAt,
|
|
322
|
+
last_event_at: updatedAt,
|
|
323
|
+
transcript_ref: null,
|
|
324
|
+
state_ref: supervisorSource,
|
|
325
|
+
reply_target: null,
|
|
326
|
+
resumable: false,
|
|
327
|
+
attachable: true,
|
|
328
|
+
source_refs: [supervisorSource],
|
|
329
|
+
});
|
|
330
|
+
backgroundRuns.push(BackgroundRunSchema.parse({
|
|
331
|
+
schema_version: "background-run-v1",
|
|
332
|
+
id: runId,
|
|
333
|
+
kind: "coreloop_run",
|
|
334
|
+
parent_session_id: parentSessionId,
|
|
335
|
+
child_session_id: sessionId,
|
|
336
|
+
process_session_id: null,
|
|
337
|
+
status: "running",
|
|
338
|
+
notify_policy: "state_changes",
|
|
339
|
+
reply_target_source: "none",
|
|
340
|
+
pinned_reply_target: null,
|
|
341
|
+
title,
|
|
342
|
+
workspace: null,
|
|
343
|
+
created_at: startedAt,
|
|
344
|
+
started_at: startedAt,
|
|
345
|
+
updated_at: updatedAt,
|
|
346
|
+
completed_at: null,
|
|
347
|
+
summary: null,
|
|
348
|
+
error: null,
|
|
349
|
+
artifacts: [],
|
|
350
|
+
source_refs: [supervisorSource],
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async projectProcessSessions(backgroundRuns, warnings) {
|
|
355
|
+
const liveSnapshots = new Map();
|
|
356
|
+
for (const snapshot of this.processSessionManager?.list(true) ?? []) {
|
|
357
|
+
liveSnapshots.set(snapshot.session_id, snapshot);
|
|
358
|
+
}
|
|
359
|
+
const sidecars = await this.readProcessSidecars(warnings);
|
|
360
|
+
const ids = new Set([...liveSnapshots.keys(), ...sidecars.map((snapshot) => snapshot.session_id)]);
|
|
361
|
+
for (const id of ids) {
|
|
362
|
+
const live = liveSnapshots.get(id);
|
|
363
|
+
const sidecar = sidecars.find((snapshot) => snapshot.session_id === id);
|
|
364
|
+
const snapshot = chooseProcessSnapshot(live, sidecar);
|
|
365
|
+
if (!snapshot)
|
|
366
|
+
continue;
|
|
367
|
+
const status = this.processRunStatus(snapshot, Boolean(live), warnings);
|
|
368
|
+
const processSource = sourceRef("process_session", snapshot.session_id, snapshot.metadataPath ?? null, snapshot.metadataRelativePath ?? path.join(PROCESS_SESSION_DIR, `${snapshot.session_id}.json`), snapshot.exitedAt ?? snapshot.startedAt);
|
|
369
|
+
const artifacts = processArtifacts(snapshot);
|
|
370
|
+
backgroundRuns.push(BackgroundRunSchema.parse({
|
|
371
|
+
schema_version: "background-run-v1",
|
|
372
|
+
id: processRunId(snapshot.session_id),
|
|
373
|
+
kind: "process_run",
|
|
374
|
+
parent_session_id: null,
|
|
375
|
+
child_session_id: null,
|
|
376
|
+
process_session_id: snapshot.session_id,
|
|
377
|
+
status,
|
|
378
|
+
notify_policy: "done_only",
|
|
379
|
+
reply_target_source: "none",
|
|
380
|
+
pinned_reply_target: null,
|
|
381
|
+
title: snapshot.label ?? `${snapshot.command} ${snapshot.args.join(" ")}`.trim(),
|
|
382
|
+
workspace: snapshot.cwd,
|
|
383
|
+
created_at: snapshot.startedAt,
|
|
384
|
+
started_at: snapshot.startedAt,
|
|
385
|
+
updated_at: snapshot.exitedAt ?? snapshot.startedAt,
|
|
386
|
+
completed_at: status === "succeeded" || status === "failed" || status === "cancelled" || status === "lost"
|
|
387
|
+
? snapshot.exitedAt ?? null
|
|
388
|
+
: null,
|
|
389
|
+
summary: null,
|
|
390
|
+
error: status === "failed" ? `Process exited with code ${snapshot.exitCode}` : null,
|
|
391
|
+
artifacts,
|
|
392
|
+
source_refs: [
|
|
393
|
+
processSource,
|
|
394
|
+
...artifacts.map((artifact) => sourceRef("artifact", artifact.label, artifact.path, relativeToBase(this.stateBaseDir, artifact.path), null)),
|
|
395
|
+
],
|
|
396
|
+
}));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
async projectLedgerRuns(sessions, backgroundRuns, warnings) {
|
|
400
|
+
let ledgerRuns;
|
|
401
|
+
try {
|
|
402
|
+
ledgerRuns = await this.backgroundRunLedger.list();
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
warnings.push({
|
|
406
|
+
code: "source_unavailable",
|
|
407
|
+
source: sourceRef("task_ledger", null, null, path.join("runtime", "background-runs"), null),
|
|
408
|
+
message: `Failed to list background run ledger records: ${messageFromError(error)}`,
|
|
409
|
+
});
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
const byId = new Map(backgroundRuns.map((run) => [run.id, run]));
|
|
413
|
+
const sessionIds = new Set(sessions.map((session) => session.id));
|
|
414
|
+
for (const run of ledgerRuns) {
|
|
415
|
+
const merged = mergeLedgerRunWithProjection(run, byId.get(run.id));
|
|
416
|
+
byId.set(run.id, merged);
|
|
417
|
+
if (merged.kind === "coreloop_run" && merged.child_session_id && !sessionIds.has(merged.child_session_id)) {
|
|
418
|
+
sessions.push(coreLoopSessionFromLedgerRun(merged));
|
|
419
|
+
sessionIds.add(merged.child_session_id);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
backgroundRuns.splice(0, backgroundRuns.length, ...byId.values());
|
|
423
|
+
}
|
|
424
|
+
async readProcessSidecars(warnings) {
|
|
425
|
+
const dir = path.join(this.stateBaseDir, PROCESS_SESSION_DIR);
|
|
426
|
+
let entries;
|
|
427
|
+
try {
|
|
428
|
+
entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
if (error.code === "ENOENT")
|
|
432
|
+
return [];
|
|
433
|
+
warnings.push({
|
|
434
|
+
code: "source_unavailable",
|
|
435
|
+
source: sourceRef("process_session", null, dir, PROCESS_SESSION_DIR, null),
|
|
436
|
+
message: `Failed to list process session sidecars: ${messageFromError(error)}`,
|
|
437
|
+
});
|
|
438
|
+
return [];
|
|
439
|
+
}
|
|
440
|
+
const snapshots = [];
|
|
441
|
+
for (const entry of entries) {
|
|
442
|
+
if (!entry.isFile() || !entry.name.endsWith(".json"))
|
|
443
|
+
continue;
|
|
444
|
+
const relativePath = path.join(PROCESS_SESSION_DIR, entry.name);
|
|
445
|
+
try {
|
|
446
|
+
const raw = await this.stateManager.readRaw(relativePath);
|
|
447
|
+
const snapshot = normalizeProcessSnapshot(raw);
|
|
448
|
+
if (snapshot) {
|
|
449
|
+
snapshots.push(snapshot);
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
warnings.push({
|
|
453
|
+
code: "source_parse_failed",
|
|
454
|
+
source: sourceRef("process_session", entry.name.slice(0, -5), null, relativePath, null),
|
|
455
|
+
message: `Process session sidecar could not be normalized: ${relativePath}`,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
warnings.push({
|
|
461
|
+
code: "source_parse_failed",
|
|
462
|
+
source: sourceRef("process_session", entry.name.slice(0, -5), null, relativePath, null),
|
|
463
|
+
message: `Failed to read process session sidecar ${relativePath}: ${messageFromError(error)}`,
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return snapshots;
|
|
468
|
+
}
|
|
469
|
+
async findSupervisorStatePath() {
|
|
470
|
+
for (const candidate of [
|
|
471
|
+
path.join("runtime", "supervisor-state.json"),
|
|
472
|
+
"supervisor-state.json",
|
|
473
|
+
]) {
|
|
474
|
+
try {
|
|
475
|
+
if (await fileExists(path.join(this.stateBaseDir, candidate)))
|
|
476
|
+
return candidate;
|
|
477
|
+
}
|
|
478
|
+
catch {
|
|
479
|
+
// Try the next legacy/current candidate.
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
processRunStatus(snapshot, hasLiveSession, warnings) {
|
|
485
|
+
if (snapshot.exitedAt || snapshot.running === false || snapshot.exitCode !== null || snapshot.signal) {
|
|
486
|
+
if (snapshot.exitCode === 0)
|
|
487
|
+
return "succeeded";
|
|
488
|
+
if (snapshot.exitCode !== null)
|
|
489
|
+
return "failed";
|
|
490
|
+
if (snapshot.signal)
|
|
491
|
+
return "cancelled";
|
|
492
|
+
if (snapshot.exitedAt)
|
|
493
|
+
return "unknown";
|
|
494
|
+
warnings.push({
|
|
495
|
+
code: "stale_source",
|
|
496
|
+
source: sourceRef("process_session", snapshot.session_id, snapshot.metadataPath ?? null, snapshot.metadataRelativePath ?? null, snapshot.startedAt),
|
|
497
|
+
message: `Process session ${snapshot.session_id} is not running but has no terminal exit metadata.`,
|
|
498
|
+
});
|
|
499
|
+
return "lost";
|
|
500
|
+
}
|
|
501
|
+
if (!snapshot.running)
|
|
502
|
+
return "unknown";
|
|
503
|
+
if (hasLiveSession)
|
|
504
|
+
return "running";
|
|
505
|
+
if (typeof snapshot.pid !== "number")
|
|
506
|
+
return "unknown";
|
|
507
|
+
const alive = this.isPidAlive(snapshot.pid);
|
|
508
|
+
if (alive === true)
|
|
509
|
+
return "running";
|
|
510
|
+
if (alive === false) {
|
|
511
|
+
warnings.push({
|
|
512
|
+
code: "dead_process_sidecar",
|
|
513
|
+
source: sourceRef("process_session", snapshot.session_id, snapshot.metadataPath ?? null, snapshot.metadataRelativePath ?? null, snapshot.startedAt),
|
|
514
|
+
message: `Process session ${snapshot.session_id} is marked running but PID ${snapshot.pid} is not alive.`,
|
|
515
|
+
});
|
|
516
|
+
return "lost";
|
|
517
|
+
}
|
|
518
|
+
return "unknown";
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
export function createRuntimeSessionRegistry(deps) {
|
|
522
|
+
return new RuntimeSessionRegistry(deps);
|
|
523
|
+
}
|
|
524
|
+
function filterSessions(sessions, filter) {
|
|
525
|
+
return sessions.filter((session) => {
|
|
526
|
+
if (filter.kind && session.kind !== filter.kind)
|
|
527
|
+
return false;
|
|
528
|
+
if (filter.status && session.status !== filter.status)
|
|
529
|
+
return false;
|
|
530
|
+
if (filter.activeOnly && session.status !== "active")
|
|
531
|
+
return false;
|
|
532
|
+
return true;
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
function filterRuns(runs, filter) {
|
|
536
|
+
return runs.filter((run) => {
|
|
537
|
+
if (filter.kind && run.kind !== filter.kind)
|
|
538
|
+
return false;
|
|
539
|
+
if (filter.status && run.status !== filter.status)
|
|
540
|
+
return false;
|
|
541
|
+
if (filter.activeOnly && run.status !== "queued" && run.status !== "running")
|
|
542
|
+
return false;
|
|
543
|
+
if (filter.attentionOnly && run.status !== "failed" && run.status !== "timed_out" && run.status !== "lost")
|
|
544
|
+
return false;
|
|
545
|
+
return true;
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
function mergeLedgerRunWithProjection(ledgerRun, projectedRun) {
|
|
549
|
+
if (!projectedRun)
|
|
550
|
+
return ledgerRun;
|
|
551
|
+
if (!isActiveRunStatus(ledgerRun.status) || isActiveRunStatus(projectedRun.status)) {
|
|
552
|
+
return ledgerRun;
|
|
553
|
+
}
|
|
554
|
+
return BackgroundRunSchema.parse({
|
|
555
|
+
...ledgerRun,
|
|
556
|
+
status: projectedRun.status,
|
|
557
|
+
updated_at: projectedRun.updated_at ?? ledgerRun.updated_at,
|
|
558
|
+
completed_at: projectedRun.completed_at ?? ledgerRun.completed_at,
|
|
559
|
+
error: projectedRun.error ?? ledgerRun.error,
|
|
560
|
+
source_refs: [...ledgerRun.source_refs, ...projectedRun.source_refs],
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
function coreLoopSessionFromLedgerRun(run) {
|
|
564
|
+
const stateRef = run.source_refs.find((ref) => ref.kind === "supervisor_state") ?? null;
|
|
565
|
+
const createdAt = run.started_at ?? run.created_at;
|
|
566
|
+
return {
|
|
567
|
+
schema_version: "runtime-session-v1",
|
|
568
|
+
id: run.child_session_id,
|
|
569
|
+
kind: "coreloop",
|
|
570
|
+
parent_session_id: run.parent_session_id,
|
|
571
|
+
title: run.title ?? run.id,
|
|
572
|
+
workspace: run.workspace,
|
|
573
|
+
status: coreLoopSessionStatusFromRunStatus(run.status),
|
|
574
|
+
created_at: createdAt,
|
|
575
|
+
updated_at: run.updated_at,
|
|
576
|
+
last_event_at: run.updated_at,
|
|
577
|
+
transcript_ref: null,
|
|
578
|
+
state_ref: stateRef,
|
|
579
|
+
reply_target: null,
|
|
580
|
+
resumable: false,
|
|
581
|
+
attachable: isActiveRunStatus(run.status),
|
|
582
|
+
source_refs: run.source_refs,
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
function coreLoopSessionStatusFromRunStatus(status) {
|
|
586
|
+
if (status === "queued" || status === "running")
|
|
587
|
+
return "active";
|
|
588
|
+
if (status === "lost")
|
|
589
|
+
return "lost";
|
|
590
|
+
if (status === "unknown")
|
|
591
|
+
return "unknown";
|
|
592
|
+
return "ended";
|
|
593
|
+
}
|
|
594
|
+
function isActiveRunStatus(status) {
|
|
595
|
+
return status === "queued" || status === "running";
|
|
596
|
+
}
|
|
597
|
+
function sourceRef(kind, id, absolutePath, relativePath, updatedAt) {
|
|
598
|
+
return {
|
|
599
|
+
kind,
|
|
600
|
+
id,
|
|
601
|
+
path: absolutePath,
|
|
602
|
+
relative_path: relativePath,
|
|
603
|
+
updated_at: updatedAt,
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function agentStatusToSessionStatus(status) {
|
|
607
|
+
if (status === "running")
|
|
608
|
+
return "active";
|
|
609
|
+
if (status === "completed" || status === "failed")
|
|
610
|
+
return "ended";
|
|
611
|
+
return "unknown";
|
|
612
|
+
}
|
|
613
|
+
function agentStatusToRunStatus(status) {
|
|
614
|
+
if (status === "running")
|
|
615
|
+
return "running";
|
|
616
|
+
if (status === "completed")
|
|
617
|
+
return "succeeded";
|
|
618
|
+
if (status === "failed")
|
|
619
|
+
return "failed";
|
|
620
|
+
return "unknown";
|
|
621
|
+
}
|
|
622
|
+
function conversationSessionId(id) {
|
|
623
|
+
return `session:conversation:${id}`;
|
|
624
|
+
}
|
|
625
|
+
function agentSessionId(id) {
|
|
626
|
+
return `session:agent:${id}`;
|
|
627
|
+
}
|
|
628
|
+
function agentRunId(id) {
|
|
629
|
+
return `run:agent:${id}`;
|
|
630
|
+
}
|
|
631
|
+
function coreLoopSessionId(id) {
|
|
632
|
+
return `session:coreloop:${id}`;
|
|
633
|
+
}
|
|
634
|
+
function coreLoopRunId(id) {
|
|
635
|
+
return `run:coreloop:${id}`;
|
|
636
|
+
}
|
|
637
|
+
function processRunId(id) {
|
|
638
|
+
return `run:process:${id}`;
|
|
639
|
+
}
|
|
640
|
+
function messageFromError(error) {
|
|
641
|
+
return error instanceof Error ? error.message : String(error);
|
|
642
|
+
}
|
|
643
|
+
function compareByUpdatedAtThenId(left, right) {
|
|
644
|
+
const leftTime = parseTime(left.updated_at);
|
|
645
|
+
const rightTime = parseTime(right.updated_at);
|
|
646
|
+
if (rightTime !== leftTime)
|
|
647
|
+
return rightTime - leftTime;
|
|
648
|
+
return left.id.localeCompare(right.id);
|
|
649
|
+
}
|
|
650
|
+
function parseTime(value) {
|
|
651
|
+
if (!value)
|
|
652
|
+
return Number.NEGATIVE_INFINITY;
|
|
653
|
+
const parsed = Date.parse(value);
|
|
654
|
+
return Number.isFinite(parsed) ? parsed : Number.NEGATIVE_INFINITY;
|
|
655
|
+
}
|
|
656
|
+
function numberToIso(value) {
|
|
657
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
658
|
+
return null;
|
|
659
|
+
return new Date(value).toISOString();
|
|
660
|
+
}
|
|
661
|
+
function isObject(value) {
|
|
662
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
663
|
+
}
|
|
664
|
+
function stringField(value, key) {
|
|
665
|
+
const field = value[key];
|
|
666
|
+
return typeof field === "string" && field.length > 0 ? field : null;
|
|
667
|
+
}
|
|
668
|
+
function normalizeProcessSnapshot(value) {
|
|
669
|
+
if (!isObject(value))
|
|
670
|
+
return null;
|
|
671
|
+
const sessionId = stringField(value, "session_id");
|
|
672
|
+
const command = stringField(value, "command");
|
|
673
|
+
const cwd = stringField(value, "cwd");
|
|
674
|
+
const startedAt = stringField(value, "startedAt");
|
|
675
|
+
const args = Array.isArray(value["args"]) ? value["args"].filter((arg) => typeof arg === "string") : null;
|
|
676
|
+
if (!sessionId || !command || !cwd || !startedAt || !args)
|
|
677
|
+
return null;
|
|
678
|
+
const exitCode = typeof value["exitCode"] === "number" ? value["exitCode"] : null;
|
|
679
|
+
const signal = typeof value["signal"] === "string" ? value["signal"] : null;
|
|
680
|
+
const artifactRefs = Array.isArray(value["artifactRefs"]) ? value["artifactRefs"].filter((ref) => typeof ref === "string") : undefined;
|
|
681
|
+
return {
|
|
682
|
+
session_id: sessionId,
|
|
683
|
+
...(typeof value["label"] === "string" ? { label: value["label"] } : {}),
|
|
684
|
+
command,
|
|
685
|
+
args,
|
|
686
|
+
cwd,
|
|
687
|
+
...(typeof value["goal_id"] === "string" ? { goal_id: value["goal_id"] } : {}),
|
|
688
|
+
...(typeof value["task_id"] === "string" ? { task_id: value["task_id"] } : {}),
|
|
689
|
+
...(typeof value["strategy_id"] === "string" ? { strategy_id: value["strategy_id"] } : {}),
|
|
690
|
+
...(typeof value["pid"] === "number" ? { pid: value["pid"] } : {}),
|
|
691
|
+
running: value["running"] === true,
|
|
692
|
+
exitCode,
|
|
693
|
+
signal,
|
|
694
|
+
startedAt,
|
|
695
|
+
...(typeof value["exitedAt"] === "string" ? { exitedAt: value["exitedAt"] } : {}),
|
|
696
|
+
bufferedChars: typeof value["bufferedChars"] === "number" ? value["bufferedChars"] : 0,
|
|
697
|
+
...(typeof value["metadataPath"] === "string" ? { metadataPath: value["metadataPath"] } : {}),
|
|
698
|
+
...(typeof value["metadataRelativePath"] === "string" ? { metadataRelativePath: value["metadataRelativePath"] } : {}),
|
|
699
|
+
...(artifactRefs ? { artifactRefs } : {}),
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
function chooseProcessSnapshot(live, sidecar) {
|
|
703
|
+
if (sidecar && (sidecar.exitedAt || sidecar.exitCode !== null || sidecar.signal || sidecar.running === false)) {
|
|
704
|
+
return sidecar;
|
|
705
|
+
}
|
|
706
|
+
return live ?? sidecar ?? null;
|
|
707
|
+
}
|
|
708
|
+
function processArtifacts(snapshot) {
|
|
709
|
+
return (snapshot.artifactRefs ?? []).map((artifactPath) => ({
|
|
710
|
+
label: path.basename(artifactPath),
|
|
711
|
+
path: artifactPath,
|
|
712
|
+
url: null,
|
|
713
|
+
kind: classifyArtifact(artifactPath),
|
|
714
|
+
}));
|
|
715
|
+
}
|
|
716
|
+
function classifyArtifact(artifactPath) {
|
|
717
|
+
const basename = path.basename(artifactPath).toLowerCase();
|
|
718
|
+
if (basename.endsWith(".log") || basename.includes("log"))
|
|
719
|
+
return "log";
|
|
720
|
+
if (basename.endsWith(".json") && (basename.includes("metric") || basename.includes("score")))
|
|
721
|
+
return "metrics";
|
|
722
|
+
if (basename.endsWith(".md") || basename.endsWith(".txt"))
|
|
723
|
+
return "report";
|
|
724
|
+
if (basename.endsWith(".diff") || basename.endsWith(".patch"))
|
|
725
|
+
return "diff";
|
|
726
|
+
return "other";
|
|
727
|
+
}
|
|
728
|
+
function relativeToBase(baseDir, maybePath) {
|
|
729
|
+
if (!maybePath)
|
|
730
|
+
return null;
|
|
731
|
+
if (!path.isAbsolute(maybePath))
|
|
732
|
+
return maybePath;
|
|
733
|
+
const relative = path.relative(baseDir, maybePath);
|
|
734
|
+
return relative.startsWith("..") || path.isAbsolute(relative) ? null : relative;
|
|
735
|
+
}
|
|
736
|
+
function defaultIsPidAlive(pid) {
|
|
737
|
+
try {
|
|
738
|
+
process.kill(pid, 0);
|
|
739
|
+
return true;
|
|
740
|
+
}
|
|
741
|
+
catch (error) {
|
|
742
|
+
const code = error.code;
|
|
743
|
+
if (code === "ESRCH")
|
|
744
|
+
return false;
|
|
745
|
+
if (code === "EPERM")
|
|
746
|
+
return true;
|
|
747
|
+
return "unknown";
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
async function fileExists(filePath) {
|
|
751
|
+
try {
|
|
752
|
+
const stat = await fsp.stat(filePath);
|
|
753
|
+
return stat.isFile();
|
|
754
|
+
}
|
|
755
|
+
catch (error) {
|
|
756
|
+
if (error.code === "ENOENT")
|
|
757
|
+
return false;
|
|
758
|
+
throw error;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
//# sourceMappingURL=registry.js.map
|