@orion-agents/orion-code 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +495 -0
- package/README.md +142 -314
- package/README.zh-CN.md +117 -559
- package/dist/cli.js +71 -90
- package/dist/cli.js.map +1 -1
- package/dist/commands/context-commands.d.ts.map +1 -1
- package/dist/commands/context-commands.js +14 -7
- package/dist/commands/context-commands.js.map +1 -1
- package/dist/commands/context-tool-command-handlers.d.ts +4 -5
- package/dist/commands/context-tool-command-handlers.d.ts.map +1 -1
- package/dist/commands/context-tool-command-handlers.js +174 -208
- package/dist/commands/context-tool-command-handlers.js.map +1 -1
- package/dist/commands/core-command-handlers.d.ts +3 -6
- package/dist/commands/core-command-handlers.d.ts.map +1 -1
- package/dist/commands/core-command-handlers.js +66 -664
- package/dist/commands/core-command-handlers.js.map +1 -1
- package/dist/commands/diagnostic-command-handlers.d.ts +1 -2
- package/dist/commands/diagnostic-command-handlers.d.ts.map +1 -1
- package/dist/commands/diagnostic-command-handlers.js +3 -17
- package/dist/commands/diagnostic-command-handlers.js.map +1 -1
- package/dist/commands/diagnostic-commands.d.ts.map +1 -1
- package/dist/commands/diagnostic-commands.js +0 -45
- package/dist/commands/diagnostic-commands.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -7
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/model-command-handlers.d.ts +2 -2
- package/dist/commands/model-command-handlers.d.ts.map +1 -1
- package/dist/commands/model-command-handlers.js +168 -3
- package/dist/commands/model-command-handlers.js.map +1 -1
- package/dist/commands/model-commands.d.ts.map +1 -1
- package/dist/commands/model-commands.js +0 -11
- package/dist/commands/model-commands.js.map +1 -1
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/registry.js +1 -139
- package/dist/commands/registry.js.map +1 -1
- package/dist/commands/session-command-handlers.d.ts.map +1 -1
- package/dist/commands/session-command-handlers.js +35 -119
- package/dist/commands/session-command-handlers.js.map +1 -1
- package/dist/commands/session-commands.d.ts.map +1 -1
- package/dist/commands/session-commands.js +2 -50
- package/dist/commands/session-commands.js.map +1 -1
- package/dist/commands/target-command.d.ts +9 -15
- package/dist/commands/target-command.d.ts.map +1 -1
- package/dist/commands/target-command.js +16 -130
- package/dist/commands/target-command.js.map +1 -1
- package/dist/commands/tool-commands.d.ts.map +1 -1
- package/dist/commands/tool-commands.js +0 -10
- package/dist/commands/tool-commands.js.map +1 -1
- package/dist/commands/types.d.ts +14 -14
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/workflow-command-handlers.d.ts.map +1 -1
- package/dist/commands/workflow-command-handlers.js +1 -3
- package/dist/commands/workflow-command-handlers.js.map +1 -1
- package/dist/commands/workflow-commands.d.ts.map +1 -1
- package/dist/commands/workflow-commands.js +2 -24
- package/dist/commands/workflow-commands.js.map +1 -1
- package/dist/framework/agent-mode.d.ts +2 -3
- package/dist/framework/agent-mode.d.ts.map +1 -1
- package/dist/framework/agent-mode.js +8 -31
- package/dist/framework/agent-mode.js.map +1 -1
- package/dist/framework/index.d.ts +8 -6
- package/dist/framework/index.d.ts.map +1 -1
- package/dist/framework/index.js +14 -9
- package/dist/framework/index.js.map +1 -1
- package/dist/framework/loop-budget-contract.d.ts +20 -0
- package/dist/framework/loop-budget-contract.d.ts.map +1 -0
- package/dist/framework/loop-budget-contract.js +13 -0
- package/dist/framework/loop-budget-contract.js.map +1 -0
- package/dist/framework/prompt.d.ts.map +1 -1
- package/dist/framework/prompt.js +5 -4
- package/dist/framework/prompt.js.map +1 -1
- package/dist/framework/query.d.ts +71 -26
- package/dist/framework/query.d.ts.map +1 -1
- package/dist/framework/query.js +371 -102
- package/dist/framework/query.js.map +1 -1
- package/dist/framework/stop-decision.d.ts +56 -0
- package/dist/framework/stop-decision.d.ts.map +1 -0
- package/dist/framework/stop-decision.js +36 -0
- package/dist/framework/stop-decision.js.map +1 -0
- package/dist/framework/store.d.ts +4 -2
- package/dist/framework/store.d.ts.map +1 -1
- package/dist/framework/store.js +1 -0
- package/dist/framework/store.js.map +1 -1
- package/dist/framework/tool-call-orchestrator.d.ts +80 -0
- package/dist/framework/tool-call-orchestrator.d.ts.map +1 -0
- package/dist/framework/tool-call-orchestrator.js +192 -0
- package/dist/framework/tool-call-orchestrator.js.map +1 -0
- package/dist/framework/tool-state.d.ts +12 -11
- package/dist/framework/tool-state.d.ts.map +1 -1
- package/dist/framework/tool-state.js +36 -28
- package/dist/framework/tool-state.js.map +1 -1
- package/dist/framework/tool.d.ts +0 -9
- package/dist/framework/tool.d.ts.map +1 -1
- package/dist/framework/tool.js.map +1 -1
- package/dist/harness/assembler.d.ts.map +1 -1
- package/dist/harness/assembler.js +77 -19
- package/dist/harness/assembler.js.map +1 -1
- package/dist/harness/capability-profile.d.ts +3 -0
- package/dist/harness/capability-profile.d.ts.map +1 -0
- package/dist/harness/capability-profile.js +44 -0
- package/dist/harness/capability-profile.js.map +1 -0
- package/dist/harness/capsule.d.ts.map +1 -1
- package/dist/harness/capsule.js +22 -3
- package/dist/harness/capsule.js.map +1 -1
- package/dist/harness/compact-benchmark-corpus.d.ts +10 -0
- package/dist/harness/compact-benchmark-corpus.d.ts.map +1 -0
- package/dist/harness/compact-benchmark-corpus.js +56 -0
- package/dist/harness/compact-benchmark-corpus.js.map +1 -0
- package/dist/harness/context-harness.d.ts +23 -3
- package/dist/harness/context-harness.d.ts.map +1 -1
- package/dist/harness/context-harness.js +183 -11
- package/dist/harness/context-harness.js.map +1 -1
- package/dist/harness/contract.d.ts.map +1 -1
- package/dist/harness/contract.js +106 -11
- package/dist/harness/contract.js.map +1 -1
- package/dist/harness/drift-guard.d.ts +2 -1
- package/dist/harness/drift-guard.d.ts.map +1 -1
- package/dist/harness/drift-guard.js +315 -20
- package/dist/harness/drift-guard.js.map +1 -1
- package/dist/harness/evidence.d.ts.map +1 -1
- package/dist/harness/evidence.js +25 -12
- package/dist/harness/evidence.js.map +1 -1
- package/dist/harness/index.d.ts +7 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +19 -1
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/ledger.d.ts.map +1 -1
- package/dist/harness/ledger.js +44 -14
- package/dist/harness/ledger.js.map +1 -1
- package/dist/harness/progress-controller.d.ts +14 -0
- package/dist/harness/progress-controller.d.ts.map +1 -0
- package/dist/harness/progress-controller.js +110 -0
- package/dist/harness/progress-controller.js.map +1 -0
- package/dist/harness/state.d.ts.map +1 -1
- package/dist/harness/state.js +5 -2
- package/dist/harness/state.js.map +1 -1
- package/dist/harness/stop-controller.d.ts +15 -0
- package/dist/harness/stop-controller.d.ts.map +1 -0
- package/dist/harness/stop-controller.js +87 -0
- package/dist/harness/stop-controller.js.map +1 -0
- package/dist/harness/types.d.ts +137 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/verification.d.ts +7 -0
- package/dist/harness/verification.d.ts.map +1 -0
- package/dist/harness/verification.js +122 -0
- package/dist/harness/verification.js.map +1 -0
- package/dist/index.d.ts +70 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -59
- package/dist/index.js.map +1 -1
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +1 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/prompt-context.d.ts +42 -0
- package/dist/memory/prompt-context.d.ts.map +1 -0
- package/dist/memory/prompt-context.js +129 -0
- package/dist/memory/prompt-context.js.map +1 -0
- package/dist/print-ui/launch.d.ts.map +1 -1
- package/dist/print-ui/launch.js +9 -2
- package/dist/print-ui/launch.js.map +1 -1
- package/dist/product/paths.d.ts +7 -0
- package/dist/product/paths.d.ts.map +1 -1
- package/dist/product/paths.js +19 -0
- package/dist/product/paths.js.map +1 -1
- package/dist/runtime/agent-loop.d.ts +78 -0
- package/dist/runtime/agent-loop.d.ts.map +1 -0
- package/dist/runtime/agent-loop.js +418 -0
- package/dist/runtime/agent-loop.js.map +1 -0
- package/dist/runtime/agent-runtime-controller.d.ts +10 -57
- package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-controller.js +265 -1215
- package/dist/runtime/agent-runtime-controller.js.map +1 -1
- package/dist/runtime/agent-runtime-protocol.d.ts +4 -5
- package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-protocol.js.map +1 -1
- package/dist/runtime/agent-runtime-runner.d.ts +34 -0
- package/dist/runtime/agent-runtime-runner.d.ts.map +1 -0
- package/dist/runtime/agent-runtime-runner.js +3 -0
- package/dist/runtime/agent-runtime-runner.js.map +1 -0
- package/dist/runtime/batch-read-service.d.ts +29 -0
- package/dist/runtime/batch-read-service.d.ts.map +1 -0
- package/dist/runtime/batch-read-service.js +212 -0
- package/dist/runtime/batch-read-service.js.map +1 -0
- package/dist/runtime/builtin-tool-provider.d.ts +30 -0
- package/dist/runtime/builtin-tool-provider.d.ts.map +1 -0
- package/dist/runtime/builtin-tool-provider.js +233 -0
- package/dist/runtime/builtin-tool-provider.js.map +1 -0
- package/dist/runtime/capabilities/compiler.d.ts +11 -0
- package/dist/runtime/capabilities/compiler.d.ts.map +1 -0
- package/dist/runtime/capabilities/compiler.js +719 -0
- package/dist/runtime/capabilities/compiler.js.map +1 -0
- package/dist/runtime/capabilities/index.d.ts +3 -0
- package/dist/runtime/capabilities/index.d.ts.map +1 -0
- package/dist/runtime/capabilities/index.js +9 -0
- package/dist/runtime/capabilities/index.js.map +1 -0
- package/dist/runtime/capabilities/types.d.ts +175 -0
- package/dist/runtime/capabilities/types.d.ts.map +1 -0
- package/dist/runtime/capabilities/types.js +3 -0
- package/dist/runtime/capabilities/types.js.map +1 -0
- package/dist/runtime/capability-receipt-journal.d.ts +29 -0
- package/dist/runtime/capability-receipt-journal.d.ts.map +1 -0
- package/dist/runtime/capability-receipt-journal.js +264 -0
- package/dist/runtime/capability-receipt-journal.js.map +1 -0
- package/dist/runtime/capability-step-factory.d.ts +73 -0
- package/dist/runtime/capability-step-factory.d.ts.map +1 -0
- package/dist/runtime/capability-step-factory.js +302 -0
- package/dist/runtime/capability-step-factory.js.map +1 -0
- package/dist/runtime/compact-transaction.d.ts +225 -0
- package/dist/runtime/compact-transaction.d.ts.map +1 -0
- package/dist/runtime/compact-transaction.js +622 -0
- package/dist/runtime/compact-transaction.js.map +1 -0
- package/dist/runtime/composer/buffer.d.ts +3 -4
- package/dist/runtime/composer/buffer.d.ts.map +1 -1
- package/dist/runtime/composer/buffer.js +3 -4
- package/dist/runtime/composer/buffer.js.map +1 -1
- package/dist/runtime/composer/grapheme.d.ts +2 -4
- package/dist/runtime/composer/grapheme.d.ts.map +1 -1
- package/dist/runtime/composer/grapheme.js +2 -4
- package/dist/runtime/composer/grapheme.js.map +1 -1
- package/dist/runtime/composer/layout.d.ts +1 -3
- package/dist/runtime/composer/layout.d.ts.map +1 -1
- package/dist/runtime/composer/layout.js +1 -3
- package/dist/runtime/composer/layout.js.map +1 -1
- package/dist/runtime/core-tools/descriptors.d.ts +17 -0
- package/dist/runtime/core-tools/descriptors.d.ts.map +1 -0
- package/dist/runtime/core-tools/descriptors.js +185 -0
- package/dist/runtime/core-tools/descriptors.js.map +1 -0
- package/dist/runtime/first-party-core-provider.d.ts +55 -0
- package/dist/runtime/first-party-core-provider.d.ts.map +1 -0
- package/dist/runtime/first-party-core-provider.js +197 -0
- package/dist/runtime/first-party-core-provider.js.map +1 -0
- package/dist/runtime/first-party-long-tail-provider.d.ts +57 -0
- package/dist/runtime/first-party-long-tail-provider.d.ts.map +1 -0
- package/dist/runtime/first-party-long-tail-provider.js +238 -0
- package/dist/runtime/first-party-long-tail-provider.js.map +1 -0
- package/dist/runtime/first-party-tool-services.d.ts +43 -0
- package/dist/runtime/first-party-tool-services.d.ts.map +1 -0
- package/dist/runtime/first-party-tool-services.js +200 -0
- package/dist/runtime/first-party-tool-services.js.map +1 -0
- package/dist/runtime/first-party-tool-universe.d.ts +14 -0
- package/dist/runtime/first-party-tool-universe.d.ts.map +1 -0
- package/dist/runtime/first-party-tool-universe.js +20 -0
- package/dist/runtime/first-party-tool-universe.js.map +1 -0
- package/dist/runtime/goal-lifecycle-v2.d.ts +63 -0
- package/dist/runtime/goal-lifecycle-v2.d.ts.map +1 -0
- package/dist/runtime/goal-lifecycle-v2.js +253 -0
- package/dist/runtime/goal-lifecycle-v2.js.map +1 -0
- package/dist/runtime/goal-runtime-coordinator.d.ts +105 -0
- package/dist/runtime/goal-runtime-coordinator.d.ts.map +1 -0
- package/dist/runtime/goal-runtime-coordinator.js +506 -0
- package/dist/runtime/goal-runtime-coordinator.js.map +1 -0
- package/dist/runtime/goals/types.d.ts +0 -1
- package/dist/runtime/goals/types.d.ts.map +1 -1
- package/dist/runtime/goals/types.js +0 -1
- package/dist/runtime/goals/types.js.map +1 -1
- package/dist/runtime/harness-confluence.d.ts +165 -0
- package/dist/runtime/harness-confluence.d.ts.map +1 -0
- package/dist/runtime/harness-confluence.js +807 -0
- package/dist/runtime/harness-confluence.js.map +1 -0
- package/dist/runtime/harness-eval.d.ts +96 -0
- package/dist/runtime/harness-eval.d.ts.map +1 -0
- package/dist/runtime/harness-eval.js +181 -0
- package/dist/runtime/harness-eval.js.map +1 -0
- package/dist/runtime/harness-metrics.d.ts +202 -0
- package/dist/runtime/harness-metrics.d.ts.map +1 -0
- package/dist/runtime/harness-metrics.js +415 -0
- package/dist/runtime/harness-metrics.js.map +1 -0
- package/dist/runtime/legacy-session-importer.d.ts +99 -0
- package/dist/runtime/legacy-session-importer.d.ts.map +1 -0
- package/dist/runtime/legacy-session-importer.js +455 -0
- package/dist/runtime/legacy-session-importer.js.map +1 -0
- package/dist/runtime/legacy-thread-materializer.d.ts +72 -0
- package/dist/runtime/legacy-thread-materializer.d.ts.map +1 -0
- package/dist/runtime/legacy-thread-materializer.js +553 -0
- package/dist/runtime/legacy-thread-materializer.js.map +1 -0
- package/dist/runtime/long-tail-tools/descriptors.d.ts +23 -0
- package/dist/runtime/long-tail-tools/descriptors.d.ts.map +1 -0
- package/dist/runtime/long-tail-tools/descriptors.js +423 -0
- package/dist/runtime/long-tail-tools/descriptors.js.map +1 -0
- package/dist/runtime/loop-budget.d.ts +1 -1
- package/dist/runtime/loop-budget.d.ts.map +1 -1
- package/dist/runtime/loop-budget.js +2 -2
- package/dist/runtime/loop-budget.js.map +1 -1
- package/dist/runtime/mcp/first-party-mcp-adapter.d.ts +75 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.d.ts.map +1 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.js +484 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.js.map +1 -0
- package/dist/runtime/mcp/first-party-mcp-config.d.ts +13 -0
- package/dist/runtime/mcp/first-party-mcp-config.d.ts.map +1 -0
- package/dist/runtime/mcp/first-party-mcp-config.js +139 -0
- package/dist/runtime/mcp/first-party-mcp-config.js.map +1 -0
- package/dist/runtime/mcp/index.d.ts +5 -0
- package/dist/runtime/mcp/index.d.ts.map +1 -0
- package/dist/{skills → runtime/mcp}/index.js +3 -9
- package/dist/runtime/mcp/index.js.map +1 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.d.ts +95 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.d.ts.map +1 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.js +854 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.js.map +1 -0
- package/dist/runtime/mcp/types.d.ts +128 -0
- package/dist/runtime/mcp/types.d.ts.map +1 -0
- package/dist/runtime/mcp/types.js +5 -0
- package/dist/runtime/mcp/types.js.map +1 -0
- package/dist/runtime/model-coordinator.d.ts +44 -1
- package/dist/runtime/model-coordinator.d.ts.map +1 -1
- package/dist/runtime/model-coordinator.js +161 -19
- package/dist/runtime/model-coordinator.js.map +1 -1
- package/dist/runtime/orion-runtime-v1.d.ts +321 -0
- package/dist/runtime/orion-runtime-v1.d.ts.map +1 -0
- package/dist/runtime/orion-runtime-v1.js +958 -0
- package/dist/runtime/orion-runtime-v1.js.map +1 -0
- package/dist/runtime/orion-session-runner.d.ts +37 -0
- package/dist/runtime/orion-session-runner.d.ts.map +1 -0
- package/dist/runtime/orion-session-runner.js +146 -0
- package/dist/runtime/orion-session-runner.js.map +1 -0
- package/dist/runtime/product-orion-runtime.d.ts +35 -0
- package/dist/runtime/product-orion-runtime.d.ts.map +1 -0
- package/dist/runtime/product-orion-runtime.js +1019 -0
- package/dist/runtime/product-orion-runtime.js.map +1 -0
- package/dist/runtime/prompts/index.d.ts +3 -0
- package/dist/runtime/prompts/index.d.ts.map +1 -0
- package/dist/{ink-ui/types.js → runtime/prompts/index.js} +3 -2
- package/dist/runtime/prompts/index.js.map +1 -0
- package/dist/runtime/prompts/prompt-registry.d.ts +22 -0
- package/dist/runtime/prompts/prompt-registry.d.ts.map +1 -0
- package/dist/runtime/prompts/prompt-registry.js +356 -0
- package/dist/runtime/prompts/prompt-registry.js.map +1 -0
- package/dist/runtime/prompts/types.d.ts +111 -0
- package/dist/runtime/prompts/types.d.ts.map +1 -0
- package/dist/runtime/prompts/types.js +5 -0
- package/dist/runtime/prompts/types.js.map +1 -0
- package/dist/runtime/protocol/canonical.d.ts +3 -0
- package/dist/runtime/protocol/canonical.d.ts.map +1 -0
- package/dist/runtime/protocol/canonical.js +21 -0
- package/dist/runtime/protocol/canonical.js.map +1 -0
- package/dist/runtime/protocol/index.d.ts +4 -0
- package/dist/runtime/protocol/index.d.ts.map +1 -0
- package/dist/runtime/protocol/index.js +16 -0
- package/dist/runtime/protocol/index.js.map +1 -0
- package/dist/runtime/protocol/runtime-protocol-v1.d.ts +671 -0
- package/dist/runtime/protocol/runtime-protocol-v1.d.ts.map +1 -0
- package/dist/runtime/protocol/runtime-protocol-v1.js +557 -0
- package/dist/runtime/protocol/runtime-protocol-v1.js.map +1 -0
- package/dist/runtime/release-receipts.d.ts +109 -0
- package/dist/runtime/release-receipts.d.ts.map +1 -0
- package/dist/runtime/release-receipts.js +304 -0
- package/dist/runtime/release-receipts.js.map +1 -0
- package/dist/runtime/resource-scope.d.ts +123 -0
- package/dist/runtime/resource-scope.d.ts.map +1 -0
- package/dist/runtime/resource-scope.js +363 -0
- package/dist/runtime/resource-scope.js.map +1 -0
- package/dist/runtime/runtime-event-buffer.d.ts +78 -0
- package/dist/runtime/runtime-event-buffer.d.ts.map +1 -0
- package/dist/runtime/runtime-event-buffer.js +237 -0
- package/dist/runtime/runtime-event-buffer.js.map +1 -0
- package/dist/runtime/runtime-services.d.ts +87 -0
- package/dist/runtime/runtime-services.d.ts.map +1 -0
- package/dist/runtime/runtime-services.js +180 -0
- package/dist/runtime/runtime-services.js.map +1 -0
- package/dist/runtime/skills/bounded-lru-cache.d.ts +34 -0
- package/dist/runtime/skills/bounded-lru-cache.d.ts.map +1 -0
- package/dist/runtime/skills/bounded-lru-cache.js +100 -0
- package/dist/runtime/skills/bounded-lru-cache.js.map +1 -0
- package/dist/runtime/skills/filesystem-skill-provider.d.ts +96 -0
- package/dist/runtime/skills/filesystem-skill-provider.d.ts.map +1 -0
- package/dist/runtime/skills/filesystem-skill-provider.js +829 -0
- package/dist/runtime/skills/filesystem-skill-provider.js.map +1 -0
- package/dist/runtime/skills/index.d.ts +5 -0
- package/dist/runtime/skills/index.d.ts.map +1 -0
- package/dist/{ink-ui/controllers/chat-controller.js → runtime/skills/index.js} +5 -2
- package/dist/runtime/skills/index.js.map +1 -0
- package/dist/runtime/skills/lazy-skill-runtime.d.ts +77 -0
- package/dist/runtime/skills/lazy-skill-runtime.d.ts.map +1 -0
- package/dist/runtime/skills/lazy-skill-runtime.js +673 -0
- package/dist/runtime/skills/lazy-skill-runtime.js.map +1 -0
- package/dist/runtime/skills/types.d.ts +137 -0
- package/dist/runtime/skills/types.d.ts.map +1 -0
- package/dist/runtime/skills/types.js +13 -0
- package/dist/runtime/skills/types.js.map +1 -0
- package/dist/runtime/step-snapshot.d.ts +183 -0
- package/dist/runtime/step-snapshot.d.ts.map +1 -0
- package/dist/runtime/step-snapshot.js +286 -0
- package/dist/runtime/step-snapshot.js.map +1 -0
- package/dist/runtime/subagent-thread-runtime.d.ts +239 -0
- package/dist/runtime/subagent-thread-runtime.d.ts.map +1 -0
- package/dist/runtime/subagent-thread-runtime.js +876 -0
- package/dist/runtime/subagent-thread-runtime.js.map +1 -0
- package/dist/runtime/subagents/index.d.ts +5 -2
- package/dist/runtime/subagents/index.d.ts.map +1 -1
- package/dist/runtime/subagents/index.js +10 -2
- package/dist/runtime/subagents/index.js.map +1 -1
- package/dist/runtime/subagents/parent-step-fork.d.ts +36 -0
- package/dist/runtime/subagents/parent-step-fork.d.ts.map +1 -0
- package/dist/runtime/subagents/parent-step-fork.js +83 -0
- package/dist/runtime/subagents/parent-step-fork.js.map +1 -0
- package/dist/runtime/subagents/production.d.ts +65 -42
- package/dist/runtime/subagents/production.d.ts.map +1 -1
- package/dist/runtime/subagents/production.js +494 -151
- package/dist/runtime/subagents/production.js.map +1 -1
- package/dist/runtime/subagents/receipt-journal.d.ts +20 -0
- package/dist/runtime/subagents/receipt-journal.d.ts.map +1 -0
- package/dist/runtime/subagents/receipt-journal.js +74 -0
- package/dist/runtime/subagents/receipt-journal.js.map +1 -0
- package/dist/runtime/subagents/runner.d.ts +12 -1
- package/dist/runtime/subagents/runner.d.ts.map +1 -1
- package/dist/runtime/subagents/runner.js +62 -1
- package/dist/runtime/subagents/runner.js.map +1 -1
- package/dist/runtime/subagents/runtime-contract.d.ts +29 -0
- package/dist/runtime/subagents/runtime-contract.d.ts.map +1 -0
- package/dist/runtime/subagents/runtime-contract.js +3 -0
- package/dist/runtime/subagents/runtime-contract.js.map +1 -0
- package/dist/runtime/subagents/runtime-integration.d.ts +41 -56
- package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -1
- package/dist/runtime/subagents/runtime-integration.js +34 -197
- package/dist/runtime/subagents/runtime-integration.js.map +1 -1
- package/dist/runtime/subagents/supervisor.d.ts +19 -7
- package/dist/runtime/subagents/supervisor.d.ts.map +1 -1
- package/dist/runtime/subagents/supervisor.js +88 -39
- package/dist/runtime/subagents/supervisor.js.map +1 -1
- package/dist/runtime/subagents/types.d.ts +5 -2
- package/dist/runtime/subagents/types.d.ts.map +1 -1
- package/dist/runtime/subagents/types.js +1 -1
- package/dist/runtime/subagents/types.js.map +1 -1
- package/dist/runtime/task-context-service.d.ts +91 -0
- package/dist/runtime/task-context-service.d.ts.map +1 -0
- package/dist/runtime/task-context-service.js +122 -0
- package/dist/runtime/task-context-service.js.map +1 -0
- package/dist/runtime/thread-admission.d.ts +130 -0
- package/dist/runtime/thread-admission.d.ts.map +1 -0
- package/dist/runtime/thread-admission.js +276 -0
- package/dist/runtime/thread-admission.js.map +1 -0
- package/dist/runtime/thread-compact-persistence.d.ts +50 -0
- package/dist/runtime/thread-compact-persistence.d.ts.map +1 -0
- package/dist/runtime/thread-compact-persistence.js +176 -0
- package/dist/runtime/thread-compact-persistence.js.map +1 -0
- package/dist/runtime/thread-event-store.d.ts +98 -0
- package/dist/runtime/thread-event-store.d.ts.map +1 -0
- package/dist/runtime/thread-event-store.js +737 -0
- package/dist/runtime/thread-event-store.js.map +1 -0
- package/dist/runtime/thread-projection.d.ts +91 -0
- package/dist/runtime/thread-projection.d.ts.map +1 -0
- package/dist/runtime/thread-projection.js +407 -0
- package/dist/runtime/thread-projection.js.map +1 -0
- package/dist/runtime/thread-runtime.d.ts +165 -0
- package/dist/runtime/thread-runtime.d.ts.map +1 -0
- package/dist/runtime/thread-runtime.js +704 -0
- package/dist/runtime/thread-runtime.js.map +1 -0
- package/dist/runtime/thread-tool-journal.d.ts +11 -0
- package/dist/runtime/thread-tool-journal.d.ts.map +1 -0
- package/dist/runtime/thread-tool-journal.js +131 -0
- package/dist/runtime/thread-tool-journal.js.map +1 -0
- package/dist/runtime/thread-ui-adapter.d.ts +85 -0
- package/dist/runtime/thread-ui-adapter.d.ts.map +1 -0
- package/dist/runtime/thread-ui-adapter.js +514 -0
- package/dist/runtime/thread-ui-adapter.js.map +1 -0
- package/dist/runtime/tool-gateway.d.ts +159 -0
- package/dist/runtime/tool-gateway.d.ts.map +1 -0
- package/dist/runtime/tool-gateway.js +311 -0
- package/dist/runtime/tool-gateway.js.map +1 -0
- package/dist/runtime/turn-commit.d.ts +103 -0
- package/dist/runtime/turn-commit.d.ts.map +1 -0
- package/dist/runtime/turn-commit.js +321 -0
- package/dist/runtime/turn-commit.js.map +1 -0
- package/dist/runtime/ui-events.d.ts +15 -5
- package/dist/runtime/ui-events.d.ts.map +1 -1
- package/dist/runtime/ui-events.js +0 -1
- package/dist/runtime/ui-events.js.map +1 -1
- package/dist/runtime/ui-view-model.d.ts +1 -1
- package/dist/runtime/ui-view-model.d.ts.map +1 -1
- package/dist/runtime/ui-view-model.js +3 -5
- package/dist/runtime/ui-view-model.js.map +1 -1
- package/dist/services/compact/auto-compact.d.ts +82 -2
- package/dist/services/compact/auto-compact.d.ts.map +1 -1
- package/dist/services/compact/auto-compact.js +226 -44
- package/dist/services/compact/auto-compact.js.map +1 -1
- package/dist/services/compact/compact.d.ts +54 -37
- package/dist/services/compact/compact.d.ts.map +1 -1
- package/dist/services/compact/compact.js +512 -127
- package/dist/services/compact/compact.js.map +1 -1
- package/dist/services/compact/coordinator.d.ts +5 -1
- package/dist/services/compact/coordinator.d.ts.map +1 -1
- package/dist/services/compact/coordinator.js +10 -1
- package/dist/services/compact/coordinator.js.map +1 -1
- package/dist/services/compact/fingerprint.d.ts +27 -0
- package/dist/services/compact/fingerprint.d.ts.map +1 -0
- package/dist/services/compact/fingerprint.js +69 -0
- package/dist/services/compact/fingerprint.js.map +1 -0
- package/dist/services/compact/index.d.ts +7 -5
- package/dist/services/compact/index.d.ts.map +1 -1
- package/dist/services/compact/index.js +19 -6
- package/dist/services/compact/index.js.map +1 -1
- package/dist/services/compact/planner.d.ts +41 -0
- package/dist/services/compact/planner.d.ts.map +1 -0
- package/dist/services/compact/planner.js +102 -0
- package/dist/services/compact/planner.js.map +1 -0
- package/dist/services/compact/semantic-summary.d.ts +93 -0
- package/dist/services/compact/semantic-summary.d.ts.map +1 -0
- package/dist/services/compact/semantic-summary.js +158 -0
- package/dist/services/compact/semantic-summary.js.map +1 -0
- package/dist/services/compact/summary-generator.d.ts +23 -0
- package/dist/services/compact/summary-generator.d.ts.map +1 -1
- package/dist/services/compact/summary-generator.js +173 -39
- package/dist/services/compact/summary-generator.js.map +1 -1
- package/dist/services/config-dir.d.ts +1 -1
- package/dist/services/config-dir.d.ts.map +1 -1
- package/dist/services/config-dir.js +2 -1
- package/dist/services/config-dir.js.map +1 -1
- package/dist/services/config.d.ts +2 -16
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +2 -29
- package/dist/services/config.js.map +1 -1
- package/dist/services/doctor.d.ts +0 -2
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +39 -64
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/file-context.d.ts.map +1 -1
- package/dist/services/file-context.js +29 -33
- package/dist/services/file-context.js.map +1 -1
- package/dist/services/global-config.d.ts +8 -2
- package/dist/services/global-config.d.ts.map +1 -1
- package/dist/services/global-config.js +8 -0
- package/dist/services/global-config.js.map +1 -1
- package/dist/services/llm.d.ts +3 -0
- package/dist/services/llm.d.ts.map +1 -1
- package/dist/services/llm.js +7 -0
- package/dist/services/llm.js.map +1 -1
- package/dist/services/project-instructions.d.ts.map +1 -1
- package/dist/services/project-instructions.js +10 -17
- package/dist/services/project-instructions.js.map +1 -1
- package/dist/services/safe-project-reader.d.ts +30 -0
- package/dist/services/safe-project-reader.d.ts.map +1 -0
- package/dist/services/safe-project-reader.js +141 -0
- package/dist/services/safe-project-reader.js.map +1 -0
- package/dist/services/session-storage.d.ts +134 -5
- package/dist/services/session-storage.d.ts.map +1 -1
- package/dist/services/session-storage.js +727 -57
- package/dist/services/session-storage.js.map +1 -1
- package/dist/services/usage-state.d.ts +7 -0
- package/dist/services/usage-state.d.ts.map +1 -1
- package/dist/services/usage-state.js +117 -16
- package/dist/services/usage-state.js.map +1 -1
- package/dist/skills/builtin/code-review/SKILL.md +51 -0
- package/dist/skills/builtin/security-check/SKILL.md +54 -0
- package/dist/skills/builtin/test-gen/SKILL.md +49 -0
- package/dist/terminal-ui/launch.d.ts +3 -1
- package/dist/terminal-ui/launch.d.ts.map +1 -1
- package/dist/terminal-ui/launch.js +19 -3
- package/dist/terminal-ui/launch.js.map +1 -1
- package/dist/tools/core/common.d.ts +34 -0
- package/dist/tools/core/common.d.ts.map +1 -0
- package/dist/tools/core/common.js +164 -0
- package/dist/tools/core/common.js.map +1 -0
- package/dist/tools/core/edit-file.d.ts +10 -0
- package/dist/tools/core/edit-file.d.ts.map +1 -0
- package/dist/tools/core/edit-file.js +301 -0
- package/dist/tools/core/edit-file.js.map +1 -0
- package/dist/tools/core/exec-command.d.ts +2 -0
- package/dist/tools/core/exec-command.d.ts.map +1 -0
- package/dist/tools/core/exec-command.js +347 -0
- package/dist/tools/core/exec-command.js.map +1 -0
- package/dist/tools/core/glob.d.ts +2 -0
- package/dist/tools/core/glob.d.ts.map +1 -0
- package/dist/tools/core/glob.js +133 -0
- package/dist/tools/core/glob.js.map +1 -0
- package/dist/tools/core/grep.d.ts +12 -0
- package/dist/tools/core/grep.d.ts.map +1 -0
- package/dist/tools/core/grep.js +223 -0
- package/dist/tools/core/grep.js.map +1 -0
- package/dist/tools/core/index.d.ts +15 -0
- package/dist/tools/core/index.d.ts.map +1 -0
- package/dist/tools/core/index.js +31 -0
- package/dist/tools/core/index.js.map +1 -0
- package/dist/tools/core/list-files.d.ts +2 -0
- package/dist/tools/core/list-files.d.ts.map +1 -0
- package/dist/tools/core/list-files.js +87 -0
- package/dist/tools/core/list-files.js.map +1 -0
- package/dist/tools/core/read-file.d.ts +2 -0
- package/dist/tools/core/read-file.d.ts.map +1 -0
- package/dist/tools/core/read-file.js +129 -0
- package/dist/tools/core/read-file.js.map +1 -0
- package/dist/tools/core/write-file.d.ts +2 -0
- package/dist/tools/core/write-file.d.ts.map +1 -0
- package/dist/tools/core/write-file.js +65 -0
- package/dist/tools/core/write-file.js.map +1 -0
- package/dist/tools/todo.d.ts +3 -4
- package/dist/tools/todo.d.ts.map +1 -1
- package/dist/tools/todo.js +80 -79
- package/dist/tools/todo.js.map +1 -1
- package/dist/tui-ui/chrome-view-model.js +1 -1
- package/dist/tui-ui/chrome-view-model.js.map +1 -1
- package/dist/tui-ui/layout.js +1 -1
- package/dist/tui-ui/layout.js.map +1 -1
- package/docs/migration/v0.1.9-to-v0.2.0.md +98 -0
- package/docs/orion.example.json +79 -0
- package/docs/plan/v0.2.0-dsh-harness-redesign-plan.md +1234 -0
- package/docs/plan/v0.2.0-release-checklist.md +91 -0
- package/docs/readme.md +27 -0
- package/npm-shrinkwrap.json +9 -438
- package/package.json +19 -11
- package/dist/agents/coder.d.ts +0 -12
- package/dist/agents/coder.d.ts.map +0 -1
- package/dist/agents/coder.js +0 -48
- package/dist/agents/coder.js.map +0 -1
- package/dist/agents/coordinator.d.ts +0 -86
- package/dist/agents/coordinator.d.ts.map +0 -1
- package/dist/agents/coordinator.js +0 -251
- package/dist/agents/coordinator.js.map +0 -1
- package/dist/agents/fork.d.ts +0 -69
- package/dist/agents/fork.d.ts.map +0 -1
- package/dist/agents/fork.js +0 -164
- package/dist/agents/fork.js.map +0 -1
- package/dist/agents/leader.d.ts +0 -12
- package/dist/agents/leader.d.ts.map +0 -1
- package/dist/agents/leader.js +0 -49
- package/dist/agents/leader.js.map +0 -1
- package/dist/agents/router.d.ts +0 -59
- package/dist/agents/router.d.ts.map +0 -1
- package/dist/agents/router.js +0 -193
- package/dist/agents/router.js.map +0 -1
- package/dist/agents/worker-pool.d.ts +0 -72
- package/dist/agents/worker-pool.d.ts.map +0 -1
- package/dist/agents/worker-pool.js +0 -224
- package/dist/agents/worker-pool.js.map +0 -1
- package/dist/commands/legacy-commands.d.ts +0 -4
- package/dist/commands/legacy-commands.d.ts.map +0 -1
- package/dist/commands/legacy-commands.js +0 -44
- package/dist/commands/legacy-commands.js.map +0 -1
- package/dist/core/agent.d.ts +0 -84
- package/dist/core/agent.d.ts.map +0 -1
- package/dist/core/agent.js +0 -58
- package/dist/core/agent.js.map +0 -1
- package/dist/core/brain.d.ts +0 -50
- package/dist/core/brain.d.ts.map +0 -1
- package/dist/core/brain.js +0 -95
- package/dist/core/brain.js.map +0 -1
- package/dist/framework/tool-scheduler.d.ts +0 -186
- package/dist/framework/tool-scheduler.d.ts.map +0 -1
- package/dist/framework/tool-scheduler.js +0 -558
- package/dist/framework/tool-scheduler.js.map +0 -1
- package/dist/harness/harness.d.ts +0 -58
- package/dist/harness/harness.d.ts.map +0 -1
- package/dist/harness/harness.js +0 -195
- package/dist/harness/harness.js.map +0 -1
- package/dist/harness/safety.d.ts +0 -101
- package/dist/harness/safety.d.ts.map +0 -1
- package/dist/harness/safety.js +0 -322
- package/dist/harness/safety.js.map +0 -1
- package/dist/init.d.ts +0 -108
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -393
- package/dist/init.js.map +0 -1
- package/dist/ink-ui/App.d.ts +0 -9
- package/dist/ink-ui/App.d.ts.map +0 -1
- package/dist/ink-ui/App.js +0 -12
- package/dist/ink-ui/App.js.map +0 -1
- package/dist/ink-ui/components/Markdown.d.ts +0 -10
- package/dist/ink-ui/components/Markdown.d.ts.map +0 -1
- package/dist/ink-ui/components/Markdown.js +0 -210
- package/dist/ink-ui/components/Markdown.js.map +0 -1
- package/dist/ink-ui/components/NativeCursor.d.ts +0 -12
- package/dist/ink-ui/components/NativeCursor.d.ts.map +0 -1
- package/dist/ink-ui/components/NativeCursor.js +0 -35
- package/dist/ink-ui/components/NativeCursor.js.map +0 -1
- package/dist/ink-ui/components/PixelHorseBanner.d.ts +0 -8
- package/dist/ink-ui/components/PixelHorseBanner.d.ts.map +0 -1
- package/dist/ink-ui/components/PixelHorseBanner.js +0 -97
- package/dist/ink-ui/components/PixelHorseBanner.js.map +0 -1
- package/dist/ink-ui/components/PromptInput.d.ts +0 -13
- package/dist/ink-ui/components/PromptInput.d.ts.map +0 -1
- package/dist/ink-ui/components/PromptInput.js +0 -30
- package/dist/ink-ui/components/PromptInput.js.map +0 -1
- package/dist/ink-ui/components/RunningHorseIndicator.d.ts +0 -13
- package/dist/ink-ui/components/RunningHorseIndicator.d.ts.map +0 -1
- package/dist/ink-ui/components/RunningHorseIndicator.js +0 -53
- package/dist/ink-ui/components/RunningHorseIndicator.js.map +0 -1
- package/dist/ink-ui/components/SelectList.d.ts +0 -16
- package/dist/ink-ui/components/SelectList.d.ts.map +0 -1
- package/dist/ink-ui/components/SelectList.js +0 -60
- package/dist/ink-ui/components/SelectList.js.map +0 -1
- package/dist/ink-ui/components/StatusLine.d.ts +0 -11
- package/dist/ink-ui/components/StatusLine.d.ts.map +0 -1
- package/dist/ink-ui/components/StatusLine.js +0 -70
- package/dist/ink-ui/components/StatusLine.js.map +0 -1
- package/dist/ink-ui/components/ToolActivity.d.ts +0 -19
- package/dist/ink-ui/components/ToolActivity.d.ts.map +0 -1
- package/dist/ink-ui/components/ToolActivity.js +0 -134
- package/dist/ink-ui/components/ToolActivity.js.map +0 -1
- package/dist/ink-ui/components/Transcript.d.ts +0 -14
- package/dist/ink-ui/components/Transcript.d.ts.map +0 -1
- package/dist/ink-ui/components/Transcript.js +0 -66
- package/dist/ink-ui/components/Transcript.js.map +0 -1
- package/dist/ink-ui/controllers/chat-controller.d.ts +0 -2
- package/dist/ink-ui/controllers/chat-controller.d.ts.map +0 -1
- package/dist/ink-ui/controllers/chat-controller.js.map +0 -1
- package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts +0 -6
- package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts.map +0 -1
- package/dist/ink-ui/hooks/use-raw-input-bridge.js +0 -27
- package/dist/ink-ui/hooks/use-raw-input-bridge.js.map +0 -1
- package/dist/ink-ui/hooks/use-terminal-size.d.ts +0 -7
- package/dist/ink-ui/hooks/use-terminal-size.d.ts.map +0 -1
- package/dist/ink-ui/hooks/use-terminal-size.js +0 -34
- package/dist/ink-ui/hooks/use-terminal-size.js.map +0 -1
- package/dist/ink-ui/launch.d.ts +0 -9
- package/dist/ink-ui/launch.d.ts.map +0 -1
- package/dist/ink-ui/launch.js +0 -101
- package/dist/ink-ui/launch.js.map +0 -1
- package/dist/ink-ui/runtime/grapheme.d.ts +0 -10
- package/dist/ink-ui/runtime/grapheme.d.ts.map +0 -1
- package/dist/ink-ui/runtime/grapheme.js +0 -17
- package/dist/ink-ui/runtime/grapheme.js.map +0 -1
- package/dist/ink-ui/runtime/input-buffer.d.ts +0 -10
- package/dist/ink-ui/runtime/input-buffer.d.ts.map +0 -1
- package/dist/ink-ui/runtime/input-buffer.js +0 -18
- package/dist/ink-ui/runtime/input-buffer.js.map +0 -1
- package/dist/ink-ui/runtime/layout-budget.d.ts +0 -13
- package/dist/ink-ui/runtime/layout-budget.d.ts.map +0 -1
- package/dist/ink-ui/runtime/layout-budget.js +0 -25
- package/dist/ink-ui/runtime/layout-budget.js.map +0 -1
- package/dist/ink-ui/runtime/native-cursor.d.ts +0 -62
- package/dist/ink-ui/runtime/native-cursor.d.ts.map +0 -1
- package/dist/ink-ui/runtime/native-cursor.js +0 -398
- package/dist/ink-ui/runtime/native-cursor.js.map +0 -1
- package/dist/ink-ui/runtime/prompt-layout.d.ts +0 -10
- package/dist/ink-ui/runtime/prompt-layout.d.ts.map +0 -1
- package/dist/ink-ui/runtime/prompt-layout.js +0 -21
- package/dist/ink-ui/runtime/prompt-layout.js.map +0 -1
- package/dist/ink-ui/runtime/raw-input.d.ts +0 -4
- package/dist/ink-ui/runtime/raw-input.d.ts.map +0 -1
- package/dist/ink-ui/runtime/raw-input.js +0 -15
- package/dist/ink-ui/runtime/raw-input.js.map +0 -1
- package/dist/ink-ui/runtime/transcript-state.d.ts +0 -37
- package/dist/ink-ui/runtime/transcript-state.d.ts.map +0 -1
- package/dist/ink-ui/runtime/transcript-state.js +0 -91
- package/dist/ink-ui/runtime/transcript-state.js.map +0 -1
- package/dist/ink-ui/screens/ReplScreen.d.ts +0 -24
- package/dist/ink-ui/screens/ReplScreen.d.ts.map +0 -1
- package/dist/ink-ui/screens/ReplScreen.js +0 -756
- package/dist/ink-ui/screens/ReplScreen.js.map +0 -1
- package/dist/ink-ui/types.d.ts +0 -2
- package/dist/ink-ui/types.d.ts.map +0 -1
- package/dist/ink-ui/types.js.map +0 -1
- package/dist/runtime/chat-checkpoint.d.ts +0 -17
- package/dist/runtime/chat-checkpoint.d.ts.map +0 -1
- package/dist/runtime/chat-checkpoint.js +0 -105
- package/dist/runtime/chat-checkpoint.js.map +0 -1
- package/dist/runtime/chat-command-scope.d.ts +0 -5
- package/dist/runtime/chat-command-scope.d.ts.map +0 -1
- package/dist/runtime/chat-command-scope.js +0 -22
- package/dist/runtime/chat-command-scope.js.map +0 -1
- package/dist/runtime/chat-controller.d.ts +0 -62
- package/dist/runtime/chat-controller.d.ts.map +0 -1
- package/dist/runtime/chat-controller.js +0 -1630
- package/dist/runtime/chat-controller.js.map +0 -1
- package/dist/runtime/chat-effort.d.ts +0 -5
- package/dist/runtime/chat-effort.d.ts.map +0 -1
- package/dist/runtime/chat-effort.js +0 -47
- package/dist/runtime/chat-effort.js.map +0 -1
- package/dist/runtime/chat-presentation.d.ts +0 -63
- package/dist/runtime/chat-presentation.d.ts.map +0 -1
- package/dist/runtime/chat-presentation.js +0 -561
- package/dist/runtime/chat-presentation.js.map +0 -1
- package/dist/runtime/chat-trace.d.ts +0 -52
- package/dist/runtime/chat-trace.d.ts.map +0 -1
- package/dist/runtime/chat-trace.js +0 -234
- package/dist/runtime/chat-trace.js.map +0 -1
- package/dist/runtime/chat-workspace.d.ts +0 -22
- package/dist/runtime/chat-workspace.d.ts.map +0 -1
- package/dist/runtime/chat-workspace.js +0 -154
- package/dist/runtime/chat-workspace.js.map +0 -1
- package/dist/runtime/goals/accounting.d.ts +0 -45
- package/dist/runtime/goals/accounting.d.ts.map +0 -1
- package/dist/runtime/goals/accounting.js +0 -114
- package/dist/runtime/goals/accounting.js.map +0 -1
- package/dist/runtime/goals/coordinator.d.ts +0 -89
- package/dist/runtime/goals/coordinator.d.ts.map +0 -1
- package/dist/runtime/goals/coordinator.js +0 -1481
- package/dist/runtime/goals/coordinator.js.map +0 -1
- package/dist/runtime/goals/lifecycle.d.ts +0 -13
- package/dist/runtime/goals/lifecycle.d.ts.map +0 -1
- package/dist/runtime/goals/lifecycle.js +0 -46
- package/dist/runtime/goals/lifecycle.js.map +0 -1
- package/dist/runtime/goals/prompt.d.ts +0 -16
- package/dist/runtime/goals/prompt.d.ts.map +0 -1
- package/dist/runtime/goals/prompt.js +0 -88
- package/dist/runtime/goals/prompt.js.map +0 -1
- package/dist/runtime/goals/tools.d.ts +0 -61
- package/dist/runtime/goals/tools.d.ts.map +0 -1
- package/dist/runtime/goals/tools.js +0 -568
- package/dist/runtime/goals/tools.js.map +0 -1
- package/dist/sdk/index.d.ts +0 -10
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js +0 -23
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/init.d.ts +0 -24
- package/dist/sdk/init.d.ts.map +0 -1
- package/dist/sdk/init.js +0 -48
- package/dist/sdk/init.js.map +0 -1
- package/dist/sdk/query.d.ts +0 -19
- package/dist/sdk/query.d.ts.map +0 -1
- package/dist/sdk/query.js +0 -42
- package/dist/sdk/query.js.map +0 -1
- package/dist/sdk/sessions.d.ts +0 -19
- package/dist/sdk/sessions.d.ts.map +0 -1
- package/dist/sdk/sessions.js +0 -57
- package/dist/sdk/sessions.js.map +0 -1
- package/dist/sdk/types.d.ts +0 -47
- package/dist/sdk/types.d.ts.map +0 -1
- package/dist/sdk/types.js +0 -8
- package/dist/sdk/types.js.map +0 -1
- package/dist/services/agent-runner.d.ts +0 -71
- package/dist/services/agent-runner.d.ts.map +0 -1
- package/dist/services/agent-runner.js +0 -185
- package/dist/services/agent-runner.js.map +0 -1
- package/dist/services/compact/micro-compact.d.ts +0 -21
- package/dist/services/compact/micro-compact.d.ts.map +0 -1
- package/dist/services/compact/micro-compact.js +0 -99
- package/dist/services/compact/micro-compact.js.map +0 -1
- package/dist/services/task-manager.d.ts +0 -161
- package/dist/services/task-manager.d.ts.map +0 -1
- package/dist/services/task-manager.js +0 -315
- package/dist/services/task-manager.js.map +0 -1
- package/dist/skills/discovery.d.ts +0 -22
- package/dist/skills/discovery.d.ts.map +0 -1
- package/dist/skills/discovery.js +0 -75
- package/dist/skills/discovery.js.map +0 -1
- package/dist/skills/index.d.ts +0 -11
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/loader.d.ts +0 -53
- package/dist/skills/loader.d.ts.map +0 -1
- package/dist/skills/loader.js +0 -421
- package/dist/skills/loader.js.map +0 -1
- package/dist/skills/registry.d.ts +0 -41
- package/dist/skills/registry.d.ts.map +0 -1
- package/dist/skills/registry.js +0 -157
- package/dist/skills/registry.js.map +0 -1
- package/dist/skills/runtime.d.ts +0 -46
- package/dist/skills/runtime.d.ts.map +0 -1
- package/dist/skills/runtime.js +0 -364
- package/dist/skills/runtime.js.map +0 -1
- package/dist/skills/types.d.ts +0 -112
- package/dist/skills/types.d.ts.map +0 -1
- package/dist/skills/types.js +0 -24
- package/dist/skills/types.js.map +0 -1
- package/dist/tools/index.d.ts +0 -52
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -2268
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/mcp.d.ts +0 -99
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mcp.js +0 -695
- package/dist/tools/mcp.js.map +0 -1
- package/dist/tools/plan.d.ts +0 -17
- package/dist/tools/plan.d.ts.map +0 -1
- package/dist/tools/plan.js +0 -84
- package/dist/tools/plan.js.map +0 -1
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThreadRuntimeV1 = void 0;
|
|
4
|
+
const runtime_event_buffer_1 = require("./runtime-event-buffer");
|
|
5
|
+
const thread_admission_1 = require("./thread-admission");
|
|
6
|
+
const runtime_protocol_v1_1 = require("./protocol/runtime-protocol-v1");
|
|
7
|
+
class ThreadRuntimeV1 {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.consumers = new Map();
|
|
10
|
+
this.compactMaintenance = new Map();
|
|
11
|
+
this.goalControlTurns = new Map();
|
|
12
|
+
this.queuedGoalControls = new Map();
|
|
13
|
+
this.idleWaiters = new Set();
|
|
14
|
+
this.closed = false;
|
|
15
|
+
this.store = options.store;
|
|
16
|
+
this.threadId = options.store.threadId;
|
|
17
|
+
this.runner = options.runner;
|
|
18
|
+
this.maintenanceRunner = options.maintenanceRunner;
|
|
19
|
+
this.idFactory = options.idFactory ?? runtime_protocol_v1_1.createRuntimeId;
|
|
20
|
+
this.requireTurnCommit = options.requireTurnCommit === true;
|
|
21
|
+
this.onTurnStarted = options.onTurnStarted;
|
|
22
|
+
this.onTurnDurablyTerminal = options.onTurnDurablyTerminal;
|
|
23
|
+
this.onTurnSettled = options.onTurnSettled;
|
|
24
|
+
this.admission = new thread_admission_1.ThreadAdmissionControllerV1({
|
|
25
|
+
...options.admission,
|
|
26
|
+
idFactory: this.idFactory,
|
|
27
|
+
});
|
|
28
|
+
this.unsubscribeStore = this.store.subscribeCommitted(events => this.publish(events));
|
|
29
|
+
let projection = this.store.loadProjection();
|
|
30
|
+
if (projection.cursor === 0) {
|
|
31
|
+
projection = this.commitAndPublish([
|
|
32
|
+
{
|
|
33
|
+
payload: {
|
|
34
|
+
type: 'thread.started',
|
|
35
|
+
data: options.projectPath ? { projectPath: options.projectPath } : {},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
]).projection;
|
|
39
|
+
}
|
|
40
|
+
else if (projection.activeTurnId && options.recoverIncomplete !== false) {
|
|
41
|
+
projection = this.store.recoverIncomplete();
|
|
42
|
+
}
|
|
43
|
+
this.admission.restore({
|
|
44
|
+
queue: projection.queue.map(item => ({
|
|
45
|
+
queueId: item.queueId,
|
|
46
|
+
input: item.input,
|
|
47
|
+
inputBytes: Buffer.byteLength(item.input, 'utf8'),
|
|
48
|
+
mode: item.mode,
|
|
49
|
+
kind: item.kind,
|
|
50
|
+
source: item.source,
|
|
51
|
+
enqueuedAt: item.enqueuedAt,
|
|
52
|
+
deadline: item.deadline,
|
|
53
|
+
})),
|
|
54
|
+
queuedBytes: projection.queue.reduce((total, item) => total + Buffer.byteLength(item.input, 'utf8'), 0),
|
|
55
|
+
continuationMode: latestContinuationMode(projection),
|
|
56
|
+
shutdown: false,
|
|
57
|
+
});
|
|
58
|
+
if (projection.queue.length > 0) {
|
|
59
|
+
queueMicrotask(() => this.promoteQueuedTurn());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
dispatch(command) {
|
|
63
|
+
if (this.closed)
|
|
64
|
+
return { status: 'rejected', reason: 'shutdown' };
|
|
65
|
+
const before = this.admission.getSnapshot();
|
|
66
|
+
const result = this.admission.admit(command);
|
|
67
|
+
if (result.status === 'rejected')
|
|
68
|
+
return result;
|
|
69
|
+
try {
|
|
70
|
+
switch (result.status) {
|
|
71
|
+
case 'started': {
|
|
72
|
+
const active = this.requiredActiveTurn(result.turnId);
|
|
73
|
+
this.persistTurnStart(active);
|
|
74
|
+
this.scheduleTurn(active);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case 'queued': {
|
|
78
|
+
const queued = this.admission
|
|
79
|
+
.getSnapshot()
|
|
80
|
+
.queue.find(item => item.queueId === result.queueId);
|
|
81
|
+
if (!queued)
|
|
82
|
+
throw new Error(`Queued turn ${result.queueId} disappeared before commit`);
|
|
83
|
+
this.commitAndPublish([
|
|
84
|
+
{
|
|
85
|
+
payload: {
|
|
86
|
+
type: 'turn.queued',
|
|
87
|
+
data: {
|
|
88
|
+
queueId: queued.queueId,
|
|
89
|
+
input: queued.input,
|
|
90
|
+
mode: queued.mode,
|
|
91
|
+
kind: queued.kind,
|
|
92
|
+
source: queued.source,
|
|
93
|
+
enqueuedAt: queued.enqueuedAt,
|
|
94
|
+
deadline: queued.deadline,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
]);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case 'steered': {
|
|
102
|
+
if (command.type !== 'turn.steer') {
|
|
103
|
+
throw new Error('Admission returned steered for a non-steer command');
|
|
104
|
+
}
|
|
105
|
+
const steerInput = command.data.input;
|
|
106
|
+
const stepId = this.idFactory();
|
|
107
|
+
this.commitAndPublish([
|
|
108
|
+
{
|
|
109
|
+
turnId: result.activeTurnId,
|
|
110
|
+
payload: {
|
|
111
|
+
type: 'turn.steered',
|
|
112
|
+
data: { itemId: result.itemId, input: steerInput },
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
turnId: result.activeTurnId,
|
|
117
|
+
stepId,
|
|
118
|
+
itemId: result.itemId,
|
|
119
|
+
payload: { type: 'item.started', data: { kind: 'message', role: 'user' } },
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
turnId: result.activeTurnId,
|
|
123
|
+
stepId,
|
|
124
|
+
itemId: result.itemId,
|
|
125
|
+
payload: { type: 'item.completed', data: { content: steerInput } },
|
|
126
|
+
},
|
|
127
|
+
]);
|
|
128
|
+
void Promise.resolve(this.steerHandler?.(steerInput, result.itemId)).catch(() => undefined);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
case 'interrupt_requested':
|
|
132
|
+
if (!result.alreadyRequested) {
|
|
133
|
+
const reason = command.type === 'turn.interrupt' ? command.data.reason : undefined;
|
|
134
|
+
this.commitAndPublish([
|
|
135
|
+
{
|
|
136
|
+
turnId: result.activeTurnId,
|
|
137
|
+
payload: {
|
|
138
|
+
type: 'turn.interrupt_requested',
|
|
139
|
+
data: { intentId: result.intentId, ...(reason ? { reason } : {}) },
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
// The durable intent is flushed before AbortSignal is propagated.
|
|
144
|
+
this.activeAbort?.abort(reason ?? 'thread interrupted');
|
|
145
|
+
}
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
this.admission.restore(before);
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
startMaintenance(input) {
|
|
156
|
+
if (this.closed)
|
|
157
|
+
return { status: 'rejected', reason: 'shutdown' };
|
|
158
|
+
const before = this.admission.getSnapshot();
|
|
159
|
+
const result = this.admission.start({ input, mode: 'maintenance', kind: 'maintenance' });
|
|
160
|
+
try {
|
|
161
|
+
if (result.status === 'started') {
|
|
162
|
+
const active = this.requiredActiveTurn(result.turnId);
|
|
163
|
+
this.persistTurnStart(active);
|
|
164
|
+
this.scheduleTurn(active);
|
|
165
|
+
}
|
|
166
|
+
else if (result.status === 'queued') {
|
|
167
|
+
this.persistQueuedTurn(result.queueId);
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
this.admission.restore(before);
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Serialize a Goal control mutation through the same bounded admission and
|
|
178
|
+
* durable terminal lane as every other Thread turn. The callback owns no
|
|
179
|
+
* scheduling; it must write its TurnCommit before returning completed.
|
|
180
|
+
*/
|
|
181
|
+
startGoalControl(request) {
|
|
182
|
+
if (this.closed)
|
|
183
|
+
return { status: 'rejected', reason: 'shutdown' };
|
|
184
|
+
const before = this.admission.getSnapshot();
|
|
185
|
+
const result = this.admission.start({
|
|
186
|
+
input: request.input,
|
|
187
|
+
mode: 'maintenance',
|
|
188
|
+
kind: 'maintenance',
|
|
189
|
+
});
|
|
190
|
+
try {
|
|
191
|
+
if (result.status === 'started') {
|
|
192
|
+
this.goalControlTurns.set(result.turnId, request);
|
|
193
|
+
const active = this.requiredActiveTurn(result.turnId);
|
|
194
|
+
this.persistTurnStart(active);
|
|
195
|
+
this.scheduleTurn(active);
|
|
196
|
+
}
|
|
197
|
+
else if (result.status === 'queued') {
|
|
198
|
+
this.queuedGoalControls.set(result.queueId, request);
|
|
199
|
+
this.persistQueuedTurn(result.queueId);
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
if (result.status === 'started')
|
|
205
|
+
this.goalControlTurns.delete(result.turnId);
|
|
206
|
+
if (result.status === 'queued')
|
|
207
|
+
this.queuedGoalControls.delete(result.queueId);
|
|
208
|
+
this.admission.restore(before);
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/** Start an explicit Compact maintenance transaction only from an idle boundary. */
|
|
213
|
+
startCompactMaintenance(request, input = 'compact:explicit') {
|
|
214
|
+
if (this.closed)
|
|
215
|
+
return { status: 'rejected', reason: 'shutdown' };
|
|
216
|
+
if (!this.maintenanceRunner)
|
|
217
|
+
throw new Error('Compact maintenance runner is not configured');
|
|
218
|
+
const snapshot = this.admission.getSnapshot();
|
|
219
|
+
if (snapshot.activeTurn)
|
|
220
|
+
return { status: 'rejected', reason: 'non_steerable' };
|
|
221
|
+
if (snapshot.queue.length > 0)
|
|
222
|
+
return { status: 'rejected', reason: 'overloaded' };
|
|
223
|
+
const result = this.admission.start({ input, mode: 'maintenance', kind: 'maintenance' });
|
|
224
|
+
if (result.status !== 'started')
|
|
225
|
+
return result;
|
|
226
|
+
try {
|
|
227
|
+
this.compactMaintenance.set(result.turnId, request);
|
|
228
|
+
const active = this.requiredActiveTurn(result.turnId);
|
|
229
|
+
this.persistTurnStart(active);
|
|
230
|
+
this.scheduleTurn(active);
|
|
231
|
+
return result;
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
this.compactMaintenance.delete(result.turnId);
|
|
235
|
+
this.admission.restore(snapshot);
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
subscribe(consumerId, cursor = this.store.getCursor(), options = {}) {
|
|
240
|
+
if (this.consumers.has(consumerId))
|
|
241
|
+
throw new Error(`Consumer already exists: ${consumerId}`);
|
|
242
|
+
const buffer = new runtime_event_buffer_1.RuntimeEventBufferV1(this.threadId, { ...options, initialCursor: cursor });
|
|
243
|
+
this.consumers.set(consumerId, buffer);
|
|
244
|
+
return buffer;
|
|
245
|
+
}
|
|
246
|
+
unsubscribe(consumerId) {
|
|
247
|
+
this.consumers.delete(consumerId);
|
|
248
|
+
}
|
|
249
|
+
replay(cursor = 0, limit) {
|
|
250
|
+
return this.store.replay(cursor, limit);
|
|
251
|
+
}
|
|
252
|
+
getProjection() {
|
|
253
|
+
return this.store.loadProjection();
|
|
254
|
+
}
|
|
255
|
+
getAdmissionSnapshot() {
|
|
256
|
+
return this.admission.getSnapshot();
|
|
257
|
+
}
|
|
258
|
+
async waitForIdle() {
|
|
259
|
+
if (!this.admission.getSnapshot().activeTurn && !this.activeRun)
|
|
260
|
+
return;
|
|
261
|
+
await new Promise(resolve => this.idleWaiters.add(resolve));
|
|
262
|
+
}
|
|
263
|
+
async waitForTurnTerminal(turnId) {
|
|
264
|
+
const current = terminalStatus(this.store.loadProjection().turns[turnId]?.status);
|
|
265
|
+
if (current)
|
|
266
|
+
return current;
|
|
267
|
+
return new Promise(resolve => {
|
|
268
|
+
let settled = false;
|
|
269
|
+
const finish = (status) => {
|
|
270
|
+
if (settled)
|
|
271
|
+
return;
|
|
272
|
+
settled = true;
|
|
273
|
+
unsubscribe();
|
|
274
|
+
resolve(status);
|
|
275
|
+
};
|
|
276
|
+
const unsubscribe = this.store.subscribeCommitted(events => {
|
|
277
|
+
for (const event of events) {
|
|
278
|
+
if (event.turnId !== turnId)
|
|
279
|
+
continue;
|
|
280
|
+
const status = terminalEventStatus(event);
|
|
281
|
+
if (status)
|
|
282
|
+
finish(status);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
const raced = terminalStatus(this.store.loadProjection().turns[turnId]?.status);
|
|
286
|
+
if (raced)
|
|
287
|
+
finish(raced);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
close(reason = 'runtime shutdown') {
|
|
291
|
+
if (this.closed)
|
|
292
|
+
return;
|
|
293
|
+
this.closed = true;
|
|
294
|
+
this.deferredGoalContinuation = undefined;
|
|
295
|
+
for (const request of this.queuedGoalControls.values())
|
|
296
|
+
request.onRejected?.('shutdown');
|
|
297
|
+
this.goalControlTurns.clear();
|
|
298
|
+
this.queuedGoalControls.clear();
|
|
299
|
+
this.admission.close();
|
|
300
|
+
this.activeAbort?.abort(reason);
|
|
301
|
+
this.consumers.clear();
|
|
302
|
+
this.unsubscribeStore();
|
|
303
|
+
}
|
|
304
|
+
/** Runtime-owned entry for a recovered Goal; public input still uses dispatch(). */
|
|
305
|
+
startGoalContinuation(request) {
|
|
306
|
+
if (this.closed)
|
|
307
|
+
return { status: 'rejected', reason: 'shutdown' };
|
|
308
|
+
if (request.mode !== 'goal' || request.kind !== 'goal') {
|
|
309
|
+
return { status: 'rejected', reason: 'invalid_input' };
|
|
310
|
+
}
|
|
311
|
+
const before = this.admission.getSnapshot();
|
|
312
|
+
const result = this.admission.start(request);
|
|
313
|
+
try {
|
|
314
|
+
if (result.status === 'started') {
|
|
315
|
+
const active = this.requiredActiveTurn(result.turnId);
|
|
316
|
+
this.persistTurnStart(active);
|
|
317
|
+
this.scheduleTurn(active);
|
|
318
|
+
}
|
|
319
|
+
else if (result.status === 'queued') {
|
|
320
|
+
this.persistQueuedTurn(result.queueId);
|
|
321
|
+
}
|
|
322
|
+
return result;
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
this.admission.restore(before);
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
persistTurnStart(active, queueId) {
|
|
330
|
+
const stepId = this.idFactory();
|
|
331
|
+
const itemId = this.idFactory();
|
|
332
|
+
const inputs = [
|
|
333
|
+
{
|
|
334
|
+
turnId: active.turnId,
|
|
335
|
+
payload: {
|
|
336
|
+
type: 'turn.started',
|
|
337
|
+
data: {
|
|
338
|
+
input: active.input,
|
|
339
|
+
mode: active.mode,
|
|
340
|
+
...(queueId ? { queueId } : {}),
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
];
|
|
345
|
+
if (active.kind !== 'maintenance') {
|
|
346
|
+
inputs.push({
|
|
347
|
+
turnId: active.turnId,
|
|
348
|
+
stepId,
|
|
349
|
+
itemId,
|
|
350
|
+
payload: { type: 'item.started', data: { kind: 'message', role: 'user' } },
|
|
351
|
+
});
|
|
352
|
+
inputs.push({
|
|
353
|
+
turnId: active.turnId,
|
|
354
|
+
stepId,
|
|
355
|
+
itemId,
|
|
356
|
+
payload: { type: 'item.completed', data: { content: active.input } },
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
this.commitAndPublish(inputs);
|
|
360
|
+
try {
|
|
361
|
+
this.onTurnStarted?.({
|
|
362
|
+
turnId: active.turnId,
|
|
363
|
+
input: active.input,
|
|
364
|
+
mode: active.mode,
|
|
365
|
+
kind: active.kind,
|
|
366
|
+
startedAt: active.startedAt,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
catch {
|
|
370
|
+
// Timing is an observation only; a durable turn.start cannot be rolled back.
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
scheduleTurn(active) {
|
|
374
|
+
if (this.activeRun)
|
|
375
|
+
throw new Error('ThreadRuntime attempted to schedule a second active run');
|
|
376
|
+
const abortController = new AbortController();
|
|
377
|
+
this.activeAbort = abortController;
|
|
378
|
+
this.activeTurnId = active.turnId;
|
|
379
|
+
const context = this.createExecutionContext(active, abortController.signal);
|
|
380
|
+
const compactRequest = this.compactMaintenance.get(active.turnId);
|
|
381
|
+
const goalControlRequest = this.goalControlTurns.get(active.turnId);
|
|
382
|
+
this.activeRun = Promise.resolve()
|
|
383
|
+
.then(() => {
|
|
384
|
+
if (goalControlRequest)
|
|
385
|
+
return goalControlRequest.run(context);
|
|
386
|
+
if (compactRequest) {
|
|
387
|
+
if (!this.maintenanceRunner)
|
|
388
|
+
throw new Error('Compact maintenance runner is missing');
|
|
389
|
+
return this.maintenanceRunner.run(compactRequest, context);
|
|
390
|
+
}
|
|
391
|
+
return this.runner.run(context);
|
|
392
|
+
})
|
|
393
|
+
.then(outcome => this.finalizeTurn(active, normalizeOutcome(outcome, abortController)))
|
|
394
|
+
.catch(error => this.finalizeTurn(active, {
|
|
395
|
+
status: abortController.signal.aborted ? 'interrupted' : 'failed',
|
|
396
|
+
error: error instanceof Error ? error.message : String(error),
|
|
397
|
+
}))
|
|
398
|
+
.finally(async () => {
|
|
399
|
+
try {
|
|
400
|
+
await this.onTurnSettled?.(active.turnId);
|
|
401
|
+
}
|
|
402
|
+
catch {
|
|
403
|
+
// The resource owner remains fail-closed; no lease is handed to the
|
|
404
|
+
// next turn even if teardown diagnostics fail.
|
|
405
|
+
}
|
|
406
|
+
this.activeRun = undefined;
|
|
407
|
+
this.activeAbort = undefined;
|
|
408
|
+
this.activeTurnId = undefined;
|
|
409
|
+
this.steerHandler = undefined;
|
|
410
|
+
this.compactMaintenance.delete(active.turnId);
|
|
411
|
+
this.goalControlTurns.delete(active.turnId);
|
|
412
|
+
const next = this.admission.getSnapshot().activeTurn;
|
|
413
|
+
if (this.closed && next)
|
|
414
|
+
this.admission.finish(next.turnId);
|
|
415
|
+
else if (next)
|
|
416
|
+
this.scheduleTurn(next);
|
|
417
|
+
else
|
|
418
|
+
this.promoteQueuedTurn();
|
|
419
|
+
this.resolveIdleIfNeeded();
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
createExecutionContext(active, abortSignal) {
|
|
423
|
+
return {
|
|
424
|
+
threadId: this.threadId,
|
|
425
|
+
turnId: active.turnId,
|
|
426
|
+
input: active.input,
|
|
427
|
+
mode: active.mode,
|
|
428
|
+
kind: active.kind,
|
|
429
|
+
abortSignal,
|
|
430
|
+
startItem: input => {
|
|
431
|
+
const handle = {
|
|
432
|
+
turnId: active.turnId,
|
|
433
|
+
stepId: input.stepId ?? this.idFactory(),
|
|
434
|
+
itemId: input.itemId ?? this.idFactory(),
|
|
435
|
+
};
|
|
436
|
+
this.commitAndPublish([
|
|
437
|
+
{
|
|
438
|
+
...handle,
|
|
439
|
+
payload: {
|
|
440
|
+
type: 'item.started',
|
|
441
|
+
data: {
|
|
442
|
+
kind: input.kind,
|
|
443
|
+
...(input.role ? { role: input.role } : {}),
|
|
444
|
+
...(input.name ? { name: input.name } : {}),
|
|
445
|
+
...(input.inputDigest ? { inputDigest: input.inputDigest } : {}),
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
},
|
|
449
|
+
]);
|
|
450
|
+
return handle;
|
|
451
|
+
},
|
|
452
|
+
emitDelta: (handle, delta, channel = 'content') => {
|
|
453
|
+
const event = this.store.createEphemeral({
|
|
454
|
+
...handle,
|
|
455
|
+
payload: { type: 'item.delta', data: { delta, channel } },
|
|
456
|
+
});
|
|
457
|
+
this.publish([event]);
|
|
458
|
+
},
|
|
459
|
+
completeItem: (handle, input = {}) => {
|
|
460
|
+
this.commitAndPublish([
|
|
461
|
+
{
|
|
462
|
+
...handle,
|
|
463
|
+
payload: {
|
|
464
|
+
type: 'item.completed',
|
|
465
|
+
data: {
|
|
466
|
+
...(input.content === undefined ? {} : { content: input.content }),
|
|
467
|
+
...(input.summary === undefined ? {} : { summary: input.summary }),
|
|
468
|
+
...(input.outputDigest === undefined ? {} : { outputDigest: input.outputDigest }),
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
]);
|
|
473
|
+
},
|
|
474
|
+
failItem: (handle, error) => {
|
|
475
|
+
this.commitAndPublish([{ ...handle, payload: { type: 'item.failed', data: { error } } }]);
|
|
476
|
+
},
|
|
477
|
+
onSteer: handler => {
|
|
478
|
+
this.steerHandler = handler;
|
|
479
|
+
},
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
finalizeTurn(active, outcome) {
|
|
483
|
+
const turnId = active.turnId;
|
|
484
|
+
const goalControl = this.goalControlTurns.has(turnId);
|
|
485
|
+
let terminalPublished = false;
|
|
486
|
+
try {
|
|
487
|
+
if (this.requireTurnCommit && (active.kind !== 'maintenance' || goalControl)) {
|
|
488
|
+
const committed = this.store.loadProjection().turns[turnId]?.commit;
|
|
489
|
+
if (!committed)
|
|
490
|
+
throw new Error(`Turn ${turnId} has no durable TurnCommitV1`);
|
|
491
|
+
if (committed.terminal !== outcome.status) {
|
|
492
|
+
throw new Error(`Turn ${turnId} outcome ${outcome.status} conflicts with committed ${committed.terminal}`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (outcome.status === 'completed') {
|
|
496
|
+
this.commitAndPublish([
|
|
497
|
+
{
|
|
498
|
+
turnId,
|
|
499
|
+
payload: {
|
|
500
|
+
type: 'turn.completed',
|
|
501
|
+
data: outcome.outcome === undefined ? {} : { outcome: outcome.outcome },
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
]);
|
|
505
|
+
}
|
|
506
|
+
else if (outcome.status === 'failed') {
|
|
507
|
+
this.commitAndPublish([
|
|
508
|
+
{
|
|
509
|
+
turnId,
|
|
510
|
+
payload: { type: 'turn.failed', data: { error: outcome.error } },
|
|
511
|
+
},
|
|
512
|
+
]);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
this.commitAndPublish([
|
|
516
|
+
{
|
|
517
|
+
turnId,
|
|
518
|
+
payload: {
|
|
519
|
+
type: 'turn.interrupted',
|
|
520
|
+
data: (() => {
|
|
521
|
+
const reason = 'error' in outcome ? outcome.error : outcome.reason;
|
|
522
|
+
return reason === undefined ? {} : { reason };
|
|
523
|
+
})(),
|
|
524
|
+
},
|
|
525
|
+
},
|
|
526
|
+
]);
|
|
527
|
+
}
|
|
528
|
+
terminalPublished = true;
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
// A runner that exits with open Items cannot publish a false turn
|
|
532
|
+
// terminal. Recovery marks those Items indeterminate first.
|
|
533
|
+
this.store.recoverIncomplete('turn_finished_with_uncommitted_items');
|
|
534
|
+
}
|
|
535
|
+
const terminal = outcome.status;
|
|
536
|
+
let continuation;
|
|
537
|
+
if (terminalPublished && !this.closed) {
|
|
538
|
+
try {
|
|
539
|
+
continuation = this.onTurnDurablyTerminal?.({
|
|
540
|
+
turnId,
|
|
541
|
+
input: active.input,
|
|
542
|
+
mode: active.mode,
|
|
543
|
+
kind: active.kind,
|
|
544
|
+
terminal,
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
catch {
|
|
548
|
+
// Goal continuation is fail-closed. The durable terminal remains authoritative.
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (active.kind !== 'maintenance')
|
|
552
|
+
this.deferredGoalContinuation = undefined;
|
|
553
|
+
const maintenance = terminalPublished && active.kind !== 'maintenance' && outcome.status === 'completed'
|
|
554
|
+
? outcome.maintenance
|
|
555
|
+
: undefined;
|
|
556
|
+
if (maintenance && continuation) {
|
|
557
|
+
this.deferredGoalContinuation = continuation;
|
|
558
|
+
continuation = undefined;
|
|
559
|
+
}
|
|
560
|
+
else if (active.kind === 'maintenance' && !goalControl) {
|
|
561
|
+
continuation = terminal === 'completed' ? this.deferredGoalContinuation : undefined;
|
|
562
|
+
this.deferredGoalContinuation = undefined;
|
|
563
|
+
}
|
|
564
|
+
const finish = maintenance
|
|
565
|
+
? this.admission.finishAndStartPriority(turnId, {
|
|
566
|
+
input: `compact:${maintenance.source}`,
|
|
567
|
+
mode: 'maintenance',
|
|
568
|
+
kind: 'maintenance',
|
|
569
|
+
})
|
|
570
|
+
: this.admission.finish(turnId);
|
|
571
|
+
if (finish.status === 'rejected')
|
|
572
|
+
throw new Error(`Admission lost active turn ${turnId}`);
|
|
573
|
+
for (const queueId of finish.expiredQueueIds) {
|
|
574
|
+
this.rejectQueuedGoalControl(queueId, 'deadline_expired');
|
|
575
|
+
this.commitAndPublish([{ payload: { type: 'turn.queue_expired', data: { queueId } } }]);
|
|
576
|
+
}
|
|
577
|
+
if (finish.status === 'started') {
|
|
578
|
+
if (maintenance)
|
|
579
|
+
this.compactMaintenance.set(finish.turnId, maintenance);
|
|
580
|
+
this.promoteQueuedGoalControl(finish.turnId, finish.queueId);
|
|
581
|
+
const active = this.requiredActiveTurn(finish.turnId);
|
|
582
|
+
this.persistTurnStart(active, finish.queueId);
|
|
583
|
+
}
|
|
584
|
+
else if (finish.status === 'idle' && continuation && !this.closed) {
|
|
585
|
+
const started = this.admission.start(continuation);
|
|
586
|
+
if (started.status !== 'started') {
|
|
587
|
+
throw new Error('Goal continuation could not start from an idle durable boundary');
|
|
588
|
+
}
|
|
589
|
+
const next = this.requiredActiveTurn(started.turnId);
|
|
590
|
+
this.persistTurnStart(next);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
promoteQueuedTurn() {
|
|
594
|
+
if (this.closed || this.activeRun || this.admission.getSnapshot().activeTurn)
|
|
595
|
+
return;
|
|
596
|
+
const result = this.admission.startNextQueued();
|
|
597
|
+
if (result.status === 'rejected')
|
|
598
|
+
return;
|
|
599
|
+
for (const queueId of result.expiredQueueIds) {
|
|
600
|
+
this.rejectQueuedGoalControl(queueId, 'deadline_expired');
|
|
601
|
+
this.commitAndPublish([{ payload: { type: 'turn.queue_expired', data: { queueId } } }]);
|
|
602
|
+
}
|
|
603
|
+
if (result.status === 'started') {
|
|
604
|
+
this.promoteQueuedGoalControl(result.turnId, result.queueId);
|
|
605
|
+
const active = this.requiredActiveTurn(result.turnId);
|
|
606
|
+
this.persistTurnStart(active, result.queueId);
|
|
607
|
+
this.scheduleTurn(active);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
persistQueuedTurn(queueId) {
|
|
611
|
+
const queued = this.admission.getSnapshot().queue.find(item => item.queueId === queueId);
|
|
612
|
+
if (!queued)
|
|
613
|
+
throw new Error(`Queued maintenance turn ${queueId} disappeared before commit`);
|
|
614
|
+
this.commitAndPublish([
|
|
615
|
+
{
|
|
616
|
+
payload: {
|
|
617
|
+
type: 'turn.queued',
|
|
618
|
+
data: {
|
|
619
|
+
queueId: queued.queueId,
|
|
620
|
+
input: queued.input,
|
|
621
|
+
mode: queued.mode,
|
|
622
|
+
kind: queued.kind,
|
|
623
|
+
source: queued.source,
|
|
624
|
+
enqueuedAt: queued.enqueuedAt,
|
|
625
|
+
deadline: queued.deadline,
|
|
626
|
+
},
|
|
627
|
+
},
|
|
628
|
+
},
|
|
629
|
+
]);
|
|
630
|
+
}
|
|
631
|
+
requiredActiveTurn(turnId) {
|
|
632
|
+
const active = this.admission.getSnapshot().activeTurn;
|
|
633
|
+
if (!active || active.turnId !== turnId)
|
|
634
|
+
throw new Error(`Active turn ${turnId} is missing`);
|
|
635
|
+
return active;
|
|
636
|
+
}
|
|
637
|
+
promoteQueuedGoalControl(turnId, queueId) {
|
|
638
|
+
if (!queueId)
|
|
639
|
+
return;
|
|
640
|
+
const request = this.queuedGoalControls.get(queueId);
|
|
641
|
+
if (!request)
|
|
642
|
+
return;
|
|
643
|
+
this.queuedGoalControls.delete(queueId);
|
|
644
|
+
this.goalControlTurns.set(turnId, request);
|
|
645
|
+
}
|
|
646
|
+
rejectQueuedGoalControl(queueId, reason) {
|
|
647
|
+
const request = this.queuedGoalControls.get(queueId);
|
|
648
|
+
this.queuedGoalControls.delete(queueId);
|
|
649
|
+
request?.onRejected?.(reason);
|
|
650
|
+
}
|
|
651
|
+
commitAndPublish(inputs) {
|
|
652
|
+
return this.store.appendDurableBatch(inputs);
|
|
653
|
+
}
|
|
654
|
+
publish(events) {
|
|
655
|
+
for (const event of events) {
|
|
656
|
+
for (const buffer of this.consumers.values())
|
|
657
|
+
buffer.offer(event);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
resolveIdleIfNeeded() {
|
|
661
|
+
if (this.activeRun || this.admission.getSnapshot().activeTurn)
|
|
662
|
+
return;
|
|
663
|
+
for (const resolve of this.idleWaiters)
|
|
664
|
+
resolve();
|
|
665
|
+
this.idleWaiters.clear();
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
exports.ThreadRuntimeV1 = ThreadRuntimeV1;
|
|
669
|
+
function normalizeOutcome(outcome, abortController) {
|
|
670
|
+
if (abortController.signal.aborted && outcome.status !== 'interrupted') {
|
|
671
|
+
return {
|
|
672
|
+
status: 'interrupted',
|
|
673
|
+
reason: typeof abortController.signal.reason === 'string'
|
|
674
|
+
? abortController.signal.reason
|
|
675
|
+
: 'thread interrupted',
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
return outcome;
|
|
679
|
+
}
|
|
680
|
+
function terminalStatus(status) {
|
|
681
|
+
return status === 'completed' || status === 'failed' || status === 'interrupted'
|
|
682
|
+
? status
|
|
683
|
+
: undefined;
|
|
684
|
+
}
|
|
685
|
+
function terminalEventStatus(event) {
|
|
686
|
+
switch (event.payload.type) {
|
|
687
|
+
case 'turn.completed':
|
|
688
|
+
return 'completed';
|
|
689
|
+
case 'turn.failed':
|
|
690
|
+
return 'failed';
|
|
691
|
+
case 'turn.interrupted':
|
|
692
|
+
return 'interrupted';
|
|
693
|
+
default:
|
|
694
|
+
return undefined;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
function latestContinuationMode(projection) {
|
|
698
|
+
const mode = Object.values(projection.turns)
|
|
699
|
+
.filter(turn => turn.mode !== 'maintenance')
|
|
700
|
+
.sort((left, right) => left.startedSeq - right.startedSeq)
|
|
701
|
+
.at(-1)?.mode;
|
|
702
|
+
return mode === 'plan' || mode === 'auto' || mode === 'goal' ? mode : 'build';
|
|
703
|
+
}
|
|
704
|
+
//# sourceMappingURL=thread-runtime.js.map
|