@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
package/dist/framework/query.js
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* chunks directly to stdout via the callback.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.QueryLoopError = exports.
|
|
13
|
+
exports.QueryLoopError = exports.DEFAULT_MAX_MODEL_VISIBLE_TOOL_RESULT_BYTES = exports.DEFAULT_LOOP_BUDGET = void 0;
|
|
14
|
+
exports.withLoopFinishReason = withLoopFinishReason;
|
|
14
15
|
exports.createLocalFastPathLoopStats = createLocalFastPathLoopStats;
|
|
15
16
|
exports.createFailedLoopStats = createFailedLoopStats;
|
|
16
17
|
exports.query = query;
|
|
@@ -18,13 +19,19 @@ const llm_1 = require("../services/llm");
|
|
|
18
19
|
const tool_1 = require("./tool");
|
|
19
20
|
const strategy_tracker_1 = require("../core/strategy-tracker");
|
|
20
21
|
const auto_compact_1 = require("../services/compact/auto-compact");
|
|
22
|
+
const fingerprint_1 = require("../services/compact/fingerprint");
|
|
21
23
|
const tool_call_groups_1 = require("../services/compact/tool-call-groups");
|
|
22
|
-
const
|
|
24
|
+
const tool_call_orchestrator_1 = require("./tool-call-orchestrator");
|
|
23
25
|
const token_estimate_1 = require("../utils/token-estimate");
|
|
24
26
|
const tool_serializer_1 = require("./tool-serializer");
|
|
25
27
|
const model_context_1 = require("../services/model-context");
|
|
26
|
-
const
|
|
28
|
+
const stop_decision_1 = require("./stop-decision");
|
|
29
|
+
const loop_budget_contract_1 = require("./loop-budget-contract");
|
|
30
|
+
var loop_budget_contract_2 = require("./loop-budget-contract");
|
|
31
|
+
Object.defineProperty(exports, "DEFAULT_LOOP_BUDGET", { enumerable: true, get: function () { return loop_budget_contract_2.DEFAULT_LOOP_BUDGET; } });
|
|
27
32
|
exports.DEFAULT_MAX_MODEL_VISIBLE_TOOL_RESULT_BYTES = 4096;
|
|
33
|
+
/** Read-only tools eligible for the fragmentation hint; kept loop-local so Query has no tool registry. */
|
|
34
|
+
const BATCH_READ_ALLOWED_TOOLS = new Set(['git_status', 'list_files', 'glob', 'grep', 'read_file']);
|
|
28
35
|
function isAborted(signal) {
|
|
29
36
|
return signal?.aborted === true;
|
|
30
37
|
}
|
|
@@ -75,15 +82,6 @@ function parseBatchReadEvidenceSteps(result) {
|
|
|
75
82
|
];
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
|
-
exports.DEFAULT_LOOP_BUDGET = {
|
|
79
|
-
maxLlmRequestsPerUserTurn: 24,
|
|
80
|
-
maxToolCallsPerUserTurn: 120,
|
|
81
|
-
maxReadOnlyFragmentation: 3,
|
|
82
|
-
maxModelVisibleToolBytes: 64 * 1024,
|
|
83
|
-
profile: 'default',
|
|
84
|
-
baseProfile: 'default',
|
|
85
|
-
configOverride: false,
|
|
86
|
-
};
|
|
87
85
|
const COMPLEX_LOOP_BUDGET = {
|
|
88
86
|
maxLlmRequestsPerUserTurn: 48,
|
|
89
87
|
maxToolCallsPerUserTurn: 180,
|
|
@@ -120,23 +118,152 @@ function createLoopStats() {
|
|
|
120
118
|
localFastPathUsed: false,
|
|
121
119
|
};
|
|
122
120
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
121
|
+
function stopDecisionForLoop(stats, finishReason) {
|
|
122
|
+
if (finishReason === 'compact_paused' && stats.compactFailure) {
|
|
123
|
+
const failure = stats.compactFailure;
|
|
124
|
+
return (0, stop_decision_1.createStopDecision)({
|
|
125
|
+
scope: 'request',
|
|
126
|
+
status: 'stopped',
|
|
127
|
+
disposition: 'pause_scope',
|
|
128
|
+
reason: { code: failure.code, message: failure.message },
|
|
129
|
+
evidence: [
|
|
130
|
+
{
|
|
131
|
+
kind: 'resource_limit',
|
|
132
|
+
source: `compact:${failure.mode}`,
|
|
133
|
+
detail: `${failure.beforeTokens} tokens before compact; ${failure.afterTokens ?? 'unknown'} after; target ${failure.targetTokens}.`,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
nextActions: [
|
|
137
|
+
{ kind: 'inspect', label: 'Inspect current context pressure', command: '/context' },
|
|
138
|
+
{ kind: 'change_input', label: 'Narrow or split the current instruction' },
|
|
139
|
+
{ kind: 'raise_budget', label: 'Select a larger-context model or raise the budget' },
|
|
140
|
+
{ kind: 'resume', label: 'Resume after changing context or budget', command: '继续' },
|
|
141
|
+
],
|
|
142
|
+
resources: {
|
|
143
|
+
tokens: {
|
|
144
|
+
used: Math.max(0, Math.round(failure.afterTokens ?? failure.beforeTokens)),
|
|
145
|
+
limit: Math.max(0, Math.round(failure.targetTokens)),
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const status = finishReason === 'completed'
|
|
151
|
+
? 'completed'
|
|
152
|
+
: finishReason === 'cancelled'
|
|
153
|
+
? 'cancelled'
|
|
154
|
+
: finishReason === 'failed'
|
|
155
|
+
? 'failed'
|
|
156
|
+
: finishReason === 'blocked'
|
|
157
|
+
? 'blocked'
|
|
158
|
+
: 'stopped';
|
|
159
|
+
const reasonCode = finishReason === 'budget_exceeded'
|
|
160
|
+
? /LLM request budget/iu.test(stats.budgetExceededReason ?? '')
|
|
161
|
+
? 'llm_request_budget'
|
|
162
|
+
: /tool call budget/iu.test(stats.budgetExceededReason ?? '')
|
|
163
|
+
? 'tool_call_budget'
|
|
164
|
+
: /preflight|provider/iu.test(stats.budgetExceededReason ?? '')
|
|
165
|
+
? 'provider_preflight_budget'
|
|
166
|
+
: 'resource_budget'
|
|
167
|
+
: finishReason;
|
|
168
|
+
const resumable = finishReason === 'budget_exceeded' ||
|
|
169
|
+
finishReason === 'completion_gate' ||
|
|
170
|
+
finishReason === 'blocked';
|
|
171
|
+
const evidence = [];
|
|
172
|
+
if (finishReason === 'budget_exceeded') {
|
|
173
|
+
evidence.push({
|
|
174
|
+
kind: 'resource_limit',
|
|
175
|
+
source: 'query',
|
|
176
|
+
detail: stats.budgetExceededReason ?? 'request resource budget reached',
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (stats.lastToolName) {
|
|
180
|
+
evidence.push({
|
|
181
|
+
kind: 'tool_boundary',
|
|
182
|
+
source: stats.lastToolName,
|
|
183
|
+
detail: stats.lastToolSummary ?? `last tool success=${String(stats.lastToolSuccess)}`,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const nextActions = [];
|
|
187
|
+
for (const action of stats.continuationActions ?? []) {
|
|
188
|
+
if (action === 'reply_continue') {
|
|
189
|
+
nextActions.push({ kind: 'continue', label: 'Continue the same objective', command: '继续' });
|
|
190
|
+
}
|
|
191
|
+
else if (action === 'raise_budget') {
|
|
192
|
+
nextActions.push({ kind: 'raise_budget', label: 'Raise the intentional loop budget' });
|
|
193
|
+
}
|
|
194
|
+
else if (action === 'inspect_loop_stats') {
|
|
195
|
+
nextActions.push({
|
|
196
|
+
kind: 'inspect',
|
|
197
|
+
label: 'Inspect loop statistics',
|
|
198
|
+
command: '/usage',
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
nextActions.push({ kind: 'change_input', label: 'Provide a narrower instruction' });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return (0, stop_decision_1.createStopDecision)({
|
|
206
|
+
scope: 'request',
|
|
207
|
+
status,
|
|
208
|
+
disposition: resumable ? 'resume_allowed' : 'finish_scope',
|
|
209
|
+
reason: {
|
|
210
|
+
code: reasonCode,
|
|
211
|
+
message: finishReason === 'budget_exceeded'
|
|
212
|
+
? (stats.budgetExceededReason ?? 'Request resource budget reached')
|
|
213
|
+
: `Request finished with ${finishReason}`,
|
|
214
|
+
},
|
|
215
|
+
evidence,
|
|
216
|
+
nextActions,
|
|
217
|
+
resources: {
|
|
218
|
+
turns: { used: stats.turnsStarted },
|
|
219
|
+
llmRequests: {
|
|
220
|
+
used: stats.llmRequests,
|
|
221
|
+
...(stats.loopBudgetMaxLlmRequests === undefined
|
|
222
|
+
? {}
|
|
223
|
+
: { limit: stats.loopBudgetMaxLlmRequests }),
|
|
224
|
+
},
|
|
225
|
+
toolCalls: {
|
|
226
|
+
used: stats.toolCalls,
|
|
227
|
+
...(stats.loopBudgetMaxToolCalls === undefined
|
|
228
|
+
? {}
|
|
229
|
+
: { limit: stats.loopBudgetMaxToolCalls }),
|
|
230
|
+
},
|
|
231
|
+
modelVisibleToolBytes: {
|
|
232
|
+
used: stats.modelVisibleToolBytes,
|
|
233
|
+
...(stats.loopBudgetMaxModelVisibleBytes === undefined
|
|
234
|
+
? {}
|
|
235
|
+
: { limit: stats.loopBudgetMaxModelVisibleBytes }),
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/** Rebuild terminal loop stats and its StopDecision as one atomic projection. */
|
|
241
|
+
function withLoopFinishReason(stats, finishReason) {
|
|
242
|
+
const resolvedReason = finishReason;
|
|
243
|
+
const cloned = {
|
|
125
244
|
...stats,
|
|
126
|
-
finishReason:
|
|
245
|
+
finishReason: resolvedReason,
|
|
127
246
|
};
|
|
247
|
+
if (resolvedReason !== 'running')
|
|
248
|
+
cloned.stopDecision = stopDecisionForLoop(cloned, resolvedReason);
|
|
249
|
+
else
|
|
250
|
+
delete cloned.stopDecision;
|
|
251
|
+
return cloned;
|
|
252
|
+
}
|
|
253
|
+
function cloneLoopStats(stats, finishReason) {
|
|
254
|
+
return withLoopFinishReason(stats, finishReason ?? stats.finishReason);
|
|
128
255
|
}
|
|
129
256
|
function byteLength(text) {
|
|
130
257
|
return Buffer.byteLength(text, 'utf8');
|
|
131
258
|
}
|
|
132
259
|
function createLocalFastPathLoopStats(overrides = {}) {
|
|
133
|
-
return {
|
|
260
|
+
return cloneLoopStats({
|
|
134
261
|
...createLoopStats(),
|
|
135
262
|
turnsStarted: 1,
|
|
136
263
|
finishReason: 'completed',
|
|
137
264
|
localFastPathUsed: true,
|
|
138
265
|
...overrides,
|
|
139
|
-
};
|
|
266
|
+
});
|
|
140
267
|
}
|
|
141
268
|
function createFailedLoopStats(options = {}) {
|
|
142
269
|
const { loopBudget, diagnostics, ...overrides } = options;
|
|
@@ -149,7 +276,7 @@ function createFailedLoopStats(options = {}) {
|
|
|
149
276
|
};
|
|
150
277
|
applyLoopBudgetStats(stats, resolveLoopBudget(loopBudget));
|
|
151
278
|
applyLlmRequestDiagnostics(stats, diagnostics);
|
|
152
|
-
return stats;
|
|
279
|
+
return cloneLoopStats(stats);
|
|
153
280
|
}
|
|
154
281
|
function isLoopBudgetSource(value) {
|
|
155
282
|
return value === 'default' || value === 'complex' || value === 'release' || value === 'config';
|
|
@@ -164,16 +291,16 @@ function resolveLoopBudget(partial) {
|
|
|
164
291
|
const inferredConfigOverride = hasNumericOverrides && !hasExplicitProfile;
|
|
165
292
|
const configOverride = partial?.configOverride === true || inferredConfigOverride;
|
|
166
293
|
return {
|
|
167
|
-
...
|
|
294
|
+
...loop_budget_contract_1.DEFAULT_LOOP_BUDGET,
|
|
168
295
|
...numericOverrides,
|
|
169
296
|
profile: isLoopBudgetSource(partial?.profile)
|
|
170
297
|
? partial.profile
|
|
171
298
|
: configOverride
|
|
172
299
|
? 'config'
|
|
173
|
-
:
|
|
300
|
+
: loop_budget_contract_1.DEFAULT_LOOP_BUDGET.profile,
|
|
174
301
|
baseProfile: isLoopBudgetBaseProfile(partial?.baseProfile)
|
|
175
302
|
? partial.baseProfile
|
|
176
|
-
:
|
|
303
|
+
: loop_budget_contract_1.DEFAULT_LOOP_BUDGET.baseProfile,
|
|
177
304
|
configOverride,
|
|
178
305
|
};
|
|
179
306
|
}
|
|
@@ -235,14 +362,14 @@ function budgetExceededEvent(llm, stats, reason) {
|
|
|
235
362
|
'inspect_loop_stats',
|
|
236
363
|
'raise_budget',
|
|
237
364
|
];
|
|
238
|
-
const continuationHint = 'Reply `继续` to continue the same objective, give a narrower next step, inspect /
|
|
365
|
+
const continuationHint = 'Reply `继续` to continue the same objective, give a narrower next step, inspect /usage, or raise agentLoop.budget for intentional long work.';
|
|
239
366
|
return {
|
|
240
367
|
type: 'complete',
|
|
241
368
|
content: [
|
|
242
369
|
`Agent loop budget reached: ${reason}.`,
|
|
243
370
|
'I stopped this turn to avoid unnecessary model requests and preserved the current session state.',
|
|
244
371
|
'To continue the same objective, reply `继续` or provide the next concrete step.',
|
|
245
|
-
'Use /
|
|
372
|
+
'Use /usage to inspect request/tool counts. For intentional long work, raise agentLoop.budget in orion.json.',
|
|
246
373
|
].join('\n'),
|
|
247
374
|
model: llm.getModel(),
|
|
248
375
|
stats: cloneLoopStats({
|
|
@@ -404,18 +531,46 @@ function omitModelVisibleToolResult(executed, maxAggregateBytes) {
|
|
|
404
531
|
summarizedBytes: Math.max(0, fullBytes - bytes),
|
|
405
532
|
};
|
|
406
533
|
}
|
|
534
|
+
function queryCompactCommit(mode, result, before, after, uncompactedHistory, prepareSource, semanticHarnessState) {
|
|
535
|
+
return {
|
|
536
|
+
mode,
|
|
537
|
+
uncompactedHistory: uncompactedHistory.map(message => ({ ...message })),
|
|
538
|
+
modelHistory: result.messages.map(message => ({ ...message })),
|
|
539
|
+
summary: {
|
|
540
|
+
text: result.summary,
|
|
541
|
+
generatedAt: result.summaryGeneratedAt,
|
|
542
|
+
source: result.summarySource,
|
|
543
|
+
},
|
|
544
|
+
before,
|
|
545
|
+
after,
|
|
546
|
+
prepareSource,
|
|
547
|
+
semanticHarnessState,
|
|
548
|
+
fingerprint: result.fingerprint,
|
|
549
|
+
beforeTokens: result.beforeTokens,
|
|
550
|
+
afterTokens: result.afterTokens,
|
|
551
|
+
plan: structuredClone(result.plan),
|
|
552
|
+
semanticSummary: structuredClone(result.semanticSummary),
|
|
553
|
+
diagnostics: result.diagnostics.map(diagnostic => ({ ...diagnostic })),
|
|
554
|
+
};
|
|
555
|
+
}
|
|
407
556
|
function attachCompactCommit(event, compact, messages, usage) {
|
|
408
557
|
const eventWithUsage = usage ? { ...event, usage: { ...usage } } : event;
|
|
409
558
|
return compact
|
|
410
559
|
? {
|
|
411
560
|
...eventWithUsage,
|
|
412
|
-
compact:
|
|
413
|
-
...compact,
|
|
414
|
-
modelHistory: messages.map(message => ({ ...message })),
|
|
415
|
-
},
|
|
561
|
+
compact: bindCompactCommitToHistory(compact, messages),
|
|
416
562
|
}
|
|
417
563
|
: eventWithUsage;
|
|
418
564
|
}
|
|
565
|
+
function bindCompactCommitToHistory(compact, messages) {
|
|
566
|
+
const modelHistory = messages.map(message => ({ ...message }));
|
|
567
|
+
return {
|
|
568
|
+
...compact,
|
|
569
|
+
uncompactedHistory: compact.uncompactedHistory.map(message => ({ ...message })),
|
|
570
|
+
modelHistory,
|
|
571
|
+
afterTokens: (0, token_estimate_1.estimateMessagesTokens)(modelHistory),
|
|
572
|
+
};
|
|
573
|
+
}
|
|
419
574
|
function publishContextUsage(params, autoCompact, modelId, usedTokens, source = 'estimated') {
|
|
420
575
|
const stats = autoCompact.getStats();
|
|
421
576
|
const usage = (0, model_context_1.createContextUsageSnapshot)({
|
|
@@ -443,6 +598,57 @@ function publishAutoCompact(callback, notice) {
|
|
|
443
598
|
// Runtime observers must never break autonomous compaction.
|
|
444
599
|
}
|
|
445
600
|
}
|
|
601
|
+
function validateFinalCompactRequest(result, autoCompact, modelId, harness, messagesForHarness, input) {
|
|
602
|
+
const assembled = harness
|
|
603
|
+
? harness.assembleMessages(result.messages, {
|
|
604
|
+
input,
|
|
605
|
+
tools: messagesForHarness,
|
|
606
|
+
})
|
|
607
|
+
: result.messages;
|
|
608
|
+
const estimatedTokens = (0, token_estimate_1.estimateMessagesTokens)(assembled);
|
|
609
|
+
const observedTokens = autoCompact.adjustTokenEstimate(estimatedTokens, modelId);
|
|
610
|
+
const compactStats = autoCompact.getStats();
|
|
611
|
+
const targetTokens = Math.max(1, Math.floor(compactStats.safeInputBudget * compactStats.targetRatio));
|
|
612
|
+
if (observedTokens <= targetTokens)
|
|
613
|
+
return { valid: true, observedTokens, targetTokens };
|
|
614
|
+
return {
|
|
615
|
+
valid: false,
|
|
616
|
+
code: 'no_headroom',
|
|
617
|
+
message: `Final assembled request uses ${observedTokens} tokens after compact; safe target is ${targetTokens}.`,
|
|
618
|
+
observedTokens,
|
|
619
|
+
targetTokens,
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
function failureForUnchangedCompactAttempt(attempt, autoCompact) {
|
|
623
|
+
const compactStats = autoCompact.getStats();
|
|
624
|
+
const beforeTokens = (0, token_estimate_1.estimateMessagesTokens)(attempt.messages);
|
|
625
|
+
return {
|
|
626
|
+
code: attempt.status === 'duplicate' ? 'context_thrash' : 'no_headroom',
|
|
627
|
+
message: attempt.status === 'duplicate'
|
|
628
|
+
? 'The same high-pressure context reached compact again without new durable progress.'
|
|
629
|
+
: 'Compact could not reduce the high-pressure context, so the request was paused.',
|
|
630
|
+
mode: attempt.mode,
|
|
631
|
+
fingerprint: attempt.fingerprint,
|
|
632
|
+
consecutiveNoProgressAttempts: attempt.consecutiveNoProgressAttempts,
|
|
633
|
+
beforeTokens,
|
|
634
|
+
afterTokens: beforeTokens,
|
|
635
|
+
safeInputBudget: compactStats.safeInputBudget,
|
|
636
|
+
targetTokens: Math.max(1, Math.floor(compactStats.safeInputBudget * compactStats.targetRatio)),
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
function compactPausedEvent(llm, stats, failure, content) {
|
|
640
|
+
stats.compactFailure = {
|
|
641
|
+
...failure,
|
|
642
|
+
validationErrors: failure.validationErrors?.map(error => ({ ...error })),
|
|
643
|
+
};
|
|
644
|
+
return {
|
|
645
|
+
type: 'complete',
|
|
646
|
+
content: content ??
|
|
647
|
+
`Context compaction paused this request: ${failure.message} Change context or budget, then resume.`,
|
|
648
|
+
model: llm.getModel(),
|
|
649
|
+
stats: cloneLoopStats(stats, 'compact_paused'),
|
|
650
|
+
};
|
|
651
|
+
}
|
|
446
652
|
// ============================================================================
|
|
447
653
|
// query() — async generator
|
|
448
654
|
// ============================================================================
|
|
@@ -462,19 +668,49 @@ function publishAutoCompact(callback, notice) {
|
|
|
462
668
|
* }
|
|
463
669
|
*/
|
|
464
670
|
async function* query(params) {
|
|
465
|
-
const { messages, tools, toolExecutor, llm,
|
|
466
|
-
abortSignal, streamCallbacks, costTracker, strategyTracker = (0, strategy_tracker_1.createStrategyTracker)({ maxAttempts: 5 }), // 增加到 5 次
|
|
671
|
+
const { messages, tools: initialTools, toolExecutor: initialToolExecutor, llm, abortSignal, streamCallbacks, costTracker, strategyTracker = (0, strategy_tracker_1.createStrategyTracker)({ maxAttempts: 5 }), // 增加到 5 次
|
|
467
672
|
harness, input, maxParallelToolCalls = 6, } = params;
|
|
468
|
-
const openaiTools = (0, tool_1.toOpenAITools)(tools);
|
|
469
673
|
let turn = 0;
|
|
470
674
|
let consecutiveCompletionGateBlocks = 0;
|
|
471
675
|
const stats = createLoopStats();
|
|
472
676
|
let pendingCompact;
|
|
677
|
+
const uncompactedMessages = messages.map(message => ({ ...message }));
|
|
678
|
+
const appendMessage = (message) => {
|
|
679
|
+
messages.push(message);
|
|
680
|
+
uncompactedMessages.push({ ...message });
|
|
681
|
+
if (pendingCompact) {
|
|
682
|
+
pendingCompact.uncompactedHistory = uncompactedMessages.map(entry => ({ ...entry }));
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
let compactPrepareSource;
|
|
686
|
+
const captureCompactPrepareSource = () => {
|
|
687
|
+
if (compactPrepareSource)
|
|
688
|
+
return compactPrepareSource;
|
|
689
|
+
try {
|
|
690
|
+
compactPrepareSource = params.onCompactPrepare?.();
|
|
691
|
+
}
|
|
692
|
+
catch {
|
|
693
|
+
// Candidate preparation may continue in memory, but persistence will fail
|
|
694
|
+
// closed because semantic checkpoint commits require this receipt.
|
|
695
|
+
compactPrepareSource = undefined;
|
|
696
|
+
}
|
|
697
|
+
return compactPrepareSource;
|
|
698
|
+
};
|
|
473
699
|
let aggregateUsage;
|
|
474
|
-
|
|
700
|
+
// Preserve the old option as a resource-budget alias. It no longer emits a
|
|
701
|
+
// task-like `max_turns` completion or claims that the objective completed.
|
|
702
|
+
const legacyRequestBudget = typeof params.maxTurns === 'number' && Number.isFinite(params.maxTurns) && params.maxTurns > 0
|
|
703
|
+
? Math.floor(params.maxTurns)
|
|
704
|
+
: undefined;
|
|
705
|
+
let loopBudget = resolveLoopBudget({
|
|
706
|
+
...params.loopBudget,
|
|
707
|
+
...(params.loopBudget?.maxLlmRequestsPerUserTurn === undefined && legacyRequestBudget
|
|
708
|
+
? { maxLlmRequestsPerUserTurn: legacyRequestBudget }
|
|
709
|
+
: {}),
|
|
710
|
+
});
|
|
475
711
|
applyLoopBudgetStats(stats, loopBudget);
|
|
476
712
|
const maxModelVisibleToolResultBytes = Math.max(512, params.maxModelVisibleToolResultBytes ?? exports.DEFAULT_MAX_MODEL_VISIBLE_TOOL_RESULT_BYTES);
|
|
477
|
-
const fragmentedReadOnlyTools = new Set(
|
|
713
|
+
const fragmentedReadOnlyTools = new Set(BATCH_READ_ALLOWED_TOOLS);
|
|
478
714
|
// 无限循环,依赖安全机制停止
|
|
479
715
|
while (true) {
|
|
480
716
|
turn++;
|
|
@@ -483,16 +719,6 @@ async function* query(params) {
|
|
|
483
719
|
yield attachCompactCommit(cancelledCompleteEvent(llm, stats), pendingCompact, messages, aggregateUsage);
|
|
484
720
|
return;
|
|
485
721
|
}
|
|
486
|
-
// Safety valve: check maxTurns if specified (optional)
|
|
487
|
-
if (maxTurns && turn > maxTurns) {
|
|
488
|
-
yield attachCompactCommit({
|
|
489
|
-
type: 'complete',
|
|
490
|
-
content: `Reached maximum turns (${maxTurns}). Task may be incomplete.`,
|
|
491
|
-
model: llm.getModel(),
|
|
492
|
-
stats: cloneLoopStats(stats, 'max_turns'),
|
|
493
|
-
}, pendingCompact, messages, aggregateUsage);
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
722
|
if (shouldPromoteDefaultBudget(stats, loopBudget)) {
|
|
497
723
|
loopBudget = promoteDefaultBudgetToComplex(loopBudget);
|
|
498
724
|
applyLoopBudgetStats(stats, loopBudget);
|
|
@@ -501,6 +727,24 @@ async function* query(params) {
|
|
|
501
727
|
yield attachCompactCommit(budgetExceededEvent(llm, stats, `LLM request budget ${loopBudget.maxLlmRequestsPerUserTurn} reached`), pendingCompact, messages, aggregateUsage);
|
|
502
728
|
return;
|
|
503
729
|
}
|
|
730
|
+
const resolvedStep = params.resolveStep
|
|
731
|
+
? await params.resolveStep({
|
|
732
|
+
requestIndex: turn - 1,
|
|
733
|
+
messages: messages.map(message => ({ ...message })),
|
|
734
|
+
input,
|
|
735
|
+
abortSignal,
|
|
736
|
+
})
|
|
737
|
+
: { tools: initialTools, toolExecutor: initialToolExecutor };
|
|
738
|
+
const tools = [...resolvedStep.tools];
|
|
739
|
+
let toolExecutor = resolvedStep.toolExecutor;
|
|
740
|
+
const openaiTools = (0, tool_1.toOpenAITools)(tools);
|
|
741
|
+
harness?.updateCapabilityProfile?.({
|
|
742
|
+
modelId: llm.getModel(),
|
|
743
|
+
contextWindow: (0, model_context_1.getModelContextWindow)(llm.getModel()),
|
|
744
|
+
permissionMode: params.permissionMode ?? 'default',
|
|
745
|
+
toolConfirmation: params.toolConfirmation ?? 'allow',
|
|
746
|
+
tools: tools.map(tool => tool.name),
|
|
747
|
+
});
|
|
504
748
|
// Request start
|
|
505
749
|
yield { type: 'request_start', model: llm.getModel(), turn };
|
|
506
750
|
stats.turnsStarted = turn;
|
|
@@ -532,8 +776,27 @@ async function* query(params) {
|
|
|
532
776
|
const predictedTokens = autoCompact.adjustTokenEstimate(requestEstimatedTokens, llm.getModel());
|
|
533
777
|
const contextBeforePredictiveCompact = publishContextUsage(params, autoCompact, llm.getModel(), predictedTokens, autoCompact.hasProviderCalibration(llm.getModel()) ? 'provider_adjusted' : 'estimated');
|
|
534
778
|
const preCompactObjective = harness?.getCapsule()?.contract?.objective;
|
|
535
|
-
const
|
|
536
|
-
|
|
779
|
+
const compactToolDescriptions = tools.map(tool => ({
|
|
780
|
+
name: tool.name,
|
|
781
|
+
description: tool.description,
|
|
782
|
+
}));
|
|
783
|
+
const predictiveStats = autoCompact.getStats();
|
|
784
|
+
if (predictiveStats.enabled &&
|
|
785
|
+
predictedTokens / Math.max(1, predictiveStats.safeInputBudget) >=
|
|
786
|
+
predictiveStats.predictiveCompactThreshold) {
|
|
787
|
+
captureCompactPrepareSource();
|
|
788
|
+
}
|
|
789
|
+
const preCompactAttempt = await autoCompact.checkPredictiveCompactOutcome(messages, predictedTokens, result => validateFinalCompactRequest(result, autoCompact, llm.getModel(), harness, compactToolDescriptions, input));
|
|
790
|
+
if (preCompactAttempt.status === 'paused') {
|
|
791
|
+
yield attachCompactCommit(compactPausedEvent(llm, stats, preCompactAttempt.failure), pendingCompact, messages, aggregateUsage);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
if (preCompactAttempt.status === 'duplicate' || preCompactAttempt.status === 'rejected') {
|
|
795
|
+
yield attachCompactCommit(compactPausedEvent(llm, stats, failureForUnchangedCompactAttempt(preCompactAttempt, autoCompact)), pendingCompact, messages, aggregateUsage);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const preCompacted = preCompactAttempt.messages;
|
|
799
|
+
if (preCompactAttempt.status === 'compacted') {
|
|
537
800
|
stats.compactTrigger = 'pre_turn';
|
|
538
801
|
messages.length = 0;
|
|
539
802
|
messages.push(...preCompacted);
|
|
@@ -556,20 +819,7 @@ async function* query(params) {
|
|
|
556
819
|
const compactedTokens = autoCompact.adjustTokenEstimate(requestEstimatedTokens, llm.getModel());
|
|
557
820
|
autoCompact.getCtxPercent(compactedTokens);
|
|
558
821
|
const contextAfterPredictiveCompact = publishContextUsage(params, autoCompact, llm.getModel(), compactedTokens, autoCompact.hasProviderCalibration(llm.getModel()) ? 'provider_adjusted' : 'estimated');
|
|
559
|
-
|
|
560
|
-
if (result) {
|
|
561
|
-
pendingCompact = {
|
|
562
|
-
mode: 'predictive',
|
|
563
|
-
modelHistory: result.messages.map(message => ({ ...message })),
|
|
564
|
-
summary: {
|
|
565
|
-
text: result.summary,
|
|
566
|
-
generatedAt: result.summaryGeneratedAt,
|
|
567
|
-
source: result.summarySource,
|
|
568
|
-
},
|
|
569
|
-
before: contextBeforePredictiveCompact,
|
|
570
|
-
after: contextAfterPredictiveCompact,
|
|
571
|
-
};
|
|
572
|
-
}
|
|
822
|
+
pendingCompact = queryCompactCommit('predictive', preCompactAttempt.result, contextBeforePredictiveCompact, contextAfterPredictiveCompact, uncompactedMessages, compactPrepareSource, harness?.toJSON());
|
|
573
823
|
publishAutoCompact(params.onAutoCompact, {
|
|
574
824
|
mode: 'predictive',
|
|
575
825
|
before: contextBeforePredictiveCompact,
|
|
@@ -591,12 +841,39 @@ async function* query(params) {
|
|
|
591
841
|
omittedEvidence: compactPromptEvidence(assemblyStats.omittedEvidence, 8),
|
|
592
842
|
includedEvidenceCount: assemblyStats.includedEvidence.length,
|
|
593
843
|
omittedEvidenceCount: assemblyStats.omittedEvidence.length,
|
|
844
|
+
sectionManifest: assemblyStats.sectionManifest?.map(item => ({ ...item })) ?? [],
|
|
845
|
+
overBudget: assemblyStats.overBudget === true,
|
|
846
|
+
capabilityProfileVersion: assemblyStats.capabilityProfileVersion,
|
|
847
|
+
capabilityProfileFingerprint: assemblyStats.capabilityProfileFingerprint,
|
|
594
848
|
};
|
|
849
|
+
if (assemblyStats.overBudget) {
|
|
850
|
+
yield attachCompactCommit(compactPausedEvent(llm, stats, {
|
|
851
|
+
code: 'mandatory_context_over_budget',
|
|
852
|
+
message: `Mandatory Harness context uses ${assemblyStats.estimatedTokens} tokens; its atomic section budget is ${assemblyStats.budgetTokens}.`,
|
|
853
|
+
mode: 'predictive',
|
|
854
|
+
fingerprint: (0, fingerprint_1.canonicalMessagesFingerprint)(requestMessages),
|
|
855
|
+
consecutiveNoProgressAttempts: 1,
|
|
856
|
+
beforeTokens: assemblyStats.estimatedTokens,
|
|
857
|
+
afterTokens: assemblyStats.estimatedTokens,
|
|
858
|
+
safeInputBudget: assemblyStats.budgetTokens,
|
|
859
|
+
targetTokens: assemblyStats.budgetTokens,
|
|
860
|
+
}, 'Mandatory task context does not fit its atomic prompt budget. Narrow the contract or choose a larger-context model, then resume.'), pendingCompact, messages, aggregateUsage);
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
595
863
|
}
|
|
596
864
|
if (isAborted(abortSignal)) {
|
|
597
865
|
yield attachCompactCommit(cancelledCompleteEvent(llm, stats), pendingCompact, messages, aggregateUsage);
|
|
598
866
|
return;
|
|
599
867
|
}
|
|
868
|
+
if (resolvedStep.bindModelRequest) {
|
|
869
|
+
const bound = await resolvedStep.bindModelRequest({
|
|
870
|
+
requestIndex: turn - 1,
|
|
871
|
+
messages: requestMessages.map(message => ({ ...message })),
|
|
872
|
+
tools,
|
|
873
|
+
abortSignal,
|
|
874
|
+
});
|
|
875
|
+
toolExecutor = bound.toolExecutor;
|
|
876
|
+
}
|
|
600
877
|
let response;
|
|
601
878
|
try {
|
|
602
879
|
stats.llmRequests++;
|
|
@@ -649,29 +926,21 @@ async function* query(params) {
|
|
|
649
926
|
content: response.content,
|
|
650
927
|
tool_calls: toolCalls,
|
|
651
928
|
};
|
|
652
|
-
|
|
929
|
+
appendMessage(assistantMsg);
|
|
653
930
|
harness?.recordAssistantResponse(response);
|
|
654
931
|
yield {
|
|
655
932
|
type: 'assistant_tool_calls',
|
|
656
933
|
content: response.content,
|
|
657
934
|
toolCalls,
|
|
658
935
|
};
|
|
659
|
-
const preparedCalls = (0,
|
|
936
|
+
const preparedCalls = (0, tool_call_orchestrator_1.prepareToolCalls)({
|
|
660
937
|
toolCalls,
|
|
661
938
|
tools,
|
|
662
|
-
toolExecutor,
|
|
663
|
-
permissionMode: params.permissionMode,
|
|
664
|
-
toolConfirmation: params.toolConfirmation,
|
|
665
|
-
toolAllowlist: params.toolAllowlist,
|
|
666
|
-
confirmToolUse: params.confirmToolUse,
|
|
667
|
-
toolContext: params.toolContext,
|
|
668
|
-
abortSignal,
|
|
669
939
|
startApproach: (toolName) => strategyTracker.startApproach(toolName),
|
|
670
940
|
addToolToTracker: (attemptId, toolName) => strategyTracker.addTool(attemptId, toolName),
|
|
671
941
|
harnessDriftCheck: harness
|
|
672
942
|
? ({ name, args }) => harness.beforeToolUse({ name, args })
|
|
673
943
|
: undefined,
|
|
674
|
-
harnessBlockedResult: harness ? drift => harness.asToolBlockedResult(drift) : undefined,
|
|
675
944
|
});
|
|
676
945
|
stats.toolCalls += preparedCalls.length;
|
|
677
946
|
for (const prepared of preparedCalls) {
|
|
@@ -701,13 +970,9 @@ async function* query(params) {
|
|
|
701
970
|
batchIndex: prepared.index,
|
|
702
971
|
};
|
|
703
972
|
}
|
|
704
|
-
for await (const executed of (0,
|
|
973
|
+
for await (const executed of (0, tool_call_orchestrator_1.executeToolCalls)(preparedCalls, {
|
|
705
974
|
toolExecutor,
|
|
706
975
|
abortSignal,
|
|
707
|
-
confirmToolUse: params.confirmToolUse,
|
|
708
|
-
permissionMode: params.permissionMode,
|
|
709
|
-
toolConfirmation: params.toolConfirmation,
|
|
710
|
-
toolAllowlist: params.toolAllowlist,
|
|
711
976
|
harnessBlockedResult: harness ? drift => harness.asToolBlockedResult(drift) : undefined,
|
|
712
977
|
maxParallelToolCalls,
|
|
713
978
|
})) {
|
|
@@ -786,7 +1051,7 @@ async function* query(params) {
|
|
|
786
1051
|
batchCount: toolCalls.length,
|
|
787
1052
|
batchIndex: prepared.index,
|
|
788
1053
|
};
|
|
789
|
-
|
|
1054
|
+
appendMessage({
|
|
790
1055
|
role: 'tool',
|
|
791
1056
|
content: modelVisible.result,
|
|
792
1057
|
tool_call_id: tc.id,
|
|
@@ -830,7 +1095,7 @@ async function* query(params) {
|
|
|
830
1095
|
batchCount: toolCalls.length,
|
|
831
1096
|
batchIndex: skippedPrepared.index,
|
|
832
1097
|
};
|
|
833
|
-
|
|
1098
|
+
appendMessage({
|
|
834
1099
|
role: 'tool',
|
|
835
1100
|
content: skippedResult,
|
|
836
1101
|
tool_call_id: skipped.id,
|
|
@@ -846,14 +1111,14 @@ async function* query(params) {
|
|
|
846
1111
|
}
|
|
847
1112
|
if (pendingStrategySuggestion) {
|
|
848
1113
|
yield { type: 'strategy_exhausted', suggestion: pendingStrategySuggestion };
|
|
849
|
-
|
|
1114
|
+
appendMessage({
|
|
850
1115
|
role: 'user',
|
|
851
1116
|
content: pendingStrategySuggestion,
|
|
852
1117
|
});
|
|
853
1118
|
strategyTracker.reset();
|
|
854
1119
|
}
|
|
855
1120
|
if (stats.singleReadOnlyStreak >= loopBudget.maxReadOnlyFragmentation) {
|
|
856
|
-
|
|
1121
|
+
appendMessage({
|
|
857
1122
|
role: 'system',
|
|
858
1123
|
content: [
|
|
859
1124
|
'[Orion Code loop hint]',
|
|
@@ -871,7 +1136,7 @@ async function* query(params) {
|
|
|
871
1136
|
role: 'assistant',
|
|
872
1137
|
content: response.content,
|
|
873
1138
|
};
|
|
874
|
-
|
|
1139
|
+
appendMessage(assistantMsg);
|
|
875
1140
|
harness?.recordAssistantResponse(response);
|
|
876
1141
|
// No tool calls — done, unless the harness requires one more pass.
|
|
877
1142
|
const completionGate = harness?.beforeComplete();
|
|
@@ -881,15 +1146,19 @@ async function* query(params) {
|
|
|
881
1146
|
const missing = completionGate.missing?.length
|
|
882
1147
|
? completionGate.missing.join('; ')
|
|
883
1148
|
: 'required verification evidence is missing';
|
|
1149
|
+
const stoppedStats = cloneLoopStats(stats, 'completion_gate');
|
|
1150
|
+
if (completionGate.stopDecision) {
|
|
1151
|
+
stoppedStats.stopDecision = completionGate.stopDecision;
|
|
1152
|
+
}
|
|
884
1153
|
yield attachCompactCommit({
|
|
885
1154
|
type: 'complete',
|
|
886
1155
|
content: `Completion gate stopped this turn: ${missing}\nRun the required verification, then continue.`,
|
|
887
1156
|
model: response.model || llm.getModel(),
|
|
888
|
-
stats:
|
|
1157
|
+
stats: stoppedStats,
|
|
889
1158
|
}, pendingCompact, messages, aggregateUsage);
|
|
890
1159
|
return;
|
|
891
1160
|
}
|
|
892
|
-
|
|
1161
|
+
appendMessage(harness.asCompletionBlockedMessage(completionGate));
|
|
893
1162
|
stats.finishReason = 'completion_gate';
|
|
894
1163
|
continue;
|
|
895
1164
|
}
|
|
@@ -908,8 +1177,26 @@ async function* query(params) {
|
|
|
908
1177
|
const contextBeforeThresholdCompact = publishContextUsage(params, autoCompact, response.model || llm.getModel(), currentContextTokens, autoCompact.hasProviderCalibration(response.model || llm.getModel())
|
|
909
1178
|
? 'provider_adjusted'
|
|
910
1179
|
: 'estimated');
|
|
911
|
-
const
|
|
912
|
-
|
|
1180
|
+
const validatePostCompact = (result) => validateFinalCompactRequest(result, autoCompact, response.model || llm.getModel(), harness, compactToolDescriptions, input);
|
|
1181
|
+
const thresholdStats = autoCompact.getStats();
|
|
1182
|
+
if (!pendingCompact &&
|
|
1183
|
+
thresholdStats.enabled &&
|
|
1184
|
+
currentContextTokens / Math.max(1, thresholdStats.safeInputBudget) >= thresholdStats.threshold) {
|
|
1185
|
+
captureCompactPrepareSource();
|
|
1186
|
+
}
|
|
1187
|
+
const postCompactAttempt = pendingCompact
|
|
1188
|
+
? await autoCompact.ensureHeadroomAndCompactOutcome(messages, currentContextTokens, validatePostCompact)
|
|
1189
|
+
: await autoCompact.checkAndCompactOutcome(messages, currentContextTokens, validatePostCompact);
|
|
1190
|
+
if (postCompactAttempt.status === 'paused') {
|
|
1191
|
+
yield attachCompactCommit(compactPausedEvent(llm, stats, postCompactAttempt.failure, response.content), pendingCompact, messages, aggregateUsage);
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
if (postCompactAttempt.status === 'duplicate' || postCompactAttempt.status === 'rejected') {
|
|
1195
|
+
yield attachCompactCommit(compactPausedEvent(llm, stats, failureForUnchangedCompactAttempt(postCompactAttempt, autoCompact), response.content), pendingCompact, messages, aggregateUsage);
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
const compacted = postCompactAttempt.messages;
|
|
1199
|
+
if (postCompactAttempt.status === 'compacted') {
|
|
913
1200
|
stats.compactTrigger = stats.compactTrigger ?? 'post_turn';
|
|
914
1201
|
messages.length = 0;
|
|
915
1202
|
messages.push(...compacted);
|
|
@@ -919,20 +1206,7 @@ async function* query(params) {
|
|
|
919
1206
|
const contextAfterThresholdCompact = publishContextUsage(params, autoCompact, response.model || llm.getModel(), compactedTokens, autoCompact.hasProviderCalibration(response.model || llm.getModel())
|
|
920
1207
|
? 'provider_adjusted'
|
|
921
1208
|
: 'estimated');
|
|
922
|
-
|
|
923
|
-
if (result) {
|
|
924
|
-
pendingCompact = {
|
|
925
|
-
mode: 'threshold',
|
|
926
|
-
modelHistory: result.messages.map(message => ({ ...message })),
|
|
927
|
-
summary: {
|
|
928
|
-
text: result.summary,
|
|
929
|
-
generatedAt: result.summaryGeneratedAt,
|
|
930
|
-
source: result.summarySource,
|
|
931
|
-
},
|
|
932
|
-
before: contextBeforeThresholdCompact,
|
|
933
|
-
after: contextAfterThresholdCompact,
|
|
934
|
-
};
|
|
935
|
-
}
|
|
1209
|
+
pendingCompact = queryCompactCommit(pendingCompact?.mode ?? 'threshold', postCompactAttempt.result, contextBeforeThresholdCompact, contextAfterThresholdCompact, uncompactedMessages, pendingCompact?.prepareSource ?? compactPrepareSource, pendingCompact?.semanticHarnessState ?? harness?.toJSON());
|
|
936
1210
|
publishAutoCompact(params.onAutoCompact, {
|
|
937
1211
|
mode: 'threshold',
|
|
938
1212
|
before: contextBeforeThresholdCompact,
|
|
@@ -951,12 +1225,7 @@ async function* query(params) {
|
|
|
951
1225
|
usage: aggregateUsage,
|
|
952
1226
|
model: response.model,
|
|
953
1227
|
stats: cloneLoopStats(stats, 'completed'),
|
|
954
|
-
compact: pendingCompact
|
|
955
|
-
? {
|
|
956
|
-
...pendingCompact,
|
|
957
|
-
modelHistory: messages.map(message => ({ ...message })),
|
|
958
|
-
}
|
|
959
|
-
: undefined,
|
|
1228
|
+
compact: pendingCompact ? bindCompactCommitToHistory(pendingCompact, messages) : undefined,
|
|
960
1229
|
};
|
|
961
1230
|
return;
|
|
962
1231
|
}
|