devcontour-harness 0.0.0-stage → 0.1.0-alpha.12
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/LICENSE +21 -0
- package/README.md +268 -2
- package/docs/architecture.md +496 -0
- package/docs/compatibility-versions.md +60 -0
- package/docs/compatibility.md +192 -0
- package/docs/connectors.md +323 -0
- package/docs/contracts.md +630 -0
- package/docs/integrations/hindsight.md +148 -0
- package/docs/quickstart.md +185 -0
- package/docs/release-notes/0.1.0-alpha.10.md +50 -0
- package/docs/release-notes/0.1.0-alpha.11.md +44 -0
- package/docs/release-notes/0.1.0-alpha.12.md +66 -0
- package/docs/release-notes/0.1.0-alpha.6.md +238 -0
- package/docs/release-notes/0.1.0-alpha.7.md +71 -0
- package/docs/release-notes/0.1.0-alpha.8.md +73 -0
- package/docs/release-notes/0.1.0-alpha.9.md +55 -0
- package/docs/review-probes.md +199 -0
- package/docs/review-protocol.md +251 -0
- package/docs/standalone.md +271 -0
- package/docs/toolchains.md +167 -0
- package/docs/turbo-starter.md +269 -0
- package/docs/upgrade.md +219 -0
- package/examples/README.md +27 -0
- package/examples/external-connector/README.md +19 -0
- package/examples/external-connector/connector.mjs +55 -0
- package/examples/files-only/README.md +28 -0
- package/examples/files-only/context/norms/rules.md +4 -0
- package/examples/files-only/graph.json +23 -0
- package/examples/files-only/policy.json +30 -0
- package/examples/one-vendor/README.md +19 -0
- package/examples/one-vendor/policy.json +27 -0
- package/examples/single-task/README.md +18 -0
- package/examples/single-task/graph.json +27 -0
- package/examples/single-task/policy-same-vendor.json +55 -0
- package/examples/single-task/policy.json +52 -0
- package/examples/single-task/src/.gitkeep +0 -0
- package/examples/single-task/test/run.js +19 -0
- package/examples/toolchains/README.md +32 -0
- package/examples/toolchains/go/bad/label/label.go +9 -0
- package/examples/toolchains/go/good/label/label.go +9 -0
- package/examples/toolchains/go/policy.json +79 -0
- package/examples/toolchains/go/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/go/repo/_gitignore +1 -0
- package/examples/toolchains/go/repo/go.mod +5 -0
- package/examples/toolchains/go/repo/go.sum +2 -0
- package/examples/toolchains/go/repo/label/label.go +9 -0
- package/examples/toolchains/go/repo/label/label_test.go +27 -0
- package/examples/toolchains/go/repo/label/version.go +9 -0
- package/examples/toolchains/go/task.json +25 -0
- package/examples/toolchains/mixed-go/bad/backend/label/label.go +9 -0
- package/examples/toolchains/mixed-go/bad/frontend/src/label.js +4 -0
- package/examples/toolchains/mixed-go/good/backend/label/label.go +9 -0
- package/examples/toolchains/mixed-go/good/frontend/src/label.js +4 -0
- package/examples/toolchains/mixed-go/policy.json +126 -0
- package/examples/toolchains/mixed-go/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/mixed-go/repo/_gitignore +6 -0
- package/examples/toolchains/mixed-go/repo/backend/go.mod +3 -0
- package/examples/toolchains/mixed-go/repo/backend/label/label.go +9 -0
- package/examples/toolchains/mixed-go/repo/backend/label/label_test.go +30 -0
- package/examples/toolchains/mixed-go/repo/contract/check.mjs +17 -0
- package/examples/toolchains/mixed-go/repo/contract/label.json +9 -0
- package/examples/toolchains/mixed-go/repo/frontend/package.json +15 -0
- package/examples/toolchains/mixed-go/repo/frontend/pnpm-lock.yaml +22 -0
- package/examples/toolchains/mixed-go/repo/frontend/src/label.js +4 -0
- package/examples/toolchains/mixed-go/repo/frontend/test/label.test.js +11 -0
- package/examples/toolchains/mixed-go/task.json +25 -0
- package/examples/toolchains/mixed-python/bad/backend/src/fx_backend/__init__.py +6 -0
- package/examples/toolchains/mixed-python/bad/frontend/src/label.js +4 -0
- package/examples/toolchains/mixed-python/good/backend/src/fx_backend/__init__.py +6 -0
- package/examples/toolchains/mixed-python/good/frontend/src/label.js +4 -0
- package/examples/toolchains/mixed-python/policy.json +121 -0
- package/examples/toolchains/mixed-python/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/mixed-python/repo/_gitignore +6 -0
- package/examples/toolchains/mixed-python/repo/backend/.python-version +1 -0
- package/examples/toolchains/mixed-python/repo/backend/pyproject.toml +19 -0
- package/examples/toolchains/mixed-python/repo/backend/src/fx_backend/__init__.py +6 -0
- package/examples/toolchains/mixed-python/repo/backend/tests/test_label.py +11 -0
- package/examples/toolchains/mixed-python/repo/backend/uv.lock +108 -0
- package/examples/toolchains/mixed-python/repo/contract/check.mjs +17 -0
- package/examples/toolchains/mixed-python/repo/contract/label.json +9 -0
- package/examples/toolchains/mixed-python/repo/frontend/package.json +15 -0
- package/examples/toolchains/mixed-python/repo/frontend/pnpm-lock.yaml +22 -0
- package/examples/toolchains/mixed-python/repo/frontend/src/label.js +4 -0
- package/examples/toolchains/mixed-python/repo/frontend/test/label.test.js +11 -0
- package/examples/toolchains/mixed-python/task.json +25 -0
- package/examples/toolchains/npm/bad/src/label.js +4 -0
- package/examples/toolchains/npm/good/src/label.js +4 -0
- package/examples/toolchains/npm/policy.json +82 -0
- package/examples/toolchains/npm/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/npm/repo/_gitignore +4 -0
- package/examples/toolchains/npm/repo/package-lock.json +22 -0
- package/examples/toolchains/npm/repo/package.json +13 -0
- package/examples/toolchains/npm/repo/src/label.js +4 -0
- package/examples/toolchains/npm/repo/test/label.test.js +13 -0
- package/examples/toolchains/npm/task.json +25 -0
- package/examples/toolchains/pnpm/bad/packages/label/src/label.js +4 -0
- package/examples/toolchains/pnpm/good/packages/label/src/label.js +4 -0
- package/examples/toolchains/pnpm/policy.json +85 -0
- package/examples/toolchains/pnpm/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/pnpm/repo/_gitignore +4 -0
- package/examples/toolchains/pnpm/repo/package.json +10 -0
- package/examples/toolchains/pnpm/repo/packages/checker/check.mjs +5 -0
- package/examples/toolchains/pnpm/repo/packages/checker/package.json +9 -0
- package/examples/toolchains/pnpm/repo/packages/label/package.json +14 -0
- package/examples/toolchains/pnpm/repo/packages/label/src/label.js +4 -0
- package/examples/toolchains/pnpm/repo/packages/label/test/label.test.js +13 -0
- package/examples/toolchains/pnpm/repo/pnpm-lock.yaml +29 -0
- package/examples/toolchains/pnpm/repo/pnpm-workspace.yaml +2 -0
- package/examples/toolchains/pnpm/task.json +25 -0
- package/examples/toolchains/python/bad/src/fx_label/__init__.py +6 -0
- package/examples/toolchains/python/good/src/fx_label/__init__.py +6 -0
- package/examples/toolchains/python/policy.json +80 -0
- package/examples/toolchains/python/repo/.python-version +1 -0
- package/examples/toolchains/python/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/python/repo/_gitignore +5 -0
- package/examples/toolchains/python/repo/pyproject.toml +19 -0
- package/examples/toolchains/python/repo/src/fx_label/__init__.py +6 -0
- package/examples/toolchains/python/repo/tests/test_label.py +13 -0
- package/examples/toolchains/python/repo/uv.lock +108 -0
- package/examples/toolchains/python/task.json +25 -0
- package/examples/toolchains/turbo/bad/packages/label/src/label.js +4 -0
- package/examples/toolchains/turbo/good/packages/label/src/label.js +4 -0
- package/examples/toolchains/turbo/policy.json +110 -0
- package/examples/toolchains/turbo/repo/REQUIREMENTS.md +9 -0
- package/examples/toolchains/turbo/repo/_gitignore +4 -0
- package/examples/toolchains/turbo/repo/package.json +13 -0
- package/examples/toolchains/turbo/repo/packages/checker/check.mjs +5 -0
- package/examples/toolchains/turbo/repo/packages/checker/package.json +9 -0
- package/examples/toolchains/turbo/repo/packages/label/package.json +14 -0
- package/examples/toolchains/turbo/repo/packages/label/src/label.js +4 -0
- package/examples/toolchains/turbo/repo/packages/label/test/label.test.js +13 -0
- package/examples/toolchains/turbo/repo/pnpm-lock.yaml +94 -0
- package/examples/toolchains/turbo/repo/pnpm-workspace.yaml +2 -0
- package/examples/toolchains/turbo/repo/turbo.json +7 -0
- package/examples/toolchains/turbo/task.json +25 -0
- package/examples/turbo-starter/README.md +16 -0
- package/examples/turbo-starter/changes/issued-at-consumer-only.patch +12 -0
- package/examples/turbo-starter/changes/issued-at.patch +130 -0
- package/examples/turbo-starter/cleanup.mjs +58 -0
- package/examples/turbo-starter/graph.json +32 -0
- package/examples/turbo-starter/harness/acceptance/db-isolation.test.mjs +97 -0
- package/examples/turbo-starter/harness/acceptance/env-probe.test.mjs +75 -0
- package/examples/turbo-starter/harness/acceptance/generation.test.mjs +54 -0
- package/examples/turbo-starter/harness/acceptance/issued-at.test.mjs +43 -0
- package/examples/turbo-starter/harness/acceptance/lifecycle-probe.test.mjs +47 -0
- package/examples/turbo-starter/harness/compose-bridge.mjs +593 -0
- package/examples/turbo-starter/harness/compose.acceptance.yml +23 -0
- package/examples/turbo-starter/harness/env/backend.env.template +7 -0
- package/examples/turbo-starter/harness/env/compose.env.template +6 -0
- package/examples/turbo-starter/policy.json +109 -0
- package/examples/turbo-starter/policy.lifecycle.json +114 -0
- package/examples/turbo-starter/setup.mjs +352 -0
- package/examples/two-vendors/policy.json +30 -0
- package/lib/agents/cli-adapter.d.ts +48 -0
- package/lib/agents/cli-adapter.js +393 -0
- package/lib/agents/inspect.d.ts +60 -0
- package/lib/agents/inspect.js +296 -0
- package/lib/agents/probe-server.d.ts +2 -0
- package/lib/agents/probe-server.js +13 -0
- package/lib/agents/review-probe.d.ts +345 -0
- package/lib/agents/review-probe.js +1037 -0
- package/lib/agents/runtime-events.d.ts +11 -0
- package/lib/agents/runtime-events.js +21 -0
- package/lib/agents/schemas.d.ts +217 -0
- package/lib/agents/schemas.js +124 -0
- package/lib/agents/usage.d.ts +8 -0
- package/lib/agents/usage.js +83 -0
- package/lib/catalog/bytes.d.ts +9 -0
- package/lib/catalog/bytes.js +14 -0
- package/lib/catalog/harness.d.ts +3 -0
- package/lib/catalog/harness.js +11 -0
- package/lib/catalog/index.d.ts +5 -0
- package/lib/catalog/index.js +5 -0
- package/lib/catalog/operations.d.ts +24 -0
- package/lib/catalog/operations.js +74 -0
- package/lib/catalog/page.d.ts +46 -0
- package/lib/catalog/page.js +128 -0
- package/lib/catalog/shared.d.ts +37 -0
- package/lib/catalog/shared.js +67 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.js +673 -0
- package/lib/connectors/files.d.ts +108 -0
- package/lib/connectors/files.js +133 -0
- package/lib/contracts/catalog.d.ts +31 -0
- package/lib/contracts/catalog.js +18 -0
- package/lib/contracts/checks.d.ts +307 -0
- package/lib/contracts/checks.js +181 -0
- package/lib/contracts/cli.d.ts +4665 -0
- package/lib/contracts/cli.js +840 -0
- package/lib/contracts/context.d.ts +135 -0
- package/lib/contracts/context.js +129 -0
- package/lib/contracts/diagnosis.d.ts +108 -0
- package/lib/contracts/diagnosis.js +69 -0
- package/lib/contracts/digest.d.ts +9 -0
- package/lib/contracts/digest.js +22 -0
- package/lib/contracts/errors.d.ts +89 -0
- package/lib/contracts/errors.js +74 -0
- package/lib/contracts/events.d.ts +827 -0
- package/lib/contracts/events.js +258 -0
- package/lib/contracts/execution.d.ts +3423 -0
- package/lib/contracts/execution.js +936 -0
- package/lib/contracts/failure.d.ts +38 -0
- package/lib/contracts/failure.js +53 -0
- package/lib/contracts/index.d.ts +22 -0
- package/lib/contracts/index.js +22 -0
- package/lib/contracts/planning.d.ts +433 -0
- package/lib/contracts/planning.js +159 -0
- package/lib/contracts/policy.d.ts +1075 -0
- package/lib/contracts/policy.js +544 -0
- package/lib/contracts/ports.d.ts +417 -0
- package/lib/contracts/ports.js +1 -0
- package/lib/contracts/primitives.d.ts +63 -0
- package/lib/contracts/primitives.js +73 -0
- package/lib/contracts/profiles.d.ts +340 -0
- package/lib/contracts/profiles.js +109 -0
- package/lib/contracts/project.d.ts +69 -0
- package/lib/contracts/project.js +47 -0
- package/lib/contracts/published.d.ts +3467 -0
- package/lib/contracts/published.js +40 -0
- package/lib/contracts/repair-policy.d.ts +31 -0
- package/lib/contracts/repair-policy.js +77 -0
- package/lib/contracts/result.d.ts +1284 -0
- package/lib/contracts/result.js +311 -0
- package/lib/contracts/review.d.ts +441 -0
- package/lib/contracts/review.js +477 -0
- package/lib/contracts/toolchain.d.ts +96 -0
- package/lib/contracts/toolchain.js +89 -0
- package/lib/contracts/version.d.ts +17 -0
- package/lib/contracts/version.js +17 -0
- package/lib/contracts/work.d.ts +171 -0
- package/lib/contracts/work.js +178 -0
- package/lib/control/base-move.d.ts +44 -0
- package/lib/control/base-move.js +90 -0
- package/lib/control/doctor.d.ts +50 -0
- package/lib/control/doctor.js +113 -0
- package/lib/control/harness.d.ts +1125 -0
- package/lib/control/harness.js +741 -0
- package/lib/control/provenance.d.ts +17 -0
- package/lib/control/provenance.js +25 -0
- package/lib/control/recovery.d.ts +237 -0
- package/lib/control/recovery.js +236 -0
- package/lib/control/review.d.ts +62 -0
- package/lib/control/review.js +182 -0
- package/lib/control/workflow.d.ts +256 -0
- package/lib/control/workflow.js +277 -0
- package/lib/engine/budget.d.ts +345 -0
- package/lib/engine/budget.js +278 -0
- package/lib/engine/classify.d.ts +8 -0
- package/lib/engine/classify.js +41 -0
- package/lib/engine/engine.d.ts +1564 -0
- package/lib/engine/engine.js +2283 -0
- package/lib/engine/failure.d.ts +1 -0
- package/lib/engine/failure.js +3 -0
- package/lib/engine/joint-runner.d.ts +257 -0
- package/lib/engine/joint-runner.js +254 -0
- package/lib/engine/measured.d.ts +15 -0
- package/lib/engine/measured.js +82 -0
- package/lib/engine/prompt.d.ts +66 -0
- package/lib/engine/prompt.js +131 -0
- package/lib/engine/property-recovery.d.ts +50 -0
- package/lib/engine/property-recovery.js +171 -0
- package/lib/engine/repair.d.ts +33 -0
- package/lib/engine/repair.js +82 -0
- package/lib/engine/result.d.ts +9 -0
- package/lib/engine/result.js +194 -0
- package/lib/engine/reuse.d.ts +80 -0
- package/lib/engine/reuse.js +102 -0
- package/lib/engine/runner.d.ts +360 -0
- package/lib/engine/runner.js +1844 -0
- package/lib/engine/standalone.d.ts +6 -0
- package/lib/engine/standalone.js +48 -0
- package/lib/engine/usage.d.ts +87 -0
- package/lib/engine/usage.js +165 -0
- package/lib/environment/isolation.d.ts +110 -0
- package/lib/environment/isolation.js +238 -0
- package/lib/environment/lifecycle.d.ts +40 -0
- package/lib/environment/lifecycle.js +197 -0
- package/lib/environment/live-calls.d.ts +14 -0
- package/lib/environment/live-calls.js +73 -0
- package/lib/environment/os-tools.d.ts +16 -0
- package/lib/environment/os-tools.js +35 -0
- package/lib/environment/process.d.ts +40 -0
- package/lib/environment/process.js +375 -0
- package/lib/environment/redaction.d.ts +22 -0
- package/lib/environment/redaction.js +102 -0
- package/lib/environment/resources.d.ts +31 -0
- package/lib/environment/resources.js +120 -0
- package/lib/explain/diagnose.d.ts +25 -0
- package/lib/explain/diagnose.js +60 -0
- package/lib/explain/state.d.ts +18 -0
- package/lib/explain/state.js +305 -0
- package/lib/index.d.ts +72 -0
- package/lib/index.js +74 -0
- package/lib/init/policy.d.ts +40 -0
- package/lib/init/policy.js +73 -0
- package/lib/init/project.d.ts +52 -0
- package/lib/init/project.js +412 -0
- package/lib/integrations/connector/commands.d.ts +358 -0
- package/lib/integrations/connector/commands.js +428 -0
- package/lib/integrations/connector/config.d.ts +215 -0
- package/lib/integrations/connector/config.js +214 -0
- package/lib/integrations/connector/delivery.d.ts +107 -0
- package/lib/integrations/connector/delivery.js +591 -0
- package/lib/integrations/connector/fake.d.ts +291 -0
- package/lib/integrations/connector/fake.js +786 -0
- package/lib/integrations/connector/history.d.ts +124 -0
- package/lib/integrations/connector/history.js +497 -0
- package/lib/integrations/connector/index.d.ts +16 -0
- package/lib/integrations/connector/index.js +16 -0
- package/lib/integrations/connector/redact.d.ts +19 -0
- package/lib/integrations/connector/redact.js +91 -0
- package/lib/integrations/connector/registry.d.ts +15 -0
- package/lib/integrations/connector/registry.js +43 -0
- package/lib/integrations/connector/snapshot.d.ts +131 -0
- package/lib/integrations/connector/snapshot.js +422 -0
- package/lib/integrations/connector/source.d.ts +37 -0
- package/lib/integrations/connector/source.js +73 -0
- package/lib/integrations/connector/steps.d.ts +71 -0
- package/lib/integrations/connector/steps.js +188 -0
- package/lib/integrations/connector/store.d.ts +140 -0
- package/lib/integrations/connector/store.js +277 -0
- package/lib/integrations/connector/summary.d.ts +38 -0
- package/lib/integrations/connector/summary.js +59 -0
- package/lib/integrations/connector/testing-worker.d.ts +1 -0
- package/lib/integrations/connector/testing-worker.js +81 -0
- package/lib/integrations/connector/testing.d.ts +205 -0
- package/lib/integrations/connector/testing.js +1615 -0
- package/lib/integrations/connector/transport.d.ts +240 -0
- package/lib/integrations/connector/transport.js +28 -0
- package/lib/integrations/memory/context.d.ts +120 -0
- package/lib/integrations/memory/context.js +239 -0
- package/lib/integrations/memory/index.d.ts +8 -0
- package/lib/integrations/memory/index.js +8 -0
- package/lib/integrations/memory/provider.d.ts +79 -0
- package/lib/integrations/memory/provider.js +22 -0
- package/lib/integrations/memory/sink.d.ts +56 -0
- package/lib/integrations/memory/sink.js +116 -0
- package/lib/integrations/memory/testing.d.ts +44 -0
- package/lib/integrations/memory/testing.js +61 -0
- package/lib/integrations/relay-v1/index.d.ts +122 -0
- package/lib/integrations/relay-v1/index.js +860 -0
- package/lib/integrations/relay-v2/index.d.ts +145 -0
- package/lib/integrations/relay-v2/index.js +752 -0
- package/lib/integrations/relay-v2/process.d.ts +32 -0
- package/lib/integrations/relay-v2/process.js +112 -0
- package/lib/integrations/relay-v2/protocol.d.ts +172 -0
- package/lib/integrations/relay-v2/protocol.js +142 -0
- package/lib/package.d.ts +2 -0
- package/lib/package.js +3 -0
- package/lib/planning/check.d.ts +26 -0
- package/lib/planning/check.js +174 -0
- package/lib/planning/facts.d.ts +13 -0
- package/lib/planning/facts.js +47 -0
- package/lib/planning/graph.d.ts +20 -0
- package/lib/planning/graph.js +114 -0
- package/lib/planning/index.d.ts +6 -0
- package/lib/planning/index.js +6 -0
- package/lib/planning/issues.d.ts +19 -0
- package/lib/planning/issues.js +210 -0
- package/lib/planning/request.d.ts +19 -0
- package/lib/planning/request.js +57 -0
- package/lib/planning/standalone.d.ts +16 -0
- package/lib/planning/standalone.js +19 -0
- package/lib/planning/stub.d.ts +2 -0
- package/lib/planning/stub.js +5 -0
- package/lib/profiles/resolve.d.ts +266 -0
- package/lib/profiles/resolve.js +322 -0
- package/lib/projections/chain.d.ts +35 -0
- package/lib/projections/chain.js +72 -0
- package/lib/projections/clip.d.ts +6 -0
- package/lib/projections/clip.js +23 -0
- package/lib/projections/enums.d.ts +7 -0
- package/lib/projections/enums.js +19 -0
- package/lib/projections/index.d.ts +8 -0
- package/lib/projections/index.js +9 -0
- package/lib/projections/next.d.ts +28 -0
- package/lib/projections/next.js +75 -0
- package/lib/projections/progress.d.ts +27 -0
- package/lib/projections/progress.js +37 -0
- package/lib/projections/queue.d.ts +21 -0
- package/lib/projections/queue.js +18 -0
- package/lib/projections/stop.d.ts +98 -0
- package/lib/projections/stop.js +532 -0
- package/lib/setup/files.d.ts +45 -0
- package/lib/setup/files.js +280 -0
- package/lib/storage/document.d.ts +1286 -0
- package/lib/storage/document.js +80 -0
- package/lib/storage/sqlite.d.ts +35 -0
- package/lib/storage/sqlite.js +260 -0
- package/lib/testing/index.d.ts +5 -0
- package/lib/testing/index.js +5 -0
- package/lib/testing/store-contract.d.ts +8 -0
- package/lib/testing/store-contract.js +167 -0
- package/lib/toolchains/index.d.ts +9 -0
- package/lib/toolchains/index.js +9 -0
- package/lib/toolchains/inspect.d.ts +105 -0
- package/lib/toolchains/inspect.js +831 -0
- package/lib/toolchains/manifests.d.ts +67 -0
- package/lib/toolchains/manifests.js +238 -0
- package/lib/toolchains/probe.d.ts +28 -0
- package/lib/toolchains/probe.js +54 -0
- package/lib/toolchains/recipes.d.ts +33 -0
- package/lib/toolchains/recipes.js +51 -0
- package/lib/validate.d.ts +37 -0
- package/lib/validate.js +182 -0
- package/lib/verification/acceptance.d.ts +284 -0
- package/lib/verification/acceptance.js +670 -0
- package/lib/verification/checks.d.ts +72 -0
- package/lib/verification/checks.js +190 -0
- package/lib/verification/confirm.d.ts +125 -0
- package/lib/verification/confirm.js +411 -0
- package/lib/verification/corpus.d.ts +1303 -0
- package/lib/verification/corpus.js +744 -0
- package/lib/verification/dependencies.d.ts +66 -0
- package/lib/verification/dependencies.js +144 -0
- package/lib/verification/gates.d.ts +182 -0
- package/lib/verification/gates.js +641 -0
- package/lib/verification/joint.d.ts +63 -0
- package/lib/verification/joint.js +121 -0
- package/lib/verification/proof.d.ts +54 -0
- package/lib/verification/proof.js +96 -0
- package/lib/verification/property.d.ts +86 -0
- package/lib/verification/property.js +214 -0
- package/lib/verification/requirements.d.ts +25 -0
- package/lib/verification/requirements.js +69 -0
- package/lib/verification/self-check.d.ts +29 -0
- package/lib/verification/self-check.js +99 -0
- package/lib/verification/spike.d.ts +79 -0
- package/lib/verification/spike.js +124 -0
- package/package.json +104 -4
- package/profiles/expo-mobile.json +15 -0
- package/profiles/go-api.json +15 -0
- package/profiles/go-gotestsum.json +21 -0
- package/profiles/mobile-maestro.json +29 -0
- package/profiles/nest-api.json +26 -0
- package/profiles/next-product.json +72 -0
- package/profiles/node-checks.json +77 -0
- package/profiles/npm-ci.json +22 -0
- package/profiles/pnpm-frozen.json +24 -0
- package/profiles/python-api.json +32 -0
- package/profiles/python-uv.json +26 -0
- package/profiles/react-native.json +50 -0
- package/profiles/react-vite-admin.json +71 -0
- package/schemas/context-snapshot.schema.json +231 -0
- package/schemas/contract-document.schema.json +385 -0
- package/schemas/execution-document.schema.json +3881 -0
- package/schemas/execution-policy.schema.json +2196 -0
- package/schemas/joint-verification.schema.json +617 -0
- package/schemas/plan-draft.schema.json +217 -0
- package/schemas/project-manifest.schema.json +167 -0
- package/schemas/result-envelope.schema.json +1654 -0
- package/schemas/review-record.schema.json +177 -0
- package/schemas/run-event.schema.json +2458 -0
- package/schemas/run-result.schema.json +1572 -0
- package/schemas/stack-profile.schema.json +535 -0
- package/schemas/stop-diagnosis.schema.json +169 -0
- package/schemas/work-graph.schema.json +381 -0
- package/schemas/work-order.schema.json +256 -0
- package/skills/harness/SKILL.md +247 -0
- package/skills/harness-setup/SKILL.md +356 -0
- package/templates/AGENTS.md +13 -0
- package/templates/controller-mode/AGENTS.controller.md +58 -0
- package/templates/controller-mode/README.md +44 -0
- package/templates/graph.json +22 -0
- package/templates/plan-draft.json +35 -0
- package/templates/policy.json +28 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { activeStatuses, } from "./enums.js";
|
|
2
|
+
export const chainRootCodes = [
|
|
3
|
+
'failed',
|
|
4
|
+
'failed-exhausted',
|
|
5
|
+
'draft',
|
|
6
|
+
'cancelled',
|
|
7
|
+
'held',
|
|
8
|
+
'budget-blocked',
|
|
9
|
+
'attempts-exhausted',
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Корневые причины, из-за которых ждут готовые работы (OP-DIAG-01).
|
|
13
|
+
* Корень — незавершённая предшественница, которая сама не выполняется:
|
|
14
|
+
* упала, не утверждена, удержана, отменена или упёрлась в бюджет. Каждый
|
|
15
|
+
* ждущий считается у корня один раз, даже если доходит до него по ромбу.
|
|
16
|
+
* Порядок результата — порядок первого обнаружения корня.
|
|
17
|
+
*/
|
|
18
|
+
export function chainRoots(works, maxAttempts = 3) {
|
|
19
|
+
const byId = new Map(works.map((w) => [w.id, w]));
|
|
20
|
+
const active = activeStatuses;
|
|
21
|
+
const open = (w) => w.dependsOn.filter((d) => byId.get(d)?.status !== 'done');
|
|
22
|
+
const waiting = works.filter((w) => w.status === 'ready' && open(w).length > 0);
|
|
23
|
+
const roots = new Map();
|
|
24
|
+
for (const w of waiting) {
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
const walk = (id) => {
|
|
27
|
+
if (seen.has(id))
|
|
28
|
+
return;
|
|
29
|
+
seen.add(id);
|
|
30
|
+
const t = byId.get(id);
|
|
31
|
+
if (!t || t.status === 'done')
|
|
32
|
+
return;
|
|
33
|
+
const deps = open(t);
|
|
34
|
+
if (deps.length && t.status === 'ready')
|
|
35
|
+
return deps.forEach(walk);
|
|
36
|
+
if (active.includes(t.status) || t.activeRunId)
|
|
37
|
+
return;
|
|
38
|
+
if (t.status === 'ready' && !t.hold && !t.budgetBlock && t.attempt < maxAttempts)
|
|
39
|
+
return;
|
|
40
|
+
roots.set(id, (roots.get(id) ?? new Set()).add(w.id));
|
|
41
|
+
};
|
|
42
|
+
w.dependsOn.forEach(walk);
|
|
43
|
+
}
|
|
44
|
+
return [...roots].map(([id, dependents]) => {
|
|
45
|
+
const t = byId.get(id);
|
|
46
|
+
const exhausted = t.attempt >= maxAttempts;
|
|
47
|
+
const root = (code, actor, action, detail) => ({
|
|
48
|
+
workId: id,
|
|
49
|
+
code,
|
|
50
|
+
waiting: dependents.size,
|
|
51
|
+
actor,
|
|
52
|
+
action,
|
|
53
|
+
...(detail !== undefined ? { detail } : {}),
|
|
54
|
+
...((code === 'failed' || code === 'failed-exhausted') && t.failureKind
|
|
55
|
+
? { failureKind: t.failureKind }
|
|
56
|
+
: {}),
|
|
57
|
+
});
|
|
58
|
+
if (t.status === 'failed')
|
|
59
|
+
return exhausted
|
|
60
|
+
? root('failed-exhausted', 'user', 'reset-attempts')
|
|
61
|
+
: root('failed', 'controller', 'retry');
|
|
62
|
+
if (t.status === 'draft')
|
|
63
|
+
return root('draft', 'lead', 'review-plan');
|
|
64
|
+
if (t.status === 'cancelled')
|
|
65
|
+
return root('cancelled', 'lead', 'replan-dependents');
|
|
66
|
+
if (t.hold)
|
|
67
|
+
return root('held', 'controller', 'wait', t.hold.reason);
|
|
68
|
+
if (t.budgetBlock && !exhausted)
|
|
69
|
+
return root('budget-blocked', 'user', 'raise-budget', t.budgetBlock.reason);
|
|
70
|
+
return root('attempts-exhausted', 'user', 'reset-attempts');
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CLIP_SHORT = 300;
|
|
2
|
+
export declare const CLIP_DIAGNOSTIC = 2000;
|
|
3
|
+
/** Строка длиннее `n` code units обрезается до `n` и получает «…». */
|
|
4
|
+
export declare function clipText(text: string | undefined, n?: number): string | undefined;
|
|
5
|
+
/** Каждая строка на любой глубине — через clipText; ключи `omitKeys` удаляются. */
|
|
6
|
+
export declare function clipDeep<T>(value: T, n?: number, omitKeys?: readonly string[]): T;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Усечение строк для ответов агенту и проекций. Предел — на каждую строку,
|
|
2
|
+
// а не на размер объекта: байтовый предел транспорта — отдельная граница.
|
|
3
|
+
export const CLIP_SHORT = 300;
|
|
4
|
+
export const CLIP_DIAGNOSTIC = 2000;
|
|
5
|
+
/** Строка длиннее `n` code units обрезается до `n` и получает «…». */
|
|
6
|
+
export function clipText(text, n = CLIP_SHORT) {
|
|
7
|
+
return text && text.length > n ? text.slice(0, n) + '…' : text;
|
|
8
|
+
}
|
|
9
|
+
/** Каждая строка на любой глубине — через clipText; ключи `omitKeys` удаляются. */
|
|
10
|
+
export function clipDeep(value, n = CLIP_DIAGNOSTIC, omitKeys = ['token']) {
|
|
11
|
+
const walk = (v) => {
|
|
12
|
+
if (typeof v === 'string')
|
|
13
|
+
return clipText(v, n);
|
|
14
|
+
if (Array.isArray(v))
|
|
15
|
+
return v.map(walk);
|
|
16
|
+
if (v && typeof v === 'object')
|
|
17
|
+
return Object.fromEntries(Object.entries(v)
|
|
18
|
+
.filter(([k]) => !omitKeys.includes(k))
|
|
19
|
+
.map(([k, x]) => [k, walk(x)]));
|
|
20
|
+
return v;
|
|
21
|
+
};
|
|
22
|
+
return walk(value);
|
|
23
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { FailureKind, PauseReason, WorkStatus } from '../contracts/execution.ts';
|
|
2
|
+
/** Кто действует: ведущий агент, человек, штатный исполнитель; null — никто. */
|
|
3
|
+
export declare const actors: readonly ["controller", "lead", "user"];
|
|
4
|
+
export type Actor = (typeof actors)[number] | null;
|
|
5
|
+
export declare const nextActions: readonly ["none", "wait", "review-plan", "retry", "diagnose-failure", "reset-attempts", "raise-budget", "replan-dependents", "recovery-decision", "user-decision", "resume-queue", "fix-environment", "fix-access"];
|
|
6
|
+
export type NextAction = (typeof nextActions)[number];
|
|
7
|
+
export declare const activeStatuses: readonly ["running", "verifying", "reviewing", "integrating"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Общие перечни проекций. Модуль без node:* — его импортирует браузер.
|
|
2
|
+
/** Кто действует: ведущий агент, человек, штатный исполнитель; null — никто. */
|
|
3
|
+
export const actors = ['controller', 'lead', 'user'];
|
|
4
|
+
export const nextActions = [
|
|
5
|
+
'none',
|
|
6
|
+
'wait',
|
|
7
|
+
'review-plan',
|
|
8
|
+
'retry',
|
|
9
|
+
'diagnose-failure',
|
|
10
|
+
'reset-attempts',
|
|
11
|
+
'raise-budget',
|
|
12
|
+
'replan-dependents',
|
|
13
|
+
'recovery-decision',
|
|
14
|
+
'user-decision',
|
|
15
|
+
'resume-queue',
|
|
16
|
+
'fix-environment',
|
|
17
|
+
'fix-access',
|
|
18
|
+
];
|
|
19
|
+
export const activeStatuses = ['running', 'verifying', 'reviewing', 'integrating'];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { actors, nextActions, activeStatuses, type Actor, type NextAction } from './enums.ts';
|
|
2
|
+
export type { FailureKind, PauseReason, WorkStatus } from './enums.ts';
|
|
3
|
+
export { chainRoots, chainRootCodes, type ChainWork, type ChainRoot, type ChainRootCode, } from './chain.ts';
|
|
4
|
+
export { workProgress, progressReasons, type ProgressInput, type ProgressReason, type ProgressView, } from './progress.ts';
|
|
5
|
+
export { nextAction, nextSteps, type NextInput, type NextStep, type NextView } from './next.ts';
|
|
6
|
+
export { queueStop, type QueueStopInput, type QueueStopView } from './queue.ts';
|
|
7
|
+
export { CLIP_SHORT, CLIP_DIAGNOSTIC, clipText, clipDeep } from './clip.ts';
|
|
8
|
+
export { stopCodeOf, explainStop, stopCauses, stopPhases, type StopInput, type StopCause, type StopPhase, type StopDiagnosis, type EvidenceLink, } from './stop.ts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// devcontour-harness/projections — чистые проекции без node:*. Те же функции
|
|
2
|
+
// экспортирует корень пакета: реализация одна.
|
|
3
|
+
export { actors, nextActions, activeStatuses } from "./enums.js";
|
|
4
|
+
export { chainRoots, chainRootCodes, } from "./chain.js";
|
|
5
|
+
export { workProgress, progressReasons, } from "./progress.js";
|
|
6
|
+
export { nextAction, nextSteps } from "./next.js";
|
|
7
|
+
export { queueStop } from "./queue.js";
|
|
8
|
+
export { CLIP_SHORT, CLIP_DIAGNOSTIC, clipText, clipDeep } from "./clip.js";
|
|
9
|
+
export { stopCodeOf, explainStop, stopCauses, stopPhases, } from "./stop.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PropertyRecovery } from '../contracts/execution.ts';
|
|
2
|
+
import { type Actor, type NextAction, type WorkStatus } from './enums.ts';
|
|
3
|
+
export declare const nextSteps: readonly ["accepted", "cancelled", "recovery-awaiting-lead", "recovery-analyzing", "recovery-applying", "recovery-retry-allowed", "recovery-retrying", "recovery-awaiting-user", "recovery-stopped", "corpus-adoption", "held", "plan-review", "attempt-running", "retry-within-budget", "attempts-exhausted", "awaiting-claim"];
|
|
4
|
+
export type NextStep = (typeof nextSteps)[number];
|
|
5
|
+
export interface NextInput {
|
|
6
|
+
status: WorkStatus;
|
|
7
|
+
attempt: number;
|
|
8
|
+
maxAttempts: number;
|
|
9
|
+
hold?: {
|
|
10
|
+
operation: string;
|
|
11
|
+
};
|
|
12
|
+
recovery?: Pick<PropertyRecovery, 'status' | 'property' | 'reason' | 'decision'>;
|
|
13
|
+
waitingAdoption?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface NextView {
|
|
16
|
+
actor: Actor;
|
|
17
|
+
action: NextAction;
|
|
18
|
+
step: NextStep;
|
|
19
|
+
property?: string;
|
|
20
|
+
detail?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Следующий шаг по работе и кто его делает (OP-DIAG-03). Порядок веток —
|
|
24
|
+
* прежний: итог, эпизод восстановления, смена корпуса, удержание, план,
|
|
25
|
+
* идущая попытка, сбой, ожидание выдачи. Закрытый эпизод (`closed`) идёт
|
|
26
|
+
* дальше по веткам.
|
|
27
|
+
*/
|
|
28
|
+
export declare function nextAction(input: NextInput): NextView;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { activeStatuses } from "./enums.js";
|
|
2
|
+
export const nextSteps = [
|
|
3
|
+
'accepted',
|
|
4
|
+
'cancelled',
|
|
5
|
+
'recovery-awaiting-lead',
|
|
6
|
+
'recovery-analyzing',
|
|
7
|
+
'recovery-applying',
|
|
8
|
+
'recovery-retry-allowed',
|
|
9
|
+
'recovery-retrying',
|
|
10
|
+
'recovery-awaiting-user',
|
|
11
|
+
'recovery-stopped',
|
|
12
|
+
'corpus-adoption',
|
|
13
|
+
'held',
|
|
14
|
+
'plan-review',
|
|
15
|
+
'attempt-running',
|
|
16
|
+
'retry-within-budget',
|
|
17
|
+
'attempts-exhausted',
|
|
18
|
+
'awaiting-claim',
|
|
19
|
+
];
|
|
20
|
+
const view = (actor, action, step, extra = {}) => ({
|
|
21
|
+
actor,
|
|
22
|
+
action,
|
|
23
|
+
step,
|
|
24
|
+
...(extra.property !== undefined ? { property: extra.property } : {}),
|
|
25
|
+
...(extra.detail !== undefined ? { detail: extra.detail } : {}),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Следующий шаг по работе и кто его делает (OP-DIAG-03). Порядок веток —
|
|
29
|
+
* прежний: итог, эпизод восстановления, смена корпуса, удержание, план,
|
|
30
|
+
* идущая попытка, сбой, ожидание выдачи. Закрытый эпизод (`closed`) идёт
|
|
31
|
+
* дальше по веткам.
|
|
32
|
+
*/
|
|
33
|
+
export function nextAction(input) {
|
|
34
|
+
const r = input.recovery;
|
|
35
|
+
if (input.status === 'done')
|
|
36
|
+
return view(null, 'none', 'accepted');
|
|
37
|
+
if (input.status === 'cancelled')
|
|
38
|
+
return view(null, 'none', 'cancelled');
|
|
39
|
+
if (r)
|
|
40
|
+
switch (r.status) {
|
|
41
|
+
case 'awaiting-lead':
|
|
42
|
+
return view('lead', 'recovery-decision', 'recovery-awaiting-lead', {
|
|
43
|
+
property: r.property,
|
|
44
|
+
});
|
|
45
|
+
case 'analyzing':
|
|
46
|
+
return view('lead', 'wait', 'recovery-analyzing', { property: r.property });
|
|
47
|
+
case 'applying':
|
|
48
|
+
return view('controller', 'wait', 'recovery-applying');
|
|
49
|
+
case 'retry':
|
|
50
|
+
return view('controller', 'wait', 'recovery-retry-allowed');
|
|
51
|
+
case 'retrying':
|
|
52
|
+
return view('controller', 'wait', 'recovery-retrying');
|
|
53
|
+
case 'awaiting-user':
|
|
54
|
+
return view('user', 'user-decision', 'recovery-awaiting-user', { detail: r.reason });
|
|
55
|
+
case 'stopped':
|
|
56
|
+
return view(r.decision?.proposal ? 'lead' : 'user', 'user-decision', 'recovery-stopped', {
|
|
57
|
+
detail: r.reason,
|
|
58
|
+
});
|
|
59
|
+
case 'closed':
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
if (input.waitingAdoption)
|
|
63
|
+
return view('controller', 'wait', 'corpus-adoption');
|
|
64
|
+
if (input.hold)
|
|
65
|
+
return view('controller', 'wait', 'held', { detail: input.hold.operation });
|
|
66
|
+
if (input.status === 'draft')
|
|
67
|
+
return view('lead', 'review-plan', 'plan-review');
|
|
68
|
+
if (activeStatuses.includes(input.status))
|
|
69
|
+
return view('controller', 'wait', 'attempt-running');
|
|
70
|
+
if (input.status === 'failed')
|
|
71
|
+
return input.maxAttempts - input.attempt > 0
|
|
72
|
+
? view('controller', 'retry', 'retry-within-budget')
|
|
73
|
+
: view('user', 'reset-attempts', 'attempts-exhausted');
|
|
74
|
+
return view('controller', 'wait', 'awaiting-claim');
|
|
75
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { WorkStatus } from './enums.ts';
|
|
2
|
+
export declare const progressReasons: readonly ["plan-review-required", "attempts-exhausted", "failure-requires-diagnosis", "dependencies-incomplete", "queue-paused", "workers-busy"];
|
|
3
|
+
export type ProgressReason = (typeof progressReasons)[number];
|
|
4
|
+
export interface ProgressInput {
|
|
5
|
+
work: {
|
|
6
|
+
status: WorkStatus;
|
|
7
|
+
attempt: number;
|
|
8
|
+
dependsOn: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
statusOf: (id: string) => WorkStatus | undefined;
|
|
11
|
+
maxAttempts: number;
|
|
12
|
+
paused: boolean;
|
|
13
|
+
activeRuns: number;
|
|
14
|
+
concurrency: number;
|
|
15
|
+
hostReasons?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
export interface ProgressView {
|
|
18
|
+
dependencies: string[];
|
|
19
|
+
reasons: ProgressReason[];
|
|
20
|
+
eligible: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Почему работа сейчас не выдаётся (OP-DIAG-02): общие ветви. Продуктовые
|
|
24
|
+
* причины хоста приходят в `hostReasons` и влияют только на `eligible`;
|
|
25
|
+
* их место в итоговом перечне определяет хост.
|
|
26
|
+
*/
|
|
27
|
+
export declare function workProgress(input: ProgressInput): ProgressView;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const progressReasons = [
|
|
2
|
+
'plan-review-required',
|
|
3
|
+
'attempts-exhausted',
|
|
4
|
+
'failure-requires-diagnosis',
|
|
5
|
+
'dependencies-incomplete',
|
|
6
|
+
'queue-paused',
|
|
7
|
+
'workers-busy',
|
|
8
|
+
];
|
|
9
|
+
/**
|
|
10
|
+
* Почему работа сейчас не выдаётся (OP-DIAG-02): общие ветви. Продуктовые
|
|
11
|
+
* причины хоста приходят в `hostReasons` и влияют только на `eligible`;
|
|
12
|
+
* их место в итоговом перечне определяет хост.
|
|
13
|
+
*/
|
|
14
|
+
export function workProgress(input) {
|
|
15
|
+
const { work, statusOf, maxAttempts } = input;
|
|
16
|
+
const dependencies = work.dependsOn.filter((id) => statusOf(id) !== 'done');
|
|
17
|
+
const reasons = [];
|
|
18
|
+
if (work.status === 'draft')
|
|
19
|
+
reasons.push('plan-review-required');
|
|
20
|
+
if (work.status === 'failed')
|
|
21
|
+
reasons.push(work.attempt >= maxAttempts ? 'attempts-exhausted' : 'failure-requires-diagnosis');
|
|
22
|
+
if (work.status === 'ready') {
|
|
23
|
+
if (dependencies.length)
|
|
24
|
+
reasons.push('dependencies-incomplete');
|
|
25
|
+
if (work.attempt >= maxAttempts)
|
|
26
|
+
reasons.push('attempts-exhausted');
|
|
27
|
+
if (input.paused)
|
|
28
|
+
reasons.push('queue-paused');
|
|
29
|
+
if (input.activeRuns >= input.concurrency)
|
|
30
|
+
reasons.push('workers-busy');
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
dependencies,
|
|
34
|
+
reasons,
|
|
35
|
+
eligible: work.status === 'ready' && !reasons.length && !(input.hostReasons ?? []).length,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PauseReason } from './enums.ts';
|
|
2
|
+
export interface QueueStopInput {
|
|
3
|
+
paused: boolean;
|
|
4
|
+
pauseReason?: PauseReason;
|
|
5
|
+
errors: readonly {
|
|
6
|
+
seq: number;
|
|
7
|
+
message?: string;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
export interface QueueStopView {
|
|
11
|
+
paused: boolean;
|
|
12
|
+
reason?: PauseReason;
|
|
13
|
+
detail?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Причина остановки очереди (OP-DIAG-04). Пауза без причины — прежние записи
|
|
17
|
+
* паузы рантайма, она означает runtime. Пауза оператора и прочие причины не
|
|
18
|
+
* называют сбой. Для runtime берётся ошибка с наибольшим `seq`; если у неё нет
|
|
19
|
+
* сообщения, `detail` нет: более старая ошибка за причину не выдаётся.
|
|
20
|
+
*/
|
|
21
|
+
export declare function queueStop(input: QueueStopInput): QueueStopView;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Причина остановки очереди (OP-DIAG-04). Пауза без причины — прежние записи
|
|
3
|
+
* паузы рантайма, она означает runtime. Пауза оператора и прочие причины не
|
|
4
|
+
* называют сбой. Для runtime берётся ошибка с наибольшим `seq`; если у неё нет
|
|
5
|
+
* сообщения, `detail` нет: более старая ошибка за причину не выдаётся.
|
|
6
|
+
*/
|
|
7
|
+
export function queueStop(input) {
|
|
8
|
+
if (!input.paused)
|
|
9
|
+
return { paused: false };
|
|
10
|
+
const reason = input.pauseReason ?? 'runtime';
|
|
11
|
+
if (reason !== 'runtime')
|
|
12
|
+
return { paused: true, reason };
|
|
13
|
+
const latest = input.errors.reduce((a, e) => (!a || e.seq > a.seq ? e : a), undefined);
|
|
14
|
+
const message = latest?.message;
|
|
15
|
+
return message
|
|
16
|
+
? { paused: true, reason, detail: message.replace(/^(Error|TaskFailure):\s*/, '') }
|
|
17
|
+
: { paused: true, reason };
|
|
18
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type ErrorCode } from '../contracts/errors.ts';
|
|
2
|
+
import type { Actor, FailureKind, NextAction, PauseReason, WorkStatus } from './enums.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Код остановки по классу отказа. Это та же таблица, которой RunResult
|
|
5
|
+
* называет stopReason: сетевой класс приходит из сохранённого failureKind
|
|
6
|
+
* (его ставит classifyFailure в точке отказа), текст здесь не разбирается.
|
|
7
|
+
*/
|
|
8
|
+
export declare function stopCodeOf(kind: FailureKind | undefined): ErrorCode;
|
|
9
|
+
export declare const stopCauses: readonly ["provider-auth", "environment", "timeout", "stale-base", "empty-result", "scope-violation", "gate", "review", "review-protocol", "merge", "cancelled", "budget", "unknown", "runtime-missing", "controller-busy", "operator-pause", "approval-required", "not-ready"];
|
|
10
|
+
export type StopCause = (typeof stopCauses)[number];
|
|
11
|
+
export declare const stopPhases: readonly ["preflight", "claim", "implementation", "gates", "review", "integration", "delivery"];
|
|
12
|
+
export type StopPhase = (typeof stopPhases)[number];
|
|
13
|
+
export interface EvidenceLink {
|
|
14
|
+
kind: 'attempt' | 'evidence' | 'event' | 'doctor';
|
|
15
|
+
id: string;
|
|
16
|
+
sha?: string;
|
|
17
|
+
}
|
|
18
|
+
export type StopInput = {
|
|
19
|
+
kind: 'work';
|
|
20
|
+
work: {
|
|
21
|
+
id: string;
|
|
22
|
+
status: WorkStatus;
|
|
23
|
+
attempt: number;
|
|
24
|
+
failureKind?: FailureKind;
|
|
25
|
+
failure?: string;
|
|
26
|
+
hold?: {
|
|
27
|
+
operation: string;
|
|
28
|
+
reason: string;
|
|
29
|
+
};
|
|
30
|
+
budgetBlock?: {
|
|
31
|
+
reason: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Эпизод восстановления свойства: работу ведёт его разбор, а не штатный
|
|
35
|
+
* repair. Статус — как в `PropertyRecovery.status`.
|
|
36
|
+
*/
|
|
37
|
+
recovery?: {
|
|
38
|
+
status: string;
|
|
39
|
+
};
|
|
40
|
+
/** Незавершённые предпосылки, на которых движок остановит задание. */
|
|
41
|
+
waitingOn?: string[];
|
|
42
|
+
/** Согласование графа устарело для этой политики (режим operator). */
|
|
43
|
+
approvalStale?: string;
|
|
44
|
+
};
|
|
45
|
+
maxAttempts: number;
|
|
46
|
+
repair: {
|
|
47
|
+
sameFailureRepairs: number;
|
|
48
|
+
groupRepairsUsed: number;
|
|
49
|
+
groupRepairBudget: number;
|
|
50
|
+
/**
|
|
51
|
+
* Что движок сделает с этой работой, когда продолжит задание графа
|
|
52
|
+
* (вычисляется тем же порядком решений, что `advance`): `retry` —
|
|
53
|
+
* назначит повтор, `wait` — сначала занят другим (разбор свойства,
|
|
54
|
+
* другое поручение группы), `stop` — автоматического действия нет.
|
|
55
|
+
* Не задано — решение выводится из счётчиков.
|
|
56
|
+
*/
|
|
57
|
+
outlook?: 'retry' | 'wait' | 'stop';
|
|
58
|
+
};
|
|
59
|
+
control: {
|
|
60
|
+
paused: boolean;
|
|
61
|
+
pauseReason?: PauseReason;
|
|
62
|
+
pauseFailures?: FailureKind[];
|
|
63
|
+
};
|
|
64
|
+
phase?: StopPhase;
|
|
65
|
+
runId?: string;
|
|
66
|
+
evidence?: EvidenceLink[];
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'error';
|
|
69
|
+
error: {
|
|
70
|
+
code: ErrorCode;
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'runtime';
|
|
75
|
+
runtime: {
|
|
76
|
+
runtime: string;
|
|
77
|
+
available: boolean;
|
|
78
|
+
reason?: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export interface StopDiagnosis {
|
|
82
|
+
code: ErrorCode;
|
|
83
|
+
cause: StopCause;
|
|
84
|
+
phase: StopPhase;
|
|
85
|
+
actor: Actor;
|
|
86
|
+
action: NextAction;
|
|
87
|
+
retryPlanned: boolean;
|
|
88
|
+
message: string;
|
|
89
|
+
evidence: EvidenceLink[];
|
|
90
|
+
workId?: string;
|
|
91
|
+
runId?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Объяснение остановки (OP-DIAG-05): только чтение, ничего не планирует.
|
|
95
|
+
* Класс отказа берётся из сохранённого `failureKind` — текст ошибки здесь не
|
|
96
|
+
* разбирается и не переклассифицируется (исторический `unknown` остаётся им).
|
|
97
|
+
*/
|
|
98
|
+
export declare function explainStop(input: StopInput): StopDiagnosis;
|