spawnfile 0.1.13 → 0.1.14
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 +50 -11
- package/dist/audit/auditCli.d.ts +19 -0
- package/dist/audit/auditCli.js +63 -0
- package/dist/audit/checks.d.ts +100 -0
- package/dist/audit/checks.js +279 -0
- package/dist/audit/checksShared.d.ts +74 -0
- package/dist/audit/checksShared.js +37 -0
- package/dist/audit/generateAudit.d.ts +19 -0
- package/dist/audit/generateAudit.js +122 -0
- package/dist/audit/index.d.ts +4 -0
- package/dist/audit/index.js +4 -0
- package/dist/audit/readAudit.d.ts +50 -0
- package/dist/audit/readAudit.js +59 -0
- package/dist/audit/types.d.ts +40 -0
- package/dist/audit/types.js +8 -0
- package/dist/auth/credentialEnvFile.d.ts +11 -0
- package/dist/auth/credentialEnvFile.js +60 -0
- package/dist/auth/credentialProvisioning.d.ts +15 -0
- package/dist/auth/credentialProvisioning.js +75 -0
- package/dist/auth/credentialProvisioningReceipt.d.ts +28 -0
- package/dist/auth/credentialProvisioningReceipt.js +70 -0
- package/dist/auth/credentialProvisioningRequest.d.ts +51 -0
- package/dist/auth/credentialProvisioningRequest.js +169 -0
- package/dist/auth/credentialWorldBindings.d.ts +21 -0
- package/dist/auth/credentialWorldBindings.js +104 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/paths.d.ts +11 -0
- package/dist/auth/paths.js +21 -0
- package/dist/auth/targetSecretSourceAuthor.d.ts +18 -0
- package/dist/auth/targetSecretSourceAuthor.js +52 -0
- package/dist/auth/targetSecretSourceFsPublish.d.ts +15 -0
- package/dist/auth/targetSecretSourceFsPublish.js +49 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.d.ts +16 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.js +435 -0
- package/dist/auth/targetSecretSourceFsRead.d.ts +14 -0
- package/dist/auth/targetSecretSourceFsRead.js +198 -0
- package/dist/auth/targetSecretSourceGrant.d.ts +16 -0
- package/dist/auth/targetSecretSourceGrant.js +99 -0
- package/dist/auth/targetSecretSourceGrantRecords.d.ts +84 -0
- package/dist/auth/targetSecretSourceGrantRecords.js +214 -0
- package/dist/auth/targetSecretSourceLifecycle.d.ts +30 -0
- package/dist/auth/targetSecretSourceLifecycle.js +52 -0
- package/dist/auth/targetSecretSourceOwnerEntropy.d.ts +6 -0
- package/dist/auth/targetSecretSourceOwnerEntropy.js +28 -0
- package/dist/auth/targetSecretSourceRecordCommon.d.ts +14 -0
- package/dist/auth/targetSecretSourceRecordCommon.js +100 -0
- package/dist/auth/targetSecretSourceRecordPublish.d.ts +10 -0
- package/dist/auth/targetSecretSourceRecordPublish.js +104 -0
- package/dist/auth/targetSecretSourceResolver.d.ts +10 -0
- package/dist/auth/targetSecretSourceResolver.js +137 -0
- package/dist/auth/targetSecretSourceRevoke.d.ts +20 -0
- package/dist/auth/targetSecretSourceRevoke.js +92 -0
- package/dist/auth/targetSecretSourceRotate.d.ts +19 -0
- package/dist/auth/targetSecretSourceRotate.js +121 -0
- package/dist/auth/targetSecretSourceVersionRecords.d.ts +49 -0
- package/dist/auth/targetSecretSourceVersionRecords.js +166 -0
- package/dist/cli/artifactsCommands.d.ts +27 -0
- package/dist/cli/artifactsCommands.js +132 -0
- package/dist/cli/authCommands.d.ts +5 -0
- package/dist/cli/authCommands.js +221 -0
- package/dist/cli/compileBuildCommands.d.ts +3 -0
- package/dist/cli/compileBuildCommands.js +35 -0
- package/dist/cli/containerBundleCommand.d.ts +6 -0
- package/dist/cli/containerBundleCommand.js +116 -0
- package/dist/cli/downCommand.d.ts +25 -0
- package/dist/cli/downCommand.js +134 -0
- package/dist/cli/index.js +6 -3
- package/dist/cli/lifecycleCommands.d.ts +1 -1
- package/dist/cli/lifecycleCommands.js +11 -181
- package/dist/cli/lifecycleMachine.d.ts +19 -0
- package/dist/cli/lifecycleMachine.js +78 -0
- package/dist/cli/lifecyclePlan.d.ts +35 -0
- package/dist/cli/lifecyclePlan.js +240 -0
- package/dist/cli/lifecyclePlanningCommands.d.ts +3 -0
- package/dist/cli/lifecyclePlanningCommands.js +30 -0
- package/dist/cli/runCli.d.ts +9 -2
- package/dist/cli/runCli.js +27 -71
- package/dist/cli/runPublishCommands.d.ts +3 -0
- package/dist/cli/runPublishCommands.js +70 -0
- package/dist/cli/statusCommand.d.ts +3 -33
- package/dist/cli/statusCommand.js +19 -249
- package/dist/cli/statusCommandLive.d.ts +20 -0
- package/dist/cli/statusCommandLive.js +188 -0
- package/dist/cli/statusCommandOptions.d.ts +40 -0
- package/dist/cli/statusCommandOptions.js +42 -0
- package/dist/cli/targetCliRoute.d.ts +2 -0
- package/dist/cli/targetCliRoute.js +30 -0
- package/dist/cli/targetCommands.d.ts +33 -0
- package/dist/cli/targetCommands.js +257 -0
- package/dist/cli/targetComposedPreparationCommand.d.ts +6 -0
- package/dist/cli/targetComposedPreparationCommand.js +39 -0
- package/dist/cli/targetDefaultArtifactAuthority.d.ts +5 -0
- package/dist/cli/targetDefaultArtifactAuthority.js +28 -0
- package/dist/cli/targetDefaultAuthorities.d.ts +53 -0
- package/dist/cli/targetDefaultAuthorities.js +210 -0
- package/dist/cli/targetDefaultConfig.d.ts +68 -0
- package/dist/cli/targetDefaultConfig.js +317 -0
- package/dist/cli/targetDefaultConfigStdin.d.ts +13 -0
- package/dist/cli/targetDefaultConfigStdin.js +215 -0
- package/dist/cli/targetDefaultEnvelope.d.ts +1 -0
- package/dist/cli/targetDefaultEnvelope.js +13 -0
- package/dist/cli/targetDefaultHandlerFactory.d.ts +28 -0
- package/dist/cli/targetDefaultHandlerFactory.js +247 -0
- package/dist/cli/targetDefaultHandlers.d.ts +21 -0
- package/dist/cli/targetDefaultHandlers.js +72 -0
- package/dist/cli/targetDefaultJournalAuthority.d.ts +35 -0
- package/dist/cli/targetDefaultJournalAuthority.js +135 -0
- package/dist/cli/targetDefaultWorldClock.d.ts +4 -0
- package/dist/cli/targetDefaultWorldClock.js +14 -0
- package/dist/cli/targetDefaultWorldQueries.d.ts +5 -0
- package/dist/cli/targetDefaultWorldQueries.js +11 -0
- package/dist/cli/targetDefaultWorldReadiness.d.ts +4 -0
- package/dist/cli/targetDefaultWorldReadiness.js +17 -0
- package/dist/cli/targetEvidenceHelperResolution.d.ts +14 -0
- package/dist/cli/targetEvidenceHelperResolution.js +23 -0
- package/dist/cli/targetLookupCli.d.ts +3 -0
- package/dist/cli/targetLookupCli.js +31 -0
- package/dist/cli/targetLookupCommands.d.ts +12 -0
- package/dist/cli/targetLookupCommands.js +69 -0
- package/dist/cli/targetOperationDispatch.d.ts +58 -0
- package/dist/cli/targetOperationDispatch.js +21 -0
- package/dist/cli/targetReceiptOutput.d.ts +14 -0
- package/dist/cli/targetReceiptOutput.js +21 -0
- package/dist/cli/targetRequestFile.d.ts +14 -0
- package/dist/cli/targetRequestFile.js +63 -0
- package/dist/cli/targetSecretSourceInput.d.ts +28 -0
- package/dist/cli/targetSecretSourceInput.js +121 -0
- package/dist/cli/targetWorldClockCommand.d.ts +10 -0
- package/dist/cli/targetWorldClockCommand.js +42 -0
- package/dist/cli/targetWorldClockCrossProcess.test-helper.d.ts +13 -0
- package/dist/cli/targetWorldClockCrossProcess.test-helper.js +109 -0
- package/dist/cli/targetWorldReadinessCommand.d.ts +10 -0
- package/dist/cli/targetWorldReadinessCommand.js +43 -0
- package/dist/cli/upCommand.d.ts +3 -0
- package/dist/cli/upCommand.js +133 -0
- package/dist/cli/upImageCommand.d.ts +11 -0
- package/dist/cli/upImageCommand.js +41 -0
- package/dist/cli/upLifecycleInvocation.d.ts +41 -0
- package/dist/cli/upLifecycleInvocation.js +48 -0
- package/dist/cli/upLifecycleRecovery.d.ts +4 -0
- package/dist/cli/upLifecycleRecovery.js +53 -0
- package/dist/compiler/agentNodeMerge.d.ts +2 -0
- package/dist/compiler/agentNodeMerge.js +79 -0
- package/dist/compiler/agentSurfaces.js +11 -1
- package/dist/compiler/buildCompilePlan.js +17 -0
- package/dist/compiler/buildCompilePlanAgent.d.ts +11 -0
- package/dist/compiler/buildCompilePlanAgent.js +56 -0
- package/dist/compiler/buildCompilePlanTeams.d.ts +1 -0
- package/dist/compiler/buildCompilePlanTeams.js +4 -1
- package/dist/compiler/buildCompilePlanTraversal.js +75 -82
- package/dist/compiler/buildProject.d.ts +11 -0
- package/dist/compiler/buildProject.js +77 -2
- package/dist/compiler/compilePlanHelpers.js +2 -0
- package/dist/compiler/compileProject.d.ts +13 -0
- package/dist/compiler/compileProject.js +26 -74
- package/dist/compiler/compileProjectPolicy.d.ts +5 -0
- package/dist/compiler/compileProjectPolicy.js +21 -0
- package/dist/compiler/compileProjectReports.d.ts +9 -0
- package/dist/compiler/compileProjectReports.js +52 -0
- package/dist/compiler/containerArtifactSummaries.d.ts +7 -0
- package/dist/compiler/containerArtifactSummaries.js +138 -0
- package/dist/compiler/containerArtifacts.d.ts +10 -0
- package/dist/compiler/containerArtifacts.js +126 -125
- package/dist/compiler/containerArtifactsPlans.d.ts +5 -3
- package/dist/compiler/containerArtifactsPlans.js +31 -118
- package/dist/compiler/containerArtifactsRender.d.ts +3 -1
- package/dist/compiler/containerArtifactsRender.js +15 -12
- package/dist/compiler/containerArtifactsTypes.d.ts +12 -0
- package/dist/compiler/containerConfigEnvRender.d.ts +3 -0
- package/dist/compiler/containerConfigEnvRender.js +54 -0
- package/dist/compiler/containerEntrypointRender.d.ts +1 -0
- package/dist/compiler/containerEntrypointRender.js +56 -52
- package/dist/compiler/containerEntrypointShell.d.ts +5 -0
- package/dist/compiler/containerEntrypointShell.js +29 -0
- package/dist/compiler/containerPackageOverrides.d.ts +27 -0
- package/dist/compiler/containerPackageOverrides.js +63 -0
- package/dist/compiler/containerTargetPlanResolution.d.ts +20 -0
- package/dist/compiler/containerTargetPlanResolution.js +97 -0
- package/dist/compiler/daimonTelemetryArtifacts.d.ts +22 -0
- package/dist/compiler/daimonTelemetryArtifacts.js +61 -0
- package/dist/compiler/dockerBuildContext.d.ts +16 -0
- package/dist/compiler/dockerBuildContext.js +159 -0
- package/dist/compiler/dockerBuildSkip.d.ts +30 -0
- package/dist/compiler/dockerBuildSkip.js +81 -0
- package/dist/compiler/index.d.ts +4 -0
- package/dist/compiler/index.js +4 -0
- package/dist/compiler/memoryArtifacts.d.ts +26 -0
- package/dist/compiler/memoryArtifacts.js +134 -0
- package/dist/compiler/memoryResolution.d.ts +4 -0
- package/dist/compiler/memoryResolution.js +147 -0
- package/dist/compiler/modelEnv.d.ts +2 -0
- package/dist/compiler/modelEnv.js +6 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.d.ts +2 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.js +42 -0
- package/dist/compiler/moltnetArtifactPaths.d.ts +26 -0
- package/dist/compiler/moltnetArtifactPaths.js +49 -0
- package/dist/compiler/moltnetArtifactTypes.d.ts +46 -0
- package/dist/compiler/moltnetArtifactTypes.js +1 -0
- package/dist/compiler/moltnetArtifacts.d.ts +2 -40
- package/dist/compiler/moltnetArtifacts.js +43 -97
- package/dist/compiler/moltnetBinaries.d.ts +21 -4
- package/dist/compiler/moltnetBinaries.js +134 -27
- package/dist/compiler/moltnetClientConfig.js +7 -2
- package/dist/compiler/moltnetConfigLowering.d.ts +16 -1
- package/dist/compiler/moltnetConfigLowering.js +67 -5
- package/dist/compiler/moltnetExternalParticipantArtifact.d.ts +38 -0
- package/dist/compiler/moltnetExternalParticipantArtifact.js +188 -0
- package/dist/compiler/moltnetNodeConfig.js +7 -2
- package/dist/compiler/moltnetReleaseAuthority.d.ts +17 -0
- package/dist/compiler/moltnetReleaseAuthority.js +73 -0
- package/dist/compiler/moltnetReleaseDownload.d.ts +12 -0
- package/dist/compiler/moltnetReleaseDownload.js +85 -0
- package/dist/compiler/moltnetRepresentativeResolution.d.ts +1 -0
- package/dist/compiler/moltnetRepresentativeResolution.js +16 -2
- package/dist/compiler/moltnetResolution.js +72 -20
- package/dist/compiler/moltnetRoomMemberships.js +37 -9
- package/dist/compiler/moltnetServerPlans.d.ts +9 -0
- package/dist/compiler/moltnetServerPlans.js +132 -0
- package/dist/compiler/organizationIdentity.d.ts +27 -0
- package/dist/compiler/organizationIdentity.js +297 -0
- package/dist/compiler/organizationReadyEvidence.d.ts +49 -0
- package/dist/compiler/organizationReadyEvidence.js +261 -0
- package/dist/compiler/projectManifestGraph.d.ts +4 -0
- package/dist/compiler/projectManifestGraph.js +24 -0
- package/dist/compiler/runProject.d.ts +4 -0
- package/dist/compiler/runProject.js +30 -21
- package/dist/compiler/runProjectAuth.d.ts +7 -1
- package/dist/compiler/runProjectAuth.js +87 -9
- package/dist/compiler/runProjectDocker.d.ts +7 -0
- package/dist/compiler/runProjectDocker.js +31 -8
- package/dist/compiler/runProjectLifecycle.d.ts +7 -0
- package/dist/compiler/runProjectLifecycle.js +40 -0
- package/dist/compiler/syncProjectAuth.js +4 -1
- package/dist/compiler/teamContextActiveEnvironments.d.ts +13 -0
- package/dist/compiler/teamContextActiveEnvironments.js +255 -0
- package/dist/compiler/teamContextSupport.js +32 -40
- package/dist/compiler/teamContextTypes.d.ts +2 -0
- package/dist/compiler/types.d.ts +82 -1
- package/dist/compiler/upProject.d.ts +5 -0
- package/dist/compiler/upProject.js +256 -20
- package/dist/compiler/upReceipt.d.ts +36 -0
- package/dist/compiler/upReceipt.js +82 -0
- package/dist/compiler/updateProjectModels.js +42 -60
- package/dist/compiler/updateProjectRuntime.js +22 -35
- package/dist/compiler/updateProjectSurfaces.js +53 -47
- package/dist/compiler/worldBindings.d.ts +39 -0
- package/dist/compiler/worldBindings.js +247 -0
- package/dist/compiler/worldBindingsFile.d.ts +5 -0
- package/dist/compiler/worldBindingsFile.js +162 -0
- package/dist/deployment/artifactsExport.d.ts +49 -0
- package/dist/deployment/artifactsExport.js +217 -0
- package/dist/deployment/artifactsExportDocker.d.ts +48 -0
- package/dist/deployment/artifactsExportDocker.js +91 -0
- package/dist/deployment/artifactsExportPlan.d.ts +24 -0
- package/dist/deployment/artifactsExportPlan.js +135 -0
- package/dist/deployment/artifactsExportTypes.d.ts +50 -0
- package/dist/deployment/artifactsExportTypes.js +52 -0
- package/dist/deployment/buildImageCacheStore.d.ts +23 -0
- package/dist/deployment/buildImageCacheStore.js +54 -0
- package/dist/deployment/deploymentLifecycleCorrelation.d.ts +11 -0
- package/dist/deployment/deploymentLifecycleCorrelation.js +33 -0
- package/dist/deployment/dockerInspect.d.ts +9 -0
- package/dist/deployment/dockerInspect.js +24 -1
- package/dist/deployment/dockerLabels.d.ts +2 -0
- package/dist/deployment/dockerLabels.js +2 -0
- package/dist/deployment/dockerLogs.js +2 -10
- package/dist/deployment/dockerManager.d.ts +51 -0
- package/dist/deployment/dockerManager.js +118 -1
- package/dist/deployment/dockerProbeGateway.js +64 -5
- package/dist/deployment/dockerRecover.js +9 -1
- package/dist/deployment/dockerTeardown.d.ts +32 -0
- package/dist/deployment/dockerTeardown.js +61 -0
- package/dist/deployment/downDeployment.d.ts +34 -0
- package/dist/deployment/downDeployment.js +147 -0
- package/dist/deployment/downReceiptTypes.d.ts +21 -0
- package/dist/deployment/downReceiptTypes.js +30 -0
- package/dist/deployment/index.d.ts +16 -0
- package/dist/deployment/index.js +17 -0
- package/dist/deployment/lifecycleCompletion.d.ts +37 -0
- package/dist/deployment/lifecycleCompletion.js +236 -0
- package/dist/deployment/lifecycleCompletionContracts.d.ts +158 -0
- package/dist/deployment/lifecycleCompletionContracts.js +106 -0
- package/dist/deployment/lifecycleCompletionHeartbeat.d.ts +2 -0
- package/dist/deployment/lifecycleCompletionHeartbeat.js +50 -0
- package/dist/deployment/lifecycleCompletionLookup.d.ts +18 -0
- package/dist/deployment/lifecycleCompletionLookup.js +88 -0
- package/dist/deployment/lifecycleCompletionOwner.d.ts +8 -0
- package/dist/deployment/lifecycleCompletionOwner.js +31 -0
- package/dist/deployment/lifecycleCompletionParsing.d.ts +12 -0
- package/dist/deployment/lifecycleCompletionParsing.js +108 -0
- package/dist/deployment/lifecycleCompletionPaths.d.ts +9 -0
- package/dist/deployment/lifecycleCompletionPaths.js +16 -0
- package/dist/deployment/lifecycleCompletionPublication.d.ts +5 -0
- package/dist/deployment/lifecycleCompletionPublication.js +35 -0
- package/dist/deployment/lifecycleCompletionRecovery.d.ts +21 -0
- package/dist/deployment/lifecycleCompletionRecovery.js +56 -0
- package/dist/deployment/lifecycleCompletionRoot.d.ts +21 -0
- package/dist/deployment/lifecycleCompletionRoot.js +243 -0
- package/dist/deployment/lifecycleCompletionStore.d.ts +6 -0
- package/dist/deployment/lifecycleCompletionStore.js +151 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.d.ts +17 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.js +132 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.js +285 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.js +26 -0
- package/dist/deployment/organizationHandoffAuthorityStore.d.ts +41 -0
- package/dist/deployment/organizationHandoffAuthorityStore.js +348 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.d.ts +76 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.js +148 -0
- package/dist/deployment/organizationHandoffTypes.d.ts +29 -0
- package/dist/deployment/organizationHandoffTypes.js +80 -0
- package/dist/deployment/organizationReady.d.ts +52 -0
- package/dist/deployment/organizationReady.js +200 -0
- package/dist/deployment/privateArtifactsExport.d.ts +18 -0
- package/dist/deployment/privateArtifactsExport.js +80 -0
- package/dist/deployment/providerRuntimeBoundaryScanner.test-helper.d.ts +8 -0
- package/dist/deployment/providerRuntimeBoundaryScanner.test-helper.js +60 -0
- package/dist/deployment/record.d.ts +26 -1
- package/dist/deployment/record.js +49 -4
- package/dist/deployment/simfileFixtureBoundary.test-helper.d.ts +8 -0
- package/dist/deployment/simfileFixtureBoundary.test-helper.js +103 -0
- package/dist/deployment/target.d.ts +1 -35
- package/dist/deployment/target.js +1 -96
- package/dist/deployment/upReceiptTypes.d.ts +111 -0
- package/dist/deployment/upReceiptTypes.js +164 -0
- package/dist/dev/project.js +15 -9
- package/dist/distribution/buildDistributionReport.d.ts +2 -1
- package/dist/distribution/buildDistributionReport.js +2 -1
- package/dist/distribution/distributionReportSchema.d.ts +5 -0
- package/dist/distribution/distributionReportSchema.js +7 -2
- package/dist/distribution/index.d.ts +2 -2
- package/dist/distribution/index.js +1 -1
- package/dist/distribution/types.d.ts +7 -0
- package/dist/distribution/types.js +1 -0
- package/dist/filesystem/paths.js +10 -1
- package/dist/ledger/causalConformanceCli.d.ts +1 -0
- package/dist/ledger/causalConformanceCli.js +41 -0
- package/dist/ledger/causeNamespace.d.ts +8 -0
- package/dist/ledger/causeNamespace.js +24 -0
- package/dist/ledger/conformance.d.ts +83 -0
- package/dist/ledger/conformance.js +259 -0
- package/dist/ledger/emitters.d.ts +76 -0
- package/dist/ledger/emitters.js +188 -0
- package/dist/ledger/index.d.ts +4 -0
- package/dist/ledger/index.js +4 -0
- package/dist/ledger/principal.d.ts +96 -0
- package/dist/ledger/principal.js +121 -0
- package/dist/manifest/externalParticipantSchemas.d.ts +18 -0
- package/dist/manifest/externalParticipantSchemas.js +17 -0
- package/dist/manifest/index.d.ts +1 -0
- package/dist/manifest/index.js +1 -0
- package/dist/manifest/inlineAgentMember.d.ts +2 -0
- package/dist/manifest/inlineAgentMember.js +9 -0
- package/dist/manifest/loadManifest.js +14 -8
- package/dist/manifest/mcpSchemas.d.ts +17 -0
- package/dist/manifest/mcpSchemas.js +41 -0
- package/dist/manifest/memorySchemas.d.ts +245 -0
- package/dist/manifest/memorySchemas.js +148 -0
- package/dist/manifest/renderSpawnfile.js +22 -131
- package/dist/manifest/renderSpawnfileNetworks.js +9 -2
- package/dist/manifest/renderSpawnfileSurfaces.d.ts +2 -0
- package/dist/manifest/renderSpawnfileSurfaces.js +134 -0
- package/dist/manifest/schemas.d.ts +1868 -99
- package/dist/manifest/schemas.js +78 -32
- package/dist/manifest/surfaceSchemas.d.ts +17 -0
- package/dist/manifest/surfaceSchemas.js +24 -1
- package/dist/manifest/teamNetworkAccessSchemas.d.ts +1 -1
- package/dist/manifest/teamNetworkAuthSchemas.d.ts +48 -0
- package/dist/manifest/teamNetworkAuthSchemas.js +103 -0
- package/dist/manifest/teamNetworkSchemas.d.ts +8 -187
- package/dist/manifest/teamNetworkSchemas.js +3 -317
- package/dist/manifest/teamNetworkServerSchemas.d.ts +150 -0
- package/dist/manifest/teamNetworkServerSchemas.js +199 -0
- package/dist/ownership/siblingBuildFreshness.d.ts +20 -0
- package/dist/ownership/siblingBuildFreshness.js +20 -0
- package/dist/ownership/simfileRunOperatorInputs.d.ts +103 -0
- package/dist/ownership/simfileRunOperatorInputs.js +139 -0
- package/dist/report/types.d.ts +142 -0
- package/dist/runtime/common.d.ts +35 -0
- package/dist/runtime/common.js +55 -0
- package/dist/runtime/container.d.ts +28 -1
- package/dist/runtime/container.js +38 -5
- package/dist/runtime/containerPackageOverrides.d.ts +37 -0
- package/dist/runtime/containerPackageOverrides.js +33 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/mnemeMcp.d.ts +15 -0
- package/dist/runtime/mnemeMcp.js +109 -0
- package/dist/runtime/openclaw/adapter.js +15 -4
- package/dist/runtime/openclaw/mcp.d.ts +10 -0
- package/dist/runtime/openclaw/mcp.js +69 -0
- package/dist/runtime/openclaw/runAuth.js +2 -2
- package/dist/runtime/openclaw/scaffold.js +1 -1
- package/dist/runtime/openclaw/schedules.d.ts +38 -0
- package/dist/runtime/openclaw/schedules.js +74 -0
- package/dist/runtime/pi/adapter.d.ts +1 -1
- package/dist/runtime/pi/adapter.js +86 -53
- package/dist/runtime/pi/appActivitySource.js +114 -2
- package/dist/runtime/pi/appAgentConfig.d.ts +11 -0
- package/dist/runtime/pi/appAgentConfig.js +264 -0
- package/dist/runtime/pi/appCliEnginesSource.d.ts +1 -0
- package/dist/runtime/pi/appCliEnginesSource.js +183 -0
- package/dist/runtime/pi/appCliSource.d.ts +1 -0
- package/dist/runtime/pi/appCliSource.js +353 -0
- package/dist/runtime/pi/appControlSource.d.ts +1 -0
- package/dist/runtime/pi/appControlSource.js +390 -0
- package/dist/runtime/pi/appControlWakeIdentitySource.d.ts +1 -0
- package/dist/runtime/pi/appControlWakeIdentitySource.js +19 -0
- package/dist/runtime/pi/appCoreSource.d.ts +4 -1
- package/dist/runtime/pi/appCoreSource.js +104 -214
- package/dist/runtime/pi/appPreludeSource.js +140 -52
- package/dist/runtime/pi/appScheduleSource.d.ts +1 -0
- package/dist/runtime/pi/appScheduleSource.js +80 -0
- package/dist/runtime/pi/appScriptedEngine.d.ts +31 -0
- package/dist/runtime/pi/appScriptedEngine.js +42 -0
- package/dist/runtime/pi/appSource.d.ts +4 -1
- package/dist/runtime/pi/appSource.js +6 -2
- package/dist/runtime/pi/appTemplate.d.ts +8 -22
- package/dist/runtime/pi/appTemplate.js +9 -126
- package/dist/runtime/pi/appTemplateTypes.d.ts +64 -0
- package/dist/runtime/pi/appTemplateTypes.js +18 -0
- package/dist/runtime/pi/appWakeContextSource.d.ts +1 -0
- package/dist/runtime/pi/appWakeContextSource.js +398 -0
- package/dist/runtime/pi/containerTargets.d.ts +4 -0
- package/dist/runtime/pi/containerTargets.js +57 -0
- package/dist/runtime/pi/runAuth.js +126 -9
- package/dist/runtime/pi/testHelpers.d.ts +2 -0
- package/dist/runtime/pi/testHelpers.js +40 -0
- package/dist/runtime/picoclaw/adapter.js +23 -27
- package/dist/runtime/picoclaw/mcp.d.ts +4 -0
- package/dist/runtime/picoclaw/mcp.js +43 -0
- package/dist/runtime/picoclaw/memory.d.ts +7 -0
- package/dist/runtime/picoclaw/memory.js +17 -0
- package/dist/runtime/picoclaw/runAuth.js +1 -1
- package/dist/runtime/picoclaw/scaffold.js +1 -1
- package/dist/runtime/picoclaw/schedules.d.ts +26 -0
- package/dist/runtime/picoclaw/schedules.js +62 -3
- package/dist/runtime/scheduleUtils.d.ts +2 -0
- package/dist/runtime/scheduleUtils.js +15 -0
- package/dist/runtime/types.d.ts +25 -2
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +2 -2
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/redaction.d.ts +2 -0
- package/dist/shared/redaction.js +10 -0
- package/dist/status/buildStatus.d.ts +1 -0
- package/dist/status/buildStatus.js +2 -0
- package/dist/status/compileReport.d.ts +22 -0
- package/dist/status/compileReport.js +16 -2
- package/dist/status/compiledProbeCollection.d.ts +21 -0
- package/dist/status/compiledProbeCollection.js +27 -0
- package/dist/status/imageStatusReport.js +6 -0
- package/dist/status/index.d.ts +3 -0
- package/dist/status/index.js +3 -0
- package/dist/status/lifecycleProbes.d.ts +19 -0
- package/dist/status/lifecycleProbes.js +174 -0
- package/dist/status/moltnetProbes.d.ts +7 -8
- package/dist/status/moltnetProbes.js +27 -198
- package/dist/status/moltnetWiringProbes.d.ts +19 -0
- package/dist/status/moltnetWiringProbes.js +178 -0
- package/dist/target/cleanupRun.d.ts +41 -0
- package/dist/target/cleanupRun.js +139 -0
- package/dist/target/cleanupRunDocker.d.ts +16 -0
- package/dist/target/cleanupRunDocker.js +66 -0
- package/dist/target/cleanupRunDocker.test-helper.d.ts +67 -0
- package/dist/target/cleanupRunDocker.test-helper.js +238 -0
- package/dist/target/cleanupRunDockerPreflight.d.ts +17 -0
- package/dist/target/cleanupRunDockerPreflight.js +224 -0
- package/dist/target/composedPreparation.d.ts +205 -0
- package/dist/target/composedPreparation.js +223 -0
- package/dist/target/containerBundle.d.ts +82 -0
- package/dist/target/containerBundle.js +243 -0
- package/dist/target/containerBundleArchive.d.ts +31 -0
- package/dist/target/containerBundleArchive.js +140 -0
- package/dist/target/containerBundleAuthority.d.ts +25 -0
- package/dist/target/containerBundleAuthority.js +65 -0
- package/dist/target/containerBundleContracts.d.ts +114 -0
- package/dist/target/containerBundleContracts.js +173 -0
- package/dist/target/containerBundleFilesystemStore.d.ts +3 -0
- package/dist/target/containerBundleFilesystemStore.js +247 -0
- package/dist/target/containerBundlePolicy.d.ts +33 -0
- package/dist/target/containerBundlePolicy.js +64 -0
- package/dist/target/containerBundleStore.d.ts +127 -0
- package/dist/target/containerBundleStore.js +284 -0
- package/dist/target/contracts.d.ts +538 -0
- package/dist/target/contracts.js +373 -0
- package/dist/target/dockerArtifactIdentityTypes.d.ts +56 -0
- package/dist/target/dockerArtifactIdentityTypes.js +1 -0
- package/dist/target/dockerArtifactInspection.d.ts +40 -0
- package/dist/target/dockerArtifactInspection.js +125 -0
- package/dist/target/dockerArtifacts.d.ts +21 -0
- package/dist/target/dockerArtifacts.js +110 -0
- package/dist/target/dockerArtifactsProvider.d.ts +41 -0
- package/dist/target/dockerArtifactsProvider.js +449 -0
- package/dist/target/dockerCommandExecutor.d.ts +27 -0
- package/dist/target/dockerCommandExecutor.js +200 -0
- package/dist/target/dockerCommandExecutorCore.d.ts +34 -0
- package/dist/target/dockerCommandExecutorCore.js +273 -0
- package/dist/target/dockerContainerBundleBuilder.d.ts +8 -0
- package/dist/target/dockerContainerBundleBuilder.js +256 -0
- package/dist/target/dockerContextSnapshot.d.ts +21 -0
- package/dist/target/dockerContextSnapshot.js +158 -0
- package/dist/target/dockerEndpointFingerprint.d.ts +1 -0
- package/dist/target/dockerEndpointFingerprint.js +9 -0
- package/dist/target/dockerPreparedArtifact.d.ts +48 -0
- package/dist/target/dockerPreparedArtifact.js +131 -0
- package/dist/target/dockerProjectionJson.d.ts +1 -0
- package/dist/target/dockerProjectionJson.js +80 -0
- package/dist/target/dockerPublicArtifactSnapshot.d.ts +17 -0
- package/dist/target/dockerPublicArtifactSnapshot.js +99 -0
- package/dist/target/dockerResources.d.ts +26 -0
- package/dist/target/dockerResources.js +162 -0
- package/dist/target/dockerResourcesProvider.d.ts +44 -0
- package/dist/target/dockerResourcesProvider.js +207 -0
- package/dist/target/dockerSecrets.d.ts +39 -0
- package/dist/target/dockerSecrets.js +249 -0
- package/dist/target/dockerSecretsAuthority.d.ts +26 -0
- package/dist/target/dockerSecretsAuthority.js +216 -0
- package/dist/target/dockerSecretsLifecycle.d.ts +25 -0
- package/dist/target/dockerSecretsLifecycle.js +133 -0
- package/dist/target/dockerSecretsProvider.d.ts +68 -0
- package/dist/target/dockerSecretsProvider.js +329 -0
- package/dist/target/dockerTarget.d.ts +52 -0
- package/dist/target/dockerTarget.js +48 -0
- package/dist/target/dockerTargetBinding.d.ts +14 -0
- package/dist/target/dockerTargetBinding.js +96 -0
- package/dist/target/dockerWorldClock.d.ts +17 -0
- package/dist/target/dockerWorldClock.js +111 -0
- package/dist/target/dockerWorldReadiness.d.ts +17 -0
- package/dist/target/dockerWorldReadiness.js +119 -0
- package/dist/target/dockerWorldService.d.ts +23 -0
- package/dist/target/dockerWorldService.js +216 -0
- package/dist/target/dockerWorldServiceAuthority.d.ts +80 -0
- package/dist/target/dockerWorldServiceAuthority.js +182 -0
- package/dist/target/dockerWorldServiceLifecycle.d.ts +41 -0
- package/dist/target/dockerWorldServiceLifecycle.js +275 -0
- package/dist/target/dockerWorldServiceProvider.d.ts +60 -0
- package/dist/target/dockerWorldServiceProvider.js +318 -0
- package/dist/target/dockerWorldServiceStore.d.ts +73 -0
- package/dist/target/dockerWorldServiceStore.js +367 -0
- package/dist/target/evidenceExport.d.ts +55 -0
- package/dist/target/evidenceExport.js +518 -0
- package/dist/target/evidenceExportArchive.d.ts +10 -0
- package/dist/target/evidenceExportArchive.js +302 -0
- package/dist/target/evidenceExportContract.d.ts +27 -0
- package/dist/target/evidenceExportContract.js +40 -0
- package/dist/target/evidenceExportOperationsTestKit.d.ts +87 -0
- package/dist/target/evidenceExportOperationsTestKit.js +312 -0
- package/dist/target/evidenceExportProvider.d.ts +85 -0
- package/dist/target/evidenceExportProvider.js +187 -0
- package/dist/target/evidenceExportPublicationTypes.d.ts +16 -0
- package/dist/target/evidenceExportPublicationTypes.js +1 -0
- package/dist/target/evidenceExportStore.d.ts +70 -0
- package/dist/target/evidenceExportStore.js +498 -0
- package/dist/target/evidenceExportStorePublication.d.ts +7 -0
- package/dist/target/evidenceExportStorePublication.js +395 -0
- package/dist/target/handles.d.ts +20 -0
- package/dist/target/handles.js +56 -0
- package/dist/target/index.d.ts +12 -0
- package/dist/target/index.js +11 -0
- package/dist/target/journal.d.ts +59 -0
- package/dist/target/journal.js +529 -0
- package/dist/target/journalFilesystem.d.ts +3 -0
- package/dist/target/journalFilesystem.js +111 -0
- package/dist/target/journalRoot.d.ts +4 -0
- package/dist/target/journalRoot.js +6 -0
- package/dist/target/organizationAttachment.d.ts +23 -0
- package/dist/target/organizationAttachment.js +263 -0
- package/dist/target/organizationAttachmentAuthority.d.ts +65 -0
- package/dist/target/organizationAttachmentAuthority.js +161 -0
- package/dist/target/organizationAttachmentLifecycle.d.ts +17 -0
- package/dist/target/organizationAttachmentLifecycle.js +101 -0
- package/dist/target/organizationAttachmentProvider.d.ts +76 -0
- package/dist/target/organizationAttachmentProvider.js +289 -0
- package/dist/target/organizationAttachmentStore.d.ts +51 -0
- package/dist/target/organizationAttachmentStore.js +316 -0
- package/dist/target/publicArtifactSnapshot.d.ts +41 -0
- package/dist/target/publicArtifactSnapshot.js +150 -0
- package/dist/target/topologyActivation.d.ts +51 -0
- package/dist/target/topologyActivation.js +149 -0
- package/dist/target/topologyAttestation.d.ts +37 -0
- package/dist/target/topologyAttestation.js +300 -0
- package/dist/target/topologyAttestationErrors.d.ts +1 -0
- package/dist/target/topologyAttestationErrors.js +1 -0
- package/dist/target/worldClock.d.ts +60 -0
- package/dist/target/worldClock.js +129 -0
- package/dist/target/worldReadiness.d.ts +103 -0
- package/dist/target/worldReadiness.js +153 -0
- package/moltnet-releases.json +20 -0
- package/package.json +27 -11
- package/runtimes.yaml +8 -23
- package/dist/runtime/openclaw/scaffold-assets/CLAUDE.md +0 -5
- package/dist/runtime/picoclaw/scaffold-assets/CLAUDE.md +0 -5
- /package/dist/runtime/openclaw/scaffold-assets/{AGENTS.md → WORKSPACE_AGENTS.md} +0 -0
- /package/dist/runtime/picoclaw/scaffold-assets/{AGENTS.md → WORKSPACE_AGENTS.md} +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { assertOrdinaryJsonGraph, parseSelectedTargetReceipt, parseTargetResourceReceipt, parseTargetResourceRequest, } from "./contracts.js";
|
|
4
|
+
import { createCanonicalTargetReceiptBytes, createTargetReceiptDigest, createTargetRequestDigest, } from "./handles.js";
|
|
5
|
+
export const COMPOSED_PREPARATION_REQUEST_VERSION = "spawnfile.composed-preparation.request.v1";
|
|
6
|
+
export const COMPOSED_PREPARATION_RECEIPT_VERSION = "spawnfile.composed-preparation.receipt.v1";
|
|
7
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/u);
|
|
8
|
+
const runId = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u);
|
|
9
|
+
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
10
|
+
const idempotencyKey = z.string().regex(/^idem_[a-z0-9]{16,64}$/u);
|
|
11
|
+
const opaqueHandle = z.string().regex(/^opaque_[a-z0-9]{16,64}$/u);
|
|
12
|
+
export const composedPreparationRequestSchema = z.object({
|
|
13
|
+
auth_profile: identifier,
|
|
14
|
+
descriptor_digest: digest,
|
|
15
|
+
idempotency_key: idempotencyKey,
|
|
16
|
+
organization: z.object({
|
|
17
|
+
artifact_digest: digest,
|
|
18
|
+
world_bindings_digest: digest,
|
|
19
|
+
}).strict(),
|
|
20
|
+
run_id: runId,
|
|
21
|
+
secret_bindings: z.array(z.object({
|
|
22
|
+
name: identifier,
|
|
23
|
+
scope: identifier,
|
|
24
|
+
source_handle: opaqueHandle,
|
|
25
|
+
}).strict()).min(1).max(32),
|
|
26
|
+
target_selector: identifier,
|
|
27
|
+
version: z.literal(COMPOSED_PREPARATION_REQUEST_VERSION),
|
|
28
|
+
world: z.object({
|
|
29
|
+
artifact_manifest_digest: digest,
|
|
30
|
+
bundle_digest: digest,
|
|
31
|
+
}).strict(),
|
|
32
|
+
}).strict();
|
|
33
|
+
const selectedTarget = z.object({
|
|
34
|
+
fingerprint: z.string().regex(/^sha256:[a-f0-9]{32}$/u),
|
|
35
|
+
handle: opaqueHandle,
|
|
36
|
+
version: z.literal("spawnfile.target-resource.selected-target.v1"),
|
|
37
|
+
}).strict();
|
|
38
|
+
const mutationReceipt = z.object({
|
|
39
|
+
cleanup_state: z.enum(["not_requested", "preserved", "removed", "incomplete"]).nullable(),
|
|
40
|
+
descriptor_digest: digest,
|
|
41
|
+
export_state: z.enum(["not_requested", "exported", "incomplete"]).nullable(),
|
|
42
|
+
labels: z.array(z.object({ key: identifier, value: identifier }).strict()).max(16),
|
|
43
|
+
operation: z.enum([
|
|
44
|
+
"resolve_world_artifact", "prepare_secret_bindings",
|
|
45
|
+
"create_data_network", "create_evidence_volume",
|
|
46
|
+
]),
|
|
47
|
+
operation_handle: opaqueHandle,
|
|
48
|
+
receipt_digest: digest,
|
|
49
|
+
request_digest: digest,
|
|
50
|
+
result_handle: opaqueHandle,
|
|
51
|
+
resulting_revision: z.number().int().min(1).max(4),
|
|
52
|
+
run_id: runId,
|
|
53
|
+
selected_target: selectedTarget.omit({ version: true }),
|
|
54
|
+
version: z.literal("spawnfile.target-resource.receipt.v1"),
|
|
55
|
+
}).strict();
|
|
56
|
+
export const composedPreparationReceiptSchema = z.object({
|
|
57
|
+
auth_profile: identifier,
|
|
58
|
+
descriptor_digest: digest,
|
|
59
|
+
organization: z.object({
|
|
60
|
+
artifact_digest: digest,
|
|
61
|
+
world_bindings_digest: digest,
|
|
62
|
+
}).strict(),
|
|
63
|
+
receipt_digest: digest,
|
|
64
|
+
request_digest: digest,
|
|
65
|
+
resources: z.object({
|
|
66
|
+
data_network: mutationReceipt,
|
|
67
|
+
evidence_volume: mutationReceipt,
|
|
68
|
+
secret_bindings: mutationReceipt,
|
|
69
|
+
world_artifact: mutationReceipt,
|
|
70
|
+
}).strict(),
|
|
71
|
+
run_id: runId,
|
|
72
|
+
selected_target: selectedTarget,
|
|
73
|
+
target_selector: identifier,
|
|
74
|
+
version: z.literal(COMPOSED_PREPARATION_RECEIPT_VERSION),
|
|
75
|
+
world: z.object({
|
|
76
|
+
artifact_manifest_digest: digest,
|
|
77
|
+
bundle_digest: digest,
|
|
78
|
+
}).strict(),
|
|
79
|
+
}).strict().superRefine((value, context) => {
|
|
80
|
+
const ordered = [
|
|
81
|
+
["world_artifact", "resolve_world_artifact", 1],
|
|
82
|
+
["secret_bindings", "prepare_secret_bindings", 2],
|
|
83
|
+
["data_network", "create_data_network", 3],
|
|
84
|
+
["evidence_volume", "create_evidence_volume", 4],
|
|
85
|
+
];
|
|
86
|
+
for (const [key, operation, revision] of ordered) {
|
|
87
|
+
const receipt = value.resources[key];
|
|
88
|
+
if (receipt.operation !== operation || receipt.resulting_revision !== revision
|
|
89
|
+
|| receipt.run_id !== value.run_id
|
|
90
|
+
|| receipt.descriptor_digest !== value.descriptor_digest
|
|
91
|
+
|| receipt.selected_target.handle !== value.selected_target.handle
|
|
92
|
+
|| receipt.selected_target.fingerprint !== value.selected_target.fingerprint) {
|
|
93
|
+
context.addIssue({
|
|
94
|
+
code: z.ZodIssueCode.custom,
|
|
95
|
+
message: `composed preparation ${key} correlation is invalid`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (value.resources.world_artifact.result_handle === value.resources.secret_bindings.result_handle
|
|
100
|
+
|| new Set(ordered.map(([key]) => value.resources[key].operation_handle)).size !== ordered.length
|
|
101
|
+
|| new Set(ordered.map(([key]) => value.resources[key].result_handle)).size !== ordered.length) {
|
|
102
|
+
context.addIssue({
|
|
103
|
+
code: z.ZodIssueCode.custom,
|
|
104
|
+
message: "composed preparation resource identities are not unique",
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const canonical = (value) => {
|
|
109
|
+
assertOrdinaryJsonGraph(value);
|
|
110
|
+
if (Array.isArray(value))
|
|
111
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
112
|
+
if (value !== null && typeof value === "object") {
|
|
113
|
+
const record = value;
|
|
114
|
+
return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${canonical(record[key])}`).join(",")}}`;
|
|
115
|
+
}
|
|
116
|
+
return JSON.stringify(value);
|
|
117
|
+
};
|
|
118
|
+
const hash = (domain, value) => `sha256:${createHash("sha256").update(`${domain}\0${canonical(value)}`).digest("hex")}`;
|
|
119
|
+
export const parseComposedPreparationRequest = (raw) => {
|
|
120
|
+
assertOrdinaryJsonGraph(raw);
|
|
121
|
+
return composedPreparationRequestSchema.parse(raw);
|
|
122
|
+
};
|
|
123
|
+
export const createComposedPreparationRequestDigest = (raw) => hash(COMPOSED_PREPARATION_REQUEST_VERSION, parseComposedPreparationRequest(raw));
|
|
124
|
+
export const parseComposedPreparationReceipt = (raw) => {
|
|
125
|
+
assertOrdinaryJsonGraph(raw);
|
|
126
|
+
const receipt = composedPreparationReceiptSchema.parse(raw);
|
|
127
|
+
const { receipt_digest: _digest, ...body } = receipt;
|
|
128
|
+
if (receipt.receipt_digest !== hash(COMPOSED_PREPARATION_RECEIPT_VERSION, body)) {
|
|
129
|
+
throw new TypeError("Composed preparation receipt digest is invalid");
|
|
130
|
+
}
|
|
131
|
+
return Object.freeze(receipt);
|
|
132
|
+
};
|
|
133
|
+
export const createCanonicalComposedPreparationReceiptBytes = (raw) => canonical(parseComposedPreparationReceipt(raw));
|
|
134
|
+
const operationKey = (request, operation) => `idem_${createHash("sha256")
|
|
135
|
+
.update(`${request.idempotency_key}\0${operation}`, "utf8").digest("hex").slice(0, 32)}`;
|
|
136
|
+
const selectionRequest = (request) => parseTargetResourceRequest({
|
|
137
|
+
idempotency_key: operationKey(request, "select_target"),
|
|
138
|
+
operation: "select_target",
|
|
139
|
+
target_reference: request.target_selector,
|
|
140
|
+
version: "spawnfile.target-resource.request.v1",
|
|
141
|
+
});
|
|
142
|
+
const mutationEnvelope = (request, target, operation, revision) => ({
|
|
143
|
+
descriptor_digest: request.descriptor_digest,
|
|
144
|
+
expected_revision: revision,
|
|
145
|
+
idempotency_key: operationKey(request, operation),
|
|
146
|
+
run_id: request.run_id,
|
|
147
|
+
selected_target: { fingerprint: target.fingerprint, handle: target.handle },
|
|
148
|
+
version: "spawnfile.target-resource.request.v1",
|
|
149
|
+
});
|
|
150
|
+
const validateMutation = (raw, request, expectedRevision) => {
|
|
151
|
+
const receipt = parseTargetResourceReceipt(raw.receipt);
|
|
152
|
+
if (typeof raw.receiptBytes !== "string"
|
|
153
|
+
|| raw.receiptBytes !== createCanonicalTargetReceiptBytes(receipt)
|
|
154
|
+
|| receipt.receipt_digest !== createTargetReceiptDigest(receipt)
|
|
155
|
+
|| receipt.request_digest !== createTargetRequestDigest(request)
|
|
156
|
+
|| receipt.operation !== request.operation
|
|
157
|
+
|| receipt.run_id !== ("run_id" in request ? request.run_id : null)
|
|
158
|
+
|| receipt.descriptor_digest !== ("descriptor_digest" in request ? request.descriptor_digest : null)
|
|
159
|
+
|| receipt.resulting_revision !== expectedRevision
|
|
160
|
+
|| receipt.result_handle === null) {
|
|
161
|
+
throw new TypeError("Composed preparation operation receipt is invalid");
|
|
162
|
+
}
|
|
163
|
+
return receipt;
|
|
164
|
+
};
|
|
165
|
+
const sameSelectedTarget = (receipt, target) => canonical(receipt.selected_target) === canonical({
|
|
166
|
+
fingerprint: target.fingerprint,
|
|
167
|
+
handle: target.handle,
|
|
168
|
+
});
|
|
169
|
+
export const prepareComposedRun = async (handlers, raw) => {
|
|
170
|
+
const request = parseComposedPreparationRequest(raw);
|
|
171
|
+
const selected = parseSelectedTargetReceipt(await handlers.select_target(selectionRequest(request)));
|
|
172
|
+
const requests = [
|
|
173
|
+
parseTargetResourceRequest({
|
|
174
|
+
...mutationEnvelope(request, selected, "resolve_world_artifact", 0),
|
|
175
|
+
artifact_manifest_digest: request.world.artifact_manifest_digest,
|
|
176
|
+
operation: "resolve_world_artifact",
|
|
177
|
+
}),
|
|
178
|
+
parseTargetResourceRequest({
|
|
179
|
+
...mutationEnvelope(request, selected, "prepare_secret_bindings", 1),
|
|
180
|
+
bindings: request.secret_bindings,
|
|
181
|
+
operation: "prepare_secret_bindings",
|
|
182
|
+
}),
|
|
183
|
+
parseTargetResourceRequest({
|
|
184
|
+
...mutationEnvelope(request, selected, "create_data_network", 2),
|
|
185
|
+
operation: "create_data_network",
|
|
186
|
+
}),
|
|
187
|
+
parseTargetResourceRequest({
|
|
188
|
+
...mutationEnvelope(request, selected, "create_evidence_volume", 3),
|
|
189
|
+
operation: "create_evidence_volume",
|
|
190
|
+
}),
|
|
191
|
+
];
|
|
192
|
+
const receipts = [];
|
|
193
|
+
for (const [index, operationRequest] of requests.entries()) {
|
|
194
|
+
const handler = handlers[operationRequest.operation];
|
|
195
|
+
const receipt = validateMutation(await handler(operationRequest), operationRequest, index + 1);
|
|
196
|
+
if (!sameSelectedTarget(receipt, selected)) {
|
|
197
|
+
throw new TypeError("Composed preparation selected target changed");
|
|
198
|
+
}
|
|
199
|
+
receipts.push(receipt);
|
|
200
|
+
}
|
|
201
|
+
const body = {
|
|
202
|
+
auth_profile: request.auth_profile,
|
|
203
|
+
descriptor_digest: request.descriptor_digest,
|
|
204
|
+
organization: request.organization,
|
|
205
|
+
receipt_digest: `sha256:${"0".repeat(64)}`,
|
|
206
|
+
request_digest: createComposedPreparationRequestDigest(request),
|
|
207
|
+
resources: {
|
|
208
|
+
data_network: receipts[2],
|
|
209
|
+
evidence_volume: receipts[3],
|
|
210
|
+
secret_bindings: receipts[1],
|
|
211
|
+
world_artifact: receipts[0],
|
|
212
|
+
},
|
|
213
|
+
run_id: request.run_id,
|
|
214
|
+
selected_target: selected,
|
|
215
|
+
target_selector: request.target_selector,
|
|
216
|
+
version: COMPOSED_PREPARATION_RECEIPT_VERSION,
|
|
217
|
+
world: request.world,
|
|
218
|
+
};
|
|
219
|
+
return parseComposedPreparationReceipt({
|
|
220
|
+
...body,
|
|
221
|
+
receipt_digest: hash(COMPOSED_PREPARATION_RECEIPT_VERSION, (({ receipt_digest: _receiptDigest, ...unsigned }) => unsigned)(body)),
|
|
222
|
+
});
|
|
223
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type ParsedContainerBundleArchive } from "./containerBundleArchive.js";
|
|
2
|
+
import type { AuthorizedContainerBundlePlan, ContainerBundlePreparationAuthority } from "./containerBundleAuthority.js";
|
|
3
|
+
import { type TargetLocalBundlePrepareReceipt, type TargetLocalBundlePrepareRequest } from "./containerBundleContracts.js";
|
|
4
|
+
import type { TargetLocalBundlePrivateMapping, TargetLocalBundleStore } from "./containerBundleStore.js";
|
|
5
|
+
export declare const TARGET_LOCAL_CONTAINER_BUNDLE_ERROR = "Target-local container bundle preparation failed";
|
|
6
|
+
export interface DockerTargetLocalBundleBuilder {
|
|
7
|
+
build(input: {
|
|
8
|
+
readonly archive: ParsedContainerBundleArchive;
|
|
9
|
+
readonly base_image_config_digest: string;
|
|
10
|
+
readonly entrypoint: string;
|
|
11
|
+
readonly gc_tag: string;
|
|
12
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
13
|
+
readonly platform: {
|
|
14
|
+
readonly architecture: "amd64" | "arm64";
|
|
15
|
+
readonly os: "linux";
|
|
16
|
+
};
|
|
17
|
+
}): Promise<{
|
|
18
|
+
readonly config_id: string;
|
|
19
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
20
|
+
readonly platform: {
|
|
21
|
+
readonly architecture: "amd64" | "arm64";
|
|
22
|
+
readonly os: "linux";
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
inspect(input: {
|
|
26
|
+
readonly config_id: string;
|
|
27
|
+
readonly gc_tag: string;
|
|
28
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
29
|
+
readonly platform: {
|
|
30
|
+
readonly architecture: "amd64" | "arm64";
|
|
31
|
+
readonly os: "linux";
|
|
32
|
+
};
|
|
33
|
+
}): Promise<{
|
|
34
|
+
readonly config_id: string;
|
|
35
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
36
|
+
readonly platform: {
|
|
37
|
+
readonly architecture: "amd64" | "arm64";
|
|
38
|
+
readonly os: "linux";
|
|
39
|
+
};
|
|
40
|
+
} | null>;
|
|
41
|
+
/** Finds only this deterministic anchor. `missing` means no tag existed before an effect. */
|
|
42
|
+
inspectAnchor(input: {
|
|
43
|
+
readonly gc_tag: string;
|
|
44
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
45
|
+
readonly platform: {
|
|
46
|
+
readonly architecture: "amd64" | "arm64";
|
|
47
|
+
readonly os: "linux";
|
|
48
|
+
};
|
|
49
|
+
}): Promise<{
|
|
50
|
+
readonly config_id: string;
|
|
51
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
52
|
+
readonly platform: {
|
|
53
|
+
readonly architecture: "amd64" | "arm64";
|
|
54
|
+
readonly os: "linux";
|
|
55
|
+
};
|
|
56
|
+
} | "missing" | null>;
|
|
57
|
+
/** A fresh selected-target + daemon attestation. It is called before and after any Docker action. */
|
|
58
|
+
attestTarget(input: {
|
|
59
|
+
readonly selected_target: TargetLocalBundlePrepareRequest["selected_target"];
|
|
60
|
+
}): Promise<{
|
|
61
|
+
readonly daemon_epoch: string;
|
|
62
|
+
} | null>;
|
|
63
|
+
}
|
|
64
|
+
export interface TargetLocalContainerBundleOperations {
|
|
65
|
+
lookup(input: {
|
|
66
|
+
readonly idempotency_key: unknown;
|
|
67
|
+
readonly request_digest: unknown;
|
|
68
|
+
}): ReturnType<TargetLocalBundleStore["lookup"]>;
|
|
69
|
+
prepare(raw: unknown): Promise<TargetLocalBundlePrepareReceipt>;
|
|
70
|
+
recover(raw: unknown): Promise<TargetLocalBundlePrepareReceipt>;
|
|
71
|
+
}
|
|
72
|
+
export declare const targetLocalBundleGcTag: (requestDigest: string) => string;
|
|
73
|
+
type BundleLabelPlan = Pick<AuthorizedContainerBundlePlan, "archive_digest" | "artifact_digest" | "base_image_config_digest" | "build_policy_digest" | "bundle_digest" | "entrypoint" | "launcher_digest" | "network_alias" | "platform_digest">;
|
|
74
|
+
export declare const targetLocalBundleLabels: (plan: BundleLabelPlan, daemonEpoch: string, requestDigest: string) => Readonly<Record<string, string>>;
|
|
75
|
+
/** Re-attests the exact private anchor before an image config becomes usable. */
|
|
76
|
+
export declare const attestTargetLocalBundleMapping: (builder: DockerTargetLocalBundleBuilder, value: TargetLocalBundlePrivateMapping) => Promise<void>;
|
|
77
|
+
export declare const createTargetLocalContainerBundleOperations: (input: {
|
|
78
|
+
readonly authority: ContainerBundlePreparationAuthority;
|
|
79
|
+
readonly builder: DockerTargetLocalBundleBuilder;
|
|
80
|
+
readonly store: TargetLocalBundleStore;
|
|
81
|
+
}) => TargetLocalContainerBundleOperations;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { Buffer } from "node:buffer";
|
|
3
|
+
import { parseContainerBundleArchive, validateContainerBundleEnvelope } from "./containerBundleArchive.js";
|
|
4
|
+
import { createTargetLocalBundleReceiptDigest, createTargetLocalBundleRequestDigest, parseTargetLocalBundlePrepareRequest } from "./containerBundleContracts.js";
|
|
5
|
+
import { parseOpaqueTargetHandle } from "./contracts.js";
|
|
6
|
+
export const TARGET_LOCAL_CONTAINER_BUNDLE_ERROR = "Target-local container bundle preparation failed";
|
|
7
|
+
const fail = () => { throw new Error(TARGET_LOCAL_CONTAINER_BUNDLE_ERROR); };
|
|
8
|
+
export const targetLocalBundleGcTag = (requestDigest) => `spfb_${createHash("sha256")
|
|
9
|
+
.update("spawnfile.target-local-container-bundle.gc-tag.v1\0", "utf8").update(requestDigest).digest("hex").slice(0, 58)}`;
|
|
10
|
+
export const targetLocalBundleLabels = (plan, daemonEpoch, requestDigest) => Object.freeze({
|
|
11
|
+
spawnfile_target_bundle_v1_archive: plan.archive_digest,
|
|
12
|
+
spawnfile_target_bundle_v1_alias: plan.network_alias,
|
|
13
|
+
spawnfile_target_bundle_v1_artifact: plan.artifact_digest,
|
|
14
|
+
spawnfile_target_bundle_v1_base: plan.base_image_config_digest,
|
|
15
|
+
spawnfile_target_bundle_v1_bundle: plan.bundle_digest,
|
|
16
|
+
spawnfile_target_bundle_v1_daemon: daemonEpoch,
|
|
17
|
+
spawnfile_target_bundle_v1_entrypoint: plan.entrypoint,
|
|
18
|
+
spawnfile_target_bundle_v1_launcher: plan.launcher_digest,
|
|
19
|
+
spawnfile_target_bundle_v1_platform: plan.platform_digest,
|
|
20
|
+
spawnfile_target_bundle_v1_policy: plan.build_policy_digest,
|
|
21
|
+
spawnfile_target_bundle_v1_request: requestDigest,
|
|
22
|
+
spawnfile_target_bundle_v1_version: "v1"
|
|
23
|
+
});
|
|
24
|
+
const exactLabels = (actual, expected) => Object.keys(actual).length === Object.keys(expected).length && Object.entries(expected).every(([key, value]) => actual[key] === value);
|
|
25
|
+
const receipt = (request, requestDigest, operation, mapping) => {
|
|
26
|
+
const raw = { archive_digest: request.archive_digest, artifact_digest: request.artifact_digest,
|
|
27
|
+
build_policy_digest: request.build_policy_digest, bundle_digest: request.bundle_digest,
|
|
28
|
+
launcher_digest: request.launcher_digest, mapping_handle: mapping, network_alias: request.network_alias,
|
|
29
|
+
operation_handle: operation, platform: request.platform, platform_digest: request.platform_digest,
|
|
30
|
+
receipt_digest: `sha256:${"0".repeat(64)}`, request_digest: requestDigest,
|
|
31
|
+
selected_target: request.selected_target, version: "spawnfile.target-local-container-bundle.prepare-receipt.v1" };
|
|
32
|
+
return { ...raw, mapping_handle: parseOpaqueTargetHandle(mapping),
|
|
33
|
+
operation_handle: parseOpaqueTargetHandle(operation), receipt_digest: createTargetLocalBundleReceiptDigest(raw) };
|
|
34
|
+
};
|
|
35
|
+
const mappingHandle = (operation, requestDigest) => `opaque_${createHash("sha256")
|
|
36
|
+
.update("spawnfile.target-local-container-bundle.mapping.v1\0", "utf8").update(`${operation}\0${requestDigest}`, "utf8").digest("hex")}`;
|
|
37
|
+
const same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
38
|
+
const mapping = (plan, request, daemonEpoch, reservation, configId) => ({
|
|
39
|
+
archive_digest: plan.archive_digest, artifact_digest: plan.artifact_digest,
|
|
40
|
+
base_image_config_digest: plan.base_image_config_digest, build_policy_digest: plan.build_policy_digest,
|
|
41
|
+
bundle_digest: plan.bundle_digest, config_id: configId, daemon_epoch: daemonEpoch,
|
|
42
|
+
entrypoint: plan.entrypoint, gc_tag: targetLocalBundleGcTag(reservation.request_digest), identity_kind: "docker_image_config_digest",
|
|
43
|
+
launcher_digest: plan.launcher_digest, network_alias: plan.network_alias,
|
|
44
|
+
operation_handle: reservation.operation_handle, platform: plan.platform, platform_digest: plan.platform_digest,
|
|
45
|
+
request_digest: reservation.request_digest, selected_target: request.selected_target
|
|
46
|
+
});
|
|
47
|
+
const compatibleMapping = (value, plan, request, requestDigest) => value.request_digest === requestDigest && value.archive_digest === plan.archive_digest && value.artifact_digest === plan.artifact_digest
|
|
48
|
+
&& value.base_image_config_digest === plan.base_image_config_digest && value.build_policy_digest === plan.build_policy_digest
|
|
49
|
+
&& value.bundle_digest === plan.bundle_digest && value.entrypoint === plan.entrypoint && value.launcher_digest === plan.launcher_digest
|
|
50
|
+
&& value.network_alias === plan.network_alias && value.platform_digest === plan.platform_digest
|
|
51
|
+
&& same(value.platform, plan.platform) && same(value.selected_target, request.selected_target);
|
|
52
|
+
/** Re-attests the exact private anchor before an image config becomes usable. */
|
|
53
|
+
export const attestTargetLocalBundleMapping = async (builder, value) => {
|
|
54
|
+
if (value.gc_tag !== targetLocalBundleGcTag(value.request_digest))
|
|
55
|
+
fail();
|
|
56
|
+
const first = await builder.attestTarget({ selected_target: value.selected_target });
|
|
57
|
+
if (!first || first.daemon_epoch !== value.daemon_epoch)
|
|
58
|
+
fail();
|
|
59
|
+
const expected = targetLocalBundleLabels(value, value.daemon_epoch, value.request_digest);
|
|
60
|
+
const inspected = await builder.inspect({ config_id: value.config_id, gc_tag: value.gc_tag, labels: expected, platform: value.platform });
|
|
61
|
+
if (!inspected || inspected.config_id !== value.config_id || !exactLabels(inspected.labels, expected)
|
|
62
|
+
|| !same(inspected.platform, value.platform))
|
|
63
|
+
fail();
|
|
64
|
+
const second = await builder.attestTarget({ selected_target: value.selected_target });
|
|
65
|
+
if (!second || second.daemon_epoch !== value.daemon_epoch)
|
|
66
|
+
fail();
|
|
67
|
+
};
|
|
68
|
+
export const createTargetLocalContainerBundleOperations = (input) => {
|
|
69
|
+
if (!input?.authority || typeof input.authority.authorize !== "function" || !input.builder || !input.store)
|
|
70
|
+
fail();
|
|
71
|
+
const attest = async (request) => {
|
|
72
|
+
const result = await input.builder.attestTarget({ selected_target: request.selected_target });
|
|
73
|
+
if (!result || !/^sha256:[a-f0-9]{64}$/u.test(result.daemon_epoch))
|
|
74
|
+
fail();
|
|
75
|
+
return result.daemon_epoch;
|
|
76
|
+
};
|
|
77
|
+
const withHeartbeat = async (lease, action) => {
|
|
78
|
+
let current = lease;
|
|
79
|
+
let failure;
|
|
80
|
+
let renewing = Promise.resolve();
|
|
81
|
+
const beat = () => { renewing = renewing.then(async () => { try {
|
|
82
|
+
current = await input.store.renew({ lease: current });
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
failure = error;
|
|
86
|
+
} }); };
|
|
87
|
+
const timer = setInterval(beat, 5_000);
|
|
88
|
+
try {
|
|
89
|
+
const value = await action();
|
|
90
|
+
await renewing;
|
|
91
|
+
if (failure)
|
|
92
|
+
fail();
|
|
93
|
+
return { lease: current, value };
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
clearInterval(timer);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const replayAnchor = async (value, plan, request) => {
|
|
100
|
+
const privateMapping = value.mapping;
|
|
101
|
+
if (!compatibleMapping(privateMapping, plan, request, value.receipt.request_digest)
|
|
102
|
+
|| privateMapping.operation_handle !== value.receipt.operation_handle
|
|
103
|
+
|| privateMapping.gc_tag !== targetLocalBundleGcTag(privateMapping.request_digest))
|
|
104
|
+
fail();
|
|
105
|
+
const first = await input.builder.attestTarget({ selected_target: privateMapping.selected_target });
|
|
106
|
+
if (!first || first.daemon_epoch !== privateMapping.daemon_epoch)
|
|
107
|
+
fail();
|
|
108
|
+
const expected = targetLocalBundleLabels(privateMapping, privateMapping.daemon_epoch, privateMapping.request_digest);
|
|
109
|
+
const inspected = await input.builder.inspectAnchor({ gc_tag: privateMapping.gc_tag, labels: expected, platform: privateMapping.platform });
|
|
110
|
+
const second = await input.builder.attestTarget({ selected_target: privateMapping.selected_target });
|
|
111
|
+
if (!second || second.daemon_epoch !== privateMapping.daemon_epoch)
|
|
112
|
+
fail();
|
|
113
|
+
if (inspected === "missing")
|
|
114
|
+
return "missing";
|
|
115
|
+
if (!inspected || inspected.config_id !== privateMapping.config_id || !exactLabels(inspected.labels, expected)
|
|
116
|
+
|| !same(inspected.platform, privateMapping.platform))
|
|
117
|
+
fail();
|
|
118
|
+
return "intact";
|
|
119
|
+
};
|
|
120
|
+
const reserveAttested = async (request, plan, joinPending) => {
|
|
121
|
+
let reservation = await input.store.reserve(request);
|
|
122
|
+
let mayJoin = joinPending;
|
|
123
|
+
for (let attempt = 0; attempt < 4; attempt += 1) {
|
|
124
|
+
if (reservation.kind === "replay") {
|
|
125
|
+
if (await replayAnchor(reservation, plan, request) === "intact")
|
|
126
|
+
return reservation;
|
|
127
|
+
reservation = await input.store.retryMissingCompleted({ generation: reservation.generation,
|
|
128
|
+
operation_handle: reservation.receipt.operation_handle, request_digest: reservation.receipt.request_digest });
|
|
129
|
+
mayJoin = true;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (reservation.kind === "pending" && mayJoin) {
|
|
133
|
+
const waited = await input.store.awaitReplay({ idempotency_key: request.idempotency_key,
|
|
134
|
+
maximum_wait_ms: 30_000, request_digest: createTargetLocalBundleRequestDigest(request) });
|
|
135
|
+
if (waited.status !== "completed")
|
|
136
|
+
return reservation;
|
|
137
|
+
reservation = await input.store.reserve(request);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
return reservation;
|
|
141
|
+
}
|
|
142
|
+
return fail();
|
|
143
|
+
};
|
|
144
|
+
const buildOwner = async (request, plan, owner) => {
|
|
145
|
+
const archive = parseContainerBundleArchive(Buffer.from(request.archive_base64, "base64"), request.archive_entries, request.archive_digest);
|
|
146
|
+
validateContainerBundleEnvelope(archive, plan);
|
|
147
|
+
let buildLease = await input.store.beginBuild({ lease: owner.lease });
|
|
148
|
+
const daemonEpoch = await attest(request);
|
|
149
|
+
const expected = targetLocalBundleLabels(plan, daemonEpoch, owner.request_digest);
|
|
150
|
+
buildLease = await input.store.renew({ lease: buildLease });
|
|
151
|
+
const heartbeated = await withHeartbeat(buildLease, () => input.builder.build({ archive, base_image_config_digest: plan.base_image_config_digest,
|
|
152
|
+
entrypoint: plan.entrypoint, gc_tag: targetLocalBundleGcTag(owner.request_digest), labels: expected, platform: plan.platform }));
|
|
153
|
+
buildLease = heartbeated.lease;
|
|
154
|
+
const built = heartbeated.value;
|
|
155
|
+
buildLease = await input.store.renew({ lease: buildLease });
|
|
156
|
+
if (!/^sha256:[a-f0-9]{64}$/u.test(built.config_id) || !exactLabels(built.labels, expected) || !same(built.platform, plan.platform)
|
|
157
|
+
|| await attest(request) !== daemonEpoch) {
|
|
158
|
+
await input.store.markIncomplete({ lease: buildLease, operation_handle: owner.operation_handle, request_digest: owner.request_digest });
|
|
159
|
+
fail();
|
|
160
|
+
}
|
|
161
|
+
const privateMapping = mapping(plan, request, daemonEpoch, owner, built.config_id);
|
|
162
|
+
const postbuildLease = await input.store.stagePostbuild({ lease: buildLease, mapping: privateMapping });
|
|
163
|
+
try {
|
|
164
|
+
await attestTargetLocalBundleMapping(input.builder, privateMapping);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
await input.store.markIncomplete({ lease: postbuildLease, operation_handle: owner.operation_handle, request_digest: owner.request_digest });
|
|
168
|
+
fail();
|
|
169
|
+
}
|
|
170
|
+
return input.store.complete({ lease: postbuildLease, mapping: privateMapping,
|
|
171
|
+
receipt: receipt(request, owner.request_digest, owner.operation_handle, mappingHandle(owner.operation_handle, owner.request_digest)) });
|
|
172
|
+
};
|
|
173
|
+
const completePostbuild = async (request, plan, owner) => {
|
|
174
|
+
const recovered = owner.mapping;
|
|
175
|
+
if (recovered === undefined || owner.state !== "postbuild")
|
|
176
|
+
return fail();
|
|
177
|
+
const daemonEpoch = await attest(request);
|
|
178
|
+
if (!compatibleMapping(recovered, plan, request, owner.request_digest) || recovered.daemon_epoch !== daemonEpoch)
|
|
179
|
+
fail();
|
|
180
|
+
await attestTargetLocalBundleMapping(input.builder, recovered);
|
|
181
|
+
return input.store.complete({ lease: owner.lease, mapping: recovered,
|
|
182
|
+
receipt: receipt(request, owner.request_digest, owner.operation_handle, mappingHandle(owner.operation_handle, owner.request_digest)) });
|
|
183
|
+
};
|
|
184
|
+
const recover = async (raw) => {
|
|
185
|
+
const request = parseTargetLocalBundlePrepareRequest(raw);
|
|
186
|
+
const plan = input.authority.authorize(request);
|
|
187
|
+
const reservation = await reserveAttested(request, plan, false);
|
|
188
|
+
if (reservation.kind === "replay")
|
|
189
|
+
return reservation.receipt;
|
|
190
|
+
if (reservation.kind !== "owner")
|
|
191
|
+
fail();
|
|
192
|
+
const owner = reservation;
|
|
193
|
+
if (owner.state === "prebuild")
|
|
194
|
+
return buildOwner(request, plan, owner);
|
|
195
|
+
const recovered = owner.mapping;
|
|
196
|
+
if (owner.state === "inflight" && recovered === undefined) {
|
|
197
|
+
const daemonEpoch = await attest(request);
|
|
198
|
+
const expected = targetLocalBundleLabels(plan, daemonEpoch, owner.request_digest);
|
|
199
|
+
const anchor = await input.builder.inspectAnchor({ gc_tag: targetLocalBundleGcTag(owner.request_digest), labels: expected, platform: plan.platform });
|
|
200
|
+
if (anchor && anchor !== "missing") {
|
|
201
|
+
const adopted = mapping(plan, request, daemonEpoch, owner, anchor.config_id);
|
|
202
|
+
const postbuild = await input.store.stagePostbuild({ lease: owner.lease, mapping: adopted });
|
|
203
|
+
await attestTargetLocalBundleMapping(input.builder, adopted);
|
|
204
|
+
return input.store.complete({ lease: postbuild, mapping: adopted,
|
|
205
|
+
receipt: receipt(request, owner.request_digest, owner.operation_handle, mappingHandle(owner.operation_handle, owner.request_digest)) });
|
|
206
|
+
}
|
|
207
|
+
if (anchor !== "missing")
|
|
208
|
+
fail(); // Existing but non-exact is ambiguous drift, never a retry.
|
|
209
|
+
const retryLease = await input.store.retryPrebuild({ lease: owner.lease });
|
|
210
|
+
return buildOwner(request, plan, { ...owner, lease: retryLease, state: "prebuild" });
|
|
211
|
+
}
|
|
212
|
+
return completePostbuild(request, plan, owner);
|
|
213
|
+
};
|
|
214
|
+
const prepare = async (raw) => {
|
|
215
|
+
const request = parseTargetLocalBundlePrepareRequest(raw);
|
|
216
|
+
const plan = input.authority.authorize(request);
|
|
217
|
+
const reservation = await reserveAttested(request, plan, true);
|
|
218
|
+
if (reservation.kind === "replay")
|
|
219
|
+
return reservation.receipt;
|
|
220
|
+
if (reservation.kind !== "owner")
|
|
221
|
+
fail();
|
|
222
|
+
const owner = reservation;
|
|
223
|
+
if (owner.state === "postbuild")
|
|
224
|
+
return completePostbuild(request, plan, owner);
|
|
225
|
+
/* An expired/reclaimed inflight record is ambiguous; never erase it from a fresh caller. */
|
|
226
|
+
if (owner.state !== "prebuild")
|
|
227
|
+
fail();
|
|
228
|
+
return buildOwner(request, plan, owner);
|
|
229
|
+
};
|
|
230
|
+
/* Join only byte-identical work inside this process; the durable store remains the authority across restarts. */
|
|
231
|
+
const active = new Map();
|
|
232
|
+
const joinedPrepare = async (raw) => {
|
|
233
|
+
const key = createTargetLocalBundleRequestDigest(parseTargetLocalBundlePrepareRequest(raw));
|
|
234
|
+
const prior = active.get(key);
|
|
235
|
+
if (prior)
|
|
236
|
+
return prior;
|
|
237
|
+
const task = prepare(raw).finally(() => { if (active.get(key) === task)
|
|
238
|
+
active.delete(key); });
|
|
239
|
+
active.set(key, task);
|
|
240
|
+
return task;
|
|
241
|
+
};
|
|
242
|
+
return Object.freeze({ lookup: (value) => input.store.lookup(value), prepare: joinedPrepare, recover });
|
|
243
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ContainerBundleArchiveEntry {
|
|
2
|
+
readonly bytes: Uint8Array;
|
|
3
|
+
readonly path: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ParsedContainerBundleArchive {
|
|
6
|
+
readonly bytes: Uint8Array;
|
|
7
|
+
readonly entries: readonly ContainerBundleArchiveEntry[];
|
|
8
|
+
}
|
|
9
|
+
export interface ContainerBundleEnvelopeClaims {
|
|
10
|
+
readonly artifact_digest: string;
|
|
11
|
+
readonly build_policy_digest: string;
|
|
12
|
+
readonly bundle_digest: string;
|
|
13
|
+
readonly entrypoint: string;
|
|
14
|
+
readonly launcher_digest: string;
|
|
15
|
+
readonly network_alias: string;
|
|
16
|
+
readonly platform: {
|
|
17
|
+
readonly architecture: "amd64" | "arm64";
|
|
18
|
+
readonly os: "linux";
|
|
19
|
+
};
|
|
20
|
+
readonly platform_digest: string;
|
|
21
|
+
}
|
|
22
|
+
/** Validates an uncompressed canonical USTAR bundle before Docker ever receives it. */
|
|
23
|
+
export declare const parseContainerBundleArchive: (raw: unknown, allowedPaths: readonly string[], expectedDigest: string) => ParsedContainerBundleArchive;
|
|
24
|
+
/**
|
|
25
|
+
* The versioned preparation request is the sealed deployment envelope.
|
|
26
|
+
* The archive digest already commits every byte. The artifact digest is an
|
|
27
|
+
* owner-defined semantic identity (for example, a manifest digest), while the
|
|
28
|
+
* launcher is the one generic executable role whose raw bytes Spawnfile can
|
|
29
|
+
* and must verify without interpreting provider-private contents.
|
|
30
|
+
*/
|
|
31
|
+
export declare const validateContainerBundleEnvelope: (archive: ParsedContainerBundleArchive, claims: ContainerBundleEnvelopeClaims) => void;
|