@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
|
@@ -1,160 +1,545 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* orion code - Compact 服务
|
|
4
|
-
*
|
|
5
|
-
* 长对话压缩服务,减少上下文长度同时保留关键信息。
|
|
6
|
-
* 参考 OpenClaude 的 compact/ 目录实现。
|
|
7
|
-
*/
|
|
2
|
+
/** Semantic, group-safe conversation compaction. */
|
|
8
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CompactCandidateValidationError = void 0;
|
|
5
|
+
exports.prepareCompactCandidate = prepareCompactCandidate;
|
|
6
|
+
exports.validateCompactCandidate = validateCompactCandidate;
|
|
7
|
+
exports.commitCompactCandidate = commitCompactCandidate;
|
|
9
8
|
exports.compactMessages = compactMessages;
|
|
10
9
|
exports.needsCompact = needsCompact;
|
|
11
|
-
|
|
10
|
+
const crypto_1 = require("crypto");
|
|
12
11
|
const summary_generator_1 = require("./summary-generator");
|
|
13
12
|
const harness_1 = require("../../harness");
|
|
13
|
+
const token_estimate_1 = require("../../utils/token-estimate");
|
|
14
|
+
const fingerprint_1 = require("./fingerprint");
|
|
15
|
+
const planner_1 = require("./planner");
|
|
16
|
+
const semantic_summary_1 = require("./semantic-summary");
|
|
14
17
|
const tool_call_groups_1 = require("./tool-call-groups");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const CONTEXT_SUMMARY_PREFIX = '[Context Summary]\n';
|
|
19
|
+
const SUMMARY_ACK = 'I understand the context. I will continue the conversation with this background information.';
|
|
20
|
+
class CompactCandidateValidationError extends Error {
|
|
21
|
+
constructor(validation) {
|
|
22
|
+
super(validation.errors.map(error => `${error.code}: ${error.message}`).join('; '));
|
|
23
|
+
this.validation = validation;
|
|
24
|
+
this.name = 'CompactCandidateValidationError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.CompactCandidateValidationError = CompactCandidateValidationError;
|
|
18
28
|
const DEFAULT_OPTIONS = {
|
|
19
29
|
maxMessages: 20,
|
|
20
30
|
keepToolCalls: true,
|
|
21
31
|
keepSystemMessage: true,
|
|
22
|
-
threshold: 0,
|
|
32
|
+
threshold: 0,
|
|
23
33
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
function cloneMessages(messages) {
|
|
35
|
+
return messages.map(message => ({
|
|
36
|
+
...message,
|
|
37
|
+
tool_calls: message.tool_calls?.map(call => ({
|
|
38
|
+
...call,
|
|
39
|
+
function: { ...call.function },
|
|
40
|
+
})),
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
function uniqueStrings(values) {
|
|
44
|
+
return [
|
|
45
|
+
...new Set(values.map(value => value?.trim()).filter((value) => !!value)),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
function invariantItemId(kind, material) {
|
|
49
|
+
const digest = (0, crypto_1.createHash)('sha256').update(material, 'utf8').digest('hex').slice(0, 20);
|
|
50
|
+
return `ctx-${kind}-${digest}`;
|
|
51
|
+
}
|
|
52
|
+
function invariantItem(params) {
|
|
53
|
+
const id = invariantItemId(params.kind, `${params.sourceRefs.join('\0')}\0${params.text}`);
|
|
54
|
+
return {
|
|
55
|
+
id,
|
|
56
|
+
groupId: `harness:${id}`,
|
|
57
|
+
kind: params.kind,
|
|
58
|
+
priority: 'must_keep',
|
|
59
|
+
sourceRefs: [...params.sourceRefs],
|
|
60
|
+
tokenEstimate: (0, token_estimate_1.estimateMessagesTokens)([{ role: 'system', content: params.text }]),
|
|
61
|
+
taskEpoch: params.taskEpoch,
|
|
62
|
+
expires: 'task',
|
|
63
|
+
text: params.text,
|
|
64
|
+
sourceRole: 'system',
|
|
65
|
+
messageIndexes: { start: -1, end: -1 },
|
|
66
|
+
status: params.status,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function structuredProjectionLine(label, value, maxLength = 280) {
|
|
70
|
+
const normalized = value.replace(/\s+/g, ' ').trim();
|
|
71
|
+
const prefix = `${label}: `;
|
|
72
|
+
if (prefix.length + normalized.length <= maxLength)
|
|
73
|
+
return `${prefix}${normalized}`;
|
|
74
|
+
const ref = (0, crypto_1.createHash)('sha256').update(normalized, 'utf8').digest('hex').slice(0, 16);
|
|
75
|
+
const suffix = ` [full-ref:${ref}]`;
|
|
76
|
+
const available = Math.max(0, maxLength - prefix.length - suffix.length);
|
|
77
|
+
return `${prefix}${normalized.slice(0, available)}${suffix}`;
|
|
78
|
+
}
|
|
79
|
+
function renderDeterministicSemanticSummary(summary, maxLength) {
|
|
80
|
+
const lines = ['[Semantic Snapshot v1]'];
|
|
81
|
+
if (summary.requestedFocus) {
|
|
82
|
+
lines.push(structuredProjectionLine('Requested focus', summary.requestedFocus));
|
|
83
|
+
}
|
|
84
|
+
if (summary.projectInstructions) {
|
|
85
|
+
lines.push(structuredProjectionLine('Project compact instructions', summary.projectInstructions));
|
|
49
86
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
87
|
+
if (summary.objective)
|
|
88
|
+
lines.push(structuredProjectionLine('Objective', summary.objective));
|
|
89
|
+
if (summary.activeInstruction) {
|
|
90
|
+
lines.push(structuredProjectionLine('Active instruction', summary.activeInstruction));
|
|
91
|
+
}
|
|
92
|
+
for (const criterion of summary.criterionStates ?? []) {
|
|
93
|
+
lines.push(structuredProjectionLine(`Criterion ${criterion.id} [${criterion.status}]`, `${criterion.statement}${criterion.evidenceRefs.length ? ` | evidence=${criterion.evidenceRefs.join(',')}` : ''}`));
|
|
94
|
+
}
|
|
95
|
+
const appendValues = (label, values) => {
|
|
96
|
+
for (const value of values ?? [])
|
|
97
|
+
lines.push(structuredProjectionLine(label, value));
|
|
98
|
+
};
|
|
99
|
+
appendValues('Constraint', summary.constraints);
|
|
100
|
+
appendValues('Non-goal', summary.nonGoals);
|
|
101
|
+
appendValues('Decision', summary.decisions);
|
|
102
|
+
appendValues('Completed', summary.completed);
|
|
103
|
+
appendValues('Pending', summary.pending);
|
|
104
|
+
appendValues('Blocker', summary.blockers);
|
|
105
|
+
appendValues('Verification passed', summary.successfulVerifications);
|
|
106
|
+
appendValues('Verification failed', summary.failedVerifications);
|
|
107
|
+
appendValues('Changed file', summary.changedFiles);
|
|
108
|
+
appendValues('Open question', summary.openQuestions);
|
|
109
|
+
if (summary.nextAction)
|
|
110
|
+
lines.push(structuredProjectionLine('Next action', summary.nextAction));
|
|
111
|
+
lines.push(`Source boundary: ${summary.coverage.groupCount} groups / ${summary.coverage.messageCount} messages`);
|
|
112
|
+
const selected = [];
|
|
113
|
+
const omitted = [];
|
|
114
|
+
let used = 0;
|
|
115
|
+
for (const line of lines) {
|
|
116
|
+
const needed = line.length + (selected.length > 0 ? 1 : 0);
|
|
117
|
+
if (used + needed <= maxLength) {
|
|
118
|
+
selected.push(line);
|
|
119
|
+
used += needed;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
omitted.push(line);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (omitted.length > 0) {
|
|
126
|
+
const ref = (0, crypto_1.createHash)('sha256').update(omitted.join('\n'), 'utf8').digest('hex').slice(0, 16);
|
|
127
|
+
const receipt = `Omitted structured lines: ${omitted.length} [full-ref:${ref}]`;
|
|
128
|
+
while (selected.length > 1 && selected.join('\n').length + receipt.length + 1 > maxLength) {
|
|
129
|
+
omitted.unshift(selected.pop());
|
|
130
|
+
}
|
|
131
|
+
if (receipt.length <= maxLength)
|
|
132
|
+
selected.push(receipt);
|
|
133
|
+
}
|
|
134
|
+
return selected.join('\n');
|
|
135
|
+
}
|
|
136
|
+
function enrichSemanticSummary(summary, options) {
|
|
137
|
+
const state = options.harnessState;
|
|
138
|
+
const capsule = state?.capsule ?? options.contextCapsule;
|
|
139
|
+
const contract = state?.contract ?? capsule?.contract;
|
|
140
|
+
const capability = state?.capabilityProfile;
|
|
141
|
+
const taskEpoch = Math.max(1, state?.taskEpoch ?? contract?.taskEpoch ?? summary.taskEpoch);
|
|
142
|
+
const criterionStates = contract?.criteria?.map(criterion => ({
|
|
143
|
+
id: criterion.id,
|
|
144
|
+
statement: criterion.statement,
|
|
145
|
+
status: criterion.status ?? 'pending',
|
|
146
|
+
evidenceRefs: [...criterion.evidenceRefs],
|
|
147
|
+
}));
|
|
148
|
+
const boundEvidenceRefs = uniqueStrings((criterionStates ?? []).flatMap(criterion => criterion.evidenceRefs));
|
|
149
|
+
const evidenceByRef = new Map();
|
|
150
|
+
for (const record of state?.evidenceIndex ?? []) {
|
|
151
|
+
const value = { content: record.content, status: record.verificationStatus };
|
|
152
|
+
evidenceByRef.set(record.id, value);
|
|
153
|
+
evidenceByRef.set(`evidence:${record.id}`, value);
|
|
154
|
+
}
|
|
155
|
+
for (const entry of state?.ledger ?? []) {
|
|
156
|
+
const rawSuccess = entry.metadata?.success;
|
|
157
|
+
const status = rawSuccess === true ? 'passed' : rawSuccess === false ? 'failed' : 'unknown';
|
|
158
|
+
const value = { content: entry.content, status };
|
|
159
|
+
evidenceByRef.set(entry.id, value);
|
|
160
|
+
evidenceByRef.set(`ledger:${entry.id}`, value);
|
|
161
|
+
}
|
|
162
|
+
const invariantItems = [];
|
|
163
|
+
if (contract) {
|
|
164
|
+
invariantItems.push(invariantItem({
|
|
165
|
+
kind: 'contract',
|
|
166
|
+
text: JSON.stringify({
|
|
167
|
+
objective: contract.objective,
|
|
168
|
+
activeInstruction: state?.activeInstruction ?? contract.userIntent,
|
|
169
|
+
constraints: contract.constraints,
|
|
170
|
+
prohibitions: contract.prohibitions,
|
|
171
|
+
nonGoals: state?.nonGoals ?? contract.nonGoals ?? [],
|
|
172
|
+
openQuestions: state?.openQuestions ?? contract.openQuestions ?? [],
|
|
173
|
+
criteria: criterionStates ?? [],
|
|
174
|
+
}),
|
|
175
|
+
sourceRefs: uniqueStrings([
|
|
176
|
+
`contract:${contract.id}`,
|
|
177
|
+
...(criterionStates ?? []).map(criterion => criterion.id),
|
|
178
|
+
]),
|
|
179
|
+
taskEpoch,
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
for (const ref of boundEvidenceRefs) {
|
|
183
|
+
const evidence = evidenceByRef.get(ref);
|
|
184
|
+
invariantItems.push(invariantItem({
|
|
185
|
+
kind: 'evidence',
|
|
186
|
+
text: evidence?.content ?? `Evidence reference: ${ref}`,
|
|
187
|
+
sourceRefs: [ref],
|
|
188
|
+
taskEpoch,
|
|
189
|
+
status: evidence?.status ?? 'unknown',
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
if (capsule?.nextAction) {
|
|
193
|
+
invariantItems.push(invariantItem({
|
|
194
|
+
kind: 'next_action',
|
|
195
|
+
text: capsule.nextAction,
|
|
196
|
+
sourceRefs: ['harness:next-action'],
|
|
197
|
+
taskEpoch,
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
...summary,
|
|
202
|
+
taskEpoch,
|
|
203
|
+
objective: options.goalObjective ?? state?.rootObjective ?? contract?.objective ?? summary.objective,
|
|
204
|
+
activeInstruction: state?.activeInstruction ?? contract?.userIntent ?? summary.latestUserInstruction,
|
|
205
|
+
scope: contract
|
|
206
|
+
? {
|
|
207
|
+
cwd: contract.allowedScope.cwd,
|
|
208
|
+
files: contract.allowedScope.files ? [...contract.allowedScope.files] : undefined,
|
|
209
|
+
commands: contract.allowedScope.commands
|
|
210
|
+
? [...contract.allowedScope.commands]
|
|
211
|
+
: undefined,
|
|
212
|
+
}
|
|
213
|
+
: undefined,
|
|
214
|
+
nonGoals: uniqueStrings([
|
|
215
|
+
...(summary.nonGoals ?? []),
|
|
216
|
+
...(state?.nonGoals ?? contract?.nonGoals ?? []),
|
|
217
|
+
]),
|
|
218
|
+
openQuestions: uniqueStrings([
|
|
219
|
+
...(summary.openQuestions ?? []),
|
|
220
|
+
...(state?.openQuestions ?? contract?.openQuestions ?? []),
|
|
221
|
+
]),
|
|
222
|
+
criterionStates,
|
|
223
|
+
files: uniqueStrings([...summary.files, ...(capsule?.changedFiles ?? [])]),
|
|
224
|
+
changedFiles: uniqueStrings(capsule?.changedFiles ?? []),
|
|
225
|
+
successfulVerifications: uniqueStrings(capsule?.verification.passed ?? []),
|
|
226
|
+
failedVerifications: uniqueStrings(capsule?.verification.failed ?? []),
|
|
227
|
+
blockers: uniqueStrings([...summary.blockers, ...(capsule?.verification.warnings ?? [])]),
|
|
228
|
+
nextAction: capsule?.nextAction,
|
|
229
|
+
evidenceRefs: uniqueStrings([...summary.evidenceRefs, ...boundEvidenceRefs]),
|
|
230
|
+
items: [...invariantItems, ...summary.items.map(item => ({ ...item, taskEpoch }))],
|
|
231
|
+
verification: [
|
|
232
|
+
...invariantItems.filter(item => item.kind === 'evidence'),
|
|
233
|
+
...summary.verification.map(item => ({ ...item, taskEpoch })),
|
|
234
|
+
],
|
|
235
|
+
capability: capability
|
|
236
|
+
? {
|
|
237
|
+
revision: capability.revision,
|
|
238
|
+
fingerprint: capability.fingerprint,
|
|
239
|
+
modelId: capability.model.id,
|
|
240
|
+
permissionMode: capability.permission.mode,
|
|
241
|
+
tools: [...capability.tools],
|
|
242
|
+
}
|
|
243
|
+
: undefined,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function pinnedContextMessages(options) {
|
|
247
|
+
if (options.harnessState) {
|
|
248
|
+
return [
|
|
249
|
+
{
|
|
250
|
+
role: 'user',
|
|
251
|
+
content: (0, harness_1.renderHarnessStateForCompact)(options.harnessState, options.compactMode ?? 'manual'),
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
role: 'assistant',
|
|
255
|
+
content: 'I will continue from this Orion Code Context State and preserve its root objective, active instruction, constraints, and verification state.',
|
|
256
|
+
},
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
if (options.contextCapsule) {
|
|
260
|
+
return [
|
|
261
|
+
{ role: 'user', content: (0, harness_1.renderContextCapsule)(options.contextCapsule) },
|
|
262
|
+
{
|
|
263
|
+
role: 'assistant',
|
|
264
|
+
content: 'I will continue from this Context Capsule and preserve its open todos, constraints, and verification state.',
|
|
265
|
+
},
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
return [];
|
|
269
|
+
}
|
|
270
|
+
function stripSyntheticCompactMessages(messages) {
|
|
271
|
+
const priorSummary = [...messages]
|
|
55
272
|
.reverse()
|
|
56
|
-
.find(message => message.content?.startsWith(
|
|
57
|
-
const
|
|
273
|
+
.find(message => message.content?.startsWith(CONTEXT_SUMMARY_PREFIX));
|
|
274
|
+
const conversation = messages.filter(message => !message.content?.startsWith(CONTEXT_SUMMARY_PREFIX) &&
|
|
275
|
+
!(message.role === 'assistant' && message.content === SUMMARY_ACK) &&
|
|
276
|
+
!message.content?.startsWith('[Orion Code Context State v2]') &&
|
|
277
|
+
!message.content?.startsWith('## Context Capsule') &&
|
|
58
278
|
!(message.role === 'assistant' &&
|
|
59
|
-
message.content
|
|
60
|
-
'I
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
279
|
+
(message.content.startsWith('I will continue from this Orion Code Context State') ||
|
|
280
|
+
message.content.startsWith('I will continue from this Context Capsule'))));
|
|
281
|
+
return { priorSummary, conversation: cloneMessages(conversation) };
|
|
282
|
+
}
|
|
283
|
+
function withoutToolProtocol(messages) {
|
|
284
|
+
const callIds = new Set(messages.flatMap(message => message.tool_calls?.map(call => call.id) ?? []));
|
|
285
|
+
return messages
|
|
286
|
+
.filter(message => message.role !== 'tool' || !callIds.has(message.tool_call_id ?? ''))
|
|
287
|
+
.map(message => message.tool_calls?.length ? { ...message, tool_calls: undefined } : { ...message });
|
|
288
|
+
}
|
|
289
|
+
function emptyPlan(messages) {
|
|
290
|
+
return (0, planner_1.planCompactMessages)(messages, { maxMessages: messages.length });
|
|
291
|
+
}
|
|
292
|
+
function resultFromCandidate(candidate) {
|
|
293
|
+
return {
|
|
294
|
+
messages: cloneMessages(candidate.messages),
|
|
295
|
+
originalCount: candidate.originalCount,
|
|
296
|
+
compactedCount: candidate.messages.length,
|
|
297
|
+
ratio: candidate.originalCount === 0 ? 1 : candidate.messages.length / candidate.originalCount,
|
|
298
|
+
summary: candidate.summary,
|
|
299
|
+
summarySource: candidate.summarySource,
|
|
300
|
+
summaryGeneratedAt: candidate.summaryGeneratedAt,
|
|
301
|
+
semanticSummary: candidate.semanticSummary,
|
|
302
|
+
diagnostics: candidate.diagnostics.map(diagnostic => ({ ...diagnostic })),
|
|
303
|
+
fingerprint: candidate.fingerprint,
|
|
304
|
+
beforeTokens: candidate.beforeTokens,
|
|
305
|
+
afterTokens: candidate.afterTokens,
|
|
306
|
+
plan: candidate.plan,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/** Prepare a model-context projection without mutating or persisting its source. */
|
|
310
|
+
async function prepareCompactCandidate(messages, options = {}) {
|
|
311
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
312
|
+
const source = cloneMessages(messages);
|
|
313
|
+
const systemMessages = opts.keepSystemMessage
|
|
314
|
+
? source.filter(message => message.role === 'system')
|
|
315
|
+
: [];
|
|
316
|
+
const nonSystem = opts.keepSystemMessage
|
|
317
|
+
? source.filter(message => message.role !== 'system')
|
|
318
|
+
: source;
|
|
319
|
+
const { priorSummary, conversation } = stripSyntheticCompactMessages(nonSystem);
|
|
320
|
+
const pinned = pinnedContextMessages(opts);
|
|
321
|
+
const framingTokens = (0, token_estimate_1.estimateMessagesTokens)([
|
|
322
|
+
{ role: 'user', content: CONTEXT_SUMMARY_PREFIX },
|
|
323
|
+
{ role: 'assistant', content: SUMMARY_ACK },
|
|
324
|
+
]);
|
|
325
|
+
const plan = (0, planner_1.planCompactMessages)(conversation, {
|
|
326
|
+
maxMessages: opts.maxMessages,
|
|
327
|
+
safeInputBudget: opts.safeInputBudget,
|
|
328
|
+
targetRatio: opts.targetRatio ?? planner_1.DEFAULT_COMPACT_TARGET_RATIO,
|
|
329
|
+
fixedTokens: (0, token_estimate_1.estimateMessagesTokens)([...systemMessages, ...pinned]) + framingTokens,
|
|
330
|
+
summaryReserveTokens: opts.summaryReserveTokens,
|
|
331
|
+
});
|
|
332
|
+
const evictedMessages = (0, planner_1.flattenCompactGroups)(plan.evictedGroups);
|
|
333
|
+
const oldMessages = priorSummary ? [{ ...priorSummary }, ...evictedMessages] : evictedMessages;
|
|
334
|
+
let semanticSummary = (0, semantic_summary_1.extractCompactSummary)(plan.evictedGroups, {
|
|
335
|
+
taskEpoch: opts.harnessState?.taskEpoch ?? opts.harnessState?.contract?.taskEpoch,
|
|
336
|
+
});
|
|
337
|
+
semanticSummary = {
|
|
338
|
+
...semanticSummary,
|
|
339
|
+
requestedFocus: (0, summary_generator_1.normalizeCompactFocus)(opts.summaryOptions?.focus),
|
|
340
|
+
projectInstructions: (0, summary_generator_1.normalizeCompactInstructions)(opts.summaryOptions?.instructions),
|
|
341
|
+
};
|
|
342
|
+
semanticSummary = enrichSemanticSummary(semanticSummary, opts);
|
|
343
|
+
let summary = '';
|
|
344
|
+
let summarySource = 'heuristic';
|
|
345
|
+
let diagnostics = [];
|
|
346
|
+
if (plan.evictedGroups.length > 0) {
|
|
347
|
+
if (opts.llm) {
|
|
348
|
+
const generated = await (0, summary_generator_1.generateSummaryWithSource)(oldMessages, opts.llm, opts.summaryOptions);
|
|
349
|
+
summary = generated.text;
|
|
350
|
+
summarySource = generated.source;
|
|
351
|
+
diagnostics = generated.diagnostics;
|
|
352
|
+
if (generated.source === 'heuristic') {
|
|
353
|
+
const projectionBudget = Math.max(256, Math.min(opts.summaryOptions?.maxLength ?? 2000, plan.summaryReserveTokens * 3 || 2000));
|
|
354
|
+
summary = renderDeterministicSemanticSummary(semanticSummary, projectionBudget);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
const projectionBudget = Math.max(256, Math.min(opts.summaryOptions?.maxLength ?? 2000, plan.summaryReserveTokens * 3 || 2000));
|
|
359
|
+
summary = renderDeterministicSemanticSummary(semanticSummary, projectionBudget);
|
|
360
|
+
diagnostics = [
|
|
361
|
+
{
|
|
362
|
+
code: 'deterministic_projection',
|
|
363
|
+
message: 'Rendered the typed semantic snapshot without a summary provider.',
|
|
364
|
+
fallbackUsed: true,
|
|
365
|
+
},
|
|
366
|
+
];
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
else if (priorSummary) {
|
|
370
|
+
summary = priorSummary.content.slice(CONTEXT_SUMMARY_PREFIX.length);
|
|
371
|
+
}
|
|
372
|
+
const candidateMessages = [...systemMessages];
|
|
373
|
+
if (plan.evictedGroups.length > 0)
|
|
374
|
+
candidateMessages.push(...pinned);
|
|
375
|
+
if (summary) {
|
|
376
|
+
candidateMessages.push({ role: 'user', content: `${CONTEXT_SUMMARY_PREFIX}${summary}` }, { role: 'assistant', content: SUMMARY_ACK });
|
|
377
|
+
}
|
|
378
|
+
candidateMessages.push(...(0, planner_1.flattenCompactGroups)(plan.recentGroups));
|
|
379
|
+
const visibleMessages = opts.keepToolCalls
|
|
380
|
+
? candidateMessages
|
|
381
|
+
: withoutToolProtocol(candidateMessages);
|
|
382
|
+
return {
|
|
383
|
+
status: 'prepared',
|
|
384
|
+
messages: visibleMessages,
|
|
385
|
+
originalCount: source.length,
|
|
386
|
+
summary,
|
|
387
|
+
summarySource,
|
|
388
|
+
summaryGeneratedAt: Date.now(),
|
|
389
|
+
semanticSummary,
|
|
390
|
+
diagnostics,
|
|
391
|
+
fingerprint: (0, fingerprint_1.canonicalCompactCandidateFingerprint)({
|
|
392
|
+
messages: visibleMessages,
|
|
393
|
+
sourceBoundary: {
|
|
394
|
+
firstGroupId: semanticSummary.sourceBoundary?.firstGroupId,
|
|
395
|
+
lastGroupId: semanticSummary.sourceBoundary?.lastGroupId,
|
|
396
|
+
groupCount: semanticSummary.sourceBoundary?.groupCount ?? semanticSummary.coverage.groupCount,
|
|
397
|
+
messageCount: semanticSummary.sourceBoundary?.messageCount ?? semanticSummary.coverage.messageCount,
|
|
398
|
+
groupIds: semanticSummary.coverage.groupIds,
|
|
399
|
+
},
|
|
400
|
+
}),
|
|
401
|
+
beforeTokens: (0, token_estimate_1.estimateMessagesTokens)(source),
|
|
402
|
+
afterTokens: (0, token_estimate_1.estimateMessagesTokens)(visibleMessages),
|
|
403
|
+
plan,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
/** Validate semantic coverage, provider headroom, and tool protocol invariants. */
|
|
407
|
+
function validateCompactCandidate(candidate) {
|
|
408
|
+
const errors = [];
|
|
409
|
+
try {
|
|
410
|
+
(0, tool_call_groups_1.assertToolCallGroups)(candidate.messages);
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
errors.push({
|
|
414
|
+
code: 'tool_group_invalid',
|
|
415
|
+
message: error instanceof Error ? error.message : String(error),
|
|
86
416
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
417
|
+
}
|
|
418
|
+
if (candidate.plan.targetTokens !== undefined &&
|
|
419
|
+
candidate.afterTokens > candidate.plan.targetTokens) {
|
|
420
|
+
errors.push({
|
|
421
|
+
code: 'target_headroom_exceeded',
|
|
422
|
+
message: `Candidate uses ${candidate.afterTokens} tokens; target is ${candidate.plan.targetTokens}.`,
|
|
90
423
|
});
|
|
91
424
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
425
|
+
const expectedCoverage = candidate.plan.evictedGroups.map(group => group.id);
|
|
426
|
+
if (expectedCoverage.length !== candidate.semanticSummary.coverage.groupIds.length ||
|
|
427
|
+
expectedCoverage.some((groupId, index) => candidate.semanticSummary.coverage.groupIds[index] !== groupId)) {
|
|
428
|
+
errors.push({
|
|
429
|
+
code: 'evicted_coverage_mismatch',
|
|
430
|
+
message: 'Semantic summary does not cover every evicted atomic group in order.',
|
|
96
431
|
});
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
432
|
+
}
|
|
433
|
+
const summary = candidate.semanticSummary;
|
|
434
|
+
const expectedMessageCount = candidate.plan.evictedGroups.reduce((total, group) => total + group.messages.length, 0);
|
|
435
|
+
if (summary.sourceBoundary?.firstGroupId !== expectedCoverage[0] ||
|
|
436
|
+
summary.sourceBoundary?.lastGroupId !== expectedCoverage.at(-1) ||
|
|
437
|
+
summary.sourceBoundary?.groupCount !== expectedCoverage.length ||
|
|
438
|
+
summary.sourceBoundary?.messageCount !== expectedMessageCount) {
|
|
439
|
+
errors.push({
|
|
440
|
+
code: 'source_boundary_mismatch',
|
|
441
|
+
message: 'Semantic source boundary does not match the evicted atomic groups.',
|
|
100
442
|
});
|
|
101
443
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
444
|
+
const validKinds = new Set([
|
|
445
|
+
'system',
|
|
446
|
+
'contract',
|
|
447
|
+
'decision',
|
|
448
|
+
'evidence',
|
|
449
|
+
'tool_group',
|
|
450
|
+
'turn',
|
|
451
|
+
'next_action',
|
|
452
|
+
]);
|
|
453
|
+
const validPriorities = new Set(['must_keep', 'high', 'normal', 'evictable']);
|
|
454
|
+
const schemaInvalid = !Number.isSafeInteger(summary.taskEpoch) ||
|
|
455
|
+
summary.taskEpoch < 1 ||
|
|
456
|
+
summary.items.some(item => !item.id ||
|
|
457
|
+
!item.groupId ||
|
|
458
|
+
!validKinds.has(item.kind) ||
|
|
459
|
+
!validPriorities.has(item.priority) ||
|
|
460
|
+
!Array.isArray(item.sourceRefs) ||
|
|
461
|
+
item.sourceRefs.length === 0 ||
|
|
462
|
+
!Number.isSafeInteger(item.tokenEstimate) ||
|
|
463
|
+
item.tokenEstimate < 0);
|
|
464
|
+
if (schemaInvalid) {
|
|
465
|
+
errors.push({
|
|
466
|
+
code: 'semantic_schema_invalid',
|
|
467
|
+
message: 'Semantic ContextItems do not satisfy the typed schema.',
|
|
107
468
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
469
|
+
}
|
|
470
|
+
if (summary.items.some(item => item.taskEpoch !== summary.taskEpoch)) {
|
|
471
|
+
errors.push({
|
|
472
|
+
code: 'task_epoch_mismatch',
|
|
473
|
+
message: 'Semantic ContextItems are not bound to the current task epoch.',
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
const conversationItems = summary.items.filter(item => item.messageIndexes.start >= 0);
|
|
477
|
+
if (conversationItems.length !== expectedCoverage.length ||
|
|
478
|
+
expectedCoverage.some((groupId, index) => conversationItems[index]?.groupId !== groupId ||
|
|
479
|
+
!conversationItems[index]?.sourceRefs.includes(`group:${groupId}`))) {
|
|
480
|
+
errors.push({
|
|
481
|
+
code: 'semantic_reference_invalid',
|
|
482
|
+
message: 'Conversation ContextItems do not bind every evicted group in order.',
|
|
111
483
|
});
|
|
112
484
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
485
|
+
const criterionIds = new Set();
|
|
486
|
+
let semanticReferenceInvalid = false;
|
|
487
|
+
for (const criterion of summary.criterionStates ?? []) {
|
|
488
|
+
if (!criterion.id || criterionIds.has(criterion.id))
|
|
489
|
+
semanticReferenceInvalid = true;
|
|
490
|
+
criterionIds.add(criterion.id);
|
|
491
|
+
if (!summary.items.some(item => item.kind === 'contract' && item.sourceRefs.includes(criterion.id))) {
|
|
492
|
+
semanticReferenceInvalid = true;
|
|
493
|
+
}
|
|
494
|
+
for (const evidenceRef of criterion.evidenceRefs) {
|
|
495
|
+
if (!summary.evidenceRefs.includes(evidenceRef) ||
|
|
496
|
+
!summary.items.some(item => item.kind === 'evidence' && item.sourceRefs.includes(evidenceRef))) {
|
|
497
|
+
semanticReferenceInvalid = true;
|
|
120
498
|
}
|
|
121
|
-
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (semanticReferenceInvalid) {
|
|
502
|
+
errors.push({
|
|
503
|
+
code: 'semantic_reference_invalid',
|
|
504
|
+
message: 'Criterion or evidence references are missing, duplicated, or dangling.',
|
|
122
505
|
});
|
|
123
506
|
}
|
|
124
|
-
|
|
125
|
-
const ratio = compactedCount / originalCount;
|
|
126
|
-
return {
|
|
127
|
-
messages: compactedMessages,
|
|
128
|
-
originalCount,
|
|
129
|
-
compactedCount,
|
|
130
|
-
ratio,
|
|
131
|
-
summary,
|
|
132
|
-
summarySource: generated.source,
|
|
133
|
-
summaryGeneratedAt: Date.now(),
|
|
134
|
-
};
|
|
507
|
+
return { valid: errors.length === 0, errors };
|
|
135
508
|
}
|
|
136
509
|
/**
|
|
137
|
-
*
|
|
510
|
+
* Commit the prepared in-memory projection. This intentionally does not write a
|
|
511
|
+
* session checkpoint; the runtime/session owner must perform that transaction.
|
|
138
512
|
*/
|
|
139
|
-
function
|
|
140
|
-
const
|
|
141
|
-
|
|
513
|
+
function commitCompactCandidate(candidate) {
|
|
514
|
+
const validation = validateCompactCandidate(candidate);
|
|
515
|
+
if (!validation.valid)
|
|
516
|
+
throw new CompactCandidateValidationError(validation);
|
|
517
|
+
return resultFromCandidate(candidate);
|
|
142
518
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
519
|
+
async function compactMessages(messages, options = {}) {
|
|
520
|
+
const threshold = options.threshold ?? DEFAULT_OPTIONS.threshold;
|
|
521
|
+
if (messages.length <= threshold) {
|
|
522
|
+
const cloned = cloneMessages(messages);
|
|
523
|
+
const tokens = (0, token_estimate_1.estimateMessagesTokens)(cloned);
|
|
524
|
+
return {
|
|
525
|
+
messages,
|
|
526
|
+
originalCount: messages.length,
|
|
527
|
+
compactedCount: messages.length,
|
|
528
|
+
ratio: 1,
|
|
529
|
+
summary: '',
|
|
530
|
+
summarySource: 'heuristic',
|
|
531
|
+
summaryGeneratedAt: Date.now(),
|
|
532
|
+
semanticSummary: (0, semantic_summary_1.emptyCompactSummary)(),
|
|
533
|
+
diagnostics: [],
|
|
534
|
+
fingerprint: (0, fingerprint_1.canonicalMessagesFingerprint)(cloned),
|
|
535
|
+
beforeTokens: tokens,
|
|
536
|
+
afterTokens: tokens,
|
|
537
|
+
plan: emptyPlan(cloned),
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
return commitCompactCandidate(await prepareCompactCandidate(messages, options));
|
|
541
|
+
}
|
|
542
|
+
function needsCompact(messages, threshold) {
|
|
543
|
+
return messages.length > (threshold ?? DEFAULT_OPTIONS.threshold);
|
|
159
544
|
}
|
|
160
545
|
//# sourceMappingURL=compact.js.map
|