@gpustack/loopwright 0.0.0-stage → 0.0.3
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 +2094 -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 +1648 -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 +2642 -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 +7335 -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 +3025 -0
- package/package-lock.json +3025 -0
- package/package.json +52 -4
|
@@ -0,0 +1,1378 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { lstat, open, realpath, rename } from 'node:fs/promises';
|
|
3
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { randomBytes } from 'node:crypto';
|
|
5
|
+
import { reopenLocalRun } from '@loopwright/state';
|
|
6
|
+
import { VERIFIER_ARTIFACT_LIMITS, validateDocument } from '@loopwright/core';
|
|
7
|
+
import { approvedState, loadConfiguration } from './config.js';
|
|
8
|
+
import { compilePlan } from './compile.js';
|
|
9
|
+
import { ControllerFailure, refuse, result } from './errors.js';
|
|
10
|
+
import { ControllerOwner } from './ownership.js';
|
|
11
|
+
import { admitRetainedRun, readRetained, validatePortPolicyFields, validatePortsAgainstHostPolicy } from './retained.js';
|
|
12
|
+
import { resumeCycleWithPorts } from './recovery.js';
|
|
13
|
+
import { overlayManifestBounds, restoreSource } from './source.js';
|
|
14
|
+
import { ArtifactStore, checkedRef, overwriteAtomicMarker, publishAtomicMarker, stateValue } from './storage.js';
|
|
15
|
+
import { readBoundedFile } from './files.js';
|
|
16
|
+
import { ProgressStore, journal, phaseCheckpointId, validateProgress } from './progress.js';
|
|
17
|
+
import { parsePrivateJson } from './parser.js';
|
|
18
|
+
import { canonical, freeze, hash, isRecord, list, record, same, text } from './schema.js';
|
|
19
|
+
import { preparePublication, verifyPublicationReceipt } from './publication.js';
|
|
20
|
+
import { checkedGateVerdict, GATE_OUTPUT_BYTES, RESPONSE_BYTES, stripVerdictSignature, validateGateUrlOverrides, verifyGateSignature, verifySignedPayload } from './gate.js';
|
|
21
|
+
import { BENCHMARK_OUTPUT_BYTES, BENCHMARK_RESPONSE_BYTES, checkedBenchmarkVerdict, checkedVerifierArtifactRef, collectPriorGenerationVerifierBudget, computeBenchmarkDisposition, createRateLimitedProgress, expectedBenchmarkOutputArtifactRef, expectedBenchmarkRequest, isPreemptedBenchmarkVerdict, pullBenchmarkOutputBlobs, resolveBenchmarkBaseUrl, resolveBenchmarkSlotMetadata, sealBenchmarkBaseTreeBundle, shouldPullBenchmarkOutputs, validateStoredBenchmarkProof, } from './benchmark-gate.js';
|
|
22
|
+
const RECEIPT_BYTES = RESPONSE_BYTES + 256;
|
|
23
|
+
/** Operator receipt files may live anywhere private enough for the operator; ancestor symlinks such as /tmp -> /private/tmp canonicalize, the file itself never links. */
|
|
24
|
+
async function readReceiptFile(path) {
|
|
25
|
+
const rawTarget = resolve(text(path));
|
|
26
|
+
let target;
|
|
27
|
+
try {
|
|
28
|
+
const stats = await lstat(rawTarget);
|
|
29
|
+
if (!stats.isFile() || stats.isSymbolicLink() || stats.size > RECEIPT_BYTES)
|
|
30
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
31
|
+
target = join(await realpath(dirname(rawTarget)), basename(rawTarget));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (error instanceof ControllerFailure)
|
|
35
|
+
throw error;
|
|
36
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return await readBoundedFile(target, RECEIPT_BYTES, false);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Explicit operator reconciliation for interrupted or unproven external effects; never re-dispatches the external request. */
|
|
46
|
+
export function reconcileCycle(input, ports = {}) {
|
|
47
|
+
return result(async () => {
|
|
48
|
+
const fields = Object.keys(input);
|
|
49
|
+
record(input, fields);
|
|
50
|
+
if (fields.some(key => !['configuration', 'runRoot', 'runId', 'receipt', 'signal'].includes(key)) || input.signal !== undefined && !(input.signal instanceof AbortSignal))
|
|
51
|
+
refuse('CONFIG_SCHEMA', '', 'recovery');
|
|
52
|
+
validateGateUrlOverrides(ports.gateUrlOverrides, 'recovery');
|
|
53
|
+
validatePortPolicyFields(ports, 'recovery');
|
|
54
|
+
const receiptBytes = await readReceiptFile(input.receipt);
|
|
55
|
+
let raw;
|
|
56
|
+
try {
|
|
57
|
+
raw = parsePrivateJson(receiptBytes, RECEIPT_BYTES);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
61
|
+
}
|
|
62
|
+
const kind = typeof raw === 'object' && raw !== null ? raw.kind : null;
|
|
63
|
+
if (kind !== 'publication_receipt' && kind !== 'gate_verdict' && kind !== 'benchmark_verdict')
|
|
64
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
65
|
+
let effectiveConfig = input.configuration;
|
|
66
|
+
let state = approvedState(effectiveConfig);
|
|
67
|
+
try {
|
|
68
|
+
const retained = await readRetained({ runRoot: input.runRoot, runId: input.runId });
|
|
69
|
+
if (retained.descriptor.configuration.roleModelOverrides !== undefined && state.input.roleModelOverrides === undefined) {
|
|
70
|
+
const reloaded = await loadConfiguration({ ...state.input, roleModelOverrides: retained.descriptor.configuration.roleModelOverrides }, { environment: name => process.env[name] });
|
|
71
|
+
if (reloaded.ok) {
|
|
72
|
+
effectiveConfig = reloaded.value;
|
|
73
|
+
state = approvedState(effectiveConfig);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch { /* admit() below will validate retained run and report the canonical diagnostic */ }
|
|
78
|
+
validateGateUrlOverrides(ports.gateUrlOverrides, 'recovery', effectiveConfig.registry.spec.gateEndpoints);
|
|
79
|
+
const compiled = await compilePlan(effectiveConfig);
|
|
80
|
+
if (!compiled.ok)
|
|
81
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
82
|
+
const plan = compiled.value;
|
|
83
|
+
if (kind === 'gate_verdict')
|
|
84
|
+
return await reconcileGate({ ...input, configuration: effectiveConfig }, state, plan, receiptBytes, ports);
|
|
85
|
+
if (kind === 'benchmark_verdict')
|
|
86
|
+
return await reconcileBenchmarkGate({ ...input, configuration: effectiveConfig }, state, plan, receiptBytes, ports);
|
|
87
|
+
if (plan.publication.mode !== 'pull_request')
|
|
88
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
89
|
+
return await reconcilePublication({ ...input, configuration: effectiveConfig }, state, plan, raw, ports);
|
|
90
|
+
}, 'recovery');
|
|
91
|
+
}
|
|
92
|
+
/** Shared retained-run admission for both reconciliation paths. */
|
|
93
|
+
async function admit(input, plan, ports) {
|
|
94
|
+
const admitted = await admitRetainedRun({ runRoot: input.runRoot, runId: input.runId, configuration: input.configuration, phase: 'recovery' });
|
|
95
|
+
if (!same(plan, admitted.plan))
|
|
96
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
97
|
+
const effectivePorts = validatePortsAgainstHostPolicy(ports, admitted.hostPolicy, 'recovery');
|
|
98
|
+
return { ...admitted, effectivePorts };
|
|
99
|
+
}
|
|
100
|
+
async function reconcileGate(input, state, plan, receiptBytes, ports) {
|
|
101
|
+
const { directory, descriptor, lock, effectivePorts } = await admit(input, plan, ports);
|
|
102
|
+
let owner = null, store = null, authority = null;
|
|
103
|
+
let primaryFailed = false;
|
|
104
|
+
try {
|
|
105
|
+
owner = await ControllerOwner.acquire(directory, input.runId, plan.planDigest);
|
|
106
|
+
store = stateValue(reopenLocalRun(descriptor.identity));
|
|
107
|
+
const original = stateValue(store.inspect());
|
|
108
|
+
if (original.clockStatus !== 'trusted')
|
|
109
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
110
|
+
authority = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: original.owner.generation, expectedRevision: original.revision, mode: 'recovery' })).authority;
|
|
111
|
+
const artifacts = new ArtifactStore(join(directory, 'artifacts'), owner, state.vault);
|
|
112
|
+
await artifacts.cleanCasTempFiles();
|
|
113
|
+
const progress = new ProgressStore(store, authority, artifacts, plan, lock, descriptor.plan, descriptor.source), head = await progress.read();
|
|
114
|
+
const rawReceipt = parsePrivateJson(receiptBytes, 65_792);
|
|
115
|
+
if (!isRecord(rawReceipt))
|
|
116
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
117
|
+
const optionalVerdictKeys = ['detail', 'metrics', 'findings', 'retryablePreemption'].filter(key => Object.hasOwn(rawReceipt, key) && rawReceipt[key] !== undefined);
|
|
118
|
+
let file;
|
|
119
|
+
try {
|
|
120
|
+
file = record(rawReceipt, [
|
|
121
|
+
'version', 'kind', 'storeId', 'runId', 'lockHash', 'operationId', 'dispatchId', 'dispatchGeneration',
|
|
122
|
+
'gateId', 'checkId', 'candidateDigest', 'status', 'reason', 'expiresAtMs', 'signature',
|
|
123
|
+
...optionalVerdictKeys,
|
|
124
|
+
], '/receipt');
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
128
|
+
}
|
|
129
|
+
// The active verifier_pre row is checked first, so a tampered operationId while parked fails at /receipt; after
|
|
130
|
+
// resume (or a prior reconcile) the receipt locates its reconciled gate row for idempotent replay.
|
|
131
|
+
const activeRow = head?.progress.stage.kind === 'verifier_pre'
|
|
132
|
+
? head.progress.verifierReceipts.find(item => item.receipt === null && item.generation === head.progress.candidate.generation) ?? null
|
|
133
|
+
: null;
|
|
134
|
+
const row = activeRow ?? head?.progress.verifierReceipts.find(item => item.operationId === text(file.operationId, '/receipt', 128)) ?? null;
|
|
135
|
+
const slot = row ? plan.verifierSlots.find(item => item.id === row.slot) : null;
|
|
136
|
+
if (!head || !row || !slot || slot.handler.implementation !== 'gate.v1')
|
|
137
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
138
|
+
const endpoint = input.configuration.registry.spec.gateEndpoints.find(item => item.id === slot.handler.parameters.endpointRef);
|
|
139
|
+
if (!endpoint)
|
|
140
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
141
|
+
const operation = stateValue(store.getOperation(row.operationId)), dispatch = operation.dispatch;
|
|
142
|
+
if (!dispatch || operation.state !== 'dispatch_uncertain' && operation.state !== 'confirmed')
|
|
143
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
144
|
+
const subject = head.checkpoint.subject;
|
|
145
|
+
const body = stripVerdictSignature(file);
|
|
146
|
+
let parsedVerdict;
|
|
147
|
+
try {
|
|
148
|
+
parsedVerdict = checkedGateVerdict(body, {
|
|
149
|
+
storeId: original.storeId,
|
|
150
|
+
runId: lock.spec.runId,
|
|
151
|
+
lockHash: lock.spec.lockHash,
|
|
152
|
+
operationId: row.operationId,
|
|
153
|
+
dispatchId: dispatch.dispatchId,
|
|
154
|
+
dispatchGeneration: dispatch.generation,
|
|
155
|
+
gateId: slot.handler.parameters.gateId,
|
|
156
|
+
checkId: slot.checkId,
|
|
157
|
+
candidateDigest: subject.candidateDigest.hex,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
162
|
+
}
|
|
163
|
+
if (parsedVerdict.status === 'pending'
|
|
164
|
+
|| parsedVerdict.status === 'approved' && (BigInt(parsedVerdict.expiresAtMs) < BigInt(original.clock.sampledNow.wallMs) || BigInt(parsedVerdict.expiresAtMs) > BigInt(original.clock.sampledNow.wallMs) + 86400000n)
|
|
165
|
+
|| Buffer.byteLength(canonical(body)) > RESPONSE_BYTES
|
|
166
|
+
|| typeof file.signature !== 'string'
|
|
167
|
+
|| !verifyGateSignature(state.vault.resolveNetworkCredential(endpoint.signingCredentialRef), file, file.signature)) {
|
|
168
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
169
|
+
}
|
|
170
|
+
const status = parsedVerdict.status;
|
|
171
|
+
const preemptionField = parsedVerdict.retryablePreemption !== undefined ? { retryablePreemption: parsedVerdict.retryablePreemption } : {};
|
|
172
|
+
const dispositioned = status === 'approved'
|
|
173
|
+
? { status: 'passed', reason: null, method: 'verify_external_gate', ...preemptionField }
|
|
174
|
+
: status === 'denied'
|
|
175
|
+
? { status: 'failed', reason: 'gate_denied', method: 'verify_external_gate', ...preemptionField }
|
|
176
|
+
: { status: 'blocked', reason: 'EVIDENCE_UNAVAILABLE', method: 'verify_external_gate', ...preemptionField };
|
|
177
|
+
const nonce = row.producerNonce, prefix = join(artifacts.directory, 'gate-producer-' + hash(row.operationId + '\0' + nonce).hex);
|
|
178
|
+
let settledReceipt = null;
|
|
179
|
+
if (operation.state === 'confirmed') {
|
|
180
|
+
settledReceipt = operation.reconciliation ?? operation.initialReceipt;
|
|
181
|
+
if (!settledReceipt)
|
|
182
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
183
|
+
const savedOutput = record(parsePrivateJson(await artifacts.read(settledReceipt.evidence.artifact, GATE_OUTPUT_BYTES), GATE_OUTPUT_BYTES), ['version', 'binding', 'observation', 'verdict', 'responseBytes', 'responseSignature', 'disposition']);
|
|
184
|
+
if (savedOutput.verdict === null)
|
|
185
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
186
|
+
if (!same(savedOutput.verdict, parsedVerdict))
|
|
187
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
188
|
+
if (head.progress.stage.kind.startsWith('terminal') && head.progress.terminalIntent?.result) {
|
|
189
|
+
let raw;
|
|
190
|
+
try {
|
|
191
|
+
raw = parsePrivateJson(await artifacts.read(head.progress.terminalIntent.result, 1048576), 1048576);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
195
|
+
}
|
|
196
|
+
const terminalResult = validateDocument(raw, 'RunResult');
|
|
197
|
+
if (!terminalResult.ok)
|
|
198
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
199
|
+
const runStatus = terminalResult.value.spec.status;
|
|
200
|
+
if (runStatus === 'reconcile_required')
|
|
201
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
202
|
+
return freeze({ kind: 'settled', version: 1, runId: lock.spec.runId, status: runStatus === 'completed' ? 'completed' : runStatus === 'failed' ? 'failed' : 'blocked', outcome: settledReceipt.outcome === 'succeeded' ? 'succeeded' : 'not_executed', externalEffects: terminalResult.value.spec.externalEffects === 'confirmed' ? 'confirmed' : 'none', receipt: freeze(settledReceipt) });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const request = { ...{ version: 1, kind: 'gate_request', gateId: slot.handler.parameters.gateId, checkId: slot.checkId, candidateDigest: subject.candidateDigest.hex, subject }, storeId: original.storeId, runId: lock.spec.runId, lockHash: lock.spec.lockHash, operationId: row.operationId, dispatchId: dispatch.dispatchId, dispatchGeneration: dispatch.generation, requestDigest: operation.intent.requestDigest.hex };
|
|
207
|
+
const requestBytesDigest = hash(Buffer.from(canonical(request))).hex;
|
|
208
|
+
const suffix = hash(row.operationId + '\0' + nonce).hex.slice(0, 40);
|
|
209
|
+
const output = await artifacts.json('gate-output', { version: 1, binding: { planDigest: plan.planDigest, operationId: row.operationId, producerNonce: nonce, generation: row.generation, endpoint: endpoint.id, subject, requestBytesDigest },
|
|
210
|
+
observation: { attempts: 1, elapsedMs: 0, transport: 'completed' }, verdict: parsedVerdict, responseBytes: Buffer.from(canonical(body)).toString('base64'), responseSignature: text(file.signature), disposition: dispositioned }, GATE_OUTPUT_BYTES);
|
|
211
|
+
const evidenceSpec = {
|
|
212
|
+
checkId: slot.checkId,
|
|
213
|
+
observedStatus: dispositioned.status,
|
|
214
|
+
producerId: 'loopwright.gate-verifier.v1',
|
|
215
|
+
method: dispositioned.method,
|
|
216
|
+
level: 'external_service',
|
|
217
|
+
subject,
|
|
218
|
+
artifacts: [output],
|
|
219
|
+
reason: dispositioned.reason,
|
|
220
|
+
...(Object.hasOwn(parsedVerdict, 'detail') ? { detail: parsedVerdict.detail } : {}),
|
|
221
|
+
...(parsedVerdict.metrics !== undefined ? { metrics: parsedVerdict.metrics } : {}),
|
|
222
|
+
...(parsedVerdict.findings !== undefined ? { findings: parsedVerdict.findings } : {}),
|
|
223
|
+
};
|
|
224
|
+
const evidenceResult = validateDocument({ apiVersion: 'loopwright.dev/v1alpha1', kind: 'Evidence', metadata: { id: 'evidence.' + suffix }, spec: evidenceSpec }, 'Evidence');
|
|
225
|
+
if (!evidenceResult.ok)
|
|
226
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
227
|
+
settledReceipt = { receiptId: 'receipt.' + suffix, outcome: dispositioned.method === 'verify_external_gate' ? 'succeeded' : 'failed',
|
|
228
|
+
evidence: { evidenceId: 'receipt-evidence.' + suffix, producerId: 'loopwright.gate-verifier.v1', method: dispositioned.method,
|
|
229
|
+
subject: { storeId: original.storeId, runId: lock.spec.runId, lockHash: lock.spec.lockHash, operationId: row.operationId, requestId: null, intentDigest: operation.intentDigest, dispatchGeneration: dispatch.generation, dispatchId: dispatch.dispatchId }, artifact: output } };
|
|
230
|
+
const receiptRef = await artifacts.json('gate-receipt', settledReceipt, 65536);
|
|
231
|
+
await writeMarker(prefix + '.proof.json', { version: 1, output, receipt: receiptRef, evidence: evidenceResult.value }, state.vault);
|
|
232
|
+
stateValue(store.reconcileOperation(authority, row.operationId, settledReceipt));
|
|
233
|
+
}
|
|
234
|
+
// resumeCycleWithPorts re-acquires the owner and reopens the store; release everything first so it never hits OWNER_BUSY.
|
|
235
|
+
stateValue(store.release(authority));
|
|
236
|
+
authority = null;
|
|
237
|
+
stateValue(store.close());
|
|
238
|
+
store = null;
|
|
239
|
+
await owner.release();
|
|
240
|
+
owner = null;
|
|
241
|
+
const execution = await resumeCycleWithPorts({ configuration: input.configuration, repository: descriptor.repository, runRoot: input.runRoot, runId: input.runId, ...(input.signal ? { signal: input.signal } : {}) }, effectivePorts);
|
|
242
|
+
if (!execution.ok && execution.error.code === 'CAPABILITY_UNSUPPORTED') {
|
|
243
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'delegated_step_required' });
|
|
244
|
+
}
|
|
245
|
+
if (!execution.ok || execution.value.kind !== 'result')
|
|
246
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
247
|
+
if (execution.value.result.spec.status === 'reconcile_required')
|
|
248
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
249
|
+
const receipt = settledReceipt;
|
|
250
|
+
return freeze({ kind: 'settled', version: 1, runId: lock.spec.runId, status: execution.value.result.spec.status === 'completed' ? 'completed' : execution.value.result.spec.status === 'failed' ? 'failed' : 'blocked', outcome: receipt.outcome === 'succeeded' ? 'succeeded' : 'not_executed', externalEffects: execution.value.result.spec.externalEffects === 'confirmed' ? 'confirmed' : 'none', receipt: freeze(receipt) });
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
primaryFailed = true;
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
await releaseReconcileHandles(store, authority, owner, primaryFailed);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
async function releaseReconcileHandles(store, authority, owner, suppressError) {
|
|
261
|
+
let firstError = null;
|
|
262
|
+
const capture = (err) => {
|
|
263
|
+
if (firstError === null)
|
|
264
|
+
firstError = err;
|
|
265
|
+
};
|
|
266
|
+
if (store) {
|
|
267
|
+
if (authority) {
|
|
268
|
+
try {
|
|
269
|
+
stateValue(store.release(authority));
|
|
270
|
+
}
|
|
271
|
+
catch (err) {
|
|
272
|
+
capture(err);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
stateValue(store.close());
|
|
277
|
+
}
|
|
278
|
+
catch (err) {
|
|
279
|
+
capture(err);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (owner) {
|
|
283
|
+
try {
|
|
284
|
+
await owner.release();
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
capture(err);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (!suppressError && firstError !== null) {
|
|
291
|
+
throw firstError;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async function writeMarker(path, value, vault) {
|
|
295
|
+
await publishAtomicMarker(path, value, vault, 'recovery');
|
|
296
|
+
}
|
|
297
|
+
async function reconcileBenchmarkGate(input, state, plan, receiptBytes, ports) {
|
|
298
|
+
const { directory, descriptor, lock, effectivePorts } = await admit(input, plan, ports);
|
|
299
|
+
let owner = null, store = null, authority = null;
|
|
300
|
+
let primaryFailed = false;
|
|
301
|
+
try {
|
|
302
|
+
owner = await ControllerOwner.acquire(directory, input.runId, plan.planDigest);
|
|
303
|
+
store = stateValue(reopenLocalRun(descriptor.identity));
|
|
304
|
+
const original = stateValue(store.inspect());
|
|
305
|
+
if (original.clockStatus !== 'trusted')
|
|
306
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
307
|
+
authority = stateValue(store.claim({
|
|
308
|
+
ownerId: 'controller.' + owner.nonce,
|
|
309
|
+
expectedGeneration: original.owner.generation,
|
|
310
|
+
expectedRevision: original.revision,
|
|
311
|
+
mode: 'recovery',
|
|
312
|
+
})).authority;
|
|
313
|
+
const artifacts = new ArtifactStore(join(directory, 'artifacts'), owner, state.vault);
|
|
314
|
+
await artifacts.cleanCasTempFiles();
|
|
315
|
+
const progress = new ProgressStore(store, authority, artifacts, plan, lock, descriptor.plan, descriptor.source);
|
|
316
|
+
const head = await progress.read();
|
|
317
|
+
const rawReceipt = parsePrivateJson(receiptBytes, RECEIPT_BYTES);
|
|
318
|
+
if (!isRecord(rawReceipt))
|
|
319
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
320
|
+
const optionalVerdictKeys = ['retryablePreemption', 'detail', 'metrics', 'findings', 'hardwareProvenance', 'outputArtifacts'].filter(key => Object.hasOwn(rawReceipt, key) && rawReceipt[key] !== undefined);
|
|
321
|
+
let file;
|
|
322
|
+
try {
|
|
323
|
+
file = record(rawReceipt, [
|
|
324
|
+
'version',
|
|
325
|
+
'kind',
|
|
326
|
+
'storeId',
|
|
327
|
+
'runId',
|
|
328
|
+
'lockHash',
|
|
329
|
+
'operationId',
|
|
330
|
+
'dispatchId',
|
|
331
|
+
'dispatchGeneration',
|
|
332
|
+
'gateId',
|
|
333
|
+
'checkId',
|
|
334
|
+
'candidateDigest',
|
|
335
|
+
'status',
|
|
336
|
+
'reason',
|
|
337
|
+
'expiresAtMs',
|
|
338
|
+
'preemptionCount',
|
|
339
|
+
'signature',
|
|
340
|
+
...optionalVerdictKeys,
|
|
341
|
+
], '/receipt');
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
345
|
+
}
|
|
346
|
+
if (!head)
|
|
347
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
348
|
+
const receiptOpId = text(file.operationId, '/receipt', 128);
|
|
349
|
+
if (receiptOpId.length < 1)
|
|
350
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
351
|
+
// Resolve the receipt's operationId directly from retained verifierReceipts first so replaying an earlier slot
|
|
352
|
+
// or candidate generation never collides with a later active row.
|
|
353
|
+
const row = head.progress.verifierReceipts.find(item => item.operationId === receiptOpId) ?? null;
|
|
354
|
+
if (!row) {
|
|
355
|
+
const hasAnyBenchmarkRow = head.progress.verifierReceipts.some(item => plan.verifierSlots.find(s => s.id === item.slot)?.handler.implementation === 'benchmark-gate.v1');
|
|
356
|
+
if (hasAnyBenchmarkRow)
|
|
357
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
358
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
359
|
+
}
|
|
360
|
+
const slot = plan.verifierSlots.find(item => item.id === row.slot) ?? null;
|
|
361
|
+
if (!slot || slot.handler.implementation !== 'benchmark-gate.v1') {
|
|
362
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
363
|
+
}
|
|
364
|
+
const ordinal = plan.verifierSlots.findIndex(item => item.id === slot.id);
|
|
365
|
+
if (ordinal < 0)
|
|
366
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
367
|
+
const meta = resolveBenchmarkSlotMetadata(plan, slot);
|
|
368
|
+
const endpoint = input.configuration.registry.spec.gateEndpoints.find(item => item.id === meta.endpointRef);
|
|
369
|
+
if (!endpoint)
|
|
370
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
371
|
+
const operation = stateValue(store.getOperation(row.operationId));
|
|
372
|
+
const dispatch = operation.dispatch;
|
|
373
|
+
if (!dispatch || (operation.state !== 'dispatch_uncertain' && operation.state !== 'confirmed')) {
|
|
374
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
375
|
+
}
|
|
376
|
+
// Bind validation and replay to this operation's own retained candidate generation checkpoint, subject, and manifest.
|
|
377
|
+
const storeJournal = journal(store);
|
|
378
|
+
const preCheckpointId = phaseCheckpointId(lock.spec.runId, `verify.${String(row.generation)}.${String(ordinal)}.pre`);
|
|
379
|
+
const rowCheckpoint = storeJournal.checkpoints.find(cp => cp.checkpointId === preCheckpointId) ?? null;
|
|
380
|
+
let subject;
|
|
381
|
+
let rowManifest;
|
|
382
|
+
let rowWorkspaceRef;
|
|
383
|
+
if (rowCheckpoint) {
|
|
384
|
+
subject = rowCheckpoint.subject;
|
|
385
|
+
if (row.generation === head.progress.candidate.generation && same(subject, head.checkpoint.subject)) {
|
|
386
|
+
rowManifest = head.manifest;
|
|
387
|
+
rowWorkspaceRef = head.progress.candidate.workspace;
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
const wide = plan.capacity.D > 64;
|
|
391
|
+
const pMaxBytes = wide ? 262_144 : 65_536;
|
|
392
|
+
const pColLimit = wide ? 1024 : 256;
|
|
393
|
+
const rowProgressRef = rowCheckpoint.additionalArtifacts[0];
|
|
394
|
+
if (!rowProgressRef)
|
|
395
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
396
|
+
const rowProgress = validateProgress(parsePrivateJson(await artifacts.read(rowProgressRef, pMaxBytes), pMaxBytes, pColLimit), plan, lock);
|
|
397
|
+
rowManifest = await progress.manifest(rowProgress.candidate.manifest);
|
|
398
|
+
rowWorkspaceRef = rowProgress.candidate.workspace;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else if (row.generation === head.progress.candidate.generation) {
|
|
402
|
+
subject = head.checkpoint.subject;
|
|
403
|
+
rowManifest = head.manifest;
|
|
404
|
+
rowWorkspaceRef = head.progress.candidate.workspace;
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
408
|
+
}
|
|
409
|
+
const secret = state.vault.resolveNetworkCredential(endpoint.signingCredentialRef);
|
|
410
|
+
const bearerToken = endpoint.authCredentialRef !== null ? state.vault.resolveNetworkCredential(endpoint.authCredentialRef) : null;
|
|
411
|
+
const extraSecrets = [secret, ...(bearerToken !== null ? [bearerToken] : [])];
|
|
412
|
+
const body = stripVerdictSignature(file);
|
|
413
|
+
const bodyCanonicalBytes = Buffer.from(canonical(body), 'utf8');
|
|
414
|
+
if (typeof file.signature !== 'string'
|
|
415
|
+
|| bodyCanonicalBytes.byteLength > BENCHMARK_RESPONSE_BYTES
|
|
416
|
+
|| !verifyGateSignature(secret, file, file.signature)) {
|
|
417
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
418
|
+
}
|
|
419
|
+
let parsedVerdict;
|
|
420
|
+
try {
|
|
421
|
+
parsedVerdict = checkedBenchmarkVerdict(body, {
|
|
422
|
+
storeId: original.storeId,
|
|
423
|
+
runId: lock.spec.runId,
|
|
424
|
+
lockHash: lock.spec.lockHash,
|
|
425
|
+
operationId: row.operationId,
|
|
426
|
+
dispatchId: dispatch.dispatchId,
|
|
427
|
+
dispatchGeneration: dispatch.generation,
|
|
428
|
+
gateId: meta.gateId,
|
|
429
|
+
checkId: slot.checkId,
|
|
430
|
+
candidateDigest: subject.candidateDigest.hex,
|
|
431
|
+
slotId: slot.id,
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
catch {
|
|
435
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
436
|
+
}
|
|
437
|
+
if (parsedVerdict.status === 'pending') {
|
|
438
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
439
|
+
}
|
|
440
|
+
const nonce = row.producerNonce;
|
|
441
|
+
const prefix = join(artifacts.directory, 'benchmark-producer-' + hash(row.operationId + '\0' + nonce).hex);
|
|
442
|
+
const effectiveSignal = input.signal ?? new AbortController().signal;
|
|
443
|
+
if (effectiveSignal.aborted)
|
|
444
|
+
refuse('CANCELLED', '', 'recovery');
|
|
445
|
+
let settledReceipt = null;
|
|
446
|
+
const wasAlreadyConfirmed = operation.state === 'confirmed';
|
|
447
|
+
if (wasAlreadyConfirmed) {
|
|
448
|
+
settledReceipt = operation.reconciliation ?? operation.initialReceipt;
|
|
449
|
+
if (!settledReceipt)
|
|
450
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
451
|
+
const savedOutput = record(parsePrivateJson(await artifacts.read(settledReceipt.evidence.artifact, BENCHMARK_OUTPUT_BYTES), BENCHMARK_OUTPUT_BYTES), ['version', 'binding', 'observation', 'verdict', 'responseBytes', 'responseSignature', 'verifierArtifacts', 'disposition']);
|
|
452
|
+
if (savedOutput.verdict === null)
|
|
453
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
454
|
+
if (!same(savedOutput.verdict, parsedVerdict))
|
|
455
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
456
|
+
const savedVerifierRefsRaw = list(savedOutput.verifierArtifacts, '', VERIFIER_ARTIFACT_LIMITS.maxFilesPerSlot);
|
|
457
|
+
const expectedOutputs = parsedVerdict.outputArtifacts ?? [];
|
|
458
|
+
const savedDispositionStatus = isRecord(savedOutput.disposition) ? savedOutput.disposition.status : undefined;
|
|
459
|
+
if (savedVerifierRefsRaw.length > 0 || (expectedOutputs.length > 0 && savedDispositionStatus === 'passed')) {
|
|
460
|
+
if (savedVerifierRefsRaw.length !== expectedOutputs.length)
|
|
461
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
462
|
+
const replayProgress = createRateLimitedProgress(() => {
|
|
463
|
+
if (effectiveSignal.aborted)
|
|
464
|
+
refuse('CANCELLED', '', 'recovery');
|
|
465
|
+
stateValue(store.renew(authority));
|
|
466
|
+
}, 1_000);
|
|
467
|
+
for (let idx = 0; idx < savedVerifierRefsRaw.length; idx++) {
|
|
468
|
+
const ref = checkedVerifierArtifactRef(savedVerifierRefsRaw[idx], 'recovery');
|
|
469
|
+
const expOut = expectedOutputs[idx];
|
|
470
|
+
if (!same(ref, expectedBenchmarkOutputArtifactRef(slot.id, expOut, 'recovery'))) {
|
|
471
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
472
|
+
}
|
|
473
|
+
const verified = await artifacts.verifyOrReuseVerifierCasBlob({
|
|
474
|
+
logicalName: ref.name,
|
|
475
|
+
expectedSha256: ref.digest.hex,
|
|
476
|
+
expectedByteLength: ref.byteLength,
|
|
477
|
+
mediaType: expOut.mediaType,
|
|
478
|
+
maxBytes: VERIFIER_ARTIFACT_LIMITS.maxFileBytes,
|
|
479
|
+
phase: 'recovery',
|
|
480
|
+
extraSecrets,
|
|
481
|
+
signal: effectiveSignal,
|
|
482
|
+
onProgress: replayProgress,
|
|
483
|
+
});
|
|
484
|
+
if (!verified || !same(verified.blobRef, ref))
|
|
485
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if ((head.progress.stage.kind.startsWith('terminal') || head.progress.stage.kind === 'reconcile_result') && head.progress.terminalIntent?.result) {
|
|
489
|
+
let raw;
|
|
490
|
+
try {
|
|
491
|
+
raw = parsePrivateJson(await artifacts.read(head.progress.terminalIntent.result, 1_048_576), 1_048_576);
|
|
492
|
+
}
|
|
493
|
+
catch {
|
|
494
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
495
|
+
}
|
|
496
|
+
const terminalResult = validateDocument(raw, 'RunResult');
|
|
497
|
+
if (!terminalResult.ok)
|
|
498
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
499
|
+
const runStatus = terminalResult.value.spec.status;
|
|
500
|
+
if (runStatus === 'reconcile_required') {
|
|
501
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
502
|
+
}
|
|
503
|
+
return freeze({
|
|
504
|
+
kind: 'settled',
|
|
505
|
+
version: 1,
|
|
506
|
+
runId: lock.spec.runId,
|
|
507
|
+
status: runStatus === 'completed' ? 'completed' : runStatus === 'failed' ? 'failed' : 'blocked',
|
|
508
|
+
outcome: settledReceipt.outcome === 'succeeded' ? 'succeeded' : 'not_executed',
|
|
509
|
+
externalEffects: terminalResult.value.spec.externalEffects === 'confirmed' ? 'confirmed' : 'none',
|
|
510
|
+
receipt: freeze(settledReceipt),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
// If another operation is currently dispatch_uncertain/unresolved, another verifier slot has an unfinished
|
|
514
|
+
// verifier_pre checkpoint row (even before putIntent), or a delegated role attempt is unfinished, return
|
|
515
|
+
// unresolved without calling resumeCycleWithPorts (which would advance/dispatch or timeout sibling work).
|
|
516
|
+
const hasOtherUnresolvedOps = storeJournal.operations.some(op => op.intent.operationId !== row.operationId && (op.state === 'dispatch_uncertain' || op.state === 'unresolved'));
|
|
517
|
+
const hasOtherPendingVerifier = head.progress.verifierReceipts.some(item => item.operationId !== row.operationId && item.receipt === null)
|
|
518
|
+
|| (head.progress.stage.kind === 'verifier_pre'
|
|
519
|
+
&& head.progress.stage.phase !== `verify.${String(row.generation)}.${String(ordinal)}.pre`);
|
|
520
|
+
if (hasOtherUnresolvedOps || hasOtherPendingVerifier) {
|
|
521
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
522
|
+
}
|
|
523
|
+
const activeAttempt = head.progress.attempts.at(-1);
|
|
524
|
+
if (activeAttempt && activeAttempt.finished === null) {
|
|
525
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'delegated_step_required' });
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
let bindingBytes;
|
|
530
|
+
try {
|
|
531
|
+
bindingBytes = await readBoundedFile(prefix + '.binding.json', 1_048_576, true, 0o600);
|
|
532
|
+
}
|
|
533
|
+
catch (error) {
|
|
534
|
+
if (error instanceof ControllerFailure && error.diagnostic.code === 'REGISTRY_UNTRUSTED') {
|
|
535
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
536
|
+
}
|
|
537
|
+
throw error;
|
|
538
|
+
}
|
|
539
|
+
const binding = record(parsePrivateJson(bindingBytes, 1_048_576), [
|
|
540
|
+
'version',
|
|
541
|
+
'planDigest',
|
|
542
|
+
'operationId',
|
|
543
|
+
'producerNonce',
|
|
544
|
+
'requestDigest',
|
|
545
|
+
'requestBytesDigest',
|
|
546
|
+
'intentDigest',
|
|
547
|
+
'subject',
|
|
548
|
+
'generation',
|
|
549
|
+
'endpoint',
|
|
550
|
+
'dispatchReceipt',
|
|
551
|
+
]);
|
|
552
|
+
let baseTreeBundle;
|
|
553
|
+
const entryModes = new Map();
|
|
554
|
+
if (rowManifest.spec.baseTree !== undefined || rowManifest.spec.entries.length > 0) {
|
|
555
|
+
const jsonPaths = [
|
|
556
|
+
...new Set(plan.verifierSlots
|
|
557
|
+
.filter(s => ['json-artifact.v1', 'json-keys-guard.v1', 'line-section-guard.v1'].includes(s.handler.implementation))
|
|
558
|
+
.map(s => text(s.handler.parameters.path))),
|
|
559
|
+
];
|
|
560
|
+
const source = await restoreSource(descriptor.repository, plan.task, owner, artifacts, descriptor.source, descriptor.sourceWorkspace, jsonPaths);
|
|
561
|
+
if (source.version === 2) {
|
|
562
|
+
for (const item of source.baselineEntries ?? [])
|
|
563
|
+
entryModes.set(item.name, item.mode);
|
|
564
|
+
if (rowManifest.spec.baseTree !== undefined) {
|
|
565
|
+
const bundleProgress = createRateLimitedProgress(() => {
|
|
566
|
+
if (effectiveSignal.aborted)
|
|
567
|
+
refuse('CANCELLED', '', 'recovery');
|
|
568
|
+
stateValue(store.renew(authority));
|
|
569
|
+
}, 1_000);
|
|
570
|
+
baseTreeBundle = await sealBenchmarkBaseTreeBundle(source, rowManifest, artifacts, owner, effectiveSignal, bundleProgress);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
for (const item of source.artifacts)
|
|
575
|
+
entryModes.set(item.name, item.mode ?? '100644');
|
|
576
|
+
}
|
|
577
|
+
if (rowManifest.spec.entries.length > 0 && !same(rowWorkspaceRef, descriptor.sourceWorkspace)) {
|
|
578
|
+
const bounds = overlayManifestBounds(plan.budgets.overlay);
|
|
579
|
+
const maxWsBytes = Math.max(8_388_608, bounds.v2WorkspaceJsonMaxBytes, bounds.workspaceMaxBytes);
|
|
580
|
+
const wsBytes = await artifacts.read(rowWorkspaceRef, maxWsBytes);
|
|
581
|
+
let isDelegatedWorkspace = false;
|
|
582
|
+
try {
|
|
583
|
+
const parsedWs = parsePrivateJson(Buffer.from(wsBytes), maxWsBytes, bounds.collectionLimit);
|
|
584
|
+
if (isRecord(parsedWs)
|
|
585
|
+
&& (parsedWs.format === 'delegated-capture.v1' || parsedWs.format === 'delegated-capture.v2')
|
|
586
|
+
&& Array.isArray(parsedWs.overlay)) {
|
|
587
|
+
isDelegatedWorkspace = true;
|
|
588
|
+
for (const ov of parsedWs.overlay) {
|
|
589
|
+
if (isRecord(ov) && typeof ov.name === 'string' && (ov.mode === '100644' || ov.mode === '100755')) {
|
|
590
|
+
entryModes.set(ov.name, ov.mode);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
if (!(error instanceof ControllerFailure && (error.diagnostic.code === 'CONFIG_SYNTAX' || error.diagnostic.code === 'ARTIFACT_INVALID'))) {
|
|
597
|
+
throw error;
|
|
598
|
+
}
|
|
599
|
+
// Native Pi capture (non-JSON workspace; parsePrivateJson wraps non-JSON syntax errors as ARTIFACT_INVALID).
|
|
600
|
+
}
|
|
601
|
+
if (!isDelegatedWorkspace && source.version === 1) {
|
|
602
|
+
// Native Pi classic (v1) materializes every file as 0o444 (100644) and capture records explicit 100644.
|
|
603
|
+
for (const entry of rowManifest.spec.entries) {
|
|
604
|
+
entryModes.set(entry.name, '100644');
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
const request = {
|
|
610
|
+
...expectedBenchmarkRequest(plan, slot, endpoint, subject, rowManifest, baseTreeBundle, entryModes),
|
|
611
|
+
storeId: original.storeId,
|
|
612
|
+
runId: lock.spec.runId,
|
|
613
|
+
lockHash: lock.spec.lockHash,
|
|
614
|
+
operationId: row.operationId,
|
|
615
|
+
dispatchId: dispatch.dispatchId,
|
|
616
|
+
dispatchGeneration: dispatch.generation,
|
|
617
|
+
requestDigest: operation.intent.requestDigest.hex,
|
|
618
|
+
};
|
|
619
|
+
const requestBytesDigest = hash(Buffer.from(canonical(request))).hex;
|
|
620
|
+
if (binding.version !== 1
|
|
621
|
+
|| !same(binding.planDigest, plan.planDigest)
|
|
622
|
+
|| binding.operationId !== row.operationId
|
|
623
|
+
|| binding.producerNonce !== nonce
|
|
624
|
+
|| binding.generation !== row.generation
|
|
625
|
+
|| !same(binding.subject, subject)
|
|
626
|
+
|| !same(binding.requestDigest, operation.intent.requestDigest)
|
|
627
|
+
|| !same(binding.intentDigest, operation.intentDigest)
|
|
628
|
+
|| binding.endpoint !== endpoint.id
|
|
629
|
+
|| !same(binding.requestBytesDigest, requestBytesDigest)
|
|
630
|
+
|| !same(binding.dispatchReceipt, {
|
|
631
|
+
generation: dispatch.generation,
|
|
632
|
+
dispatchId: dispatch.dispatchId,
|
|
633
|
+
revision: dispatch.revision,
|
|
634
|
+
clockEpoch: original.clock.basis.clockEpoch,
|
|
635
|
+
})) {
|
|
636
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
637
|
+
}
|
|
638
|
+
const priorBudget = await collectPriorGenerationVerifierBudget(plan, artifacts, row.generation, slot.id, undefined, head.progress.verifierReceipts);
|
|
639
|
+
const buildBenchmarkSettlement = async (settlement) => {
|
|
640
|
+
const suffix = hash(row.operationId + '\0' + nonce).hex.slice(0, 40);
|
|
641
|
+
const output = await artifacts.json('benchmark-output', {
|
|
642
|
+
version: 1,
|
|
643
|
+
binding: {
|
|
644
|
+
planDigest: plan.planDigest,
|
|
645
|
+
operationId: row.operationId,
|
|
646
|
+
producerNonce: nonce,
|
|
647
|
+
generation: row.generation,
|
|
648
|
+
endpoint: endpoint.id,
|
|
649
|
+
subject,
|
|
650
|
+
requestBytesDigest,
|
|
651
|
+
},
|
|
652
|
+
observation: settlement.observation,
|
|
653
|
+
verdict: parsedVerdict,
|
|
654
|
+
responseBytes: settlement.responseBytes,
|
|
655
|
+
responseSignature: settlement.responseSignature,
|
|
656
|
+
verifierArtifacts: settlement.verifierArtifacts,
|
|
657
|
+
disposition: settlement.disposition,
|
|
658
|
+
}, BENCHMARK_OUTPUT_BYTES);
|
|
659
|
+
const evidenceSpec = {
|
|
660
|
+
checkId: slot.checkId,
|
|
661
|
+
observedStatus: settlement.disposition.status,
|
|
662
|
+
producerId: 'loopwright.benchmark-gate.v1',
|
|
663
|
+
method: settlement.disposition.method,
|
|
664
|
+
level: 'hardware_execution',
|
|
665
|
+
subject,
|
|
666
|
+
artifacts: [output, ...settlement.verifierArtifacts],
|
|
667
|
+
reason: settlement.disposition.reason,
|
|
668
|
+
...(Object.hasOwn(parsedVerdict, 'detail') ? { detail: parsedVerdict.detail } : {}),
|
|
669
|
+
...(parsedVerdict.metrics !== undefined ? { metrics: parsedVerdict.metrics } : {}),
|
|
670
|
+
...(parsedVerdict.findings !== undefined ? { findings: parsedVerdict.findings } : {}),
|
|
671
|
+
...(parsedVerdict.hardwareProvenance !== undefined ? { hardwareProvenance: parsedVerdict.hardwareProvenance } : {}),
|
|
672
|
+
};
|
|
673
|
+
const evidenceResult = validateDocument({ apiVersion: 'loopwright.dev/v1alpha1', kind: 'Evidence', metadata: { id: 'evidence.' + suffix }, spec: evidenceSpec }, 'Evidence');
|
|
674
|
+
if (!evidenceResult.ok)
|
|
675
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
676
|
+
const receipt = {
|
|
677
|
+
receiptId: 'receipt.' + suffix,
|
|
678
|
+
outcome: settlement.disposition.method === 'benchmark-gate.v1' ? 'succeeded' : 'failed',
|
|
679
|
+
evidence: {
|
|
680
|
+
evidenceId: 'receipt-evidence.' + suffix,
|
|
681
|
+
producerId: 'loopwright.benchmark-gate.v1',
|
|
682
|
+
method: settlement.disposition.method,
|
|
683
|
+
subject: {
|
|
684
|
+
storeId: original.storeId,
|
|
685
|
+
runId: lock.spec.runId,
|
|
686
|
+
lockHash: lock.spec.lockHash,
|
|
687
|
+
operationId: row.operationId,
|
|
688
|
+
requestId: null,
|
|
689
|
+
intentDigest: operation.intentDigest,
|
|
690
|
+
dispatchGeneration: dispatch.generation,
|
|
691
|
+
dispatchId: dispatch.dispatchId,
|
|
692
|
+
},
|
|
693
|
+
artifact: output,
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
const receiptRef = await artifacts.json('benchmark-receipt', receipt, 65_536);
|
|
697
|
+
return { output, evidence: evidenceResult.value, receipt, receiptRef };
|
|
698
|
+
};
|
|
699
|
+
const proofPath = prefix + '.proof.json';
|
|
700
|
+
let proofExists = false;
|
|
701
|
+
try {
|
|
702
|
+
await lstat(proofPath);
|
|
703
|
+
proofExists = true;
|
|
704
|
+
}
|
|
705
|
+
catch (error) {
|
|
706
|
+
if (error.code !== 'ENOENT') {
|
|
707
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
let useFreshReconcile = !proofExists;
|
|
711
|
+
let overwriteExistingProvisionalProof = false;
|
|
712
|
+
if (proofExists) {
|
|
713
|
+
let proofBytes;
|
|
714
|
+
try {
|
|
715
|
+
proofBytes = await readBoundedFile(proofPath, 1_048_576, true, 0o600);
|
|
716
|
+
}
|
|
717
|
+
catch {
|
|
718
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
719
|
+
}
|
|
720
|
+
const proofVerifyProgress = createRateLimitedProgress(() => {
|
|
721
|
+
if (effectiveSignal.aborted)
|
|
722
|
+
refuse('CANCELLED', '', 'recovery');
|
|
723
|
+
stateValue(store.renew(authority));
|
|
724
|
+
}, 1_000);
|
|
725
|
+
const validated = await validateStoredBenchmarkProof({
|
|
726
|
+
proofBytes,
|
|
727
|
+
artifacts,
|
|
728
|
+
plan,
|
|
729
|
+
slot,
|
|
730
|
+
endpoint,
|
|
731
|
+
targetHardware: meta.targetHardware,
|
|
732
|
+
targetCellId: meta.targetCellId,
|
|
733
|
+
allowSyntheticHardwareProbe: meta.allowSyntheticHardwareProbe,
|
|
734
|
+
metricThresholds: meta.metricThresholds,
|
|
735
|
+
view: original,
|
|
736
|
+
operation,
|
|
737
|
+
dispatch,
|
|
738
|
+
operationId: row.operationId,
|
|
739
|
+
producerNonce: nonce,
|
|
740
|
+
generation: row.generation,
|
|
741
|
+
subject,
|
|
742
|
+
request,
|
|
743
|
+
requestBytesDigest,
|
|
744
|
+
secret,
|
|
745
|
+
bearerToken,
|
|
746
|
+
priorBudget,
|
|
747
|
+
signal: effectiveSignal,
|
|
748
|
+
onProgress: proofVerifyProgress,
|
|
749
|
+
allowInvalidLocalCasSettlement: true,
|
|
750
|
+
});
|
|
751
|
+
const isProvisionalTimeoutProof = validated.verdict === null
|
|
752
|
+
&& validated.observation.transport === 'deadline'
|
|
753
|
+
&& validated.observation.casOutcome === 'gate_timeout';
|
|
754
|
+
if (isProvisionalTimeoutProof) {
|
|
755
|
+
// A prior #settleTimeout wrote a provisional timeout .proof.json but was cancelled/crashed before
|
|
756
|
+
// confirming SQLite (operation is still dispatch_uncertain). Let the verified signed receipt
|
|
757
|
+
// supersede the provisional timeout proof via normal fresh-receipt reconciliation.
|
|
758
|
+
useFreshReconcile = true;
|
|
759
|
+
overwriteExistingProvisionalProof = true;
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
if (validated.verdict === null)
|
|
763
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
764
|
+
if (!same(validated.verdict, parsedVerdict))
|
|
765
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
766
|
+
if (effectiveSignal?.aborted)
|
|
767
|
+
refuse('CANCELLED', '', 'recovery');
|
|
768
|
+
stateValue(store.renew(authority));
|
|
769
|
+
const postValidateView = stateValue(store.inspect());
|
|
770
|
+
const postValidateWallMs = BigInt(postValidateView.clock.sampledNow.wallMs);
|
|
771
|
+
const currentlyFresh = parsedVerdict.status !== 'approved'
|
|
772
|
+
|| (BigInt(parsedVerdict.expiresAtMs) >= postValidateWallMs
|
|
773
|
+
&& BigInt(parsedVerdict.expiresAtMs) <= postValidateWallMs + 86400000n);
|
|
774
|
+
if (validated.localCasInvalid) {
|
|
775
|
+
// Local CAS blob referenced by an unconfirmed proof is missing or invalid: settle the operation as
|
|
776
|
+
// blocked / ARTIFACT_INVALID with empty verifier refs instead of stranding dispatch_uncertain.
|
|
777
|
+
const invalidWallClockValid = validated.observation.wallClockValid && currentlyFresh;
|
|
778
|
+
const invalidDisposition = computeBenchmarkDisposition({
|
|
779
|
+
verdict: parsedVerdict,
|
|
780
|
+
timedOut: validated.observation.transport === 'deadline',
|
|
781
|
+
sawPreemption: validated.observation.sawPreemption,
|
|
782
|
+
wallClockValid: invalidWallClockValid,
|
|
783
|
+
targetHardware: meta.targetHardware,
|
|
784
|
+
targetCellId: meta.targetCellId,
|
|
785
|
+
allowSyntheticHardwareProbe: meta.allowSyntheticHardwareProbe,
|
|
786
|
+
metricThresholds: meta.metricThresholds,
|
|
787
|
+
casOutcome: 'artifact_invalid',
|
|
788
|
+
});
|
|
789
|
+
const builtInvalid = await buildBenchmarkSettlement({
|
|
790
|
+
disposition: invalidDisposition,
|
|
791
|
+
observation: {
|
|
792
|
+
attempts: validated.observation.attempts,
|
|
793
|
+
elapsedMs: validated.observation.elapsedMs,
|
|
794
|
+
transport: validated.observation.transport,
|
|
795
|
+
sawPreemption: validated.observation.sawPreemption,
|
|
796
|
+
wallClockValid: invalidWallClockValid,
|
|
797
|
+
casOutcome: 'artifact_invalid',
|
|
798
|
+
},
|
|
799
|
+
responseBytes: validated.responseBytesBase64,
|
|
800
|
+
responseSignature: validated.responseSignature,
|
|
801
|
+
verifierArtifacts: [],
|
|
802
|
+
});
|
|
803
|
+
settledReceipt = builtInvalid.receipt;
|
|
804
|
+
await overwriteAtomicMarker(proofPath, { version: 1, output: builtInvalid.output, receipt: builtInvalid.receiptRef, evidence: builtInvalid.evidence }, state.vault, 'recovery');
|
|
805
|
+
if (effectiveSignal?.aborted)
|
|
806
|
+
refuse('CANCELLED', '', 'recovery');
|
|
807
|
+
stateValue(store.renew(authority));
|
|
808
|
+
const finalBlockedView = stateValue(store.inspect());
|
|
809
|
+
if (finalBlockedView.clockStatus !== 'trusted')
|
|
810
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
811
|
+
if (effectiveSignal.aborted)
|
|
812
|
+
refuse('CANCELLED', '', 'recovery');
|
|
813
|
+
stateValue(store.reconcileOperation(authority, row.operationId, settledReceipt));
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
// Operation still needs first SQLite confirmation: apply current-time expiresAtMs freshness admission
|
|
817
|
+
// AFTER lease renewal and proof + CAS validation, with ZERO intervening durable writes before confirmation.
|
|
818
|
+
if (!currentlyFresh) {
|
|
819
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
820
|
+
}
|
|
821
|
+
if (effectiveSignal.aborted)
|
|
822
|
+
refuse('CANCELLED', '', 'recovery');
|
|
823
|
+
settledReceipt = validated.receipt;
|
|
824
|
+
stateValue(store.reconcileOperation(authority, row.operationId, settledReceipt));
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
if (useFreshReconcile) {
|
|
829
|
+
// Freshness admission strictly for first settlement (never blocks idempotent replay or valid existing proof).
|
|
830
|
+
const initialWallMs = BigInt(original.clock.sampledNow.wallMs);
|
|
831
|
+
if (parsedVerdict.status === 'approved'
|
|
832
|
+
&& (BigInt(parsedVerdict.expiresAtMs) < initialWallMs || BigInt(parsedVerdict.expiresAtMs) > initialWallMs + 86400000n)) {
|
|
833
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
834
|
+
}
|
|
835
|
+
// Lock signed receipt identity atomically before any CAS retrieval so transient CAS transport failures remain
|
|
836
|
+
// retryable with the exact same signed receipt while conflicting replacement verdicts refuse RECEIPT_CONFLICT.
|
|
837
|
+
const commitmentPath = prefix + '.reconcile-receipt.json';
|
|
838
|
+
const bodyDigest = hash(bodyCanonicalBytes).hex;
|
|
839
|
+
let hasCommitment = false;
|
|
840
|
+
try {
|
|
841
|
+
await lstat(commitmentPath);
|
|
842
|
+
hasCommitment = true;
|
|
843
|
+
}
|
|
844
|
+
catch (error) {
|
|
845
|
+
if (error.code !== 'ENOENT') {
|
|
846
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (hasCommitment) {
|
|
850
|
+
let rawCommitBytes;
|
|
851
|
+
try {
|
|
852
|
+
rawCommitBytes = await readBoundedFile(commitmentPath, 1_048_576, true, 0o600);
|
|
853
|
+
}
|
|
854
|
+
catch {
|
|
855
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
856
|
+
}
|
|
857
|
+
const committed = record(parsePrivateJson(rawCommitBytes, 1_048_576), [
|
|
858
|
+
'version',
|
|
859
|
+
'operationId',
|
|
860
|
+
'dispatchId',
|
|
861
|
+
'dispatchGeneration',
|
|
862
|
+
'verdict',
|
|
863
|
+
'bodyDigest',
|
|
864
|
+
]);
|
|
865
|
+
if (committed.version !== 1
|
|
866
|
+
|| committed.operationId !== row.operationId
|
|
867
|
+
|| committed.dispatchId !== dispatch.dispatchId
|
|
868
|
+
|| committed.dispatchGeneration !== dispatch.generation) {
|
|
869
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
870
|
+
}
|
|
871
|
+
if (!same(committed.verdict, parsedVerdict) || committed.bodyDigest !== bodyDigest) {
|
|
872
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
else {
|
|
876
|
+
await publishAtomicMarker(commitmentPath, {
|
|
877
|
+
version: 1,
|
|
878
|
+
operationId: row.operationId,
|
|
879
|
+
dispatchId: dispatch.dispatchId,
|
|
880
|
+
dispatchGeneration: dispatch.generation,
|
|
881
|
+
verdict: parsedVerdict,
|
|
882
|
+
bodyDigest,
|
|
883
|
+
}, state.vault, 'recovery');
|
|
884
|
+
}
|
|
885
|
+
const reconcileStarted = performance.now();
|
|
886
|
+
const reconcileStartMono = BigInt(original.clock.sampledNow.monotonicMs);
|
|
887
|
+
const reconcileBudgetMs = Math.max(endpoint.timeoutMs, endpoint.maxPollMs);
|
|
888
|
+
const reconcileDeadlineMono = reconcileStartMono + BigInt(reconcileBudgetMs);
|
|
889
|
+
const isPastReconcileDeadline = () => {
|
|
890
|
+
const nowMono = BigInt(stateValue(store.inspect()).clock.sampledNow.monotonicMs);
|
|
891
|
+
const elapsed = Math.ceil(performance.now() - reconcileStarted);
|
|
892
|
+
return nowMono >= reconcileDeadlineMono || elapsed >= reconcileBudgetMs;
|
|
893
|
+
};
|
|
894
|
+
const resolveReconcileTimeoutMs = () => {
|
|
895
|
+
const nowMono = BigInt(stateValue(store.inspect()).clock.sampledNow.monotonicMs);
|
|
896
|
+
const elapsed = Math.ceil(performance.now() - reconcileStarted);
|
|
897
|
+
const remMono = Number(reconcileDeadlineMono - nowMono);
|
|
898
|
+
const remElapsed = reconcileBudgetMs - elapsed;
|
|
899
|
+
const windowMs = Math.min(endpoint.timeoutMs, remMono, remElapsed);
|
|
900
|
+
return windowMs <= 0 ? null : windowMs;
|
|
901
|
+
};
|
|
902
|
+
const shouldPull = shouldPullBenchmarkOutputs({
|
|
903
|
+
verdict: parsedVerdict,
|
|
904
|
+
wallClockValid: true,
|
|
905
|
+
targetHardware: meta.targetHardware,
|
|
906
|
+
targetCellId: meta.targetCellId,
|
|
907
|
+
allowSyntheticHardwareProbe: meta.allowSyntheticHardwareProbe,
|
|
908
|
+
metricThresholds: meta.metricThresholds,
|
|
909
|
+
});
|
|
910
|
+
let casOutcome = 'ok';
|
|
911
|
+
let verifierCasRefs = freeze([]);
|
|
912
|
+
if (shouldPull && parsedVerdict.outputArtifacts) {
|
|
913
|
+
const proposedFiles = parsedVerdict.outputArtifacts.length;
|
|
914
|
+
const proposedBytes = parsedVerdict.outputArtifacts.reduce((sum, item) => sum + item.byteLength, 0);
|
|
915
|
+
if (priorBudget.files + proposedFiles > VERIFIER_ARTIFACT_LIMITS.maxTotalFiles
|
|
916
|
+
|| proposedBytes > VERIFIER_ARTIFACT_LIMITS.maxTotalBytes - priorBudget.bytes) {
|
|
917
|
+
casOutcome = 'artifact_invalid';
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
const baseUrl = resolveBenchmarkBaseUrl(endpoint, effectivePorts.gateUrlOverrides, 'recovery');
|
|
921
|
+
const pulled = await pullBenchmarkOutputBlobs({
|
|
922
|
+
baseUrl,
|
|
923
|
+
operationId: row.operationId,
|
|
924
|
+
slotId: slot.id,
|
|
925
|
+
secret,
|
|
926
|
+
bearerToken,
|
|
927
|
+
outputArtifacts: parsedVerdict.outputArtifacts,
|
|
928
|
+
artifacts,
|
|
929
|
+
signal: effectiveSignal,
|
|
930
|
+
resolveTimeoutMs: resolveReconcileTimeoutMs,
|
|
931
|
+
onBeforeEach: () => {
|
|
932
|
+
stateValue(store.renew(authority));
|
|
933
|
+
},
|
|
934
|
+
reuseLocalFirst: true,
|
|
935
|
+
phase: 'recovery',
|
|
936
|
+
});
|
|
937
|
+
if (!pulled.ok) {
|
|
938
|
+
casOutcome = pulled.casOutcome;
|
|
939
|
+
}
|
|
940
|
+
else if (isPastReconcileDeadline()) {
|
|
941
|
+
casOutcome = 'gate_timeout';
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
verifierCasRefs = pulled.refs;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
// Transient CAS transport unavailability leaves SQLite dispatch_uncertain (with receipt commitment locked)
|
|
949
|
+
// so retrying the exact same signed receipt succeeds once transport recovers.
|
|
950
|
+
if (casOutcome === 'evidence_unavailable' || casOutcome === 'gate_timeout') {
|
|
951
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
952
|
+
}
|
|
953
|
+
// Re-sample wall-clock freshness immediately before first settlement (after any CAS retrieval).
|
|
954
|
+
const postPullView = stateValue(store.inspect());
|
|
955
|
+
const postPullWallMs = BigInt(postPullView.clock.sampledNow.wallMs);
|
|
956
|
+
const wallClockValid = parsedVerdict.status !== 'approved'
|
|
957
|
+
|| (BigInt(parsedVerdict.expiresAtMs) >= postPullWallMs
|
|
958
|
+
&& BigInt(parsedVerdict.expiresAtMs) <= postPullWallMs + 86400000n);
|
|
959
|
+
const sawPreemption = parsedVerdict.preemptionCount > 0 || isPreemptedBenchmarkVerdict(parsedVerdict);
|
|
960
|
+
const dispositioned = computeBenchmarkDisposition({
|
|
961
|
+
verdict: parsedVerdict,
|
|
962
|
+
timedOut: false,
|
|
963
|
+
sawPreemption,
|
|
964
|
+
wallClockValid,
|
|
965
|
+
targetHardware: meta.targetHardware,
|
|
966
|
+
targetCellId: meta.targetCellId,
|
|
967
|
+
allowSyntheticHardwareProbe: meta.allowSyntheticHardwareProbe,
|
|
968
|
+
metricThresholds: meta.metricThresholds,
|
|
969
|
+
casOutcome,
|
|
970
|
+
});
|
|
971
|
+
const retainOutputs = casOutcome === 'ok'
|
|
972
|
+
&& shouldPullBenchmarkOutputs({
|
|
973
|
+
verdict: parsedVerdict,
|
|
974
|
+
wallClockValid,
|
|
975
|
+
targetHardware: meta.targetHardware,
|
|
976
|
+
targetCellId: meta.targetCellId,
|
|
977
|
+
allowSyntheticHardwareProbe: meta.allowSyntheticHardwareProbe,
|
|
978
|
+
metricThresholds: meta.metricThresholds,
|
|
979
|
+
});
|
|
980
|
+
const effectiveRefs = retainOutputs ? verifierCasRefs : freeze([]);
|
|
981
|
+
const builtFresh = await buildBenchmarkSettlement({
|
|
982
|
+
disposition: dispositioned,
|
|
983
|
+
observation: {
|
|
984
|
+
attempts: 1,
|
|
985
|
+
elapsedMs: Math.ceil(performance.now() - reconcileStarted),
|
|
986
|
+
transport: 'completed',
|
|
987
|
+
sawPreemption,
|
|
988
|
+
wallClockValid,
|
|
989
|
+
casOutcome,
|
|
990
|
+
},
|
|
991
|
+
responseBytes: bodyCanonicalBytes.toString('base64'),
|
|
992
|
+
responseSignature: text(file.signature),
|
|
993
|
+
verifierArtifacts: effectiveRefs,
|
|
994
|
+
});
|
|
995
|
+
settledReceipt = builtFresh.receipt;
|
|
996
|
+
if (overwriteExistingProvisionalProof) {
|
|
997
|
+
await overwriteAtomicMarker(prefix + '.proof.json', { version: 1, output: builtFresh.output, receipt: builtFresh.receiptRef, evidence: builtFresh.evidence }, state.vault, 'recovery');
|
|
998
|
+
}
|
|
999
|
+
else {
|
|
1000
|
+
await writeMarker(prefix + '.proof.json', { version: 1, output: builtFresh.output, receipt: builtFresh.receiptRef, evidence: builtFresh.evidence }, state.vault);
|
|
1001
|
+
}
|
|
1002
|
+
if (effectiveSignal?.aborted)
|
|
1003
|
+
refuse('CANCELLED', '', 'recovery');
|
|
1004
|
+
stateValue(store.renew(authority));
|
|
1005
|
+
// Recheck signed expiresAtMs after durable proof persistence, right at first SQLite confirmation.
|
|
1006
|
+
const confirmView = stateValue(store.inspect());
|
|
1007
|
+
const confirmWallMs = BigInt(confirmView.clock.sampledNow.wallMs);
|
|
1008
|
+
const confirmFresh = parsedVerdict.status !== 'approved'
|
|
1009
|
+
|| (BigInt(parsedVerdict.expiresAtMs) >= confirmWallMs
|
|
1010
|
+
&& BigInt(parsedVerdict.expiresAtMs) <= confirmWallMs + 86400000n);
|
|
1011
|
+
if (wallClockValid && !confirmFresh) {
|
|
1012
|
+
const expiredDisposition = computeBenchmarkDisposition({
|
|
1013
|
+
verdict: parsedVerdict,
|
|
1014
|
+
timedOut: false,
|
|
1015
|
+
sawPreemption,
|
|
1016
|
+
wallClockValid: false,
|
|
1017
|
+
targetHardware: meta.targetHardware,
|
|
1018
|
+
targetCellId: meta.targetCellId,
|
|
1019
|
+
allowSyntheticHardwareProbe: meta.allowSyntheticHardwareProbe,
|
|
1020
|
+
metricThresholds: meta.metricThresholds,
|
|
1021
|
+
casOutcome,
|
|
1022
|
+
});
|
|
1023
|
+
const builtExpired = await buildBenchmarkSettlement({
|
|
1024
|
+
disposition: expiredDisposition,
|
|
1025
|
+
observation: {
|
|
1026
|
+
attempts: 1,
|
|
1027
|
+
elapsedMs: Math.ceil(performance.now() - reconcileStarted),
|
|
1028
|
+
transport: 'completed',
|
|
1029
|
+
sawPreemption,
|
|
1030
|
+
wallClockValid: false,
|
|
1031
|
+
casOutcome,
|
|
1032
|
+
},
|
|
1033
|
+
responseBytes: bodyCanonicalBytes.toString('base64'),
|
|
1034
|
+
responseSignature: text(file.signature),
|
|
1035
|
+
verifierArtifacts: [],
|
|
1036
|
+
});
|
|
1037
|
+
settledReceipt = builtExpired.receipt;
|
|
1038
|
+
await overwriteAtomicMarker(prefix + '.proof.json', { version: 1, output: builtExpired.output, receipt: builtExpired.receiptRef, evidence: builtExpired.evidence }, state.vault, 'recovery');
|
|
1039
|
+
if (effectiveSignal?.aborted)
|
|
1040
|
+
refuse('CANCELLED', '', 'recovery');
|
|
1041
|
+
stateValue(store.renew(authority));
|
|
1042
|
+
const finalExpiredView = stateValue(store.inspect());
|
|
1043
|
+
if (finalExpiredView.clockStatus !== 'trusted')
|
|
1044
|
+
refuse('RECOVERY_REQUIRED', '/gate', 'recovery');
|
|
1045
|
+
if (effectiveSignal.aborted)
|
|
1046
|
+
refuse('CANCELLED', '', 'recovery');
|
|
1047
|
+
}
|
|
1048
|
+
stateValue(store.reconcileOperation(authority, row.operationId, settledReceipt));
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
// Check if other operations remain unresolved in the store or another verifier slot has an unfinished
|
|
1052
|
+
// pre-checkpoint row before invoking resumeCycleWithPorts.
|
|
1053
|
+
const postJournal = journal(store);
|
|
1054
|
+
const remainingUnresolvedOps = postJournal.operations.some(op => op.intent.operationId !== row.operationId && (op.state === 'dispatch_uncertain' || op.state === 'unresolved'));
|
|
1055
|
+
const remainingPendingVerifier = head.progress.verifierReceipts.some(item => item.operationId !== row.operationId && item.receipt === null);
|
|
1056
|
+
if (remainingUnresolvedOps || remainingPendingVerifier) {
|
|
1057
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
1058
|
+
}
|
|
1059
|
+
stateValue(store.release(authority));
|
|
1060
|
+
authority = null;
|
|
1061
|
+
stateValue(store.close());
|
|
1062
|
+
store = null;
|
|
1063
|
+
await owner.release();
|
|
1064
|
+
owner = null;
|
|
1065
|
+
const execution = await resumeCycleWithPorts({
|
|
1066
|
+
configuration: input.configuration,
|
|
1067
|
+
repository: descriptor.repository,
|
|
1068
|
+
runRoot: input.runRoot,
|
|
1069
|
+
runId: input.runId,
|
|
1070
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
1071
|
+
}, effectivePorts);
|
|
1072
|
+
if (!execution.ok && execution.error.code === 'CAPABILITY_UNSUPPORTED') {
|
|
1073
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'delegated_step_required' });
|
|
1074
|
+
}
|
|
1075
|
+
if (!execution.ok || execution.value.kind !== 'result')
|
|
1076
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1077
|
+
if (execution.value.result.spec.status === 'reconcile_required') {
|
|
1078
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
1079
|
+
}
|
|
1080
|
+
const receipt = settledReceipt;
|
|
1081
|
+
return freeze({
|
|
1082
|
+
kind: 'settled',
|
|
1083
|
+
version: 1,
|
|
1084
|
+
runId: lock.spec.runId,
|
|
1085
|
+
status: execution.value.result.spec.status === 'completed'
|
|
1086
|
+
? 'completed'
|
|
1087
|
+
: execution.value.result.spec.status === 'failed'
|
|
1088
|
+
? 'failed'
|
|
1089
|
+
: 'blocked',
|
|
1090
|
+
outcome: receipt.outcome === 'succeeded' ? 'succeeded' : 'not_executed',
|
|
1091
|
+
externalEffects: execution.value.result.spec.externalEffects === 'confirmed' ? 'confirmed' : 'none',
|
|
1092
|
+
receipt: freeze(receipt),
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
catch (error) {
|
|
1096
|
+
primaryFailed = true;
|
|
1097
|
+
throw error;
|
|
1098
|
+
}
|
|
1099
|
+
finally {
|
|
1100
|
+
await releaseReconcileHandles(store, authority, owner, primaryFailed);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
/** Replaces a proof marker that only carried an unresolved observation; a settled proof with different bytes refuses. */
|
|
1104
|
+
async function replaceMarker(path, value, vault) {
|
|
1105
|
+
const bytes = Buffer.from(canonical(value));
|
|
1106
|
+
if (bytes.byteLength > 1048576)
|
|
1107
|
+
refuse('OUTPUT_LIMIT', '', 'recovery');
|
|
1108
|
+
vault.assertClean(bytes);
|
|
1109
|
+
let existing;
|
|
1110
|
+
try {
|
|
1111
|
+
existing = Buffer.from(await readBoundedFile(path, 1048576, true));
|
|
1112
|
+
}
|
|
1113
|
+
catch {
|
|
1114
|
+
existing = undefined;
|
|
1115
|
+
}
|
|
1116
|
+
if (existing && existing.equals(bytes))
|
|
1117
|
+
return;
|
|
1118
|
+
if (existing) {
|
|
1119
|
+
let prior;
|
|
1120
|
+
try {
|
|
1121
|
+
prior = parsePrivateJson(existing, 1048576);
|
|
1122
|
+
}
|
|
1123
|
+
catch {
|
|
1124
|
+
prior = undefined;
|
|
1125
|
+
}
|
|
1126
|
+
if (prior && prior.receipt !== null && prior.receipt !== undefined)
|
|
1127
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1128
|
+
}
|
|
1129
|
+
const temp = path + '.' + randomBytes(6).toString('hex') + '.tmp';
|
|
1130
|
+
const file = await open(temp, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW, 0o600);
|
|
1131
|
+
try {
|
|
1132
|
+
await file.writeFile(bytes);
|
|
1133
|
+
await file.sync();
|
|
1134
|
+
}
|
|
1135
|
+
finally {
|
|
1136
|
+
await file.close();
|
|
1137
|
+
}
|
|
1138
|
+
await rename(temp, path);
|
|
1139
|
+
}
|
|
1140
|
+
async function reconcilePublication(input, state, plan, raw, ports) {
|
|
1141
|
+
const publication = plan.publication;
|
|
1142
|
+
if (publication.mode !== 'pull_request')
|
|
1143
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
1144
|
+
const { directory, descriptor, lock, effectivePorts } = await admit(input, plan, ports);
|
|
1145
|
+
let owner = null, store = null, authority = null;
|
|
1146
|
+
let primaryFailed = false;
|
|
1147
|
+
try {
|
|
1148
|
+
owner = await ControllerOwner.acquire(directory, input.runId, plan.planDigest);
|
|
1149
|
+
store = stateValue(reopenLocalRun(descriptor.identity));
|
|
1150
|
+
const original = stateValue(store.inspect());
|
|
1151
|
+
if (original.clockStatus !== 'trusted')
|
|
1152
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1153
|
+
authority = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: original.owner.generation, expectedRevision: original.revision, mode: 'recovery' })).authority;
|
|
1154
|
+
const artifacts = new ArtifactStore(join(directory, 'artifacts'), owner, state.vault);
|
|
1155
|
+
await artifacts.cleanCasTempFiles();
|
|
1156
|
+
const progress = new ProgressStore(store, authority, artifacts, plan, lock, descriptor.plan, descriptor.source), head = await progress.read();
|
|
1157
|
+
const pending = head?.progress.publication;
|
|
1158
|
+
if (!head || !pending || pending.status === 'idle' || pending.operationId === null)
|
|
1159
|
+
refuse('RECOVERY_REQUIRED', '/publication', 'recovery');
|
|
1160
|
+
const operation = stateValue(store.getOperation(pending.operationId)), subject = head.checkpoint.subject;
|
|
1161
|
+
if (operation.intent.effect !== 'external_write' || operation.intent.targetIdentity !== 'publication:' + lock.spec.runId + ':' + subject.candidateDigest.hex)
|
|
1162
|
+
refuse('RECOVERY_REQUIRED', '/publication', 'recovery');
|
|
1163
|
+
const endpoint = input.configuration.registry.spec.publicationEndpoints.find(item => item.id === publication.endpointRef);
|
|
1164
|
+
if (!endpoint)
|
|
1165
|
+
refuse('RECOVERY_REQUIRED', '/publication', 'recovery');
|
|
1166
|
+
const prepared = preparePublication(plan, lock, original.storeId, endpoint, subject);
|
|
1167
|
+
if (operation.intent.attemptId !== prepared.idempotencyKey || !same(operation.intent.requestDigest, prepared.requestDigest) || operation.intent.nodeId !== plan.orderedDAG[0].id || !operation.dispatch)
|
|
1168
|
+
refuse('RECOVERY_REQUIRED', '/publication', 'recovery');
|
|
1169
|
+
const hasCandidate = typeof raw === 'object' && raw !== null && Object.hasOwn(raw, 'candidateDigest');
|
|
1170
|
+
const file = record(raw, ['version', 'kind', 'storeId', 'runId', 'lockHash', 'operationId', 'dispatchId', 'dispatchGeneration', 'idempotencyKey', 'outcome', 'externalUrl', 'reason', 'signature', ...(hasCandidate ? ['candidateDigest'] : [])]);
|
|
1171
|
+
const body = stripVerdictSignature(file);
|
|
1172
|
+
const checked = verifyPublicationReceipt(body, { storeId: original.storeId, runId: lock.spec.runId, lockHash: lock.spec.lockHash, operationId: pending.operationId, dispatchId: operation.dispatch.dispatchId, dispatchGeneration: operation.dispatch.generation, idempotencyKey: prepared.idempotencyKey, candidateDigest: subject.candidateDigest.hex });
|
|
1173
|
+
if (!checked || checked.outcome === 'failed'
|
|
1174
|
+
|| !verifySignedPayload(state.vault.resolveNetworkCredential(endpoint.signingCredentialRef), canonical(body), text(file.signature)))
|
|
1175
|
+
refuse('EVIDENCE_UNAVAILABLE', '/receipt', 'recovery');
|
|
1176
|
+
const outcome = checked.outcome === 'succeeded' ? 'succeeded' : 'not_executed';
|
|
1177
|
+
const prefix = join(artifacts.directory, 'publication-producer-' + hash(pending.operationId).hex);
|
|
1178
|
+
let binding = null;
|
|
1179
|
+
try {
|
|
1180
|
+
binding = record(parsePrivateJson(await readBoundedFile(prefix + '.binding.json', 1048576, true), 1048576), ['version', 'planDigest', 'operationId', 'requestDigest', 'requestBytesDigest', 'intentDigest', 'subject', 'endpoint', 'dispatchReceipt']);
|
|
1181
|
+
}
|
|
1182
|
+
catch (error) {
|
|
1183
|
+
if (error instanceof ControllerFailure && error.diagnostic.code === 'REGISTRY_UNTRUSTED')
|
|
1184
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1185
|
+
throw error;
|
|
1186
|
+
}
|
|
1187
|
+
if (binding.version !== 1 || binding.operationId !== pending.operationId || !same(binding.intentDigest, operation.intentDigest) || binding.endpoint !== endpoint.id)
|
|
1188
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1189
|
+
let outputRef;
|
|
1190
|
+
let receiptRef;
|
|
1191
|
+
// Reuse the settled proof pair only when both halves are present; an unresolved proof (receipt: null) never
|
|
1192
|
+
// carries the settled verdict, so the settled output and receipt are written fresh below.
|
|
1193
|
+
const settledProof = await (async () => { try {
|
|
1194
|
+
const parsed = record(parsePrivateJson(await readBoundedFile(prefix + '.proof.json', 1048576, true), 1048576), ['version', 'output', 'receipt', 'evidence']);
|
|
1195
|
+
return parsed.output !== null && parsed.receipt !== null ? { output: checkedRef(parsed.output), receiptRef: checkedRef(parsed.receipt) } : null;
|
|
1196
|
+
}
|
|
1197
|
+
catch {
|
|
1198
|
+
return null;
|
|
1199
|
+
} })();
|
|
1200
|
+
const suffix = hash(pending.operationId + '\0' + prepared.idempotencyKey).hex.slice(0, 40);
|
|
1201
|
+
const receipt = { receiptId: 'receipt.' + suffix, outcome,
|
|
1202
|
+
evidence: { evidenceId: 'receipt-evidence.' + suffix, producerId: 'loopwright.publisher.v1', method: 'publish_external',
|
|
1203
|
+
subject: { storeId: original.storeId, runId: lock.spec.runId, lockHash: lock.spec.lockHash, operationId: pending.operationId, requestId: null, intentDigest: operation.intentDigest, dispatchGeneration: operation.dispatch.generation, dispatchId: operation.dispatch.dispatchId }, artifact: null } };
|
|
1204
|
+
if (operation.state === 'confirmed') {
|
|
1205
|
+
const settledReceipt = operation.reconciliation ?? operation.initialReceipt;
|
|
1206
|
+
if (!settledReceipt || settledReceipt.receiptId !== receipt.receiptId || settledReceipt.outcome !== receipt.outcome || !same(settledReceipt.evidence.subject, receipt.evidence.subject))
|
|
1207
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
1208
|
+
// The settled output must carry exactly the operator receipt body, byte for byte, or this is a conflict.
|
|
1209
|
+
const savedOutput = record(parsePrivateJson(await artifacts.read(settledReceipt.evidence.artifact, 65536), 65536), ['version', 'binding', 'observation', 'outcome', 'responseBytes', 'responseSignature']);
|
|
1210
|
+
if (!same(parsePrivateJson(Buffer.from(text(savedOutput.responseBytes), 'base64'), 65536), body))
|
|
1211
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
1212
|
+
outputRef = settledReceipt.evidence.artifact;
|
|
1213
|
+
receiptRef = settledProof ? settledProof.receiptRef : settledReceipt.evidence.artifact;
|
|
1214
|
+
receipt.evidence.artifact = outputRef;
|
|
1215
|
+
}
|
|
1216
|
+
else if (settledProof) {
|
|
1217
|
+
// The on-disk proof already carries the settled live evidence (crash between .proof.json and recordOperationReceipt);
|
|
1218
|
+
// it is validated and adopted as-is — the live evidence field is never rewritten.
|
|
1219
|
+
const savedOutput = record(parsePrivateJson(await artifacts.read(settledProof.output, 65536), 65536), ['version', 'binding', 'observation', 'outcome', 'responseBytes', 'responseSignature']);
|
|
1220
|
+
const savedBytes = Buffer.from(text(savedOutput.responseBytes), 'base64');
|
|
1221
|
+
const savedChecked = savedOutput.version === 1 && (savedOutput.outcome === 'succeeded' || savedOutput.outcome === 'not_executed')
|
|
1222
|
+
? verifyPublicationReceipt(parsePrivateJson(savedBytes, 65536), { storeId: original.storeId, runId: lock.spec.runId, lockHash: lock.spec.lockHash, operationId: pending.operationId, dispatchId: operation.dispatch.dispatchId, dispatchGeneration: operation.dispatch.generation, idempotencyKey: prepared.idempotencyKey, candidateDigest: subject.candidateDigest.hex }) : null;
|
|
1223
|
+
if (!savedChecked || savedChecked.outcome === 'failed'
|
|
1224
|
+
|| !verifySignedPayload(state.vault.resolveNetworkCredential(endpoint.signingCredentialRef), savedBytes, text(savedOutput.responseSignature)))
|
|
1225
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1226
|
+
if (!same(parsePrivateJson(savedBytes, 65536), body))
|
|
1227
|
+
refuse('RECEIPT_CONFLICT', '/receipt', 'recovery');
|
|
1228
|
+
outputRef = settledProof.output;
|
|
1229
|
+
receipt.evidence.artifact = outputRef;
|
|
1230
|
+
receiptRef = settledProof.receiptRef;
|
|
1231
|
+
if (!same(parsePrivateJson(await artifacts.read(settledProof.receiptRef, 65536), 65536), receipt))
|
|
1232
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1233
|
+
stateValue(store.reconcileOperation(authority, pending.operationId, receipt));
|
|
1234
|
+
}
|
|
1235
|
+
else {
|
|
1236
|
+
outputRef = await artifacts.json('publication-output', { version: 1, binding: { planDigest: plan.planDigest, operationId: pending.operationId, idempotencyKey: prepared.idempotencyKey, endpoint: endpoint.id, subject, requestDigest: prepared.requestDigest }, observation: { transport: 'completed' }, outcome, responseBytes: Buffer.from(canonical(body)).toString('base64'), responseSignature: text(file.signature) }, 65536);
|
|
1237
|
+
receipt.evidence.artifact = outputRef;
|
|
1238
|
+
receiptRef = await artifacts.json('publication-receipt', receipt, 65536);
|
|
1239
|
+
await replaceMarker(prefix + '.proof.json', { version: 1, output: outputRef, receipt: receiptRef, evidence: null }, state.vault);
|
|
1240
|
+
stateValue(store.reconcileOperation(authority, pending.operationId, receipt));
|
|
1241
|
+
}
|
|
1242
|
+
const executionStatus = await publishReconcileOutcome(store, owner, artifacts, plan, lock, descriptor, head, authority, outcome, pending.operationId, receiptRef);
|
|
1243
|
+
if (executionStatus.authority !== null)
|
|
1244
|
+
authority = executionStatus.authority;
|
|
1245
|
+
if (executionStatus.status === null) {
|
|
1246
|
+
// resumeCycleWithPorts re-acquires the owner and reopens the store; release everything first so it never hits OWNER_BUSY.
|
|
1247
|
+
stateValue(store.release(authority));
|
|
1248
|
+
authority = null;
|
|
1249
|
+
stateValue(store.close());
|
|
1250
|
+
store = null;
|
|
1251
|
+
await owner.release();
|
|
1252
|
+
owner = null;
|
|
1253
|
+
const execution = await resumeCycleWithPorts({ configuration: input.configuration, repository: descriptor.repository, runRoot: input.runRoot, runId: input.runId, ...(input.signal ? { signal: input.signal } : {}) }, effectivePorts);
|
|
1254
|
+
if (!execution.ok || execution.value.kind !== 'result')
|
|
1255
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1256
|
+
const status = execution.value.result.spec.status;
|
|
1257
|
+
if (status === 'reconcile_required')
|
|
1258
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
1259
|
+
return freeze({ kind: 'settled', version: 1, runId: lock.spec.runId, status: status === 'completed' ? 'completed' : status === 'failed' ? 'failed' : 'blocked', outcome, externalEffects: execution.value.result.spec.externalEffects === 'confirmed' ? 'confirmed' : 'none', receipt: freeze(receipt) });
|
|
1260
|
+
}
|
|
1261
|
+
if (executionStatus.status === 'reconcile_required')
|
|
1262
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'remaining_unresolved_work' });
|
|
1263
|
+
if (executionStatus.status === 'incident_retained')
|
|
1264
|
+
return freeze({ kind: 'unresolved', version: 1, runId: lock.spec.runId, reason: 'incident_retained' });
|
|
1265
|
+
return freeze({ kind: 'settled', version: 1, runId: lock.spec.runId, status: executionStatus.status === 'completed' ? 'completed' : 'failed', outcome, externalEffects: executionStatus.fx, receipt: freeze(receipt) });
|
|
1266
|
+
}
|
|
1267
|
+
catch (error) {
|
|
1268
|
+
primaryFailed = true;
|
|
1269
|
+
throw error;
|
|
1270
|
+
}
|
|
1271
|
+
finally {
|
|
1272
|
+
await releaseReconcileHandles(store, authority, owner, primaryFailed);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
/** Supersedes a retained reconcile_required terminal result in place when the run has already terminalized. */
|
|
1276
|
+
async function publishReconcileOutcome(store, owner, artifacts, plan, lock, descriptor, head, authority, outcome, operationId, receiptRef) {
|
|
1277
|
+
const prior = head.progress.terminalIntent;
|
|
1278
|
+
if (head.progress.stage.kind !== 'reconcile_result' && (head.progress.stage.kind.startsWith('terminal') || prior !== null && prior.primary === 'reconcile_required')) {
|
|
1279
|
+
if (!prior?.result)
|
|
1280
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1281
|
+
let raw;
|
|
1282
|
+
try {
|
|
1283
|
+
raw = parsePrivateJson(await artifacts.read(prior.result, 1048576), 1048576);
|
|
1284
|
+
}
|
|
1285
|
+
catch {
|
|
1286
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1287
|
+
}
|
|
1288
|
+
const priorResult = validateDocument(raw, 'RunResult');
|
|
1289
|
+
if (!priorResult.ok) {
|
|
1290
|
+
// An immutable incident primary is never overwritten: the verified receipt lands in the journal and in the
|
|
1291
|
+
// reconcile.result observations (exported as publication.json), while the run stays unresolved incident_retained.
|
|
1292
|
+
const incidentDoc = record(raw, ['version', 'code', 'runId', 'lockHash', 'stage', 'knownReferences', 'unavailable', 'cleanup']);
|
|
1293
|
+
if (incidentDoc.version !== 1 || incidentDoc.runId !== lock.spec.runId || !same(incidentDoc.lockHash, lock.spec.lockHash) || incidentDoc.code !== prior.primary)
|
|
1294
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1295
|
+
const current = stateValue(store.inspect());
|
|
1296
|
+
const stillUnresolved = current.counts.dispatchedRequests > 0 || current.counts.unresolvedRequests > 0 || current.counts.unresolvedOperations > 0 || current.ledger.violations.length > 0;
|
|
1297
|
+
if (!stillUnresolved && head.progress.stage.kind.startsWith('terminal') && head.progress.publication.status === (outcome === 'succeeded' ? 'confirmed' : 'failed'))
|
|
1298
|
+
return { status: 'incident_retained', fx: 'unknown', authority: null };
|
|
1299
|
+
let observations = null;
|
|
1300
|
+
if (prior.observations) {
|
|
1301
|
+
try {
|
|
1302
|
+
observations = parsePrivateJson(await artifacts.read(prior.observations, 1048576), 1048576);
|
|
1303
|
+
}
|
|
1304
|
+
catch {
|
|
1305
|
+
observations = null;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
const observationsRef = await artifacts.json('observations', { ...(observations ?? { version: 1, events: null }), primary: prior.result, publication: stillUnresolved ? { status: 'unresolved', reason: 'remaining_unresolved_work', receipt: null } : { status: outcome === 'succeeded' ? 'confirmed' : 'failed', reason: outcome === 'succeeded' ? null : 'not_executed', receipt: receiptRef } }, 1048576);
|
|
1309
|
+
stateValue(store.release(authority));
|
|
1310
|
+
const claimed = stateValue(store.inspect());
|
|
1311
|
+
const active = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: claimed.owner.generation, expectedRevision: claimed.revision, mode: 'active' })).authority;
|
|
1312
|
+
try {
|
|
1313
|
+
const progress = new ProgressStore(store, active, artifacts, plan, lock, descriptor.plan, descriptor.source);
|
|
1314
|
+
await progress.publish({ ...head.progress, stage: { ...head.progress.stage, kind: 'reconcile_result' }, publication: { status: outcome === 'succeeded' ? 'confirmed' : 'failed', operationId, receipt: receiptRef }, terminalIntent: { primary: prior.primary, result: prior.result, observations: observationsRef } }, 'reconcile.result');
|
|
1315
|
+
}
|
|
1316
|
+
finally {
|
|
1317
|
+
stateValue(store.release(active));
|
|
1318
|
+
}
|
|
1319
|
+
const currentAfter = stateValue(store.inspect());
|
|
1320
|
+
const restored = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: currentAfter.owner.generation, expectedRevision: currentAfter.revision, mode: 'recovery' })).authority;
|
|
1321
|
+
return { status: stillUnresolved ? 'reconcile_required' : 'incident_retained', fx: 'unknown', authority: restored };
|
|
1322
|
+
}
|
|
1323
|
+
const current = stateValue(store.inspect());
|
|
1324
|
+
const stillUnresolved = current.counts.dispatchedRequests > 0 || current.counts.unresolvedRequests > 0 || current.counts.unresolvedOperations > 0 || current.ledger.violations.length > 0;
|
|
1325
|
+
const status = stillUnresolved ? 'reconcile_required' : outcome === 'succeeded' ? 'completed' : 'failed';
|
|
1326
|
+
const fx = stillUnresolved ? 'unknown' : outcome === 'succeeded' ? 'confirmed' : 'none';
|
|
1327
|
+
// An already-settled terminal run that matches this receipt reports the settled outcome without a redundant checkpoint.
|
|
1328
|
+
if (!stillUnresolved && head.progress.stage.kind.startsWith('terminal') && prior !== null && prior.primary === status
|
|
1329
|
+
&& head.progress.publication.status === (outcome === 'succeeded' ? 'confirmed' : 'failed'))
|
|
1330
|
+
return { status, fx, authority: null };
|
|
1331
|
+
const updated = validateDocument({ ...raw, spec: { ...raw.spec, status, externalEffects: fx } }, 'RunResult');
|
|
1332
|
+
if (!updated.ok)
|
|
1333
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1334
|
+
const primaryRef = await artifacts.json('result', updated.value, 1048576);
|
|
1335
|
+
let observations = null;
|
|
1336
|
+
if (prior.observations) {
|
|
1337
|
+
try {
|
|
1338
|
+
observations = parsePrivateJson(await artifacts.read(prior.observations, 1048576), 1048576);
|
|
1339
|
+
}
|
|
1340
|
+
catch {
|
|
1341
|
+
observations = null;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
const observationsRef = await artifacts.json('observations', { ...(observations ?? { version: 1, events: null }), primary: primaryRef, publication: stillUnresolved ? { status: 'unresolved', reason: 'remaining_unresolved_work', receipt: null } : { status: outcome === 'succeeded' ? 'confirmed' : 'failed', reason: outcome === 'succeeded' ? null : 'not_executed', receipt: receiptRef } }, 1048576);
|
|
1345
|
+
stateValue(store.release(authority));
|
|
1346
|
+
const claimed = stateValue(store.inspect());
|
|
1347
|
+
const active = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: claimed.owner.generation, expectedRevision: claimed.revision, mode: 'active' })).authority;
|
|
1348
|
+
try {
|
|
1349
|
+
const progress = new ProgressStore(store, active, artifacts, plan, lock, descriptor.plan, descriptor.source);
|
|
1350
|
+
await progress.publish({ ...head.progress, stage: { ...head.progress.stage, kind: 'reconcile_result' }, publication: { status: outcome === 'succeeded' ? 'confirmed' : 'failed', operationId, receipt: receiptRef }, terminalIntent: { primary: status, result: primaryRef, observations: observationsRef } }, 'reconcile.result');
|
|
1351
|
+
}
|
|
1352
|
+
finally {
|
|
1353
|
+
stateValue(store.release(active));
|
|
1354
|
+
}
|
|
1355
|
+
const currentAfter = stateValue(store.inspect());
|
|
1356
|
+
const restored = stateValue(store.claim({ ownerId: 'controller.' + owner.nonce, expectedGeneration: currentAfter.owner.generation, expectedRevision: currentAfter.revision, mode: 'recovery' })).authority;
|
|
1357
|
+
return { status, fx, authority: restored };
|
|
1358
|
+
}
|
|
1359
|
+
if (head.progress.stage.kind === 'reconcile_result')
|
|
1360
|
+
return await stillUnresolvedView(store, outcome, head, artifacts);
|
|
1361
|
+
return { status: null, fx: 'none', authority: null };
|
|
1362
|
+
}
|
|
1363
|
+
async function stillUnresolvedView(store, outcome, head, artifacts) {
|
|
1364
|
+
const current = stateValue(store.inspect());
|
|
1365
|
+
const stillUnresolved = current.counts.dispatchedRequests > 0 || current.counts.unresolvedRequests > 0 || current.counts.unresolvedOperations > 0 || current.ledger.violations.length > 0;
|
|
1366
|
+
if (!stillUnresolved && head.progress.terminalIntent?.result) {
|
|
1367
|
+
let raw;
|
|
1368
|
+
try {
|
|
1369
|
+
raw = parsePrivateJson(await artifacts.read(head.progress.terminalIntent.result, 1048576), 1048576);
|
|
1370
|
+
}
|
|
1371
|
+
catch {
|
|
1372
|
+
refuse('RECOVERY_REQUIRED', '', 'recovery');
|
|
1373
|
+
}
|
|
1374
|
+
if (!validateDocument(raw, 'RunResult').ok)
|
|
1375
|
+
return { status: 'incident_retained', fx: 'unknown', authority: null };
|
|
1376
|
+
}
|
|
1377
|
+
return { status: stillUnresolved ? 'reconcile_required' : outcome === 'succeeded' ? 'completed' : 'failed', fx: stillUnresolved ? 'unknown' : outcome === 'succeeded' ? 'confirmed' : 'none', authority: null };
|
|
1378
|
+
}
|