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,80 @@
|
|
|
1
|
+
import { type OpaqueTargetHandle } from "./contracts.js";
|
|
2
|
+
export declare const WORLD_SERVICE_AUTHORIZATION_VERSION: "spawnfile.target-world-service.authorization.v1";
|
|
3
|
+
export declare const WORLD_SERVICE_ERROR = "Docker world-service lifecycle failed";
|
|
4
|
+
export interface WorldServiceAuthorization {
|
|
5
|
+
readonly data_network_handle: OpaqueTargetHandle;
|
|
6
|
+
readonly descriptor_digest: string;
|
|
7
|
+
readonly evidence_mount_path: string;
|
|
8
|
+
readonly evidence_volume_handle: OpaqueTargetHandle;
|
|
9
|
+
readonly operation_handle: OpaqueTargetHandle;
|
|
10
|
+
readonly request_digest: string;
|
|
11
|
+
readonly run_id: string;
|
|
12
|
+
readonly secret_bindings_handle: OpaqueTargetHandle;
|
|
13
|
+
readonly selected_target: {
|
|
14
|
+
readonly fingerprint: string;
|
|
15
|
+
readonly handle: OpaqueTargetHandle;
|
|
16
|
+
};
|
|
17
|
+
readonly version: typeof WORLD_SERVICE_AUTHORIZATION_VERSION;
|
|
18
|
+
readonly world_artifact_handle: OpaqueTargetHandle;
|
|
19
|
+
}
|
|
20
|
+
export interface ResolvedOciWorldArtifactBinding {
|
|
21
|
+
readonly artifact_manifest_digest: string;
|
|
22
|
+
/** Legacy in-memory fixtures may omit this; parsed authority packets may not. */
|
|
23
|
+
readonly identity_kind?: "oci_image_manifest";
|
|
24
|
+
readonly image_digest: string;
|
|
25
|
+
readonly image_reference: string;
|
|
26
|
+
readonly operation_handle: OpaqueTargetHandle;
|
|
27
|
+
readonly request_digest: string;
|
|
28
|
+
readonly result_handle: OpaqueTargetHandle;
|
|
29
|
+
}
|
|
30
|
+
export interface ResolvedConfigWorldArtifactBinding {
|
|
31
|
+
readonly archive_digest: string;
|
|
32
|
+
readonly artifact_manifest_digest: string;
|
|
33
|
+
readonly base_image_config_digest: string;
|
|
34
|
+
readonly build_policy_digest: string;
|
|
35
|
+
readonly bundle_digest: string;
|
|
36
|
+
readonly config_id: string;
|
|
37
|
+
readonly daemon_epoch: string;
|
|
38
|
+
readonly entrypoint: string;
|
|
39
|
+
readonly gc_tag: string;
|
|
40
|
+
readonly identity_kind: "docker_image_config_digest";
|
|
41
|
+
readonly image_digest: string;
|
|
42
|
+
readonly image_reference: string;
|
|
43
|
+
readonly launcher_digest: string;
|
|
44
|
+
readonly network_alias: string;
|
|
45
|
+
readonly operation_handle: OpaqueTargetHandle;
|
|
46
|
+
readonly platform: {
|
|
47
|
+
readonly architecture: "amd64" | "arm64";
|
|
48
|
+
readonly os: "linux";
|
|
49
|
+
};
|
|
50
|
+
readonly platform_digest: string;
|
|
51
|
+
readonly prepared_operation_handle: OpaqueTargetHandle;
|
|
52
|
+
readonly prepared_request_digest: string;
|
|
53
|
+
readonly request_digest: string;
|
|
54
|
+
readonly result_handle: OpaqueTargetHandle;
|
|
55
|
+
}
|
|
56
|
+
export type ResolvedWorldArtifactBinding = ResolvedOciWorldArtifactBinding | ResolvedConfigWorldArtifactBinding;
|
|
57
|
+
export interface WorldServiceResolution {
|
|
58
|
+
readonly artifact: ResolvedWorldArtifactBinding;
|
|
59
|
+
readonly authorization: WorldServiceAuthorization;
|
|
60
|
+
}
|
|
61
|
+
export interface WorldServiceResolver {
|
|
62
|
+
resolve(input: {
|
|
63
|
+
readonly authorization: WorldServiceAuthorization;
|
|
64
|
+
readonly signal?: AbortSignal;
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
}
|
|
67
|
+
export declare const createWorldServiceAuthorization: (input: {
|
|
68
|
+
readonly dataNetworkHandle: unknown;
|
|
69
|
+
readonly descriptorDigest: unknown;
|
|
70
|
+
readonly evidenceMountPath: unknown;
|
|
71
|
+
readonly evidenceVolumeHandle: unknown;
|
|
72
|
+
readonly operationHandle: unknown;
|
|
73
|
+
readonly requestDigest: unknown;
|
|
74
|
+
readonly runId: unknown;
|
|
75
|
+
readonly secretBindingsHandle: unknown;
|
|
76
|
+
readonly selectedTarget: unknown;
|
|
77
|
+
readonly worldArtifactHandle: unknown;
|
|
78
|
+
}) => WorldServiceAuthorization;
|
|
79
|
+
export declare const parseWorldServiceAuthorization: (raw: unknown) => WorldServiceAuthorization;
|
|
80
|
+
export declare const parseWorldServiceResolution: (raw: unknown) => WorldServiceResolution;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { assertOrdinaryJsonGraph, parseOpaqueTargetHandle, parseRunId, parseSelectedTargetReceipt } from "./contracts.js";
|
|
2
|
+
import { createDockerArtifactSpec, createDockerConfigArtifactSpec } from "./dockerArtifactsProvider.js";
|
|
3
|
+
export const WORLD_SERVICE_AUTHORIZATION_VERSION = "spawnfile.target-world-service.authorization.v1";
|
|
4
|
+
export const WORLD_SERVICE_ERROR = "Docker world-service lifecycle failed";
|
|
5
|
+
const DIGEST_PATTERN = /^sha256:[a-f0-9]{64}$/u;
|
|
6
|
+
const FINGERPRINT_PATTERN = /^sha256:[a-f0-9]{32}$/u;
|
|
7
|
+
const fail = () => { throw new Error(WORLD_SERVICE_ERROR); };
|
|
8
|
+
const ordinary = (raw) => {
|
|
9
|
+
try {
|
|
10
|
+
assertOrdinaryJsonGraph(raw);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return fail();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const record = (raw) => raw !== null && typeof raw === "object" && !Array.isArray(raw)
|
|
17
|
+
&& Object.getPrototypeOf(raw) === Object.prototype;
|
|
18
|
+
const exactKeys = (raw, expected) => {
|
|
19
|
+
const actual = Object.keys(raw).sort();
|
|
20
|
+
const wanted = [...expected].sort();
|
|
21
|
+
return actual.length === wanted.length
|
|
22
|
+
&& actual.every((key, index) => key === wanted[index]);
|
|
23
|
+
};
|
|
24
|
+
const digest = (raw) => {
|
|
25
|
+
if (typeof raw !== "string" || !DIGEST_PATTERN.test(raw))
|
|
26
|
+
return fail();
|
|
27
|
+
return raw;
|
|
28
|
+
};
|
|
29
|
+
const containerPath = (raw) => {
|
|
30
|
+
if (typeof raw !== "string" || raw.length > 255
|
|
31
|
+
|| !/^\/(?:run|var\/lib)\/[A-Za-z0-9][A-Za-z0-9._/-]*$/u.test(raw) || raw.includes("//")
|
|
32
|
+
|| raw.endsWith("/") || raw.split("/").some((part) => part === "." || part === "..")
|
|
33
|
+
|| raw === "/run/spawnfile-secrets" || raw.startsWith("/run/spawnfile-secrets/")
|
|
34
|
+
|| "/run/spawnfile-secrets".startsWith(`${raw}/`))
|
|
35
|
+
return fail();
|
|
36
|
+
return raw;
|
|
37
|
+
};
|
|
38
|
+
export const createWorldServiceAuthorization = (input) => {
|
|
39
|
+
try {
|
|
40
|
+
const selected = parseSelectedTargetReceipt({
|
|
41
|
+
...(record(input.selectedTarget) ? input.selectedTarget : {}),
|
|
42
|
+
version: "spawnfile.target-resource.selected-target.v1"
|
|
43
|
+
});
|
|
44
|
+
return Object.freeze({
|
|
45
|
+
data_network_handle: parseOpaqueTargetHandle(input.dataNetworkHandle),
|
|
46
|
+
descriptor_digest: digest(input.descriptorDigest),
|
|
47
|
+
evidence_mount_path: containerPath(input.evidenceMountPath),
|
|
48
|
+
evidence_volume_handle: parseOpaqueTargetHandle(input.evidenceVolumeHandle),
|
|
49
|
+
operation_handle: parseOpaqueTargetHandle(input.operationHandle),
|
|
50
|
+
request_digest: digest(input.requestDigest),
|
|
51
|
+
run_id: parseRunId(input.runId),
|
|
52
|
+
secret_bindings_handle: parseOpaqueTargetHandle(input.secretBindingsHandle),
|
|
53
|
+
selected_target: Object.freeze({
|
|
54
|
+
fingerprint: selected.fingerprint,
|
|
55
|
+
handle: selected.handle
|
|
56
|
+
}),
|
|
57
|
+
version: WORLD_SERVICE_AUTHORIZATION_VERSION,
|
|
58
|
+
world_artifact_handle: parseOpaqueTargetHandle(input.worldArtifactHandle)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return fail();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export const parseWorldServiceAuthorization = (raw) => {
|
|
66
|
+
try {
|
|
67
|
+
ordinary(raw);
|
|
68
|
+
if (!record(raw) || !exactKeys(raw, [
|
|
69
|
+
"data_network_handle", "descriptor_digest", "evidence_mount_path", "evidence_volume_handle",
|
|
70
|
+
"operation_handle", "request_digest", "run_id", "secret_bindings_handle",
|
|
71
|
+
"selected_target", "version", "world_artifact_handle"
|
|
72
|
+
]) || raw.version !== WORLD_SERVICE_AUTHORIZATION_VERSION
|
|
73
|
+
|| !record(raw.selected_target)
|
|
74
|
+
|| !exactKeys(raw.selected_target, ["fingerprint", "handle"])
|
|
75
|
+
|| typeof raw.selected_target.fingerprint !== "string"
|
|
76
|
+
|| !FINGERPRINT_PATTERN.test(raw.selected_target.fingerprint))
|
|
77
|
+
return fail();
|
|
78
|
+
return createWorldServiceAuthorization({
|
|
79
|
+
dataNetworkHandle: raw.data_network_handle,
|
|
80
|
+
descriptorDigest: raw.descriptor_digest,
|
|
81
|
+
evidenceMountPath: raw.evidence_mount_path,
|
|
82
|
+
evidenceVolumeHandle: raw.evidence_volume_handle,
|
|
83
|
+
operationHandle: raw.operation_handle,
|
|
84
|
+
requestDigest: raw.request_digest,
|
|
85
|
+
runId: raw.run_id,
|
|
86
|
+
secretBindingsHandle: raw.secret_bindings_handle,
|
|
87
|
+
selectedTarget: raw.selected_target,
|
|
88
|
+
worldArtifactHandle: raw.world_artifact_handle
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return fail();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const parseArtifact = (raw, authorization) => {
|
|
96
|
+
if (!record(raw) || raw.identity_kind !== undefined && typeof raw.identity_kind !== "string")
|
|
97
|
+
return fail();
|
|
98
|
+
let artifact;
|
|
99
|
+
let spec;
|
|
100
|
+
try {
|
|
101
|
+
if (raw.identity_kind === "oci_image_manifest" || raw.identity_kind === undefined) {
|
|
102
|
+
const legacy = raw.identity_kind === undefined;
|
|
103
|
+
if (!exactKeys(raw, legacy ? ["artifact_manifest_digest", "image_digest", "image_reference", "operation_handle", "request_digest", "result_handle"]
|
|
104
|
+
: ["artifact_manifest_digest", "identity_kind", "image_digest", "image_reference", "operation_handle", "request_digest", "result_handle"]))
|
|
105
|
+
return fail();
|
|
106
|
+
artifact = Object.freeze({ artifact_manifest_digest: digest(raw.artifact_manifest_digest),
|
|
107
|
+
identity_kind: "oci_image_manifest", image_digest: digest(raw.image_digest),
|
|
108
|
+
image_reference: typeof raw.image_reference === "string" ? raw.image_reference : fail(),
|
|
109
|
+
operation_handle: parseOpaqueTargetHandle(raw.operation_handle), request_digest: digest(raw.request_digest),
|
|
110
|
+
result_handle: parseOpaqueTargetHandle(raw.result_handle) });
|
|
111
|
+
spec = createDockerArtifactSpec({ artifactManifestDigest: artifact.artifact_manifest_digest,
|
|
112
|
+
imageDigest: artifact.image_digest, imageReference: artifact.image_reference,
|
|
113
|
+
operationHandle: artifact.operation_handle, requestDigest: artifact.request_digest,
|
|
114
|
+
selectedTargetHandle: authorization.selected_target.handle });
|
|
115
|
+
}
|
|
116
|
+
else if (raw.identity_kind === "docker_image_config_digest") {
|
|
117
|
+
if (!exactKeys(raw, ["archive_digest", "artifact_manifest_digest", "base_image_config_digest",
|
|
118
|
+
"build_policy_digest", "bundle_digest", "config_id", "daemon_epoch", "entrypoint", "gc_tag", "identity_kind",
|
|
119
|
+
"image_digest", "image_reference", "launcher_digest", "network_alias", "operation_handle", "platform",
|
|
120
|
+
"platform_digest", "prepared_operation_handle", "prepared_request_digest", "request_digest", "result_handle"]))
|
|
121
|
+
return fail();
|
|
122
|
+
const configId = digest(raw.config_id);
|
|
123
|
+
const platform = raw.platform;
|
|
124
|
+
if (!record(platform) || !exactKeys(platform, ["architecture", "os"])
|
|
125
|
+
|| (platform.architecture !== "amd64" && platform.architecture !== "arm64") || platform.os !== "linux"
|
|
126
|
+
|| typeof raw.entrypoint !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._/-]{0,239}$/u.test(raw.entrypoint)
|
|
127
|
+
|| raw.entrypoint.includes("//") || raw.entrypoint.split("/").some((part) => part === "." || part === "..")
|
|
128
|
+
|| typeof raw.network_alias !== "string" || !/^[a-z][a-z0-9-]{0,62}$/u.test(raw.network_alias))
|
|
129
|
+
return fail();
|
|
130
|
+
artifact = Object.freeze({ archive_digest: digest(raw.archive_digest),
|
|
131
|
+
artifact_manifest_digest: digest(raw.artifact_manifest_digest),
|
|
132
|
+
base_image_config_digest: digest(raw.base_image_config_digest),
|
|
133
|
+
build_policy_digest: digest(raw.build_policy_digest), bundle_digest: digest(raw.bundle_digest),
|
|
134
|
+
config_id: configId, daemon_epoch: digest(raw.daemon_epoch), entrypoint: raw.entrypoint,
|
|
135
|
+
gc_tag: typeof raw.gc_tag === "string" && /^spfb_[a-f0-9]{58}$/u.test(raw.gc_tag) ? raw.gc_tag : fail(),
|
|
136
|
+
identity_kind: "docker_image_config_digest",
|
|
137
|
+
image_digest: digest(raw.image_digest), image_reference: typeof raw.image_reference === "string" ? raw.image_reference : fail(),
|
|
138
|
+
launcher_digest: digest(raw.launcher_digest), network_alias: raw.network_alias,
|
|
139
|
+
operation_handle: parseOpaqueTargetHandle(raw.operation_handle), request_digest: digest(raw.request_digest),
|
|
140
|
+
prepared_operation_handle: parseOpaqueTargetHandle(raw.prepared_operation_handle),
|
|
141
|
+
prepared_request_digest: digest(raw.prepared_request_digest),
|
|
142
|
+
result_handle: parseOpaqueTargetHandle(raw.result_handle),
|
|
143
|
+
platform: Object.freeze({ architecture: platform.architecture, os: platform.os }),
|
|
144
|
+
platform_digest: digest(raw.platform_digest) });
|
|
145
|
+
if (artifact.image_digest !== configId || artifact.image_reference !== configId)
|
|
146
|
+
return fail();
|
|
147
|
+
spec = createDockerConfigArtifactSpec({ archiveDigest: artifact.archive_digest,
|
|
148
|
+
artifactManifestDigest: artifact.artifact_manifest_digest,
|
|
149
|
+
baseImageConfigDigest: artifact.base_image_config_digest,
|
|
150
|
+
buildPolicyDigest: artifact.build_policy_digest, bundleDigest: artifact.bundle_digest,
|
|
151
|
+
configId, daemonEpoch: artifact.daemon_epoch, entrypoint: artifact.entrypoint,
|
|
152
|
+
launcherDigest: artifact.launcher_digest, networkAlias: artifact.network_alias,
|
|
153
|
+
operationHandle: artifact.operation_handle, requestDigest: artifact.request_digest,
|
|
154
|
+
selectedTargetHandle: authorization.selected_target.handle, platform: artifact.platform,
|
|
155
|
+
platformDigest: artifact.platform_digest });
|
|
156
|
+
}
|
|
157
|
+
else
|
|
158
|
+
return fail();
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return fail();
|
|
162
|
+
}
|
|
163
|
+
if (spec.resultHandle !== artifact.result_handle
|
|
164
|
+
|| artifact.result_handle !== authorization.world_artifact_handle)
|
|
165
|
+
return fail();
|
|
166
|
+
return artifact;
|
|
167
|
+
};
|
|
168
|
+
export const parseWorldServiceResolution = (raw) => {
|
|
169
|
+
try {
|
|
170
|
+
ordinary(raw);
|
|
171
|
+
if (!record(raw) || !exactKeys(raw, ["artifact", "authorization"]))
|
|
172
|
+
return fail();
|
|
173
|
+
const authorization = parseWorldServiceAuthorization(raw.authorization);
|
|
174
|
+
return Object.freeze({
|
|
175
|
+
artifact: parseArtifact(raw.artifact, authorization),
|
|
176
|
+
authorization
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return fail();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type OpaqueTargetHandle, type TargetResourceReceipt, type TargetResourceRequest } from "./contracts.js";
|
|
2
|
+
import { type TargetJournalClaim, type TargetJournalStore } from "./journal.js";
|
|
3
|
+
import { type WorldServiceResolution, type WorldServiceResolver } from "./dockerWorldServiceAuthority.js";
|
|
4
|
+
import { type DockerWorldServiceExecutor, type DockerWorldServiceInspection, type DockerWorldServiceSpec } from "./dockerWorldServiceProvider.js";
|
|
5
|
+
import { type WorldServiceAuthorityStore, type WorldServiceBinding } from "./dockerWorldServiceStore.js";
|
|
6
|
+
type ServiceRequest = Extract<TargetResourceRequest, {
|
|
7
|
+
operation: "create_world_service" | "start_world_service" | "stop_world_service";
|
|
8
|
+
}>;
|
|
9
|
+
type CreateRequest = Extract<ServiceRequest, {
|
|
10
|
+
operation: "create_world_service";
|
|
11
|
+
}>;
|
|
12
|
+
export interface WorldServiceCleanupContext {
|
|
13
|
+
readonly context: string;
|
|
14
|
+
readonly executor: DockerWorldServiceExecutor;
|
|
15
|
+
readonly signal?: AbortSignal;
|
|
16
|
+
readonly timeoutMs: number;
|
|
17
|
+
}
|
|
18
|
+
export interface WorldServiceLifecycleContext extends WorldServiceCleanupContext {
|
|
19
|
+
readonly authorityStore: WorldServiceAuthorityStore;
|
|
20
|
+
readonly journal: TargetJournalStore;
|
|
21
|
+
readonly resolver: WorldServiceResolver;
|
|
22
|
+
}
|
|
23
|
+
export declare const sameWorldServiceValue: (left: unknown, right: unknown) => boolean;
|
|
24
|
+
export declare const selectedWorldServiceContextMatches: (request: ServiceRequest, options: WorldServiceLifecycleContext) => Promise<void>;
|
|
25
|
+
export declare const resolveWorldServiceCreate: (request: CreateRequest, claim: TargetJournalClaim, options: WorldServiceLifecycleContext) => Promise<{
|
|
26
|
+
readonly resolution: WorldServiceResolution;
|
|
27
|
+
readonly resources: WorldServiceBinding["resources"];
|
|
28
|
+
}>;
|
|
29
|
+
export declare const verifyWorldServiceResources: (binding: Pick<WorldServiceBinding, "resolution" | "resources">, options: WorldServiceLifecycleContext) => Promise<void>;
|
|
30
|
+
export declare const worldServiceSpecForBinding: (binding: Pick<WorldServiceBinding, "resolution" | "resources">) => DockerWorldServiceSpec;
|
|
31
|
+
export declare const inspectDockerWorldService: (reference: string, spec: DockerWorldServiceSpec, options: WorldServiceCleanupContext) => Promise<DockerWorldServiceInspection | null>;
|
|
32
|
+
export declare const mutateDockerWorldService: (args: string[], options: WorldServiceCleanupContext) => Promise<string>;
|
|
33
|
+
export declare const removeExactDockerWorldService: (rawBinding: unknown, options: WorldServiceCleanupContext) => Promise<void>;
|
|
34
|
+
export declare const createWorldServiceReceipt: (input: {
|
|
35
|
+
readonly claim: TargetJournalClaim;
|
|
36
|
+
readonly journal: TargetJournalStore;
|
|
37
|
+
readonly labels: Readonly<Record<string, string>>;
|
|
38
|
+
readonly request: ServiceRequest;
|
|
39
|
+
readonly resultHandle: OpaqueTargetHandle | null;
|
|
40
|
+
}) => Promise<TargetResourceReceipt>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
2
|
+
import { selectTarget } from "./dockerTarget.js";
|
|
3
|
+
import { createTargetReceiptDigest } from "./handles.js";
|
|
4
|
+
import { createDockerResourceSpec, executeDockerResource, isExpectedDockerResource } from "./dockerResourcesProvider.js";
|
|
5
|
+
import { createExistingDockerSecretSpec, executeDockerSecretCommand, isExpectedDockerSecretVolume } from "./dockerSecretsProvider.js";
|
|
6
|
+
import { WORLD_SERVICE_ERROR, createWorldServiceAuthorization, parseWorldServiceResolution } from "./dockerWorldServiceAuthority.js";
|
|
7
|
+
import { DockerWorldServiceProviderError, createDockerWorldServiceSpec, executeDockerWorldService, parseExpectedDockerWorldService } from "./dockerWorldServiceProvider.js";
|
|
8
|
+
import { parseWorldServiceBinding, worldServiceResourceBindings } from "./dockerWorldServiceStore.js";
|
|
9
|
+
const fail = () => {
|
|
10
|
+
throw new SpawnfileError("runtime_error", WORLD_SERVICE_ERROR);
|
|
11
|
+
};
|
|
12
|
+
export const sameWorldServiceValue = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
13
|
+
export const selectedWorldServiceContextMatches = async (request, options) => {
|
|
14
|
+
const selected = await selectTarget({
|
|
15
|
+
context: options.context,
|
|
16
|
+
dockerCommand: "docker",
|
|
17
|
+
execFile: async (_file, args, commandOptions) => executeDockerWorldService({
|
|
18
|
+
args,
|
|
19
|
+
executor: options.executor,
|
|
20
|
+
signal: commandOptions.signal,
|
|
21
|
+
timeoutMs: commandOptions.timeout
|
|
22
|
+
}),
|
|
23
|
+
signal: options.signal,
|
|
24
|
+
timeoutMs: options.timeoutMs
|
|
25
|
+
});
|
|
26
|
+
if (!sameWorldServiceValue({ fingerprint: selected.fingerprint, handle: selected.handle }, request.selected_target))
|
|
27
|
+
return fail();
|
|
28
|
+
};
|
|
29
|
+
const findResourceClaim = async (input) => {
|
|
30
|
+
const operation = input.kind === "data_network"
|
|
31
|
+
? "create_data_network" : "create_evidence_volume";
|
|
32
|
+
const journal = await input.journal.read();
|
|
33
|
+
const matches = journal.entries.filter((entry) => {
|
|
34
|
+
if (entry.operation !== operation || entry.state !== "completed")
|
|
35
|
+
return false;
|
|
36
|
+
try {
|
|
37
|
+
return createDockerResourceSpec({
|
|
38
|
+
kind: input.kind,
|
|
39
|
+
operationHandle: entry.operation_handle,
|
|
40
|
+
requestDigest: entry.request_digest,
|
|
41
|
+
runId: input.runId,
|
|
42
|
+
selectedTargetHandle: input.selectedTargetHandle
|
|
43
|
+
}).resultHandle === input.handle;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
if (matches.length !== 1)
|
|
50
|
+
return fail();
|
|
51
|
+
return {
|
|
52
|
+
operationHandle: matches[0].operation_handle,
|
|
53
|
+
requestDigest: matches[0].request_digest
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export const resolveWorldServiceCreate = async (request, claim, options) => {
|
|
57
|
+
const authorization = createWorldServiceAuthorization({
|
|
58
|
+
dataNetworkHandle: request.data_network_handle,
|
|
59
|
+
descriptorDigest: request.descriptor_digest,
|
|
60
|
+
evidenceMountPath: request.evidence_mount_path,
|
|
61
|
+
evidenceVolumeHandle: request.evidence_volume_handle,
|
|
62
|
+
operationHandle: claim.operationHandle,
|
|
63
|
+
requestDigest: claim.requestDigest,
|
|
64
|
+
runId: request.run_id,
|
|
65
|
+
secretBindingsHandle: request.secret_bindings_handle,
|
|
66
|
+
selectedTarget: request.selected_target,
|
|
67
|
+
worldArtifactHandle: request.world_artifact_handle
|
|
68
|
+
});
|
|
69
|
+
const resolution = parseWorldServiceResolution(await options.resolver.resolve({
|
|
70
|
+
authorization,
|
|
71
|
+
signal: options.signal
|
|
72
|
+
}));
|
|
73
|
+
if (!sameWorldServiceValue(resolution.authorization, authorization))
|
|
74
|
+
return fail();
|
|
75
|
+
const journal = await options.journal.read();
|
|
76
|
+
const artifactClaims = journal.entries.filter((entry) => entry.operation === "resolve_world_artifact" && entry.state === "completed"
|
|
77
|
+
&& entry.operation_handle === resolution.artifact.operation_handle
|
|
78
|
+
&& entry.request_digest === resolution.artifact.request_digest);
|
|
79
|
+
if (artifactClaims.length !== 1)
|
|
80
|
+
return fail();
|
|
81
|
+
const dataNetworkClaim = await findResourceClaim({
|
|
82
|
+
handle: request.data_network_handle,
|
|
83
|
+
journal: options.journal,
|
|
84
|
+
kind: "data_network",
|
|
85
|
+
runId: request.run_id,
|
|
86
|
+
selectedTargetHandle: request.selected_target.handle
|
|
87
|
+
});
|
|
88
|
+
const evidenceVolumeClaim = await findResourceClaim({
|
|
89
|
+
handle: request.evidence_volume_handle,
|
|
90
|
+
journal: options.journal,
|
|
91
|
+
kind: "evidence_volume",
|
|
92
|
+
runId: request.run_id,
|
|
93
|
+
selectedTargetHandle: request.selected_target.handle
|
|
94
|
+
});
|
|
95
|
+
const resources = worldServiceResourceBindings({
|
|
96
|
+
dataNetworkClaim,
|
|
97
|
+
evidenceVolumeClaim,
|
|
98
|
+
resolution
|
|
99
|
+
});
|
|
100
|
+
await options.authorityStore.bindResolution(resolution);
|
|
101
|
+
return { resolution, resources };
|
|
102
|
+
};
|
|
103
|
+
export const verifyWorldServiceResources = async (binding, options) => {
|
|
104
|
+
const authorization = binding.resolution.authorization;
|
|
105
|
+
for (const [kind, resource] of [
|
|
106
|
+
["data_network", binding.resources.data_network],
|
|
107
|
+
["evidence_volume", binding.resources.evidence_volume]
|
|
108
|
+
]) {
|
|
109
|
+
const claim = await findResourceClaim({
|
|
110
|
+
handle: resource.handle,
|
|
111
|
+
journal: options.journal,
|
|
112
|
+
kind,
|
|
113
|
+
runId: authorization.run_id,
|
|
114
|
+
selectedTargetHandle: authorization.selected_target.handle
|
|
115
|
+
});
|
|
116
|
+
const spec = createDockerResourceSpec({
|
|
117
|
+
kind,
|
|
118
|
+
...claim,
|
|
119
|
+
runId: authorization.run_id,
|
|
120
|
+
selectedTargetHandle: authorization.selected_target.handle
|
|
121
|
+
});
|
|
122
|
+
const result = await executeDockerResource({
|
|
123
|
+
args: ["--context", options.context,
|
|
124
|
+
kind === "data_network" ? "network" : "volume", "inspect",
|
|
125
|
+
"--format", spec.inspectionFormat, spec.name],
|
|
126
|
+
executor: options.executor,
|
|
127
|
+
signal: options.signal,
|
|
128
|
+
timeoutMs: options.timeoutMs
|
|
129
|
+
});
|
|
130
|
+
if (!isExpectedDockerResource(result.stdout, spec))
|
|
131
|
+
return fail();
|
|
132
|
+
}
|
|
133
|
+
const secretSpec = createExistingDockerSecretSpec({
|
|
134
|
+
bindingsHandle: binding.resources.secret_bindings.handle,
|
|
135
|
+
runId: authorization.run_id,
|
|
136
|
+
selectedTargetHandle: authorization.selected_target.handle
|
|
137
|
+
});
|
|
138
|
+
const secret = await executeDockerSecretCommand({
|
|
139
|
+
args: ["--context", options.context, "volume", "inspect", "--format",
|
|
140
|
+
secretSpec.volumeInspectionFormat, secretSpec.volumeName],
|
|
141
|
+
executor: options.executor,
|
|
142
|
+
signal: options.signal,
|
|
143
|
+
timeoutMs: options.timeoutMs
|
|
144
|
+
});
|
|
145
|
+
if (!isExpectedDockerSecretVolume(secret.stdout, secretSpec))
|
|
146
|
+
return fail();
|
|
147
|
+
};
|
|
148
|
+
export const worldServiceSpecForBinding = (binding) => {
|
|
149
|
+
const authorization = binding.resolution.authorization;
|
|
150
|
+
return createDockerWorldServiceSpec({
|
|
151
|
+
dataNetwork: binding.resources.data_network,
|
|
152
|
+
evidenceMountPath: authorization.evidence_mount_path,
|
|
153
|
+
evidenceVolume: binding.resources.evidence_volume,
|
|
154
|
+
imageDigest: binding.resolution.artifact.image_digest,
|
|
155
|
+
imageReference: binding.resolution.artifact.image_reference,
|
|
156
|
+
operationHandle: authorization.operation_handle,
|
|
157
|
+
requestDigest: authorization.request_digest,
|
|
158
|
+
runId: authorization.run_id,
|
|
159
|
+
secretBindings: binding.resources.secret_bindings,
|
|
160
|
+
selectedTargetHandle: authorization.selected_target.handle,
|
|
161
|
+
...(binding.resolution.artifact.identity_kind === "docker_image_config_digest"
|
|
162
|
+
? { networkAlias: binding.resolution.artifact.network_alias } : {})
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
export const inspectDockerWorldService = async (reference, spec, options) => {
|
|
166
|
+
try {
|
|
167
|
+
const result = await executeDockerWorldService({
|
|
168
|
+
args: ["--context", options.context, "container", "inspect", "--format",
|
|
169
|
+
spec.inspectionFormat, reference],
|
|
170
|
+
executor: options.executor,
|
|
171
|
+
signal: options.signal,
|
|
172
|
+
timeoutMs: options.timeoutMs
|
|
173
|
+
});
|
|
174
|
+
return parseExpectedDockerWorldService(result.stdout, spec) ?? fail();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error instanceof DockerWorldServiceProviderError && error.kind === "not_found") {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
export const mutateDockerWorldService = async (args, options) => {
|
|
184
|
+
const result = await executeDockerWorldService({
|
|
185
|
+
args: ["--context", options.context, ...args],
|
|
186
|
+
executor: options.executor,
|
|
187
|
+
signal: options.signal,
|
|
188
|
+
timeoutMs: options.timeoutMs
|
|
189
|
+
});
|
|
190
|
+
if (result.stderr !== "")
|
|
191
|
+
return fail();
|
|
192
|
+
return result.stdout;
|
|
193
|
+
};
|
|
194
|
+
const activeWorldStatus = (status) => status === "running" || status === "paused" || status === "restarting";
|
|
195
|
+
const exactWorldAck = (value, containerId) => value === `${containerId}\n`;
|
|
196
|
+
const inspectedWorld = async (binding, spec, options) => {
|
|
197
|
+
const current = await inspectDockerWorldService(binding.container_id, spec, options);
|
|
198
|
+
if (current && current.containerId !== binding.container_id)
|
|
199
|
+
return fail();
|
|
200
|
+
return current;
|
|
201
|
+
};
|
|
202
|
+
export const removeExactDockerWorldService = async (rawBinding, options) => {
|
|
203
|
+
try {
|
|
204
|
+
if (!options || typeof options.context !== "string"
|
|
205
|
+
|| !/^[a-z][a-z0-9_-]{0,63}$/u.test(options.context)
|
|
206
|
+
|| typeof options.executor !== "function" || !Number.isSafeInteger(options.timeoutMs)
|
|
207
|
+
|| options.timeoutMs < 1 || options.timeoutMs > 120_000)
|
|
208
|
+
return fail();
|
|
209
|
+
const binding = parseWorldServiceBinding(rawBinding);
|
|
210
|
+
const spec = worldServiceSpecForBinding(binding);
|
|
211
|
+
if (spec.resultHandle !== binding.world_service_handle)
|
|
212
|
+
return fail();
|
|
213
|
+
let current = await inspectedWorld(binding, spec, options);
|
|
214
|
+
if (current === null)
|
|
215
|
+
return;
|
|
216
|
+
if (current.status === "removing")
|
|
217
|
+
return fail();
|
|
218
|
+
if (activeWorldStatus(current.status)) {
|
|
219
|
+
let stopError;
|
|
220
|
+
let stopAck;
|
|
221
|
+
try {
|
|
222
|
+
stopAck = await mutateDockerWorldService(["container", "stop", "--timeout", "10", binding.container_id], options);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
stopError = error;
|
|
226
|
+
}
|
|
227
|
+
if (stopAck !== undefined && !exactWorldAck(stopAck, binding.container_id))
|
|
228
|
+
return fail();
|
|
229
|
+
current = await inspectedWorld(binding, spec, options);
|
|
230
|
+
if (current === null)
|
|
231
|
+
return;
|
|
232
|
+
if (activeWorldStatus(current.status) || current.status === "removing") {
|
|
233
|
+
if (stopError)
|
|
234
|
+
throw stopError;
|
|
235
|
+
return fail();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
let removeError;
|
|
239
|
+
let removeAck;
|
|
240
|
+
try {
|
|
241
|
+
removeAck = await mutateDockerWorldService(["container", "rm", binding.container_id], options);
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
removeError = error;
|
|
245
|
+
}
|
|
246
|
+
if (removeAck !== undefined && !exactWorldAck(removeAck, binding.container_id))
|
|
247
|
+
return fail();
|
|
248
|
+
if (await inspectedWorld(binding, spec, options) !== null) {
|
|
249
|
+
if (removeError)
|
|
250
|
+
throw removeError;
|
|
251
|
+
return fail();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
return fail();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
export const createWorldServiceReceipt = async (input) => {
|
|
259
|
+
const raw = {
|
|
260
|
+
cleanup_state: "not_requested",
|
|
261
|
+
descriptor_digest: input.request.descriptor_digest,
|
|
262
|
+
export_state: "not_requested",
|
|
263
|
+
labels: Object.entries(input.labels).map(([key, value]) => ({ key, value })),
|
|
264
|
+
operation: input.request.operation,
|
|
265
|
+
operation_handle: input.claim.operationHandle,
|
|
266
|
+
receipt_digest: `sha256:${"0".repeat(64)}`,
|
|
267
|
+
request_digest: input.claim.requestDigest,
|
|
268
|
+
result_handle: input.resultHandle,
|
|
269
|
+
resulting_revision: (await input.journal.read()).revision + 1,
|
|
270
|
+
run_id: input.request.run_id,
|
|
271
|
+
selected_target: input.request.selected_target,
|
|
272
|
+
version: "spawnfile.target-resource.receipt.v1"
|
|
273
|
+
};
|
|
274
|
+
return { ...raw, receipt_digest: createTargetReceiptDigest(raw) };
|
|
275
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type OpaqueTargetHandle } from "./contracts.js";
|
|
2
|
+
export declare const DOCKER_WORLD_SERVICE_ERROR = "Docker world-service lifecycle failed";
|
|
3
|
+
export declare const WORLD_SECRETS_PATH: "/run/spawnfile-secrets";
|
|
4
|
+
export declare const WORLD_RUNTIME_TMPFS: Readonly<{
|
|
5
|
+
path: "/tmp";
|
|
6
|
+
options: "rw,noexec,nosuid,nodev,size=1m,mode=1777";
|
|
7
|
+
}>;
|
|
8
|
+
export type DockerWorldServiceFailureKind = "collision" | "not_found";
|
|
9
|
+
export interface DockerWorldServiceExecutor {
|
|
10
|
+
(file: string, args: string[], options: {
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
readonly timeout: number;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
readonly stderr: string;
|
|
15
|
+
readonly stdout: string;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export declare class DockerWorldServiceProviderError extends Error {
|
|
19
|
+
readonly kind: DockerWorldServiceFailureKind;
|
|
20
|
+
constructor(kind: DockerWorldServiceFailureKind);
|
|
21
|
+
}
|
|
22
|
+
export interface DockerWorldServiceSpec {
|
|
23
|
+
readonly containerName: string;
|
|
24
|
+
readonly createArgs: readonly string[];
|
|
25
|
+
readonly imageDigest: string;
|
|
26
|
+
readonly imageReference: string;
|
|
27
|
+
readonly evidenceMountPath: string;
|
|
28
|
+
readonly networkAlias?: string;
|
|
29
|
+
readonly inspectionFormat: string;
|
|
30
|
+
readonly receiptLabels: Readonly<Record<string, string>>;
|
|
31
|
+
readonly resultHandle: OpaqueTargetHandle;
|
|
32
|
+
}
|
|
33
|
+
export interface DockerWorldServiceInspection {
|
|
34
|
+
readonly containerId: string;
|
|
35
|
+
readonly networkId: string;
|
|
36
|
+
readonly status: "created" | "dead" | "exited" | "paused" | "removing" | "restarting" | "running";
|
|
37
|
+
}
|
|
38
|
+
export declare const createDockerWorldServiceSpec: (input: {
|
|
39
|
+
readonly operationHandle: unknown;
|
|
40
|
+
readonly requestDigest: unknown;
|
|
41
|
+
readonly runId: unknown;
|
|
42
|
+
readonly selectedTargetHandle: unknown;
|
|
43
|
+
readonly imageReference: unknown;
|
|
44
|
+
readonly imageDigest: unknown;
|
|
45
|
+
readonly dataNetwork: unknown;
|
|
46
|
+
readonly evidenceVolume: unknown;
|
|
47
|
+
readonly evidenceMountPath: unknown;
|
|
48
|
+
readonly secretBindings: unknown;
|
|
49
|
+
readonly networkAlias?: unknown;
|
|
50
|
+
}) => DockerWorldServiceSpec;
|
|
51
|
+
export declare const executeDockerWorldService: (input: {
|
|
52
|
+
readonly args: string[];
|
|
53
|
+
readonly executor: DockerWorldServiceExecutor;
|
|
54
|
+
readonly signal?: AbortSignal;
|
|
55
|
+
readonly timeoutMs: number;
|
|
56
|
+
}) => Promise<{
|
|
57
|
+
readonly stderr: string;
|
|
58
|
+
readonly stdout: string;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const parseExpectedDockerWorldService: (stdout: string, spec: DockerWorldServiceSpec) => DockerWorldServiceInspection | null;
|