firedrill-run 2.2.5 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -22
- package/bin/firedrill.mjs +29 -5
- package/dist/assembly.json +13 -0
- package/dist/cli/runtime/candidate_copy.py +395 -0
- package/dist/cli/runtime/source_snapshot.py +391 -0
- package/dist/cli/src/administration.js +295 -0
- package/dist/cli/src/agent-changes.js +496 -0
- package/dist/cli/src/assessment-requests.js +67 -0
- package/dist/cli/src/auth.js +465 -0
- package/dist/cli/src/billing-commerce-contracts.js +1 -0
- package/dist/cli/src/billing-usage.js +227 -0
- package/dist/cli/src/billing-wallet-contracts.js +1 -0
- package/dist/cli/src/billing.js +170 -0
- package/dist/cli/src/bootstrap-process-lock.js +136 -0
- package/dist/cli/src/browser-links.js +14 -0
- package/dist/cli/src/campaign-controls.js +122 -0
- package/dist/cli/src/campaign-diagnoses.js +118 -0
- package/dist/cli/src/campaign-reports.js +1215 -0
- package/dist/cli/src/campaign-world.js +156 -0
- package/dist/cli/src/candidate-copy.js +376 -0
- package/dist/cli/src/catalog-contracts.js +1 -0
- package/dist/cli/src/ci-access-contracts.js +1 -0
- package/dist/cli/src/ci-configuration-contracts.js +1 -0
- package/dist/cli/src/ci-coverage.js +64 -0
- package/dist/cli/src/ci-delivery-contracts.js +1 -0
- package/dist/cli/src/ci-result-contracts.js +1 -0
- package/dist/cli/src/ci-run-contracts.js +1 -0
- package/dist/cli/src/ci-setup-proposals.js +52 -0
- package/dist/cli/src/company-policies.js +229 -0
- package/dist/cli/src/completion.js +79 -0
- package/dist/cli/src/configuration-intents.js +277 -0
- package/dist/cli/src/configuration.js +369 -0
- package/dist/cli/src/continuous-simulation.js +277 -0
- package/dist/cli/src/coordinated-checkpoints.js +133 -0
- package/dist/cli/src/credential-mode.js +139 -0
- package/dist/cli/src/credentials.js +331 -0
- package/dist/cli/src/credit-format.js +8 -0
- package/dist/cli/src/dataset-contracts.js +1 -0
- package/dist/cli/src/dataset-export.js +154 -0
- package/dist/cli/src/dataset-reads.js +37 -0
- package/dist/cli/src/dependency-preparation.js +239 -0
- package/dist/cli/src/director-tool-setup.js +104 -0
- package/dist/cli/src/driver-review.js +225 -0
- package/dist/cli/src/evaluation-authoring.js +315 -0
- package/dist/cli/src/evidence-bundles.js +367 -0
- package/dist/cli/src/execution-proposals.js +36 -0
- package/dist/cli/src/http.js +302 -0
- package/dist/cli/src/local-container-boundary.js +38 -0
- package/dist/cli/src/local-container-policy.js +201 -0
- package/dist/cli/src/local-execution-setup.js +81 -0
- package/dist/cli/src/local-source-basis.js +73 -0
- package/dist/cli/src/local-source.js +66 -0
- package/dist/cli/src/local-value-store.js +91 -0
- package/dist/cli/src/local-values.js +163 -0
- package/dist/cli/src/login-organizations.js +70 -0
- package/dist/cli/src/main.js +1622 -0
- package/dist/cli/src/mcp-connection.js +109 -0
- package/dist/cli/src/native/bindings.js +137 -0
- package/dist/cli/src/native/canonical.js +370 -0
- package/dist/cli/src/native/cloud-resources.js +942 -0
- package/dist/cli/src/native/companion-channel.js +421 -0
- package/dist/cli/src/native/companion-ipc.js +473 -0
- package/dist/cli/src/native/contracts.js +218 -0
- package/dist/cli/src/native/control-plane.js +1354 -0
- package/dist/cli/src/native/credit-approval.js +15 -0
- package/dist/cli/src/native/dependency-proxy.js +1006 -0
- package/dist/cli/src/native/drill-cleanup.js +115 -0
- package/dist/cli/src/native/drill-runner.js +1562 -0
- package/dist/cli/src/native/drivers/action-trace.js +210 -0
- package/dist/cli/src/native/drivers/function-wrapper.js +152 -0
- package/dist/cli/src/native/drivers/http.js +442 -0
- package/dist/cli/src/native/drivers/index.js +47 -0
- package/dist/cli/src/native/drivers/jsonl-process.js +538 -0
- package/dist/cli/src/native/drivers/playwright.js +600 -0
- package/dist/cli/src/native/drivers/signed-event.js +244 -0
- package/dist/cli/src/native/drivers/types.js +578 -0
- package/dist/cli/src/native/evidence-filter.js +255 -0
- package/dist/cli/src/native/isolated-access.js +241 -0
- package/dist/cli/src/native/library-sharing.js +220 -0
- package/dist/cli/src/native/local-run.js +667 -0
- package/dist/cli/src/native/local-secrets.js +19 -0
- package/dist/cli/src/native/mcp-config.js +123 -0
- package/dist/cli/src/native/metadata-requests.js +120 -0
- package/dist/cli/src/native/observations.js +1159 -0
- package/dist/cli/src/native/owned-groups.js +46 -0
- package/dist/cli/src/native/plan.js +594 -0
- package/dist/cli/src/native/png.js +159 -0
- package/dist/cli/src/native/ports.js +43 -0
- package/dist/cli/src/native/readiness.js +139 -0
- package/dist/cli/src/native/reassessments.js +206 -0
- package/dist/cli/src/native/redaction.js +235 -0
- package/dist/cli/src/native/registration.js +155 -0
- package/dist/cli/src/native/roots.js +110 -0
- package/dist/cli/src/native/run-cleanup.js +199 -0
- package/dist/cli/src/native/scratch.js +117 -0
- package/dist/cli/src/native/screenshots.js +60 -0
- package/dist/cli/src/native/session.js +556 -0
- package/dist/cli/src/native/standalone-proxy.js +580 -0
- package/dist/cli/src/native/standalone-renewals.js +183 -0
- package/dist/cli/src/native/standalone-state.js +193 -0
- package/dist/cli/src/native/standalone-tools.js +187 -0
- package/dist/cli/src/native/supervisor.js +831 -0
- package/dist/cli/src/native/target-auth.js +161 -0
- package/dist/cli/src/native/target-state.js +330 -0
- package/dist/cli/src/native/tool-reuse.js +364 -0
- package/dist/cli/src/native/tool-setups.js +336 -0
- package/dist/cli/src/native/world-reuse.js +288 -0
- package/dist/cli/src/onboarding.js +23 -0
- package/dist/cli/src/priority-requests.js +70 -0
- package/dist/cli/src/priority.js +223 -0
- package/dist/cli/src/prompts.js +184 -0
- package/dist/cli/src/real-operations.js +221 -0
- package/dist/cli/src/recipe-intents.js +58 -0
- package/dist/cli/src/recorded-context-intents.js +59 -0
- package/dist/cli/src/recorded-context.js +248 -0
- package/dist/cli/src/recordings.js +69 -0
- package/dist/cli/src/registration-guide.js +39 -0
- package/dist/cli/src/report-exports.js +213 -0
- package/dist/cli/src/request-input.js +47 -0
- package/dist/cli/src/resource-lifecycle.js +141 -0
- package/dist/cli/src/revision-requests.js +55 -0
- package/dist/cli/src/runner-abandon.js +53 -0
- package/dist/cli/src/runner-campaign-controls.js +262 -0
- package/dist/cli/src/runner-claim-reads.js +36 -0
- package/dist/cli/src/runner-completion.js +65 -0
- package/dist/cli/src/runner-configuration.js +546 -0
- package/dist/cli/src/runner-container.js +794 -0
- package/dist/cli/src/runner-evidence-erasure.js +351 -0
- package/dist/cli/src/runner-evidence-privacy.js +37 -0
- package/dist/cli/src/runner-evidence-retention.js +161 -0
- package/dist/cli/src/runner-evidence.js +326 -0
- package/dist/cli/src/runner-execute.js +92 -0
- package/dist/cli/src/runner-execution-deadline.js +25 -0
- package/dist/cli/src/runner-grants.js +307 -0
- package/dist/cli/src/runner-identity.js +615 -0
- package/dist/cli/src/runner-inputs.js +308 -0
- package/dist/cli/src/runner-jobs.js +49 -0
- package/dist/cli/src/runner-model-transport.js +392 -0
- package/dist/cli/src/runner-ownership.js +332 -0
- package/dist/cli/src/runner-process-lock.js +175 -0
- package/dist/cli/src/runner-runtime.js +396 -0
- package/dist/cli/src/runner-session-channel.js +377 -0
- package/dist/cli/src/runner-trial-completion.js +34 -0
- package/dist/cli/src/runner-trial-journal.js +358 -0
- package/dist/cli/src/runner-trial-live.js +393 -0
- package/dist/cli/src/runner-trial-protocol.js +289 -0
- package/dist/cli/src/runner-trial-sync.js +110 -0
- package/dist/cli/src/runner-trial-transfer.js +107 -0
- package/dist/cli/src/runner-voice.js +40 -0
- package/dist/cli/src/runner-world-claim.js +21 -0
- package/dist/cli/src/runner-world-collector.js +159 -0
- package/dist/cli/src/runner-world-command-evidence.js +487 -0
- package/dist/cli/src/runner-world-commands.js +268 -0
- package/dist/cli/src/runner-world-completion.js +76 -0
- package/dist/cli/src/runner-world-erasure.js +95 -0
- package/dist/cli/src/runner-world-evidence-sync.js +91 -0
- package/dist/cli/src/runner-world-journal.js +510 -0
- package/dist/cli/src/runner-world-native-filters.js +134 -0
- package/dist/cli/src/runner-world-observations.js +50 -0
- package/dist/cli/src/runner-world-session-protocol.js +134 -0
- package/dist/cli/src/saved-records.js +40 -0
- package/dist/cli/src/scenario-authoring.js +212 -0
- package/dist/cli/src/scenario-discovery.js +216 -0
- package/dist/cli/src/scenario-paths.js +68 -0
- package/dist/cli/src/scenario-requests.js +4 -0
- package/dist/cli/src/service-receipts.js +105 -0
- package/dist/cli/src/simple/authoring.js +270 -0
- package/dist/cli/src/simple/credit-approval.js +16 -0
- package/dist/cli/src/simple/help.js +98 -0
- package/dist/cli/src/simple/init.js +61 -0
- package/dist/cli/src/simple/library-sharing.js +414 -0
- package/dist/cli/src/simple/metadata-requests.js +46 -0
- package/dist/cli/src/simple/native-report.js +841 -0
- package/dist/cli/src/simple/native-tools.js +780 -0
- package/dist/cli/src/simple/plan-apply.js +506 -0
- package/dist/cli/src/simple/reassessment.js +323 -0
- package/dist/cli/src/simple/register.js +123 -0
- package/dist/cli/src/simple/run.js +122 -0
- package/dist/cli/src/simple/status.js +49 -0
- package/dist/cli/src/simple/tool-renewal.js +308 -0
- package/dist/cli/src/simple/tool-reuse.js +526 -0
- package/dist/cli/src/simple/tool-start-catalog.js +100 -0
- package/dist/cli/src/simple/tool-state.js +426 -0
- package/dist/cli/src/simple/tools-author.js +222 -0
- package/dist/cli/src/simple/watch.js +28 -0
- package/dist/cli/src/simple/world-reuse.js +586 -0
- package/dist/cli/src/simulation-intents.js +406 -0
- package/dist/cli/src/simulation-run.js +1058 -0
- package/dist/cli/src/source-batch.js +322 -0
- package/dist/cli/src/source-connection.js +451 -0
- package/dist/cli/src/source-runtime.js +346 -0
- package/dist/cli/src/source-selection-intents.js +75 -0
- package/dist/cli/src/source-sets.js +214 -0
- package/dist/cli/src/target-models.js +109 -0
- package/dist/cli/src/tool-catalog.js +224 -0
- package/dist/cli/src/tool-command-contracts.js +1 -0
- package/dist/cli/src/tool-command-export.js +245 -0
- package/dist/cli/src/tool-connection-contracts.js +1 -0
- package/dist/cli/src/tool-connection-reads.js +23 -0
- package/dist/cli/src/tool-contributions.js +58 -0
- package/dist/cli/src/tool-data.js +116 -0
- package/dist/cli/src/tool-datasets.js +176 -0
- package/dist/cli/src/tool-group-contracts.js +1 -0
- package/dist/cli/src/tool-group-reads.js +26 -0
- package/dist/cli/src/tool-group-state.js +147 -0
- package/dist/cli/src/tool-groups.js +311 -0
- package/dist/cli/src/tool-instances.js +186 -0
- package/dist/cli/src/tool-lifecycle-contracts.js +1 -0
- package/dist/cli/src/tool-lifecycle-reads.js +30 -0
- package/dist/cli/src/tool-lifecycle.js +323 -0
- package/dist/cli/src/tool-package-contracts.js +1 -0
- package/dist/cli/src/tool-package-reads.js +41 -0
- package/dist/cli/src/tool-records.js +53 -0
- package/dist/cli/src/tool-runtime.js +96 -0
- package/dist/cli/src/tool-state-contracts.js +1 -0
- package/dist/cli/src/tool-state-reads.js +31 -0
- package/dist/cli/src/tools.js +306 -0
- package/dist/cli/src/trial-actions.js +93 -0
- package/dist/cli/src/trial-checkpoints.js +133 -0
- package/dist/cli/src/trial-checks.js +70 -0
- package/dist/cli/src/trial-state.js +197 -0
- package/dist/cli/src/vault.js +266 -0
- package/dist/cli/src/workspace-registration.js +383 -0
- package/dist/cli/src/workspace-team-contracts.js +1 -0
- package/dist/cli/src/world-access.js +231 -0
- package/dist/cli/src/world-agent.js +4 -0
- package/dist/cli/src/world-checkpoint-scopes.js +15 -0
- package/dist/cli/src/world-contracts.js +6 -0
- package/dist/cli/src/world-creation.js +201 -0
- package/dist/cli/src/world-datasets.js +207 -0
- package/dist/cli/src/world-inspection.js +257 -0
- package/dist/cli/src/world-recipes.js +103 -0
- package/dist/cli/src/world-requests.js +241 -0
- package/dist/cli/src/world-session-checkpoints.js +196 -0
- package/dist/cli/src/world-session-lifecycle.js +207 -0
- package/dist/cli/src/world-session-requests.js +215 -0
- package/dist/cli/src/world-session-state.js +145 -0
- package/dist/cli/src/world-session-voice.js +66 -0
- package/dist/cli/src/world-sessions.js +288 -0
- package/dist/cli/src/world-stream.js +99 -0
- package/dist/cli/src/world-time-report.js +58 -0
- package/dist/contracts/agent-change-contracts.js +75 -0
- package/dist/contracts/agent-execution-contracts.js +38 -0
- package/dist/contracts/application-state-contracts.js +26 -0
- package/dist/contracts/assessment-aggregate-contracts.js +15 -0
- package/dist/contracts/assessment-contracts.js +74 -0
- package/dist/contracts/billing-commerce-contracts.js +107 -0
- package/dist/contracts/billing-wallet-contracts.js +43 -0
- package/dist/contracts/campaign-lifecycle.js +1 -0
- package/dist/contracts/campaign-world-contracts.js +80 -0
- package/dist/contracts/catalog-contracts.js +73 -0
- package/dist/contracts/ci-access-contracts.js +68 -0
- package/dist/contracts/ci-configuration-contracts.js +88 -0
- package/dist/contracts/ci-coverage-contracts.js +65 -0
- package/dist/contracts/ci-coverage-labels.js +25 -0
- package/dist/contracts/ci-delivery-contracts.js +61 -0
- package/dist/contracts/ci-result-contracts.js +103 -0
- package/dist/contracts/ci-run-contracts.js +51 -0
- package/dist/contracts/ci-setup-contracts.js +88 -0
- package/dist/contracts/clip-contracts.js +32 -0
- package/dist/contracts/comparison-contracts.js +53 -0
- package/dist/contracts/composite-contracts.js +34 -0
- package/dist/contracts/context-contracts.js +76 -0
- package/dist/contracts/continuation-report-contracts.js +1 -0
- package/dist/contracts/continuity-requirements.js +8 -0
- package/dist/contracts/coordinated-checkpoint-contracts.js +34 -0
- package/dist/contracts/dataset-contracts.js +88 -0
- package/dist/contracts/dependency-decision-contracts.js +36 -0
- package/dist/contracts/dependency-protocol-contracts.js +43 -0
- package/dist/contracts/director-execution.js +51 -0
- package/dist/contracts/driver-review-contracts.js +99 -0
- package/dist/contracts/evidence-contracts.js +65 -0
- package/dist/contracts/evidence-coverage-contracts.js +10 -0
- package/dist/contracts/export-contracts.js +44 -0
- package/dist/contracts/github-directory-contracts.js +96 -0
- package/dist/contracts/insight-contracts.js +11 -0
- package/dist/contracts/inspection-contracts.js +1 -0
- package/dist/contracts/local-claim-contracts.js +39 -0
- package/dist/contracts/local-configuration-contracts.js +7 -0
- package/dist/contracts/local-evidence-contracts.js +32 -0
- package/dist/contracts/local-grant-contracts.js +83 -0
- package/dist/contracts/local-input-contracts.js +19 -0
- package/dist/contracts/local-runner-contracts.js +42 -0
- package/dist/contracts/local-trial-live-contracts.js +16 -0
- package/dist/contracts/local-value-source-contracts.js +92 -0
- package/dist/contracts/local-world-native-contracts.js +8 -0
- package/dist/contracts/mcp-contracts.js +42 -0
- package/dist/contracts/media-contracts.js +28 -0
- package/dist/contracts/native-check-contracts.js +31 -0
- package/dist/contracts/native-identity-contracts.js +52 -0
- package/dist/contracts/onboarding-contracts.js +32 -0
- package/dist/contracts/performance-contracts.js +85 -0
- package/dist/contracts/planning-contracts.js +81 -0
- package/dist/contracts/real-operation-contracts.js +30 -0
- package/dist/contracts/recommendation-contracts.js +54 -0
- package/dist/contracts/report-contracts.js +1 -0
- package/dist/contracts/resource-lifecycle-contracts.js +57 -0
- package/dist/contracts/revision-contracts.js +12 -0
- package/dist/contracts/revision-request-contracts.js +39 -0
- package/dist/contracts/saved-record-contracts.js +76 -0
- package/dist/contracts/scenario-draft-comparison.js +91 -0
- package/dist/contracts/scenario-world-contracts.js +14 -0
- package/dist/contracts/service-contracts.js +1 -0
- package/dist/contracts/session-command-contracts.js +56 -0
- package/dist/contracts/session-contracts.js +65 -0
- package/dist/contracts/session-state-contracts.js +67 -0
- package/dist/contracts/session-voice-contracts.js +45 -0
- package/dist/contracts/source-set-contracts.js +26 -0
- package/dist/contracts/source-upload-contracts.js +22 -0
- package/dist/contracts/tool-command-contracts.js +57 -0
- package/dist/contracts/tool-connection-contracts.js +87 -0
- package/dist/contracts/tool-contribution-contracts.js +35 -0
- package/dist/contracts/tool-group-contracts.js +53 -0
- package/dist/contracts/tool-group-state-contracts.js +63 -0
- package/dist/contracts/tool-lifecycle-contracts.js +94 -0
- package/dist/contracts/tool-package-contracts.js +91 -0
- package/dist/contracts/tool-protocol-contracts.js +71 -0
- package/dist/contracts/tool-runtime-billing-contracts.js +28 -0
- package/dist/contracts/tool-setup-proposal.js +59 -0
- package/dist/contracts/tool-state-contracts.js +79 -0
- package/dist/contracts/trial-state-contracts.js +30 -0
- package/dist/contracts/typescript/agent-change.js +1 -0
- package/dist/contracts/typescript/assessment-aggregate.js +1 -0
- package/dist/contracts/typescript/assessment.js +1 -0
- package/dist/contracts/typescript/billing-commerce.js +1 -0
- package/dist/contracts/typescript/campaigns.js +1 -0
- package/dist/contracts/typescript/catalog.js +1 -0
- package/dist/contracts/typescript/ci-access.js +1 -0
- package/dist/contracts/typescript/ci-configuration.js +1 -0
- package/dist/contracts/typescript/ci-delivery.js +1 -0
- package/dist/contracts/typescript/ci-result.js +1 -0
- package/dist/contracts/typescript/ci-runs.js +1 -0
- package/dist/contracts/typescript/clips.js +1 -0
- package/dist/contracts/typescript/comparison.js +1 -0
- package/dist/contracts/typescript/composite.js +1 -0
- package/dist/contracts/typescript/connections.js +1 -0
- package/dist/contracts/typescript/context.js +1 -0
- package/dist/contracts/typescript/datasets.js +1 -0
- package/dist/contracts/typescript/evidence-coverage.js +1 -0
- package/dist/contracts/typescript/export.js +1 -0
- package/dist/contracts/typescript/github-directory.js +1 -0
- package/dist/contracts/typescript/insight.js +1 -0
- package/dist/contracts/typescript/inspection.js +1 -0
- package/dist/contracts/typescript/intake.js +1 -0
- package/dist/contracts/typescript/local-claim.js +1 -0
- package/dist/contracts/typescript/local-configuration.js +1 -0
- package/dist/contracts/typescript/local-evidence.js +1 -0
- package/dist/contracts/typescript/local-grant.js +1 -0
- package/dist/contracts/typescript/local-input.js +1 -0
- package/dist/contracts/typescript/local-runner.js +1 -0
- package/dist/contracts/typescript/local-trial-live.js +1 -0
- package/dist/contracts/typescript/local-value-source.js +1 -0
- package/dist/contracts/typescript/local-world-native.js +1 -0
- package/dist/contracts/typescript/mcp.js +1 -0
- package/dist/contracts/typescript/media.js +1 -0
- package/dist/contracts/typescript/native-check.js +1 -0
- package/dist/contracts/typescript/native-identity.js +1 -0
- package/dist/contracts/typescript/onboarding.js +1 -0
- package/dist/contracts/typescript/performance.js +1 -0
- package/dist/contracts/typescript/planning.js +1 -0
- package/dist/contracts/typescript/preparation.js +1 -0
- package/dist/contracts/typescript/real-operation.js +1 -0
- package/dist/contracts/typescript/recommendation.js +1 -0
- package/dist/contracts/typescript/reports.js +1 -0
- package/dist/contracts/typescript/resource-lifecycle.js +1 -0
- package/dist/contracts/typescript/saved-record.js +1 -0
- package/dist/contracts/typescript/scenarios.js +1 -0
- package/dist/contracts/typescript/services.js +1 -0
- package/dist/contracts/typescript/session-command.js +1 -0
- package/dist/contracts/typescript/session-state.js +1 -0
- package/dist/contracts/typescript/session-voice.js +1 -0
- package/dist/contracts/typescript/session.js +1 -0
- package/dist/contracts/typescript/tool-command.js +1 -0
- package/dist/contracts/typescript/tool-connection.js +1 -0
- package/dist/contracts/typescript/tool-contribution.js +1 -0
- package/dist/contracts/typescript/tool-groups.js +1 -0
- package/dist/contracts/typescript/tool-lifecycle.js +1 -0
- package/dist/contracts/typescript/tool-package.js +1 -0
- package/dist/contracts/typescript/tool-state.js +1 -0
- package/dist/contracts/typescript/trial-state.js +1 -0
- package/dist/contracts/typescript/vault.js +1 -0
- package/dist/contracts/typescript/workspace-team.js +1 -0
- package/dist/contracts/typescript/world-stream.js +1 -0
- package/dist/contracts/workspace-team-contracts.js +55 -0
- package/dist/contracts/world-command.js +65 -0
- package/dist/contracts/world-lifetime-contracts.js +74 -0
- package/dist/contracts/world-recipe-contracts.js +27 -0
- package/dist/contracts/world-stream-contracts.js +27 -0
- package/dist/package.json +1 -0
- package/package.json +16 -16
- package/LICENSE.md +0 -23
- package/PACKAGING.json +0 -50
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import { api } from './auth.js';
|
|
3
|
+
import { API_ORIGIN, CliError } from './http.js';
|
|
4
|
+
import { signRunnerRequest } from './runner-identity.js';
|
|
5
|
+
import { identifier } from './world-contracts.js';
|
|
6
|
+
import { resolveLocalValues } from './local-value-store.js';
|
|
7
|
+
import { voiceChannels, voiceSession } from './runner-voice.js';
|
|
8
|
+
import { checkpointResetBaselines } from './world-checkpoint-scopes.js';
|
|
9
|
+
import { applicationStateReference } from '../../contracts/application-state-contracts.js';
|
|
10
|
+
import { readLocalClaim } from './runner-claim-reads.js';
|
|
11
|
+
import { localConfigurationIdentityMatches } from '../../contracts/local-configuration-contracts.js';
|
|
12
|
+
import { executionDriverMatches, executionAuthorityMatches, driverBasisMatches } from '../../contracts/agent-execution-contracts.js';
|
|
13
|
+
const HASH = /^[a-f0-9]{64}$/;
|
|
14
|
+
const VARIABLE = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
15
|
+
const TOKEN = /^[A-Za-z0-9_-]{32,256}$/;
|
|
16
|
+
const FORBIDDEN_HEADERS = new Set(['host', 'content-length', 'content-type', 'accept', 'connection', 'transfer-encoding',
|
|
17
|
+
'upgrade', 'te', 'trailer', 'expect', 'forwarded', 'via', 'cookie', 'set-cookie', 'proxy-authorization',
|
|
18
|
+
'proxy-authenticate', 'range', 'accept-encoding', 'mcp-session-id', 'mcp-protocol-version']);
|
|
19
|
+
const invalid = () => new CliError('local_runtime_packet_invalid', 'The native execution packet does not match the exact approved inputs. No target was started.');
|
|
20
|
+
const record = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
21
|
+
function startingData(control, owner, inputs) {
|
|
22
|
+
const entry = inputs.manifest.entries.find(one => one.part === 'dataset');
|
|
23
|
+
const placementBinding = owner.purpose === 'world_session' ? null : control.dataset_binding;
|
|
24
|
+
if (control.dataset === null) {
|
|
25
|
+
if (entry || control.dataset_transfer !== null || placementBinding !== null)
|
|
26
|
+
throw invalid();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const value = control.dataset, transfer = control.dataset_transfer;
|
|
30
|
+
const fields = ['schema', 'dataset_id', 'world_id', 'source_id', 'observation_id', 'configuration_id', 'configuration_digest',
|
|
31
|
+
'world_revision', 'validation_job_id', 'native_bundle_digest', 'engine_source_digest', 'archive_digest', 'index_digest', 'edit_count', 'recipe_artifact'];
|
|
32
|
+
if (!entry || !record(value) || Object.keys(value).sort().join(',') !== fields.sort().join(',')
|
|
33
|
+
|| value.schema !== 'firedrill.world-dataset-selection.v1'
|
|
34
|
+
|| typeof value.native_bundle_digest !== 'string' || !/^sha256:[a-f0-9]{64}$/.test(value.native_bundle_digest)
|
|
35
|
+
|| !Number.isSafeInteger(value.world_revision) || Number(value.world_revision) < 1
|
|
36
|
+
|| !Number.isSafeInteger(value.edit_count) || Number(value.edit_count) < 0 || Number(value.edit_count) > 100000
|
|
37
|
+
|| !record(transfer) || Object.keys(transfer).sort().join(',') !== 'sha256,size'
|
|
38
|
+
|| transfer.size !== entry.size || transfer.sha256 !== entry.sha256)
|
|
39
|
+
throw invalid();
|
|
40
|
+
for (const name of ['dataset_id', 'world_id', 'source_id', 'observation_id', 'configuration_id', 'validation_job_id']) {
|
|
41
|
+
if (typeof value[name] !== 'string' || identifier(value[name]) !== value[name])
|
|
42
|
+
throw invalid();
|
|
43
|
+
}
|
|
44
|
+
for (const name of ['configuration_digest', 'engine_source_digest', 'archive_digest', 'index_digest']) {
|
|
45
|
+
if (typeof value[name] !== 'string' || !HASH.test(value[name]))
|
|
46
|
+
throw invalid();
|
|
47
|
+
}
|
|
48
|
+
let placement = value;
|
|
49
|
+
if (placementBinding !== null) {
|
|
50
|
+
if (owner.purpose !== 'trial')
|
|
51
|
+
throw invalid();
|
|
52
|
+
const binding = placementBinding;
|
|
53
|
+
const fields = ['schema', 'comparison_id', 'comparison_sha256', 'selection_sha256', 'world_id', 'world_revision',
|
|
54
|
+
'source_id', 'configuration_id', 'configuration_digest', 'validation_job_id', 'native_bundle_digest', 'engine_source_digest'];
|
|
55
|
+
if (!record(binding) || Object.keys(binding).sort().join(',') !== fields.sort().join(',')
|
|
56
|
+
|| binding.schema !== 'firedrill.world-dataset-execution.v1'
|
|
57
|
+
|| binding.selection_sha256 !== createHash('sha256').update(canonical(value)).digest('hex')
|
|
58
|
+
|| !Number.isSafeInteger(binding.world_revision) || Number(binding.world_revision) < 1)
|
|
59
|
+
throw invalid();
|
|
60
|
+
for (const name of ['comparison_id', 'world_id', 'source_id', 'configuration_id', 'validation_job_id']) {
|
|
61
|
+
if (typeof binding[name] !== 'string' || identifier(binding[name]) !== binding[name])
|
|
62
|
+
throw invalid();
|
|
63
|
+
}
|
|
64
|
+
for (const name of ['comparison_sha256', 'configuration_digest', 'engine_source_digest']) {
|
|
65
|
+
if (typeof binding[name] !== 'string' || !HASH.test(binding[name]))
|
|
66
|
+
throw invalid();
|
|
67
|
+
}
|
|
68
|
+
placement = binding;
|
|
69
|
+
}
|
|
70
|
+
if (placement.world_id !== owner.world || placement.configuration_digest !== owner.configurationDigest
|
|
71
|
+
|| placement.native_bundle_digest !== control.bundle_digest || placement.engine_source_digest !== control.engine_source_digest)
|
|
72
|
+
throw invalid();
|
|
73
|
+
const archive = value.recipe_artifact;
|
|
74
|
+
if (!record(archive) || Object.keys(archive).sort().join(',') !== 'generation,id,sha256,size'
|
|
75
|
+
|| typeof archive.id !== 'string' || identifier(archive.id) !== archive.id || typeof archive.generation !== 'string'
|
|
76
|
+
|| !/^[1-9][0-9]{0,30}$/.test(archive.generation) || typeof archive.sha256 !== 'string' || !HASH.test(archive.sha256)
|
|
77
|
+
|| !Number.isSafeInteger(archive.size) || Number(archive.size) < 1 || Number(archive.size) > 8 * 1024 ** 2)
|
|
78
|
+
throw invalid();
|
|
79
|
+
}
|
|
80
|
+
function canonical(value) {
|
|
81
|
+
if (Array.isArray(value))
|
|
82
|
+
return '[' + value.map(canonical).join(',') + ']';
|
|
83
|
+
if (record(value))
|
|
84
|
+
return '{' + Object.keys(value).sort().map(key => JSON.stringify(key) + ':' + canonical(value[key])).join(',') + '}';
|
|
85
|
+
const result = JSON.stringify(value);
|
|
86
|
+
if (result === undefined)
|
|
87
|
+
throw invalid();
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
/** Remove references, not a claim of cryptographic zeroization of JS strings. */
|
|
91
|
+
export function clearRuntimeConfiguration(value) {
|
|
92
|
+
if (!record(value))
|
|
93
|
+
return;
|
|
94
|
+
if (record(value.target_phases))
|
|
95
|
+
for (const phase of ['build', 'runtime']) {
|
|
96
|
+
const values = value.target_phases[phase];
|
|
97
|
+
if (record(values))
|
|
98
|
+
for (const name of Object.keys(values))
|
|
99
|
+
delete values[name];
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(value.model_channels))
|
|
102
|
+
for (const item of value.model_channels) {
|
|
103
|
+
if (record(item)) {
|
|
104
|
+
delete item.token;
|
|
105
|
+
delete item.endpoint;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(value.real_channels))
|
|
109
|
+
for (const item of value.real_channels) {
|
|
110
|
+
if (record(item)) {
|
|
111
|
+
delete item.token;
|
|
112
|
+
delete item.endpoint;
|
|
113
|
+
if (record(item.markers))
|
|
114
|
+
for (const name of Object.keys(item.markers))
|
|
115
|
+
delete item.markers[name];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (record(value.participant_channel)) {
|
|
119
|
+
delete value.participant_channel.token;
|
|
120
|
+
delete value.participant_channel.endpoint;
|
|
121
|
+
}
|
|
122
|
+
if (Array.isArray(value.voice_channels))
|
|
123
|
+
for (const item of value.voice_channels) {
|
|
124
|
+
if (record(item)) {
|
|
125
|
+
delete item.token;
|
|
126
|
+
delete item.endpoint;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function validateRealChannels(value, owner, variables) {
|
|
131
|
+
const channels = value.real_channels, control = value.control;
|
|
132
|
+
if (!Array.isArray(channels) || !record(control) || !record(control.dependency_bindings)
|
|
133
|
+
|| !Array.isArray(control.dependency_bindings.real_channels) || !Array.isArray(control.dependency_bindings.dependencies)
|
|
134
|
+
|| !record(value.target_phases) || !record(value.target_phases.build) || !record(value.target_phases.runtime)
|
|
135
|
+
|| channels.length > 0 && (owner.realAccountAccess !== true || owner.purpose !== 'trial' && !(['validation', 'world_session'].includes(owner.purpose) && control.validation_scope === 'target_startup_only'
|
|
136
|
+
&& typeof control.startup_authorization_sha256 === 'string' && HASH.test(control.startup_authorization_sha256))))
|
|
137
|
+
throw invalid();
|
|
138
|
+
const expected = [];
|
|
139
|
+
for (const item of control.dependency_bindings.dependencies) {
|
|
140
|
+
if (!record(item) || typeof item.service_key !== 'string' || !HASH.test(item.service_key)
|
|
141
|
+
|| typeof item.mode !== 'string' || !['real', 'simulated'].includes(item.mode))
|
|
142
|
+
throw invalid();
|
|
143
|
+
if (item.mode === 'real')
|
|
144
|
+
expected.push(item.service_key);
|
|
145
|
+
}
|
|
146
|
+
const identifiers = new Set(), services = new Set(), projected = [];
|
|
147
|
+
for (const item of channels) {
|
|
148
|
+
if (!record(item) || Object.keys(item).sort().join(',') !== 'authentication,base_path,credential_variables,endpoint,endpoint_variable,id,markers,routes,service_key,token'
|
|
149
|
+
|| typeof item.id !== 'string' || identifier(item.id) !== item.id || identifiers.has(item.id)
|
|
150
|
+
|| typeof item.service_key !== 'string' || !HASH.test(item.service_key) || services.has(item.service_key)
|
|
151
|
+
|| typeof item.endpoint_variable !== 'string' || !VARIABLE.test(item.endpoint_variable) || variables.has(item.endpoint_variable)
|
|
152
|
+
|| typeof item.endpoint !== 'string' || typeof item.token !== 'string' || !TOKEN.test(item.token)
|
|
153
|
+
|| typeof item.base_path !== 'string' || item.base_path.length > 2048 || !/^(?:\/[A-Za-z0-9_~.-]+)*$/.test(item.base_path)
|
|
154
|
+
|| item.base_path.split('/').some(part => part === '.' || part === '..')
|
|
155
|
+
|| !Array.isArray(item.authentication) || item.authentication.length > 16 || !Array.isArray(item.credential_variables)
|
|
156
|
+
|| !record(item.markers) || !Array.isArray(item.routes) || !item.routes.length)
|
|
157
|
+
throw invalid();
|
|
158
|
+
const endpoint = new URL(item.endpoint);
|
|
159
|
+
if (endpoint.origin !== API_ORIGIN || endpoint.username || endpoint.password || endpoint.search || endpoint.hash
|
|
160
|
+
|| endpoint.pathname !== '/api/internal/real-dependency/' + item.id)
|
|
161
|
+
throw invalid();
|
|
162
|
+
variables.add(item.endpoint_variable);
|
|
163
|
+
if (Object.hasOwn(value.target_phases.build, item.endpoint_variable) || Object.hasOwn(value.target_phases.runtime, item.endpoint_variable))
|
|
164
|
+
throw invalid();
|
|
165
|
+
const names = [], headers = new Set();
|
|
166
|
+
for (const auth of item.authentication) {
|
|
167
|
+
if (!record(auth) || Object.keys(auth).sort().join(',') !== 'header,prefix,variable'
|
|
168
|
+
|| typeof auth.variable !== 'string' || !VARIABLE.test(auth.variable) || variables.has(auth.variable)
|
|
169
|
+
|| typeof auth.header !== 'string' || !/^[a-z][a-z0-9-]{0,63}$/.test(auth.header) || FORBIDDEN_HEADERS.has(auth.header)
|
|
170
|
+
|| /^(?:proxy-|x-forwarded-|sec-)/.test(auth.header) || headers.has(auth.header)
|
|
171
|
+
|| typeof auth.prefix !== 'string' || !/^(?:[A-Za-z][A-Za-z0-9_-]{0,31} )?$/.test(auth.prefix))
|
|
172
|
+
throw invalid();
|
|
173
|
+
const marker = item.markers[auth.variable];
|
|
174
|
+
if (typeof marker !== 'string' || !TOKEN.test(marker) || value.target_phases.runtime[auth.variable] !== marker
|
|
175
|
+
|| Object.hasOwn(value.target_phases.build, auth.variable))
|
|
176
|
+
throw invalid();
|
|
177
|
+
variables.add(auth.variable);
|
|
178
|
+
headers.add(auth.header);
|
|
179
|
+
names.push(auth.variable);
|
|
180
|
+
}
|
|
181
|
+
names.sort();
|
|
182
|
+
if (canonical(item.credential_variables) !== canonical(names) || canonical(Object.keys(item.markers).sort()) !== canonical(names))
|
|
183
|
+
throw invalid();
|
|
184
|
+
const routes = new Set();
|
|
185
|
+
for (const route of item.routes) {
|
|
186
|
+
if (!record(route) || !['http', 'mcp'].includes(String(route.protocol))
|
|
187
|
+
|| Object.keys(route).sort().join(',') !== (route.protocol === 'mcp' ? 'input_schema,mcp_tool,mcp_url_mode,method,operation,output_schema,protocol,route' : 'method,operation,protocol,route')
|
|
188
|
+
|| typeof route.operation !== 'string' || !route.operation.length || route.operation.length > 255 || route.operation.includes('\0')
|
|
189
|
+
|| typeof route.method !== 'string' || !['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'].includes(route.method)
|
|
190
|
+
|| typeof route.route !== 'string' || route.route.length > 2048 || !/^\/[A-Za-z0-9_./{}~:-]*$/.test(route.route)
|
|
191
|
+
|| route.route.startsWith('//') || route.route.split('/').some(part => part === '.' || part === '..'
|
|
192
|
+
|| (part.includes('{') || part.includes('}')) && !/^\{[A-Za-z_][A-Za-z0-9_]*\}$/.test(part)))
|
|
193
|
+
throw invalid();
|
|
194
|
+
if (route.protocol === 'mcp' && (route.method !== 'POST' || typeof route.mcp_tool !== 'string' || !route.mcp_tool.length || route.mcp_tool.length > 255
|
|
195
|
+
|| !['base', 'endpoint'].includes(String(route.mcp_url_mode)) || !record(route.input_schema)
|
|
196
|
+
|| route.output_schema !== null && !record(route.output_schema) || !/^\/(?:[A-Za-z0-9_~.-]+\/?)*$/.test(route.route)))
|
|
197
|
+
throw invalid();
|
|
198
|
+
const key = route.protocol + ':' + route.method + ':' + route.route.replace(/\{[A-Za-z_][A-Za-z0-9_]*\}/g, '{}') + (route.protocol === 'mcp' ? ':' + route.mcp_tool : '');
|
|
199
|
+
if (routes.has(key))
|
|
200
|
+
throw invalid();
|
|
201
|
+
routes.add(key);
|
|
202
|
+
}
|
|
203
|
+
identifiers.add(item.id);
|
|
204
|
+
services.add(item.service_key);
|
|
205
|
+
projected.push(Object.fromEntries(['id', 'service_key', 'endpoint_variable', 'authentication', 'base_path', 'routes'].map(key => [key, item[key]])));
|
|
206
|
+
}
|
|
207
|
+
if (canonical([...services].sort()) !== canonical(expected.sort()) || services.size !== expected.length
|
|
208
|
+
|| canonical(projected) !== canonical(control.dependency_bindings.real_channels))
|
|
209
|
+
throw invalid();
|
|
210
|
+
}
|
|
211
|
+
function validate(value, owner, inputs) {
|
|
212
|
+
if (!record(value) || !localConfigurationIdentityMatches(value, owner) || value.job_id !== owner.job
|
|
213
|
+
|| value.attempt_id !== owner.attempt || value.lease_id !== owner.lease || value.operation_id !== owner.lease
|
|
214
|
+
|| value.manifest_sha256 !== inputs.manifestSha256 || value.configuration_digest !== owner.configurationDigest
|
|
215
|
+
|| value.provenance !== 'customer_device' || !record(value.control) || !record(value.target_phases)
|
|
216
|
+
|| !Array.isArray(value.model_channels) || !Array.isArray(value.real_channels))
|
|
217
|
+
throw invalid();
|
|
218
|
+
const issued = Date.parse(String(value.issued_at)), expires = Date.parse(String(value.lease_expires_at)), deadline = Date.parse(String(value.job_deadline_at));
|
|
219
|
+
if (![issued, expires, deadline].every(Number.isSafeInteger) || expires <= issued || deadline <= issued)
|
|
220
|
+
throw invalid();
|
|
221
|
+
const control = value.control;
|
|
222
|
+
if (!Array.isArray(control.secret_variable_names)
|
|
223
|
+
|| control.secret_variable_names.some(name => typeof name !== 'string' || !VARIABLE.test(name))
|
|
224
|
+
|| new Set(control.secret_variable_names).size !== control.secret_variable_names.length)
|
|
225
|
+
throw invalid();
|
|
226
|
+
const entry = (part) => inputs.manifest.entries.find(item => item.part === part);
|
|
227
|
+
if (control.job_id !== owner.job || control.operation_id !== owner.lease || control.source_sha256 !== entry('source')?.sha256
|
|
228
|
+
|| typeof control.engine_source_digest !== 'string'
|
|
229
|
+
|| !HASH.test(control.engine_source_digest) || control.cpu_units !== owner.limits.cpu_units || control.memory_mb !== owner.limits.memory_mb
|
|
230
|
+
|| !Number.isSafeInteger(control.budget_seconds) || Number(control.budget_seconds) < 1
|
|
231
|
+
|| Number(control.budget_seconds) > Math.floor((deadline - issued) / 1000) + 1
|
|
232
|
+
|| !record(control.package_inputs) || control.package_inputs.profile !== 'public-locked-packages'
|
|
233
|
+
|| control.package_inputs.sha256 !== entry('packages')?.sha256 || !Number.isSafeInteger(control.package_inputs.max_bytes)
|
|
234
|
+
|| Number(control.package_inputs.max_bytes) < (entry('packages')?.size ?? Infinity)
|
|
235
|
+
|| !record(control.dependency_bindings)
|
|
236
|
+
|| control.dependency_bindings.schema !== 'firedrill.native-binding-policy.v1' || control.dependency_bindings.world_id !== owner.world
|
|
237
|
+
|| control.dependency_bindings.configuration_digest !== owner.configurationDigest)
|
|
238
|
+
throw invalid();
|
|
239
|
+
if (!Array.isArray(control.dependency_bindings.dependencies))
|
|
240
|
+
throw invalid();
|
|
241
|
+
const hasCatalog = control.dependency_bindings.dependencies.some(choice => record(choice) && record(choice.policy) && choice.policy.catalog !== undefined && choice.policy.catalog !== null);
|
|
242
|
+
if (hasCatalog && owner.catalogPackagesToDevice !== true) {
|
|
243
|
+
throw new CliError('local_grant_consent_required', 'This device permission does not allow the selected private tool package download. Review local authorization before continuing.');
|
|
244
|
+
}
|
|
245
|
+
if (owner.purpose === 'validation' && hasCatalog) {
|
|
246
|
+
const input = control.catalog_inputs;
|
|
247
|
+
if (!record(input) || Object.keys(input).sort().join(',') !== 'sha256,size'
|
|
248
|
+
|| typeof input.sha256 !== 'string' || !HASH.test(input.sha256)
|
|
249
|
+
|| !Number.isSafeInteger(input.size) || Number(input.size) < 1 || Number(input.size) > 128 * 1024 ** 2)
|
|
250
|
+
throw invalid();
|
|
251
|
+
}
|
|
252
|
+
else if (control.catalog_inputs !== undefined)
|
|
253
|
+
throw invalid();
|
|
254
|
+
if (owner.purpose !== 'world_session' && (value.world_session !== undefined
|
|
255
|
+
|| control.source_snapshot_id !== owner.sourceSnapshot || control.source_revision !== owner.sourceRevision
|
|
256
|
+
|| !record(control.scenario_inputs) || control.scenario_inputs.sha256 !== entry('scenarios')?.sha256
|
|
257
|
+
|| control.scenario_inputs.size !== entry('scenarios')?.size || typeof control.scenario_inputs.selection_sha256 !== 'string'
|
|
258
|
+
|| !HASH.test(control.scenario_inputs.selection_sha256)))
|
|
259
|
+
throw invalid();
|
|
260
|
+
if (owner.purpose === 'world_session') {
|
|
261
|
+
const packetFields = ['schema', 'actor_id', 'workspace_id', 'native_session_id', 'device_key', 'request_key', 'job_id', 'attempt_id', 'lease_id', 'operation_id', 'manifest_sha256', 'configuration_digest',
|
|
262
|
+
'provenance', 'issued_at', 'lease_expires_at', 'job_deadline_at', 'control', 'target_phases', 'model_channels',
|
|
263
|
+
'real_channels', 'participant_channel', 'voice_channels', 'world_session', 'local_values'];
|
|
264
|
+
const fields = ['schema', 'purpose', 'operation_id', 'job_id', 'session_id', 'world_id', 'configuration_id', 'configuration_digest',
|
|
265
|
+
'source_sha256', 'engine_source_digest', 'validation_sha256', 'bundle_digest', 'retained_scenario_selection_sha256', 'validation_scope',
|
|
266
|
+
'dependency_bindings', 'package_inputs', 'target_model_channels', 'secret_variable_names', 'budget_seconds', 'expires_at',
|
|
267
|
+
'network_policy', 'cpu_units', 'memory_mb', 'state_observation_max_bytes', 'evidence_context_sha256', 'initial_checkpoint', 'dataset', 'dataset_transfer', 'application_checkpoint'];
|
|
268
|
+
const real = control.validation_scope === 'target_startup_only';
|
|
269
|
+
if (real)
|
|
270
|
+
fields.push('startup_authorization_sha256', 'external_effects_sha256');
|
|
271
|
+
if (Object.keys(value).sort().join(',') !== packetFields.sort().join(',')
|
|
272
|
+
|| Object.keys(control).sort().join(',') !== fields.sort().join(',') || !record(value.world_session)
|
|
273
|
+
|| canonical(value.world_session) !== canonical(owner.session)
|
|
274
|
+
|| control.schema !== 'firedrill.world-session.v1' || control.purpose !== 'world_inspection_session'
|
|
275
|
+
|| control.session_id !== owner.session.session_id || control.configuration_id !== owner.session.configuration_id
|
|
276
|
+
|| control.world_id !== owner.world || control.configuration_digest !== owner.configurationDigest
|
|
277
|
+
|| control.dependency_bindings.configuration_id !== owner.session.configuration_id
|
|
278
|
+
|| control.expires_at !== owner.session.expires_at || Date.parse(owner.session.expires_at) !== deadline
|
|
279
|
+
|| typeof owner.session.input_sha256 !== 'string' || !HASH.test(owner.session.input_sha256)
|
|
280
|
+
|| control.validation_sha256 !== entry('compiled')?.sha256
|
|
281
|
+
|| typeof control.bundle_digest !== 'string' || !/^sha256:[a-f0-9]{64}$/.test(control.bundle_digest)
|
|
282
|
+
|| typeof control.retained_scenario_selection_sha256 !== 'string' || !HASH.test(control.retained_scenario_selection_sha256)
|
|
283
|
+
|| typeof control.evidence_context_sha256 !== 'string' || !HASH.test(control.evidence_context_sha256)
|
|
284
|
+
|| !Number.isSafeInteger(control.state_observation_max_bytes) || Number(control.state_observation_max_bytes) < 1
|
|
285
|
+
|| Number(control.state_observation_max_bytes) > 512 * 1024 ** 2
|
|
286
|
+
|| !Array.isArray(control.secret_variable_names) || control.secret_variable_names.some(name => typeof name !== 'string' || !VARIABLE.test(name))
|
|
287
|
+
|| new Set(control.secret_variable_names).size !== control.secret_variable_names.length
|
|
288
|
+
|| value.participant_channel !== null
|
|
289
|
+
|| (real ? !value.real_channels.length || owner.realAccountAccess !== true
|
|
290
|
+
|| typeof control.startup_authorization_sha256 !== 'string' || !HASH.test(control.startup_authorization_sha256)
|
|
291
|
+
|| typeof control.external_effects_sha256 !== 'string' || !HASH.test(control.external_effects_sha256)
|
|
292
|
+
: control.validation_scope !== 'native_runtime_and_scenario_preconditions' || value.real_channels.length > 0
|
|
293
|
+
|| control.startup_authorization_sha256 !== undefined || control.external_effects_sha256 !== undefined))
|
|
294
|
+
throw invalid();
|
|
295
|
+
const checkpoint = control.initial_checkpoint, saved = entry('checkpoint');
|
|
296
|
+
const application = control.application_checkpoint, applicationFile = entry('application_checkpoint');
|
|
297
|
+
if (application === null ? !!applicationFile : !applicationStateReference(application) || !applicationFile
|
|
298
|
+
|| application.size !== applicationFile.size || application.sha256 !== applicationFile.sha256 || real)
|
|
299
|
+
throw invalid();
|
|
300
|
+
if (checkpoint === null) {
|
|
301
|
+
if (saved)
|
|
302
|
+
throw invalid();
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
if (!record(checkpoint) || Object.keys(checkpoint).sort().join(',') !== 'archive_id,checkpoint_id,checkpoint_session_id,clock_mode,generation,schema_sha256,scope,sha256,size'
|
|
306
|
+
|| control.dataset !== null || !saved || checkpoint.size !== saved.size || checkpoint.sha256 !== saved.sha256
|
|
307
|
+
|| !Number.isSafeInteger(checkpoint.size) || Number(checkpoint.size) < 1 || Number(checkpoint.size) > Number(control.state_observation_max_bytes)
|
|
308
|
+
|| typeof checkpoint.sha256 !== 'string' || !HASH.test(checkpoint.sha256)
|
|
309
|
+
|| typeof checkpoint.schema_sha256 !== 'string' || !HASH.test(checkpoint.schema_sha256) || typeof checkpoint.generation !== 'string'
|
|
310
|
+
|| !/^[1-9][0-9]{0,30}$/.test(checkpoint.generation) || typeof checkpoint.clock_mode !== 'string'
|
|
311
|
+
|| !['wall', 'not_configured'].includes(checkpoint.clock_mode)
|
|
312
|
+
|| typeof checkpoint.scope !== 'string' || !Object.hasOwn(checkpointResetBaselines, checkpoint.scope)
|
|
313
|
+
|| checkpoint.scope !== 'owned_postgres_rows_sequences_and_sql_clock' && checkpoint.clock_mode !== 'not_configured')
|
|
314
|
+
throw invalid();
|
|
315
|
+
for (const name of ['checkpoint_id', 'checkpoint_session_id', 'archive_id']) {
|
|
316
|
+
if (typeof checkpoint[name] !== 'string' || identifier(checkpoint[name]) !== checkpoint[name])
|
|
317
|
+
throw invalid();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
startingData(control, owner, inputs);
|
|
321
|
+
}
|
|
322
|
+
else if (owner.purpose === 'validation') {
|
|
323
|
+
if (control.schema !== 'firedrill.validation.v1' || control.purpose !== 'world_validation'
|
|
324
|
+
|| control.candidate_sha256 !== entry('candidate')?.sha256 || value.participant_channel !== null)
|
|
325
|
+
throw invalid();
|
|
326
|
+
const startup = control.validation_scope === 'target_startup_only';
|
|
327
|
+
if (startup ? !value.real_channels.length || owner.realAccountAccess !== true
|
|
328
|
+
|| typeof control.startup_authorization_sha256 !== 'string' || !HASH.test(control.startup_authorization_sha256)
|
|
329
|
+
: control.validation_scope !== undefined || control.startup_authorization_sha256 !== undefined || value.real_channels.length > 0)
|
|
330
|
+
throw invalid();
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
if (owner.purpose !== 'trial' || control.schema !== 'firedrill.trial.v1' || control.purpose !== 'simulation_trial'
|
|
334
|
+
|| control.world_continuity !== undefined && control.world_continuity !== null && control.world_continuity !== 'continuous'
|
|
335
|
+
|| !Number.isSafeInteger(control.trial_seconds) || Number(control.trial_seconds) < 1 || Number(control.trial_seconds) > 2147483647
|
|
336
|
+
|| control.job_deadline_at !== value.job_deadline_at || deadline <= Date.now()
|
|
337
|
+
|| typeof control.invocation_mode !== 'string' || !['conversation', 'single_request', 'browser_chat', 'voice'].includes(control.invocation_mode)
|
|
338
|
+
|| control.validation_sha256 !== entry('compiled')?.sha256 || control.scenario_count !== 1
|
|
339
|
+
|| !Number.isSafeInteger(control.attempt_number) || Number(control.attempt_number) < 1
|
|
340
|
+
|| typeof control.execution_id !== 'string' || identifier(control.execution_id) !== control.execution_id
|
|
341
|
+
|| typeof control.execution_inputs_sha256 !== 'string' || !HASH.test(control.execution_inputs_sha256)
|
|
342
|
+
|| typeof control.scenario_key !== 'string' || !control.scenario_key.length || control.scenario_key.length > 255
|
|
343
|
+
|| typeof control.bundle_digest !== 'string' || !/^sha256:[a-f0-9]{64}$/.test(control.bundle_digest))
|
|
344
|
+
throw invalid();
|
|
345
|
+
const driver = control.execution_driver;
|
|
346
|
+
if (driver !== null && !executionDriverMatches(driver)
|
|
347
|
+
|| !executionAuthorityMatches(control.execution_authority, driver)
|
|
348
|
+
|| (driver === null ? control.execution_basis !== null
|
|
349
|
+
: !driverBasisMatches(control.execution_basis) || canonical(control.execution_basis) !== canonical(driver.basis))
|
|
350
|
+
|| driver?.requires_input && value.real_channels.length > 0)
|
|
351
|
+
throw invalid();
|
|
352
|
+
startingData(control, owner, inputs);
|
|
353
|
+
const capture = control.browser_capture;
|
|
354
|
+
const audio = control.voice_capture;
|
|
355
|
+
const desktop = control.desktop_session, desktopCapture = control.desktop_capture;
|
|
356
|
+
if (desktop !== null && (!record(desktop) || Object.keys(desktop).sort().join(',') !== 'capability,height,kind,redactions,width'
|
|
357
|
+
|| desktop.kind !== 'rfb_3_8' || typeof desktop.capability !== 'string' || !/^[a-z0-9][a-z0-9_-]{0,127}$/.test(desktop.capability)
|
|
358
|
+
|| !Number.isSafeInteger(desktop.width) || Number(desktop.width) < 320 || Number(desktop.width) > 1920
|
|
359
|
+
|| !Number.isSafeInteger(desktop.height) || Number(desktop.height) < 240 || Number(desktop.height) > 1080
|
|
360
|
+
|| !Array.isArray(desktop.redactions) || desktop.redactions.length > 128
|
|
361
|
+
|| desktop.redactions.some(rect => !record(rect) || Object.keys(rect).sort().join(',') !== 'height,width,x,y'
|
|
362
|
+
|| !['x', 'y', 'width', 'height'].every(key => Number.isSafeInteger(rect[key]))
|
|
363
|
+
|| Number(rect.x) < 0 || Number(rect.y) < 0 || Number(rect.width) < 1 || Number(rect.height) < 1
|
|
364
|
+
|| Number(rect.x) + Number(rect.width) > Number(desktop.width) || Number(rect.y) + Number(rect.height) > Number(desktop.height))))
|
|
365
|
+
throw invalid();
|
|
366
|
+
if (!record(desktopCapture) || Object.keys(desktopCapture).sort().join(',') !== 'acknowledge_screen_content,enabled,interval_ms,mask,schema,scope'
|
|
367
|
+
|| desktopCapture.schema !== 'firedrill.desktop-visual-policy.v1' || typeof desktopCapture.enabled !== 'boolean'
|
|
368
|
+
|| desktopCapture.acknowledge_screen_content !== desktopCapture.enabled || desktopCapture.scope !== 'private_synthetic_world'
|
|
369
|
+
|| desktopCapture.mask !== 'declared-regions-and-text-audit.v1' || desktopCapture.interval_ms !== 2000
|
|
370
|
+
|| desktopCapture.enabled && (desktop === null || value.real_channels.length > 0 || control.invocation_mode === 'browser_chat'
|
|
371
|
+
|| !record(capture) || capture.enabled !== false))
|
|
372
|
+
throw invalid();
|
|
373
|
+
const voice = control.invocation_mode === 'voice';
|
|
374
|
+
if (voice) {
|
|
375
|
+
voiceSession(control.voice_session);
|
|
376
|
+
if (!Number.isSafeInteger(control.voice_seconds) || Number(control.voice_seconds) < 1 || Number(control.voice_seconds) > 2147483647
|
|
377
|
+
|| control.voice_seconds !== control.trial_seconds
|
|
378
|
+
|| Number(control.voice_seconds) + 90 > Number(control.budget_seconds) || value.real_channels.length > 0)
|
|
379
|
+
throw invalid();
|
|
380
|
+
}
|
|
381
|
+
else if (control.voice_session !== undefined || control.voice_seconds !== undefined)
|
|
382
|
+
throw invalid();
|
|
383
|
+
if (!record(audio) || Object.keys(audio).sort().join(',') !== 'enabled,redaction,schema,scope'
|
|
384
|
+
|| audio.schema !== 'firedrill.voice-capture-policy.v1' || typeof audio.enabled !== 'boolean'
|
|
385
|
+
|| audio.enabled && (!voice || value.real_channels.length > 0)
|
|
386
|
+
|| audio.scope !== 'private_synthetic_room' || audio.redaction !== 'none')
|
|
387
|
+
throw invalid();
|
|
388
|
+
const session = control.browser_session;
|
|
389
|
+
if (session !== null && (!record(session) || Object.keys(session).sort().join(',') !== 'capability,height,kind,width'
|
|
390
|
+
|| session.kind !== 'chromium_cdp' || typeof session.capability !== 'string'
|
|
391
|
+
|| !/^[a-z0-9][a-z0-9_-]{0,127}$/.test(session.capability)
|
|
392
|
+
|| !Number.isSafeInteger(session.width) || Number(session.width) < 320 || Number(session.width) > 1920
|
|
393
|
+
|| !Number.isSafeInteger(session.height) || Number(session.height) < 240 || Number(session.height) > 1080
|
|
394
|
+
|| control.invocation_mode === 'browser_chat'))
|
|
395
|
+
throw invalid();
|
|
396
|
+
if (!record(capture) || Object.keys(capture).sort().join(',') !== 'enabled,interval_ms,mask,mask_form_values,schema'
|
|
397
|
+
|| capture.schema !== 'firedrill.browser-visual-policy.v2' || typeof capture.enabled !== 'boolean'
|
|
398
|
+
|| typeof capture.mask_form_values !== 'boolean'
|
|
399
|
+
|| capture.mask !== (capture.mask_form_values ? 'form-values-and-sensitive-opaque-dom.v1' : 'sensitive-and-opaque-dom.v1') || capture.interval_ms !== 2000
|
|
400
|
+
|| capture.enabled && (control.invocation_mode !== 'browser_chat' && session === null
|
|
401
|
+
&& !['browser_workflow', 'adaptive_browser'].includes(driver?.kind ?? '') || value.real_channels.length > 0))
|
|
402
|
+
throw invalid();
|
|
403
|
+
const startup = control.validation_scope === 'target_startup_only';
|
|
404
|
+
const continuation = control.application_continuation, applicationFile = entry('application_checkpoint'), nativeFile = entry('checkpoint');
|
|
405
|
+
if (continuation === null) {
|
|
406
|
+
if (applicationFile || nativeFile)
|
|
407
|
+
throw invalid();
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
const paired = record(continuation) && continuation.schema === 'firedrill.application-continuation.v2';
|
|
411
|
+
if (!record(continuation) || Object.keys(continuation).sort().join(',') !== (paired
|
|
412
|
+
? 'acknowledged,barrier,checkpoint,dependencies,schema,world_checkpoint' : 'acknowledged,checkpoint,dependencies,schema')
|
|
413
|
+
|| continuation.schema !== (paired ? 'firedrill.application-continuation.v2' : 'firedrill.application-continuation.v1')
|
|
414
|
+
|| continuation.dependencies !== (paired ? 'coordinated_native_checkpoint' : 'fresh_prepared_state')
|
|
415
|
+
|| continuation.acknowledged !== true || !applicationStateReference(continuation.checkpoint) || !applicationFile
|
|
416
|
+
|| continuation.checkpoint.size !== applicationFile.size || continuation.checkpoint.sha256 !== applicationFile.sha256
|
|
417
|
+
|| control.dataset !== null || startup || value.real_channels.length > 0)
|
|
418
|
+
throw invalid();
|
|
419
|
+
if (paired) {
|
|
420
|
+
const native = continuation.world_checkpoint, barrier = continuation.barrier;
|
|
421
|
+
if (control.world_id !== owner.world || control.configuration_digest !== owner.configurationDigest
|
|
422
|
+
|| control.configuration_digest !== value.configuration_digest || typeof control.configuration_id !== 'string'
|
|
423
|
+
|| identifier(control.configuration_id) !== control.configuration_id || control.configuration_id !== control.dependency_bindings.configuration_id
|
|
424
|
+
|| !Number.isSafeInteger(control.state_observation_max_bytes) || Number(control.state_observation_max_bytes) < 1
|
|
425
|
+
|| Number(control.state_observation_max_bytes) > 512 * 1024 ** 2
|
|
426
|
+
|| !record(native) || Object.keys(native).sort().join(',') !== 'archive_id,checkpoint_id,checkpoint_session_id,clock_mode,generation,schema_sha256,scope,sha256,size'
|
|
427
|
+
|| !nativeFile || native.size !== nativeFile.size || native.sha256 !== nativeFile.sha256
|
|
428
|
+
|| !Number.isSafeInteger(native.size) || Number(native.size) < 1 || Number(native.size) > 512 * 1024 ** 2
|
|
429
|
+
|| Number(native.size) > Number(control.state_observation_max_bytes)
|
|
430
|
+
|| typeof native.sha256 !== 'string' || !HASH.test(native.sha256) || typeof native.schema_sha256 !== 'string' || !HASH.test(native.schema_sha256)
|
|
431
|
+
|| typeof native.generation !== 'string' || !/^[1-9][0-9]{0,30}$/.test(native.generation)
|
|
432
|
+
|| native.checkpoint_id !== continuation.checkpoint.checkpoint_id || native.checkpoint_session_id !== continuation.checkpoint.checkpoint_session_id
|
|
433
|
+
|| typeof native.archive_id !== 'string' || identifier(native.archive_id) !== native.archive_id
|
|
434
|
+
|| typeof native.scope !== 'string' || !Object.hasOwn(checkpointResetBaselines, native.scope)
|
|
435
|
+
|| !['wall', 'not_configured'].includes(String(native.clock_mode))
|
|
436
|
+
|| native.scope !== 'owned_postgres_rows_sequences_and_sql_clock' && native.clock_mode !== 'not_configured'
|
|
437
|
+
|| !record(barrier) || Object.keys(barrier).sort().join(',') !== 'event_watermark,request_id'
|
|
438
|
+
|| barrier.request_id !== native.checkpoint_id || barrier.event_watermark !== continuation.checkpoint.event_watermark)
|
|
439
|
+
throw invalid();
|
|
440
|
+
}
|
|
441
|
+
else if (nativeFile)
|
|
442
|
+
throw invalid();
|
|
443
|
+
}
|
|
444
|
+
if (typeof control.retained_scenario_selection_sha256 !== 'string' || !HASH.test(control.retained_scenario_selection_sha256)
|
|
445
|
+
|| (startup ? !value.real_channels.length || owner.realAccountAccess !== true
|
|
446
|
+
|| typeof control.startup_authorization_sha256 !== 'string' || !HASH.test(control.startup_authorization_sha256)
|
|
447
|
+
|| typeof control.external_effects_sha256 !== 'string' || !HASH.test(control.external_effects_sha256)
|
|
448
|
+
: control.validation_scope !== 'native_runtime_and_scenario_preconditions' || value.real_channels.length > 0
|
|
449
|
+
|| control.startup_authorization_sha256 !== undefined || control.external_effects_sha256 !== undefined))
|
|
450
|
+
throw invalid();
|
|
451
|
+
const participant = value.participant_channel;
|
|
452
|
+
if (control.invocation_mode === 'single_request' && !driver?.uses_participant_model || voice) {
|
|
453
|
+
if (participant !== null)
|
|
454
|
+
throw invalid();
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
if (!record(participant) || Object.keys(participant).sort().join(',') !== 'endpoint,model,role,token'
|
|
458
|
+
|| participant.role !== 'participant' || typeof participant.model !== 'string'
|
|
459
|
+
|| !/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(participant.model)
|
|
460
|
+
|| typeof participant.token !== 'string' || !/^[A-Za-z0-9_-]{32,256}$/.test(participant.token)
|
|
461
|
+
|| typeof participant.endpoint !== 'string')
|
|
462
|
+
throw invalid();
|
|
463
|
+
const endpoint = new URL(participant.endpoint);
|
|
464
|
+
if (endpoint.origin !== API_ORIGIN || endpoint.username || endpoint.password || endpoint.search || endpoint.hash
|
|
465
|
+
|| !/^\/api\/internal\/model\/[a-f0-9-]{36}$/.test(endpoint.pathname))
|
|
466
|
+
throw invalid();
|
|
467
|
+
identifier(endpoint.pathname.split('/').at(-1));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
voiceChannels(value.voice_channels, owner.purpose === 'trial' && control.invocation_mode === 'voice');
|
|
471
|
+
if (value.target_phases.schema !== 'firedrill.target-phases.v1'
|
|
472
|
+
|| Object.keys(value.target_phases).sort().join(',') !== 'build,runtime,schema')
|
|
473
|
+
throw invalid();
|
|
474
|
+
for (const phase of ['build', 'runtime']) {
|
|
475
|
+
const values = value.target_phases[phase];
|
|
476
|
+
if (!record(values) || Object.entries(values).some(([name, item]) => !VARIABLE.test(name)
|
|
477
|
+
|| typeof item !== 'string' || item.includes('\0') || Buffer.byteLength(item) > 65536))
|
|
478
|
+
throw invalid();
|
|
479
|
+
}
|
|
480
|
+
const bindings = new Set(), variables = new Set();
|
|
481
|
+
const projected = [];
|
|
482
|
+
for (const item of value.model_channels) {
|
|
483
|
+
if (!record(item) || typeof item.binding_id !== 'string' || identifier(item.binding_id) !== item.binding_id || bindings.has(item.binding_id)
|
|
484
|
+
|| !['anthropic', 'openai'].includes(String(item.provider)) || !Array.isArray(item.models) || !item.models.length
|
|
485
|
+
|| item.models.some(model => typeof model !== 'string' || !model.length || model.length > 256 || /[\x00-\x1f\x7f]/.test(model))
|
|
486
|
+
|| typeof item.key_variable !== 'string' || !VARIABLE.test(item.key_variable)
|
|
487
|
+
|| typeof item.base_url_variable !== 'string' || !VARIABLE.test(item.base_url_variable) || item.key_variable === item.base_url_variable
|
|
488
|
+
|| typeof item.token !== 'string' || !/^[A-Za-z0-9_-]{32,256}$/.test(item.token)
|
|
489
|
+
|| typeof item.endpoint !== 'string' || !Array.isArray(item.phases) || !item.phases.length
|
|
490
|
+
|| item.phases.some(phase => phase !== 'build' && phase !== 'runtime') || new Set(item.phases).size !== item.phases.length)
|
|
491
|
+
throw invalid();
|
|
492
|
+
if (variables.has(item.key_variable) || variables.has(item.base_url_variable))
|
|
493
|
+
throw invalid();
|
|
494
|
+
variables.add(item.key_variable);
|
|
495
|
+
variables.add(item.base_url_variable);
|
|
496
|
+
const endpoint = new URL(item.endpoint);
|
|
497
|
+
if (endpoint.origin !== API_ORIGIN || endpoint.username || endpoint.password || endpoint.search || endpoint.hash
|
|
498
|
+
|| !/^\/api\/internal\/target-model\/[a-f0-9-]{36}$/.test(endpoint.pathname))
|
|
499
|
+
throw invalid();
|
|
500
|
+
identifier(endpoint.pathname.split('/').at(-1));
|
|
501
|
+
for (const phase of item.phases) {
|
|
502
|
+
const values = value.target_phases[phase];
|
|
503
|
+
if (values[item.key_variable] !== item.token || Object.hasOwn(values, item.base_url_variable))
|
|
504
|
+
throw invalid();
|
|
505
|
+
}
|
|
506
|
+
bindings.add(item.binding_id);
|
|
507
|
+
projected.push(Object.fromEntries(Object.entries(item).filter(([key]) => key !== 'endpoint' && key !== 'token')));
|
|
508
|
+
}
|
|
509
|
+
validateRealChannels(value, owner, variables);
|
|
510
|
+
if (canonical(control.target_model_channels) !== canonical(projected)
|
|
511
|
+
|| control.network_policy !== (owner.purpose === 'world_session' ? 'isolated_world_session' : owner.purpose === 'trial' ? 'managed_trial'
|
|
512
|
+
: control.validation_scope === 'target_startup_only' ? 'scoped_real_startup'
|
|
513
|
+
: bindings.size ? 'scoped_model_native_preconditions' : 'offline_native_preconditions'))
|
|
514
|
+
throw invalid();
|
|
515
|
+
}
|
|
516
|
+
/** Transient private input for the selected executor. Never print or journal. */
|
|
517
|
+
export async function receiveRuntimeConfiguration(owner, inputs, signal) {
|
|
518
|
+
const prefix = `/api/workspaces/${identifier(owner.workspace)}/local-runners/${identifier(owner.device)}/jobs/${identifier(owner.job)}/claims/${identifier(owner.request)}`;
|
|
519
|
+
const auth = { actor: owner.owner, workspace: owner.workspace, signal };
|
|
520
|
+
if (createHash('sha256').update(canonical(inputs.manifest)).digest('hex') !== inputs.manifestSha256)
|
|
521
|
+
throw invalid();
|
|
522
|
+
const receipt = await readLocalClaim({ owner: owner.owner, workspace: owner.workspace, world: owner.world }, owner.device, owner.job, owner.request, signal);
|
|
523
|
+
if (receipt.job_id !== owner.job || receipt.grant_id !== owner.grant || receipt.device_key !== owner.device || receipt.native_session_id !== owner.nativeSession
|
|
524
|
+
|| receipt.purpose !== owner.purpose || (owner.purpose === 'world_session'
|
|
525
|
+
? canonical(receipt.world_session) !== canonical(owner.session) : receipt.world_session !== undefined)
|
|
526
|
+
|| receipt.payload_digest !== owner.payloadDigest || receipt.claim?.id !== owner.lease
|
|
527
|
+
|| receipt.claim.request_key !== owner.request || receipt.claim.attempt_id !== owner.attempt || receipt.claim.state !== 'claimed')
|
|
528
|
+
throw invalid();
|
|
529
|
+
const sent = Date.parse(receipt.server_time);
|
|
530
|
+
if (!Number.isSafeInteger(sent) || Date.parse(receipt.claim.expires_at) <= sent)
|
|
531
|
+
throw invalid();
|
|
532
|
+
const payload = { schema: 'firedrill.local-runtime-read.v1', request_key: owner.request,
|
|
533
|
+
job_id: owner.job, device_key: owner.device, native_session_id: owner.nativeSession, lease_id: owner.lease,
|
|
534
|
+
manifest_sha256: inputs.manifestSha256, read_key: randomUUID(), sent_at_ms: sent };
|
|
535
|
+
const signed = await signRunnerRequest(owner, owner.device, payload, signal);
|
|
536
|
+
const value = await api(prefix + '/runtime-configuration', { ...auth, method: 'POST', body: signed });
|
|
537
|
+
try {
|
|
538
|
+
validate(value, owner, inputs);
|
|
539
|
+
await resolveLocalValues(owner, value.local_values, value.target_phases, value.control.secret_variable_names);
|
|
540
|
+
return value;
|
|
541
|
+
}
|
|
542
|
+
catch {
|
|
543
|
+
clearRuntimeConfiguration(value);
|
|
544
|
+
throw invalid();
|
|
545
|
+
}
|
|
546
|
+
}
|