@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,1019 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createProductOrionRuntimeV1 = createProductOrionRuntimeV1;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const prompt_1 = require("../framework/prompt");
|
|
6
|
+
const stop_decision_1 = require("../framework/stop-decision");
|
|
7
|
+
const prompt_context_1 = require("../memory/prompt-context");
|
|
8
|
+
const file_context_1 = require("../services/file-context");
|
|
9
|
+
const goal_storage_1 = require("../services/goal-storage");
|
|
10
|
+
const llm_1 = require("../services/llm");
|
|
11
|
+
const session_storage_1 = require("../services/session-storage");
|
|
12
|
+
const token_estimate_1 = require("../utils/token-estimate");
|
|
13
|
+
const paths_1 = require("../product/paths");
|
|
14
|
+
const builtin_tool_provider_1 = require("./builtin-tool-provider");
|
|
15
|
+
const legacy_thread_materializer_1 = require("./legacy-thread-materializer");
|
|
16
|
+
const orion_runtime_v1_1 = require("./orion-runtime-v1");
|
|
17
|
+
const prompts_1 = require("./prompts");
|
|
18
|
+
const canonical_1 = require("./protocol/canonical");
|
|
19
|
+
const step_snapshot_1 = require("./step-snapshot");
|
|
20
|
+
const production_1 = require("./subagents/production");
|
|
21
|
+
const runtime_integration_1 = require("./subagents/runtime-integration");
|
|
22
|
+
const policy_1 = require("./subagents/policy");
|
|
23
|
+
const parent_step_fork_1 = require("./subagents/parent-step-fork");
|
|
24
|
+
const presets_1 = require("./subagents/presets");
|
|
25
|
+
const types_1 = require("./subagents/types");
|
|
26
|
+
const turn_commit_1 = require("./turn-commit");
|
|
27
|
+
/** Build one explicit OrionRuntime owner for a legacy Session/v2 Thread identity. */
|
|
28
|
+
function createProductOrionRuntimeV1(options, sessionId) {
|
|
29
|
+
let promptState;
|
|
30
|
+
const scheduledPlanReceipts = new Set();
|
|
31
|
+
let storage = (0, legacy_thread_materializer_1.resolveSessionStorageV1)(options.cwd, sessionId);
|
|
32
|
+
if (storage.kind === 'legacy') {
|
|
33
|
+
(0, legacy_thread_materializer_1.materializeLegacyThreadV1)({ projectPath: options.cwd, sessionId });
|
|
34
|
+
storage = (0, legacy_thread_materializer_1.resolveSessionStorageV1)(options.cwd, sessionId);
|
|
35
|
+
}
|
|
36
|
+
if (storage.kind !== 'thread') {
|
|
37
|
+
throw new Error(`Session ${sessionId} did not cut over to a v2 Thread.`);
|
|
38
|
+
}
|
|
39
|
+
const profile = options.config.modelRegistry?.defaultProfile;
|
|
40
|
+
const provider = profile
|
|
41
|
+
? options.config.modelRegistry?.providers.get(profile.provider)
|
|
42
|
+
: undefined;
|
|
43
|
+
const modelId = profile?.model ?? options.llm.getModel();
|
|
44
|
+
const contextWindow = profile?.contextWindow ?? 128000;
|
|
45
|
+
const taskState = (0, session_storage_1.loadSessionHarnessState)(sessionId) ?? undefined;
|
|
46
|
+
const goalSeed = loadProductGoalSeed(options.cwd, sessionId);
|
|
47
|
+
const executionPolicy = (0, step_snapshot_1.createExecutionPolicySnapshotV1)({
|
|
48
|
+
policyId: 'orion-product-policy-v1',
|
|
49
|
+
approvalMode: options.config.toolConfirmation === 'ask' ? 'interactive' : 'never',
|
|
50
|
+
// Workspace file tools provide path containment. Shell sandboxing remains
|
|
51
|
+
// explicitly recorded by FirstPartySandboxService; a project grant may
|
|
52
|
+
// execute with enforcement=none without pretending a sandbox exists.
|
|
53
|
+
sandboxRequired: false,
|
|
54
|
+
sandboxBackend: 'configured-first-party',
|
|
55
|
+
timeoutMs: 120000,
|
|
56
|
+
});
|
|
57
|
+
const subagents = createProductSubagentCompositionV1(options, {
|
|
58
|
+
modelId,
|
|
59
|
+
providerId: profile?.provider ?? 'configured-provider',
|
|
60
|
+
protocol: provider?.protocol ?? 'openai-compatible',
|
|
61
|
+
providerProtocol: provider?.protocol,
|
|
62
|
+
contextWindow,
|
|
63
|
+
});
|
|
64
|
+
const runtime = (0, orion_runtime_v1_1.createOrionRuntimeV1)({
|
|
65
|
+
modelExecutor: options.llm,
|
|
66
|
+
toolCatalog: options.toolCatalog,
|
|
67
|
+
toolContext: {
|
|
68
|
+
cwd: options.cwd,
|
|
69
|
+
config: { name: options.config.name, mode: options.config.mode },
|
|
70
|
+
},
|
|
71
|
+
eventStore: {
|
|
72
|
+
rootDir: (0, paths_1.getProjectThreadsV2Dir)(options.cwd),
|
|
73
|
+
threadId: storage.threadId,
|
|
74
|
+
},
|
|
75
|
+
projectPath: options.cwd,
|
|
76
|
+
taskContext: {
|
|
77
|
+
cwd: options.cwd,
|
|
78
|
+
modelId,
|
|
79
|
+
...(taskState ? { state: taskState } : {}),
|
|
80
|
+
},
|
|
81
|
+
...(goalSeed ? { goal: goalSeed } : {}),
|
|
82
|
+
skills: { providers: [...(options.skillProviders ?? [])] },
|
|
83
|
+
mcp: {
|
|
84
|
+
descriptors: [...(options.mcpDescriptors ?? [])],
|
|
85
|
+
connector: options.mcpConnector ?? INERT_MCP_CONNECTOR,
|
|
86
|
+
},
|
|
87
|
+
approvalHandler: options.approvalHandler,
|
|
88
|
+
...(subagents ? { subagents } : {}),
|
|
89
|
+
resolveCapabilityConfiguration: async (input, context) => {
|
|
90
|
+
if (!promptState || promptState.turnId !== input.turnId) {
|
|
91
|
+
throw new Error(`Prompt receipt is missing for active turn ${input.turnId}.`);
|
|
92
|
+
}
|
|
93
|
+
const dynamicTools = await resolveMcpToolsForStep(input, context.mcp, context.mcpCatalog);
|
|
94
|
+
return capabilityConfiguration({
|
|
95
|
+
options,
|
|
96
|
+
input,
|
|
97
|
+
modelId,
|
|
98
|
+
contextWindow,
|
|
99
|
+
providerId: profile?.provider ?? 'configured-provider',
|
|
100
|
+
protocol: provider?.protocol ?? 'openai-compatible',
|
|
101
|
+
executionPolicy,
|
|
102
|
+
skillCatalog: promptState.skillCatalog,
|
|
103
|
+
loadedSkills: promptState.loadedSkills,
|
|
104
|
+
explicitSkillIds: promptState.explicitSkillIds,
|
|
105
|
+
promptReceipt: promptState.receipt,
|
|
106
|
+
dynamicTools,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
loadBaseMessages: async (store, context, prompts, composition) => {
|
|
110
|
+
const assembled = await buildProductMessages(options, sessionId, store, prompts, composition, context.input, context.mode, contextWindow);
|
|
111
|
+
promptState = {
|
|
112
|
+
turnId: context.turnId,
|
|
113
|
+
mode: context.mode,
|
|
114
|
+
planReturnMode: productPlanReturnMode(options.store),
|
|
115
|
+
receipt: assembled.receipt,
|
|
116
|
+
skillCatalog: assembled.skillCatalog,
|
|
117
|
+
loadedSkills: assembled.loadedSkills,
|
|
118
|
+
explicitSkillIds: assembled.explicitSkillIds,
|
|
119
|
+
};
|
|
120
|
+
return assembled.messages;
|
|
121
|
+
},
|
|
122
|
+
loop: {
|
|
123
|
+
...(options.compactCoordinator ? { compactCoordinator: options.compactCoordinator } : {}),
|
|
124
|
+
prepareTurnCommit: commit => {
|
|
125
|
+
const active = promptState;
|
|
126
|
+
if (!active || active.turnId !== commit.turnId || active.mode !== 'plan')
|
|
127
|
+
return {};
|
|
128
|
+
const plan = extractDecisionCompletePlan(commit);
|
|
129
|
+
return {
|
|
130
|
+
stopDecision: createPlanStopDecision(commit, active.receipt.digest),
|
|
131
|
+
plan: {
|
|
132
|
+
plan,
|
|
133
|
+
returnMode: active.planReturnMode,
|
|
134
|
+
promptReceiptDigest: active.receipt.digest,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
onTurnCommitted: (commit, durableCommit) => {
|
|
139
|
+
if (promptState?.turnId === commit.turnId)
|
|
140
|
+
promptState = undefined;
|
|
141
|
+
if (commit.queryComplete.stats)
|
|
142
|
+
options.store.setLastLoopStats(commit.queryComplete.stats);
|
|
143
|
+
options.store.setState({
|
|
144
|
+
harnessState: commit.taskContextState,
|
|
145
|
+
conversationHistory: commit.history.map(message => ({ ...message })),
|
|
146
|
+
});
|
|
147
|
+
const planReceipt = planReceiptFromCommit(durableCommit);
|
|
148
|
+
if (planReceipt) {
|
|
149
|
+
projectPlanReceipt(options.store, planReceipt);
|
|
150
|
+
schedulePlanExecution(runtime, planReceipt, scheduledPlanReceipts);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
onRuntimeStarted: ({ restoredCommit, thread }) => {
|
|
154
|
+
const planReceipt = restoredCommit ? planReceiptFromCommit(restoredCommit) : undefined;
|
|
155
|
+
if (!planReceipt)
|
|
156
|
+
return;
|
|
157
|
+
projectPlanReceipt(options.store, planReceipt);
|
|
158
|
+
if (thread.getProjection().queue.length === 0) {
|
|
159
|
+
schedulePlanExecution(runtime, planReceipt, scheduledPlanReceipts);
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
return runtime;
|
|
165
|
+
}
|
|
166
|
+
function createProductSubagentCompositionV1(options, model) {
|
|
167
|
+
const config = (0, policy_1.clampSubagentConfig)(options.config.subagents ?? types_1.DEFAULT_SUBAGENT_CONFIG);
|
|
168
|
+
const rootLlmConfig = (0, runtime_integration_1.deriveRootLlmConfig)(options.config);
|
|
169
|
+
if (config.mode === 'off' || !rootLlmConfig.apiKey)
|
|
170
|
+
return undefined;
|
|
171
|
+
const allowedNames = new Set(presets_1.READ_ONLY_INVESTIGATION_TOOLS);
|
|
172
|
+
const childTools = options.toolCatalog.entries
|
|
173
|
+
.filter(entry => allowedNames.has(entry.candidate.descriptor.name) &&
|
|
174
|
+
entry.candidate.descriptor.risk.readOnly &&
|
|
175
|
+
!entry.candidate.descriptor.risk.destructive &&
|
|
176
|
+
entry.candidate.descriptor.risk.network === 'none')
|
|
177
|
+
.map(entry => entry.tool);
|
|
178
|
+
const toolContext = {
|
|
179
|
+
cwd: options.cwd,
|
|
180
|
+
config: { name: options.config.name, mode: options.config.mode },
|
|
181
|
+
};
|
|
182
|
+
const childCatalog = (0, builtin_tool_provider_1.createBuiltinToolCatalogV1)(childTools, { context: toolContext });
|
|
183
|
+
const childExecutionPolicy = (0, step_snapshot_1.createExecutionPolicySnapshotV1)({
|
|
184
|
+
policyId: 'orion-product-subagent-readonly-v1',
|
|
185
|
+
approvalMode: 'never',
|
|
186
|
+
sandboxRequired: false,
|
|
187
|
+
sandboxBackend: 'workspace-path-containment',
|
|
188
|
+
timeoutMs: config.timeoutMs,
|
|
189
|
+
});
|
|
190
|
+
const rolePolicies = createProductSubagentRolePolicies(options, config);
|
|
191
|
+
const issuedModels = new WeakSet();
|
|
192
|
+
const childRuntimeServicesDigest = (0, canonical_1.digestRuntimeValue)({
|
|
193
|
+
version: 1,
|
|
194
|
+
owner: 'product-subagent-composition-v1',
|
|
195
|
+
loop: 'agent-loop-v1',
|
|
196
|
+
gateway: 'tool-gateway-v1',
|
|
197
|
+
toolCatalog: childCatalog.digest,
|
|
198
|
+
});
|
|
199
|
+
const emptySkillCatalogDigest = (0, canonical_1.digestRuntimeValue)({ version: 1, skills: [] });
|
|
200
|
+
const emptyMcpCatalogDigest = (0, canonical_1.digestRuntimeValue)({ version: 1, servers: [] });
|
|
201
|
+
return Object.freeze({
|
|
202
|
+
serviceId: 'product-subagent-composition-v1',
|
|
203
|
+
createTurn: async (input) => {
|
|
204
|
+
if (input.abortSignal.aborted)
|
|
205
|
+
return null;
|
|
206
|
+
const parentForkSource = new parent_step_fork_1.ParentThreadStepForkSourceV1({
|
|
207
|
+
store: input.store,
|
|
208
|
+
flush: input.flush,
|
|
209
|
+
});
|
|
210
|
+
let productionRuntime;
|
|
211
|
+
try {
|
|
212
|
+
productionRuntime = (0, production_1.createProductionSubagentRuntimeV1)({
|
|
213
|
+
childStoreRootDir: (0, path_1.join)((0, paths_1.getProjectThreadsV2Dir)(options.cwd), 'subagents'),
|
|
214
|
+
receiptRootDir: (0, path_1.join)((0, paths_1.getProjectThreadsV2Dir)(options.cwd), 'subagent-receipts'),
|
|
215
|
+
toolCatalog: childCatalog,
|
|
216
|
+
treeLimits: {
|
|
217
|
+
maxConcurrent: config.maxParallel,
|
|
218
|
+
maxQueued: config.maxTasksPerTurn,
|
|
219
|
+
maxModelRequests: config.maxModelRequestsPerTurn,
|
|
220
|
+
maxToolCalls: config.maxToolCallsPerTask * config.maxTasksPerTurn,
|
|
221
|
+
},
|
|
222
|
+
rolePolicies,
|
|
223
|
+
createModelExecutor: childInput => {
|
|
224
|
+
const executor = options.createSubagentModelExecutor
|
|
225
|
+
? options.createSubagentModelExecutor(childInput)
|
|
226
|
+
: createProductChildModelExecutor(options, rootLlmConfig, model.providerProtocol);
|
|
227
|
+
if (executor === options.llm || issuedModels.has(executor)) {
|
|
228
|
+
throw new Error('Subagent model factory must return a distinct LLMService for every child request.');
|
|
229
|
+
}
|
|
230
|
+
issuedModels.add(executor);
|
|
231
|
+
return executor;
|
|
232
|
+
},
|
|
233
|
+
resolveCapabilityConfiguration: (step, context) => ({
|
|
234
|
+
taskEpoch: 1,
|
|
235
|
+
model: {
|
|
236
|
+
providerId: model.providerId,
|
|
237
|
+
modelId: context.modelId,
|
|
238
|
+
protocol: model.protocol,
|
|
239
|
+
contextWindow: model.contextWindow,
|
|
240
|
+
},
|
|
241
|
+
executionPolicy: childExecutionPolicy,
|
|
242
|
+
environment: {
|
|
243
|
+
cwd: context.authority.projectRoot,
|
|
244
|
+
platform: process.platform,
|
|
245
|
+
arch: process.arch,
|
|
246
|
+
environmentDigest: (0, canonical_1.digestRuntimeValue)({
|
|
247
|
+
cwd: context.authority.projectRoot,
|
|
248
|
+
platform: process.platform,
|
|
249
|
+
arch: process.arch,
|
|
250
|
+
}),
|
|
251
|
+
},
|
|
252
|
+
compiler: {
|
|
253
|
+
task: { objective: context.objective },
|
|
254
|
+
model: { toolCalling: true },
|
|
255
|
+
authority: context.authority,
|
|
256
|
+
budgets: {
|
|
257
|
+
maxDirectTools: Math.max(1, childCatalog.candidates.length),
|
|
258
|
+
maxToolSchemaBytes: Math.max(1, childCatalog.toolSchemaBytes),
|
|
259
|
+
maxDeferredTools: 0,
|
|
260
|
+
maxExpansionTools: 0,
|
|
261
|
+
},
|
|
262
|
+
tools: childCatalog.candidates,
|
|
263
|
+
runtimeServicesDigest: childRuntimeServicesDigest,
|
|
264
|
+
executionPolicyDigest: childExecutionPolicy.digest,
|
|
265
|
+
skillCatalogDigest: emptySkillCatalogDigest,
|
|
266
|
+
mcpCatalogDigest: emptyMcpCatalogDigest,
|
|
267
|
+
estimatedInputTokens: (0, token_estimate_1.estimateTokens)(step.input),
|
|
268
|
+
},
|
|
269
|
+
}),
|
|
270
|
+
toolContext: (_request, authority) => ({
|
|
271
|
+
...toolContext,
|
|
272
|
+
cwd: authority.projectRoot,
|
|
273
|
+
}),
|
|
274
|
+
runtimeServicesDigest: childRuntimeServicesDigest,
|
|
275
|
+
onReceipt: options.onSubagentReceipt,
|
|
276
|
+
parentAbortSignal: input.abortSignal,
|
|
277
|
+
});
|
|
278
|
+
const bundle = (0, runtime_integration_1.createSubagentBundleForTurn)({
|
|
279
|
+
config,
|
|
280
|
+
cwd: options.cwd,
|
|
281
|
+
rootLlmConfig,
|
|
282
|
+
productionRuntime,
|
|
283
|
+
parentForkSource,
|
|
284
|
+
parentAuthority: input.authority,
|
|
285
|
+
modelLabel: model.modelId,
|
|
286
|
+
rootObjectiveSummary: input.input,
|
|
287
|
+
abortSignal: input.abortSignal,
|
|
288
|
+
});
|
|
289
|
+
if (!bundle) {
|
|
290
|
+
productionRuntime.close('subagent_turn_unavailable');
|
|
291
|
+
parentForkSource.close('subagent_turn_unavailable');
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
const catalog = (0, builtin_tool_provider_1.createBuiltinToolCatalogV1)([bundle.tool], { context: toolContext });
|
|
295
|
+
const capability = {
|
|
296
|
+
serviceId: `product-subagent-turn-v1:${input.turnId}`,
|
|
297
|
+
turnId: input.turnId,
|
|
298
|
+
catalog,
|
|
299
|
+
publishCommitted: (stepBundle, commit) => {
|
|
300
|
+
parentForkSource.publishCommitted(stepBundle, commit);
|
|
301
|
+
},
|
|
302
|
+
close: (reason) => bundle.close(reason),
|
|
303
|
+
};
|
|
304
|
+
return Object.freeze(capability);
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
productionRuntime?.close('subagent_turn_start_failed');
|
|
308
|
+
parentForkSource.close('subagent_turn_start_failed');
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function createProductSubagentRolePolicies(options, config) {
|
|
315
|
+
const entries = config.roles.map(role => [
|
|
316
|
+
role,
|
|
317
|
+
(0, step_snapshot_1.createAuthoritySnapshotV1)({
|
|
318
|
+
authorityId: `subagent-role:${role}:${(0, canonical_1.digestRuntimeValue)(options.cwd).slice(0, 16)}`,
|
|
319
|
+
projectRoot: options.cwd,
|
|
320
|
+
confirmation: 'allow',
|
|
321
|
+
filesystem: 'workspace',
|
|
322
|
+
network: 'deny',
|
|
323
|
+
}),
|
|
324
|
+
]);
|
|
325
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
326
|
+
}
|
|
327
|
+
function createProductChildModelExecutor(options, rootConfig, providerProtocol) {
|
|
328
|
+
const executor = new llm_1.LLMService({
|
|
329
|
+
...(0, production_1.createChildLlmConfig)(rootConfig),
|
|
330
|
+
providerProtocol,
|
|
331
|
+
reasoningCapability: options.config.modelRegistry?.defaultProfile?.reasoningCapability,
|
|
332
|
+
fallbackReasoningCapability: options.config.modelRegistry?.fallbackProfile?.reasoningCapability,
|
|
333
|
+
effortPreference: options.config.defaultEffort,
|
|
334
|
+
});
|
|
335
|
+
executor.resilience = options.llm.resilience;
|
|
336
|
+
return executor;
|
|
337
|
+
}
|
|
338
|
+
function capabilityConfiguration(input) {
|
|
339
|
+
const authority = createProductAuthority(input.options, input.input.mode);
|
|
340
|
+
const loadedSkillIds = new Set(input.loadedSkills.map(skill => skill.definition.id));
|
|
341
|
+
return {
|
|
342
|
+
taskEpoch: 1,
|
|
343
|
+
model: {
|
|
344
|
+
providerId: input.providerId,
|
|
345
|
+
modelId: input.modelId,
|
|
346
|
+
protocol: input.protocol,
|
|
347
|
+
contextWindow: input.contextWindow,
|
|
348
|
+
},
|
|
349
|
+
executionPolicy: input.executionPolicy,
|
|
350
|
+
environment: {
|
|
351
|
+
cwd: input.options.cwd,
|
|
352
|
+
platform: process.platform,
|
|
353
|
+
arch: process.arch,
|
|
354
|
+
environmentDigest: (0, canonical_1.digestRuntimeValue)({
|
|
355
|
+
cwd: input.options.cwd,
|
|
356
|
+
platform: process.platform,
|
|
357
|
+
arch: process.arch,
|
|
358
|
+
}),
|
|
359
|
+
},
|
|
360
|
+
compiler: {
|
|
361
|
+
task: {
|
|
362
|
+
objective: input.input.input,
|
|
363
|
+
...(input.explicitSkillIds.length > 0 ? { explicitSkillIds: input.explicitSkillIds } : {}),
|
|
364
|
+
...(input.dynamicTools?.candidates.length
|
|
365
|
+
? {
|
|
366
|
+
explicitMcpToolIds: input.dynamicTools.candidates.map(candidate => candidate.descriptor.name),
|
|
367
|
+
}
|
|
368
|
+
: {}),
|
|
369
|
+
},
|
|
370
|
+
model: { toolCalling: true },
|
|
371
|
+
authority,
|
|
372
|
+
budgets: {
|
|
373
|
+
maxDirectTools: 12,
|
|
374
|
+
maxToolSchemaBytes: 16384,
|
|
375
|
+
maxDeferredTools: 32,
|
|
376
|
+
maxExpansionTools: 4,
|
|
377
|
+
},
|
|
378
|
+
skills: input.skillCatalog.descriptors.map(skill => ({
|
|
379
|
+
id: skill.id,
|
|
380
|
+
digest: skill.digest,
|
|
381
|
+
description: skill.description,
|
|
382
|
+
keywords: [skill.name],
|
|
383
|
+
requestedCapabilities: skill.requestedCapabilities,
|
|
384
|
+
loaded: loadedSkillIds.has(skill.id),
|
|
385
|
+
})),
|
|
386
|
+
executionPolicyDigest: input.executionPolicy.digest,
|
|
387
|
+
skillCatalogDigest: input.skillCatalog.digest,
|
|
388
|
+
promptManifest: input.promptReceipt.sections.map(section => ({
|
|
389
|
+
id: section.id,
|
|
390
|
+
digest: section.contentDigest,
|
|
391
|
+
selected: section.selected,
|
|
392
|
+
reason: section.reason,
|
|
393
|
+
})),
|
|
394
|
+
estimatedInputTokens: (0, token_estimate_1.estimateTokens)(input.input.input),
|
|
395
|
+
},
|
|
396
|
+
...(input.dynamicTools ? { dynamicTools: input.dynamicTools } : {}),
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function loadProductGoalSeed(projectPath, sessionId) {
|
|
400
|
+
const loaded = (0, goal_storage_1.loadGoal)(projectPath, sessionId);
|
|
401
|
+
if (!loaded.ok) {
|
|
402
|
+
if (loaded.error === 'not_found')
|
|
403
|
+
return undefined;
|
|
404
|
+
throw new Error(`Cannot start Goal runtime: ${loaded.message}`);
|
|
405
|
+
}
|
|
406
|
+
const legacy = loaded.value;
|
|
407
|
+
const status = legacy.status === 'active' ? 'active' : legacy.status === 'complete' ? 'completed' : 'paused';
|
|
408
|
+
const budget = {
|
|
409
|
+
maxTokens: legacy.tokenBudget ?? Number.MAX_SAFE_INTEGER,
|
|
410
|
+
maxElapsedMs: Number.MAX_SAFE_INTEGER,
|
|
411
|
+
};
|
|
412
|
+
const content = {
|
|
413
|
+
version: 2,
|
|
414
|
+
goalId: legacy.goalId,
|
|
415
|
+
objective: legacy.objective,
|
|
416
|
+
status,
|
|
417
|
+
generation: Math.max(1, legacy.revision + 1),
|
|
418
|
+
continuationCount: legacy.continuationCount,
|
|
419
|
+
noProgressCount: legacy.noProgressCount,
|
|
420
|
+
blockedCount: legacy.blocker?.consecutiveTurns ?? 0,
|
|
421
|
+
tokensUsed: legacy.tokensUsed,
|
|
422
|
+
elapsedMs: legacy.timeUsedMs,
|
|
423
|
+
budget,
|
|
424
|
+
createdAt: legacy.createdAt,
|
|
425
|
+
updatedAt: Math.max(legacy.createdAt, legacy.updatedAt),
|
|
426
|
+
};
|
|
427
|
+
const state = Object.freeze({
|
|
428
|
+
...content,
|
|
429
|
+
digest: (0, canonical_1.digestRuntimeValue)(content),
|
|
430
|
+
});
|
|
431
|
+
return Object.freeze({
|
|
432
|
+
goalId: state.goalId,
|
|
433
|
+
objective: state.objective,
|
|
434
|
+
budget: state.budget,
|
|
435
|
+
state,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
function buildGoalRuntimeContext(state) {
|
|
439
|
+
if (!state)
|
|
440
|
+
return undefined;
|
|
441
|
+
return [
|
|
442
|
+
'Durable Goal lifecycle (v2):',
|
|
443
|
+
`- Goal ID: ${state.goalId}`,
|
|
444
|
+
`- Objective: ${state.objective}`,
|
|
445
|
+
`- Status: ${state.status}`,
|
|
446
|
+
`- Generation: ${state.generation}`,
|
|
447
|
+
`- Continuations: ${state.continuationCount}`,
|
|
448
|
+
`- Tokens: ${state.tokensUsed}/${state.budget.maxTokens}`,
|
|
449
|
+
`- Elapsed ms: ${state.elapsedMs}/${state.budget.maxElapsedMs}`,
|
|
450
|
+
state.status === 'active'
|
|
451
|
+
? '- Continue autonomously; only TaskContext may verify completion.'
|
|
452
|
+
: '- Do not autonomously continue this Goal unless the user explicitly resumes it.',
|
|
453
|
+
].join('\n');
|
|
454
|
+
}
|
|
455
|
+
async function buildProductMessages(options, sessionId, eventStore, prompts, composition, input, mode, contextWindow) {
|
|
456
|
+
const durable = latestDurableHistory(eventStore);
|
|
457
|
+
const history = durable ?? legacyHistory(sessionId);
|
|
458
|
+
const withoutOldSystem = history.filter(message => message.role !== 'system');
|
|
459
|
+
const snapshot = options.store.getSnapshot();
|
|
460
|
+
const goalContent = buildGoalRuntimeContext(composition.goal.state);
|
|
461
|
+
const planReceipt = mode === 'plan' ? undefined : latestDurablePlanReceipt(eventStore);
|
|
462
|
+
const memory = (0, prompt_context_1.buildMemoryPromptContext)(input, options.cwd).content;
|
|
463
|
+
const skillCatalog = await composition.skills.observe({ id: `project:${(0, canonical_1.digestRuntimeValue)(options.cwd)}` }, undefined);
|
|
464
|
+
const skillSelection = await loadSelectedSkills(input, skillCatalog, composition, createProductAuthority(options, mode));
|
|
465
|
+
const basePrompt = (0, prompt_1.buildSystemPrompt)({
|
|
466
|
+
cwd: options.cwd,
|
|
467
|
+
platform: process.platform,
|
|
468
|
+
nodeVersion: process.version,
|
|
469
|
+
tools: options.toolCatalog.entries
|
|
470
|
+
.filter(entry => entry.candidate.tier === 'core')
|
|
471
|
+
.map(entry => entry.tool),
|
|
472
|
+
planMode: mode === 'plan',
|
|
473
|
+
agentMode: mode === 'goal'
|
|
474
|
+
? snapshot.agentMode
|
|
475
|
+
: mode === 'build'
|
|
476
|
+
? 'interactive'
|
|
477
|
+
: mode === 'maintenance'
|
|
478
|
+
? snapshot.agentMode
|
|
479
|
+
: mode,
|
|
480
|
+
});
|
|
481
|
+
const referencedFiles = (0, file_context_1.buildReferencedFilesPrompt)(input, options.cwd);
|
|
482
|
+
const sections = productPromptSections({
|
|
483
|
+
basePrompt,
|
|
484
|
+
memory,
|
|
485
|
+
projectInstructions: snapshot.projectInstructionsContent,
|
|
486
|
+
referencedFiles,
|
|
487
|
+
goal: goalContent,
|
|
488
|
+
plan: planReceipt,
|
|
489
|
+
skills: skillSelection.loaded,
|
|
490
|
+
});
|
|
491
|
+
const assembly = prompts.assemble({
|
|
492
|
+
hardTokenBudget: Math.min(32000, Math.max(8000, Math.floor(contextWindow * 0.25))),
|
|
493
|
+
contributors: sections,
|
|
494
|
+
});
|
|
495
|
+
const cacheable = assembly.sections
|
|
496
|
+
.filter(section => section.cacheablePrefix)
|
|
497
|
+
.map(section => section.content)
|
|
498
|
+
.join('\n\n');
|
|
499
|
+
const dynamic = assembly.sections
|
|
500
|
+
.filter(section => !section.cacheablePrefix)
|
|
501
|
+
.map(section => section.content)
|
|
502
|
+
.join('\n\n');
|
|
503
|
+
return {
|
|
504
|
+
messages: [
|
|
505
|
+
...(cacheable
|
|
506
|
+
? [
|
|
507
|
+
{
|
|
508
|
+
role: 'system',
|
|
509
|
+
content: cacheable,
|
|
510
|
+
cacheControl: { type: 'ephemeral' },
|
|
511
|
+
},
|
|
512
|
+
]
|
|
513
|
+
: []),
|
|
514
|
+
...(dynamic ? [{ role: 'system', content: dynamic }] : []),
|
|
515
|
+
...withoutOldSystem,
|
|
516
|
+
],
|
|
517
|
+
receipt: assembly.receipt,
|
|
518
|
+
skillCatalog,
|
|
519
|
+
loadedSkills: skillSelection.loaded,
|
|
520
|
+
explicitSkillIds: skillSelection.explicitSkillIds,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function productPromptSections(input) {
|
|
524
|
+
const section = (value) => ({
|
|
525
|
+
...value,
|
|
526
|
+
source: { id: value.sourceId, digest: (0, prompts_1.digestPromptSource)(value.content) },
|
|
527
|
+
});
|
|
528
|
+
return {
|
|
529
|
+
taskContext: [
|
|
530
|
+
section({
|
|
531
|
+
id: 'core.instructions',
|
|
532
|
+
sourceId: 'orion.core.v020',
|
|
533
|
+
authority: 'system',
|
|
534
|
+
priority: 1000,
|
|
535
|
+
tokenBudget: 12000,
|
|
536
|
+
mandatory: true,
|
|
537
|
+
atomic: true,
|
|
538
|
+
dynamic: false,
|
|
539
|
+
cacheability: 'cacheable',
|
|
540
|
+
redaction: 'none',
|
|
541
|
+
content: input.basePrompt.static,
|
|
542
|
+
}),
|
|
543
|
+
],
|
|
544
|
+
project: [
|
|
545
|
+
section({
|
|
546
|
+
id: 'project.instructions',
|
|
547
|
+
sourceId: 'project.instructions',
|
|
548
|
+
authority: 'project',
|
|
549
|
+
priority: 900,
|
|
550
|
+
tokenBudget: 8000,
|
|
551
|
+
mandatory: false,
|
|
552
|
+
atomic: true,
|
|
553
|
+
dynamic: false,
|
|
554
|
+
cacheability: 'cacheable',
|
|
555
|
+
redaction: 'secrets',
|
|
556
|
+
content: input.projectInstructions,
|
|
557
|
+
enabled: Boolean(input.projectInstructions.trim()),
|
|
558
|
+
omissionReason: input.projectInstructions.trim() ? undefined : 'source_unavailable',
|
|
559
|
+
}),
|
|
560
|
+
section({
|
|
561
|
+
id: 'project.referenced-files',
|
|
562
|
+
sourceId: 'turn.referenced-files',
|
|
563
|
+
authority: 'user',
|
|
564
|
+
priority: 850,
|
|
565
|
+
tokenBudget: 8000,
|
|
566
|
+
mandatory: false,
|
|
567
|
+
atomic: true,
|
|
568
|
+
dynamic: true,
|
|
569
|
+
cacheability: 'non_cacheable',
|
|
570
|
+
redaction: 'secrets',
|
|
571
|
+
content: input.referencedFiles,
|
|
572
|
+
enabled: Boolean(input.referencedFiles.trim()),
|
|
573
|
+
omissionReason: input.referencedFiles.trim() ? undefined : 'not_applicable',
|
|
574
|
+
}),
|
|
575
|
+
],
|
|
576
|
+
memory: [
|
|
577
|
+
section({
|
|
578
|
+
id: 'memory.relevant',
|
|
579
|
+
sourceId: 'project.memory',
|
|
580
|
+
authority: 'session',
|
|
581
|
+
priority: 800,
|
|
582
|
+
tokenBudget: 6000,
|
|
583
|
+
mandatory: false,
|
|
584
|
+
atomic: true,
|
|
585
|
+
dynamic: true,
|
|
586
|
+
cacheability: 'non_cacheable',
|
|
587
|
+
redaction: 'secrets',
|
|
588
|
+
content: input.memory ? `Project memory:\n${input.memory}` : '',
|
|
589
|
+
enabled: Boolean(input.memory.trim()),
|
|
590
|
+
omissionReason: input.memory.trim() ? undefined : 'source_unavailable',
|
|
591
|
+
}),
|
|
592
|
+
],
|
|
593
|
+
skill: input.skills.map((skill, index) => section({
|
|
594
|
+
id: `skill.selected-${index + 1}`,
|
|
595
|
+
sourceId: `skill.${skill.definition.digest.slice(0, 24)}`,
|
|
596
|
+
authority: skill.receipt.actor === 'user' ? 'user' : 'system',
|
|
597
|
+
priority: 920 - index,
|
|
598
|
+
tokenBudget: 16000,
|
|
599
|
+
mandatory: false,
|
|
600
|
+
atomic: true,
|
|
601
|
+
dynamic: true,
|
|
602
|
+
cacheability: 'non_cacheable',
|
|
603
|
+
redaction: 'secrets',
|
|
604
|
+
content: [
|
|
605
|
+
`Selected Skill: ${skill.definition.name}`,
|
|
606
|
+
`Granted capabilities: ${skill.receipt.grantedCapabilities.join(', ') || 'none'}`,
|
|
607
|
+
skill.definition.body,
|
|
608
|
+
].join('\n\n'),
|
|
609
|
+
})),
|
|
610
|
+
goal: [
|
|
611
|
+
section({
|
|
612
|
+
id: 'goal.active',
|
|
613
|
+
sourceId: 'goal.active',
|
|
614
|
+
authority: 'session',
|
|
615
|
+
priority: 950,
|
|
616
|
+
tokenBudget: 8000,
|
|
617
|
+
mandatory: false,
|
|
618
|
+
atomic: true,
|
|
619
|
+
dynamic: true,
|
|
620
|
+
cacheability: 'non_cacheable',
|
|
621
|
+
redaction: 'secrets',
|
|
622
|
+
content: input.goal ?? '',
|
|
623
|
+
enabled: Boolean(input.goal?.trim()),
|
|
624
|
+
omissionReason: input.goal?.trim() ? undefined : 'not_applicable',
|
|
625
|
+
}),
|
|
626
|
+
],
|
|
627
|
+
mode: [
|
|
628
|
+
section({
|
|
629
|
+
id: 'runtime.saved-plan',
|
|
630
|
+
sourceId: input.plan ? `plan.${input.plan.digest.slice(0, 24)}` : 'plan.none',
|
|
631
|
+
authority: 'runtime',
|
|
632
|
+
priority: 1010,
|
|
633
|
+
tokenBudget: 16000,
|
|
634
|
+
mandatory: false,
|
|
635
|
+
atomic: true,
|
|
636
|
+
dynamic: true,
|
|
637
|
+
cacheability: 'non_cacheable',
|
|
638
|
+
redaction: 'secrets',
|
|
639
|
+
content: input.plan
|
|
640
|
+
? [
|
|
641
|
+
'[Durable PlanReceipt V1]',
|
|
642
|
+
`Receipt: ${input.plan.digest}`,
|
|
643
|
+
`Planning turn: ${input.plan.turnId}`,
|
|
644
|
+
`Execution mode: ${input.plan.returnMode.toUpperCase()}`,
|
|
645
|
+
'Execute this saved plan now; do not return to planning unless new evidence invalidates it.',
|
|
646
|
+
'',
|
|
647
|
+
input.plan.plan,
|
|
648
|
+
].join('\n')
|
|
649
|
+
: '',
|
|
650
|
+
enabled: Boolean(input.plan),
|
|
651
|
+
omissionReason: input.plan ? undefined : 'not_applicable',
|
|
652
|
+
}),
|
|
653
|
+
section({
|
|
654
|
+
id: 'runtime.environment-mode',
|
|
655
|
+
sourceId: 'runtime.environment-mode',
|
|
656
|
+
authority: 'runtime',
|
|
657
|
+
priority: 1000,
|
|
658
|
+
tokenBudget: 4000,
|
|
659
|
+
mandatory: true,
|
|
660
|
+
atomic: true,
|
|
661
|
+
dynamic: true,
|
|
662
|
+
cacheability: 'non_cacheable',
|
|
663
|
+
redaction: 'secrets',
|
|
664
|
+
content: input.basePrompt.dynamic,
|
|
665
|
+
}),
|
|
666
|
+
],
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function latestDurableHistory(store) {
|
|
670
|
+
const commits = Object.values(store.loadProjection().turns)
|
|
671
|
+
.map(turn => turn.commit)
|
|
672
|
+
.filter((commit) => Boolean(commit))
|
|
673
|
+
.sort((left, right) => left.seq - right.seq);
|
|
674
|
+
const latest = commits.at(-1);
|
|
675
|
+
if (!latest)
|
|
676
|
+
return undefined;
|
|
677
|
+
const parsed = (0, turn_commit_1.parseTurnCommitV1)(latest.receipt);
|
|
678
|
+
const history = JSON.parse(parsed.history);
|
|
679
|
+
if (!Array.isArray(history) || !history.every(isMessage)) {
|
|
680
|
+
throw new Error('Durable TurnCommit contains an invalid model history.');
|
|
681
|
+
}
|
|
682
|
+
return history.map(message => ({ ...message }));
|
|
683
|
+
}
|
|
684
|
+
function latestDurablePlanReceipt(store) {
|
|
685
|
+
const latest = Object.values(store.loadProjection().turns)
|
|
686
|
+
.map(turn => turn.commit)
|
|
687
|
+
.filter((commit) => Boolean(commit))
|
|
688
|
+
.sort((left, right) => left.seq - right.seq)
|
|
689
|
+
.at(-1);
|
|
690
|
+
if (!latest)
|
|
691
|
+
return undefined;
|
|
692
|
+
return planReceiptFromCommit((0, turn_commit_1.parseTurnCommitV1)(latest.receipt));
|
|
693
|
+
}
|
|
694
|
+
function planReceiptFromCommit(commit) {
|
|
695
|
+
if (!commit.planReceipt)
|
|
696
|
+
return undefined;
|
|
697
|
+
const receipt = (0, turn_commit_1.parsePlanReceiptV1)(commit.planReceipt);
|
|
698
|
+
if (commit.planReceiptDigest !== receipt.digest) {
|
|
699
|
+
throw new Error('Durable PlanReceipt digest differs from its TurnCommit binding.');
|
|
700
|
+
}
|
|
701
|
+
return receipt;
|
|
702
|
+
}
|
|
703
|
+
function extractDecisionCompletePlan(commit) {
|
|
704
|
+
const plan = commit.queryComplete.content.trim();
|
|
705
|
+
if (!plan)
|
|
706
|
+
throw new Error('PLAN finished without a decision-complete plan body.');
|
|
707
|
+
const persistedInHistory = [...commit.history]
|
|
708
|
+
.reverse()
|
|
709
|
+
.some(message => message.role === 'assistant' && message.content.trim() === plan);
|
|
710
|
+
if (!persistedInHistory) {
|
|
711
|
+
throw new Error('PLAN output is not present in the authoritative model history.');
|
|
712
|
+
}
|
|
713
|
+
return plan;
|
|
714
|
+
}
|
|
715
|
+
function createPlanStopDecision(commit, promptReceiptDigest) {
|
|
716
|
+
const stats = commit.queryComplete.stats;
|
|
717
|
+
const completion = commit.taskContextCompletion;
|
|
718
|
+
const tokenCount = (commit.queryComplete.usage?.promptTokens ?? 0) +
|
|
719
|
+
(commit.queryComplete.usage?.completionTokens ?? 0);
|
|
720
|
+
return (0, stop_decision_1.createStopDecision)({
|
|
721
|
+
scope: 'request',
|
|
722
|
+
status: 'completed',
|
|
723
|
+
disposition: 'finish_scope',
|
|
724
|
+
reason: {
|
|
725
|
+
code: 'plan_ready',
|
|
726
|
+
message: 'The planning phase produced a durable decision-complete plan.',
|
|
727
|
+
},
|
|
728
|
+
evidence: [
|
|
729
|
+
{
|
|
730
|
+
kind: 'runtime',
|
|
731
|
+
source: 'task-context',
|
|
732
|
+
detail: `revision=${commit.taskContextRevision};digest=${(0, canonical_1.digestRuntimeValue)(commit.taskContextState)}`,
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
kind: 'runtime',
|
|
736
|
+
source: 'prompt-registry',
|
|
737
|
+
detail: `receipt=${promptReceiptDigest}`,
|
|
738
|
+
},
|
|
739
|
+
],
|
|
740
|
+
nextActions: [
|
|
741
|
+
{
|
|
742
|
+
kind: 'continue',
|
|
743
|
+
label: 'Execute the saved plan in the next logical turn.',
|
|
744
|
+
},
|
|
745
|
+
],
|
|
746
|
+
resources: {
|
|
747
|
+
turns: { used: safeCounter(stats?.turnsStarted) },
|
|
748
|
+
llmRequests: { used: safeCounter(stats?.llmRequests) },
|
|
749
|
+
toolCalls: { used: safeCounter(stats?.toolCalls) },
|
|
750
|
+
tokens: { used: safeCounter(tokenCount) },
|
|
751
|
+
},
|
|
752
|
+
...(completion?.criterionResults
|
|
753
|
+
? {
|
|
754
|
+
criterionStates: completion.criterionResults.map(result => ({
|
|
755
|
+
id: result.criterionId,
|
|
756
|
+
status: result.status,
|
|
757
|
+
})),
|
|
758
|
+
}
|
|
759
|
+
: {}),
|
|
760
|
+
...(completion?.progressDelta
|
|
761
|
+
? {
|
|
762
|
+
progressDelta: structuredClone(completion.progressDelta),
|
|
763
|
+
}
|
|
764
|
+
: {}),
|
|
765
|
+
...(completion?.stopDecision?.evidenceRefs
|
|
766
|
+
? { evidenceRefs: [...completion.stopDecision.evidenceRefs] }
|
|
767
|
+
: {}),
|
|
768
|
+
resumable: false,
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
function safeCounter(value) {
|
|
772
|
+
return Number.isSafeInteger(value) && (value ?? -1) >= 0 ? value : 0;
|
|
773
|
+
}
|
|
774
|
+
function productPlanReturnMode(store) {
|
|
775
|
+
const snapshot = store.getSnapshot();
|
|
776
|
+
return snapshot.agentMode === 'auto' || snapshot.planReturnMode === 'auto' ? 'auto' : 'build';
|
|
777
|
+
}
|
|
778
|
+
function projectPlanReceipt(store, receipt) {
|
|
779
|
+
const agentMode = receipt.returnMode === 'auto' ? 'auto' : 'interactive';
|
|
780
|
+
store.setState({
|
|
781
|
+
agentMode,
|
|
782
|
+
planMode: false,
|
|
783
|
+
planReturnMode: agentMode,
|
|
784
|
+
currentPlan: receipt.plan,
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
function schedulePlanExecution(runtime, receipt, scheduled) {
|
|
788
|
+
if (scheduled.has(receipt.digest))
|
|
789
|
+
return;
|
|
790
|
+
const admission = runtime.thread.dispatch({
|
|
791
|
+
type: 'turn.start',
|
|
792
|
+
data: {
|
|
793
|
+
input: [
|
|
794
|
+
`Execute durable PlanReceipt ${receipt.digest}.`,
|
|
795
|
+
'Continue autonomously from the saved plan and verify the implementation before finishing.',
|
|
796
|
+
].join(' '),
|
|
797
|
+
mode: receipt.returnMode,
|
|
798
|
+
},
|
|
799
|
+
});
|
|
800
|
+
if (admission.status === 'rejected') {
|
|
801
|
+
throw new Error(`Saved plan execution was not admitted: ${admission.reason}.`);
|
|
802
|
+
}
|
|
803
|
+
if (admission.status !== 'started' && admission.status !== 'queued') {
|
|
804
|
+
throw new Error(`Saved plan execution returned unexpected admission: ${admission.status}.`);
|
|
805
|
+
}
|
|
806
|
+
scheduled.add(receipt.digest);
|
|
807
|
+
}
|
|
808
|
+
function legacyHistory(sessionId) {
|
|
809
|
+
return (0, session_storage_1.readSessionMessages)(sessionId).map(message => ({
|
|
810
|
+
role: message.role,
|
|
811
|
+
content: message.modelVisibleContent ?? message.content,
|
|
812
|
+
...(message.toolCallId ? { toolCallId: message.toolCallId } : {}),
|
|
813
|
+
...(message.tool_calls ? { tool_calls: structuredClone(message.tool_calls) } : {}),
|
|
814
|
+
}));
|
|
815
|
+
}
|
|
816
|
+
function isMessage(value) {
|
|
817
|
+
if (!value || typeof value !== 'object')
|
|
818
|
+
return false;
|
|
819
|
+
const message = value;
|
|
820
|
+
return (['system', 'user', 'assistant', 'tool'].includes(message.role ?? '') &&
|
|
821
|
+
typeof message.content === 'string');
|
|
822
|
+
}
|
|
823
|
+
function createProductAuthority(options, mode) {
|
|
824
|
+
// AUTO is an explicit full-action consent mode. It bypasses interactive
|
|
825
|
+
// approval only; capability, containment, hard policy and sandbox checks
|
|
826
|
+
// remain unchanged and still precede execution.
|
|
827
|
+
const confirmation = mode === 'auto' ? 'allow' : options.config.toolConfirmation;
|
|
828
|
+
return (0, step_snapshot_1.createAuthoritySnapshotV1)({
|
|
829
|
+
authorityId: `project:${(0, canonical_1.digestRuntimeValue)(options.cwd).slice(0, 16)}:${mode ?? 'base'}`,
|
|
830
|
+
projectRoot: options.cwd,
|
|
831
|
+
confirmation,
|
|
832
|
+
filesystem: 'workspace',
|
|
833
|
+
network: confirmation === 'deny' ? 'deny' : 'write',
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
async function loadSelectedSkills(input, catalog, composition, authority) {
|
|
837
|
+
const explicit = parseExplicitSkillSelector(input);
|
|
838
|
+
const selected = selectSkillDescriptors(input, catalog.descriptors, explicit);
|
|
839
|
+
const allowedCapabilities = skillAuthorityCapabilities(authority);
|
|
840
|
+
const skillAuthority = Object.freeze({
|
|
841
|
+
authorityId: authority.authorityId,
|
|
842
|
+
digest: (0, canonical_1.digestRuntimeValue)({
|
|
843
|
+
authorityDigest: authority.digest,
|
|
844
|
+
allowedCapabilities,
|
|
845
|
+
}),
|
|
846
|
+
allowedCapabilities,
|
|
847
|
+
deniedCapabilityReasons: authority.network === 'deny'
|
|
848
|
+
? Object.freeze({ network: 'Project Authority denies network access.' })
|
|
849
|
+
: undefined,
|
|
850
|
+
});
|
|
851
|
+
const loaded = [];
|
|
852
|
+
for (const descriptor of selected.slice(0, 3)) {
|
|
853
|
+
loaded.push(await composition.skills.getDefinition({
|
|
854
|
+
catalog,
|
|
855
|
+
skillId: descriptor.id,
|
|
856
|
+
actor: explicit ? 'user' : 'model',
|
|
857
|
+
reason: explicit ? `Explicit Skill selection: ${explicit}` : 'Matched current task intent.',
|
|
858
|
+
authority: skillAuthority,
|
|
859
|
+
}));
|
|
860
|
+
}
|
|
861
|
+
const explicitSkillIds = explicit
|
|
862
|
+
? [
|
|
863
|
+
catalog.descriptors.find(descriptor => normalizeLookup(descriptor.id) === normalizeLookup(explicit) ||
|
|
864
|
+
normalizeLookup(descriptor.name) === normalizeLookup(explicit))?.id ?? explicit,
|
|
865
|
+
]
|
|
866
|
+
: loaded.map(skill => skill.definition.id);
|
|
867
|
+
return Object.freeze({ loaded: Object.freeze(loaded), explicitSkillIds });
|
|
868
|
+
}
|
|
869
|
+
function parseExplicitSkillSelector(input) {
|
|
870
|
+
const command = input.trim().match(/^\/(?:skill|use-skill|activate-skill)\s+([^\s]+)/iu);
|
|
871
|
+
const dollar = input.trim().match(/^\$([A-Za-z\p{L}][\w\p{L}-]*)\b/u);
|
|
872
|
+
const value = command?.[1] ?? dollar?.[1];
|
|
873
|
+
if (!value)
|
|
874
|
+
return undefined;
|
|
875
|
+
return value.replace(/^[$@#]+/u, '').trim();
|
|
876
|
+
}
|
|
877
|
+
function selectSkillDescriptors(input, descriptors, explicit) {
|
|
878
|
+
if (explicit) {
|
|
879
|
+
const key = normalizeLookup(explicit);
|
|
880
|
+
return descriptors.filter(descriptor => normalizeLookup(descriptor.id) === key || normalizeLookup(descriptor.name) === key);
|
|
881
|
+
}
|
|
882
|
+
const task = normalizeLookup(input);
|
|
883
|
+
return descriptors.filter(descriptor => descriptor.modelInvocable &&
|
|
884
|
+
normalizeLookup(descriptor.name).length >= 3 &&
|
|
885
|
+
task.includes(normalizeLookup(descriptor.name)));
|
|
886
|
+
}
|
|
887
|
+
function skillAuthorityCapabilities(authority) {
|
|
888
|
+
const values = new Set(['read', 'workspace_read', 'read_file', 'list_files', 'glob', 'grep']);
|
|
889
|
+
if (authority.confirmation !== 'deny') {
|
|
890
|
+
for (const value of ['write', 'workspace_write', 'write_file', 'edit_file', 'exec_command']) {
|
|
891
|
+
values.add(value);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
if (authority.network !== 'deny') {
|
|
895
|
+
for (const value of ['network', 'web', 'web_search', 'web_fetch'])
|
|
896
|
+
values.add(value);
|
|
897
|
+
}
|
|
898
|
+
return Object.freeze([...values].sort());
|
|
899
|
+
}
|
|
900
|
+
async function resolveMcpToolsForStep(input, runtime, catalog) {
|
|
901
|
+
const server = selectMcpServer(input.input, catalog);
|
|
902
|
+
if (!server)
|
|
903
|
+
return undefined;
|
|
904
|
+
const ownerId = input.turnId;
|
|
905
|
+
const existing = runtime
|
|
906
|
+
.bindingSnapshotForOwner(ownerId)
|
|
907
|
+
.servers.some(binding => binding.serverId === server.id);
|
|
908
|
+
if (!existing) {
|
|
909
|
+
await runtime.acquire({
|
|
910
|
+
catalog,
|
|
911
|
+
serverId: server.id,
|
|
912
|
+
ownerId,
|
|
913
|
+
reason: 'explicit',
|
|
914
|
+
signal: input.abortSignal,
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
const bindings = chooseMcpBindings(input.input, runtime.toolBindingsForOwner(ownerId));
|
|
918
|
+
const candidates = [];
|
|
919
|
+
const registry = new Map();
|
|
920
|
+
for (const binding of bindings) {
|
|
921
|
+
const bindingId = `mcp:${binding.descriptor.bindingDigest}`;
|
|
922
|
+
const risk = Object.freeze({
|
|
923
|
+
readOnly: false,
|
|
924
|
+
destructive: true,
|
|
925
|
+
fileEdit: false,
|
|
926
|
+
effect: 'external_write',
|
|
927
|
+
network: 'write',
|
|
928
|
+
});
|
|
929
|
+
const descriptor = Object.freeze({
|
|
930
|
+
name: binding.descriptor.qualifiedName,
|
|
931
|
+
aliases: Object.freeze([]),
|
|
932
|
+
description: binding.descriptor.description,
|
|
933
|
+
inputSchema: binding.descriptor.inputSchema,
|
|
934
|
+
schemaDigest: binding.descriptor.schemaDigest,
|
|
935
|
+
executorId: bindingId,
|
|
936
|
+
risk,
|
|
937
|
+
});
|
|
938
|
+
candidates.push(Object.freeze({
|
|
939
|
+
bindingId,
|
|
940
|
+
descriptor,
|
|
941
|
+
tier: 'long_tail',
|
|
942
|
+
source: 'mcp',
|
|
943
|
+
keywords: Object.freeze([
|
|
944
|
+
binding.descriptor.serverId,
|
|
945
|
+
binding.descriptor.name,
|
|
946
|
+
binding.descriptor.qualifiedName,
|
|
947
|
+
]),
|
|
948
|
+
mcp: Object.freeze({
|
|
949
|
+
serverId: binding.descriptor.serverId,
|
|
950
|
+
bindingDigest: binding.descriptor.bindingDigest,
|
|
951
|
+
}),
|
|
952
|
+
}));
|
|
953
|
+
registry.set(bindingId, Object.freeze({
|
|
954
|
+
descriptor,
|
|
955
|
+
execute: async (args, context) => {
|
|
956
|
+
try {
|
|
957
|
+
const result = await binding.invoke(args, context.abortSignal);
|
|
958
|
+
return { success: true, output: renderMcpResult(result) };
|
|
959
|
+
}
|
|
960
|
+
catch (error) {
|
|
961
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
962
|
+
return { success: false, output: '', error: message };
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
}));
|
|
966
|
+
}
|
|
967
|
+
return candidates.length === 0
|
|
968
|
+
? undefined
|
|
969
|
+
: Object.freeze({ candidates: Object.freeze(candidates), bindings: registry });
|
|
970
|
+
}
|
|
971
|
+
function selectMcpServer(input, catalog) {
|
|
972
|
+
const task = normalizeLookup(input);
|
|
973
|
+
const explicit = input.trim().match(/^\/mcp\s+([^\s]+)/iu)?.[1];
|
|
974
|
+
const explicitKey = explicit ? normalizeLookup(explicit) : undefined;
|
|
975
|
+
return catalog.descriptors.find(descriptor => {
|
|
976
|
+
if (descriptor.disabled)
|
|
977
|
+
return false;
|
|
978
|
+
const identities = [descriptor.id, descriptor.name, ...descriptor.tags]
|
|
979
|
+
.map(normalizeLookup)
|
|
980
|
+
.filter(value => value.length >= 2);
|
|
981
|
+
return explicitKey
|
|
982
|
+
? identities.includes(explicitKey)
|
|
983
|
+
: identities.some(identity => task.includes(identity));
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
function chooseMcpBindings(input, bindings) {
|
|
987
|
+
const task = normalizeLookup(input);
|
|
988
|
+
const ranked = [...bindings].sort((left, right) => {
|
|
989
|
+
const leftRelevant = task.includes(normalizeLookup(left.descriptor.name)) ? 1 : 0;
|
|
990
|
+
const rightRelevant = task.includes(normalizeLookup(right.descriptor.name)) ? 1 : 0;
|
|
991
|
+
return (rightRelevant - leftRelevant ||
|
|
992
|
+
left.descriptor.qualifiedName.localeCompare(right.descriptor.qualifiedName));
|
|
993
|
+
});
|
|
994
|
+
const relevant = ranked.filter(binding => task.includes(normalizeLookup(binding.descriptor.name)));
|
|
995
|
+
return Object.freeze((relevant.length > 0 ? relevant : ranked).slice(0, 4));
|
|
996
|
+
}
|
|
997
|
+
function normalizeLookup(value) {
|
|
998
|
+
return value
|
|
999
|
+
.normalize('NFKC')
|
|
1000
|
+
.toLocaleLowerCase('en-US')
|
|
1001
|
+
.replace(/[^\p{L}\p{N}]+/gu, ' ')
|
|
1002
|
+
.trim();
|
|
1003
|
+
}
|
|
1004
|
+
function renderMcpResult(value) {
|
|
1005
|
+
if (typeof value === 'string')
|
|
1006
|
+
return value;
|
|
1007
|
+
try {
|
|
1008
|
+
return JSON.stringify(value);
|
|
1009
|
+
}
|
|
1010
|
+
catch {
|
|
1011
|
+
return String(value);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
const INERT_MCP_CONNECTOR = Object.freeze({
|
|
1015
|
+
connect: async () => {
|
|
1016
|
+
throw new Error('No MCP connector is configured for this OrionRuntime.');
|
|
1017
|
+
},
|
|
1018
|
+
});
|
|
1019
|
+
//# sourceMappingURL=product-orion-runtime.js.map
|