@gpustack/loopwright 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +356 -2
- package/bin/loopwright.js +3 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter-v2.d.ts +9 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter-v2.js +122 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter.d.ts +30 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter.js +340 -0
- package/node_modules/@loopwright/agent-pi/dist/admission.d.ts +25 -0
- package/node_modules/@loopwright/agent-pi/dist/admission.js +65 -0
- package/node_modules/@loopwright/agent-pi/dist/artifacts.d.ts +15 -0
- package/node_modules/@loopwright/agent-pi/dist/artifacts.js +76 -0
- package/node_modules/@loopwright/agent-pi/dist/boundary.d.ts +18 -0
- package/node_modules/@loopwright/agent-pi/dist/boundary.js +113 -0
- package/node_modules/@loopwright/agent-pi/dist/broker-channel.d.ts +4 -0
- package/node_modules/@loopwright/agent-pi/dist/broker-channel.js +121 -0
- package/node_modules/@loopwright/agent-pi/dist/candidate.d.ts +96 -0
- package/node_modules/@loopwright/agent-pi/dist/candidate.js +1712 -0
- package/node_modules/@loopwright/agent-pi/dist/capture.d.ts +39 -0
- package/node_modules/@loopwright/agent-pi/dist/capture.js +146 -0
- package/node_modules/@loopwright/agent-pi/dist/cas.d.ts +51 -0
- package/node_modules/@loopwright/agent-pi/dist/cas.js +836 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog-api.d.ts +3 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog-api.js +2 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog.d.ts +39 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog.js +280 -0
- package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.d.ts +9 -0
- package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.js +12 -0
- package/node_modules/@loopwright/agent-pi/dist/containers.d.ts +29 -0
- package/node_modules/@loopwright/agent-pi/dist/containers.js +160 -0
- package/node_modules/@loopwright/agent-pi/dist/context.d.ts +56 -0
- package/node_modules/@loopwright/agent-pi/dist/context.js +351 -0
- package/node_modules/@loopwright/agent-pi/dist/daemon.d.ts +8 -0
- package/node_modules/@loopwright/agent-pi/dist/daemon.js +52 -0
- package/node_modules/@loopwright/agent-pi/dist/deadline.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/deadline.js +18 -0
- package/node_modules/@loopwright/agent-pi/dist/decode-capture.d.ts +39 -0
- package/node_modules/@loopwright/agent-pi/dist/decode-capture.js +287 -0
- package/node_modules/@loopwright/agent-pi/dist/descriptor.d.ts +12 -0
- package/node_modules/@loopwright/agent-pi/dist/descriptor.js +17 -0
- package/node_modules/@loopwright/agent-pi/dist/docker-absence.d.ts +2 -0
- package/node_modules/@loopwright/agent-pi/dist/docker-absence.js +9 -0
- package/node_modules/@loopwright/agent-pi/dist/errors.d.ts +7 -0
- package/node_modules/@loopwright/agent-pi/dist/errors.js +19 -0
- package/node_modules/@loopwright/agent-pi/dist/event-sequence.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/event-sequence.js +64 -0
- package/node_modules/@loopwright/agent-pi/dist/events.d.ts +19 -0
- package/node_modules/@loopwright/agent-pi/dist/events.js +132 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-guard.d.ts +9 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-guard.js +25 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-lease.d.ts +24 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-lease.js +316 -0
- package/node_modules/@loopwright/agent-pi/dist/execution.d.ts +32 -0
- package/node_modules/@loopwright/agent-pi/dist/execution.js +476 -0
- package/node_modules/@loopwright/agent-pi/dist/external-mcp.d.ts +87 -0
- package/node_modules/@loopwright/agent-pi/dist/external-mcp.js +526 -0
- package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.d.ts +15 -0
- package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.js +74 -0
- package/node_modules/@loopwright/agent-pi/dist/host-session.d.ts +51 -0
- package/node_modules/@loopwright/agent-pi/dist/host-session.js +2083 -0
- package/node_modules/@loopwright/agent-pi/dist/http-mcp.d.ts +32 -0
- package/node_modules/@loopwright/agent-pi/dist/http-mcp.js +353 -0
- package/node_modules/@loopwright/agent-pi/dist/index.d.ts +7 -0
- package/node_modules/@loopwright/agent-pi/dist/index.js +4 -0
- package/node_modules/@loopwright/agent-pi/dist/lifecycle.d.ts +13 -0
- package/node_modules/@loopwright/agent-pi/dist/lifecycle.js +11 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-process.d.ts +35 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-process.js +92 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-transport.d.ts +25 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-transport.js +63 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp.d.ts +23 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp.js +212 -0
- package/node_modules/@loopwright/agent-pi/dist/operation.d.ts +5 -0
- package/node_modules/@loopwright/agent-pi/dist/operation.js +28 -0
- package/node_modules/@loopwright/agent-pi/dist/policy-v2.d.ts +10 -0
- package/node_modules/@loopwright/agent-pi/dist/policy-v2.js +64 -0
- package/node_modules/@loopwright/agent-pi/dist/policy.d.ts +13 -0
- package/node_modules/@loopwright/agent-pi/dist/policy.js +260 -0
- package/node_modules/@loopwright/agent-pi/dist/preflight.d.ts +60 -0
- package/node_modules/@loopwright/agent-pi/dist/preflight.js +700 -0
- package/node_modules/@loopwright/agent-pi/dist/progress-summary.d.ts +1 -0
- package/node_modules/@loopwright/agent-pi/dist/progress-summary.js +119 -0
- package/node_modules/@loopwright/agent-pi/dist/protocol.d.ts +17 -0
- package/node_modules/@loopwright/agent-pi/dist/protocol.js +131 -0
- package/node_modules/@loopwright/agent-pi/dist/provider.d.ts +62 -0
- package/node_modules/@loopwright/agent-pi/dist/provider.js +217 -0
- package/node_modules/@loopwright/agent-pi/dist/receipt.d.ts +3 -0
- package/node_modules/@loopwright/agent-pi/dist/receipt.js +64 -0
- package/node_modules/@loopwright/agent-pi/dist/recovery.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/recovery.js +188 -0
- package/node_modules/@loopwright/agent-pi/dist/resources.d.ts +13 -0
- package/node_modules/@loopwright/agent-pi/dist/resources.js +81 -0
- package/node_modules/@loopwright/agent-pi/dist/response.d.ts +20 -0
- package/node_modules/@loopwright/agent-pi/dist/response.js +259 -0
- package/node_modules/@loopwright/agent-pi/dist/runtime-profile.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/runtime-profile.js +37 -0
- package/node_modules/@loopwright/agent-pi/dist/sdk-worker.d.ts +14 -0
- package/node_modules/@loopwright/agent-pi/dist/sdk-worker.js +633 -0
- package/node_modules/@loopwright/agent-pi/dist/sender.d.ts +46 -0
- package/node_modules/@loopwright/agent-pi/dist/sender.js +553 -0
- package/node_modules/@loopwright/agent-pi/dist/session-host.d.ts +21 -0
- package/node_modules/@loopwright/agent-pi/dist/session-host.js +315 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.d.ts +14 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.js +102 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot.d.ts +19 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot.js +121 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-process.d.ts +32 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-process.js +85 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-worker.d.ts +2 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-worker.js +105 -0
- package/node_modules/@loopwright/agent-pi/dist/tools.d.ts +36 -0
- package/node_modules/@loopwright/agent-pi/dist/tools.js +128 -0
- package/node_modules/@loopwright/agent-pi/dist/types-v2.d.ts +71 -0
- package/node_modules/@loopwright/agent-pi/dist/types-v2.js +1 -0
- package/node_modules/@loopwright/agent-pi/dist/types.d.ts +314 -0
- package/node_modules/@loopwright/agent-pi/dist/types.js +1 -0
- package/node_modules/@loopwright/agent-pi/dist/usage.d.ts +18 -0
- package/node_modules/@loopwright/agent-pi/dist/usage.js +314 -0
- package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.d.ts +27 -0
- package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.js +142 -0
- package/node_modules/@loopwright/agent-pi/package.json +24 -0
- package/node_modules/@loopwright/agent-pi/runtime/Dockerfile +8 -0
- package/node_modules/@loopwright/agent-pi/runtime/seccomp.json +1 -0
- package/node_modules/@loopwright/cli/dist/arguments.d.ts +19 -0
- package/node_modules/@loopwright/cli/dist/arguments.js +358 -0
- package/node_modules/@loopwright/cli/dist/closure.d.ts +93 -0
- package/node_modules/@loopwright/cli/dist/closure.js +230 -0
- package/node_modules/@loopwright/cli/dist/draft.d.ts +9 -0
- package/node_modules/@loopwright/cli/dist/draft.js +106 -0
- package/node_modules/@loopwright/cli/dist/failure-matrix.d.ts +9 -0
- package/node_modules/@loopwright/cli/dist/failure-matrix.js +701 -0
- package/node_modules/@loopwright/cli/dist/index.d.ts +6 -0
- package/node_modules/@loopwright/cli/dist/index.js +5 -0
- package/node_modules/@loopwright/cli/dist/main.d.ts +22 -0
- package/node_modules/@loopwright/cli/dist/main.js +1855 -0
- package/node_modules/@loopwright/cli/package.json +16 -0
- package/node_modules/@loopwright/controller/dist/acceptance.d.ts +43 -0
- package/node_modules/@loopwright/controller/dist/acceptance.js +446 -0
- package/node_modules/@loopwright/controller/dist/benchmark-gate.d.ts +273 -0
- package/node_modules/@loopwright/controller/dist/benchmark-gate.js +3147 -0
- package/node_modules/@loopwright/controller/dist/budget-observations.d.ts +25 -0
- package/node_modules/@loopwright/controller/dist/budget-observations.js +139 -0
- package/node_modules/@loopwright/controller/dist/bundle.d.ts +26 -0
- package/node_modules/@loopwright/controller/dist/bundle.js +64 -0
- package/node_modules/@loopwright/controller/dist/capture.d.ts +89 -0
- package/node_modules/@loopwright/controller/dist/capture.js +587 -0
- package/node_modules/@loopwright/controller/dist/compile.d.ts +3 -0
- package/node_modules/@loopwright/controller/dist/compile.js +402 -0
- package/node_modules/@loopwright/controller/dist/config.d.ts +22 -0
- package/node_modules/@loopwright/controller/dist/config.js +255 -0
- package/node_modules/@loopwright/controller/dist/controller.d.ts +177 -0
- package/node_modules/@loopwright/controller/dist/controller.js +2135 -0
- package/node_modules/@loopwright/controller/dist/credentials.d.ts +29 -0
- package/node_modules/@loopwright/controller/dist/credentials.js +189 -0
- package/node_modules/@loopwright/controller/dist/deadlines.d.ts +18 -0
- package/node_modules/@loopwright/controller/dist/deadlines.js +71 -0
- package/node_modules/@loopwright/controller/dist/errors.d.ts +27 -0
- package/node_modules/@loopwright/controller/dist/errors.js +41 -0
- package/node_modules/@loopwright/controller/dist/events.d.ts +52 -0
- package/node_modules/@loopwright/controller/dist/events.js +228 -0
- package/node_modules/@loopwright/controller/dist/files.d.ts +51 -0
- package/node_modules/@loopwright/controller/dist/files.js +386 -0
- package/node_modules/@loopwright/controller/dist/finalize.d.ts +25 -0
- package/node_modules/@loopwright/controller/dist/finalize.js +32 -0
- package/node_modules/@loopwright/controller/dist/gate.d.ts +84 -0
- package/node_modules/@loopwright/controller/dist/gate.js +640 -0
- package/node_modules/@loopwright/controller/dist/git-objects.d.ts +11 -0
- package/node_modules/@loopwright/controller/dist/git-objects.js +59 -0
- package/node_modules/@loopwright/controller/dist/git-reader.d.ts +17 -0
- package/node_modules/@loopwright/controller/dist/git-reader.js +40 -0
- package/node_modules/@loopwright/controller/dist/handlers.d.ts +6 -0
- package/node_modules/@loopwright/controller/dist/handlers.js +45 -0
- package/node_modules/@loopwright/controller/dist/handoff.d.ts +71 -0
- package/node_modules/@loopwright/controller/dist/handoff.js +554 -0
- package/node_modules/@loopwright/controller/dist/index.d.ts +41 -0
- package/node_modules/@loopwright/controller/dist/index.js +21 -0
- package/node_modules/@loopwright/controller/dist/inspect.d.ts +30 -0
- package/node_modules/@loopwright/controller/dist/inspect.js +372 -0
- package/node_modules/@loopwright/controller/dist/interpolation.d.ts +9 -0
- package/node_modules/@loopwright/controller/dist/interpolation.js +79 -0
- package/node_modules/@loopwright/controller/dist/ownership.d.ts +41 -0
- package/node_modules/@loopwright/controller/dist/ownership.js +666 -0
- package/node_modules/@loopwright/controller/dist/parser.d.ts +5 -0
- package/node_modules/@loopwright/controller/dist/parser.js +200 -0
- package/node_modules/@loopwright/controller/dist/progress.d.ts +41 -0
- package/node_modules/@loopwright/controller/dist/progress.js +904 -0
- package/node_modules/@loopwright/controller/dist/publication.d.ts +60 -0
- package/node_modules/@loopwright/controller/dist/publication.js +329 -0
- package/node_modules/@loopwright/controller/dist/reconcile.d.ts +26 -0
- package/node_modules/@loopwright/controller/dist/reconcile.js +1378 -0
- package/node_modules/@loopwright/controller/dist/recovery.d.ts +10 -0
- package/node_modules/@loopwright/controller/dist/recovery.js +315 -0
- package/node_modules/@loopwright/controller/dist/refusal-record.d.ts +43 -0
- package/node_modules/@loopwright/controller/dist/refusal-record.js +150 -0
- package/node_modules/@loopwright/controller/dist/registry.d.ts +6 -0
- package/node_modules/@loopwright/controller/dist/registry.js +374 -0
- package/node_modules/@loopwright/controller/dist/repair.d.ts +31 -0
- package/node_modules/@loopwright/controller/dist/repair.js +102 -0
- package/node_modules/@loopwright/controller/dist/report.d.ts +64 -0
- package/node_modules/@loopwright/controller/dist/report.js +596 -0
- package/node_modules/@loopwright/controller/dist/retained.d.ts +284 -0
- package/node_modules/@loopwright/controller/dist/retained.js +193 -0
- package/node_modules/@loopwright/controller/dist/rules.d.ts +31 -0
- package/node_modules/@loopwright/controller/dist/rules.js +110 -0
- package/node_modules/@loopwright/controller/dist/run-eval.d.ts +115 -0
- package/node_modules/@loopwright/controller/dist/run-eval.js +959 -0
- package/node_modules/@loopwright/controller/dist/scheduler.d.ts +10 -0
- package/node_modules/@loopwright/controller/dist/scheduler.js +41 -0
- package/node_modules/@loopwright/controller/dist/schema.d.ts +17 -0
- package/node_modules/@loopwright/controller/dist/schema.js +78 -0
- package/node_modules/@loopwright/controller/dist/source.d.ts +69 -0
- package/node_modules/@loopwright/controller/dist/source.js +872 -0
- package/node_modules/@loopwright/controller/dist/step.d.ts +38 -0
- package/node_modules/@loopwright/controller/dist/step.js +1776 -0
- package/node_modules/@loopwright/controller/dist/storage.d.ts +90 -0
- package/node_modules/@loopwright/controller/dist/storage.js +1345 -0
- package/node_modules/@loopwright/controller/dist/submission.d.ts +51 -0
- package/node_modules/@loopwright/controller/dist/submission.js +292 -0
- package/node_modules/@loopwright/controller/dist/types.d.ts +585 -0
- package/node_modules/@loopwright/controller/dist/types.js +9 -0
- package/node_modules/@loopwright/controller/dist/verification.d.ts +124 -0
- package/node_modules/@loopwright/controller/dist/verification.js +1308 -0
- package/node_modules/@loopwright/controller/dist/verifier-protocol.d.ts +105 -0
- package/node_modules/@loopwright/controller/dist/verifier-protocol.js +1312 -0
- package/node_modules/@loopwright/controller/dist/verifier-worker.d.ts +1 -0
- package/node_modules/@loopwright/controller/dist/verifier-worker.js +33 -0
- package/node_modules/@loopwright/controller/package.json +12 -0
- package/node_modules/@loopwright/core/dist/acceptance.d.ts +108 -0
- package/node_modules/@loopwright/core/dist/acceptance.js +327 -0
- package/node_modules/@loopwright/core/dist/artifacts.d.ts +63 -0
- package/node_modules/@loopwright/core/dist/artifacts.js +356 -0
- package/node_modules/@loopwright/core/dist/boundary.d.ts +21 -0
- package/node_modules/@loopwright/core/dist/boundary.js +484 -0
- package/node_modules/@loopwright/core/dist/contracts.d.ts +287 -0
- package/node_modules/@loopwright/core/dist/contracts.js +694 -0
- package/node_modules/@loopwright/core/dist/diagnostics.d.ts +21 -0
- package/node_modules/@loopwright/core/dist/diagnostics.js +51 -0
- package/node_modules/@loopwright/core/dist/evidence.d.ts +92 -0
- package/node_modules/@loopwright/core/dist/evidence.js +85 -0
- package/node_modules/@loopwright/core/dist/graph.d.ts +8 -0
- package/node_modules/@loopwright/core/dist/graph.js +44 -0
- package/node_modules/@loopwright/core/dist/identity.d.ts +162 -0
- package/node_modules/@loopwright/core/dist/identity.js +80 -0
- package/node_modules/@loopwright/core/dist/index.d.ts +30 -0
- package/node_modules/@loopwright/core/dist/index.js +39 -0
- package/node_modules/@loopwright/core/dist/limits.d.ts +99 -0
- package/node_modules/@loopwright/core/dist/limits.js +59 -0
- package/node_modules/@loopwright/core/dist/results.d.ts +161 -0
- package/node_modules/@loopwright/core/dist/results.js +98 -0
- package/node_modules/@loopwright/core/dist/scope.d.ts +13 -0
- package/node_modules/@loopwright/core/dist/scope.js +154 -0
- package/node_modules/@loopwright/core/dist/scrubber.d.ts +13 -0
- package/node_modules/@loopwright/core/dist/scrubber.js +63 -0
- package/node_modules/@loopwright/core/dist/usage.d.ts +68 -0
- package/node_modules/@loopwright/core/dist/usage.js +56 -0
- package/node_modules/@loopwright/core/package.json +12 -0
- package/node_modules/@loopwright/decisions/dist/benchmark.d.ts +23 -0
- package/node_modules/@loopwright/decisions/dist/benchmark.js +337 -0
- package/node_modules/@loopwright/decisions/dist/client.d.ts +74 -0
- package/node_modules/@loopwright/decisions/dist/client.js +292 -0
- package/node_modules/@loopwright/decisions/dist/index.d.ts +15 -0
- package/node_modules/@loopwright/decisions/dist/index.js +8 -0
- package/node_modules/@loopwright/decisions/dist/nodes.d.ts +63 -0
- package/node_modules/@loopwright/decisions/dist/nodes.js +282 -0
- package/node_modules/@loopwright/decisions/dist/primitives.d.ts +36 -0
- package/node_modules/@loopwright/decisions/dist/primitives.js +300 -0
- package/node_modules/@loopwright/decisions/dist/redaction.d.ts +23 -0
- package/node_modules/@loopwright/decisions/dist/redaction.js +146 -0
- package/node_modules/@loopwright/decisions/dist/router.d.ts +55 -0
- package/node_modules/@loopwright/decisions/dist/router.js +248 -0
- package/node_modules/@loopwright/decisions/dist/schema.d.ts +25 -0
- package/node_modules/@loopwright/decisions/dist/schema.js +536 -0
- package/node_modules/@loopwright/decisions/dist/types.d.ts +394 -0
- package/node_modules/@loopwright/decisions/dist/types.js +80 -0
- package/node_modules/@loopwright/decisions/package.json +12 -0
- package/node_modules/@loopwright/github-app/dist/action.d.ts +90 -0
- package/node_modules/@loopwright/github-app/dist/action.js +2429 -0
- package/node_modules/@loopwright/github-app/dist/config.d.ts +23 -0
- package/node_modules/@loopwright/github-app/dist/config.js +297 -0
- package/node_modules/@loopwright/github-app/dist/digests.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/digests.js +1 -0
- package/node_modules/@loopwright/github-app/dist/index.d.ts +14 -0
- package/node_modules/@loopwright/github-app/dist/index.js +13 -0
- package/node_modules/@loopwright/github-app/dist/models-config.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/models-config.js +1 -0
- package/node_modules/@loopwright/github-app/dist/output-format.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/output-format.js +1 -0
- package/node_modules/@loopwright/github-app/dist/preflight.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/preflight.js +1 -0
- package/node_modules/@loopwright/github-app/dist/publisher.d.ts +58 -0
- package/node_modules/@loopwright/github-app/dist/publisher.js +1368 -0
- package/node_modules/@loopwright/github-app/dist/qualification.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/qualification.js +1 -0
- package/node_modules/@loopwright/github-app/dist/sandbox.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/sandbox.js +1 -0
- package/node_modules/@loopwright/github-app/dist/schema.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/schema.js +1 -0
- package/node_modules/@loopwright/github-app/dist/service.d.ts +52 -0
- package/node_modules/@loopwright/github-app/dist/service.js +1658 -0
- package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.d.ts +90 -0
- package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.js +392 -0
- package/node_modules/@loopwright/github-app/dist/taskpack.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/taskpack.js +1 -0
- package/node_modules/@loopwright/github-app/dist/tenant-queue.d.ts +44 -0
- package/node_modules/@loopwright/github-app/dist/tenant-queue.js +423 -0
- package/node_modules/@loopwright/github-app/dist/token-broker.d.ts +50 -0
- package/node_modules/@loopwright/github-app/dist/token-broker.js +262 -0
- package/node_modules/@loopwright/github-app/dist/turnkey-memory.d.ts +35 -0
- package/node_modules/@loopwright/github-app/dist/turnkey-memory.js +1654 -0
- package/node_modules/@loopwright/github-app/dist/turnkey.d.ts +16 -0
- package/node_modules/@loopwright/github-app/dist/turnkey.js +34 -0
- package/node_modules/@loopwright/github-app/dist/types.d.ts +220 -0
- package/node_modules/@loopwright/github-app/dist/types.js +14 -0
- package/node_modules/@loopwright/github-app/dist/upstreams.d.ts +13 -0
- package/node_modules/@loopwright/github-app/dist/upstreams.js +65 -0
- package/node_modules/@loopwright/github-app/dist/webhook.d.ts +34 -0
- package/node_modules/@loopwright/github-app/dist/webhook.js +241 -0
- package/node_modules/@loopwright/github-app/dist/yaml.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/yaml.js +1 -0
- package/node_modules/@loopwright/github-app/package.json +12 -0
- package/node_modules/@loopwright/hardware-runner/dist/config.d.ts +48 -0
- package/node_modules/@loopwright/hardware-runner/dist/config.js +719 -0
- package/node_modules/@loopwright/hardware-runner/dist/evaluator.d.ts +230 -0
- package/node_modules/@loopwright/hardware-runner/dist/evaluator.js +3178 -0
- package/node_modules/@loopwright/hardware-runner/dist/index.d.ts +13 -0
- package/node_modules/@loopwright/hardware-runner/dist/index.js +9 -0
- package/node_modules/@loopwright/hardware-runner/dist/provenance.d.ts +128 -0
- package/node_modules/@loopwright/hardware-runner/dist/provenance.js +1500 -0
- package/node_modules/@loopwright/hardware-runner/dist/queue.d.ts +81 -0
- package/node_modules/@loopwright/hardware-runner/dist/queue.js +1081 -0
- package/node_modules/@loopwright/hardware-runner/dist/relay-server.d.ts +13 -0
- package/node_modules/@loopwright/hardware-runner/dist/relay-server.js +2997 -0
- package/node_modules/@loopwright/hardware-runner/dist/types.d.ts +239 -0
- package/node_modules/@loopwright/hardware-runner/dist/types.js +12 -0
- package/node_modules/@loopwright/hardware-runner/dist/worker.d.ts +49 -0
- package/node_modules/@loopwright/hardware-runner/dist/worker.js +1646 -0
- package/node_modules/@loopwright/hardware-runner/package.json +12 -0
- package/node_modules/@loopwright/memory/dist/cas.d.ts +21 -0
- package/node_modules/@loopwright/memory/dist/cas.js +510 -0
- package/node_modules/@loopwright/memory/dist/compaction.d.ts +18 -0
- package/node_modules/@loopwright/memory/dist/compaction.js +110 -0
- package/node_modules/@loopwright/memory/dist/finalizer.d.ts +23 -0
- package/node_modules/@loopwright/memory/dist/finalizer.js +538 -0
- package/node_modules/@loopwright/memory/dist/index.d.ts +9 -0
- package/node_modules/@loopwright/memory/dist/index.js +8 -0
- package/node_modules/@loopwright/memory/dist/schema.d.ts +36 -0
- package/node_modules/@loopwright/memory/dist/schema.js +510 -0
- package/node_modules/@loopwright/memory/dist/selector.d.ts +7 -0
- package/node_modules/@loopwright/memory/dist/selector.js +157 -0
- package/node_modules/@loopwright/memory/dist/store.d.ts +51 -0
- package/node_modules/@loopwright/memory/dist/store.js +554 -0
- package/node_modules/@loopwright/memory/dist/types.d.ts +442 -0
- package/node_modules/@loopwright/memory/dist/types.js +8 -0
- package/node_modules/@loopwright/memory/dist/verifier.d.ts +5 -0
- package/node_modules/@loopwright/memory/dist/verifier.js +328 -0
- package/node_modules/@loopwright/memory/package.json +12 -0
- package/node_modules/@loopwright/state/dist/admission.d.ts +321 -0
- package/node_modules/@loopwright/state/dist/admission.js +199 -0
- package/node_modules/@loopwright/state/dist/boundary.d.ts +53 -0
- package/node_modules/@loopwright/state/dist/boundary.js +194 -0
- package/node_modules/@loopwright/state/dist/checkpoint.d.ts +16 -0
- package/node_modules/@loopwright/state/dist/checkpoint.js +84 -0
- package/node_modules/@loopwright/state/dist/clock.d.ts +8 -0
- package/node_modules/@loopwright/state/dist/clock.js +27 -0
- package/node_modules/@loopwright/state/dist/connection.d.ts +55 -0
- package/node_modules/@loopwright/state/dist/connection.js +391 -0
- package/node_modules/@loopwright/state/dist/errors.d.ts +13 -0
- package/node_modules/@loopwright/state/dist/errors.js +34 -0
- package/node_modules/@loopwright/state/dist/index.d.ts +3 -0
- package/node_modules/@loopwright/state/dist/index.js +1 -0
- package/node_modules/@loopwright/state/dist/journal.d.ts +119 -0
- package/node_modules/@loopwright/state/dist/journal.js +72 -0
- package/node_modules/@loopwright/state/dist/model.d.ts +40 -0
- package/node_modules/@loopwright/state/dist/model.js +58 -0
- package/node_modules/@loopwright/state/dist/ownership.d.ts +14 -0
- package/node_modules/@loopwright/state/dist/ownership.js +45 -0
- package/node_modules/@loopwright/state/dist/pages.d.ts +11 -0
- package/node_modules/@loopwright/state/dist/pages.js +41 -0
- package/node_modules/@loopwright/state/dist/receipts.d.ts +33 -0
- package/node_modules/@loopwright/state/dist/receipts.js +97 -0
- package/node_modules/@loopwright/state/dist/schema.d.ts +28 -0
- package/node_modules/@loopwright/state/dist/schema.js +41 -0
- package/node_modules/@loopwright/state/dist/settlement.d.ts +10 -0
- package/node_modules/@loopwright/state/dist/settlement.js +129 -0
- package/node_modules/@loopwright/state/dist/store.d.ts +52 -0
- package/node_modules/@loopwright/state/dist/store.js +100 -0
- package/node_modules/@loopwright/state/dist/types.d.ts +315 -0
- package/node_modules/@loopwright/state/dist/types.js +1 -0
- package/node_modules/@loopwright/state/package.json +12 -0
- package/node_modules/@loopwright/taskpack/dist/baseline-align.d.ts +195 -0
- package/node_modules/@loopwright/taskpack/dist/baseline-align.js +1847 -0
- package/node_modules/@loopwright/taskpack/dist/digests.d.ts +61 -0
- package/node_modules/@loopwright/taskpack/dist/digests.js +715 -0
- package/node_modules/@loopwright/taskpack/dist/index.d.ts +18 -0
- package/node_modules/@loopwright/taskpack/dist/index.js +17 -0
- package/node_modules/@loopwright/taskpack/dist/models-config.d.ts +112 -0
- package/node_modules/@loopwright/taskpack/dist/models-config.js +1026 -0
- package/node_modules/@loopwright/taskpack/dist/output-format.d.ts +28 -0
- package/node_modules/@loopwright/taskpack/dist/output-format.js +157 -0
- package/node_modules/@loopwright/taskpack/dist/preflight.d.ts +130 -0
- package/node_modules/@loopwright/taskpack/dist/preflight.js +1497 -0
- package/node_modules/@loopwright/taskpack/dist/qualification.d.ts +23 -0
- package/node_modules/@loopwright/taskpack/dist/qualification.js +120 -0
- package/node_modules/@loopwright/taskpack/dist/sandbox.d.ts +121 -0
- package/node_modules/@loopwright/taskpack/dist/sandbox.js +2605 -0
- package/node_modules/@loopwright/taskpack/dist/schema.d.ts +197 -0
- package/node_modules/@loopwright/taskpack/dist/schema.js +4189 -0
- package/node_modules/@loopwright/taskpack/dist/scrubber.d.ts +47 -0
- package/node_modules/@loopwright/taskpack/dist/scrubber.js +283 -0
- package/node_modules/@loopwright/taskpack/dist/suite.d.ts +124 -0
- package/node_modules/@loopwright/taskpack/dist/suite.js +3256 -0
- package/node_modules/@loopwright/taskpack/dist/taskpack.d.ts +154 -0
- package/node_modules/@loopwright/taskpack/dist/taskpack.js +3634 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey-memory.d.ts +122 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey-memory.js +483 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey.d.ts +437 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey.js +7313 -0
- package/node_modules/@loopwright/taskpack/dist/types.d.ts +1274 -0
- package/node_modules/@loopwright/taskpack/dist/types.js +99 -0
- package/node_modules/@loopwright/taskpack/dist/upstreams.d.ts +261 -0
- package/node_modules/@loopwright/taskpack/dist/upstreams.js +2242 -0
- package/node_modules/@loopwright/taskpack/dist/yaml.d.ts +18 -0
- package/node_modules/@loopwright/taskpack/dist/yaml.js +167 -0
- package/node_modules/@loopwright/taskpack/package.json +12 -0
- package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.d.ts +137 -0
- package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.js +474 -0
- package/node_modules/@loopwright/taskpack-runner/dist/corpus.d.ts +8 -0
- package/node_modules/@loopwright/taskpack-runner/dist/corpus.js +129 -0
- package/node_modules/@loopwright/taskpack-runner/dist/index.d.ts +13 -0
- package/node_modules/@loopwright/taskpack-runner/dist/index.js +7 -0
- package/node_modules/@loopwright/taskpack-runner/dist/intake.d.ts +149 -0
- package/node_modules/@loopwright/taskpack-runner/dist/intake.js +135 -0
- package/node_modules/@loopwright/taskpack-runner/dist/parity.d.ts +130 -0
- package/node_modules/@loopwright/taskpack-runner/dist/parity.js +927 -0
- package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.d.ts +68 -0
- package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.js +517 -0
- package/node_modules/@loopwright/taskpack-runner/dist/service.d.ts +149 -0
- package/node_modules/@loopwright/taskpack-runner/dist/service.js +1796 -0
- package/node_modules/@loopwright/taskpack-runner/dist/types.d.ts +29 -0
- package/node_modules/@loopwright/taskpack-runner/dist/types.js +11 -0
- package/node_modules/@loopwright/taskpack-runner/package.json +12 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/README.md +77 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/support-records.md +57 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/supported-runners.md +98 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/manifest.json +205 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/expand_matrix.sh +273 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/matrix.yaml +280 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/resolve_dockerfile.sh +24 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pyproject.toml +46 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/runtime_runner/runner.py.json +5270 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/discovery/legacy-support.md +86 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/github/service.py +401 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/analysis.json +95 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/ready.json +109 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_assemble.py +263 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_check_draft.py +333 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_checks.py +1099 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_discovery.py +817 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_proposal.py +658 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_publish.py +987 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_summary.py +107 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/agent.py +610 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/assemble.py +84 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/check_draft.py +94 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/checks.py +1002 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/discovery.py +789 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/model.py +557 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/progress.py +174 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/analysis.md +40 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/proposal.md +65 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/repair.md +17 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/proposal.py +903 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/publish.py +997 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/summary.py +131 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/tool-versions.json +133 -0
- package/node_modules/package-lock.json +3021 -0
- package/package-lock.json +3021 -0
- package/package.json +52 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ProgressHead } from './progress.js';
|
|
2
|
+
import { type ByteInventory } from './verification.js';
|
|
3
|
+
import { type CycleContext, type ControllerPorts, type RunCycleInput } from './controller.js';
|
|
4
|
+
import type { CycleExecution } from './types.js';
|
|
5
|
+
export declare function restoredCandidate(context: CycleContext, head: ProgressHead | null): Promise<ByteInventory>;
|
|
6
|
+
export declare function retainedPrimary(context: CycleContext, head: ProgressHead): Promise<CycleExecution>;
|
|
7
|
+
export declare function reconcileInterruptedOperations(context: CycleContext, head: ProgressHead | null, candidate: ByteInventory, storeId: string): Promise<void>;
|
|
8
|
+
export declare function resumeCycle(input: RunCycleInput): Promise<import("./errors.js").ControllerResult<CycleExecution>>;
|
|
9
|
+
/** Test observation ports are private; resume has the same production execution route as run. */
|
|
10
|
+
export declare function resumeCycleWithPorts(input: RunCycleInput, ports?: ControllerPorts): Promise<import("./errors.js").ControllerResult<CycleExecution>>;
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { join, resolve } from 'node:path';
|
|
2
|
+
import { validateDocument } from '@loopwright/core';
|
|
3
|
+
import { reopenLocalRun } from '@loopwright/state';
|
|
4
|
+
import { approvedState } from './config.js';
|
|
5
|
+
import { ControllerFailure, refuse, result } from './errors.js';
|
|
6
|
+
import { ControllerOwner } from './ownership.js';
|
|
7
|
+
import { admitRetainedRun, effectiveRunHostPolicy, hostProtectionFromPolicy, validatePortPolicyFields, validatePortsAgainstHostPolicy, } from './retained.js';
|
|
8
|
+
import { ArtifactStore, stateValue } from './storage.js';
|
|
9
|
+
import { assertCanonicalMinimalOverlay, overlayManifestBounds, restoreSource } from './source.js';
|
|
10
|
+
import { ProgressStore, journal } from './progress.js';
|
|
11
|
+
import { assertNoHostProtectedMutations, decodeCandidateCapture } from './capture.js';
|
|
12
|
+
import { ControllerEvents } from './events.js';
|
|
13
|
+
import { Finalizer } from './finalize.js';
|
|
14
|
+
import { parsePrivateJson } from './parser.js';
|
|
15
|
+
import { boundFindingsForObservations, hydrateStepVerdicts, normalizeSubmission } from './submission.js';
|
|
16
|
+
import { freeze, record, same, text } from './schema.js';
|
|
17
|
+
import { Verifier, prepareVerification } from './verification.js';
|
|
18
|
+
import { Gate, GATE_OUTPUT_BYTES, prepareGate, validateGateUrlOverrides } from './gate.js';
|
|
19
|
+
import { BenchmarkGate, BENCHMARK_OUTPUT_BYTES, collectPriorGenerationVerifierBudget, createRateLimitedProgress, prepareBenchmarkGate, sealBenchmarkBaseTreeBundle, } from './benchmark-gate.js';
|
|
20
|
+
import { Publication, preparePublication } from './publication.js';
|
|
21
|
+
import { countDelegatedBudgets } from './budget-observations.js';
|
|
22
|
+
import { executeCycleContext, isHaltedByVerdict } from './controller.js';
|
|
23
|
+
export async function restoredCandidate(context, head) {
|
|
24
|
+
if (!head || same(head.progress.candidate.workspace, context.source.workspace)) {
|
|
25
|
+
if (head && (!same(head.manifest, context.source.manifest) || !same(head.progress.candidate.workspace, context.source.workspace) || head.progress.candidate.privateSession !== null))
|
|
26
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
27
|
+
const bounds = overlayManifestBounds(context.plan.budgets.overlay);
|
|
28
|
+
return { manifest: context.source.manifest, ref: head?.progress.candidate.manifest ?? await context.artifacts.json('manifest', context.source.manifest, bounds.manifestMaxBytes), files: context.source.artifacts, baselineProofs: context.source.baselineProofs };
|
|
29
|
+
}
|
|
30
|
+
const attempt = [...head.progress.attempts].reverse().find(item => item.finished?.nativeCheckpointId && same(journal(context.store).checkpoints.find(cp => cp.checkpointId === item.finished.nativeCheckpointId)?.workspace, head.progress.candidate.workspace));
|
|
31
|
+
if (!attempt)
|
|
32
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
33
|
+
const checkpoint = stateValue(context.store.getCheckpoint(attempt.finished.nativeCheckpointId));
|
|
34
|
+
const interval = journal(context.store).requests.filter(row => row.sequence > attempt.before.requests && row.sequence <= attempt.finished.after.requests);
|
|
35
|
+
const decoded = await decodeCandidateCapture({
|
|
36
|
+
artifacts: context.artifacts,
|
|
37
|
+
artifactsDirectory: context.artifacts.directory,
|
|
38
|
+
source: context.source,
|
|
39
|
+
lock: context.lock,
|
|
40
|
+
plan: context.plan,
|
|
41
|
+
checkpoint,
|
|
42
|
+
attempt,
|
|
43
|
+
expectedManifest: head.manifest,
|
|
44
|
+
requestIds: interval.map(row => row.admission.requestId),
|
|
45
|
+
phase: 'recovery',
|
|
46
|
+
});
|
|
47
|
+
await assertCanonicalMinimalOverlay(head.manifest, decoded.artifacts, context.source, 'recovery');
|
|
48
|
+
const effectivePolicy = effectiveRunHostPolicy(context.descriptor);
|
|
49
|
+
assertNoHostProtectedMutations(head.manifest, decoded.artifacts, context.source, hostProtectionFromPolicy(effectivePolicy), 'recovery');
|
|
50
|
+
return { manifest: head.manifest, ref: head.progress.candidate.manifest, files: decoded.artifacts, baselineProofs: context.source.baselineProofs };
|
|
51
|
+
}
|
|
52
|
+
export async function retainedPrimary(context, head) {
|
|
53
|
+
const intent = head.progress.terminalIntent;
|
|
54
|
+
if (!intent?.result)
|
|
55
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
56
|
+
const raw = parsePrivateJson(await context.artifacts.read(intent.result, 1048576), 1048576);
|
|
57
|
+
let complete = head.progress.stage.kind === 'terminal_observations' || head.progress.stage.kind === 'reconcile_result', observations = intent.observations;
|
|
58
|
+
if (observations)
|
|
59
|
+
await context.artifacts.read(observations, 1048576);
|
|
60
|
+
const checked = validateDocument(raw, 'RunResult');
|
|
61
|
+
const storedVerdicts = head.progress.stepVerdicts ?? [];
|
|
62
|
+
const finalVerdicts = checked.ok ? await hydrateStepVerdicts(context.artifacts, storedVerdicts).catch(() => []) : [];
|
|
63
|
+
const finalFindings = finalVerdicts.flatMap(item => item.verdict.findings);
|
|
64
|
+
if (!complete && checked.ok) {
|
|
65
|
+
const finalizer = new Finalizer(context.artifacts, Math.max(stateValue(context.store.inspect()).clock.remainingTaskMs.safeValue ?? 0, 15000));
|
|
66
|
+
let events = null;
|
|
67
|
+
try {
|
|
68
|
+
events = new ControllerEvents(context.store, context.artifacts, context.onEvent, () => { }, head.progress.eventSequence, true);
|
|
69
|
+
await events.ready();
|
|
70
|
+
if (!events.hasTerminal)
|
|
71
|
+
await events.push('terminal', null);
|
|
72
|
+
let current = head;
|
|
73
|
+
if (current.progress.stage.kind === 'terminal_intent') {
|
|
74
|
+
finalizer.reserve(65536 + 65536 + 40960);
|
|
75
|
+
current = await context.progress.publish({ ...current.progress, eventSequence: events.sequence, stage: { ...current.progress.stage, kind: 'terminal_result' } }, 'terminal.result');
|
|
76
|
+
}
|
|
77
|
+
const eventsRef = await events.close();
|
|
78
|
+
finalizer.check();
|
|
79
|
+
const boundedFindings = boundFindingsForObservations(finalFindings);
|
|
80
|
+
observations = await finalizer.put('observations', { version: 1, primary: intent.result, requestedStatus: null, diagnostic: null, requestedStatusSource: 'unavailable', selectedNoChangeCheck: context.plan.noChangeEligibility.checkId,
|
|
81
|
+
contradictions: [], verifierMatrix: null, verification: checked.value.spec.verification, preflightRefusals: null, events: eventsRef, cleanup: 'complete', memory: { status: 'not_requested', reason: null },
|
|
82
|
+
publication: head.progress.publication.status === 'confirmed' ? { status: 'confirmed', reason: null, receipt: head.progress.publication.receipt } : head.progress.publication.status === 'failed' ? { status: 'failed', reason: 'not_executed', receipt: head.progress.publication.receipt } : head.progress.publication.status === 'unresolved' || head.progress.publication.status === 'pending' ? { status: 'unresolved', reason: 'unresolved', receipt: null } : { status: 'not_run', reason: 'disabled', receipt: null },
|
|
83
|
+
...(storedVerdicts.length > 0 ? { stepVerdicts: storedVerdicts } : {}),
|
|
84
|
+
...(boundedFindings.findings.length > 0 ? { findings: boundedFindings.findings } : {}),
|
|
85
|
+
...(boundedFindings.findingsTruncated ? { findingsTruncated: true, totalFindingsCount: boundedFindings.totalFindingsCount } : {}),
|
|
86
|
+
unavailable: ['requestedStatus', 'contradictions', 'verifierMatrix', 'preflightRefusals'], recoveredOriginalPrimary: true });
|
|
87
|
+
finalizer.reserve(65536 + 65536 + 40960);
|
|
88
|
+
await context.progress.publish({ ...current.progress, eventSequence: events.sequence, stage: { ...current.progress.stage, kind: 'terminal_observations' }, terminalIntent: { ...intent, observations } }, 'terminal.observations');
|
|
89
|
+
complete = true;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
observations = intent.observations;
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
if (events)
|
|
96
|
+
await events.close().catch(() => { });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (checked.ok) {
|
|
100
|
+
if (!same(checked.value.spec.subject.lockHash, context.lock.spec.lockHash) || checked.value.spec.status !== intent.primary)
|
|
101
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
102
|
+
return freeze({
|
|
103
|
+
kind: 'result',
|
|
104
|
+
version: 1,
|
|
105
|
+
runId: context.lock.spec.runId,
|
|
106
|
+
result: checked.value,
|
|
107
|
+
observations,
|
|
108
|
+
secondary: complete ? [] : ['RECOVERY_REQUIRED'],
|
|
109
|
+
...(finalFindings.length > 0 ? { findings: freeze(finalFindings) } : {}),
|
|
110
|
+
...(finalVerdicts.length > 0 ? { stepVerdicts: freeze([...finalVerdicts]) } : {}),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const incident = record(raw, ['version', 'code', 'runId', 'lockHash', 'stage', 'knownReferences', 'unavailable', 'cleanup']);
|
|
114
|
+
if (incident.version !== 1 || incident.runId !== context.lock.spec.runId || !same(incident.lockHash, context.lock.spec.lockHash) || incident.code !== intent.primary)
|
|
115
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
116
|
+
return freeze({ kind: 'incident', version: 1, incident: incident });
|
|
117
|
+
}
|
|
118
|
+
export async function reconcileInterruptedOperations(context, head, candidate, storeId) {
|
|
119
|
+
const { plan, lock, store, authority, artifacts, loaded, source, descriptor, ports } = context;
|
|
120
|
+
if (head?.progress.stage.kind === 'verifier_pre') {
|
|
121
|
+
const row = head.progress.verifierReceipts.find(item => item.generation === head.progress.candidate.generation && item.receipt === null);
|
|
122
|
+
if (row) {
|
|
123
|
+
const operation = store.getOperation(row.operationId);
|
|
124
|
+
if (operation.ok && operation.value.dispatch !== null) {
|
|
125
|
+
const slot = plan.verifierSlots.find(item => item.id === row.slot), subject = head.checkpoint.subject;
|
|
126
|
+
if (slot.handler.implementation === 'gate.v1') {
|
|
127
|
+
const prepared = prepareGate(plan, lock, row.slot, candidate, head.progress.candidate.generation, row.producerNonce, loaded.registry.spec.gateEndpoints);
|
|
128
|
+
await new Gate(store, authority, artifacts, plan, lock, ref => approvedState(loaded).vault.resolveNetworkCredential(ref), () => subject, null, ports.gateUrlOverrides).restore(prepared);
|
|
129
|
+
}
|
|
130
|
+
else if (slot.handler.implementation === 'benchmark-gate.v1') {
|
|
131
|
+
const bundleProgress = createRateLimitedProgress(() => {
|
|
132
|
+
if (context.signal.aborted)
|
|
133
|
+
refuse('CANCELLED', '', 'recovery');
|
|
134
|
+
stateValue(store.renew(authority));
|
|
135
|
+
}, 1_000);
|
|
136
|
+
const baseTreeBundle = await sealBenchmarkBaseTreeBundle(source, candidate.manifest, artifacts, context.owner, context.signal, bundleProgress);
|
|
137
|
+
const prepared = prepareBenchmarkGate(plan, lock, row.slot, candidate, head.progress.candidate.generation, row.producerNonce, loaded.registry.spec.gateEndpoints, baseTreeBundle);
|
|
138
|
+
await new BenchmarkGate(store, authority, artifacts, plan, lock, ref => approvedState(loaded).vault.resolveNetworkCredential(ref), () => subject, null, ports.gateUrlOverrides, (gen, excludeSlotId) => collectPriorGenerationVerifierBudget(plan, artifacts, gen, excludeSlotId, undefined, head.progress.verifierReceipts)).restore(prepared, context.signal);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const bounds = overlayManifestBounds(plan.budgets.overlay);
|
|
142
|
+
const prepared = prepareVerification(plan, lock, row.slot, { manifest: source.manifest, ref: await artifacts.json('manifest', source.manifest, bounds.manifestMaxBytes), files: source.artifacts, ...(source.baselineProofs ? { baselineProofs: source.baselineProofs } : {}) }, candidate, head.progress.candidate.generation, row.producerNonce);
|
|
143
|
+
await new Verifier(store, authority, artifacts, plan, lock, () => subject).restore(prepared);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const publicationConfig = plan.publication;
|
|
149
|
+
if (head?.progress.stage.kind === 'publication_pre' && head.progress.publication.operationId !== null && publicationConfig.mode === 'pull_request') {
|
|
150
|
+
const operation = store.getOperation(head.progress.publication.operationId);
|
|
151
|
+
const endpoint = loaded.registry.spec.publicationEndpoints.find(item => item.id === publicationConfig.endpointRef);
|
|
152
|
+
if (operation.ok && operation.value.dispatch !== null && operation.value.state === 'dispatch_uncertain' && endpoint) {
|
|
153
|
+
const prepared = preparePublication(plan, lock, storeId, endpoint, head.checkpoint.subject);
|
|
154
|
+
await new Publication(store, authority, artifacts, plan, lock, ref => approvedState(loaded).vault.resolveNetworkCredential(ref), () => head.checkpoint.subject, descriptor.repository).restore(prepared, endpoint);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export function resumeCycle(input) { return resumeCycleWithPorts(input); }
|
|
159
|
+
/** Test observation ports are private; resume has the same production execution route as run. */
|
|
160
|
+
export function resumeCycleWithPorts(input, ports = {}) {
|
|
161
|
+
return result(async () => {
|
|
162
|
+
const fields = Object.keys(input);
|
|
163
|
+
record(input, fields);
|
|
164
|
+
if (fields.some(key => !['configuration', 'repository', 'runRoot', 'runId', 'signal', 'onEvent'].includes(key)) || input.signal !== undefined && !(input.signal instanceof AbortSignal) || input.onEvent !== undefined && typeof input.onEvent !== 'function')
|
|
165
|
+
refuse('CONFIG_SCHEMA', '', 'recovery');
|
|
166
|
+
validateGateUrlOverrides(ports.gateUrlOverrides, 'recovery');
|
|
167
|
+
validatePortPolicyFields(ports, 'recovery');
|
|
168
|
+
const { directory, descriptor, hostPolicy, lock, effectiveConfig, state, plan } = await admitRetainedRun({
|
|
169
|
+
runRoot: input.runRoot,
|
|
170
|
+
runId: input.runId,
|
|
171
|
+
configuration: input.configuration,
|
|
172
|
+
repository: input.repository,
|
|
173
|
+
phase: 'recovery',
|
|
174
|
+
});
|
|
175
|
+
const effectivePorts = validatePortsAgainstHostPolicy(ports, hostPolicy, 'recovery');
|
|
176
|
+
validateGateUrlOverrides(effectivePorts.gateUrlOverrides, 'recovery', effectiveConfig.registry.spec.gateEndpoints);
|
|
177
|
+
let owner = null, store = null, authority = null, handedOff = false;
|
|
178
|
+
try {
|
|
179
|
+
owner = await ControllerOwner.acquire(directory, input.runId, plan.planDigest);
|
|
180
|
+
store = stateValue(reopenLocalRun(descriptor.identity));
|
|
181
|
+
const original = stateValue(store.inspect());
|
|
182
|
+
if (original.clockStatus !== 'trusted')
|
|
183
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
184
|
+
authority = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: original.owner.generation, expectedRevision: original.revision, mode: 'recovery' })).authority;
|
|
185
|
+
const artifacts = new ArtifactStore(join(directory, 'artifacts'), owner, state.vault);
|
|
186
|
+
await artifacts.cleanCasTempFiles();
|
|
187
|
+
const jsonPaths = [...new Set(plan.verifierSlots.filter(slot => ['json-artifact.v1', 'json-keys-guard.v1', 'line-section-guard.v1'].includes(slot.handler.implementation)).map(slot => text(slot.handler.parameters.path)))];
|
|
188
|
+
const source = await restoreSource(resolve(input.repository), plan.task, owner, artifacts, descriptor.source, descriptor.sourceWorkspace, jsonPaths);
|
|
189
|
+
let progress = new ProgressStore(store, authority, artifacts, plan, lock, descriptor.plan, descriptor.source);
|
|
190
|
+
const head = await progress.read();
|
|
191
|
+
let context = { loaded: effectiveConfig, plan, lock, directory, source, store, authority, owner, artifacts, progress, descriptor, signal: input.signal ?? new AbortController().signal, onEvent: input.onEvent, ports: effectivePorts };
|
|
192
|
+
const candidate = await restoredCandidate(context, head);
|
|
193
|
+
await reconcileInterruptedOperations(context, head, candidate, original.storeId);
|
|
194
|
+
const decision = progress.decision(head);
|
|
195
|
+
if (decision === 'terminal')
|
|
196
|
+
return await retainedPrimary(context, head);
|
|
197
|
+
let submission = null;
|
|
198
|
+
if (head?.progress.submission) {
|
|
199
|
+
try {
|
|
200
|
+
submission = { version: 1, origin: plan.orderedDAG.some(node => node.kind === 'agent') ? 'assistant' : 'controller', raw: head.progress.submission, value: normalizeSubmission(await artifacts.read(head.progress.submission, 1048576), plan.task) };
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
if (!(error instanceof ControllerFailure) || error.diagnostic.code !== 'SUBMISSION_INVALID')
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const isDelegatedNode = (nodeId) => {
|
|
208
|
+
const dagNode = plan.orderedDAG.find(item => item.id === nodeId);
|
|
209
|
+
const role = dagNode?.roleId ? plan.roles.find(item => item.roleId === dagNode.roleId) : undefined;
|
|
210
|
+
return dagNode?.kind === 'agent' && role?.adapter === 'delegated';
|
|
211
|
+
};
|
|
212
|
+
const isMutatingRole = (role) => role.policy.tools.some(tool => tool === 'write' || tool === 'edit' || tool === 'delete' || tool === 'bash');
|
|
213
|
+
const activeNodes = head ? head.progress.nodes : plan.orderedDAG.map(node => ({ id: node.id, state: 'pending' }));
|
|
214
|
+
const attempts = head?.progress.attempts ?? [];
|
|
215
|
+
const lastAttempt = attempts.at(-1);
|
|
216
|
+
const unfinishedDelegated = lastAttempt !== undefined && lastAttempt.finished === null && isDelegatedNode(lastAttempt.nodeId);
|
|
217
|
+
const reachableDelegated = activeNodes.some(node => (node.state === 'pending' || node.state === 'running') && isDelegatedNode(node.id));
|
|
218
|
+
const formatRepairDelegated = Boolean(lastAttempt?.finished?.nativeCheckpointId)
|
|
219
|
+
&& !isHaltedByVerdict(head?.progress)
|
|
220
|
+
&& lastAttempt.purpose !== 'compaction'
|
|
221
|
+
&& activeNodes.find(node => node.id === lastAttempt.nodeId)?.state === 'failed'
|
|
222
|
+
&& isDelegatedNode(lastAttempt.nodeId);
|
|
223
|
+
let implRepairDelegated = false;
|
|
224
|
+
const priorMutatingTask = attempts
|
|
225
|
+
.filter(attempt => {
|
|
226
|
+
if (attempt.purpose !== 'task' || attempt.repair === 'format' || !attempt.finished?.nativeCheckpointId)
|
|
227
|
+
return false;
|
|
228
|
+
const dagNode = plan.orderedDAG.find(item => item.id === attempt.nodeId);
|
|
229
|
+
const role = dagNode?.roleId ? plan.roles.find(item => item.roleId === dagNode.roleId) : undefined;
|
|
230
|
+
return role !== undefined && isMutatingRole(role);
|
|
231
|
+
})
|
|
232
|
+
.at(-1);
|
|
233
|
+
if (priorMutatingTask && isDelegatedNode(priorMutatingTask.nodeId) && plan.budgets.maxImplementationRepairs > 0) {
|
|
234
|
+
const delegatedCounts = countDelegatedBudgets(plan, attempts);
|
|
235
|
+
if (attempts.length < plan.capacity.A
|
|
236
|
+
&& original.ledger.implementationRepairs + delegatedCounts.implementationRepairs < plan.budgets.maxImplementationRepairs) {
|
|
237
|
+
const generation = head?.progress.candidate.generation ?? 0;
|
|
238
|
+
const requiredExplicitSlots = plan.verifierSlots.filter(slot => slot.implicit === null && plan.task.spec.acceptance.required.includes(slot.checkId));
|
|
239
|
+
let anyRequiredBlocked = false;
|
|
240
|
+
let hasFailedOrUnrunRequired = head === null;
|
|
241
|
+
for (const slot of requiredExplicitSlots) {
|
|
242
|
+
if (anyRequiredBlocked)
|
|
243
|
+
break;
|
|
244
|
+
if (head.progress.verifierRefusals.some(row => row.slot === slot.id && row.generation === generation)) {
|
|
245
|
+
anyRequiredBlocked = true;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
const receiptRow = head.progress.verifierReceipts.find(row => row.slot === slot.id && row.generation === generation);
|
|
249
|
+
if (!receiptRow) {
|
|
250
|
+
hasFailedOrUnrunRequired = true;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
const op = store.getOperation(receiptRow.operationId);
|
|
254
|
+
const settledReceipt = op.ok && op.value.state === 'confirmed'
|
|
255
|
+
? (op.value.reconciliation ?? op.value.initialReceipt)
|
|
256
|
+
: null;
|
|
257
|
+
if (!settledReceipt) {
|
|
258
|
+
hasFailedOrUnrunRequired = true;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
const impl = slot.handler.implementation;
|
|
263
|
+
const isGateLike = impl === 'gate.v1' || impl === 'benchmark-gate.v1';
|
|
264
|
+
const outCap = impl === 'gate.v1' ? GATE_OUTPUT_BYTES : impl === 'benchmark-gate.v1' ? BENCHMARK_OUTPUT_BYTES : 65536;
|
|
265
|
+
const rawOut = parsePrivateJson(await artifacts.read(settledReceipt.evidence.artifact, outCap), outCap);
|
|
266
|
+
const dispositionObj = isGateLike ? rawOut.disposition : undefined;
|
|
267
|
+
const status = isGateLike
|
|
268
|
+
? dispositionObj?.status
|
|
269
|
+
: rawOut.response?.status;
|
|
270
|
+
if (status === 'blocked'
|
|
271
|
+
|| (impl === 'benchmark-gate.v1'
|
|
272
|
+
&& (dispositionObj?.retryablePreemption === true || dispositionObj?.reason === 'BENCHMARK_PREEMPTED'))) {
|
|
273
|
+
anyRequiredBlocked = true;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
if (status !== 'passed') {
|
|
277
|
+
hasFailedOrUnrunRequired = true;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
hasFailedOrUnrunRequired = true;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (!anyRequiredBlocked && hasFailedOrUnrunRequired)
|
|
285
|
+
implRepairDelegated = true;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
if (unfinishedDelegated || reachableDelegated || formatRepairDelegated || implRepairDelegated) {
|
|
289
|
+
refuse('CAPABILITY_UNSUPPORTED', '/spec/profiles/roles', 'recovery');
|
|
290
|
+
}
|
|
291
|
+
if (input.signal?.aborted)
|
|
292
|
+
refuse('CANCELLED', '', 'recovery');
|
|
293
|
+
// No new authority implementation: release recovery claim, then claim active through S02's original CAS.
|
|
294
|
+
stateValue(store.release(authority));
|
|
295
|
+
authority = null;
|
|
296
|
+
const current = stateValue(store.inspect());
|
|
297
|
+
authority = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: current.owner.generation, expectedRevision: current.revision, mode: 'active' })).authority;
|
|
298
|
+
progress = new ProgressStore(store, authority, artifacts, plan, lock, descriptor.plan, descriptor.source);
|
|
299
|
+
context = { ...context, authority, progress };
|
|
300
|
+
handedOff = true;
|
|
301
|
+
return await executeCycleContext(context, { head, candidate, submission, adopt: decision === 'adopt_capture' });
|
|
302
|
+
}
|
|
303
|
+
finally {
|
|
304
|
+
if (!handedOff) {
|
|
305
|
+
if (store) {
|
|
306
|
+
if (authority)
|
|
307
|
+
stateValue(store.release(authority));
|
|
308
|
+
stateValue(store.close());
|
|
309
|
+
}
|
|
310
|
+
if (owner)
|
|
311
|
+
await owner.release();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}, 'recovery');
|
|
315
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ArtifactManifest, ArtifactRef, Digest, Subject, TaskLock } from '@loopwright/core';
|
|
2
|
+
import { ControllerFailure } from './errors.js';
|
|
3
|
+
import { type ManifestDescriptor, type VerifierHeader } from './verifier-protocol.js';
|
|
4
|
+
import type { CompiledPlan, VerifierRefusalRow } from './types.js';
|
|
5
|
+
export interface SizingDescription {
|
|
6
|
+
readonly reason: 'header_bytes' | 'json_file_bytes' | 'inventory_bytes' | 'packet_bytes' | 'tree_proof_bytes' | 'tree_proof_depth';
|
|
7
|
+
readonly actual: number;
|
|
8
|
+
readonly allowed: number;
|
|
9
|
+
readonly headerBytes: number;
|
|
10
|
+
readonly payloadBytes: number;
|
|
11
|
+
readonly packetBytes: number;
|
|
12
|
+
}
|
|
13
|
+
/** Created only by complete, pure job sizing after original byte validation. Never a general OUTPUT_LIMIT catch. */
|
|
14
|
+
export declare class VerifierSizingFailure extends ControllerFailure {
|
|
15
|
+
readonly sizing: SizingDescription;
|
|
16
|
+
constructor(sizing: SizingDescription);
|
|
17
|
+
}
|
|
18
|
+
export declare function sizeJob(header: VerifierHeader, payloadBytes: number, jsonBytes: number | null, merkle?: {
|
|
19
|
+
readonly treeCount: number;
|
|
20
|
+
readonly treeProofBytes: number;
|
|
21
|
+
}, inventoryBytes?: {
|
|
22
|
+
readonly firstBytes: number;
|
|
23
|
+
readonly secondBytes: number;
|
|
24
|
+
}): void;
|
|
25
|
+
export interface RefusalRecord {
|
|
26
|
+
readonly version: 1;
|
|
27
|
+
readonly kind: 'controller_preflight_refusal';
|
|
28
|
+
readonly planDigest: Digest;
|
|
29
|
+
readonly handlerDigest: Digest;
|
|
30
|
+
readonly slotId: string;
|
|
31
|
+
readonly checkId: string;
|
|
32
|
+
readonly generation: number;
|
|
33
|
+
readonly prospectiveOperationId: string;
|
|
34
|
+
readonly producerNonce: string;
|
|
35
|
+
readonly subject: Subject;
|
|
36
|
+
readonly source: ManifestDescriptor;
|
|
37
|
+
readonly candidate: ManifestDescriptor;
|
|
38
|
+
readonly code: 'OUTPUT_LIMIT';
|
|
39
|
+
readonly limits: SizingDescription;
|
|
40
|
+
}
|
|
41
|
+
export declare function checkedRefusalSubject(input: unknown, lock: TaskLock): Subject;
|
|
42
|
+
export declare function checkedRefusalRecord(input: unknown, plan: CompiledPlan, lock: TaskLock, row: VerifierRefusalRow): RefusalRecord;
|
|
43
|
+
export declare function refusalSubject(lock: TaskLock, manifest: ArtifactManifest, row: VerifierRefusalRow, recordVal: RefusalRecord, sourceRef: ArtifactRef, candidateRef: ArtifactRef, sourceManifest: ArtifactManifest): void;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { bindSubject } from '@loopwright/core';
|
|
2
|
+
import { ControllerFailure, refuse } from './errors.js';
|
|
3
|
+
import { checkedRef } from './storage.js';
|
|
4
|
+
import { canonical, digestValue, freeze, hash, id, integer, record, same } from './schema.js';
|
|
5
|
+
import { HEADER_BYTES, JSON_FILE_BYTES, maxPacketBytes, overlayProtocolBounds, } from './verifier-protocol.js';
|
|
6
|
+
/** Created only by complete, pure job sizing after original byte validation. Never a general OUTPUT_LIMIT catch. */
|
|
7
|
+
export class VerifierSizingFailure extends ControllerFailure {
|
|
8
|
+
sizing;
|
|
9
|
+
constructor(sizing) {
|
|
10
|
+
super({ version: 1, code: 'OUTPUT_LIMIT', phase: 'verification', path: '', stateCode: null, piCode: null, effect: 'none', retryable: false });
|
|
11
|
+
this.sizing = sizing;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function sizeJob(header, payloadBytes, jsonBytes, merkle, inventoryBytes) {
|
|
15
|
+
integer(payloadBytes, 0, Number.MAX_SAFE_INTEGER);
|
|
16
|
+
const headerBytes = Buffer.byteLength(canonical({ ...header, jobId: 'x'.repeat(64), operationId: 'x'.repeat(64), dispatchId: 'x'.repeat(64), generation: 256 }));
|
|
17
|
+
const packetBytes = 4 + HEADER_BYTES + payloadBytes;
|
|
18
|
+
const bounds = overlayProtocolBounds(header.overlay);
|
|
19
|
+
const limit = maxPacketBytes(header);
|
|
20
|
+
const maxInvActual = inventoryBytes !== undefined ? Math.max(inventoryBytes.firstBytes, inventoryBytes.secondBytes) : 0;
|
|
21
|
+
const refusal = jsonBytes !== null && jsonBytes > JSON_FILE_BYTES
|
|
22
|
+
? {
|
|
23
|
+
reason: 'json_file_bytes',
|
|
24
|
+
actual: jsonBytes,
|
|
25
|
+
allowed: JSON_FILE_BYTES,
|
|
26
|
+
headerBytes,
|
|
27
|
+
payloadBytes: 4 + jsonBytes,
|
|
28
|
+
packetBytes: 4 + HEADER_BYTES + 4 + jsonBytes,
|
|
29
|
+
}
|
|
30
|
+
: headerBytes > HEADER_BYTES
|
|
31
|
+
? { reason: 'header_bytes', actual: headerBytes, allowed: HEADER_BYTES, headerBytes, payloadBytes, packetBytes }
|
|
32
|
+
: inventoryBytes !== undefined && maxInvActual > bounds.inventoryMaxBytes
|
|
33
|
+
? { reason: 'inventory_bytes', actual: maxInvActual, allowed: bounds.inventoryMaxBytes, headerBytes, payloadBytes, packetBytes }
|
|
34
|
+
: merkle !== undefined && merkle.treeCount > 16
|
|
35
|
+
? { reason: 'tree_proof_depth', actual: merkle.treeCount, allowed: 16, headerBytes, payloadBytes, packetBytes }
|
|
36
|
+
: merkle !== undefined && merkle.treeProofBytes > 262_144
|
|
37
|
+
? { reason: 'tree_proof_bytes', actual: merkle.treeProofBytes, allowed: 262_144, headerBytes, payloadBytes, packetBytes }
|
|
38
|
+
: packetBytes > limit
|
|
39
|
+
? { reason: 'packet_bytes', actual: packetBytes, allowed: limit, headerBytes, payloadBytes, packetBytes }
|
|
40
|
+
: null;
|
|
41
|
+
if (refusal)
|
|
42
|
+
throw new VerifierSizingFailure(freeze(refusal));
|
|
43
|
+
}
|
|
44
|
+
function checkedDescriptor(input, maxEntries) {
|
|
45
|
+
const value = record(input, ['metadataId', 'ref', 'entryCount']);
|
|
46
|
+
return { metadataId: id(value.metadataId), ref: checkedRef(value.ref), entryCount: integer(value.entryCount, 0, maxEntries) };
|
|
47
|
+
}
|
|
48
|
+
const PROBE_MANIFEST = Object.freeze({
|
|
49
|
+
apiVersion: 'loopwright.dev/v1alpha1',
|
|
50
|
+
kind: 'ArtifactManifest',
|
|
51
|
+
metadata: Object.freeze({ id: 'probe' }),
|
|
52
|
+
spec: Object.freeze({ entries: Object.freeze([]) }),
|
|
53
|
+
});
|
|
54
|
+
export function checkedRefusalSubject(input, lock) {
|
|
55
|
+
const value = record(input, ['lockHash', 'contractHash', 'repository', 'baseRevision', 'sourceRevision', 'candidateDigest', 'targetMatrixDigest']);
|
|
56
|
+
const contract = lock.spec.contract;
|
|
57
|
+
const target = contract.spec.target;
|
|
58
|
+
const probe = bindSubject(lock, PROBE_MANIFEST);
|
|
59
|
+
if (!probe.ok)
|
|
60
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
61
|
+
if (value.targetMatrixDigest !== null)
|
|
62
|
+
digestValue(value.targetMatrixDigest);
|
|
63
|
+
if (!same(value.lockHash, lock.spec.lockHash) ||
|
|
64
|
+
!same(value.contractHash, lock.spec.contractHash) ||
|
|
65
|
+
value.repository !== target.repository ||
|
|
66
|
+
value.baseRevision !== target.baseRevision ||
|
|
67
|
+
value.sourceRevision !== target.sourceRevision ||
|
|
68
|
+
!same(value.targetMatrixDigest, probe.value.targetMatrixDigest)) {
|
|
69
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
70
|
+
}
|
|
71
|
+
digestValue(value.candidateDigest);
|
|
72
|
+
return input;
|
|
73
|
+
}
|
|
74
|
+
const MAX_REFUSAL_METRIC = 1_073_741_824;
|
|
75
|
+
export function checkedRefusalRecord(input, plan, lock, row) {
|
|
76
|
+
const value = record(input, [
|
|
77
|
+
'version', 'kind', 'planDigest', 'handlerDigest', 'slotId', 'checkId',
|
|
78
|
+
'generation', 'prospectiveOperationId', 'producerNonce', 'subject', 'source', 'candidate', 'code', 'limits',
|
|
79
|
+
]);
|
|
80
|
+
const slot = plan.verifierSlots.find(s => s.id === row.slot);
|
|
81
|
+
const limits = record(value.limits, ['reason', 'actual', 'allowed', 'headerBytes', 'payloadBytes', 'packetBytes']);
|
|
82
|
+
for (const key of ['actual', 'allowed', 'headerBytes', 'payloadBytes', 'packetBytes']) {
|
|
83
|
+
integer(limits[key], 0, MAX_REFUSAL_METRIC);
|
|
84
|
+
}
|
|
85
|
+
const overlay = lock.spec.contract.spec.budgets.overlay;
|
|
86
|
+
const bounds = overlayProtocolBounds(overlay);
|
|
87
|
+
const impl = slot?.handler.implementation;
|
|
88
|
+
const isFileHandler = impl === 'json-artifact.v1' || impl === 'json-keys-guard.v1' || impl === 'line-section-guard.v1';
|
|
89
|
+
const payloadKind = impl === 'json-artifact.v1' ? 'json' : impl === 'json-keys-guard.v1' || impl === 'line-section-guard.v1' ? 'guard' : 'inventories';
|
|
90
|
+
const packetAllowed = maxPacketBytes({ payloadKind, ...(overlay ? { overlay } : {}) });
|
|
91
|
+
const expectedAllowed = limits.reason === 'json_file_bytes'
|
|
92
|
+
? JSON_FILE_BYTES
|
|
93
|
+
: limits.reason === 'header_bytes'
|
|
94
|
+
? HEADER_BYTES
|
|
95
|
+
: limits.reason === 'inventory_bytes'
|
|
96
|
+
? bounds.inventoryMaxBytes
|
|
97
|
+
: limits.reason === 'tree_proof_bytes'
|
|
98
|
+
? 262_144
|
|
99
|
+
: limits.reason === 'tree_proof_depth'
|
|
100
|
+
? 16
|
|
101
|
+
: limits.reason === 'packet_bytes'
|
|
102
|
+
? packetAllowed
|
|
103
|
+
: -1;
|
|
104
|
+
if (!slot ||
|
|
105
|
+
value.version !== 1 ||
|
|
106
|
+
value.kind !== 'controller_preflight_refusal' ||
|
|
107
|
+
value.code !== 'OUTPUT_LIMIT' ||
|
|
108
|
+
limits.allowed !== expectedAllowed ||
|
|
109
|
+
limits.actual <= expectedAllowed ||
|
|
110
|
+
limits.packetBytes !== 4 + HEADER_BYTES + limits.payloadBytes ||
|
|
111
|
+
(limits.reason === 'json_file_bytes' && (!isFileHandler || limits.actual !== limits.payloadBytes - 4)) ||
|
|
112
|
+
(limits.reason === 'header_bytes' && limits.actual !== limits.headerBytes) ||
|
|
113
|
+
(limits.reason === 'packet_bytes' && limits.actual !== limits.packetBytes) ||
|
|
114
|
+
((limits.reason === 'tree_proof_bytes' || limits.reason === 'tree_proof_depth') && !isFileHandler) ||
|
|
115
|
+
!same(value.planDigest, plan.planDigest) ||
|
|
116
|
+
!same(value.handlerDigest, slot.handler.digest) ||
|
|
117
|
+
value.slotId !== row.slot ||
|
|
118
|
+
value.checkId !== slot.checkId ||
|
|
119
|
+
value.generation !== row.generation ||
|
|
120
|
+
value.prospectiveOperationId !== row.prospectiveOperationId ||
|
|
121
|
+
value.producerNonce !== row.producerNonce ||
|
|
122
|
+
!same(value.subject, row.subject) ||
|
|
123
|
+
!same(row.subject.lockHash, lock.spec.lockHash) ||
|
|
124
|
+
!same(row.subject.contractHash, lock.spec.contractHash)) {
|
|
125
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
126
|
+
}
|
|
127
|
+
checkedRefusalSubject(value.subject, lock);
|
|
128
|
+
digestValue(value.planDigest);
|
|
129
|
+
digestValue(value.handlerDigest);
|
|
130
|
+
checkedDescriptor(value.source, bounds.maxManifestEntries);
|
|
131
|
+
checkedDescriptor(value.candidate, bounds.maxManifestEntries);
|
|
132
|
+
return input;
|
|
133
|
+
}
|
|
134
|
+
export function refusalSubject(lock, manifest, row, recordVal, sourceRef, candidateRef, sourceManifest) {
|
|
135
|
+
const overlayOpts = lock.spec.contract.spec.budgets.overlay ? { overlay: lock.spec.contract.spec.budgets.overlay } : undefined;
|
|
136
|
+
const subject = bindSubject(lock, manifest, overlayOpts);
|
|
137
|
+
if (!subject.ok ||
|
|
138
|
+
!same(subject.value, row.subject) ||
|
|
139
|
+
!same(recordVal.subject, row.subject) ||
|
|
140
|
+
!same(recordVal.source.ref, sourceRef) ||
|
|
141
|
+
!same(recordVal.candidate.ref, candidateRef) ||
|
|
142
|
+
recordVal.source.metadataId !== sourceManifest.metadata.id ||
|
|
143
|
+
recordVal.source.entryCount !== sourceManifest.spec.entries.length ||
|
|
144
|
+
recordVal.candidate.metadataId !== manifest.metadata.id ||
|
|
145
|
+
recordVal.candidate.entryCount !== manifest.spec.entries.length ||
|
|
146
|
+
recordVal.candidate.ref.byteLength !== Buffer.byteLength(canonical(manifest)) ||
|
|
147
|
+
!same(recordVal.candidate.ref.digest, hash(canonical(manifest)))) {
|
|
148
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type TrustedRegistry, type Handler } from './types.js';
|
|
2
|
+
import { type ControllerDiagnostic } from './errors.js';
|
|
3
|
+
export declare function labelValue(value: unknown, path: string): string;
|
|
4
|
+
export declare function validatePiSelectionOrRefuse(selection: unknown, path: string, phase?: ControllerDiagnostic['phase']): void;
|
|
5
|
+
export declare function validateHandler(raw: unknown, path: string): Handler;
|
|
6
|
+
export declare function validateRegistry(raw: unknown): TrustedRegistry;
|