@gpustack/loopwright 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +356 -2
- package/bin/loopwright.js +3 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter-v2.d.ts +9 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter-v2.js +122 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter.d.ts +30 -0
- package/node_modules/@loopwright/agent-pi/dist/adapter.js +340 -0
- package/node_modules/@loopwright/agent-pi/dist/admission.d.ts +25 -0
- package/node_modules/@loopwright/agent-pi/dist/admission.js +65 -0
- package/node_modules/@loopwright/agent-pi/dist/artifacts.d.ts +15 -0
- package/node_modules/@loopwright/agent-pi/dist/artifacts.js +76 -0
- package/node_modules/@loopwright/agent-pi/dist/boundary.d.ts +18 -0
- package/node_modules/@loopwright/agent-pi/dist/boundary.js +113 -0
- package/node_modules/@loopwright/agent-pi/dist/broker-channel.d.ts +4 -0
- package/node_modules/@loopwright/agent-pi/dist/broker-channel.js +121 -0
- package/node_modules/@loopwright/agent-pi/dist/candidate.d.ts +96 -0
- package/node_modules/@loopwright/agent-pi/dist/candidate.js +1712 -0
- package/node_modules/@loopwright/agent-pi/dist/capture.d.ts +39 -0
- package/node_modules/@loopwright/agent-pi/dist/capture.js +146 -0
- package/node_modules/@loopwright/agent-pi/dist/cas.d.ts +51 -0
- package/node_modules/@loopwright/agent-pi/dist/cas.js +836 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog-api.d.ts +3 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog-api.js +2 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog.d.ts +39 -0
- package/node_modules/@loopwright/agent-pi/dist/catalog.js +280 -0
- package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.d.ts +9 -0
- package/node_modules/@loopwright/agent-pi/dist/circuit-breaker-limits.js +12 -0
- package/node_modules/@loopwright/agent-pi/dist/containers.d.ts +29 -0
- package/node_modules/@loopwright/agent-pi/dist/containers.js +160 -0
- package/node_modules/@loopwright/agent-pi/dist/context.d.ts +56 -0
- package/node_modules/@loopwright/agent-pi/dist/context.js +351 -0
- package/node_modules/@loopwright/agent-pi/dist/daemon.d.ts +8 -0
- package/node_modules/@loopwright/agent-pi/dist/daemon.js +52 -0
- package/node_modules/@loopwright/agent-pi/dist/deadline.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/deadline.js +18 -0
- package/node_modules/@loopwright/agent-pi/dist/decode-capture.d.ts +39 -0
- package/node_modules/@loopwright/agent-pi/dist/decode-capture.js +287 -0
- package/node_modules/@loopwright/agent-pi/dist/descriptor.d.ts +12 -0
- package/node_modules/@loopwright/agent-pi/dist/descriptor.js +17 -0
- package/node_modules/@loopwright/agent-pi/dist/docker-absence.d.ts +2 -0
- package/node_modules/@loopwright/agent-pi/dist/docker-absence.js +9 -0
- package/node_modules/@loopwright/agent-pi/dist/errors.d.ts +7 -0
- package/node_modules/@loopwright/agent-pi/dist/errors.js +19 -0
- package/node_modules/@loopwright/agent-pi/dist/event-sequence.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/event-sequence.js +64 -0
- package/node_modules/@loopwright/agent-pi/dist/events.d.ts +19 -0
- package/node_modules/@loopwright/agent-pi/dist/events.js +132 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-guard.d.ts +9 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-guard.js +25 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-lease.d.ts +24 -0
- package/node_modules/@loopwright/agent-pi/dist/execution-lease.js +316 -0
- package/node_modules/@loopwright/agent-pi/dist/execution.d.ts +32 -0
- package/node_modules/@loopwright/agent-pi/dist/execution.js +476 -0
- package/node_modules/@loopwright/agent-pi/dist/external-mcp.d.ts +87 -0
- package/node_modules/@loopwright/agent-pi/dist/external-mcp.js +526 -0
- package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.d.ts +15 -0
- package/node_modules/@loopwright/agent-pi/dist/factory-bootstrap.js +74 -0
- package/node_modules/@loopwright/agent-pi/dist/host-session.d.ts +51 -0
- package/node_modules/@loopwright/agent-pi/dist/host-session.js +2083 -0
- package/node_modules/@loopwright/agent-pi/dist/http-mcp.d.ts +32 -0
- package/node_modules/@loopwright/agent-pi/dist/http-mcp.js +353 -0
- package/node_modules/@loopwright/agent-pi/dist/index.d.ts +7 -0
- package/node_modules/@loopwright/agent-pi/dist/index.js +4 -0
- package/node_modules/@loopwright/agent-pi/dist/lifecycle.d.ts +13 -0
- package/node_modules/@loopwright/agent-pi/dist/lifecycle.js +11 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-process.d.ts +35 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-process.js +92 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-transport.d.ts +25 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp-transport.js +63 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp.d.ts +23 -0
- package/node_modules/@loopwright/agent-pi/dist/mcp.js +212 -0
- package/node_modules/@loopwright/agent-pi/dist/operation.d.ts +5 -0
- package/node_modules/@loopwright/agent-pi/dist/operation.js +28 -0
- package/node_modules/@loopwright/agent-pi/dist/policy-v2.d.ts +10 -0
- package/node_modules/@loopwright/agent-pi/dist/policy-v2.js +64 -0
- package/node_modules/@loopwright/agent-pi/dist/policy.d.ts +13 -0
- package/node_modules/@loopwright/agent-pi/dist/policy.js +260 -0
- package/node_modules/@loopwright/agent-pi/dist/preflight.d.ts +60 -0
- package/node_modules/@loopwright/agent-pi/dist/preflight.js +700 -0
- package/node_modules/@loopwright/agent-pi/dist/progress-summary.d.ts +1 -0
- package/node_modules/@loopwright/agent-pi/dist/progress-summary.js +119 -0
- package/node_modules/@loopwright/agent-pi/dist/protocol.d.ts +17 -0
- package/node_modules/@loopwright/agent-pi/dist/protocol.js +131 -0
- package/node_modules/@loopwright/agent-pi/dist/provider.d.ts +62 -0
- package/node_modules/@loopwright/agent-pi/dist/provider.js +217 -0
- package/node_modules/@loopwright/agent-pi/dist/receipt.d.ts +3 -0
- package/node_modules/@loopwright/agent-pi/dist/receipt.js +64 -0
- package/node_modules/@loopwright/agent-pi/dist/recovery.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/recovery.js +188 -0
- package/node_modules/@loopwright/agent-pi/dist/resources.d.ts +13 -0
- package/node_modules/@loopwright/agent-pi/dist/resources.js +81 -0
- package/node_modules/@loopwright/agent-pi/dist/response.d.ts +20 -0
- package/node_modules/@loopwright/agent-pi/dist/response.js +259 -0
- package/node_modules/@loopwright/agent-pi/dist/runtime-profile.d.ts +6 -0
- package/node_modules/@loopwright/agent-pi/dist/runtime-profile.js +37 -0
- package/node_modules/@loopwright/agent-pi/dist/sdk-worker.d.ts +14 -0
- package/node_modules/@loopwright/agent-pi/dist/sdk-worker.js +633 -0
- package/node_modules/@loopwright/agent-pi/dist/sender.d.ts +46 -0
- package/node_modules/@loopwright/agent-pi/dist/sender.js +553 -0
- package/node_modules/@loopwright/agent-pi/dist/session-host.d.ts +21 -0
- package/node_modules/@loopwright/agent-pi/dist/session-host.js +315 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.d.ts +14 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot-transfer.js +102 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot.d.ts +19 -0
- package/node_modules/@loopwright/agent-pi/dist/snapshot.js +121 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-process.d.ts +32 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-process.js +85 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-worker.d.ts +2 -0
- package/node_modules/@loopwright/agent-pi/dist/tool-worker.js +105 -0
- package/node_modules/@loopwright/agent-pi/dist/tools.d.ts +36 -0
- package/node_modules/@loopwright/agent-pi/dist/tools.js +128 -0
- package/node_modules/@loopwright/agent-pi/dist/types-v2.d.ts +71 -0
- package/node_modules/@loopwright/agent-pi/dist/types-v2.js +1 -0
- package/node_modules/@loopwright/agent-pi/dist/types.d.ts +314 -0
- package/node_modules/@loopwright/agent-pi/dist/types.js +1 -0
- package/node_modules/@loopwright/agent-pi/dist/usage.d.ts +18 -0
- package/node_modules/@loopwright/agent-pi/dist/usage.js +314 -0
- package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.d.ts +27 -0
- package/node_modules/@loopwright/agent-pi/dist/workspace-mcp.js +142 -0
- package/node_modules/@loopwright/agent-pi/package.json +24 -0
- package/node_modules/@loopwright/agent-pi/runtime/Dockerfile +8 -0
- package/node_modules/@loopwright/agent-pi/runtime/seccomp.json +1 -0
- package/node_modules/@loopwright/cli/dist/arguments.d.ts +19 -0
- package/node_modules/@loopwright/cli/dist/arguments.js +358 -0
- package/node_modules/@loopwright/cli/dist/closure.d.ts +93 -0
- package/node_modules/@loopwright/cli/dist/closure.js +230 -0
- package/node_modules/@loopwright/cli/dist/draft.d.ts +9 -0
- package/node_modules/@loopwright/cli/dist/draft.js +106 -0
- package/node_modules/@loopwright/cli/dist/failure-matrix.d.ts +9 -0
- package/node_modules/@loopwright/cli/dist/failure-matrix.js +701 -0
- package/node_modules/@loopwright/cli/dist/index.d.ts +6 -0
- package/node_modules/@loopwright/cli/dist/index.js +5 -0
- package/node_modules/@loopwright/cli/dist/main.d.ts +22 -0
- package/node_modules/@loopwright/cli/dist/main.js +1855 -0
- package/node_modules/@loopwright/cli/package.json +16 -0
- package/node_modules/@loopwright/controller/dist/acceptance.d.ts +43 -0
- package/node_modules/@loopwright/controller/dist/acceptance.js +446 -0
- package/node_modules/@loopwright/controller/dist/benchmark-gate.d.ts +273 -0
- package/node_modules/@loopwright/controller/dist/benchmark-gate.js +3147 -0
- package/node_modules/@loopwright/controller/dist/budget-observations.d.ts +25 -0
- package/node_modules/@loopwright/controller/dist/budget-observations.js +139 -0
- package/node_modules/@loopwright/controller/dist/bundle.d.ts +26 -0
- package/node_modules/@loopwright/controller/dist/bundle.js +64 -0
- package/node_modules/@loopwright/controller/dist/capture.d.ts +89 -0
- package/node_modules/@loopwright/controller/dist/capture.js +587 -0
- package/node_modules/@loopwright/controller/dist/compile.d.ts +3 -0
- package/node_modules/@loopwright/controller/dist/compile.js +402 -0
- package/node_modules/@loopwright/controller/dist/config.d.ts +22 -0
- package/node_modules/@loopwright/controller/dist/config.js +255 -0
- package/node_modules/@loopwright/controller/dist/controller.d.ts +177 -0
- package/node_modules/@loopwright/controller/dist/controller.js +2135 -0
- package/node_modules/@loopwright/controller/dist/credentials.d.ts +29 -0
- package/node_modules/@loopwright/controller/dist/credentials.js +189 -0
- package/node_modules/@loopwright/controller/dist/deadlines.d.ts +18 -0
- package/node_modules/@loopwright/controller/dist/deadlines.js +71 -0
- package/node_modules/@loopwright/controller/dist/errors.d.ts +27 -0
- package/node_modules/@loopwright/controller/dist/errors.js +41 -0
- package/node_modules/@loopwright/controller/dist/events.d.ts +52 -0
- package/node_modules/@loopwright/controller/dist/events.js +228 -0
- package/node_modules/@loopwright/controller/dist/files.d.ts +51 -0
- package/node_modules/@loopwright/controller/dist/files.js +386 -0
- package/node_modules/@loopwright/controller/dist/finalize.d.ts +25 -0
- package/node_modules/@loopwright/controller/dist/finalize.js +32 -0
- package/node_modules/@loopwright/controller/dist/gate.d.ts +84 -0
- package/node_modules/@loopwright/controller/dist/gate.js +640 -0
- package/node_modules/@loopwright/controller/dist/git-objects.d.ts +11 -0
- package/node_modules/@loopwright/controller/dist/git-objects.js +59 -0
- package/node_modules/@loopwright/controller/dist/git-reader.d.ts +17 -0
- package/node_modules/@loopwright/controller/dist/git-reader.js +40 -0
- package/node_modules/@loopwright/controller/dist/handlers.d.ts +6 -0
- package/node_modules/@loopwright/controller/dist/handlers.js +45 -0
- package/node_modules/@loopwright/controller/dist/handoff.d.ts +71 -0
- package/node_modules/@loopwright/controller/dist/handoff.js +554 -0
- package/node_modules/@loopwright/controller/dist/index.d.ts +41 -0
- package/node_modules/@loopwright/controller/dist/index.js +21 -0
- package/node_modules/@loopwright/controller/dist/inspect.d.ts +30 -0
- package/node_modules/@loopwright/controller/dist/inspect.js +372 -0
- package/node_modules/@loopwright/controller/dist/interpolation.d.ts +9 -0
- package/node_modules/@loopwright/controller/dist/interpolation.js +79 -0
- package/node_modules/@loopwright/controller/dist/ownership.d.ts +41 -0
- package/node_modules/@loopwright/controller/dist/ownership.js +666 -0
- package/node_modules/@loopwright/controller/dist/parser.d.ts +5 -0
- package/node_modules/@loopwright/controller/dist/parser.js +200 -0
- package/node_modules/@loopwright/controller/dist/progress.d.ts +41 -0
- package/node_modules/@loopwright/controller/dist/progress.js +904 -0
- package/node_modules/@loopwright/controller/dist/publication.d.ts +60 -0
- package/node_modules/@loopwright/controller/dist/publication.js +329 -0
- package/node_modules/@loopwright/controller/dist/reconcile.d.ts +26 -0
- package/node_modules/@loopwright/controller/dist/reconcile.js +1378 -0
- package/node_modules/@loopwright/controller/dist/recovery.d.ts +10 -0
- package/node_modules/@loopwright/controller/dist/recovery.js +315 -0
- package/node_modules/@loopwright/controller/dist/refusal-record.d.ts +43 -0
- package/node_modules/@loopwright/controller/dist/refusal-record.js +150 -0
- package/node_modules/@loopwright/controller/dist/registry.d.ts +6 -0
- package/node_modules/@loopwright/controller/dist/registry.js +374 -0
- package/node_modules/@loopwright/controller/dist/repair.d.ts +31 -0
- package/node_modules/@loopwright/controller/dist/repair.js +102 -0
- package/node_modules/@loopwright/controller/dist/report.d.ts +64 -0
- package/node_modules/@loopwright/controller/dist/report.js +596 -0
- package/node_modules/@loopwright/controller/dist/retained.d.ts +284 -0
- package/node_modules/@loopwright/controller/dist/retained.js +193 -0
- package/node_modules/@loopwright/controller/dist/rules.d.ts +31 -0
- package/node_modules/@loopwright/controller/dist/rules.js +110 -0
- package/node_modules/@loopwright/controller/dist/run-eval.d.ts +115 -0
- package/node_modules/@loopwright/controller/dist/run-eval.js +959 -0
- package/node_modules/@loopwright/controller/dist/scheduler.d.ts +10 -0
- package/node_modules/@loopwright/controller/dist/scheduler.js +41 -0
- package/node_modules/@loopwright/controller/dist/schema.d.ts +17 -0
- package/node_modules/@loopwright/controller/dist/schema.js +78 -0
- package/node_modules/@loopwright/controller/dist/source.d.ts +69 -0
- package/node_modules/@loopwright/controller/dist/source.js +872 -0
- package/node_modules/@loopwright/controller/dist/step.d.ts +38 -0
- package/node_modules/@loopwright/controller/dist/step.js +1776 -0
- package/node_modules/@loopwright/controller/dist/storage.d.ts +90 -0
- package/node_modules/@loopwright/controller/dist/storage.js +1345 -0
- package/node_modules/@loopwright/controller/dist/submission.d.ts +51 -0
- package/node_modules/@loopwright/controller/dist/submission.js +292 -0
- package/node_modules/@loopwright/controller/dist/types.d.ts +585 -0
- package/node_modules/@loopwright/controller/dist/types.js +9 -0
- package/node_modules/@loopwright/controller/dist/verification.d.ts +124 -0
- package/node_modules/@loopwright/controller/dist/verification.js +1308 -0
- package/node_modules/@loopwright/controller/dist/verifier-protocol.d.ts +105 -0
- package/node_modules/@loopwright/controller/dist/verifier-protocol.js +1312 -0
- package/node_modules/@loopwright/controller/dist/verifier-worker.d.ts +1 -0
- package/node_modules/@loopwright/controller/dist/verifier-worker.js +33 -0
- package/node_modules/@loopwright/controller/package.json +12 -0
- package/node_modules/@loopwright/core/dist/acceptance.d.ts +108 -0
- package/node_modules/@loopwright/core/dist/acceptance.js +327 -0
- package/node_modules/@loopwright/core/dist/artifacts.d.ts +63 -0
- package/node_modules/@loopwright/core/dist/artifacts.js +356 -0
- package/node_modules/@loopwright/core/dist/boundary.d.ts +21 -0
- package/node_modules/@loopwright/core/dist/boundary.js +484 -0
- package/node_modules/@loopwright/core/dist/contracts.d.ts +287 -0
- package/node_modules/@loopwright/core/dist/contracts.js +694 -0
- package/node_modules/@loopwright/core/dist/diagnostics.d.ts +21 -0
- package/node_modules/@loopwright/core/dist/diagnostics.js +51 -0
- package/node_modules/@loopwright/core/dist/evidence.d.ts +92 -0
- package/node_modules/@loopwright/core/dist/evidence.js +85 -0
- package/node_modules/@loopwright/core/dist/graph.d.ts +8 -0
- package/node_modules/@loopwright/core/dist/graph.js +44 -0
- package/node_modules/@loopwright/core/dist/identity.d.ts +162 -0
- package/node_modules/@loopwright/core/dist/identity.js +80 -0
- package/node_modules/@loopwright/core/dist/index.d.ts +30 -0
- package/node_modules/@loopwright/core/dist/index.js +39 -0
- package/node_modules/@loopwright/core/dist/limits.d.ts +99 -0
- package/node_modules/@loopwright/core/dist/limits.js +59 -0
- package/node_modules/@loopwright/core/dist/results.d.ts +161 -0
- package/node_modules/@loopwright/core/dist/results.js +98 -0
- package/node_modules/@loopwright/core/dist/scope.d.ts +13 -0
- package/node_modules/@loopwright/core/dist/scope.js +154 -0
- package/node_modules/@loopwright/core/dist/scrubber.d.ts +13 -0
- package/node_modules/@loopwright/core/dist/scrubber.js +63 -0
- package/node_modules/@loopwright/core/dist/usage.d.ts +68 -0
- package/node_modules/@loopwright/core/dist/usage.js +56 -0
- package/node_modules/@loopwright/core/package.json +12 -0
- package/node_modules/@loopwright/decisions/dist/benchmark.d.ts +23 -0
- package/node_modules/@loopwright/decisions/dist/benchmark.js +337 -0
- package/node_modules/@loopwright/decisions/dist/client.d.ts +74 -0
- package/node_modules/@loopwright/decisions/dist/client.js +292 -0
- package/node_modules/@loopwright/decisions/dist/index.d.ts +15 -0
- package/node_modules/@loopwright/decisions/dist/index.js +8 -0
- package/node_modules/@loopwright/decisions/dist/nodes.d.ts +63 -0
- package/node_modules/@loopwright/decisions/dist/nodes.js +282 -0
- package/node_modules/@loopwright/decisions/dist/primitives.d.ts +36 -0
- package/node_modules/@loopwright/decisions/dist/primitives.js +300 -0
- package/node_modules/@loopwright/decisions/dist/redaction.d.ts +23 -0
- package/node_modules/@loopwright/decisions/dist/redaction.js +146 -0
- package/node_modules/@loopwright/decisions/dist/router.d.ts +55 -0
- package/node_modules/@loopwright/decisions/dist/router.js +248 -0
- package/node_modules/@loopwright/decisions/dist/schema.d.ts +25 -0
- package/node_modules/@loopwright/decisions/dist/schema.js +536 -0
- package/node_modules/@loopwright/decisions/dist/types.d.ts +394 -0
- package/node_modules/@loopwright/decisions/dist/types.js +80 -0
- package/node_modules/@loopwright/decisions/package.json +12 -0
- package/node_modules/@loopwright/github-app/dist/action.d.ts +90 -0
- package/node_modules/@loopwright/github-app/dist/action.js +2429 -0
- package/node_modules/@loopwright/github-app/dist/config.d.ts +23 -0
- package/node_modules/@loopwright/github-app/dist/config.js +297 -0
- package/node_modules/@loopwright/github-app/dist/digests.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/digests.js +1 -0
- package/node_modules/@loopwright/github-app/dist/index.d.ts +14 -0
- package/node_modules/@loopwright/github-app/dist/index.js +13 -0
- package/node_modules/@loopwright/github-app/dist/models-config.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/models-config.js +1 -0
- package/node_modules/@loopwright/github-app/dist/output-format.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/output-format.js +1 -0
- package/node_modules/@loopwright/github-app/dist/preflight.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/preflight.js +1 -0
- package/node_modules/@loopwright/github-app/dist/publisher.d.ts +58 -0
- package/node_modules/@loopwright/github-app/dist/publisher.js +1368 -0
- package/node_modules/@loopwright/github-app/dist/qualification.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/qualification.js +1 -0
- package/node_modules/@loopwright/github-app/dist/sandbox.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/sandbox.js +1 -0
- package/node_modules/@loopwright/github-app/dist/schema.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/schema.js +1 -0
- package/node_modules/@loopwright/github-app/dist/service.d.ts +52 -0
- package/node_modules/@loopwright/github-app/dist/service.js +1658 -0
- package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.d.ts +90 -0
- package/node_modules/@loopwright/github-app/dist/suite-pr-lookup.js +392 -0
- package/node_modules/@loopwright/github-app/dist/taskpack.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/taskpack.js +1 -0
- package/node_modules/@loopwright/github-app/dist/tenant-queue.d.ts +44 -0
- package/node_modules/@loopwright/github-app/dist/tenant-queue.js +423 -0
- package/node_modules/@loopwright/github-app/dist/token-broker.d.ts +50 -0
- package/node_modules/@loopwright/github-app/dist/token-broker.js +262 -0
- package/node_modules/@loopwright/github-app/dist/turnkey-memory.d.ts +35 -0
- package/node_modules/@loopwright/github-app/dist/turnkey-memory.js +1654 -0
- package/node_modules/@loopwright/github-app/dist/turnkey.d.ts +16 -0
- package/node_modules/@loopwright/github-app/dist/turnkey.js +34 -0
- package/node_modules/@loopwright/github-app/dist/types.d.ts +220 -0
- package/node_modules/@loopwright/github-app/dist/types.js +14 -0
- package/node_modules/@loopwright/github-app/dist/upstreams.d.ts +13 -0
- package/node_modules/@loopwright/github-app/dist/upstreams.js +65 -0
- package/node_modules/@loopwright/github-app/dist/webhook.d.ts +34 -0
- package/node_modules/@loopwright/github-app/dist/webhook.js +241 -0
- package/node_modules/@loopwright/github-app/dist/yaml.d.ts +1 -0
- package/node_modules/@loopwright/github-app/dist/yaml.js +1 -0
- package/node_modules/@loopwright/github-app/package.json +12 -0
- package/node_modules/@loopwright/hardware-runner/dist/config.d.ts +48 -0
- package/node_modules/@loopwright/hardware-runner/dist/config.js +719 -0
- package/node_modules/@loopwright/hardware-runner/dist/evaluator.d.ts +230 -0
- package/node_modules/@loopwright/hardware-runner/dist/evaluator.js +3178 -0
- package/node_modules/@loopwright/hardware-runner/dist/index.d.ts +13 -0
- package/node_modules/@loopwright/hardware-runner/dist/index.js +9 -0
- package/node_modules/@loopwright/hardware-runner/dist/provenance.d.ts +128 -0
- package/node_modules/@loopwright/hardware-runner/dist/provenance.js +1500 -0
- package/node_modules/@loopwright/hardware-runner/dist/queue.d.ts +81 -0
- package/node_modules/@loopwright/hardware-runner/dist/queue.js +1081 -0
- package/node_modules/@loopwright/hardware-runner/dist/relay-server.d.ts +13 -0
- package/node_modules/@loopwright/hardware-runner/dist/relay-server.js +2997 -0
- package/node_modules/@loopwright/hardware-runner/dist/types.d.ts +239 -0
- package/node_modules/@loopwright/hardware-runner/dist/types.js +12 -0
- package/node_modules/@loopwright/hardware-runner/dist/worker.d.ts +49 -0
- package/node_modules/@loopwright/hardware-runner/dist/worker.js +1646 -0
- package/node_modules/@loopwright/hardware-runner/package.json +12 -0
- package/node_modules/@loopwright/memory/dist/cas.d.ts +21 -0
- package/node_modules/@loopwright/memory/dist/cas.js +510 -0
- package/node_modules/@loopwright/memory/dist/compaction.d.ts +18 -0
- package/node_modules/@loopwright/memory/dist/compaction.js +110 -0
- package/node_modules/@loopwright/memory/dist/finalizer.d.ts +23 -0
- package/node_modules/@loopwright/memory/dist/finalizer.js +538 -0
- package/node_modules/@loopwright/memory/dist/index.d.ts +9 -0
- package/node_modules/@loopwright/memory/dist/index.js +8 -0
- package/node_modules/@loopwright/memory/dist/schema.d.ts +36 -0
- package/node_modules/@loopwright/memory/dist/schema.js +510 -0
- package/node_modules/@loopwright/memory/dist/selector.d.ts +7 -0
- package/node_modules/@loopwright/memory/dist/selector.js +157 -0
- package/node_modules/@loopwright/memory/dist/store.d.ts +51 -0
- package/node_modules/@loopwright/memory/dist/store.js +554 -0
- package/node_modules/@loopwright/memory/dist/types.d.ts +442 -0
- package/node_modules/@loopwright/memory/dist/types.js +8 -0
- package/node_modules/@loopwright/memory/dist/verifier.d.ts +5 -0
- package/node_modules/@loopwright/memory/dist/verifier.js +328 -0
- package/node_modules/@loopwright/memory/package.json +12 -0
- package/node_modules/@loopwright/state/dist/admission.d.ts +321 -0
- package/node_modules/@loopwright/state/dist/admission.js +199 -0
- package/node_modules/@loopwright/state/dist/boundary.d.ts +53 -0
- package/node_modules/@loopwright/state/dist/boundary.js +194 -0
- package/node_modules/@loopwright/state/dist/checkpoint.d.ts +16 -0
- package/node_modules/@loopwright/state/dist/checkpoint.js +84 -0
- package/node_modules/@loopwright/state/dist/clock.d.ts +8 -0
- package/node_modules/@loopwright/state/dist/clock.js +27 -0
- package/node_modules/@loopwright/state/dist/connection.d.ts +55 -0
- package/node_modules/@loopwright/state/dist/connection.js +391 -0
- package/node_modules/@loopwright/state/dist/errors.d.ts +13 -0
- package/node_modules/@loopwright/state/dist/errors.js +34 -0
- package/node_modules/@loopwright/state/dist/index.d.ts +3 -0
- package/node_modules/@loopwright/state/dist/index.js +1 -0
- package/node_modules/@loopwright/state/dist/journal.d.ts +119 -0
- package/node_modules/@loopwright/state/dist/journal.js +72 -0
- package/node_modules/@loopwright/state/dist/model.d.ts +40 -0
- package/node_modules/@loopwright/state/dist/model.js +58 -0
- package/node_modules/@loopwright/state/dist/ownership.d.ts +14 -0
- package/node_modules/@loopwright/state/dist/ownership.js +45 -0
- package/node_modules/@loopwright/state/dist/pages.d.ts +11 -0
- package/node_modules/@loopwright/state/dist/pages.js +41 -0
- package/node_modules/@loopwright/state/dist/receipts.d.ts +33 -0
- package/node_modules/@loopwright/state/dist/receipts.js +97 -0
- package/node_modules/@loopwright/state/dist/schema.d.ts +28 -0
- package/node_modules/@loopwright/state/dist/schema.js +41 -0
- package/node_modules/@loopwright/state/dist/settlement.d.ts +10 -0
- package/node_modules/@loopwright/state/dist/settlement.js +129 -0
- package/node_modules/@loopwright/state/dist/store.d.ts +52 -0
- package/node_modules/@loopwright/state/dist/store.js +100 -0
- package/node_modules/@loopwright/state/dist/types.d.ts +315 -0
- package/node_modules/@loopwright/state/dist/types.js +1 -0
- package/node_modules/@loopwright/state/package.json +12 -0
- package/node_modules/@loopwright/taskpack/dist/baseline-align.d.ts +195 -0
- package/node_modules/@loopwright/taskpack/dist/baseline-align.js +1847 -0
- package/node_modules/@loopwright/taskpack/dist/digests.d.ts +61 -0
- package/node_modules/@loopwright/taskpack/dist/digests.js +715 -0
- package/node_modules/@loopwright/taskpack/dist/index.d.ts +18 -0
- package/node_modules/@loopwright/taskpack/dist/index.js +17 -0
- package/node_modules/@loopwright/taskpack/dist/models-config.d.ts +112 -0
- package/node_modules/@loopwright/taskpack/dist/models-config.js +1026 -0
- package/node_modules/@loopwright/taskpack/dist/output-format.d.ts +28 -0
- package/node_modules/@loopwright/taskpack/dist/output-format.js +157 -0
- package/node_modules/@loopwright/taskpack/dist/preflight.d.ts +130 -0
- package/node_modules/@loopwright/taskpack/dist/preflight.js +1497 -0
- package/node_modules/@loopwright/taskpack/dist/qualification.d.ts +23 -0
- package/node_modules/@loopwright/taskpack/dist/qualification.js +120 -0
- package/node_modules/@loopwright/taskpack/dist/sandbox.d.ts +121 -0
- package/node_modules/@loopwright/taskpack/dist/sandbox.js +2605 -0
- package/node_modules/@loopwright/taskpack/dist/schema.d.ts +197 -0
- package/node_modules/@loopwright/taskpack/dist/schema.js +4189 -0
- package/node_modules/@loopwright/taskpack/dist/scrubber.d.ts +47 -0
- package/node_modules/@loopwright/taskpack/dist/scrubber.js +283 -0
- package/node_modules/@loopwright/taskpack/dist/suite.d.ts +124 -0
- package/node_modules/@loopwright/taskpack/dist/suite.js +3256 -0
- package/node_modules/@loopwright/taskpack/dist/taskpack.d.ts +154 -0
- package/node_modules/@loopwright/taskpack/dist/taskpack.js +3634 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey-memory.d.ts +122 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey-memory.js +483 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey.d.ts +437 -0
- package/node_modules/@loopwright/taskpack/dist/turnkey.js +7313 -0
- package/node_modules/@loopwright/taskpack/dist/types.d.ts +1274 -0
- package/node_modules/@loopwright/taskpack/dist/types.js +99 -0
- package/node_modules/@loopwright/taskpack/dist/upstreams.d.ts +261 -0
- package/node_modules/@loopwright/taskpack/dist/upstreams.js +2242 -0
- package/node_modules/@loopwright/taskpack/dist/yaml.d.ts +18 -0
- package/node_modules/@loopwright/taskpack/dist/yaml.js +167 -0
- package/node_modules/@loopwright/taskpack/package.json +12 -0
- package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.d.ts +137 -0
- package/node_modules/@loopwright/taskpack-runner/dist/compile-taskpack.js +474 -0
- package/node_modules/@loopwright/taskpack-runner/dist/corpus.d.ts +8 -0
- package/node_modules/@loopwright/taskpack-runner/dist/corpus.js +129 -0
- package/node_modules/@loopwright/taskpack-runner/dist/index.d.ts +13 -0
- package/node_modules/@loopwright/taskpack-runner/dist/index.js +7 -0
- package/node_modules/@loopwright/taskpack-runner/dist/intake.d.ts +149 -0
- package/node_modules/@loopwright/taskpack-runner/dist/intake.js +135 -0
- package/node_modules/@loopwright/taskpack-runner/dist/parity.d.ts +130 -0
- package/node_modules/@loopwright/taskpack-runner/dist/parity.js +927 -0
- package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.d.ts +68 -0
- package/node_modules/@loopwright/taskpack-runner/dist/python-bridge.js +517 -0
- package/node_modules/@loopwright/taskpack-runner/dist/service.d.ts +149 -0
- package/node_modules/@loopwright/taskpack-runner/dist/service.js +1796 -0
- package/node_modules/@loopwright/taskpack-runner/dist/types.d.ts +29 -0
- package/node_modules/@loopwright/taskpack-runner/dist/types.js +11 -0
- package/node_modules/@loopwright/taskpack-runner/package.json +12 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/README.md +77 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/support-records.md +57 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/docs/supported-runners.md +98 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/manifest.json +205 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/expand_matrix.sh +273 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/matrix.yaml +280 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pack/resolve_dockerfile.sh +24 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/pyproject.toml +46 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/runtime_runner/runner.py.json +5270 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/discovery/legacy-support.md +86 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/github/service.py +401 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/analysis.json +95 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/fixtures/proposals/ready.json +109 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_assemble.py +263 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_check_draft.py +333 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_checks.py +1099 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_discovery.py +817 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_proposal.py +658 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_publish.py +987 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tests/auto_sync/test_summary.py +107 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/agent.py +610 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/assemble.py +84 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/check_draft.py +94 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/checks.py +1002 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/discovery.py +789 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/model.py +557 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/progress.py +174 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/analysis.md +40 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/proposal.md +65 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/prompts/repair.md +17 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/proposal.py +903 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/publish.py +997 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/summary.py +131 -0
- package/node_modules/@loopwright/taskpack-runner/vendor/runner-auto-sync/tools/auto_sync/tool-versions.json +133 -0
- package/node_modules/package-lock.json +3021 -0
- package/package-lock.json +3021 -0
- package/package.json +52 -4
|
@@ -0,0 +1,872 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { constants } from 'node:fs';
|
|
3
|
+
import { lstat, open, realpath } from 'node:fs/promises';
|
|
4
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
5
|
+
import { LIMITS, OVERLAY_LIMITS, digestArtifact, digestArtifactFromMetadata, identifyManifest, matchesScopePattern as coreMatchesScopePattern, resolveOverlayLimits, validateRelativePath, validateScopePattern, } from '@loopwright/core';
|
|
6
|
+
import { STREAM_CHUNK_BYTES, canonicalComponents } from './files.js';
|
|
7
|
+
import { canonical, hash, integer, list, record, same, text } from './schema.js';
|
|
8
|
+
import { ControllerFailure, refuse } from './errors.js';
|
|
9
|
+
import { canonicalizeCandidateManifest, compareUtf16, gitObjectOid, parseGitTreeEntries, } from './git-objects.js';
|
|
10
|
+
import { checkedRef } from './storage.js';
|
|
11
|
+
import { parsePrivateJson } from './parser.js';
|
|
12
|
+
export { canonicalizeCandidateManifest, compareUtf16, gitObjectOid, parseGitTreeEntries };
|
|
13
|
+
const decoded = (value) => {
|
|
14
|
+
try {
|
|
15
|
+
return new TextDecoder('utf-8', { fatal: true }).decode(value);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
// Delegates directly to `@loopwright/core` (`packages/core/src/scope.ts`) to eliminate glob drift.
|
|
22
|
+
export function matchesScopePattern(pattern, name) {
|
|
23
|
+
if (!validateScopePattern(pattern).ok)
|
|
24
|
+
return false;
|
|
25
|
+
const matched = coreMatchesScopePattern(pattern, name);
|
|
26
|
+
return matched.ok ? matched.value : false;
|
|
27
|
+
}
|
|
28
|
+
const HOST_ALWAYS_PROTECTED_PATTERNS = [
|
|
29
|
+
'.git/**',
|
|
30
|
+
];
|
|
31
|
+
for (const pattern of HOST_ALWAYS_PROTECTED_PATTERNS) {
|
|
32
|
+
if (!validateScopePattern(pattern).ok) {
|
|
33
|
+
throw new Error(`Invalid built-in host protected pattern: ${pattern}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function matchesHostProtectedPattern(pattern, name) {
|
|
37
|
+
const matched = coreMatchesScopePattern(pattern, name);
|
|
38
|
+
return !matched.ok || matched.value;
|
|
39
|
+
}
|
|
40
|
+
export function isHostProtectedPath(name, options = false) {
|
|
41
|
+
const allowWorkflowWrites = typeof options === 'boolean' ? options : options.allowWorkflowWrites === true;
|
|
42
|
+
const enforceGitHubWorkflowProtection = typeof options === 'boolean' ? true : options.enforceGitHubWorkflowProtection !== false;
|
|
43
|
+
const segments = name.split('/');
|
|
44
|
+
if (!validateRelativePath(name).ok || segments.some(segment => segment.toLowerCase() === '.git')) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
if (HOST_ALWAYS_PROTECTED_PATTERNS.some(pattern => matchesHostProtectedPattern(pattern, name)))
|
|
48
|
+
return true;
|
|
49
|
+
if (enforceGitHubWorkflowProtection && segments[0]?.toLowerCase() === '.github') {
|
|
50
|
+
if (!allowWorkflowWrites)
|
|
51
|
+
return true;
|
|
52
|
+
if (segments.length < 3 || segments[1]?.toLowerCase() !== 'workflows')
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
export function overlayManifestBounds(overlay) {
|
|
58
|
+
const resolved = resolveOverlayLimits(overlay);
|
|
59
|
+
if (!resolved.ok)
|
|
60
|
+
refuse('CONFIG_SCHEMA', '/spec/task/spec/budgets/overlay', 'admission');
|
|
61
|
+
const { maxFiles, maxBytes } = resolved.value;
|
|
62
|
+
const perFileMaxBytes = overlay === undefined ? 1_048_576 : maxBytes;
|
|
63
|
+
const manifestMaxBytes = maxFiles <= 128 ? 32_768 : Math.min(83_886_080, 32_768 + (maxFiles - 128) * 4_608);
|
|
64
|
+
const collectionLimit = Math.max(256, maxFiles);
|
|
65
|
+
const workspaceMaxBytes = maxFiles <= 128 && maxBytes <= 4_194_304
|
|
66
|
+
? 8_388_608
|
|
67
|
+
: Math.min(100_663_296, Math.ceil((maxBytes * 4) / 3) + maxFiles * 256 + 1_114_112);
|
|
68
|
+
const v2WorkspaceJsonMaxBytes = maxFiles <= 128 ? 1_048_576 : Math.min(33_554_432, 1_048_576 + (maxFiles - 128) * 2_048);
|
|
69
|
+
const checkpointInputMaxBytes = overlay === undefined || maxFiles <= 128
|
|
70
|
+
? 40_960
|
|
71
|
+
: Math.min(8_388_608, 65_536 + (Math.min(maxFiles, 16_384) - 128) * 4_608);
|
|
72
|
+
return {
|
|
73
|
+
maxFiles,
|
|
74
|
+
maxBytes,
|
|
75
|
+
perFileMaxBytes,
|
|
76
|
+
manifestMaxBytes,
|
|
77
|
+
collectionLimit,
|
|
78
|
+
workspaceMaxBytes,
|
|
79
|
+
v2WorkspaceJsonMaxBytes,
|
|
80
|
+
checkpointInputMaxBytes,
|
|
81
|
+
options: overlay !== undefined ? { overlay: { maxFiles, maxBytes } } : undefined,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function isProtectedByScope(name, protectedPatterns) {
|
|
85
|
+
return protectedPatterns.some(pattern => matchesScopePattern(pattern, name));
|
|
86
|
+
}
|
|
87
|
+
function isValidGitArtifactName(name) {
|
|
88
|
+
return !name.split('/').some(segment => segment.toLowerCase() === '.git' || Buffer.byteLength(segment, 'utf8') > 255)
|
|
89
|
+
&& digestArtifact(name, new Uint8Array()).ok;
|
|
90
|
+
}
|
|
91
|
+
function assertNoPathCollisions(names, code, phase) {
|
|
92
|
+
const seenNorm = new Set();
|
|
93
|
+
for (const name of names) {
|
|
94
|
+
const norm = name.normalize('NFC').toLowerCase();
|
|
95
|
+
if (seenNorm.has(norm))
|
|
96
|
+
refuse(code, '', phase);
|
|
97
|
+
seenNorm.add(norm);
|
|
98
|
+
}
|
|
99
|
+
for (const norm of seenNorm) {
|
|
100
|
+
let slash = norm.indexOf('/');
|
|
101
|
+
while (slash !== -1) {
|
|
102
|
+
if (seenNorm.has(norm.slice(0, slash)))
|
|
103
|
+
refuse(code, '', phase);
|
|
104
|
+
slash = norm.indexOf('/', slash + 1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function object(owner, directory, revision) {
|
|
109
|
+
const value = decoded(await owner.git(directory, ['rev-parse', '--verify', '--end-of-options', revision + '^{commit}'], 256)).trim();
|
|
110
|
+
if (!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(value))
|
|
111
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
async function treeObject(owner, directory, commitOid, objectFormat) {
|
|
115
|
+
const value = decoded(await owner.git(directory, ['rev-parse', '--verify', '--end-of-options', commitOid + '^{tree}'], 256)).trim();
|
|
116
|
+
const pattern = objectFormat === 'sha1' ? /^[0-9a-f]{40}$/ : /^[0-9a-f]{64}$/;
|
|
117
|
+
if (!pattern.test(value))
|
|
118
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
119
|
+
return value;
|
|
120
|
+
}
|
|
121
|
+
export async function resolveBaselineMerkleProofs(directory, owner, baseTree, baselineEntries, jsonPaths) {
|
|
122
|
+
if (jsonPaths.length === 0)
|
|
123
|
+
return undefined;
|
|
124
|
+
const byPath = new Map(baselineEntries.map(entry => [entry.name, entry]));
|
|
125
|
+
const oidByteLength = baseTree.objectFormat === 'sha1' ? 20 : 32;
|
|
126
|
+
const proofs = Object.create(null);
|
|
127
|
+
let found = 0;
|
|
128
|
+
for (const path of new Set(jsonPaths)) {
|
|
129
|
+
const entry = byPath.get(path);
|
|
130
|
+
if (!entry)
|
|
131
|
+
continue;
|
|
132
|
+
const segments = path.split('/');
|
|
133
|
+
if (segments.length > 16) {
|
|
134
|
+
proofs[path] = {
|
|
135
|
+
mode: entry.mode,
|
|
136
|
+
oid: entry.oid,
|
|
137
|
+
byteLength: entry.byteLength,
|
|
138
|
+
trees: [],
|
|
139
|
+
blob: new Uint8Array(0),
|
|
140
|
+
treeCount: segments.length,
|
|
141
|
+
};
|
|
142
|
+
found++;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
let currentTreeOid = baseTree.treeOid;
|
|
146
|
+
const trees = [];
|
|
147
|
+
let totalTreeBytes = 0;
|
|
148
|
+
let oversizeTreeBytes;
|
|
149
|
+
for (let i = 0; i < segments.length; i++) {
|
|
150
|
+
const seg = segments[i];
|
|
151
|
+
const encodedTreeSize = decoded(await owner.git(directory, ['cat-file', '-s', currentTreeOid], 64)).trim();
|
|
152
|
+
if (!/^(?:0|[1-9][0-9]{0,9})$/.test(encodedTreeSize))
|
|
153
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
154
|
+
const treeSize = Number(encodedTreeSize);
|
|
155
|
+
if (totalTreeBytes + treeSize > 262_144) {
|
|
156
|
+
oversizeTreeBytes = totalTreeBytes + treeSize;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
totalTreeBytes += treeSize;
|
|
160
|
+
const rawTree = await owner.git(directory, ['cat-file', 'tree', currentTreeOid], 262_145);
|
|
161
|
+
const treeBytes = new Uint8Array(rawTree);
|
|
162
|
+
if (treeBytes.byteLength !== treeSize || gitObjectOid(baseTree.objectFormat, 'tree', treeBytes) !== currentTreeOid) {
|
|
163
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
164
|
+
}
|
|
165
|
+
const treeEntries = parseGitTreeEntries(treeBytes, oidByteLength, 'admission', 'TARGET_MISMATCH');
|
|
166
|
+
const matched = treeEntries.find(item => item.name === seg);
|
|
167
|
+
if (!matched)
|
|
168
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
169
|
+
trees.push(treeBytes);
|
|
170
|
+
if (i < segments.length - 1) {
|
|
171
|
+
if (matched.mode !== '40000' && matched.mode !== '040000')
|
|
172
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
173
|
+
currentTreeOid = matched.oid;
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
if (matched.mode !== entry.mode || matched.oid !== entry.oid)
|
|
177
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (oversizeTreeBytes !== undefined) {
|
|
181
|
+
proofs[path] = {
|
|
182
|
+
mode: entry.mode,
|
|
183
|
+
oid: entry.oid,
|
|
184
|
+
byteLength: entry.byteLength,
|
|
185
|
+
trees: [],
|
|
186
|
+
blob: new Uint8Array(0),
|
|
187
|
+
treeCount: segments.length,
|
|
188
|
+
treeProofBytes: oversizeTreeBytes,
|
|
189
|
+
};
|
|
190
|
+
found++;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (entry.byteLength > 4_194_304) {
|
|
194
|
+
proofs[path] = {
|
|
195
|
+
mode: entry.mode,
|
|
196
|
+
oid: entry.oid,
|
|
197
|
+
byteLength: entry.byteLength,
|
|
198
|
+
trees,
|
|
199
|
+
blob: new Uint8Array(0),
|
|
200
|
+
};
|
|
201
|
+
found++;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const rawBlob = await owner.git(directory, ['cat-file', 'blob', entry.oid], entry.byteLength + 1);
|
|
205
|
+
const blobBytes = new Uint8Array(rawBlob);
|
|
206
|
+
if (blobBytes.byteLength !== entry.byteLength || gitObjectOid(baseTree.objectFormat, 'blob', blobBytes) !== entry.oid) {
|
|
207
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
208
|
+
}
|
|
209
|
+
proofs[path] = { mode: entry.mode, oid: entry.oid, byteLength: entry.byteLength, trees, blob: blobBytes };
|
|
210
|
+
found++;
|
|
211
|
+
}
|
|
212
|
+
return found > 0 ? proofs : undefined;
|
|
213
|
+
}
|
|
214
|
+
export function parseSourceTree(bytes, objectFormat, phase = 'recovery') {
|
|
215
|
+
if (bytes.byteLength > 8_388_608)
|
|
216
|
+
refuse(phase === 'admission' ? 'CONFIG_LIMIT' : 'ARTIFACT_INVALID', '', phase);
|
|
217
|
+
if (bytes.byteLength === 0)
|
|
218
|
+
return [];
|
|
219
|
+
if (bytes.at(-1) !== 10)
|
|
220
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
221
|
+
let rawText;
|
|
222
|
+
try {
|
|
223
|
+
rawText = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
227
|
+
}
|
|
228
|
+
const lines = rawText.slice(0, -1).split('\n');
|
|
229
|
+
if (lines.length > LIMITS.baselineEntries)
|
|
230
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
231
|
+
const oidPattern = objectFormat === 'sha1' ? /^[0-9a-f]{40}$/ : /^[0-9a-f]{64}$/;
|
|
232
|
+
const entries = [];
|
|
233
|
+
let prevName = null;
|
|
234
|
+
for (const line of lines) {
|
|
235
|
+
const parts = line.split('\t');
|
|
236
|
+
if (parts.length !== 4)
|
|
237
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
238
|
+
const [mode, oid, sizeStr, jsonName] = parts;
|
|
239
|
+
if (mode !== '100644' && mode !== '100755')
|
|
240
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
241
|
+
if (!oidPattern.test(oid))
|
|
242
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
243
|
+
if (!/^(?:0|[1-9][0-9]*)$/.test(sizeStr))
|
|
244
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
245
|
+
const byteLength = Number(sizeStr);
|
|
246
|
+
if (!Number.isSafeInteger(byteLength) || byteLength < 0)
|
|
247
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
248
|
+
let parsedName;
|
|
249
|
+
try {
|
|
250
|
+
parsedName = JSON.parse(jsonName);
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
254
|
+
}
|
|
255
|
+
if (typeof parsedName !== 'string' || !isValidGitArtifactName(parsedName))
|
|
256
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
257
|
+
if (prevName !== null && prevName >= parsedName)
|
|
258
|
+
refuse('ARTIFACT_INVALID', '', phase);
|
|
259
|
+
prevName = parsedName;
|
|
260
|
+
entries.push(Object.freeze({ name: parsedName, mode, oid, byteLength }));
|
|
261
|
+
}
|
|
262
|
+
assertNoPathCollisions(entries.map(item => item.name), 'ARTIFACT_INVALID', phase);
|
|
263
|
+
return Object.freeze(entries);
|
|
264
|
+
}
|
|
265
|
+
export const VERIFIED_CAS_SEAL = Symbol('loopwright.verifiedCasSeal');
|
|
266
|
+
const verifiedCasSealCache = new WeakMap();
|
|
267
|
+
export function attachVerifiedCasSeal(file, seal) {
|
|
268
|
+
const frozenSeal = Object.freeze({ ...seal });
|
|
269
|
+
verifiedCasSealCache.set(file, frozenSeal);
|
|
270
|
+
if (Object.isExtensible(file)) {
|
|
271
|
+
Object.defineProperty(file, VERIFIED_CAS_SEAL, {
|
|
272
|
+
value: frozenSeal,
|
|
273
|
+
enumerable: false,
|
|
274
|
+
writable: false,
|
|
275
|
+
configurable: true,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
return file;
|
|
279
|
+
}
|
|
280
|
+
function getVerifiedCasSeal(file) {
|
|
281
|
+
const fromSymbol = file[VERIFIED_CAS_SEAL];
|
|
282
|
+
return fromSymbol ?? verifiedCasSealCache.get(file);
|
|
283
|
+
}
|
|
284
|
+
async function verifyCasOverlayEntry(file, expectedRef, baselineOid, objectFormat, phase) {
|
|
285
|
+
const fail = () => refuse('RECOVERY_REQUIRED', '', phase);
|
|
286
|
+
if (typeof file.blobPath !== 'string' ||
|
|
287
|
+
!isAbsolute(file.blobPath) ||
|
|
288
|
+
file.blobPath.length > 4096 ||
|
|
289
|
+
/[\0\r\n]/.test(file.blobPath) ||
|
|
290
|
+
file.byteLength !== expectedRef.byteLength ||
|
|
291
|
+
!same(file.digest, expectedRef.digest)) {
|
|
292
|
+
return fail();
|
|
293
|
+
}
|
|
294
|
+
const metaCheck = digestArtifactFromMetadata(expectedRef.name, {
|
|
295
|
+
digest: expectedRef.digest,
|
|
296
|
+
byteLength: expectedRef.byteLength,
|
|
297
|
+
});
|
|
298
|
+
if (!metaCheck.ok || !same(metaCheck.value, expectedRef))
|
|
299
|
+
return fail();
|
|
300
|
+
let before;
|
|
301
|
+
try {
|
|
302
|
+
before = await lstat(file.blobPath);
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
return fail();
|
|
306
|
+
}
|
|
307
|
+
if (before.isSymbolicLink() ||
|
|
308
|
+
!before.isFile() ||
|
|
309
|
+
before.nlink !== 1 ||
|
|
310
|
+
before.uid !== process.getuid?.() ||
|
|
311
|
+
(before.mode & 0o222) !== 0 ||
|
|
312
|
+
before.size !== expectedRef.byteLength ||
|
|
313
|
+
before.size > OVERLAY_LIMITS.maxMaxBytes) {
|
|
314
|
+
return fail();
|
|
315
|
+
}
|
|
316
|
+
let fh;
|
|
317
|
+
try {
|
|
318
|
+
fh = await open(file.blobPath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return fail();
|
|
322
|
+
}
|
|
323
|
+
try {
|
|
324
|
+
const info = await fh.stat();
|
|
325
|
+
if (!info.isFile() ||
|
|
326
|
+
info.nlink !== 1 ||
|
|
327
|
+
info.dev !== before.dev ||
|
|
328
|
+
info.ino !== before.ino ||
|
|
329
|
+
info.size !== before.size ||
|
|
330
|
+
(info.mode & 0o222) !== 0) {
|
|
331
|
+
return fail();
|
|
332
|
+
}
|
|
333
|
+
const seal = getVerifiedCasSeal(file);
|
|
334
|
+
if (seal !== undefined &&
|
|
335
|
+
seal.blobPath === file.blobPath &&
|
|
336
|
+
seal.dev === info.dev &&
|
|
337
|
+
seal.ino === info.ino &&
|
|
338
|
+
seal.size === info.size &&
|
|
339
|
+
seal.mtimeMs === info.mtimeMs &&
|
|
340
|
+
seal.ctimeMs === info.ctimeMs &&
|
|
341
|
+
seal.objectFormat === objectFormat &&
|
|
342
|
+
(baselineOid === undefined || seal.gitOid !== null)) {
|
|
343
|
+
if (seal.sha256 !== expectedRef.digest.hex) {
|
|
344
|
+
return fail();
|
|
345
|
+
}
|
|
346
|
+
if (baselineOid !== undefined && seal.gitOid === baselineOid) {
|
|
347
|
+
return fail();
|
|
348
|
+
}
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const sha256 = createHash('sha256');
|
|
352
|
+
const gitOidHasher = baselineOid !== undefined ? createHash(objectFormat).update(`blob ${info.size}\0`, 'utf8') : null;
|
|
353
|
+
const chunk = Buffer.allocUnsafe(Math.min(STREAM_CHUNK_BYTES, Math.max(1, info.size)));
|
|
354
|
+
let offset = 0;
|
|
355
|
+
while (offset < info.size) {
|
|
356
|
+
const { bytesRead } = await fh.read(chunk, 0, Math.min(chunk.byteLength, info.size - offset), offset);
|
|
357
|
+
if (bytesRead <= 0)
|
|
358
|
+
break;
|
|
359
|
+
const slice = chunk.subarray(0, bytesRead);
|
|
360
|
+
sha256.update(slice);
|
|
361
|
+
gitOidHasher?.update(slice);
|
|
362
|
+
offset += bytesRead;
|
|
363
|
+
}
|
|
364
|
+
const probe = Buffer.allocUnsafe(1);
|
|
365
|
+
const { bytesRead: extra } = await fh.read(probe, 0, 1, offset);
|
|
366
|
+
const after = await fh.stat();
|
|
367
|
+
const sha256Hex = sha256.digest('hex');
|
|
368
|
+
if (extra !== 0 ||
|
|
369
|
+
offset !== info.size ||
|
|
370
|
+
!after.isFile() ||
|
|
371
|
+
after.nlink !== 1 ||
|
|
372
|
+
after.dev !== info.dev ||
|
|
373
|
+
after.ino !== info.ino ||
|
|
374
|
+
after.size !== info.size ||
|
|
375
|
+
after.mtimeMs !== info.mtimeMs ||
|
|
376
|
+
after.ctimeMs !== info.ctimeMs ||
|
|
377
|
+
(after.mode & 0o222) !== 0 ||
|
|
378
|
+
sha256Hex !== expectedRef.digest.hex) {
|
|
379
|
+
return fail();
|
|
380
|
+
}
|
|
381
|
+
const gitOid = gitOidHasher !== null ? gitOidHasher.digest('hex') : null;
|
|
382
|
+
if (gitOid !== null && gitOid === baselineOid) {
|
|
383
|
+
return fail();
|
|
384
|
+
}
|
|
385
|
+
attachVerifiedCasSeal(file, {
|
|
386
|
+
blobPath: file.blobPath,
|
|
387
|
+
dev: after.dev,
|
|
388
|
+
ino: after.ino,
|
|
389
|
+
size: after.size,
|
|
390
|
+
mtimeMs: after.mtimeMs,
|
|
391
|
+
ctimeMs: after.ctimeMs,
|
|
392
|
+
sha256: sha256Hex,
|
|
393
|
+
gitOid,
|
|
394
|
+
objectFormat,
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
finally {
|
|
398
|
+
await fh.close();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
export async function assertCanonicalMinimalOverlay(candidateManifest, candidateFiles, source, phase = 'execution') {
|
|
402
|
+
if (source.version === 1) {
|
|
403
|
+
if (candidateManifest.spec.baseTree !== undefined || candidateManifest.spec.deleted !== undefined) {
|
|
404
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
405
|
+
}
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const sourceBaseTree = source.manifest.spec.baseTree;
|
|
409
|
+
if (candidateManifest.spec.baseTree === undefined
|
|
410
|
+
|| candidateManifest.spec.deleted === undefined
|
|
411
|
+
|| sourceBaseTree === undefined
|
|
412
|
+
|| !same(candidateManifest.spec.baseTree, sourceBaseTree)) {
|
|
413
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
414
|
+
}
|
|
415
|
+
const baselineByPath = new Map((source.baselineEntries ?? []).map(entry => [entry.name, entry]));
|
|
416
|
+
for (const deletedPath of candidateManifest.spec.deleted) {
|
|
417
|
+
if (!baselineByPath.has(deletedPath))
|
|
418
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
419
|
+
}
|
|
420
|
+
if (candidateFiles.length !== candidateManifest.spec.entries.length) {
|
|
421
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
422
|
+
}
|
|
423
|
+
const filesByPath = new Map();
|
|
424
|
+
for (const file of candidateFiles) {
|
|
425
|
+
if (filesByPath.has(file.name))
|
|
426
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
427
|
+
filesByPath.set(file.name, file);
|
|
428
|
+
}
|
|
429
|
+
const deletedSet = new Set(candidateManifest.spec.deleted);
|
|
430
|
+
const survivingBaselineNorms = new Set();
|
|
431
|
+
const survivingBaselineDirs = new Set();
|
|
432
|
+
for (const basePath of baselineByPath.keys()) {
|
|
433
|
+
if (deletedSet.has(basePath))
|
|
434
|
+
continue;
|
|
435
|
+
const norm = basePath.normalize('NFC').toLowerCase();
|
|
436
|
+
survivingBaselineNorms.add(norm);
|
|
437
|
+
let slash = norm.indexOf('/');
|
|
438
|
+
while (slash !== -1) {
|
|
439
|
+
survivingBaselineDirs.add(norm.slice(0, slash));
|
|
440
|
+
slash = norm.indexOf('/', slash + 1);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
for (const entry of candidateManifest.spec.entries) {
|
|
444
|
+
const file = filesByPath.get(entry.name);
|
|
445
|
+
if (!file)
|
|
446
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
447
|
+
const baselineEntry = baselineByPath.get(entry.name);
|
|
448
|
+
if (baselineEntry !== undefined && deletedSet.has(entry.name)) {
|
|
449
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
450
|
+
}
|
|
451
|
+
if ('bytes' in file) {
|
|
452
|
+
if ('blobPath' in file)
|
|
453
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
454
|
+
const actual = digestArtifact(entry.name, file.bytes);
|
|
455
|
+
if (!actual.ok || !same(actual.value, entry))
|
|
456
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
457
|
+
if (baselineEntry !== undefined && gitObjectOid(sourceBaseTree.objectFormat, 'blob', file.bytes) === baselineEntry.oid) {
|
|
458
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
await verifyCasOverlayEntry(file, entry, baselineEntry?.oid, sourceBaseTree.objectFormat, phase);
|
|
463
|
+
}
|
|
464
|
+
if (baselineEntry === undefined) {
|
|
465
|
+
const norm = entry.name.normalize('NFC').toLowerCase();
|
|
466
|
+
if (survivingBaselineNorms.has(norm) || survivingBaselineDirs.has(norm)) {
|
|
467
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
468
|
+
}
|
|
469
|
+
let slash = norm.indexOf('/');
|
|
470
|
+
while (slash !== -1) {
|
|
471
|
+
if (survivingBaselineNorms.has(norm.slice(0, slash)))
|
|
472
|
+
refuse('RECOVERY_REQUIRED', '', phase);
|
|
473
|
+
slash = norm.indexOf('/', slash + 1);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
export async function materializeBaseline(source, baselineDir, owner, deadline) {
|
|
479
|
+
if (source.version !== 2)
|
|
480
|
+
refuse('ARTIFACT_INVALID', '', 'execution');
|
|
481
|
+
if (deadline instanceof AbortSignal) {
|
|
482
|
+
if (deadline.aborted)
|
|
483
|
+
refuse('CANCELLED', '', 'execution');
|
|
484
|
+
await owner.materializeGitBatch(source.directory, source.baselineEntries ?? [], baselineDir, deadline, 120_000);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const view = deadline.assert();
|
|
488
|
+
const remainingMs = Number(BigInt(view.clock.basis.taskDeadlineMonotonicMs) - BigInt(view.clock.sampledNow.monotonicMs));
|
|
489
|
+
if (remainingMs <= 0)
|
|
490
|
+
refuse('DEADLINE', '', 'execution');
|
|
491
|
+
try {
|
|
492
|
+
await owner.materializeGitBatch(source.directory, source.baselineEntries ?? [], baselineDir, deadline.abort.signal, Math.min(remainingMs, 120_000));
|
|
493
|
+
}
|
|
494
|
+
catch (error) {
|
|
495
|
+
if (error instanceof ControllerFailure && error.diagnostic.code === 'CANCELLED' && deadline.reason !== null) {
|
|
496
|
+
refuse(deadline.reason, '', 'execution');
|
|
497
|
+
}
|
|
498
|
+
throw error;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
export async function freezeSource(repository, task, owner, store, jsonPaths = []) {
|
|
502
|
+
const directory = resolve(repository);
|
|
503
|
+
await canonicalComponents(directory);
|
|
504
|
+
const info = await lstat(directory);
|
|
505
|
+
if (!info.isDirectory() || info.uid !== process.getuid?.() || await realpath(directory) !== directory) {
|
|
506
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
507
|
+
}
|
|
508
|
+
const top = decoded(await owner.git(directory, ['rev-parse', '--show-toplevel'], 4096)).trim();
|
|
509
|
+
if (top !== directory)
|
|
510
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
511
|
+
const baseObject = await object(owner, directory, task.spec.target.baseRevision);
|
|
512
|
+
const sourceObject = await object(owner, directory, task.spec.target.sourceRevision);
|
|
513
|
+
let tree;
|
|
514
|
+
try {
|
|
515
|
+
tree = await owner.git(directory, ['ls-tree', '-r', '-l', '-z', '--full-tree', sourceObject], 16_777_216);
|
|
516
|
+
}
|
|
517
|
+
catch (error) {
|
|
518
|
+
if (error instanceof ControllerFailure && error.diagnostic.code === 'OUTPUT_LIMIT') {
|
|
519
|
+
refuse('CONFIG_LIMIT', '', 'admission');
|
|
520
|
+
}
|
|
521
|
+
throw error;
|
|
522
|
+
}
|
|
523
|
+
if (tree.length && tree.at(-1) !== 0)
|
|
524
|
+
refuse('CONFIG_LIMIT', '', 'admission');
|
|
525
|
+
let treeText;
|
|
526
|
+
try {
|
|
527
|
+
treeText = tree.length ? new TextDecoder('utf-8', { fatal: true }).decode(tree) : '';
|
|
528
|
+
}
|
|
529
|
+
catch {
|
|
530
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
531
|
+
}
|
|
532
|
+
const rows = treeText ? treeText.split('\0').slice(0, -1) : [];
|
|
533
|
+
const descriptions = [];
|
|
534
|
+
for (const row of rows) {
|
|
535
|
+
const symlinkMatch = /^120000 blob ([0-9a-f]{40}|[0-9a-f]{64}) +[0-9-]+\t(.+)$/s.exec(row);
|
|
536
|
+
const gitlinkMatch = /^160000 commit ([0-9a-f]{40}|[0-9a-f]{64}) +-\t(.+)$/s.exec(row);
|
|
537
|
+
const special = symlinkMatch ?? gitlinkMatch;
|
|
538
|
+
if (special) {
|
|
539
|
+
const name = special[2];
|
|
540
|
+
if (!isValidGitArtifactName(name) || !isProtectedByScope(name, task.spec.scope.protected)) {
|
|
541
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
542
|
+
}
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
const match = /^(100644|100755) blob ([0-9a-f]{40}|[0-9a-f]{64}) +([0-9]+)\t(.+)$/s.exec(row);
|
|
546
|
+
if (!match)
|
|
547
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
548
|
+
const mode = match[1];
|
|
549
|
+
const oid = match[2];
|
|
550
|
+
const sizeStr = match[3];
|
|
551
|
+
const name = match[4];
|
|
552
|
+
if (!/^(?:0|[1-9][0-9]*)$/.test(sizeStr))
|
|
553
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
554
|
+
const byteLength = Number(sizeStr);
|
|
555
|
+
if (!Number.isSafeInteger(byteLength) || byteLength < 0 || !isValidGitArtifactName(name)) {
|
|
556
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
557
|
+
}
|
|
558
|
+
descriptions.push({ name, mode, oid, byteLength });
|
|
559
|
+
}
|
|
560
|
+
if (descriptions.length > LIMITS.baselineEntries)
|
|
561
|
+
refuse('CONFIG_LIMIT', '', 'admission');
|
|
562
|
+
descriptions.sort((a, b) => compareUtf16(a.name, b.name));
|
|
563
|
+
assertNoPathCollisions(descriptions.map(item => item.name), 'CAPABILITY_UNSUPPORTED', 'admission');
|
|
564
|
+
// All topology is checked before any 5th git call or candidate body is materialized.
|
|
565
|
+
const MANIFEST_JSON_LIMIT = 32_768;
|
|
566
|
+
const INVENTORY_JSON_LIMIT = 262_144;
|
|
567
|
+
const totalBytes = descriptions.reduce((sum, item) => sum + item.byteLength, 0);
|
|
568
|
+
const overlayBudget = task.spec.budgets.overlay;
|
|
569
|
+
let useClassic = false;
|
|
570
|
+
if (descriptions.length <= 128
|
|
571
|
+
&& totalBytes <= 4_194_304
|
|
572
|
+
&& (overlayBudget === undefined || (overlayBudget.maxFiles <= 128 && overlayBudget.maxBytes <= 4_194_304))) {
|
|
573
|
+
const freshDummyDigest = () => ({ algorithm: 'sha256', hex: '0'.repeat(64) });
|
|
574
|
+
const sizingRefs = descriptions.map(description => ({
|
|
575
|
+
name: description.name,
|
|
576
|
+
byteLength: description.byteLength,
|
|
577
|
+
digest: freshDummyDigest(),
|
|
578
|
+
}));
|
|
579
|
+
const sizingIdentified = identifyManifest({
|
|
580
|
+
apiVersion: 'loopwright.dev/v1alpha1',
|
|
581
|
+
kind: 'ArtifactManifest',
|
|
582
|
+
metadata: { id: 'candidate' },
|
|
583
|
+
spec: { entries: sizingRefs },
|
|
584
|
+
});
|
|
585
|
+
if (sizingIdentified.ok) {
|
|
586
|
+
const sizingManifestBytes = Buffer.byteLength(canonical(sizingIdentified.value.manifest), 'utf8');
|
|
587
|
+
if (sizingManifestBytes <= MANIFEST_JSON_LIMIT) {
|
|
588
|
+
const sizingInventory = {
|
|
589
|
+
version: 1,
|
|
590
|
+
repository: task.spec.target.repository,
|
|
591
|
+
directory,
|
|
592
|
+
baseObject,
|
|
593
|
+
sourceObject,
|
|
594
|
+
manifest: {
|
|
595
|
+
name: 'manifest-' + '0'.repeat(64) + '.bin',
|
|
596
|
+
byteLength: sizingManifestBytes,
|
|
597
|
+
digest: freshDummyDigest(),
|
|
598
|
+
},
|
|
599
|
+
entries: descriptions.map((description, index) => ({
|
|
600
|
+
name: description.name,
|
|
601
|
+
mode: description.mode,
|
|
602
|
+
oid: description.oid,
|
|
603
|
+
ref: {
|
|
604
|
+
name: description.name,
|
|
605
|
+
byteLength: description.byteLength,
|
|
606
|
+
digest: freshDummyDigest(),
|
|
607
|
+
},
|
|
608
|
+
artifact: {
|
|
609
|
+
name: `source-file-${index.toString(16).padStart(64, '0')}.bin`,
|
|
610
|
+
byteLength: description.byteLength,
|
|
611
|
+
digest: freshDummyDigest(),
|
|
612
|
+
},
|
|
613
|
+
})),
|
|
614
|
+
};
|
|
615
|
+
useClassic = Buffer.byteLength(canonical(sizingInventory), 'utf8') <= INVENTORY_JSON_LIMIT;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if (useClassic) {
|
|
620
|
+
const files = [];
|
|
621
|
+
const prospectiveEntries = [];
|
|
622
|
+
let total = 0;
|
|
623
|
+
for (const description of descriptions) {
|
|
624
|
+
const encoded = decoded(await owner.git(directory, ['cat-file', '-s', description.oid], 64)).trim();
|
|
625
|
+
if (!/^(?:0|[1-9][0-9]{0,9})$/.test(encoded))
|
|
626
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
627
|
+
const size = Number(encoded);
|
|
628
|
+
total += size;
|
|
629
|
+
if (size !== description.byteLength || total > 4_194_304)
|
|
630
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
631
|
+
const bytes = await owner.git(directory, ['cat-file', 'blob', description.oid], size + 1);
|
|
632
|
+
if (bytes.byteLength !== size)
|
|
633
|
+
refuse('TARGET_MISMATCH', '', 'admission');
|
|
634
|
+
const ref = digestArtifact(description.name, bytes);
|
|
635
|
+
if (!ref.ok)
|
|
636
|
+
refuse('ARTIFACT_INVALID', '', 'admission');
|
|
637
|
+
const artifactName = 'source-file-' + hash('loopwright.dev/controller/artifact/source-file/v1\0' + hash(bytes).hex).hex + '.bin';
|
|
638
|
+
const artifactRef = digestArtifact(artifactName, bytes);
|
|
639
|
+
if (!artifactRef.ok)
|
|
640
|
+
refuse('ARTIFACT_INVALID', '', 'admission');
|
|
641
|
+
files.push({ name: description.name, bytes: new Uint8Array(bytes), mode: description.mode });
|
|
642
|
+
prospectiveEntries.push({ name: description.name, mode: description.mode, oid: description.oid, ref: ref.value, artifact: artifactRef.value });
|
|
643
|
+
}
|
|
644
|
+
const identified = identifyManifest({
|
|
645
|
+
apiVersion: 'loopwright.dev/v1alpha1',
|
|
646
|
+
kind: 'ArtifactManifest',
|
|
647
|
+
metadata: { id: 'candidate' },
|
|
648
|
+
spec: { entries: prospectiveEntries.map(item => item.ref) },
|
|
649
|
+
});
|
|
650
|
+
if (identified.ok) {
|
|
651
|
+
const manifestBytes = Buffer.from(canonical(identified.value.manifest));
|
|
652
|
+
if (manifestBytes.byteLength <= MANIFEST_JSON_LIMIT) {
|
|
653
|
+
const manifestName = 'manifest-' + hash('loopwright.dev/controller/artifact/manifest/v1\0' + hash(manifestBytes).hex).hex + '.bin';
|
|
654
|
+
const prospectiveManifestRef = digestArtifact(manifestName, manifestBytes);
|
|
655
|
+
if (prospectiveManifestRef.ok) {
|
|
656
|
+
const prospectiveInventory = {
|
|
657
|
+
version: 1,
|
|
658
|
+
repository: task.spec.target.repository,
|
|
659
|
+
directory,
|
|
660
|
+
baseObject,
|
|
661
|
+
sourceObject,
|
|
662
|
+
manifest: prospectiveManifestRef.value,
|
|
663
|
+
entries: prospectiveEntries,
|
|
664
|
+
};
|
|
665
|
+
if (Buffer.byteLength(canonical(prospectiveInventory)) <= INVENTORY_JSON_LIMIT) {
|
|
666
|
+
const entries = [];
|
|
667
|
+
for (let i = 0; i < files.length; i++) {
|
|
668
|
+
const artifact = await store.put('source-file', files[i].bytes);
|
|
669
|
+
await store.putCasBlobFromBytes(files[i].name, files[i].bytes);
|
|
670
|
+
entries.push({ ...prospectiveEntries[i], artifact });
|
|
671
|
+
}
|
|
672
|
+
const manifest = identified.value.manifest;
|
|
673
|
+
const manifestRef = await store.json('manifest', manifest, MANIFEST_JSON_LIMIT);
|
|
674
|
+
const inventory = await store.json('source', { version: 1, repository: task.spec.target.repository, directory, baseObject, sourceObject, manifest: manifestRef, entries }, INVENTORY_JSON_LIMIT);
|
|
675
|
+
const workspace = await store.json('workspace', { version: 1, format: 'controller-passive-workspace', inventory, manifest: manifestRef }, 65_536);
|
|
676
|
+
return { version: 1, repository: task.spec.target.repository, directory, baseObject, sourceObject, manifest, inventory, workspace, artifacts: files };
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
// tree_overlay mode (version: 2): zero source-file CAS blob copies.
|
|
683
|
+
const objectFormatRaw = decoded(await owner.git(directory, ['rev-parse', '--show-object-format'], 64)).trim();
|
|
684
|
+
if (objectFormatRaw !== 'sha1' && objectFormatRaw !== 'sha256')
|
|
685
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
686
|
+
const objectFormat = objectFormatRaw;
|
|
687
|
+
const treeOid = await treeObject(owner, directory, sourceObject, objectFormat);
|
|
688
|
+
const oidPattern = objectFormat === 'sha1' ? /^[0-9a-f]{40}$/ : /^[0-9a-f]{64}$/;
|
|
689
|
+
if (!oidPattern.test(sourceObject) || descriptions.some(item => !oidPattern.test(item.oid))) {
|
|
690
|
+
refuse('CAPABILITY_UNSUPPORTED', '', 'admission');
|
|
691
|
+
}
|
|
692
|
+
const baseTree = { objectFormat, commitOid: sourceObject, treeOid };
|
|
693
|
+
const sourceTreeBytes = Buffer.from(descriptions.map(item => `${item.mode}\t${item.oid}\t${item.byteLength}\t${JSON.stringify(item.name)}\n`).join(''), 'utf8');
|
|
694
|
+
if (sourceTreeBytes.byteLength > 8_388_608)
|
|
695
|
+
refuse('CONFIG_LIMIT', '', 'admission');
|
|
696
|
+
const sourceTreeRef = await store.put('source-tree', sourceTreeBytes, 8_388_608);
|
|
697
|
+
const overlayBounds = overlayManifestBounds(task.spec.budgets.overlay);
|
|
698
|
+
const identified = identifyManifest({
|
|
699
|
+
apiVersion: 'loopwright.dev/v1alpha1',
|
|
700
|
+
kind: 'ArtifactManifest',
|
|
701
|
+
metadata: { id: 'candidate' },
|
|
702
|
+
spec: { baseTree, entries: [], deleted: [] },
|
|
703
|
+
}, overlayBounds.options);
|
|
704
|
+
if (!identified.ok)
|
|
705
|
+
refuse('ARTIFACT_INVALID', '', 'admission');
|
|
706
|
+
const manifest = identified.value.manifest;
|
|
707
|
+
const manifestRef = await store.json('manifest', manifest, overlayBounds.manifestMaxBytes);
|
|
708
|
+
const inventory = await store.json('source', {
|
|
709
|
+
version: 2,
|
|
710
|
+
repository: task.spec.target.repository,
|
|
711
|
+
directory,
|
|
712
|
+
baseObject,
|
|
713
|
+
sourceObject,
|
|
714
|
+
baseTree,
|
|
715
|
+
manifest: manifestRef,
|
|
716
|
+
sourceTree: sourceTreeRef,
|
|
717
|
+
entryCount: descriptions.length,
|
|
718
|
+
}, 262_144);
|
|
719
|
+
const workspace = await store.json('workspace', {
|
|
720
|
+
version: 1,
|
|
721
|
+
format: 'controller-passive-workspace',
|
|
722
|
+
inventory,
|
|
723
|
+
manifest: manifestRef,
|
|
724
|
+
}, 65_536);
|
|
725
|
+
const baselineProofs = await resolveBaselineMerkleProofs(directory, owner, baseTree, descriptions, jsonPaths);
|
|
726
|
+
return {
|
|
727
|
+
version: 2,
|
|
728
|
+
repository: task.spec.target.repository,
|
|
729
|
+
directory,
|
|
730
|
+
baseObject,
|
|
731
|
+
sourceObject,
|
|
732
|
+
manifest,
|
|
733
|
+
inventory,
|
|
734
|
+
workspace,
|
|
735
|
+
artifacts: [],
|
|
736
|
+
baselineEntries: Object.freeze(descriptions),
|
|
737
|
+
sourceTree: sourceTreeRef,
|
|
738
|
+
...(baselineProofs ? { baselineProofs } : {}),
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
export async function verifySource(source, task, owner) {
|
|
742
|
+
if (!same([source.baseObject, source.sourceObject], [await object(owner, source.directory, task.spec.target.baseRevision), await object(owner, source.directory, task.spec.target.sourceRevision)])) {
|
|
743
|
+
refuse('TARGET_MISMATCH', '', 'execution');
|
|
744
|
+
}
|
|
745
|
+
if (source.version === 2 || source.manifest.spec.baseTree !== undefined) {
|
|
746
|
+
const baseTree = source.manifest.spec.baseTree;
|
|
747
|
+
if (!baseTree || baseTree.commitOid !== source.sourceObject)
|
|
748
|
+
refuse('TARGET_MISMATCH', '', 'execution');
|
|
749
|
+
const actualTreeOid = await treeObject(owner, source.directory, source.sourceObject, baseTree.objectFormat);
|
|
750
|
+
if (actualTreeOid !== baseTree.treeOid)
|
|
751
|
+
refuse('TARGET_MISMATCH', '', 'execution');
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
/** Reopen the original frozen bytes, then re-resolve its exact declared refs. No replacement inventory is created. */
|
|
755
|
+
export async function restoreSource(repository, task, owner, reader, inventory, workspace, jsonPaths = []) {
|
|
756
|
+
const raw = parsePrivateJson(await reader.read(inventory, 262_144), 262_144);
|
|
757
|
+
const directory = resolve(repository);
|
|
758
|
+
const rawVersion = raw !== null && typeof raw === 'object' && !Array.isArray(raw) ? raw.version : undefined;
|
|
759
|
+
if (rawVersion === 1) {
|
|
760
|
+
const value = record(raw, ['version', 'repository', 'directory', 'baseObject', 'sourceObject', 'manifest', 'entries']);
|
|
761
|
+
if (value.repository !== task.spec.target.repository
|
|
762
|
+
|| value.directory !== directory
|
|
763
|
+
|| !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text(value.baseObject))
|
|
764
|
+
|| !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text(value.sourceObject))) {
|
|
765
|
+
refuse('TARGET_MISMATCH', '', 'recovery');
|
|
766
|
+
}
|
|
767
|
+
await canonicalComponents(directory);
|
|
768
|
+
const info = await lstat(directory);
|
|
769
|
+
if (!info.isDirectory() || info.uid !== process.getuid?.() || await realpath(directory) !== directory) {
|
|
770
|
+
refuse('TARGET_MISMATCH', '', 'recovery');
|
|
771
|
+
}
|
|
772
|
+
const overlayBounds = overlayManifestBounds(task.spec.budgets.overlay);
|
|
773
|
+
const manifestRef = checkedRef(value.manifest);
|
|
774
|
+
const identified = identifyManifest(parsePrivateJson(await reader.read(manifestRef, overlayBounds.manifestMaxBytes), overlayBounds.manifestMaxBytes, overlayBounds.collectionLimit), overlayBounds.options);
|
|
775
|
+
if (!identified.ok || identified.value.manifest.metadata.id !== 'candidate' || identified.value.manifest.spec.baseTree !== undefined) {
|
|
776
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
777
|
+
}
|
|
778
|
+
const entries = list(value.entries, '', 256).map(item => record(item, ['name', 'mode', 'oid', 'ref', 'artifact']));
|
|
779
|
+
const artifacts = [];
|
|
780
|
+
let total = 0;
|
|
781
|
+
if (!same(entries.map(entry => entry.ref), identified.value.manifest.spec.entries)
|
|
782
|
+
|| !same([...entries].sort((a, b) => compareUtf16(text(a.name), text(b.name))), entries)) {
|
|
783
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
784
|
+
}
|
|
785
|
+
const names = new Set();
|
|
786
|
+
for (const entry of entries) {
|
|
787
|
+
const name = text(entry.name, '', 4096), ref = checkedRef(entry.ref), artifact = checkedRef(entry.artifact);
|
|
788
|
+
const entryMode = text(entry.mode);
|
|
789
|
+
if (name !== ref.name
|
|
790
|
+
|| (entryMode !== '100644' && entryMode !== '100755')
|
|
791
|
+
|| !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text(entry.oid))
|
|
792
|
+
|| name.split('/').some(segment => segment.toLowerCase() === '.git' || segment.length > 255)
|
|
793
|
+
|| names.has(name.toLowerCase())
|
|
794
|
+
|| (total += ref.byteLength) > 4_194_304) {
|
|
795
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
796
|
+
}
|
|
797
|
+
names.add(name.toLowerCase());
|
|
798
|
+
const bytes = await reader.read(artifact, 4_194_304), actual = digestArtifact(name, bytes);
|
|
799
|
+
if (!actual.ok || !same(actual.value, ref))
|
|
800
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
801
|
+
artifacts.push({ name, bytes: new Uint8Array(bytes), mode: entryMode });
|
|
802
|
+
}
|
|
803
|
+
if (!same(parsePrivateJson(await reader.read(workspace, 65_536), 65_536), { version: 1, format: 'controller-passive-workspace', inventory, manifest: manifestRef })) {
|
|
804
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
805
|
+
}
|
|
806
|
+
const source = {
|
|
807
|
+
version: 1,
|
|
808
|
+
repository: task.spec.target.repository,
|
|
809
|
+
directory,
|
|
810
|
+
baseObject: text(value.baseObject),
|
|
811
|
+
sourceObject: text(value.sourceObject),
|
|
812
|
+
manifest: identified.value.manifest,
|
|
813
|
+
inventory,
|
|
814
|
+
workspace,
|
|
815
|
+
artifacts,
|
|
816
|
+
};
|
|
817
|
+
await verifySource(source, task, owner);
|
|
818
|
+
return source;
|
|
819
|
+
}
|
|
820
|
+
if (rawVersion === 2) {
|
|
821
|
+
const value = record(raw, ['version', 'repository', 'directory', 'baseObject', 'sourceObject', 'baseTree', 'manifest', 'sourceTree', 'entryCount']);
|
|
822
|
+
if (value.repository !== task.spec.target.repository
|
|
823
|
+
|| value.directory !== directory
|
|
824
|
+
|| !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text(value.baseObject))
|
|
825
|
+
|| !/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(text(value.sourceObject))) {
|
|
826
|
+
refuse('TARGET_MISMATCH', '', 'recovery');
|
|
827
|
+
}
|
|
828
|
+
await canonicalComponents(directory);
|
|
829
|
+
const info = await lstat(directory);
|
|
830
|
+
if (!info.isDirectory() || info.uid !== process.getuid?.() || await realpath(directory) !== directory) {
|
|
831
|
+
refuse('TARGET_MISMATCH', '', 'recovery');
|
|
832
|
+
}
|
|
833
|
+
const overlayBounds = overlayManifestBounds(task.spec.budgets.overlay);
|
|
834
|
+
const manifestRef = checkedRef(value.manifest);
|
|
835
|
+
const identified = identifyManifest(parsePrivateJson(await reader.read(manifestRef, overlayBounds.manifestMaxBytes), overlayBounds.manifestMaxBytes, overlayBounds.collectionLimit), overlayBounds.options);
|
|
836
|
+
if (!identified.ok
|
|
837
|
+
|| identified.value.manifest.metadata.id !== 'candidate'
|
|
838
|
+
|| identified.value.manifest.spec.baseTree === undefined
|
|
839
|
+
|| !same(identified.value.manifest.spec.baseTree, value.baseTree)
|
|
840
|
+
|| identified.value.manifest.spec.entries.length !== 0
|
|
841
|
+
|| identified.value.manifest.spec.deleted.length !== 0) {
|
|
842
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
843
|
+
}
|
|
844
|
+
const baseTree = identified.value.manifest.spec.baseTree;
|
|
845
|
+
const sourceTreeRef = checkedRef(value.sourceTree);
|
|
846
|
+
const sourceTreeBytes = await reader.read(sourceTreeRef, 8_388_608);
|
|
847
|
+
const baselineEntries = parseSourceTree(sourceTreeBytes, baseTree.objectFormat, 'recovery');
|
|
848
|
+
if (baselineEntries.length !== integer(value.entryCount, 0, LIMITS.baselineEntries)) {
|
|
849
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
850
|
+
}
|
|
851
|
+
if (!same(parsePrivateJson(await reader.read(workspace, 65_536), 65_536), { version: 1, format: 'controller-passive-workspace', inventory, manifest: manifestRef })) {
|
|
852
|
+
refuse('ARTIFACT_INVALID', '', 'recovery');
|
|
853
|
+
}
|
|
854
|
+
const source = {
|
|
855
|
+
version: 2,
|
|
856
|
+
repository: task.spec.target.repository,
|
|
857
|
+
directory,
|
|
858
|
+
baseObject: text(value.baseObject),
|
|
859
|
+
sourceObject: text(value.sourceObject),
|
|
860
|
+
manifest: identified.value.manifest,
|
|
861
|
+
inventory,
|
|
862
|
+
workspace,
|
|
863
|
+
artifacts: [],
|
|
864
|
+
baselineEntries,
|
|
865
|
+
sourceTree: sourceTreeRef,
|
|
866
|
+
};
|
|
867
|
+
await verifySource(source, task, owner);
|
|
868
|
+
const baselineProofs = await resolveBaselineMerkleProofs(directory, owner, baseTree, baselineEntries, jsonPaths);
|
|
869
|
+
return baselineProofs ? { ...source, baselineProofs } : source;
|
|
870
|
+
}
|
|
871
|
+
refuse('TARGET_MISMATCH', '', 'recovery');
|
|
872
|
+
}
|