@orion-agents/orion-code 0.1.9 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +142 -323
- package/README.zh-CN.md +118 -578
- package/dist/cli.js +65 -84
- 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 +132 -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 +1 -1
- package/dist/commands/model-command-handlers.js +2 -2
- 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 +1 -1
- package/dist/commands/session-command-handlers.d.ts.map +1 -1
- package/dist/commands/session-command-handlers.js +52 -214
- 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 +0 -48
- 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 +10 -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 +3 -3
- package/dist/framework/index.d.ts.map +1 -1
- package/dist/framework/index.js +6 -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 +45 -22
- package/dist/framework/query.d.ts.map +1 -1
- package/dist/framework/query.js +64 -52
- package/dist/framework/query.js.map +1 -1
- 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/index.d.ts +70 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -65
- package/dist/index.js.map +1 -1
- 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 +80 -0
- package/dist/runtime/agent-loop.d.ts.map +1 -0
- package/dist/runtime/agent-loop.js +419 -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 +270 -1216
- 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 +36 -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 +111 -0
- package/dist/runtime/goal-runtime-coordinator.d.ts.map +1 -0
- package/dist/runtime/goal-runtime-coordinator.js +511 -0
- package/dist/runtime/goal-runtime-coordinator.js.map +1 -0
- 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/orion-runtime-v1.d.ts +322 -0
- package/dist/runtime/orion-runtime-v1.d.ts.map +1 -0
- package/dist/runtime/orion-runtime-v1.js +959 -0
- package/dist/runtime/orion-runtime-v1.js.map +1 -0
- package/dist/runtime/orion-session-runner.d.ts +38 -0
- package/dist/runtime/orion-session-runner.d.ts.map +1 -0
- package/dist/runtime/orion-session-runner.js +168 -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 +1047 -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 +110 -0
- package/dist/runtime/release-receipts.d.ts.map +1 -0
- package/dist/runtime/release-receipts.js +305 -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/session-history-recovery.d.ts +19 -0
- package/dist/runtime/session-history-recovery.d.ts.map +1 -0
- package/dist/runtime/session-history-recovery.js +45 -0
- package/dist/runtime/session-history-recovery.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 +4 -1
- 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 -46
- package/dist/runtime/subagents/production.d.ts.map +1 -1
- package/dist/runtime/subagents/production.js +494 -170
- 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/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 -198
- 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 +83 -40
- package/dist/runtime/subagents/supervisor.js.map +1 -1
- package/dist/runtime/subagents/types.d.ts +1 -1
- package/dist/runtime/subagents/types.js +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-session-view.d.ts +45 -0
- package/dist/runtime/thread-session-view.d.ts.map +1 -0
- package/dist/runtime/thread-session-view.js +264 -0
- package/dist/runtime/thread-session-view.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 +87 -0
- package/dist/runtime/thread-ui-adapter.d.ts.map +1 -0
- package/dist/runtime/thread-ui-adapter.js +580 -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 +2 -1
- package/dist/runtime/ui-view-model.d.ts.map +1 -1
- package/dist/runtime/ui-view-model.js +6 -5
- package/dist/runtime/ui-view-model.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-lock.d.ts.map +1 -1
- package/dist/services/file-lock.js +42 -17
- package/dist/services/file-lock.js.map +1 -1
- package/dist/services/global-config.d.ts +2 -2
- package/dist/services/global-config.d.ts.map +1 -1
- package/dist/services/session-storage.d.ts +8 -0
- package/dist/services/session-storage.d.ts.map +1 -1
- package/dist/services/session-storage.js +76 -12
- package/dist/services/session-storage.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 +21 -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/tools/web.js +1 -1
- package/dist/tools/web.js.map +1 -1
- package/dist/tui-ui/chrome-view-model.d.ts.map +1 -1
- package/dist/tui-ui/chrome-view-model.js +22 -8
- package/dist/tui-ui/chrome-view-model.js.map +1 -1
- package/dist/tui-ui/launch.d.ts.map +1 -1
- package/dist/tui-ui/launch.js +13 -0
- package/dist/tui-ui/launch.js.map +1 -1
- package/dist/tui-ui/layout.js +1 -1
- package/dist/tui-ui/layout.js.map +1 -1
- package/dist/tui-ui/state.d.ts.map +1 -1
- package/dist/tui-ui/state.js +2 -0
- package/dist/tui-ui/state.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 +8 -8
- package/npm-shrinkwrap.json +45 -450
- package/package.json +17 -13
- 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 -291
- package/dist/agents/coordinator.js.map +0 -1
- package/dist/agents/fork.d.ts +0 -73
- package/dist/agents/fork.d.ts.map +0 -1
- package/dist/agents/fork.js +0 -163
- 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 -229
- 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 -191
- package/dist/framework/tool-scheduler.d.ts.map +0 -1
- package/dist/framework/tool-scheduler.js +0 -573
- 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 -27
- package/dist/ink-ui/screens/ReplScreen.d.ts.map +0 -1
- package/dist/ink-ui/screens/ReplScreen.js +0 -781
- 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-compact.d.ts +0 -26
- package/dist/runtime/chat-compact.d.ts.map +0 -1
- package/dist/runtime/chat-compact.js +0 -132
- package/dist/runtime/chat-compact.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 -1620
- 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 -92
- package/dist/runtime/goals/coordinator.d.ts.map +0 -1
- package/dist/runtime/goals/coordinator.js +0 -1471
- 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/stop-policy.d.ts +0 -9
- package/dist/runtime/goals/stop-policy.d.ts.map +0 -1
- package/dist/runtime/goals/stop-policy.js +0 -83
- package/dist/runtime/goals/stop-policy.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/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 -363
- 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
- package/docs/migration/v0.1.8-to-v0.1.9.md +0 -60
- package/docs/plan/v0.1.9-release-checklist.md +0 -64
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CapabilityCompilerError = exports.CAPABILITY_COMPILER_VERSION = void 0;
|
|
4
|
+
exports.compileCapabilityPlanV1 = compileCapabilityPlanV1;
|
|
5
|
+
exports.expandCapabilityPlanV1 = expandCapabilityPlanV1;
|
|
6
|
+
const canonical_1 = require("../protocol/canonical");
|
|
7
|
+
const step_snapshot_1 = require("../step-snapshot");
|
|
8
|
+
exports.CAPABILITY_COMPILER_VERSION = 'orion-capability-compiler-v1';
|
|
9
|
+
class CapabilityCompilerError extends Error {
|
|
10
|
+
constructor(code, message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.name = 'CapabilityCompilerError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CapabilityCompilerError = CapabilityCompilerError;
|
|
17
|
+
function compileCapabilityPlanV1(input) {
|
|
18
|
+
return compile(input, input.receipt, {});
|
|
19
|
+
}
|
|
20
|
+
function expandCapabilityPlanV1(input, expansion) {
|
|
21
|
+
validateExpansionParent(input, expansion);
|
|
22
|
+
const catalog = normalizeCatalog(input);
|
|
23
|
+
const requestedRawIds = normalizeStrings(expansion.requestedToolIds);
|
|
24
|
+
const requestedCanonicalIds = requestedRawIds
|
|
25
|
+
.map(id => catalog.byLookup.get(normalizeLookup(id))?.descriptor.name)
|
|
26
|
+
.filter((id) => Boolean(id));
|
|
27
|
+
return compile(input, expansion.receipt, {
|
|
28
|
+
expansion: {
|
|
29
|
+
previous: expansion.previous,
|
|
30
|
+
requestedCanonicalIds: uniqueSorted(requestedCanonicalIds),
|
|
31
|
+
requestedRawIds,
|
|
32
|
+
reason: expansion.reason.trim(),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function compile(input, receiptIdentity, options) {
|
|
37
|
+
validateInput(input, receiptIdentity);
|
|
38
|
+
const catalog = normalizeCatalog(input);
|
|
39
|
+
const omissions = [];
|
|
40
|
+
const selectedSkills = selectSkills(input, catalog, omissions);
|
|
41
|
+
const skillRequestedTools = new Map();
|
|
42
|
+
for (const skill of selectedSkills) {
|
|
43
|
+
for (const requested of skill.requestedCapabilities) {
|
|
44
|
+
const candidate = catalog.byLookup.get(normalizeLookup(requested));
|
|
45
|
+
if (candidate) {
|
|
46
|
+
skillRequestedTools.set(candidate.descriptor.name, skill.id);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
omissions.push(omission(requested, 'skill_capability_unavailable', `Selected skill ${skill.id} requested an unavailable capability.`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const explicit = resolveExplicitTools(input, catalog, omissions);
|
|
54
|
+
const reasons = buildDirectReasons(input, catalog, explicit, skillRequestedTools);
|
|
55
|
+
const lanes = selectLanes(input, catalog, reasons, omissions, options);
|
|
56
|
+
const plan = (0, step_snapshot_1.createCapabilityPlanV1)({
|
|
57
|
+
direct: lanes.direct.map(candidate => ({
|
|
58
|
+
id: candidate.descriptor.name,
|
|
59
|
+
reason: lanes.directReasons.get(candidate.descriptor.name),
|
|
60
|
+
})),
|
|
61
|
+
deferred: lanes.deferred.map(candidate => ({
|
|
62
|
+
id: candidate.descriptor.name,
|
|
63
|
+
reason: lanes.deferredReasons.get(candidate.descriptor.name),
|
|
64
|
+
})),
|
|
65
|
+
hidden: lanes.hidden,
|
|
66
|
+
expansionAllowed: options.expansion ? false : lanes.deferred.length > 0,
|
|
67
|
+
});
|
|
68
|
+
const directToolBindings = freeze(lanes.direct.map(candidate => ({
|
|
69
|
+
bindingId: candidate.bindingId,
|
|
70
|
+
descriptor: cloneDescriptor(candidate.descriptor),
|
|
71
|
+
reason: lanes.directReasons.get(candidate.descriptor.name),
|
|
72
|
+
})));
|
|
73
|
+
const deferredTools = freeze(lanes.deferred.map(candidate => ({
|
|
74
|
+
id: candidate.descriptor.name,
|
|
75
|
+
description: candidate.descriptor.description,
|
|
76
|
+
source: candidate.source,
|
|
77
|
+
reason: lanes.deferredReasons.get(candidate.descriptor.name),
|
|
78
|
+
})));
|
|
79
|
+
const selectedMcpBindings = selectMcpBindings(catalog, plan);
|
|
80
|
+
const routerDigests = createRouterDigests(lanes.direct);
|
|
81
|
+
const expansionReceipt = options.expansion
|
|
82
|
+
? createExpansionReceipt(input, options.expansion, lanes.selectedExpansionIds)
|
|
83
|
+
: undefined;
|
|
84
|
+
const receipt = createReceipt({
|
|
85
|
+
input,
|
|
86
|
+
receiptIdentity,
|
|
87
|
+
plan,
|
|
88
|
+
catalog,
|
|
89
|
+
selectedSkills,
|
|
90
|
+
selectedMcpBindings,
|
|
91
|
+
omissions: lanes.omissions,
|
|
92
|
+
routerDigests,
|
|
93
|
+
expansion: expansionReceipt,
|
|
94
|
+
});
|
|
95
|
+
return freeze({
|
|
96
|
+
plan,
|
|
97
|
+
directToolBindings,
|
|
98
|
+
deferredTools,
|
|
99
|
+
selectedSkills,
|
|
100
|
+
selectedMcpBindings,
|
|
101
|
+
receipt,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function validateInput(input, receipt) {
|
|
105
|
+
validateBudgets(input.budgets);
|
|
106
|
+
for (const [name, value] of [
|
|
107
|
+
['task objective', input.task.objective],
|
|
108
|
+
['runtimeServicesDigest', input.runtimeServicesDigest],
|
|
109
|
+
['executionPolicyDigest', input.executionPolicyDigest],
|
|
110
|
+
['skillCatalogDigest', input.skillCatalogDigest],
|
|
111
|
+
['mcpCatalogDigest', input.mcpCatalogDigest],
|
|
112
|
+
['authority digest', input.authority.digest],
|
|
113
|
+
['requestId', receipt.requestId],
|
|
114
|
+
['threadId', receipt.threadId],
|
|
115
|
+
['turnId', receipt.turnId],
|
|
116
|
+
['stepId', receipt.stepId],
|
|
117
|
+
['durableCommitId', receipt.durableCommitId],
|
|
118
|
+
]) {
|
|
119
|
+
if (!value.trim()) {
|
|
120
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', `${name} must not be empty.`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (!Number.isSafeInteger(input.taskContextRevision) || input.taskContextRevision < 0) {
|
|
124
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', 'taskContextRevision must be a non-negative safe integer.');
|
|
125
|
+
}
|
|
126
|
+
if (!Number.isFinite(input.estimatedInputTokens) || input.estimatedInputTokens < 0) {
|
|
127
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', 'estimatedInputTokens must be non-negative and finite.');
|
|
128
|
+
}
|
|
129
|
+
if (!Number.isFinite(receipt.createdAt) || receipt.createdAt < 0) {
|
|
130
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', 'receipt createdAt must be non-negative and finite.');
|
|
131
|
+
}
|
|
132
|
+
if (!['build', 'plan', 'auto'].includes(input.baseMode)) {
|
|
133
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', 'baseMode must be build, plan or auto.');
|
|
134
|
+
}
|
|
135
|
+
const { digest: authorityDigest, ...authorityContent } = input.authority;
|
|
136
|
+
if ((0, canonical_1.digestRuntimeValue)(authorityContent) !== authorityDigest) {
|
|
137
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', 'Authority snapshot digest does not match its content.');
|
|
138
|
+
}
|
|
139
|
+
const deniedIds = new Set();
|
|
140
|
+
for (const denied of input.hardDeniedTools ?? []) {
|
|
141
|
+
const id = normalizeLookup(denied.id);
|
|
142
|
+
if (!id || deniedIds.has(id)) {
|
|
143
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', `Hard-denied capability id is empty or duplicated: ${denied.id}.`);
|
|
144
|
+
}
|
|
145
|
+
deniedIds.add(id);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function validateBudgets(budgets) {
|
|
149
|
+
for (const [name, value] of Object.entries(budgets)) {
|
|
150
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
151
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', `Capability budget ${name} must be a non-negative safe integer.`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (budgets.maxToolSchemaBytes < 2) {
|
|
155
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_INVALID', 'maxToolSchemaBytes must fit at least an empty JSON array.');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function normalizeCatalog(input) {
|
|
159
|
+
const byName = new Map();
|
|
160
|
+
const byLookup = new Map();
|
|
161
|
+
const bindingIds = new Set();
|
|
162
|
+
const tools = [...input.tools]
|
|
163
|
+
.map(candidate => normalizeToolCandidate(candidate))
|
|
164
|
+
.sort((left, right) => compare(left.descriptor.name, right.descriptor.name));
|
|
165
|
+
for (const candidate of tools) {
|
|
166
|
+
const name = candidate.descriptor.name;
|
|
167
|
+
if (byName.has(name))
|
|
168
|
+
catalogError(`Duplicate tool name: ${name}.`);
|
|
169
|
+
if (bindingIds.has(candidate.bindingId)) {
|
|
170
|
+
catalogError(`Duplicate tool bindingId: ${candidate.bindingId}.`);
|
|
171
|
+
}
|
|
172
|
+
byName.set(name, candidate);
|
|
173
|
+
bindingIds.add(candidate.bindingId);
|
|
174
|
+
for (const lookup of [name, ...candidate.descriptor.aliases]) {
|
|
175
|
+
const key = normalizeLookup(lookup);
|
|
176
|
+
if (byLookup.has(key))
|
|
177
|
+
catalogError(`Duplicate tool name or alias: ${lookup}.`);
|
|
178
|
+
byLookup.set(key, candidate);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const skillsById = new Map();
|
|
182
|
+
const skills = [...(input.skills ?? [])]
|
|
183
|
+
.map(normalizeSkillCandidate)
|
|
184
|
+
.sort((left, right) => compare(left.id, right.id));
|
|
185
|
+
for (const skill of skills) {
|
|
186
|
+
if (skillsById.has(skill.id))
|
|
187
|
+
catalogError(`Duplicate skill id: ${skill.id}.`);
|
|
188
|
+
skillsById.set(skill.id, skill);
|
|
189
|
+
}
|
|
190
|
+
const toolCatalogDigest = (0, canonical_1.digestRuntimeValue)(tools.map(candidate => ({
|
|
191
|
+
bindingId: candidate.bindingId,
|
|
192
|
+
descriptor: candidate.descriptor,
|
|
193
|
+
tier: candidate.tier,
|
|
194
|
+
source: candidate.source,
|
|
195
|
+
keywords: candidate.keywords,
|
|
196
|
+
mcp: candidate.mcp,
|
|
197
|
+
})));
|
|
198
|
+
return { tools, byName, byLookup, skills, skillsById, toolCatalogDigest };
|
|
199
|
+
}
|
|
200
|
+
function normalizeToolCandidate(candidate) {
|
|
201
|
+
const bindingId = candidate.bindingId.trim();
|
|
202
|
+
const descriptor = cloneDescriptor(candidate.descriptor);
|
|
203
|
+
if (!bindingId)
|
|
204
|
+
catalogError(`Tool ${descriptor.name} requires a bindingId.`);
|
|
205
|
+
if (!descriptor.name.trim())
|
|
206
|
+
catalogError('Tool name must not be empty.');
|
|
207
|
+
if (!descriptor.executorId.trim())
|
|
208
|
+
catalogError(`Tool ${descriptor.name} requires executorId.`);
|
|
209
|
+
if ((0, canonical_1.digestRuntimeValue)(descriptor.inputSchema) !== descriptor.schemaDigest) {
|
|
210
|
+
catalogError(`Tool ${descriptor.name} schemaDigest does not match inputSchema.`);
|
|
211
|
+
}
|
|
212
|
+
if (!['core', 'standard', 'long_tail'].includes(candidate.tier)) {
|
|
213
|
+
catalogError(`Tool ${descriptor.name} has an invalid capability tier.`);
|
|
214
|
+
}
|
|
215
|
+
if (!['builtin', 'first_party', 'skill', 'mcp'].includes(candidate.source)) {
|
|
216
|
+
catalogError(`Tool ${descriptor.name} has an invalid capability source.`);
|
|
217
|
+
}
|
|
218
|
+
const risk = descriptor.risk;
|
|
219
|
+
if (typeof risk?.readOnly !== 'boolean' ||
|
|
220
|
+
typeof risk.destructive !== 'boolean' ||
|
|
221
|
+
typeof risk.fileEdit !== 'boolean' ||
|
|
222
|
+
!['none', 'workspace_read', 'workspace_write', 'external_write'].includes(risk.effect) ||
|
|
223
|
+
!['none', 'read', 'write'].includes(risk.network)) {
|
|
224
|
+
catalogError(`Tool ${descriptor.name} has incomplete risk metadata.`);
|
|
225
|
+
}
|
|
226
|
+
if (risk.readOnly && (risk.destructive || risk.fileEdit || risk.effect.includes('write'))) {
|
|
227
|
+
catalogError(`Tool ${descriptor.name} has contradictory read-only metadata.`);
|
|
228
|
+
}
|
|
229
|
+
if (candidate.source === 'mcp' && !candidate.mcp) {
|
|
230
|
+
catalogError(`MCP tool ${descriptor.name} requires MCP source metadata.`);
|
|
231
|
+
}
|
|
232
|
+
if (candidate.mcp && candidate.source !== 'mcp') {
|
|
233
|
+
catalogError(`Non-MCP tool ${descriptor.name} cannot declare MCP source metadata.`);
|
|
234
|
+
}
|
|
235
|
+
if (candidate.mcp && (!candidate.mcp.serverId.trim() || !candidate.mcp.bindingDigest.trim())) {
|
|
236
|
+
catalogError(`MCP tool ${descriptor.name} requires stable server and binding digests.`);
|
|
237
|
+
}
|
|
238
|
+
return freeze({
|
|
239
|
+
bindingId,
|
|
240
|
+
descriptor,
|
|
241
|
+
tier: candidate.tier,
|
|
242
|
+
source: candidate.source,
|
|
243
|
+
keywords: uniqueSorted(candidate.keywords ?? []),
|
|
244
|
+
mcp: candidate.mcp
|
|
245
|
+
? {
|
|
246
|
+
serverId: candidate.mcp.serverId.trim(),
|
|
247
|
+
bindingDigest: candidate.mcp.bindingDigest.trim(),
|
|
248
|
+
}
|
|
249
|
+
: undefined,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function cloneDescriptor(descriptor) {
|
|
253
|
+
return freeze({
|
|
254
|
+
name: descriptor.name.trim(),
|
|
255
|
+
aliases: uniqueSorted(descriptor.aliases),
|
|
256
|
+
description: descriptor.description,
|
|
257
|
+
inputSchema: structuredClone(descriptor.inputSchema),
|
|
258
|
+
schemaDigest: descriptor.schemaDigest.trim(),
|
|
259
|
+
executorId: descriptor.executorId.trim(),
|
|
260
|
+
risk: structuredClone(descriptor.risk),
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function normalizeSkillCandidate(skill) {
|
|
264
|
+
const id = skill.id.trim();
|
|
265
|
+
if (!id || !skill.digest.trim())
|
|
266
|
+
catalogError('Skill id and digest must not be empty.');
|
|
267
|
+
return freeze({
|
|
268
|
+
id,
|
|
269
|
+
digest: skill.digest.trim(),
|
|
270
|
+
description: skill.description,
|
|
271
|
+
keywords: uniqueSorted(skill.keywords ?? []),
|
|
272
|
+
requestedCapabilities: uniqueSorted(skill.requestedCapabilities),
|
|
273
|
+
loaded: skill.loaded === true,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
function selectSkills(input, catalog, omissions) {
|
|
277
|
+
const selected = new Map();
|
|
278
|
+
const explicitIds = normalizeStrings(input.task.explicitSkillIds ?? []);
|
|
279
|
+
const taskText = normalizedTaskText(input);
|
|
280
|
+
for (const id of explicitIds) {
|
|
281
|
+
const skill = catalog.skillsById.get(id);
|
|
282
|
+
if (skill) {
|
|
283
|
+
selected.set(id, 'Explicitly requested by the task.');
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
omissions.push(omission(id, 'unknown_explicit_skill', `Explicit skill ${id} is unavailable.`));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
for (const skill of catalog.skills) {
|
|
290
|
+
if (selected.has(skill.id))
|
|
291
|
+
continue;
|
|
292
|
+
if (matchesTask([skill.id, ...(skill.keywords ?? [])], taskText)) {
|
|
293
|
+
selected.set(skill.id, 'Matched current task intent.');
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return freeze([...selected]
|
|
297
|
+
.sort(([left], [right]) => compare(left, right))
|
|
298
|
+
.map(([id, reason]) => {
|
|
299
|
+
const skill = catalog.skillsById.get(id);
|
|
300
|
+
return {
|
|
301
|
+
id,
|
|
302
|
+
digest: skill.digest,
|
|
303
|
+
loaded: skill.loaded === true,
|
|
304
|
+
reason,
|
|
305
|
+
requestedCapabilities: [...skill.requestedCapabilities],
|
|
306
|
+
};
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
309
|
+
function resolveExplicitTools(input, catalog, omissions) {
|
|
310
|
+
const explicit = new Map();
|
|
311
|
+
const groups = [
|
|
312
|
+
{
|
|
313
|
+
ids: normalizeStrings(input.task.explicitToolIds ?? []),
|
|
314
|
+
missingCode: 'unknown_explicit_tool',
|
|
315
|
+
mcpOnly: false,
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
ids: normalizeStrings(input.task.explicitMcpToolIds ?? []),
|
|
319
|
+
missingCode: 'unknown_explicit_mcp_tool',
|
|
320
|
+
mcpOnly: true,
|
|
321
|
+
},
|
|
322
|
+
];
|
|
323
|
+
for (const group of groups) {
|
|
324
|
+
for (const rawId of group.ids) {
|
|
325
|
+
const candidate = resolveCandidate(rawId, catalog, group.mcpOnly);
|
|
326
|
+
if (!candidate) {
|
|
327
|
+
omissions.push(omission(rawId, group.missingCode, `Explicit capability ${rawId} is unavailable.`));
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
explicit.set(candidate.descriptor.name, 'Explicitly requested by the task.');
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const taskText = normalizedTaskText(input);
|
|
334
|
+
for (const candidate of catalog.tools) {
|
|
335
|
+
if (matchesTask([candidate.descriptor.name, ...candidate.descriptor.aliases], taskText) &&
|
|
336
|
+
!explicit.has(candidate.descriptor.name)) {
|
|
337
|
+
explicit.set(candidate.descriptor.name, 'Explicitly named in task text.');
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return explicit;
|
|
341
|
+
}
|
|
342
|
+
function resolveCandidate(id, catalog, mcpOnly) {
|
|
343
|
+
const direct = catalog.byLookup.get(normalizeLookup(id));
|
|
344
|
+
if (direct && (!mcpOnly || direct.source === 'mcp'))
|
|
345
|
+
return direct;
|
|
346
|
+
if (!mcpOnly)
|
|
347
|
+
return undefined;
|
|
348
|
+
return catalog.tools.find(candidate => candidate.source === 'mcp' &&
|
|
349
|
+
(candidate.bindingId === id ||
|
|
350
|
+
`${candidate.mcp?.serverId}.${candidate.descriptor.name}` === id));
|
|
351
|
+
}
|
|
352
|
+
function buildDirectReasons(input, catalog, explicit, skillRequestedTools) {
|
|
353
|
+
const result = new Map();
|
|
354
|
+
const taskText = normalizedTaskText(input);
|
|
355
|
+
for (const candidate of catalog.tools) {
|
|
356
|
+
const name = candidate.descriptor.name;
|
|
357
|
+
const explicitReason = explicit.get(name);
|
|
358
|
+
if (explicitReason) {
|
|
359
|
+
result.set(name, { reason: explicitReason, required: true });
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const skillId = skillRequestedTools.get(name);
|
|
363
|
+
if (skillId) {
|
|
364
|
+
result.set(name, {
|
|
365
|
+
reason: `Required by selected skill ${skillId}.`,
|
|
366
|
+
required: true,
|
|
367
|
+
});
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
if (candidate.tier === 'core') {
|
|
371
|
+
result.set(name, { reason: 'Core coding capability.', required: true });
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
if (candidate.tier === 'standard' &&
|
|
375
|
+
matchesTask([name, ...candidate.descriptor.aliases, ...(candidate.keywords ?? [])], taskText)) {
|
|
376
|
+
result.set(name, { reason: 'Matched current task intent.', required: false });
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return result;
|
|
380
|
+
}
|
|
381
|
+
function selectLanes(input, catalog, reasons, initialOmissions, options) {
|
|
382
|
+
const direct = [];
|
|
383
|
+
const directReasons = new Map();
|
|
384
|
+
const deferredCandidates = [];
|
|
385
|
+
const hidden = [];
|
|
386
|
+
const omissions = [...initialOmissions];
|
|
387
|
+
const selectedExpansionIds = [];
|
|
388
|
+
const expansionRequested = new Set(options.expansion?.requestedCanonicalIds ?? []);
|
|
389
|
+
const previousDeferred = new Set(options.expansion?.previous.plan.deferred.map(selection => selection.id) ?? []);
|
|
390
|
+
const previousDirect = new Set(options.expansion?.previous.plan.direct.map(selection => selection.id) ?? []);
|
|
391
|
+
let expansionSlots = input.budgets.maxExpansionTools;
|
|
392
|
+
const selectionPriority = (candidate) => {
|
|
393
|
+
const name = candidate.descriptor.name;
|
|
394
|
+
if (previousDirect.has(name))
|
|
395
|
+
return 0;
|
|
396
|
+
if (expansionRequested.has(name) && previousDeferred.has(name))
|
|
397
|
+
return 2;
|
|
398
|
+
const selection = reasons.get(name);
|
|
399
|
+
if (selection?.required)
|
|
400
|
+
return 0;
|
|
401
|
+
if (selection)
|
|
402
|
+
return 1;
|
|
403
|
+
return 3;
|
|
404
|
+
};
|
|
405
|
+
const orderedTools = [...catalog.tools].sort((left, right) => selectionPriority(left) - selectionPriority(right) ||
|
|
406
|
+
compare(left.descriptor.name, right.descriptor.name));
|
|
407
|
+
for (const candidate of orderedTools) {
|
|
408
|
+
const name = candidate.descriptor.name;
|
|
409
|
+
const deniedReason = authorityDenial(input, candidate);
|
|
410
|
+
if (deniedReason) {
|
|
411
|
+
hidden.push({ id: name, reason: deniedReason });
|
|
412
|
+
omissions.push(omission(name, denialCode(input), deniedReason));
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
const selection = reasons.get(name);
|
|
416
|
+
const wantsExpansion = expansionRequested.has(name) && previousDeferred.has(name);
|
|
417
|
+
const previousReason = options.expansion?.previous.plan.direct.find(item => item.id === name)?.reason;
|
|
418
|
+
const reason = wantsExpansion
|
|
419
|
+
? { reason: `Expanded after bounded request: ${options.expansion.reason}`, required: false }
|
|
420
|
+
: previousDirect.has(name)
|
|
421
|
+
? {
|
|
422
|
+
reason: previousReason ?? selection?.reason ?? 'Preserved from parent plan.',
|
|
423
|
+
required: true,
|
|
424
|
+
}
|
|
425
|
+
: selection;
|
|
426
|
+
if (wantsExpansion && expansionSlots <= 0) {
|
|
427
|
+
deferredCandidates.push({ candidate, reason: 'Deferred by the one-step expansion limit.' });
|
|
428
|
+
omissions.push(omission(name, 'expansion_limit', 'Capability expansion tool limit was reached.'));
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (reason) {
|
|
432
|
+
const budgetFailure = directBudgetFailure(input.budgets, direct, candidate);
|
|
433
|
+
if (!budgetFailure) {
|
|
434
|
+
direct.push(candidate);
|
|
435
|
+
directReasons.set(name, reason.reason);
|
|
436
|
+
if (wantsExpansion) {
|
|
437
|
+
expansionSlots--;
|
|
438
|
+
selectedExpansionIds.push(name);
|
|
439
|
+
}
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (reason.required) {
|
|
443
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_REQUIRED_BUDGET', `Required capability ${name} exceeds ${budgetFailure.replace(/_/gu, ' ')}.`);
|
|
444
|
+
}
|
|
445
|
+
deferredCandidates.push({ candidate, reason: `Deferred by ${budgetFailure}.` });
|
|
446
|
+
omissions.push(omission(name, budgetFailure, `Direct ${budgetFailure} was reached.`));
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
deferredCandidates.push({
|
|
450
|
+
candidate,
|
|
451
|
+
reason: candidate.tier === 'long_tail' || candidate.source === 'mcp'
|
|
452
|
+
? 'Deferred long-tail capability.'
|
|
453
|
+
: 'Deferred until task relevance is established.',
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
if (options.expansion) {
|
|
457
|
+
const directNames = new Set(direct.map(candidate => candidate.descriptor.name));
|
|
458
|
+
for (const rawId of options.expansion.requestedRawIds) {
|
|
459
|
+
const candidate = catalog.byLookup.get(normalizeLookup(rawId));
|
|
460
|
+
if (!candidate) {
|
|
461
|
+
omissions.push(omission(rawId, 'expansion_not_deferred', 'Expansion requested an unknown capability.'));
|
|
462
|
+
}
|
|
463
|
+
else if (options.expansion.previous.plan.direct.some(item => item.id === candidate.descriptor.name)) {
|
|
464
|
+
omissions.push(omission(candidate.descriptor.name, 'already_direct', 'Capability was already direct.'));
|
|
465
|
+
}
|
|
466
|
+
else if (!previousDeferred.has(candidate.descriptor.name)) {
|
|
467
|
+
omissions.push(omission(candidate.descriptor.name, 'expansion_not_deferred', 'Only capabilities from the parent deferred lane can be expanded.'));
|
|
468
|
+
}
|
|
469
|
+
else if (!directNames.has(candidate.descriptor.name)) {
|
|
470
|
+
// The precise budget or authority omission was recorded above.
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const deferred = deferredCandidates.slice(0, input.budgets.maxDeferredTools);
|
|
475
|
+
for (const omittedCandidate of deferredCandidates.slice(input.budgets.maxDeferredTools)) {
|
|
476
|
+
omissions.push(omission(omittedCandidate.candidate.descriptor.name, 'deferred_tool_budget', 'Deferred capability summary budget was reached.'));
|
|
477
|
+
}
|
|
478
|
+
const deferredReasons = new Map(deferred.map(entry => [entry.candidate.descriptor.name, entry.reason]));
|
|
479
|
+
const sortedDirect = direct.sort((left, right) => compare(left.descriptor.name, right.descriptor.name));
|
|
480
|
+
return {
|
|
481
|
+
direct: sortedDirect,
|
|
482
|
+
directReasons,
|
|
483
|
+
deferred: deferred.map(entry => entry.candidate),
|
|
484
|
+
deferredReasons,
|
|
485
|
+
hidden: hidden.sort((left, right) => compare(left.id, right.id)),
|
|
486
|
+
omissions: normalizeOmissions(omissions),
|
|
487
|
+
selectedExpansionIds: uniqueSorted(selectedExpansionIds),
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
function directBudgetFailure(budgets, selected, candidate) {
|
|
491
|
+
if (selected.length + 1 > budgets.maxDirectTools)
|
|
492
|
+
return 'direct_tool_budget';
|
|
493
|
+
if (toolSchemaBytes([...selected, candidate]) > budgets.maxToolSchemaBytes) {
|
|
494
|
+
return 'tool_schema_budget';
|
|
495
|
+
}
|
|
496
|
+
return undefined;
|
|
497
|
+
}
|
|
498
|
+
function authorityDenial(input, candidate) {
|
|
499
|
+
if (!input.model.toolCalling)
|
|
500
|
+
return 'Model does not support tool calling.';
|
|
501
|
+
const hardDeny = input.hardDeniedTools?.find(denied => normalizeLookup(denied.id) === normalizeLookup(candidate.descriptor.name));
|
|
502
|
+
if (hardDeny)
|
|
503
|
+
return hardDeny.reason.trim() || 'Capability is hard denied by Authority.';
|
|
504
|
+
const risk = candidate.descriptor.risk;
|
|
505
|
+
if (risk.network === 'read' && input.authority.network === 'deny') {
|
|
506
|
+
return 'Authority denies network reads.';
|
|
507
|
+
}
|
|
508
|
+
if (risk.network === 'write' && input.authority.network !== 'write') {
|
|
509
|
+
return 'Authority denies network writes.';
|
|
510
|
+
}
|
|
511
|
+
if (input.authority.confirmation === 'deny' &&
|
|
512
|
+
(risk.destructive || risk.fileEdit || risk.effect.includes('write'))) {
|
|
513
|
+
return 'Authority denies mutating capabilities.';
|
|
514
|
+
}
|
|
515
|
+
return undefined;
|
|
516
|
+
}
|
|
517
|
+
function denialCode(input) {
|
|
518
|
+
return input.model.toolCalling ? 'authority_denied' : 'model_unsupported';
|
|
519
|
+
}
|
|
520
|
+
function createRouterDigests(tools) {
|
|
521
|
+
const descriptors = tools.map(candidate => candidate.descriptor);
|
|
522
|
+
const visibleSchemas = descriptors.map(descriptor => ({
|
|
523
|
+
type: 'function',
|
|
524
|
+
function: {
|
|
525
|
+
name: descriptor.name,
|
|
526
|
+
description: descriptor.description,
|
|
527
|
+
parameters: descriptor.inputSchema,
|
|
528
|
+
},
|
|
529
|
+
}));
|
|
530
|
+
const toolSchemaDigest = (0, canonical_1.digestRuntimeValue)(visibleSchemas);
|
|
531
|
+
const toolBindingDigest = (0, canonical_1.digestRuntimeValue)(descriptors.map(descriptor => ({
|
|
532
|
+
name: descriptor.name,
|
|
533
|
+
aliases: descriptor.aliases,
|
|
534
|
+
schemaDigest: descriptor.schemaDigest,
|
|
535
|
+
executorId: descriptor.executorId,
|
|
536
|
+
risk: descriptor.risk,
|
|
537
|
+
})));
|
|
538
|
+
return {
|
|
539
|
+
toolSchemaDigest,
|
|
540
|
+
toolBindingDigest,
|
|
541
|
+
toolRouterDigest: (0, canonical_1.digestRuntimeValue)({
|
|
542
|
+
version: 1,
|
|
543
|
+
visibleSchemaDigest: toolSchemaDigest,
|
|
544
|
+
bindingDigest: toolBindingDigest,
|
|
545
|
+
}),
|
|
546
|
+
toolSchemaBytes: Buffer.byteLength((0, canonical_1.canonicalRuntimeJson)(visibleSchemas), 'utf8'),
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function toolSchemaBytes(tools) {
|
|
550
|
+
return createRouterDigests(tools).toolSchemaBytes;
|
|
551
|
+
}
|
|
552
|
+
function selectMcpBindings(catalog, plan) {
|
|
553
|
+
const direct = new Set(plan.direct.map(item => item.id));
|
|
554
|
+
const deferred = new Set(plan.deferred.map(item => item.id));
|
|
555
|
+
return freeze(catalog.tools
|
|
556
|
+
.filter(candidate => candidate.source === 'mcp' &&
|
|
557
|
+
(direct.has(candidate.descriptor.name) || deferred.has(candidate.descriptor.name)))
|
|
558
|
+
.map(candidate => ({
|
|
559
|
+
id: candidate.bindingId,
|
|
560
|
+
serverId: candidate.mcp.serverId,
|
|
561
|
+
toolName: candidate.descriptor.name,
|
|
562
|
+
bindingDigest: candidate.mcp.bindingDigest,
|
|
563
|
+
direct: direct.has(candidate.descriptor.name),
|
|
564
|
+
})));
|
|
565
|
+
}
|
|
566
|
+
function createExpansionReceipt(input, expansion, selectedIds) {
|
|
567
|
+
const selected = new Set(selectedIds);
|
|
568
|
+
const content = {
|
|
569
|
+
parentPlanDigest: expansion.previous.plan.digest,
|
|
570
|
+
parentReceiptDigest: expansion.previous.receipt.digest,
|
|
571
|
+
reason: expansion.reason,
|
|
572
|
+
requestedToolIds: expansion.requestedRawIds,
|
|
573
|
+
selectedToolIds: [...selected].sort(compare),
|
|
574
|
+
omittedToolIds: expansion.requestedCanonicalIds.filter(id => !selected.has(id)).sort(compare),
|
|
575
|
+
maxExpansionTools: input.budgets.maxExpansionTools,
|
|
576
|
+
};
|
|
577
|
+
return freeze({ ...content, digest: (0, canonical_1.digestRuntimeValue)(content) });
|
|
578
|
+
}
|
|
579
|
+
function createReceipt(params) {
|
|
580
|
+
const hiddenToolReasons = Object.fromEntries(params.plan.hidden.map(item => [item.id, item.reason]));
|
|
581
|
+
const loadedSkillDigests = Object.fromEntries(params.selectedSkills.filter(skill => skill.loaded).map(skill => [skill.id, skill.digest]));
|
|
582
|
+
const selectedMcpBindings = [...params.selectedMcpBindings];
|
|
583
|
+
const taskSignalsDigest = (0, canonical_1.digestRuntimeValue)(normalizeTaskSignals(params.input));
|
|
584
|
+
const modelSupportDigest = (0, canonical_1.digestRuntimeValue)(params.input.model);
|
|
585
|
+
const hardDenyDigest = (0, canonical_1.digestRuntimeValue)(normalizeHardDenies(params.input));
|
|
586
|
+
const budgets = { ...params.input.budgets };
|
|
587
|
+
const budgetDigest = (0, canonical_1.digestRuntimeValue)(budgets);
|
|
588
|
+
const content = {
|
|
589
|
+
version: 1,
|
|
590
|
+
compilerVersion: exports.CAPABILITY_COMPILER_VERSION,
|
|
591
|
+
...params.receiptIdentity,
|
|
592
|
+
taskContextRevision: params.input.taskContextRevision,
|
|
593
|
+
taskSignalsDigest,
|
|
594
|
+
modelSupportDigest,
|
|
595
|
+
planDigest: params.plan.digest,
|
|
596
|
+
runtimeServicesDigest: params.input.runtimeServicesDigest,
|
|
597
|
+
toolCatalogDigest: params.catalog.toolCatalogDigest,
|
|
598
|
+
toolSchemaDigest: params.routerDigests.toolSchemaDigest,
|
|
599
|
+
toolBindingDigest: params.routerDigests.toolBindingDigest,
|
|
600
|
+
toolRouterDigest: params.routerDigests.toolRouterDigest,
|
|
601
|
+
directToolNames: params.plan.direct.map(item => item.id),
|
|
602
|
+
deferredToolNames: params.plan.deferred.map(item => item.id),
|
|
603
|
+
hiddenToolReasons,
|
|
604
|
+
skillCatalogDigest: params.input.skillCatalogDigest,
|
|
605
|
+
selectedSkillIds: params.selectedSkills.map(skill => skill.id),
|
|
606
|
+
loadedSkillDigests,
|
|
607
|
+
mcpCatalogDigest: params.input.mcpCatalogDigest,
|
|
608
|
+
mcpBindingDigest: (0, canonical_1.digestRuntimeValue)({
|
|
609
|
+
catalogDigest: params.input.mcpCatalogDigest,
|
|
610
|
+
selected: selectedMcpBindings,
|
|
611
|
+
}),
|
|
612
|
+
selectedMcpBindings,
|
|
613
|
+
promptManifest: [...(params.input.promptManifest ?? [])],
|
|
614
|
+
authorityDigest: params.input.authority.digest,
|
|
615
|
+
hardDenyDigest,
|
|
616
|
+
executionPolicyDigest: params.input.executionPolicyDigest,
|
|
617
|
+
budgets,
|
|
618
|
+
budgetDigest,
|
|
619
|
+
omitted: [...params.omissions],
|
|
620
|
+
expansion: params.expansion,
|
|
621
|
+
estimatedInputTokens: params.input.estimatedInputTokens,
|
|
622
|
+
actualPromptTokens: params.input.actualPromptTokens,
|
|
623
|
+
toolSchemaBytes: params.routerDigests.toolSchemaBytes,
|
|
624
|
+
createdAt: params.receiptIdentity.createdAt,
|
|
625
|
+
};
|
|
626
|
+
return freeze({ ...content, digest: (0, canonical_1.digestRuntimeValue)(content) });
|
|
627
|
+
}
|
|
628
|
+
function validateExpansionParent(input, expansion) {
|
|
629
|
+
if (expansion.previous.receipt.expansion || !expansion.previous.plan.expansionAllowed) {
|
|
630
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_EXPANSION_EXHAUSTED', 'CapabilityPlanV1 permits at most one bounded expansion.');
|
|
631
|
+
}
|
|
632
|
+
if (!expansion.reason.trim()) {
|
|
633
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_EXPANSION_INVALID', 'Capability expansion requires a reason.');
|
|
634
|
+
}
|
|
635
|
+
if (expansion.previous.receipt.threadId !== input.receipt.threadId ||
|
|
636
|
+
expansion.previous.receipt.turnId !== input.receipt.turnId ||
|
|
637
|
+
expansion.previous.receipt.authorityDigest !== input.authority.digest ||
|
|
638
|
+
expansion.previous.receipt.runtimeServicesDigest !== input.runtimeServicesDigest ||
|
|
639
|
+
expansion.previous.receipt.executionPolicyDigest !== input.executionPolicyDigest ||
|
|
640
|
+
expansion.previous.receipt.skillCatalogDigest !== input.skillCatalogDigest ||
|
|
641
|
+
expansion.previous.receipt.mcpCatalogDigest !== input.mcpCatalogDigest ||
|
|
642
|
+
expansion.previous.receipt.taskContextRevision !== input.taskContextRevision ||
|
|
643
|
+
expansion.previous.receipt.taskSignalsDigest !==
|
|
644
|
+
(0, canonical_1.digestRuntimeValue)(normalizeTaskSignals(input)) ||
|
|
645
|
+
expansion.previous.receipt.modelSupportDigest !== (0, canonical_1.digestRuntimeValue)(input.model) ||
|
|
646
|
+
expansion.previous.receipt.hardDenyDigest !== (0, canonical_1.digestRuntimeValue)(normalizeHardDenies(input)) ||
|
|
647
|
+
expansion.previous.receipt.budgetDigest !== (0, canonical_1.digestRuntimeValue)(input.budgets) ||
|
|
648
|
+
expansion.previous.receipt.toolCatalogDigest !== normalizeCatalog(input).toolCatalogDigest) {
|
|
649
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_INPUT_DRIFT', 'Capability expansion inputs drifted from the parent plan; recompile the turn instead.');
|
|
650
|
+
}
|
|
651
|
+
if (expansion.receipt.threadId !== input.receipt.threadId ||
|
|
652
|
+
expansion.receipt.turnId !== input.receipt.turnId) {
|
|
653
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_EXPANSION_INVALID', 'Capability expansion must remain in the parent thread and turn.');
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
function omission(id, code, reason) {
|
|
657
|
+
return { id: id.trim(), code, reason };
|
|
658
|
+
}
|
|
659
|
+
function normalizeOmissions(omissions) {
|
|
660
|
+
const unique = new Map();
|
|
661
|
+
for (const entry of omissions) {
|
|
662
|
+
unique.set(`${entry.id}\u0000${entry.code}\u0000${entry.reason}`, entry);
|
|
663
|
+
}
|
|
664
|
+
return [...unique.values()].sort((left, right) => compare(left.id, right.id) || compare(left.code, right.code));
|
|
665
|
+
}
|
|
666
|
+
function normalizedTaskText(input) {
|
|
667
|
+
return normalizeLookup([input.task.objective, input.task.activeInstruction, ...(input.task.criteria ?? [])]
|
|
668
|
+
.filter(Boolean)
|
|
669
|
+
.join(' '));
|
|
670
|
+
}
|
|
671
|
+
function normalizeTaskSignals(input) {
|
|
672
|
+
return {
|
|
673
|
+
objective: input.task.objective.trim(),
|
|
674
|
+
criteria: uniqueSorted(input.task.criteria ?? []),
|
|
675
|
+
activeInstruction: input.task.activeInstruction?.trim(),
|
|
676
|
+
explicitToolIds: normalizeStrings(input.task.explicitToolIds ?? []),
|
|
677
|
+
explicitSkillIds: normalizeStrings(input.task.explicitSkillIds ?? []),
|
|
678
|
+
explicitMcpToolIds: normalizeStrings(input.task.explicitMcpToolIds ?? []),
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
function normalizeHardDenies(input) {
|
|
682
|
+
return [...(input.hardDeniedTools ?? [])]
|
|
683
|
+
.map(denied => ({ id: normalizeLookup(denied.id), reason: denied.reason.trim() }))
|
|
684
|
+
.sort((left, right) => compare(left.id, right.id));
|
|
685
|
+
}
|
|
686
|
+
function matchesTask(terms, normalizedText) {
|
|
687
|
+
return terms.some(term => {
|
|
688
|
+
const normalized = normalizeLookup(term);
|
|
689
|
+
return normalized.length > 1 && ` ${normalizedText} `.includes(` ${normalized} `);
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
function normalizeLookup(value) {
|
|
693
|
+
return value
|
|
694
|
+
.trim()
|
|
695
|
+
.toLowerCase()
|
|
696
|
+
.replace(/[^a-z0-9\p{L}\p{N}]+/gu, ' ')
|
|
697
|
+
.replace(/\s+/g, ' ')
|
|
698
|
+
.trim();
|
|
699
|
+
}
|
|
700
|
+
function normalizeStrings(values) {
|
|
701
|
+
return uniqueSorted(values.map(value => value.trim()).filter(Boolean));
|
|
702
|
+
}
|
|
703
|
+
function uniqueSorted(values) {
|
|
704
|
+
return [...new Set(values.map(value => value.trim()).filter(Boolean))].sort(compare);
|
|
705
|
+
}
|
|
706
|
+
function compare(left, right) {
|
|
707
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
708
|
+
}
|
|
709
|
+
function catalogError(message) {
|
|
710
|
+
throw new CapabilityCompilerError('ORION_CAPABILITY_CATALOG_INVALID', message);
|
|
711
|
+
}
|
|
712
|
+
function freeze(value) {
|
|
713
|
+
if (typeof value !== 'object' || value === null || Object.isFrozen(value))
|
|
714
|
+
return value;
|
|
715
|
+
for (const nested of Object.values(value))
|
|
716
|
+
freeze(nested);
|
|
717
|
+
return Object.freeze(value);
|
|
718
|
+
}
|
|
719
|
+
//# sourceMappingURL=compiler.js.map
|