@orion-agents/orion-code 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +495 -0
- package/README.md +142 -314
- package/README.zh-CN.md +117 -559
- package/dist/cli.js +71 -90
- package/dist/cli.js.map +1 -1
- package/dist/commands/context-commands.d.ts.map +1 -1
- package/dist/commands/context-commands.js +14 -7
- package/dist/commands/context-commands.js.map +1 -1
- package/dist/commands/context-tool-command-handlers.d.ts +4 -5
- package/dist/commands/context-tool-command-handlers.d.ts.map +1 -1
- package/dist/commands/context-tool-command-handlers.js +174 -208
- package/dist/commands/context-tool-command-handlers.js.map +1 -1
- package/dist/commands/core-command-handlers.d.ts +3 -6
- package/dist/commands/core-command-handlers.d.ts.map +1 -1
- package/dist/commands/core-command-handlers.js +66 -664
- package/dist/commands/core-command-handlers.js.map +1 -1
- package/dist/commands/diagnostic-command-handlers.d.ts +1 -2
- package/dist/commands/diagnostic-command-handlers.d.ts.map +1 -1
- package/dist/commands/diagnostic-command-handlers.js +3 -17
- package/dist/commands/diagnostic-command-handlers.js.map +1 -1
- package/dist/commands/diagnostic-commands.d.ts.map +1 -1
- package/dist/commands/diagnostic-commands.js +0 -45
- package/dist/commands/diagnostic-commands.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -7
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/model-command-handlers.d.ts +2 -2
- package/dist/commands/model-command-handlers.d.ts.map +1 -1
- package/dist/commands/model-command-handlers.js +168 -3
- package/dist/commands/model-command-handlers.js.map +1 -1
- package/dist/commands/model-commands.d.ts.map +1 -1
- package/dist/commands/model-commands.js +0 -11
- package/dist/commands/model-commands.js.map +1 -1
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/registry.js +1 -139
- package/dist/commands/registry.js.map +1 -1
- package/dist/commands/session-command-handlers.d.ts.map +1 -1
- package/dist/commands/session-command-handlers.js +35 -119
- package/dist/commands/session-command-handlers.js.map +1 -1
- package/dist/commands/session-commands.d.ts.map +1 -1
- package/dist/commands/session-commands.js +2 -50
- package/dist/commands/session-commands.js.map +1 -1
- package/dist/commands/target-command.d.ts +9 -15
- package/dist/commands/target-command.d.ts.map +1 -1
- package/dist/commands/target-command.js +16 -130
- package/dist/commands/target-command.js.map +1 -1
- package/dist/commands/tool-commands.d.ts.map +1 -1
- package/dist/commands/tool-commands.js +0 -10
- package/dist/commands/tool-commands.js.map +1 -1
- package/dist/commands/types.d.ts +14 -14
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/commands/workflow-command-handlers.d.ts.map +1 -1
- package/dist/commands/workflow-command-handlers.js +1 -3
- package/dist/commands/workflow-command-handlers.js.map +1 -1
- package/dist/commands/workflow-commands.d.ts.map +1 -1
- package/dist/commands/workflow-commands.js +2 -24
- package/dist/commands/workflow-commands.js.map +1 -1
- package/dist/framework/agent-mode.d.ts +2 -3
- package/dist/framework/agent-mode.d.ts.map +1 -1
- package/dist/framework/agent-mode.js +8 -31
- package/dist/framework/agent-mode.js.map +1 -1
- package/dist/framework/index.d.ts +8 -6
- package/dist/framework/index.d.ts.map +1 -1
- package/dist/framework/index.js +14 -9
- package/dist/framework/index.js.map +1 -1
- package/dist/framework/loop-budget-contract.d.ts +20 -0
- package/dist/framework/loop-budget-contract.d.ts.map +1 -0
- package/dist/framework/loop-budget-contract.js +13 -0
- package/dist/framework/loop-budget-contract.js.map +1 -0
- package/dist/framework/prompt.d.ts.map +1 -1
- package/dist/framework/prompt.js +5 -4
- package/dist/framework/prompt.js.map +1 -1
- package/dist/framework/query.d.ts +71 -26
- package/dist/framework/query.d.ts.map +1 -1
- package/dist/framework/query.js +371 -102
- package/dist/framework/query.js.map +1 -1
- package/dist/framework/stop-decision.d.ts +56 -0
- package/dist/framework/stop-decision.d.ts.map +1 -0
- package/dist/framework/stop-decision.js +36 -0
- package/dist/framework/stop-decision.js.map +1 -0
- package/dist/framework/store.d.ts +4 -2
- package/dist/framework/store.d.ts.map +1 -1
- package/dist/framework/store.js +1 -0
- package/dist/framework/store.js.map +1 -1
- package/dist/framework/tool-call-orchestrator.d.ts +80 -0
- package/dist/framework/tool-call-orchestrator.d.ts.map +1 -0
- package/dist/framework/tool-call-orchestrator.js +192 -0
- package/dist/framework/tool-call-orchestrator.js.map +1 -0
- package/dist/framework/tool-state.d.ts +12 -11
- package/dist/framework/tool-state.d.ts.map +1 -1
- package/dist/framework/tool-state.js +36 -28
- package/dist/framework/tool-state.js.map +1 -1
- package/dist/framework/tool.d.ts +0 -9
- package/dist/framework/tool.d.ts.map +1 -1
- package/dist/framework/tool.js.map +1 -1
- package/dist/harness/assembler.d.ts.map +1 -1
- package/dist/harness/assembler.js +77 -19
- package/dist/harness/assembler.js.map +1 -1
- package/dist/harness/capability-profile.d.ts +3 -0
- package/dist/harness/capability-profile.d.ts.map +1 -0
- package/dist/harness/capability-profile.js +44 -0
- package/dist/harness/capability-profile.js.map +1 -0
- package/dist/harness/capsule.d.ts.map +1 -1
- package/dist/harness/capsule.js +22 -3
- package/dist/harness/capsule.js.map +1 -1
- package/dist/harness/compact-benchmark-corpus.d.ts +10 -0
- package/dist/harness/compact-benchmark-corpus.d.ts.map +1 -0
- package/dist/harness/compact-benchmark-corpus.js +56 -0
- package/dist/harness/compact-benchmark-corpus.js.map +1 -0
- package/dist/harness/context-harness.d.ts +23 -3
- package/dist/harness/context-harness.d.ts.map +1 -1
- package/dist/harness/context-harness.js +183 -11
- package/dist/harness/context-harness.js.map +1 -1
- package/dist/harness/contract.d.ts.map +1 -1
- package/dist/harness/contract.js +106 -11
- package/dist/harness/contract.js.map +1 -1
- package/dist/harness/drift-guard.d.ts +2 -1
- package/dist/harness/drift-guard.d.ts.map +1 -1
- package/dist/harness/drift-guard.js +315 -20
- package/dist/harness/drift-guard.js.map +1 -1
- package/dist/harness/evidence.d.ts.map +1 -1
- package/dist/harness/evidence.js +25 -12
- package/dist/harness/evidence.js.map +1 -1
- package/dist/harness/index.d.ts +7 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +19 -1
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/ledger.d.ts.map +1 -1
- package/dist/harness/ledger.js +44 -14
- package/dist/harness/ledger.js.map +1 -1
- package/dist/harness/progress-controller.d.ts +14 -0
- package/dist/harness/progress-controller.d.ts.map +1 -0
- package/dist/harness/progress-controller.js +110 -0
- package/dist/harness/progress-controller.js.map +1 -0
- package/dist/harness/state.d.ts.map +1 -1
- package/dist/harness/state.js +5 -2
- package/dist/harness/state.js.map +1 -1
- package/dist/harness/stop-controller.d.ts +15 -0
- package/dist/harness/stop-controller.d.ts.map +1 -0
- package/dist/harness/stop-controller.js +87 -0
- package/dist/harness/stop-controller.js.map +1 -0
- package/dist/harness/types.d.ts +137 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/verification.d.ts +7 -0
- package/dist/harness/verification.d.ts.map +1 -0
- package/dist/harness/verification.js +122 -0
- package/dist/harness/verification.js.map +1 -0
- package/dist/index.d.ts +70 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -59
- package/dist/index.js.map +1 -1
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +1 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/prompt-context.d.ts +42 -0
- package/dist/memory/prompt-context.d.ts.map +1 -0
- package/dist/memory/prompt-context.js +129 -0
- package/dist/memory/prompt-context.js.map +1 -0
- package/dist/print-ui/launch.d.ts.map +1 -1
- package/dist/print-ui/launch.js +9 -2
- package/dist/print-ui/launch.js.map +1 -1
- package/dist/product/paths.d.ts +7 -0
- package/dist/product/paths.d.ts.map +1 -1
- package/dist/product/paths.js +19 -0
- package/dist/product/paths.js.map +1 -1
- package/dist/runtime/agent-loop.d.ts +78 -0
- package/dist/runtime/agent-loop.d.ts.map +1 -0
- package/dist/runtime/agent-loop.js +418 -0
- package/dist/runtime/agent-loop.js.map +1 -0
- package/dist/runtime/agent-runtime-controller.d.ts +10 -57
- package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-controller.js +265 -1215
- package/dist/runtime/agent-runtime-controller.js.map +1 -1
- package/dist/runtime/agent-runtime-protocol.d.ts +4 -5
- package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
- package/dist/runtime/agent-runtime-protocol.js.map +1 -1
- package/dist/runtime/agent-runtime-runner.d.ts +34 -0
- package/dist/runtime/agent-runtime-runner.d.ts.map +1 -0
- package/dist/runtime/agent-runtime-runner.js +3 -0
- package/dist/runtime/agent-runtime-runner.js.map +1 -0
- package/dist/runtime/batch-read-service.d.ts +29 -0
- package/dist/runtime/batch-read-service.d.ts.map +1 -0
- package/dist/runtime/batch-read-service.js +212 -0
- package/dist/runtime/batch-read-service.js.map +1 -0
- package/dist/runtime/builtin-tool-provider.d.ts +30 -0
- package/dist/runtime/builtin-tool-provider.d.ts.map +1 -0
- package/dist/runtime/builtin-tool-provider.js +233 -0
- package/dist/runtime/builtin-tool-provider.js.map +1 -0
- package/dist/runtime/capabilities/compiler.d.ts +11 -0
- package/dist/runtime/capabilities/compiler.d.ts.map +1 -0
- package/dist/runtime/capabilities/compiler.js +719 -0
- package/dist/runtime/capabilities/compiler.js.map +1 -0
- package/dist/runtime/capabilities/index.d.ts +3 -0
- package/dist/runtime/capabilities/index.d.ts.map +1 -0
- package/dist/runtime/capabilities/index.js +9 -0
- package/dist/runtime/capabilities/index.js.map +1 -0
- package/dist/runtime/capabilities/types.d.ts +175 -0
- package/dist/runtime/capabilities/types.d.ts.map +1 -0
- package/dist/runtime/capabilities/types.js +3 -0
- package/dist/runtime/capabilities/types.js.map +1 -0
- package/dist/runtime/capability-receipt-journal.d.ts +29 -0
- package/dist/runtime/capability-receipt-journal.d.ts.map +1 -0
- package/dist/runtime/capability-receipt-journal.js +264 -0
- package/dist/runtime/capability-receipt-journal.js.map +1 -0
- package/dist/runtime/capability-step-factory.d.ts +73 -0
- package/dist/runtime/capability-step-factory.d.ts.map +1 -0
- package/dist/runtime/capability-step-factory.js +302 -0
- package/dist/runtime/capability-step-factory.js.map +1 -0
- package/dist/runtime/compact-transaction.d.ts +225 -0
- package/dist/runtime/compact-transaction.d.ts.map +1 -0
- package/dist/runtime/compact-transaction.js +622 -0
- package/dist/runtime/compact-transaction.js.map +1 -0
- package/dist/runtime/composer/buffer.d.ts +3 -4
- package/dist/runtime/composer/buffer.d.ts.map +1 -1
- package/dist/runtime/composer/buffer.js +3 -4
- package/dist/runtime/composer/buffer.js.map +1 -1
- package/dist/runtime/composer/grapheme.d.ts +2 -4
- package/dist/runtime/composer/grapheme.d.ts.map +1 -1
- package/dist/runtime/composer/grapheme.js +2 -4
- package/dist/runtime/composer/grapheme.js.map +1 -1
- package/dist/runtime/composer/layout.d.ts +1 -3
- package/dist/runtime/composer/layout.d.ts.map +1 -1
- package/dist/runtime/composer/layout.js +1 -3
- package/dist/runtime/composer/layout.js.map +1 -1
- package/dist/runtime/core-tools/descriptors.d.ts +17 -0
- package/dist/runtime/core-tools/descriptors.d.ts.map +1 -0
- package/dist/runtime/core-tools/descriptors.js +185 -0
- package/dist/runtime/core-tools/descriptors.js.map +1 -0
- package/dist/runtime/first-party-core-provider.d.ts +55 -0
- package/dist/runtime/first-party-core-provider.d.ts.map +1 -0
- package/dist/runtime/first-party-core-provider.js +197 -0
- package/dist/runtime/first-party-core-provider.js.map +1 -0
- package/dist/runtime/first-party-long-tail-provider.d.ts +57 -0
- package/dist/runtime/first-party-long-tail-provider.d.ts.map +1 -0
- package/dist/runtime/first-party-long-tail-provider.js +238 -0
- package/dist/runtime/first-party-long-tail-provider.js.map +1 -0
- package/dist/runtime/first-party-tool-services.d.ts +43 -0
- package/dist/runtime/first-party-tool-services.d.ts.map +1 -0
- package/dist/runtime/first-party-tool-services.js +200 -0
- package/dist/runtime/first-party-tool-services.js.map +1 -0
- package/dist/runtime/first-party-tool-universe.d.ts +14 -0
- package/dist/runtime/first-party-tool-universe.d.ts.map +1 -0
- package/dist/runtime/first-party-tool-universe.js +20 -0
- package/dist/runtime/first-party-tool-universe.js.map +1 -0
- package/dist/runtime/goal-lifecycle-v2.d.ts +63 -0
- package/dist/runtime/goal-lifecycle-v2.d.ts.map +1 -0
- package/dist/runtime/goal-lifecycle-v2.js +253 -0
- package/dist/runtime/goal-lifecycle-v2.js.map +1 -0
- package/dist/runtime/goal-runtime-coordinator.d.ts +105 -0
- package/dist/runtime/goal-runtime-coordinator.d.ts.map +1 -0
- package/dist/runtime/goal-runtime-coordinator.js +506 -0
- package/dist/runtime/goal-runtime-coordinator.js.map +1 -0
- package/dist/runtime/goals/types.d.ts +0 -1
- package/dist/runtime/goals/types.d.ts.map +1 -1
- package/dist/runtime/goals/types.js +0 -1
- package/dist/runtime/goals/types.js.map +1 -1
- package/dist/runtime/harness-confluence.d.ts +165 -0
- package/dist/runtime/harness-confluence.d.ts.map +1 -0
- package/dist/runtime/harness-confluence.js +807 -0
- package/dist/runtime/harness-confluence.js.map +1 -0
- package/dist/runtime/harness-eval.d.ts +96 -0
- package/dist/runtime/harness-eval.d.ts.map +1 -0
- package/dist/runtime/harness-eval.js +181 -0
- package/dist/runtime/harness-eval.js.map +1 -0
- package/dist/runtime/harness-metrics.d.ts +202 -0
- package/dist/runtime/harness-metrics.d.ts.map +1 -0
- package/dist/runtime/harness-metrics.js +415 -0
- package/dist/runtime/harness-metrics.js.map +1 -0
- package/dist/runtime/legacy-session-importer.d.ts +99 -0
- package/dist/runtime/legacy-session-importer.d.ts.map +1 -0
- package/dist/runtime/legacy-session-importer.js +455 -0
- package/dist/runtime/legacy-session-importer.js.map +1 -0
- package/dist/runtime/legacy-thread-materializer.d.ts +72 -0
- package/dist/runtime/legacy-thread-materializer.d.ts.map +1 -0
- package/dist/runtime/legacy-thread-materializer.js +553 -0
- package/dist/runtime/legacy-thread-materializer.js.map +1 -0
- package/dist/runtime/long-tail-tools/descriptors.d.ts +23 -0
- package/dist/runtime/long-tail-tools/descriptors.d.ts.map +1 -0
- package/dist/runtime/long-tail-tools/descriptors.js +423 -0
- package/dist/runtime/long-tail-tools/descriptors.js.map +1 -0
- package/dist/runtime/loop-budget.d.ts +1 -1
- package/dist/runtime/loop-budget.d.ts.map +1 -1
- package/dist/runtime/loop-budget.js +2 -2
- package/dist/runtime/loop-budget.js.map +1 -1
- package/dist/runtime/mcp/first-party-mcp-adapter.d.ts +75 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.d.ts.map +1 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.js +484 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.js.map +1 -0
- package/dist/runtime/mcp/first-party-mcp-config.d.ts +13 -0
- package/dist/runtime/mcp/first-party-mcp-config.d.ts.map +1 -0
- package/dist/runtime/mcp/first-party-mcp-config.js +139 -0
- package/dist/runtime/mcp/first-party-mcp-config.js.map +1 -0
- package/dist/runtime/mcp/index.d.ts +5 -0
- package/dist/runtime/mcp/index.d.ts.map +1 -0
- package/dist/{skills → runtime/mcp}/index.js +3 -9
- package/dist/runtime/mcp/index.js.map +1 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.d.ts +95 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.d.ts.map +1 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.js +854 -0
- package/dist/runtime/mcp/lazy-mcp-runtime.js.map +1 -0
- package/dist/runtime/mcp/types.d.ts +128 -0
- package/dist/runtime/mcp/types.d.ts.map +1 -0
- package/dist/runtime/mcp/types.js +5 -0
- package/dist/runtime/mcp/types.js.map +1 -0
- package/dist/runtime/model-coordinator.d.ts +44 -1
- package/dist/runtime/model-coordinator.d.ts.map +1 -1
- package/dist/runtime/model-coordinator.js +161 -19
- package/dist/runtime/model-coordinator.js.map +1 -1
- package/dist/runtime/orion-runtime-v1.d.ts +321 -0
- package/dist/runtime/orion-runtime-v1.d.ts.map +1 -0
- package/dist/runtime/orion-runtime-v1.js +958 -0
- package/dist/runtime/orion-runtime-v1.js.map +1 -0
- package/dist/runtime/orion-session-runner.d.ts +37 -0
- package/dist/runtime/orion-session-runner.d.ts.map +1 -0
- package/dist/runtime/orion-session-runner.js +146 -0
- package/dist/runtime/orion-session-runner.js.map +1 -0
- package/dist/runtime/product-orion-runtime.d.ts +35 -0
- package/dist/runtime/product-orion-runtime.d.ts.map +1 -0
- package/dist/runtime/product-orion-runtime.js +1019 -0
- package/dist/runtime/product-orion-runtime.js.map +1 -0
- package/dist/runtime/prompts/index.d.ts +3 -0
- package/dist/runtime/prompts/index.d.ts.map +1 -0
- package/dist/{ink-ui/types.js → runtime/prompts/index.js} +3 -2
- package/dist/runtime/prompts/index.js.map +1 -0
- package/dist/runtime/prompts/prompt-registry.d.ts +22 -0
- package/dist/runtime/prompts/prompt-registry.d.ts.map +1 -0
- package/dist/runtime/prompts/prompt-registry.js +356 -0
- package/dist/runtime/prompts/prompt-registry.js.map +1 -0
- package/dist/runtime/prompts/types.d.ts +111 -0
- package/dist/runtime/prompts/types.d.ts.map +1 -0
- package/dist/runtime/prompts/types.js +5 -0
- package/dist/runtime/prompts/types.js.map +1 -0
- package/dist/runtime/protocol/canonical.d.ts +3 -0
- package/dist/runtime/protocol/canonical.d.ts.map +1 -0
- package/dist/runtime/protocol/canonical.js +21 -0
- package/dist/runtime/protocol/canonical.js.map +1 -0
- package/dist/runtime/protocol/index.d.ts +4 -0
- package/dist/runtime/protocol/index.d.ts.map +1 -0
- package/dist/runtime/protocol/index.js +16 -0
- package/dist/runtime/protocol/index.js.map +1 -0
- package/dist/runtime/protocol/runtime-protocol-v1.d.ts +671 -0
- package/dist/runtime/protocol/runtime-protocol-v1.d.ts.map +1 -0
- package/dist/runtime/protocol/runtime-protocol-v1.js +557 -0
- package/dist/runtime/protocol/runtime-protocol-v1.js.map +1 -0
- package/dist/runtime/release-receipts.d.ts +109 -0
- package/dist/runtime/release-receipts.d.ts.map +1 -0
- package/dist/runtime/release-receipts.js +304 -0
- package/dist/runtime/release-receipts.js.map +1 -0
- package/dist/runtime/resource-scope.d.ts +123 -0
- package/dist/runtime/resource-scope.d.ts.map +1 -0
- package/dist/runtime/resource-scope.js +363 -0
- package/dist/runtime/resource-scope.js.map +1 -0
- package/dist/runtime/runtime-event-buffer.d.ts +78 -0
- package/dist/runtime/runtime-event-buffer.d.ts.map +1 -0
- package/dist/runtime/runtime-event-buffer.js +237 -0
- package/dist/runtime/runtime-event-buffer.js.map +1 -0
- package/dist/runtime/runtime-services.d.ts +87 -0
- package/dist/runtime/runtime-services.d.ts.map +1 -0
- package/dist/runtime/runtime-services.js +180 -0
- package/dist/runtime/runtime-services.js.map +1 -0
- package/dist/runtime/skills/bounded-lru-cache.d.ts +34 -0
- package/dist/runtime/skills/bounded-lru-cache.d.ts.map +1 -0
- package/dist/runtime/skills/bounded-lru-cache.js +100 -0
- package/dist/runtime/skills/bounded-lru-cache.js.map +1 -0
- package/dist/runtime/skills/filesystem-skill-provider.d.ts +96 -0
- package/dist/runtime/skills/filesystem-skill-provider.d.ts.map +1 -0
- package/dist/runtime/skills/filesystem-skill-provider.js +829 -0
- package/dist/runtime/skills/filesystem-skill-provider.js.map +1 -0
- package/dist/runtime/skills/index.d.ts +5 -0
- package/dist/runtime/skills/index.d.ts.map +1 -0
- package/dist/{ink-ui/controllers/chat-controller.js → runtime/skills/index.js} +5 -2
- package/dist/runtime/skills/index.js.map +1 -0
- package/dist/runtime/skills/lazy-skill-runtime.d.ts +77 -0
- package/dist/runtime/skills/lazy-skill-runtime.d.ts.map +1 -0
- package/dist/runtime/skills/lazy-skill-runtime.js +673 -0
- package/dist/runtime/skills/lazy-skill-runtime.js.map +1 -0
- package/dist/runtime/skills/types.d.ts +137 -0
- package/dist/runtime/skills/types.d.ts.map +1 -0
- package/dist/runtime/skills/types.js +13 -0
- package/dist/runtime/skills/types.js.map +1 -0
- package/dist/runtime/step-snapshot.d.ts +183 -0
- package/dist/runtime/step-snapshot.d.ts.map +1 -0
- package/dist/runtime/step-snapshot.js +286 -0
- package/dist/runtime/step-snapshot.js.map +1 -0
- package/dist/runtime/subagent-thread-runtime.d.ts +239 -0
- package/dist/runtime/subagent-thread-runtime.d.ts.map +1 -0
- package/dist/runtime/subagent-thread-runtime.js +876 -0
- package/dist/runtime/subagent-thread-runtime.js.map +1 -0
- package/dist/runtime/subagents/index.d.ts +5 -2
- package/dist/runtime/subagents/index.d.ts.map +1 -1
- package/dist/runtime/subagents/index.js +10 -2
- package/dist/runtime/subagents/index.js.map +1 -1
- package/dist/runtime/subagents/parent-step-fork.d.ts +36 -0
- package/dist/runtime/subagents/parent-step-fork.d.ts.map +1 -0
- package/dist/runtime/subagents/parent-step-fork.js +83 -0
- package/dist/runtime/subagents/parent-step-fork.js.map +1 -0
- package/dist/runtime/subagents/production.d.ts +65 -42
- package/dist/runtime/subagents/production.d.ts.map +1 -1
- package/dist/runtime/subagents/production.js +494 -151
- package/dist/runtime/subagents/production.js.map +1 -1
- package/dist/runtime/subagents/receipt-journal.d.ts +20 -0
- package/dist/runtime/subagents/receipt-journal.d.ts.map +1 -0
- package/dist/runtime/subagents/receipt-journal.js +74 -0
- package/dist/runtime/subagents/receipt-journal.js.map +1 -0
- package/dist/runtime/subagents/runner.d.ts +12 -1
- package/dist/runtime/subagents/runner.d.ts.map +1 -1
- package/dist/runtime/subagents/runner.js +62 -1
- package/dist/runtime/subagents/runner.js.map +1 -1
- package/dist/runtime/subagents/runtime-contract.d.ts +29 -0
- package/dist/runtime/subagents/runtime-contract.d.ts.map +1 -0
- package/dist/runtime/subagents/runtime-contract.js +3 -0
- package/dist/runtime/subagents/runtime-contract.js.map +1 -0
- package/dist/runtime/subagents/runtime-integration.d.ts +41 -56
- package/dist/runtime/subagents/runtime-integration.d.ts.map +1 -1
- package/dist/runtime/subagents/runtime-integration.js +34 -197
- package/dist/runtime/subagents/runtime-integration.js.map +1 -1
- package/dist/runtime/subagents/supervisor.d.ts +19 -7
- package/dist/runtime/subagents/supervisor.d.ts.map +1 -1
- package/dist/runtime/subagents/supervisor.js +88 -39
- package/dist/runtime/subagents/supervisor.js.map +1 -1
- package/dist/runtime/subagents/types.d.ts +5 -2
- package/dist/runtime/subagents/types.d.ts.map +1 -1
- package/dist/runtime/subagents/types.js +1 -1
- package/dist/runtime/subagents/types.js.map +1 -1
- package/dist/runtime/task-context-service.d.ts +91 -0
- package/dist/runtime/task-context-service.d.ts.map +1 -0
- package/dist/runtime/task-context-service.js +122 -0
- package/dist/runtime/task-context-service.js.map +1 -0
- package/dist/runtime/thread-admission.d.ts +130 -0
- package/dist/runtime/thread-admission.d.ts.map +1 -0
- package/dist/runtime/thread-admission.js +276 -0
- package/dist/runtime/thread-admission.js.map +1 -0
- package/dist/runtime/thread-compact-persistence.d.ts +50 -0
- package/dist/runtime/thread-compact-persistence.d.ts.map +1 -0
- package/dist/runtime/thread-compact-persistence.js +176 -0
- package/dist/runtime/thread-compact-persistence.js.map +1 -0
- package/dist/runtime/thread-event-store.d.ts +98 -0
- package/dist/runtime/thread-event-store.d.ts.map +1 -0
- package/dist/runtime/thread-event-store.js +737 -0
- package/dist/runtime/thread-event-store.js.map +1 -0
- package/dist/runtime/thread-projection.d.ts +91 -0
- package/dist/runtime/thread-projection.d.ts.map +1 -0
- package/dist/runtime/thread-projection.js +407 -0
- package/dist/runtime/thread-projection.js.map +1 -0
- package/dist/runtime/thread-runtime.d.ts +165 -0
- package/dist/runtime/thread-runtime.d.ts.map +1 -0
- package/dist/runtime/thread-runtime.js +704 -0
- package/dist/runtime/thread-runtime.js.map +1 -0
- package/dist/runtime/thread-tool-journal.d.ts +11 -0
- package/dist/runtime/thread-tool-journal.d.ts.map +1 -0
- package/dist/runtime/thread-tool-journal.js +131 -0
- package/dist/runtime/thread-tool-journal.js.map +1 -0
- package/dist/runtime/thread-ui-adapter.d.ts +85 -0
- package/dist/runtime/thread-ui-adapter.d.ts.map +1 -0
- package/dist/runtime/thread-ui-adapter.js +514 -0
- package/dist/runtime/thread-ui-adapter.js.map +1 -0
- package/dist/runtime/tool-gateway.d.ts +159 -0
- package/dist/runtime/tool-gateway.d.ts.map +1 -0
- package/dist/runtime/tool-gateway.js +311 -0
- package/dist/runtime/tool-gateway.js.map +1 -0
- package/dist/runtime/turn-commit.d.ts +103 -0
- package/dist/runtime/turn-commit.d.ts.map +1 -0
- package/dist/runtime/turn-commit.js +321 -0
- package/dist/runtime/turn-commit.js.map +1 -0
- package/dist/runtime/ui-events.d.ts +15 -5
- package/dist/runtime/ui-events.d.ts.map +1 -1
- package/dist/runtime/ui-events.js +0 -1
- package/dist/runtime/ui-events.js.map +1 -1
- package/dist/runtime/ui-view-model.d.ts +1 -1
- package/dist/runtime/ui-view-model.d.ts.map +1 -1
- package/dist/runtime/ui-view-model.js +3 -5
- package/dist/runtime/ui-view-model.js.map +1 -1
- package/dist/services/compact/auto-compact.d.ts +82 -2
- package/dist/services/compact/auto-compact.d.ts.map +1 -1
- package/dist/services/compact/auto-compact.js +226 -44
- package/dist/services/compact/auto-compact.js.map +1 -1
- package/dist/services/compact/compact.d.ts +54 -37
- package/dist/services/compact/compact.d.ts.map +1 -1
- package/dist/services/compact/compact.js +512 -127
- package/dist/services/compact/compact.js.map +1 -1
- package/dist/services/compact/coordinator.d.ts +5 -1
- package/dist/services/compact/coordinator.d.ts.map +1 -1
- package/dist/services/compact/coordinator.js +10 -1
- package/dist/services/compact/coordinator.js.map +1 -1
- package/dist/services/compact/fingerprint.d.ts +27 -0
- package/dist/services/compact/fingerprint.d.ts.map +1 -0
- package/dist/services/compact/fingerprint.js +69 -0
- package/dist/services/compact/fingerprint.js.map +1 -0
- package/dist/services/compact/index.d.ts +7 -5
- package/dist/services/compact/index.d.ts.map +1 -1
- package/dist/services/compact/index.js +19 -6
- package/dist/services/compact/index.js.map +1 -1
- package/dist/services/compact/planner.d.ts +41 -0
- package/dist/services/compact/planner.d.ts.map +1 -0
- package/dist/services/compact/planner.js +102 -0
- package/dist/services/compact/planner.js.map +1 -0
- package/dist/services/compact/semantic-summary.d.ts +93 -0
- package/dist/services/compact/semantic-summary.d.ts.map +1 -0
- package/dist/services/compact/semantic-summary.js +158 -0
- package/dist/services/compact/semantic-summary.js.map +1 -0
- package/dist/services/compact/summary-generator.d.ts +23 -0
- package/dist/services/compact/summary-generator.d.ts.map +1 -1
- package/dist/services/compact/summary-generator.js +173 -39
- package/dist/services/compact/summary-generator.js.map +1 -1
- package/dist/services/config-dir.d.ts +1 -1
- package/dist/services/config-dir.d.ts.map +1 -1
- package/dist/services/config-dir.js +2 -1
- package/dist/services/config-dir.js.map +1 -1
- package/dist/services/config.d.ts +2 -16
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +2 -29
- package/dist/services/config.js.map +1 -1
- package/dist/services/doctor.d.ts +0 -2
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +39 -64
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/file-context.d.ts.map +1 -1
- package/dist/services/file-context.js +29 -33
- package/dist/services/file-context.js.map +1 -1
- package/dist/services/global-config.d.ts +8 -2
- package/dist/services/global-config.d.ts.map +1 -1
- package/dist/services/global-config.js +8 -0
- package/dist/services/global-config.js.map +1 -1
- package/dist/services/llm.d.ts +3 -0
- package/dist/services/llm.d.ts.map +1 -1
- package/dist/services/llm.js +7 -0
- package/dist/services/llm.js.map +1 -1
- package/dist/services/project-instructions.d.ts.map +1 -1
- package/dist/services/project-instructions.js +10 -17
- package/dist/services/project-instructions.js.map +1 -1
- package/dist/services/safe-project-reader.d.ts +30 -0
- package/dist/services/safe-project-reader.d.ts.map +1 -0
- package/dist/services/safe-project-reader.js +141 -0
- package/dist/services/safe-project-reader.js.map +1 -0
- package/dist/services/session-storage.d.ts +134 -5
- package/dist/services/session-storage.d.ts.map +1 -1
- package/dist/services/session-storage.js +727 -57
- package/dist/services/session-storage.js.map +1 -1
- package/dist/services/usage-state.d.ts +7 -0
- package/dist/services/usage-state.d.ts.map +1 -1
- package/dist/services/usage-state.js +117 -16
- package/dist/services/usage-state.js.map +1 -1
- package/dist/skills/builtin/code-review/SKILL.md +51 -0
- package/dist/skills/builtin/security-check/SKILL.md +54 -0
- package/dist/skills/builtin/test-gen/SKILL.md +49 -0
- package/dist/terminal-ui/launch.d.ts +3 -1
- package/dist/terminal-ui/launch.d.ts.map +1 -1
- package/dist/terminal-ui/launch.js +19 -3
- package/dist/terminal-ui/launch.js.map +1 -1
- package/dist/tools/core/common.d.ts +34 -0
- package/dist/tools/core/common.d.ts.map +1 -0
- package/dist/tools/core/common.js +164 -0
- package/dist/tools/core/common.js.map +1 -0
- package/dist/tools/core/edit-file.d.ts +10 -0
- package/dist/tools/core/edit-file.d.ts.map +1 -0
- package/dist/tools/core/edit-file.js +301 -0
- package/dist/tools/core/edit-file.js.map +1 -0
- package/dist/tools/core/exec-command.d.ts +2 -0
- package/dist/tools/core/exec-command.d.ts.map +1 -0
- package/dist/tools/core/exec-command.js +347 -0
- package/dist/tools/core/exec-command.js.map +1 -0
- package/dist/tools/core/glob.d.ts +2 -0
- package/dist/tools/core/glob.d.ts.map +1 -0
- package/dist/tools/core/glob.js +133 -0
- package/dist/tools/core/glob.js.map +1 -0
- package/dist/tools/core/grep.d.ts +12 -0
- package/dist/tools/core/grep.d.ts.map +1 -0
- package/dist/tools/core/grep.js +223 -0
- package/dist/tools/core/grep.js.map +1 -0
- package/dist/tools/core/index.d.ts +15 -0
- package/dist/tools/core/index.d.ts.map +1 -0
- package/dist/tools/core/index.js +31 -0
- package/dist/tools/core/index.js.map +1 -0
- package/dist/tools/core/list-files.d.ts +2 -0
- package/dist/tools/core/list-files.d.ts.map +1 -0
- package/dist/tools/core/list-files.js +87 -0
- package/dist/tools/core/list-files.js.map +1 -0
- package/dist/tools/core/read-file.d.ts +2 -0
- package/dist/tools/core/read-file.d.ts.map +1 -0
- package/dist/tools/core/read-file.js +129 -0
- package/dist/tools/core/read-file.js.map +1 -0
- package/dist/tools/core/write-file.d.ts +2 -0
- package/dist/tools/core/write-file.d.ts.map +1 -0
- package/dist/tools/core/write-file.js +65 -0
- package/dist/tools/core/write-file.js.map +1 -0
- package/dist/tools/todo.d.ts +3 -4
- package/dist/tools/todo.d.ts.map +1 -1
- package/dist/tools/todo.js +80 -79
- package/dist/tools/todo.js.map +1 -1
- package/dist/tui-ui/chrome-view-model.js +1 -1
- package/dist/tui-ui/chrome-view-model.js.map +1 -1
- package/dist/tui-ui/layout.js +1 -1
- package/dist/tui-ui/layout.js.map +1 -1
- package/docs/migration/v0.1.9-to-v0.2.0.md +98 -0
- package/docs/orion.example.json +79 -0
- package/docs/plan/v0.2.0-dsh-harness-redesign-plan.md +1234 -0
- package/docs/plan/v0.2.0-release-checklist.md +91 -0
- package/docs/readme.md +27 -0
- package/npm-shrinkwrap.json +9 -438
- package/package.json +19 -11
- package/dist/agents/coder.d.ts +0 -12
- package/dist/agents/coder.d.ts.map +0 -1
- package/dist/agents/coder.js +0 -48
- package/dist/agents/coder.js.map +0 -1
- package/dist/agents/coordinator.d.ts +0 -86
- package/dist/agents/coordinator.d.ts.map +0 -1
- package/dist/agents/coordinator.js +0 -251
- package/dist/agents/coordinator.js.map +0 -1
- package/dist/agents/fork.d.ts +0 -69
- package/dist/agents/fork.d.ts.map +0 -1
- package/dist/agents/fork.js +0 -164
- package/dist/agents/fork.js.map +0 -1
- package/dist/agents/leader.d.ts +0 -12
- package/dist/agents/leader.d.ts.map +0 -1
- package/dist/agents/leader.js +0 -49
- package/dist/agents/leader.js.map +0 -1
- package/dist/agents/router.d.ts +0 -59
- package/dist/agents/router.d.ts.map +0 -1
- package/dist/agents/router.js +0 -193
- package/dist/agents/router.js.map +0 -1
- package/dist/agents/worker-pool.d.ts +0 -72
- package/dist/agents/worker-pool.d.ts.map +0 -1
- package/dist/agents/worker-pool.js +0 -224
- package/dist/agents/worker-pool.js.map +0 -1
- package/dist/commands/legacy-commands.d.ts +0 -4
- package/dist/commands/legacy-commands.d.ts.map +0 -1
- package/dist/commands/legacy-commands.js +0 -44
- package/dist/commands/legacy-commands.js.map +0 -1
- package/dist/core/agent.d.ts +0 -84
- package/dist/core/agent.d.ts.map +0 -1
- package/dist/core/agent.js +0 -58
- package/dist/core/agent.js.map +0 -1
- package/dist/core/brain.d.ts +0 -50
- package/dist/core/brain.d.ts.map +0 -1
- package/dist/core/brain.js +0 -95
- package/dist/core/brain.js.map +0 -1
- package/dist/framework/tool-scheduler.d.ts +0 -186
- package/dist/framework/tool-scheduler.d.ts.map +0 -1
- package/dist/framework/tool-scheduler.js +0 -558
- package/dist/framework/tool-scheduler.js.map +0 -1
- package/dist/harness/harness.d.ts +0 -58
- package/dist/harness/harness.d.ts.map +0 -1
- package/dist/harness/harness.js +0 -195
- package/dist/harness/harness.js.map +0 -1
- package/dist/harness/safety.d.ts +0 -101
- package/dist/harness/safety.d.ts.map +0 -1
- package/dist/harness/safety.js +0 -322
- package/dist/harness/safety.js.map +0 -1
- package/dist/init.d.ts +0 -108
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -393
- package/dist/init.js.map +0 -1
- package/dist/ink-ui/App.d.ts +0 -9
- package/dist/ink-ui/App.d.ts.map +0 -1
- package/dist/ink-ui/App.js +0 -12
- package/dist/ink-ui/App.js.map +0 -1
- package/dist/ink-ui/components/Markdown.d.ts +0 -10
- package/dist/ink-ui/components/Markdown.d.ts.map +0 -1
- package/dist/ink-ui/components/Markdown.js +0 -210
- package/dist/ink-ui/components/Markdown.js.map +0 -1
- package/dist/ink-ui/components/NativeCursor.d.ts +0 -12
- package/dist/ink-ui/components/NativeCursor.d.ts.map +0 -1
- package/dist/ink-ui/components/NativeCursor.js +0 -35
- package/dist/ink-ui/components/NativeCursor.js.map +0 -1
- package/dist/ink-ui/components/PixelHorseBanner.d.ts +0 -8
- package/dist/ink-ui/components/PixelHorseBanner.d.ts.map +0 -1
- package/dist/ink-ui/components/PixelHorseBanner.js +0 -97
- package/dist/ink-ui/components/PixelHorseBanner.js.map +0 -1
- package/dist/ink-ui/components/PromptInput.d.ts +0 -13
- package/dist/ink-ui/components/PromptInput.d.ts.map +0 -1
- package/dist/ink-ui/components/PromptInput.js +0 -30
- package/dist/ink-ui/components/PromptInput.js.map +0 -1
- package/dist/ink-ui/components/RunningHorseIndicator.d.ts +0 -13
- package/dist/ink-ui/components/RunningHorseIndicator.d.ts.map +0 -1
- package/dist/ink-ui/components/RunningHorseIndicator.js +0 -53
- package/dist/ink-ui/components/RunningHorseIndicator.js.map +0 -1
- package/dist/ink-ui/components/SelectList.d.ts +0 -16
- package/dist/ink-ui/components/SelectList.d.ts.map +0 -1
- package/dist/ink-ui/components/SelectList.js +0 -60
- package/dist/ink-ui/components/SelectList.js.map +0 -1
- package/dist/ink-ui/components/StatusLine.d.ts +0 -11
- package/dist/ink-ui/components/StatusLine.d.ts.map +0 -1
- package/dist/ink-ui/components/StatusLine.js +0 -70
- package/dist/ink-ui/components/StatusLine.js.map +0 -1
- package/dist/ink-ui/components/ToolActivity.d.ts +0 -19
- package/dist/ink-ui/components/ToolActivity.d.ts.map +0 -1
- package/dist/ink-ui/components/ToolActivity.js +0 -134
- package/dist/ink-ui/components/ToolActivity.js.map +0 -1
- package/dist/ink-ui/components/Transcript.d.ts +0 -14
- package/dist/ink-ui/components/Transcript.d.ts.map +0 -1
- package/dist/ink-ui/components/Transcript.js +0 -66
- package/dist/ink-ui/components/Transcript.js.map +0 -1
- package/dist/ink-ui/controllers/chat-controller.d.ts +0 -2
- package/dist/ink-ui/controllers/chat-controller.d.ts.map +0 -1
- package/dist/ink-ui/controllers/chat-controller.js.map +0 -1
- package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts +0 -6
- package/dist/ink-ui/hooks/use-raw-input-bridge.d.ts.map +0 -1
- package/dist/ink-ui/hooks/use-raw-input-bridge.js +0 -27
- package/dist/ink-ui/hooks/use-raw-input-bridge.js.map +0 -1
- package/dist/ink-ui/hooks/use-terminal-size.d.ts +0 -7
- package/dist/ink-ui/hooks/use-terminal-size.d.ts.map +0 -1
- package/dist/ink-ui/hooks/use-terminal-size.js +0 -34
- package/dist/ink-ui/hooks/use-terminal-size.js.map +0 -1
- package/dist/ink-ui/launch.d.ts +0 -9
- package/dist/ink-ui/launch.d.ts.map +0 -1
- package/dist/ink-ui/launch.js +0 -101
- package/dist/ink-ui/launch.js.map +0 -1
- package/dist/ink-ui/runtime/grapheme.d.ts +0 -10
- package/dist/ink-ui/runtime/grapheme.d.ts.map +0 -1
- package/dist/ink-ui/runtime/grapheme.js +0 -17
- package/dist/ink-ui/runtime/grapheme.js.map +0 -1
- package/dist/ink-ui/runtime/input-buffer.d.ts +0 -10
- package/dist/ink-ui/runtime/input-buffer.d.ts.map +0 -1
- package/dist/ink-ui/runtime/input-buffer.js +0 -18
- package/dist/ink-ui/runtime/input-buffer.js.map +0 -1
- package/dist/ink-ui/runtime/layout-budget.d.ts +0 -13
- package/dist/ink-ui/runtime/layout-budget.d.ts.map +0 -1
- package/dist/ink-ui/runtime/layout-budget.js +0 -25
- package/dist/ink-ui/runtime/layout-budget.js.map +0 -1
- package/dist/ink-ui/runtime/native-cursor.d.ts +0 -62
- package/dist/ink-ui/runtime/native-cursor.d.ts.map +0 -1
- package/dist/ink-ui/runtime/native-cursor.js +0 -398
- package/dist/ink-ui/runtime/native-cursor.js.map +0 -1
- package/dist/ink-ui/runtime/prompt-layout.d.ts +0 -10
- package/dist/ink-ui/runtime/prompt-layout.d.ts.map +0 -1
- package/dist/ink-ui/runtime/prompt-layout.js +0 -21
- package/dist/ink-ui/runtime/prompt-layout.js.map +0 -1
- package/dist/ink-ui/runtime/raw-input.d.ts +0 -4
- package/dist/ink-ui/runtime/raw-input.d.ts.map +0 -1
- package/dist/ink-ui/runtime/raw-input.js +0 -15
- package/dist/ink-ui/runtime/raw-input.js.map +0 -1
- package/dist/ink-ui/runtime/transcript-state.d.ts +0 -37
- package/dist/ink-ui/runtime/transcript-state.d.ts.map +0 -1
- package/dist/ink-ui/runtime/transcript-state.js +0 -91
- package/dist/ink-ui/runtime/transcript-state.js.map +0 -1
- package/dist/ink-ui/screens/ReplScreen.d.ts +0 -24
- package/dist/ink-ui/screens/ReplScreen.d.ts.map +0 -1
- package/dist/ink-ui/screens/ReplScreen.js +0 -756
- package/dist/ink-ui/screens/ReplScreen.js.map +0 -1
- package/dist/ink-ui/types.d.ts +0 -2
- package/dist/ink-ui/types.d.ts.map +0 -1
- package/dist/ink-ui/types.js.map +0 -1
- package/dist/runtime/chat-checkpoint.d.ts +0 -17
- package/dist/runtime/chat-checkpoint.d.ts.map +0 -1
- package/dist/runtime/chat-checkpoint.js +0 -105
- package/dist/runtime/chat-checkpoint.js.map +0 -1
- package/dist/runtime/chat-command-scope.d.ts +0 -5
- package/dist/runtime/chat-command-scope.d.ts.map +0 -1
- package/dist/runtime/chat-command-scope.js +0 -22
- package/dist/runtime/chat-command-scope.js.map +0 -1
- package/dist/runtime/chat-controller.d.ts +0 -62
- package/dist/runtime/chat-controller.d.ts.map +0 -1
- package/dist/runtime/chat-controller.js +0 -1630
- package/dist/runtime/chat-controller.js.map +0 -1
- package/dist/runtime/chat-effort.d.ts +0 -5
- package/dist/runtime/chat-effort.d.ts.map +0 -1
- package/dist/runtime/chat-effort.js +0 -47
- package/dist/runtime/chat-effort.js.map +0 -1
- package/dist/runtime/chat-presentation.d.ts +0 -63
- package/dist/runtime/chat-presentation.d.ts.map +0 -1
- package/dist/runtime/chat-presentation.js +0 -561
- package/dist/runtime/chat-presentation.js.map +0 -1
- package/dist/runtime/chat-trace.d.ts +0 -52
- package/dist/runtime/chat-trace.d.ts.map +0 -1
- package/dist/runtime/chat-trace.js +0 -234
- package/dist/runtime/chat-trace.js.map +0 -1
- package/dist/runtime/chat-workspace.d.ts +0 -22
- package/dist/runtime/chat-workspace.d.ts.map +0 -1
- package/dist/runtime/chat-workspace.js +0 -154
- package/dist/runtime/chat-workspace.js.map +0 -1
- package/dist/runtime/goals/accounting.d.ts +0 -45
- package/dist/runtime/goals/accounting.d.ts.map +0 -1
- package/dist/runtime/goals/accounting.js +0 -114
- package/dist/runtime/goals/accounting.js.map +0 -1
- package/dist/runtime/goals/coordinator.d.ts +0 -89
- package/dist/runtime/goals/coordinator.d.ts.map +0 -1
- package/dist/runtime/goals/coordinator.js +0 -1481
- package/dist/runtime/goals/coordinator.js.map +0 -1
- package/dist/runtime/goals/lifecycle.d.ts +0 -13
- package/dist/runtime/goals/lifecycle.d.ts.map +0 -1
- package/dist/runtime/goals/lifecycle.js +0 -46
- package/dist/runtime/goals/lifecycle.js.map +0 -1
- package/dist/runtime/goals/prompt.d.ts +0 -16
- package/dist/runtime/goals/prompt.d.ts.map +0 -1
- package/dist/runtime/goals/prompt.js +0 -88
- package/dist/runtime/goals/prompt.js.map +0 -1
- package/dist/runtime/goals/tools.d.ts +0 -61
- package/dist/runtime/goals/tools.d.ts.map +0 -1
- package/dist/runtime/goals/tools.js +0 -568
- package/dist/runtime/goals/tools.js.map +0 -1
- package/dist/sdk/index.d.ts +0 -10
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js +0 -23
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/init.d.ts +0 -24
- package/dist/sdk/init.d.ts.map +0 -1
- package/dist/sdk/init.js +0 -48
- package/dist/sdk/init.js.map +0 -1
- package/dist/sdk/query.d.ts +0 -19
- package/dist/sdk/query.d.ts.map +0 -1
- package/dist/sdk/query.js +0 -42
- package/dist/sdk/query.js.map +0 -1
- package/dist/sdk/sessions.d.ts +0 -19
- package/dist/sdk/sessions.d.ts.map +0 -1
- package/dist/sdk/sessions.js +0 -57
- package/dist/sdk/sessions.js.map +0 -1
- package/dist/sdk/types.d.ts +0 -47
- package/dist/sdk/types.d.ts.map +0 -1
- package/dist/sdk/types.js +0 -8
- package/dist/sdk/types.js.map +0 -1
- package/dist/services/agent-runner.d.ts +0 -71
- package/dist/services/agent-runner.d.ts.map +0 -1
- package/dist/services/agent-runner.js +0 -185
- package/dist/services/agent-runner.js.map +0 -1
- package/dist/services/compact/micro-compact.d.ts +0 -21
- package/dist/services/compact/micro-compact.d.ts.map +0 -1
- package/dist/services/compact/micro-compact.js +0 -99
- package/dist/services/compact/micro-compact.js.map +0 -1
- package/dist/services/task-manager.d.ts +0 -161
- package/dist/services/task-manager.d.ts.map +0 -1
- package/dist/services/task-manager.js +0 -315
- package/dist/services/task-manager.js.map +0 -1
- package/dist/skills/discovery.d.ts +0 -22
- package/dist/skills/discovery.d.ts.map +0 -1
- package/dist/skills/discovery.js +0 -75
- package/dist/skills/discovery.js.map +0 -1
- package/dist/skills/index.d.ts +0 -11
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/loader.d.ts +0 -53
- package/dist/skills/loader.d.ts.map +0 -1
- package/dist/skills/loader.js +0 -421
- package/dist/skills/loader.js.map +0 -1
- package/dist/skills/registry.d.ts +0 -41
- package/dist/skills/registry.d.ts.map +0 -1
- package/dist/skills/registry.js +0 -157
- package/dist/skills/registry.js.map +0 -1
- package/dist/skills/runtime.d.ts +0 -46
- package/dist/skills/runtime.d.ts.map +0 -1
- package/dist/skills/runtime.js +0 -364
- package/dist/skills/runtime.js.map +0 -1
- package/dist/skills/types.d.ts +0 -112
- package/dist/skills/types.d.ts.map +0 -1
- package/dist/skills/types.js +0 -24
- package/dist/skills/types.js.map +0 -1
- package/dist/tools/index.d.ts +0 -52
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -2268
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/mcp.d.ts +0 -99
- package/dist/tools/mcp.d.ts.map +0 -1
- package/dist/tools/mcp.js +0 -695
- package/dist/tools/mcp.js.map +0 -1
- package/dist/tools/plan.d.ts +0 -17
- package/dist/tools/plan.d.ts.map +0 -1
- package/dist/tools/plan.js +0 -84
- package/dist/tools/plan.js.map +0 -1
|
@@ -0,0 +1,807 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArchitectureConfluenceError = exports.DEFAULT_ARCHITECTURE_CONFLUENCE_RULES_V1 = exports.DEFAULT_RESOURCE_SCOPE_CHURN_CYCLES = exports.ARCHITECTURE_CONFLUENCE_RECEIPT_VERSION = void 0;
|
|
4
|
+
exports.runArchitectureConfluenceAuditV1 = runArchitectureConfluenceAuditV1;
|
|
5
|
+
exports.verifyArchitectureConfluenceReceiptV1 = verifyArchitectureConfluenceReceiptV1;
|
|
6
|
+
exports.runResourceScopeChurnV1 = runResourceScopeChurnV1;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const canonical_1 = require("./protocol/canonical");
|
|
10
|
+
const resource_scope_1 = require("./resource-scope");
|
|
11
|
+
exports.ARCHITECTURE_CONFLUENCE_RECEIPT_VERSION = 1;
|
|
12
|
+
exports.DEFAULT_RESOURCE_SCOPE_CHURN_CYCLES = 1000;
|
|
13
|
+
const DEFAULT_RULES = {
|
|
14
|
+
forbiddenImports: [
|
|
15
|
+
{
|
|
16
|
+
id: 'legacy-import',
|
|
17
|
+
description: 'Production code must not import a legacy runtime, agent, loop, or mock SDK.',
|
|
18
|
+
targetPatterns: [
|
|
19
|
+
'src/init.ts',
|
|
20
|
+
'src/agents/**',
|
|
21
|
+
'src/core/agent.ts',
|
|
22
|
+
'src/core/brain.ts',
|
|
23
|
+
'src/harness/harness.ts',
|
|
24
|
+
'src/harness/safety.ts',
|
|
25
|
+
'src/services/agent-runner.ts',
|
|
26
|
+
'src/sdk/**',
|
|
27
|
+
'src/runtime/chat-controller.ts',
|
|
28
|
+
'src/framework/tool-scheduler.ts',
|
|
29
|
+
'src/tools/index.ts',
|
|
30
|
+
'src/tools/mcp.ts',
|
|
31
|
+
'src/skills/index.ts',
|
|
32
|
+
'src/skills/loader.ts',
|
|
33
|
+
'src/skills/registry.ts',
|
|
34
|
+
'src/skills/runtime.ts',
|
|
35
|
+
'src/runtime/goals/accounting.ts',
|
|
36
|
+
'src/runtime/goals/coordinator.ts',
|
|
37
|
+
'src/runtime/goals/lifecycle.ts',
|
|
38
|
+
'src/runtime/goals/prompt.ts',
|
|
39
|
+
'src/runtime/goals/stop-policy.ts',
|
|
40
|
+
'src/runtime/goals/tools.ts',
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'direct-query-import',
|
|
45
|
+
description: 'Only AgentLoopV1 may bind the internal model-to-tool recursion function.',
|
|
46
|
+
targetPatterns: ['src/framework/query.ts'],
|
|
47
|
+
allowedFiles: ['src/runtime/agent-loop.ts'],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'global-tools-import',
|
|
51
|
+
description: 'Production code must receive a tool catalog instead of importing global TOOLS.',
|
|
52
|
+
targetPatterns: ['src/tools.ts', 'src/tools/index.ts'],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'direct-tool-scheduler-import',
|
|
56
|
+
description: 'Production effects must converge through ToolGateway instead of tool-scheduler.',
|
|
57
|
+
targetPatterns: ['src/framework/tool-scheduler.ts'],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
forbiddenExportSymbols: [
|
|
61
|
+
'Brain',
|
|
62
|
+
'BaseAgent',
|
|
63
|
+
'LeaderAgent',
|
|
64
|
+
'CoderAgent',
|
|
65
|
+
'init',
|
|
66
|
+
'Harness',
|
|
67
|
+
'MemorySystem',
|
|
68
|
+
'SafetyChecker',
|
|
69
|
+
'AgentRunner',
|
|
70
|
+
'HarnessEngine',
|
|
71
|
+
'query',
|
|
72
|
+
'simpleQuery',
|
|
73
|
+
'ContextHarness',
|
|
74
|
+
'HarnessKernel',
|
|
75
|
+
'createContextHarness',
|
|
76
|
+
'createHarnessKernel',
|
|
77
|
+
],
|
|
78
|
+
forbiddenSingletons: [
|
|
79
|
+
{
|
|
80
|
+
id: 'global-tool-catalog',
|
|
81
|
+
description: 'The tool catalog must be injected by the composition root.',
|
|
82
|
+
pattern: '\\bexport\\s+const\\s+TOOLS\\b|\\bexport\\s+function\\s+getRuntimeTools\\b',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'global-mcp-manager',
|
|
86
|
+
description: 'MCP lifecycle must be owned by the runtime resource scope.',
|
|
87
|
+
pattern: '\\bexport\\s+const\\s+mcpManager\\s*=\\s*new\\s+',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'global-agent-pool',
|
|
91
|
+
description: 'Agent coordinators and worker pools must not be process singletons.',
|
|
92
|
+
pattern: '\\blet\\s+default(?:Coordinator|Pool)\\b|\\bexport\\s+function\\s+get(?:Coordinator|WorkerPool)\\b',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'global-tool-state',
|
|
96
|
+
description: 'Mutable tool lifecycle state must be task/runtime scoped.',
|
|
97
|
+
pattern: '\\blet\\s+state\\s*:\\s*ToolState\\b|\\blet\\s+listeners\\s*:\\s*Array<\\(s:\\s*ToolState',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: 'global-sdk-config',
|
|
101
|
+
description: 'SDK configuration must not live in a process-global mutable slot.',
|
|
102
|
+
pattern: '\\blet\\s+globalConfig\\s*:\\s*SDKConfig',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
forbiddenTarballSourcePatterns: [
|
|
106
|
+
'src/init.ts',
|
|
107
|
+
'src/agents/**',
|
|
108
|
+
'src/core/agent.ts',
|
|
109
|
+
'src/core/brain.ts',
|
|
110
|
+
'src/harness/harness.ts',
|
|
111
|
+
'src/harness/safety.ts',
|
|
112
|
+
'src/services/agent-runner.ts',
|
|
113
|
+
'src/sdk/**',
|
|
114
|
+
'src/runtime/chat-controller.ts',
|
|
115
|
+
'src/framework/tool-scheduler.ts',
|
|
116
|
+
'src/tools/index.ts',
|
|
117
|
+
'src/tools/mcp.ts',
|
|
118
|
+
'src/skills/index.ts',
|
|
119
|
+
'src/skills/loader.ts',
|
|
120
|
+
'src/skills/registry.ts',
|
|
121
|
+
'src/skills/runtime.ts',
|
|
122
|
+
'src/runtime/goals/accounting.ts',
|
|
123
|
+
'src/runtime/goals/coordinator.ts',
|
|
124
|
+
'src/runtime/goals/lifecycle.ts',
|
|
125
|
+
'src/runtime/goals/prompt.ts',
|
|
126
|
+
'src/runtime/goals/stop-policy.ts',
|
|
127
|
+
'src/runtime/goals/tools.ts',
|
|
128
|
+
],
|
|
129
|
+
requiredOwners: [
|
|
130
|
+
{
|
|
131
|
+
kind: 'runtime',
|
|
132
|
+
symbol: 'OrionRuntimeV1',
|
|
133
|
+
file: 'src/runtime/orion-runtime-v1.ts',
|
|
134
|
+
competingFindingRuleIds: [
|
|
135
|
+
'legacy-import',
|
|
136
|
+
'forbidden-export:Brain',
|
|
137
|
+
'forbidden-export:Harness',
|
|
138
|
+
'forbidden-export:HarnessEngine',
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
kind: 'loop',
|
|
143
|
+
symbol: 'AgentLoopV1',
|
|
144
|
+
file: 'src/runtime/agent-loop.ts',
|
|
145
|
+
competingFindingRuleIds: [
|
|
146
|
+
'direct-query-import',
|
|
147
|
+
'forbidden-export:AgentRunner',
|
|
148
|
+
'forbidden-export:query',
|
|
149
|
+
'forbidden-export:simpleQuery',
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
kind: 'task_context',
|
|
154
|
+
symbol: 'TaskContextService',
|
|
155
|
+
file: 'src/runtime/task-context-service.ts',
|
|
156
|
+
competingFindingRuleIds: [
|
|
157
|
+
'forbidden-export:ContextHarness',
|
|
158
|
+
'forbidden-export:HarnessKernel',
|
|
159
|
+
'forbidden-export:createContextHarness',
|
|
160
|
+
'forbidden-export:createHarnessKernel',
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
exports.DEFAULT_ARCHITECTURE_CONFLUENCE_RULES_V1 = deepFreeze(cloneRules(DEFAULT_RULES));
|
|
166
|
+
/** Configuration or receipt corruption is an architecture gate error, never an implicit pass. */
|
|
167
|
+
class ArchitectureConfluenceError extends Error {
|
|
168
|
+
constructor(message) {
|
|
169
|
+
super(message);
|
|
170
|
+
this.name = 'ArchitectureConfluenceError';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.ArchitectureConfluenceError = ArchitectureConfluenceError;
|
|
174
|
+
/**
|
|
175
|
+
* Run the strict architecture audit and produce a digest-bound, machine-readable receipt.
|
|
176
|
+
* Architecture violations are represented as a NO_GO receipt; invalid input throws fail closed.
|
|
177
|
+
*/
|
|
178
|
+
async function runArchitectureConfluenceAuditV1(options) {
|
|
179
|
+
const repositoryRoot = (0, path_1.resolve)(options.repositoryRoot);
|
|
180
|
+
if (!(0, fs_1.existsSync)(repositoryRoot) || !(0, fs_1.statSync)(repositoryRoot).isDirectory()) {
|
|
181
|
+
throw new ArchitectureConfluenceError(`Repository root does not exist: ${repositoryRoot}`);
|
|
182
|
+
}
|
|
183
|
+
const config = resolveConfig(options.config);
|
|
184
|
+
const sourceFiles = readSourceFiles(repositoryRoot, config.sourceRoot);
|
|
185
|
+
const sourceByPath = new Map(sourceFiles.map(file => [file.path, file]));
|
|
186
|
+
const findings = [];
|
|
187
|
+
const missingEntrypoints = [];
|
|
188
|
+
for (const entrypoint of uniqueSorted([
|
|
189
|
+
...config.productionEntrypoints,
|
|
190
|
+
...config.publicExportEntrypoints,
|
|
191
|
+
])) {
|
|
192
|
+
if (sourceByPath.has(entrypoint))
|
|
193
|
+
continue;
|
|
194
|
+
missingEntrypoints.push(entrypoint);
|
|
195
|
+
findings.push(finding('missing-entrypoint', 'scan', entrypoint, 1, entrypoint, `Configured architecture entrypoint does not exist: ${entrypoint}`));
|
|
196
|
+
}
|
|
197
|
+
const reachableFiles = collectReachableFiles(repositoryRoot, config.productionEntrypoints, sourceByPath);
|
|
198
|
+
const importRecords = collectImportRecords(repositoryRoot, reachableFiles, sourceByPath);
|
|
199
|
+
findings.push(...findForbiddenImports(importRecords, config));
|
|
200
|
+
findings.push(...findForbiddenExports(sourceByPath, config));
|
|
201
|
+
findings.push(...findForbiddenSingletons(sourceFiles, config));
|
|
202
|
+
const tarball = scanTarballIntent(repositoryRoot, sourceFiles, config, findings);
|
|
203
|
+
const sortedPreOwnershipFindings = sortFindings(findings);
|
|
204
|
+
const owners = scanOwners(sourceFiles, reachableFiles, config, sortedPreOwnershipFindings);
|
|
205
|
+
for (const owner of owners.filter(candidate => candidate.status === 'fail')) {
|
|
206
|
+
findings.push(finding(`ownership:${owner.kind}`, 'ownership', owner.expectedFile, owner.declarations[0]?.line ?? 1, owner.expectedSymbol, owner.reason));
|
|
207
|
+
}
|
|
208
|
+
const resourceScope = await runResourceScopeChurnV1(config.scopeCycles);
|
|
209
|
+
if (resourceScope.status === 'fail') {
|
|
210
|
+
findings.push(finding('resource-scope-churn', 'resource_scope', 'src/runtime/resource-scope.ts', 1, `${resourceScope.cycles} cycles`, 'ResourceScope churn left a leak, teardown error, timeout, or LIFO violation.'));
|
|
211
|
+
}
|
|
212
|
+
const sortedFindings = deepFreeze(sortFindings(findings));
|
|
213
|
+
const counts = countFindings(sortedFindings);
|
|
214
|
+
const checks = buildChecks(owners, counts, resourceScope);
|
|
215
|
+
const decision = checks.every(check => check.status === 'pass')
|
|
216
|
+
? 'GO'
|
|
217
|
+
: 'NO_GO';
|
|
218
|
+
const scan = buildSourceScan(config, sourceFiles, reachableFiles, uniqueSorted(missingEntrypoints));
|
|
219
|
+
const generatedAt = options.clock?.() ?? Date.now();
|
|
220
|
+
if (!Number.isFinite(generatedAt) || generatedAt < 0) {
|
|
221
|
+
throw new ArchitectureConfluenceError('Receipt clock must return a finite non-negative number.');
|
|
222
|
+
}
|
|
223
|
+
const unsigned = {
|
|
224
|
+
version: exports.ARCHITECTURE_CONFLUENCE_RECEIPT_VERSION,
|
|
225
|
+
generatedAt,
|
|
226
|
+
repositoryRoot,
|
|
227
|
+
strict: config.strict,
|
|
228
|
+
configurationDigest: (0, canonical_1.digestRuntimeValue)(config),
|
|
229
|
+
scan,
|
|
230
|
+
owners,
|
|
231
|
+
tarball,
|
|
232
|
+
resourceScope,
|
|
233
|
+
counts,
|
|
234
|
+
findings: sortedFindings,
|
|
235
|
+
checks,
|
|
236
|
+
decision,
|
|
237
|
+
};
|
|
238
|
+
return deepFreeze({ ...unsigned, digest: (0, canonical_1.digestRuntimeValue)(unsigned) });
|
|
239
|
+
}
|
|
240
|
+
/** Verify the receipt digest and every derived decision/count field. */
|
|
241
|
+
function verifyArchitectureConfluenceReceiptV1(receipt) {
|
|
242
|
+
if (receipt.version !== exports.ARCHITECTURE_CONFLUENCE_RECEIPT_VERSION) {
|
|
243
|
+
throw new ArchitectureConfluenceError(`Unsupported receipt version: ${receipt.version}`);
|
|
244
|
+
}
|
|
245
|
+
const { digest, ...unsigned } = receipt;
|
|
246
|
+
if ((0, canonical_1.digestRuntimeValue)(unsigned) !== digest) {
|
|
247
|
+
throw new ArchitectureConfluenceError('Architecture confluence receipt digest mismatch.');
|
|
248
|
+
}
|
|
249
|
+
const expectedCounts = countFindings(receipt.findings);
|
|
250
|
+
if ((0, canonical_1.canonicalRuntimeJson)(expectedCounts) !== (0, canonical_1.canonicalRuntimeJson)(receipt.counts)) {
|
|
251
|
+
throw new ArchitectureConfluenceError('Architecture confluence receipt counts mismatch.');
|
|
252
|
+
}
|
|
253
|
+
const expectedDecision = receipt.checks.every(check => check.status === 'pass') ? 'GO' : 'NO_GO';
|
|
254
|
+
if (expectedDecision !== receipt.decision) {
|
|
255
|
+
throw new ArchitectureConfluenceError('Architecture confluence receipt decision mismatch.');
|
|
256
|
+
}
|
|
257
|
+
return receipt;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Prove bounded teardown under two different activation histories. Each cycle owns a fresh scope,
|
|
261
|
+
* two fake resources and one lease; closing must converge to the same empty state in LIFO order.
|
|
262
|
+
*/
|
|
263
|
+
async function runResourceScopeChurnV1(cycles = exports.DEFAULT_RESOURCE_SCOPE_CHURN_CYCLES) {
|
|
264
|
+
if (!Number.isSafeInteger(cycles) || cycles <= 0) {
|
|
265
|
+
throw new ArchitectureConfluenceError('ResourceScope churn cycles must be a positive integer.');
|
|
266
|
+
}
|
|
267
|
+
let resourcesActivated = 0;
|
|
268
|
+
let resourcesDisposed = 0;
|
|
269
|
+
let leasesAcquired = 0;
|
|
270
|
+
let leasesReleased = 0;
|
|
271
|
+
let leakedResources = 0;
|
|
272
|
+
let leakedLeases = 0;
|
|
273
|
+
let lifoViolations = 0;
|
|
274
|
+
let closeErrors = 0;
|
|
275
|
+
let timedOutCloses = 0;
|
|
276
|
+
const finalStateDigests = new Set();
|
|
277
|
+
for (let cycle = 0; cycle < cycles; cycle++) {
|
|
278
|
+
const scope = new resource_scope_1.ResourceScope({ id: `harness-confluence-${cycle}`, deadlineMs: 250 });
|
|
279
|
+
const activationOrder = cycle % 2 === 0 ? ['catalog', 'transport'] : ['transport', 'catalog'];
|
|
280
|
+
const disposalOrder = [];
|
|
281
|
+
for (const resourceId of activationOrder) {
|
|
282
|
+
scope.register(resourceId, () => {
|
|
283
|
+
resourcesDisposed++;
|
|
284
|
+
disposalOrder.push(resourceId);
|
|
285
|
+
});
|
|
286
|
+
resourcesActivated++;
|
|
287
|
+
}
|
|
288
|
+
const lease = scope.acquireLease(`cycle-${cycle}`);
|
|
289
|
+
leasesAcquired++;
|
|
290
|
+
lease.release();
|
|
291
|
+
leasesReleased++;
|
|
292
|
+
const report = await scope.close({ reason: 'confluence_churn', deadlineMs: 250 });
|
|
293
|
+
const expectedDisposalOrder = [...activationOrder].reverse();
|
|
294
|
+
if ((0, canonical_1.canonicalRuntimeJson)(disposalOrder) !== (0, canonical_1.canonicalRuntimeJson)(expectedDisposalOrder)) {
|
|
295
|
+
lifoViolations++;
|
|
296
|
+
}
|
|
297
|
+
if (report.errors.length > 0)
|
|
298
|
+
closeErrors += report.errors.length;
|
|
299
|
+
if (report.timedOut || report.leaseTimedOut)
|
|
300
|
+
timedOutCloses++;
|
|
301
|
+
leakedResources += scope.activeResourceCount;
|
|
302
|
+
leakedLeases += scope.activeLeaseCount;
|
|
303
|
+
finalStateDigests.add((0, canonical_1.digestRuntimeValue)({
|
|
304
|
+
state: scope.state,
|
|
305
|
+
activeResourceCount: scope.activeResourceCount,
|
|
306
|
+
activeLeaseCount: scope.activeLeaseCount,
|
|
307
|
+
signalAborted: scope.signal.aborted,
|
|
308
|
+
}));
|
|
309
|
+
}
|
|
310
|
+
const historyIndependent = finalStateDigests.size === 1;
|
|
311
|
+
const status = resourcesActivated === resourcesDisposed &&
|
|
312
|
+
leasesAcquired === leasesReleased &&
|
|
313
|
+
leakedResources === 0 &&
|
|
314
|
+
leakedLeases === 0 &&
|
|
315
|
+
lifoViolations === 0 &&
|
|
316
|
+
closeErrors === 0 &&
|
|
317
|
+
timedOutCloses === 0 &&
|
|
318
|
+
historyIndependent
|
|
319
|
+
? 'pass'
|
|
320
|
+
: 'fail';
|
|
321
|
+
const unsigned = {
|
|
322
|
+
cycles,
|
|
323
|
+
resourcesActivated,
|
|
324
|
+
resourcesDisposed,
|
|
325
|
+
leasesAcquired,
|
|
326
|
+
leasesReleased,
|
|
327
|
+
leakedResources,
|
|
328
|
+
leakedLeases,
|
|
329
|
+
lifoViolations,
|
|
330
|
+
closeErrors,
|
|
331
|
+
timedOutCloses,
|
|
332
|
+
historyIndependent,
|
|
333
|
+
status,
|
|
334
|
+
};
|
|
335
|
+
return deepFreeze({ ...unsigned, digest: (0, canonical_1.digestRuntimeValue)(unsigned) });
|
|
336
|
+
}
|
|
337
|
+
function resolveConfig(input = {}) {
|
|
338
|
+
const strict = input.strict ?? true;
|
|
339
|
+
const scopeCycles = input.scopeCycles ?? exports.DEFAULT_RESOURCE_SCOPE_CHURN_CYCLES;
|
|
340
|
+
if (!Number.isSafeInteger(scopeCycles) || scopeCycles <= 0) {
|
|
341
|
+
throw new ArchitectureConfluenceError('scopeCycles must be a positive integer.');
|
|
342
|
+
}
|
|
343
|
+
if (strict && scopeCycles < exports.DEFAULT_RESOURCE_SCOPE_CHURN_CYCLES) {
|
|
344
|
+
throw new ArchitectureConfluenceError(`Strict mode requires at least ${exports.DEFAULT_RESOURCE_SCOPE_CHURN_CYCLES} ResourceScope cycles.`);
|
|
345
|
+
}
|
|
346
|
+
const rules = input.rules ?? {};
|
|
347
|
+
const resolved = {
|
|
348
|
+
strict,
|
|
349
|
+
sourceRoot: normalizeRepositoryPath(input.sourceRoot ?? 'src'),
|
|
350
|
+
productionEntrypoints: normalizePathList(input.productionEntrypoints ?? ['src/cli.ts', 'src/index.ts']),
|
|
351
|
+
publicExportEntrypoints: normalizePathList(input.publicExportEntrypoints ?? ['src/index.ts']),
|
|
352
|
+
scopeCycles,
|
|
353
|
+
rules: {
|
|
354
|
+
forbiddenImports: cloneArray(rules.forbiddenImports ?? DEFAULT_RULES.forbiddenImports),
|
|
355
|
+
forbiddenExportSymbols: uniqueSorted(rules.forbiddenExportSymbols ?? DEFAULT_RULES.forbiddenExportSymbols),
|
|
356
|
+
forbiddenSingletons: cloneArray(rules.forbiddenSingletons ?? DEFAULT_RULES.forbiddenSingletons),
|
|
357
|
+
forbiddenTarballSourcePatterns: uniqueSorted(rules.forbiddenTarballSourcePatterns ?? DEFAULT_RULES.forbiddenTarballSourcePatterns),
|
|
358
|
+
requiredOwners: cloneArray(rules.requiredOwners ?? DEFAULT_RULES.requiredOwners),
|
|
359
|
+
},
|
|
360
|
+
allow: {
|
|
361
|
+
imports: uniqueSorted(input.allow?.imports ?? []),
|
|
362
|
+
exports: uniqueSorted(input.allow?.exports ?? []),
|
|
363
|
+
singletons: uniqueSorted(input.allow?.singletons ?? []),
|
|
364
|
+
tarballEntries: uniqueSorted(input.allow?.tarballEntries ?? []),
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
validateResolvedConfig(resolved);
|
|
368
|
+
return deepFreeze(resolved);
|
|
369
|
+
}
|
|
370
|
+
function validateResolvedConfig(config) {
|
|
371
|
+
const ruleIds = [
|
|
372
|
+
...config.rules.forbiddenImports.map(rule => rule.id),
|
|
373
|
+
...config.rules.forbiddenSingletons.map(rule => rule.id),
|
|
374
|
+
];
|
|
375
|
+
if (new Set(ruleIds).size !== ruleIds.length) {
|
|
376
|
+
throw new ArchitectureConfluenceError('Architecture rule ids must be unique.');
|
|
377
|
+
}
|
|
378
|
+
for (const rule of config.rules.forbiddenSingletons) {
|
|
379
|
+
try {
|
|
380
|
+
new RegExp(rule.pattern, 'm');
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
throw new ArchitectureConfluenceError(`Invalid singleton rule ${rule.id}: ${errorMessage(error)}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const ownerKinds = config.rules.requiredOwners.map(owner => owner.kind);
|
|
387
|
+
if (new Set(ownerKinds).size !== ownerKinds.length) {
|
|
388
|
+
throw new ArchitectureConfluenceError('Each architecture owner kind must be declared once.');
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
function readSourceFiles(repositoryRoot, sourceRoot) {
|
|
392
|
+
const absoluteSourceRoot = (0, path_1.resolve)(repositoryRoot, sourceRoot);
|
|
393
|
+
if (!(0, fs_1.existsSync)(absoluteSourceRoot) || !(0, fs_1.statSync)(absoluteSourceRoot).isDirectory()) {
|
|
394
|
+
throw new ArchitectureConfluenceError(`Source root does not exist: ${sourceRoot}`);
|
|
395
|
+
}
|
|
396
|
+
const files = [];
|
|
397
|
+
const visit = (directory) => {
|
|
398
|
+
for (const entry of (0, fs_1.readdirSync)(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
|
|
399
|
+
const absolute = (0, path_1.resolve)(directory, entry.name);
|
|
400
|
+
if (entry.isDirectory()) {
|
|
401
|
+
visit(absolute);
|
|
402
|
+
}
|
|
403
|
+
else if (entry.isFile() && /\.(?:ts|tsx)$/.test(entry.name)) {
|
|
404
|
+
files.push({
|
|
405
|
+
path: toRepositoryPath(repositoryRoot, absolute),
|
|
406
|
+
content: (0, fs_1.readFileSync)(absolute, 'utf8'),
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
visit(absoluteSourceRoot);
|
|
412
|
+
return files.sort((left, right) => left.path.localeCompare(right.path));
|
|
413
|
+
}
|
|
414
|
+
function collectReachableFiles(repositoryRoot, entrypoints, sourceByPath) {
|
|
415
|
+
const reachable = new Set();
|
|
416
|
+
const queue = [...entrypoints.filter(entrypoint => sourceByPath.has(entrypoint))];
|
|
417
|
+
while (queue.length > 0) {
|
|
418
|
+
const current = queue.shift();
|
|
419
|
+
if (!current || reachable.has(current))
|
|
420
|
+
continue;
|
|
421
|
+
reachable.add(current);
|
|
422
|
+
const source = sourceByPath.get(current);
|
|
423
|
+
if (!source)
|
|
424
|
+
continue;
|
|
425
|
+
for (const record of extractImportRecords(repositoryRoot, source)) {
|
|
426
|
+
if (record.target && sourceByPath.has(record.target) && !reachable.has(record.target)) {
|
|
427
|
+
queue.push(record.target);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return uniqueSorted(reachable);
|
|
432
|
+
}
|
|
433
|
+
function collectImportRecords(repositoryRoot, reachableFiles, sourceByPath) {
|
|
434
|
+
return reachableFiles.flatMap(file => {
|
|
435
|
+
const source = sourceByPath.get(file);
|
|
436
|
+
return source ? extractImportRecords(repositoryRoot, source) : [];
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function extractImportRecords(repositoryRoot, source) {
|
|
440
|
+
const records = [];
|
|
441
|
+
const expressions = [
|
|
442
|
+
{
|
|
443
|
+
expression: /\b(?:import|export)\s+(type\s+)?[^;'"`]*?\s+from\s*['"]([^'"]+)['"]/g,
|
|
444
|
+
specifierGroup: 2,
|
|
445
|
+
typeOnlyGroup: 1,
|
|
446
|
+
},
|
|
447
|
+
{ expression: /\bimport\s*['"]([^'"]+)['"]/g, specifierGroup: 1 },
|
|
448
|
+
{ expression: /\brequire\(\s*['"]([^'"]+)['"]\s*\)/g, specifierGroup: 1 },
|
|
449
|
+
{ expression: /\bimport\(\s*['"]([^'"]+)['"]\s*\)/g, specifierGroup: 1 },
|
|
450
|
+
];
|
|
451
|
+
const seen = new Set();
|
|
452
|
+
for (const parser of expressions) {
|
|
453
|
+
for (const match of source.content.matchAll(parser.expression)) {
|
|
454
|
+
const specifier = match[parser.specifierGroup];
|
|
455
|
+
const index = (match.index ?? 0) + match[0].lastIndexOf(specifier);
|
|
456
|
+
const key = `${index}:${specifier}`;
|
|
457
|
+
if (seen.has(key))
|
|
458
|
+
continue;
|
|
459
|
+
seen.add(key);
|
|
460
|
+
records.push({
|
|
461
|
+
file: source.path,
|
|
462
|
+
line: lineNumberAt(source.content, index),
|
|
463
|
+
specifier,
|
|
464
|
+
typeOnly: parser.typeOnlyGroup !== undefined && match[parser.typeOnlyGroup] !== undefined,
|
|
465
|
+
target: resolveTypeScriptImport(repositoryRoot, source.path, specifier),
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return records.sort((left, right) => left.file.localeCompare(right.file) || left.line - right.line);
|
|
470
|
+
}
|
|
471
|
+
function resolveTypeScriptImport(repositoryRoot, importer, specifier) {
|
|
472
|
+
if (!specifier.startsWith('.'))
|
|
473
|
+
return undefined;
|
|
474
|
+
const base = (0, path_1.resolve)(repositoryRoot, (0, path_1.dirname)(importer), specifier);
|
|
475
|
+
const candidates = /\.(?:ts|tsx|js)$/.test(base)
|
|
476
|
+
? [base.replace(/\.js$/, '.ts'), base.replace(/\.js$/, '.tsx')]
|
|
477
|
+
: [base, `${base}.ts`, `${base}.tsx`, (0, path_1.resolve)(base, 'index.ts'), (0, path_1.resolve)(base, 'index.tsx')];
|
|
478
|
+
const target = candidates.find(candidate => (0, fs_1.existsSync)(candidate) && (0, fs_1.statSync)(candidate).isFile());
|
|
479
|
+
return target ? toRepositoryPath(repositoryRoot, target) : undefined;
|
|
480
|
+
}
|
|
481
|
+
function findForbiddenImports(records, config) {
|
|
482
|
+
const findings = [];
|
|
483
|
+
for (const record of records) {
|
|
484
|
+
if (!record.target || record.typeOnly)
|
|
485
|
+
continue;
|
|
486
|
+
for (const rule of config.rules.forbiddenImports) {
|
|
487
|
+
if (!rule.targetPatterns.some(pattern => matchesPathPattern(record.target, pattern)))
|
|
488
|
+
continue;
|
|
489
|
+
if (rule.allowedFiles?.some(pattern => matchesPathPattern(record.file, pattern)))
|
|
490
|
+
continue;
|
|
491
|
+
const keys = [
|
|
492
|
+
record.file,
|
|
493
|
+
`${rule.id}:${record.file}`,
|
|
494
|
+
`${rule.id}:${record.file}:${record.target}`,
|
|
495
|
+
];
|
|
496
|
+
if (keys.some(key => config.allow.imports.includes(key)))
|
|
497
|
+
continue;
|
|
498
|
+
findings.push(finding(rule.id, 'import', record.file, record.line, record.specifier, `${rule.description} Resolved target: ${record.target}.`));
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return findings;
|
|
502
|
+
}
|
|
503
|
+
function findForbiddenExports(sourceByPath, config) {
|
|
504
|
+
const findings = [];
|
|
505
|
+
for (const path of config.publicExportEntrypoints) {
|
|
506
|
+
const source = sourceByPath.get(path);
|
|
507
|
+
if (!source)
|
|
508
|
+
continue;
|
|
509
|
+
const exported = extractExports(source.content);
|
|
510
|
+
for (const symbol of config.rules.forbiddenExportSymbols) {
|
|
511
|
+
const match = exported.find(candidate => candidate.symbol === symbol);
|
|
512
|
+
if (!match)
|
|
513
|
+
continue;
|
|
514
|
+
if (config.allow.exports.includes(symbol) ||
|
|
515
|
+
config.allow.exports.includes(`${path}:${symbol}`)) {
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
findings.push(finding(`forbidden-export:${symbol}`, 'export', path, match.line, symbol, `Legacy symbol ${symbol} remains reachable from a public export entrypoint.`));
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return findings;
|
|
522
|
+
}
|
|
523
|
+
function extractExports(content) {
|
|
524
|
+
const exports = [];
|
|
525
|
+
const blocks = /\bexport\s+(?:type\s+)?\{([\s\S]*?)\}(?:\s+from\s*['"][^'"]+['"])?/g;
|
|
526
|
+
for (const block of content.matchAll(blocks)) {
|
|
527
|
+
const body = block[1];
|
|
528
|
+
const bodyOffset = (block.index ?? 0) + block[0].indexOf(body);
|
|
529
|
+
for (const rawPart of body.split(',')) {
|
|
530
|
+
const part = rawPart.trim();
|
|
531
|
+
if (!part)
|
|
532
|
+
continue;
|
|
533
|
+
const names = part.split(/\s+as\s+/).map(name => name.trim());
|
|
534
|
+
const symbol = names[names.length - 1];
|
|
535
|
+
const localOffset = body.indexOf(rawPart) + rawPart.indexOf(symbol);
|
|
536
|
+
exports.push({ symbol, line: lineNumberAt(content, bodyOffset + localOffset) });
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
const declarations = /\bexport\s+(?:default\s+)?(?:abstract\s+)?(?:class|function|const|let|var|interface|type|enum)\s+([A-Za-z_$][\w$]*)/g;
|
|
540
|
+
for (const declaration of content.matchAll(declarations)) {
|
|
541
|
+
exports.push({
|
|
542
|
+
symbol: declaration[1],
|
|
543
|
+
line: lineNumberAt(content, (declaration.index ?? 0) + declaration[0].lastIndexOf(declaration[1])),
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
return exports;
|
|
547
|
+
}
|
|
548
|
+
function findForbiddenSingletons(sourceFiles, config) {
|
|
549
|
+
const findings = [];
|
|
550
|
+
for (const source of sourceFiles) {
|
|
551
|
+
for (const rule of config.rules.forbiddenSingletons) {
|
|
552
|
+
if (rule.allowedFiles?.some(pattern => matchesPathPattern(source.path, pattern)))
|
|
553
|
+
continue;
|
|
554
|
+
const match = new RegExp(rule.pattern, 'm').exec(source.content);
|
|
555
|
+
if (!match)
|
|
556
|
+
continue;
|
|
557
|
+
const keys = [source.path, `${rule.id}:${source.path}`];
|
|
558
|
+
if (keys.some(key => config.allow.singletons.includes(key)))
|
|
559
|
+
continue;
|
|
560
|
+
findings.push(finding(rule.id, 'singleton', source.path, lineNumberAt(source.content, match.index), match[0], rule.description));
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return findings;
|
|
564
|
+
}
|
|
565
|
+
function scanTarballIntent(repositoryRoot, sourceFiles, config, findings) {
|
|
566
|
+
const packageJson = readJsonObject(repositoryRoot, 'package.json', findings);
|
|
567
|
+
const tsconfig = readJsonObject(repositoryRoot, 'tsconfig.json', findings);
|
|
568
|
+
const packageFiles = toStringArray(packageJson?.files);
|
|
569
|
+
const compilerIncludes = toStringArray(tsconfig?.include);
|
|
570
|
+
const compilerExcludes = toStringArray(tsconfig?.exclude);
|
|
571
|
+
const main = typeof packageJson?.main === 'string' ? packageJson.main : '';
|
|
572
|
+
const distIncluded = packageFiles.length === 0
|
|
573
|
+
? main.startsWith('dist/')
|
|
574
|
+
: packageFiles.some(pattern => /^(?:\.\/)?dist(?:\/|\/\*\*?|$)/.test(pattern));
|
|
575
|
+
const isCompiledSource = (source) => compilerIncludes.some(pattern => matchesPathPattern(source.path, normalizeRepositoryPath(pattern))) &&
|
|
576
|
+
!compilerExcludes.some(pattern => matchesPathPattern(source.path, normalizeRepositoryPath(pattern)));
|
|
577
|
+
const sourceCompilationEnabled = sourceFiles.some(isCompiledSource);
|
|
578
|
+
const forbiddenEntries = distIncluded && sourceCompilationEnabled
|
|
579
|
+
? uniqueSorted(sourceFiles
|
|
580
|
+
.filter(isCompiledSource)
|
|
581
|
+
.filter(source => config.rules.forbiddenTarballSourcePatterns.some(pattern => matchesPathPattern(source.path, pattern)))
|
|
582
|
+
.map(source => source.path.replace(/^src\//, 'dist/').replace(/\.tsx?$/, '.js'))
|
|
583
|
+
.filter(entry => !config.allow.tarballEntries.includes(entry)))
|
|
584
|
+
: [];
|
|
585
|
+
for (const entry of forbiddenEntries) {
|
|
586
|
+
findings.push(finding('legacy-tarball-entry', 'tarball', 'package.json', 1, entry, `Build/package intent includes forbidden legacy entry ${entry}.`));
|
|
587
|
+
}
|
|
588
|
+
const unsigned = {
|
|
589
|
+
packageFiles: uniqueSorted(packageFiles),
|
|
590
|
+
compilerIncludes: uniqueSorted(compilerIncludes),
|
|
591
|
+
compilerExcludes: uniqueSorted(compilerExcludes),
|
|
592
|
+
distIncluded,
|
|
593
|
+
sourceCompilationEnabled,
|
|
594
|
+
forbiddenEntries,
|
|
595
|
+
};
|
|
596
|
+
return deepFreeze({ ...unsigned, digest: (0, canonical_1.digestRuntimeValue)(unsigned) });
|
|
597
|
+
}
|
|
598
|
+
function readJsonObject(repositoryRoot, path, findings) {
|
|
599
|
+
const absolute = (0, path_1.resolve)(repositoryRoot, path);
|
|
600
|
+
try {
|
|
601
|
+
const value = JSON.parse((0, fs_1.readFileSync)(absolute, 'utf8'));
|
|
602
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
603
|
+
throw new Error('not an object');
|
|
604
|
+
return value;
|
|
605
|
+
}
|
|
606
|
+
catch (error) {
|
|
607
|
+
findings.push(finding('invalid-package-intent', 'scan', path, 1, path, `Unable to read architecture package intent: ${errorMessage(error)}`));
|
|
608
|
+
return undefined;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function scanOwners(sourceFiles, reachableFiles, config, findings) {
|
|
612
|
+
const reachable = new Set(reachableFiles);
|
|
613
|
+
return deepFreeze(config.rules.requiredOwners.map(owner => {
|
|
614
|
+
const expression = new RegExp(`^\\s*export\\s+(?:abstract\\s+)?(?:class|interface|function|const|type)\\s+${escapeRegExp(owner.symbol)}\\b`, 'gm');
|
|
615
|
+
const declarations = sourceFiles.flatMap(source => [...source.content.matchAll(expression)].map(match => ({
|
|
616
|
+
file: source.path,
|
|
617
|
+
line: lineNumberAt(source.content, match.index ?? 0),
|
|
618
|
+
})));
|
|
619
|
+
const referenceExpression = new RegExp(`\\b${escapeRegExp(owner.symbol)}\\b`, 'g');
|
|
620
|
+
const productionReferences = sourceFiles
|
|
621
|
+
.filter(source => reachable.has(source.path) && source.path !== owner.file)
|
|
622
|
+
.flatMap(source => {
|
|
623
|
+
const match = referenceExpression.exec(source.content);
|
|
624
|
+
referenceExpression.lastIndex = 0;
|
|
625
|
+
return match
|
|
626
|
+
? [{ file: source.path, line: lineNumberAt(source.content, match.index) }]
|
|
627
|
+
: [];
|
|
628
|
+
});
|
|
629
|
+
const competingFindingRuleIds = uniqueSorted(findings
|
|
630
|
+
.filter(candidate => owner.competingFindingRuleIds.includes(candidate.ruleId))
|
|
631
|
+
.map(candidate => candidate.ruleId));
|
|
632
|
+
const declarationIsUnique = declarations.length === 1 && declarations[0].file === owner.file;
|
|
633
|
+
const isProductionOwned = productionReferences.length > 0;
|
|
634
|
+
const status = declarationIsUnique && isProductionOwned && competingFindingRuleIds.length === 0
|
|
635
|
+
? 'pass'
|
|
636
|
+
: 'fail';
|
|
637
|
+
const reasons = [];
|
|
638
|
+
if (!declarationIsUnique) {
|
|
639
|
+
reasons.push(`expected exactly one ${owner.symbol} declaration at ${owner.file}, observed ${declarations.length}`);
|
|
640
|
+
}
|
|
641
|
+
if (!isProductionOwned)
|
|
642
|
+
reasons.push('owner is not referenced by the production entrypoint graph');
|
|
643
|
+
if (competingFindingRuleIds.length > 0) {
|
|
644
|
+
reasons.push(`competing paths remain: ${competingFindingRuleIds.join(', ')}`);
|
|
645
|
+
}
|
|
646
|
+
return deepFreeze({
|
|
647
|
+
kind: owner.kind,
|
|
648
|
+
expectedSymbol: owner.symbol,
|
|
649
|
+
expectedFile: owner.file,
|
|
650
|
+
declarations,
|
|
651
|
+
productionReferences,
|
|
652
|
+
competingFindingRuleIds,
|
|
653
|
+
status,
|
|
654
|
+
reason: reasons.length > 0 ? reasons.join('; ') : 'single production owner confirmed',
|
|
655
|
+
});
|
|
656
|
+
}));
|
|
657
|
+
}
|
|
658
|
+
function buildSourceScan(config, sourceFiles, reachableFiles, missingEntrypoints) {
|
|
659
|
+
const fileDigests = sourceFiles.map(source => ({
|
|
660
|
+
file: source.path,
|
|
661
|
+
digest: (0, canonical_1.digestRuntimeValue)(source.content),
|
|
662
|
+
}));
|
|
663
|
+
return deepFreeze({
|
|
664
|
+
sourceRoot: config.sourceRoot,
|
|
665
|
+
productionEntrypoints: config.productionEntrypoints,
|
|
666
|
+
publicExportEntrypoints: config.publicExportEntrypoints,
|
|
667
|
+
allSourceFiles: sourceFiles.map(source => source.path),
|
|
668
|
+
reachableProductionFiles: reachableFiles,
|
|
669
|
+
missingEntrypoints,
|
|
670
|
+
sourceDigest: (0, canonical_1.digestRuntimeValue)(fileDigests),
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
function buildChecks(owners, counts, resourceScope) {
|
|
674
|
+
const checks = owners.map(owner => ({
|
|
675
|
+
id: `ownership.${owner.kind}`,
|
|
676
|
+
category: 'ownership',
|
|
677
|
+
status: owner.status,
|
|
678
|
+
expected: `one production ${owner.expectedSymbol} owner and no competitor`,
|
|
679
|
+
observed: owner.reason,
|
|
680
|
+
}));
|
|
681
|
+
checks.push(countCheck('legacy.imports', 'import', counts.forbiddenImports), countCheck('legacy.exports', 'export', counts.forbiddenExports), countCheck('global.singletons', 'singleton', counts.forbiddenSingletons), countCheck('legacy.tarball_entries', 'tarball', counts.forbiddenTarballEntries), countCheck('scan.integrity', 'scan', counts.scanErrors), {
|
|
682
|
+
id: 'resource_scope.churn',
|
|
683
|
+
category: 'resource_scope',
|
|
684
|
+
status: resourceScope.status,
|
|
685
|
+
expected: `${resourceScope.cycles} cycles, zero leaks/errors/timeouts/LIFO violations`,
|
|
686
|
+
observed: `${resourceScope.leakedResources} resource leaks, ${resourceScope.leakedLeases} lease leaks, ${resourceScope.closeErrors} close errors, ${resourceScope.lifoViolations} LIFO violations`,
|
|
687
|
+
});
|
|
688
|
+
return deepFreeze(checks);
|
|
689
|
+
}
|
|
690
|
+
function countCheck(id, category, count) {
|
|
691
|
+
return {
|
|
692
|
+
id,
|
|
693
|
+
category,
|
|
694
|
+
status: count === 0 ? 'pass' : 'fail',
|
|
695
|
+
expected: '0 violations',
|
|
696
|
+
observed: `${count} violations`,
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
function countFindings(findings) {
|
|
700
|
+
return deepFreeze({
|
|
701
|
+
findings: findings.length,
|
|
702
|
+
forbiddenImports: findings.filter(candidate => candidate.category === 'import').length,
|
|
703
|
+
forbiddenExports: findings.filter(candidate => candidate.category === 'export').length,
|
|
704
|
+
forbiddenSingletons: findings.filter(candidate => candidate.category === 'singleton').length,
|
|
705
|
+
forbiddenTarballEntries: findings.filter(candidate => candidate.category === 'tarball').length,
|
|
706
|
+
scanErrors: findings.filter(candidate => candidate.category === 'scan').length,
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
function finding(ruleId, category, file, line, match, message) {
|
|
710
|
+
return deepFreeze({
|
|
711
|
+
ruleId,
|
|
712
|
+
category,
|
|
713
|
+
severity: 'error',
|
|
714
|
+
file: normalizeRepositoryPath(file),
|
|
715
|
+
line: Math.max(1, line),
|
|
716
|
+
match: compactMatch(match),
|
|
717
|
+
message,
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
function sortFindings(findings) {
|
|
721
|
+
const unique = new Map();
|
|
722
|
+
for (const candidate of findings) {
|
|
723
|
+
const key = `${candidate.ruleId}:${candidate.file}:${candidate.line}:${candidate.match}`;
|
|
724
|
+
unique.set(key, candidate);
|
|
725
|
+
}
|
|
726
|
+
return [...unique.values()].sort((left, right) => left.category.localeCompare(right.category) ||
|
|
727
|
+
left.ruleId.localeCompare(right.ruleId) ||
|
|
728
|
+
left.file.localeCompare(right.file) ||
|
|
729
|
+
left.line - right.line ||
|
|
730
|
+
left.match.localeCompare(right.match));
|
|
731
|
+
}
|
|
732
|
+
function cloneRules(rules) {
|
|
733
|
+
return {
|
|
734
|
+
forbiddenImports: cloneArray(rules.forbiddenImports),
|
|
735
|
+
forbiddenExportSymbols: [...rules.forbiddenExportSymbols],
|
|
736
|
+
forbiddenSingletons: cloneArray(rules.forbiddenSingletons),
|
|
737
|
+
forbiddenTarballSourcePatterns: [...rules.forbiddenTarballSourcePatterns],
|
|
738
|
+
requiredOwners: cloneArray(rules.requiredOwners),
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
function cloneArray(values) {
|
|
742
|
+
return values.map(value => (value && typeof value === 'object' ? { ...value } : value));
|
|
743
|
+
}
|
|
744
|
+
function normalizePathList(paths) {
|
|
745
|
+
return uniqueSorted(paths.map(normalizeRepositoryPath));
|
|
746
|
+
}
|
|
747
|
+
function uniqueSorted(values) {
|
|
748
|
+
return [...new Set(values)].sort((left, right) => left.localeCompare(right));
|
|
749
|
+
}
|
|
750
|
+
function toStringArray(value) {
|
|
751
|
+
return Array.isArray(value)
|
|
752
|
+
? value.filter((entry) => typeof entry === 'string')
|
|
753
|
+
: [];
|
|
754
|
+
}
|
|
755
|
+
function toRepositoryPath(repositoryRoot, absolutePath) {
|
|
756
|
+
return normalizeRepositoryPath((0, path_1.relative)(repositoryRoot, absolutePath));
|
|
757
|
+
}
|
|
758
|
+
function normalizeRepositoryPath(path) {
|
|
759
|
+
return path.split(path_1.sep).join('/').replace(/^\.\//, '').replace(/\/$/, '');
|
|
760
|
+
}
|
|
761
|
+
function matchesPathPattern(path, pattern) {
|
|
762
|
+
return globToRegExp(normalizeRepositoryPath(pattern)).test(normalizeRepositoryPath(path));
|
|
763
|
+
}
|
|
764
|
+
function globToRegExp(pattern) {
|
|
765
|
+
let source = '^';
|
|
766
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
767
|
+
const character = pattern[index];
|
|
768
|
+
if (character === '*' && pattern[index + 1] === '*') {
|
|
769
|
+
if (pattern[index + 2] === '/') {
|
|
770
|
+
source += '(?:.*/)?';
|
|
771
|
+
index += 2;
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
source += '.*';
|
|
775
|
+
index++;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
else if (character === '*') {
|
|
779
|
+
source += '[^/]*';
|
|
780
|
+
}
|
|
781
|
+
else {
|
|
782
|
+
source += escapeRegExp(character);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return new RegExp(`${source}$`);
|
|
786
|
+
}
|
|
787
|
+
function lineNumberAt(content, index) {
|
|
788
|
+
return content.slice(0, Math.max(0, index)).split('\n').length;
|
|
789
|
+
}
|
|
790
|
+
function escapeRegExp(value) {
|
|
791
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
792
|
+
}
|
|
793
|
+
function compactMatch(value) {
|
|
794
|
+
const normalized = value.replace(/\s+/g, ' ').trim();
|
|
795
|
+
return normalized.length <= 160 ? normalized : `${normalized.slice(0, 157)}...`;
|
|
796
|
+
}
|
|
797
|
+
function errorMessage(error) {
|
|
798
|
+
return error instanceof Error ? error.message : String(error);
|
|
799
|
+
}
|
|
800
|
+
function deepFreeze(value) {
|
|
801
|
+
if (value === null || typeof value !== 'object' || Object.isFrozen(value))
|
|
802
|
+
return value;
|
|
803
|
+
for (const nested of Object.values(value))
|
|
804
|
+
deepFreeze(nested);
|
|
805
|
+
return Object.freeze(value);
|
|
806
|
+
}
|
|
807
|
+
//# sourceMappingURL=harness-confluence.js.map
|