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,518 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { constants } from "node:fs";
|
|
4
|
+
import { link, lstat, open, unlink } from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { boundedRedactedText, SpawnfileError } from "../shared/index.js";
|
|
7
|
+
import { parseOpaqueTargetHandle, parseRunId, parseTargetResourceRequest } from "./contracts.js";
|
|
8
|
+
import { selectTarget } from "./dockerTarget.js";
|
|
9
|
+
import { createDockerResourceSpec, executeDockerResource, isExpectedDockerResource } from "./dockerResourcesProvider.js";
|
|
10
|
+
import { createTargetReceiptDigest } from "./handles.js";
|
|
11
|
+
import { EVIDENCE_EXPORT_ERROR, EVIDENCE_EXPORT_HELPER_CONTRACT, assertExportRun, createEvidenceExportHandle, createEvidenceExportHelper, createEvidenceExportHelperSpec, evidenceDigest, evidenceReceiptLabels, executeEvidenceExport, isExpectedEvidenceExportHelper, isExpectedEvidenceExportImage, parseEvidenceExportImageInspection, parseEvidenceVolumeAuthority } from "./evidenceExportProvider.js";
|
|
12
|
+
import { canonicalEvidenceArchive } from "./evidenceExportArchive.js";
|
|
13
|
+
import { createDockerArtifactSpec } from "./dockerArtifactsProvider.js";
|
|
14
|
+
const CONTEXT = /^[a-z][a-z0-9_-]{0,63}$/u;
|
|
15
|
+
const TEMP = /^\.spawnfile-evidence-[a-f0-9]{64}\.pending$/u;
|
|
16
|
+
const fail = () => { throw new SpawnfileError("runtime_error", EVIDENCE_EXPORT_ERROR); };
|
|
17
|
+
const failWithCause = (error) => {
|
|
18
|
+
const summary = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
19
|
+
throw new SpawnfileError("runtime_error", `${EVIDENCE_EXPORT_ERROR}: ${boundedRedactedText(summary)}`, { cause: error });
|
|
20
|
+
};
|
|
21
|
+
/** Internal control outcome: another process owns an exact pending export.
|
|
22
|
+
* It deliberately has no target-receipt/schema representation; callers leave
|
|
23
|
+
* the journal pending and retry after their bounded scheduling interval. */
|
|
24
|
+
export class EvidenceExportIncompleteError extends SpawnfileError {
|
|
25
|
+
incomplete = true;
|
|
26
|
+
constructor() { super("runtime_error", EVIDENCE_EXPORT_ERROR); }
|
|
27
|
+
}
|
|
28
|
+
export const isEvidenceExportIncomplete = (error) => error instanceof EvidenceExportIncompleteError;
|
|
29
|
+
const incomplete = () => { throw new EvidenceExportIncompleteError(); };
|
|
30
|
+
const hook = async (value) => { if (value)
|
|
31
|
+
await value(); };
|
|
32
|
+
const same = (left, right) => JSON.stringify(left) === JSON.stringify(right);
|
|
33
|
+
const options = (raw) => {
|
|
34
|
+
if (typeof raw.context !== "string" || !CONTEXT.test(raw.context) || typeof raw.executor !== "function" || typeof raw.exportExecutor !== "function" || !raw.authorityStore || typeof raw.authorityStore.bindAdmission !== "function" || typeof raw.authorityStore.bindDestination !== "function" || typeof raw.authorityStore.requireDestination !== "function" || typeof raw.authorityStore.claimExport !== "function" || typeof raw.authorityStore.releaseExport !== "function" || typeof raw.authorityStore.loadAdmission !== "function" || typeof raw.authorityStore.loadIndex !== "function" || typeof raw.authorityStore.clearStaleExportClaim !== "function" || !raw.artifactIdentityStore || typeof raw.artifactIdentityStore.resolveOperation !== "function" || !raw.journal || typeof raw.journal.resolveCompletedReceipt !== "function" || typeof raw.timeoutMs !== "undefined" && (!Number.isSafeInteger(raw.timeoutMs) || raw.timeoutMs < 1 || raw.timeoutMs > 120_000))
|
|
35
|
+
return fail();
|
|
36
|
+
const timeoutMs = typeof raw.timeoutMs === "number" ? raw.timeoutMs : 10_000;
|
|
37
|
+
try {
|
|
38
|
+
const rawBundle = raw.helperArtifactBundle;
|
|
39
|
+
if (!rawBundle || typeof rawBundle !== "object" || Array.isArray(rawBundle) || Object.keys(rawBundle).sort().join("\0") !== "operation_handle\0request_digest\0result_handle")
|
|
40
|
+
return fail();
|
|
41
|
+
const bundle = rawBundle;
|
|
42
|
+
const helperArtifactBundle = Object.freeze({ operationHandle: parseOpaqueTargetHandle(bundle.operation_handle), requestDigest: (() => { if (typeof bundle.request_digest !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(bundle.request_digest))
|
|
43
|
+
return fail(); return bundle.request_digest; })(), resultHandle: parseOpaqueTargetHandle(bundle.result_handle) });
|
|
44
|
+
if (typeof raw.helperArtifactManifestDigest !== "string" || !/^sha256:[a-f0-9]{64}$/u.test(raw.helperArtifactManifestDigest) || raw.helperArtifactContract !== EVIDENCE_EXPORT_HELPER_CONTRACT)
|
|
45
|
+
return fail();
|
|
46
|
+
return { authorityStore: raw.authorityStore, context: raw.context, executor: raw.executor, exportExecutor: raw.exportExecutor, helperArtifactBundle, helperArtifactManifestDigest: raw.helperArtifactManifestDigest, helperArtifactContract: EVIDENCE_EXPORT_HELPER_CONTRACT, artifactIdentityStore: raw.artifactIdentityStore, journal: raw.journal, signal: raw.signal, timeoutMs, testHooks: raw.testHooks };
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return fail();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const request = (raw) => { const parsed = parseTargetResourceRequest(raw); if (parsed.operation !== "export_evidence_volume")
|
|
53
|
+
return fail(); return parsed; };
|
|
54
|
+
const recovery = (raw) => { const parsed = parseTargetResourceRequest(raw); if (parsed.operation !== "recover_operation")
|
|
55
|
+
return fail(); return parsed; };
|
|
56
|
+
const selectedContextMatches = async (value, input) => {
|
|
57
|
+
const selected = await selectTarget({ context: input.context, dockerCommand: "docker", execFile: input.executor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
58
|
+
if (!same({ fingerprint: selected.fingerprint, handle: selected.handle }, value.selected_target))
|
|
59
|
+
return fail();
|
|
60
|
+
};
|
|
61
|
+
const authorityFor = async (value, input) => {
|
|
62
|
+
const journal = await input.journal.read();
|
|
63
|
+
if (journal.run_id !== value.run_id || !same(journal.selected_target, value.selected_target) || journal.descriptor_digest !== value.descriptor_digest)
|
|
64
|
+
return fail();
|
|
65
|
+
const entry = journal.entries.find((item) => item.operation === "create_evidence_volume" && item.state === "completed" && createDockerResourceSpec({ kind: "evidence_volume", operationHandle: item.operation_handle, requestDigest: item.request_digest, runId: value.run_id, selectedTargetHandle: value.selected_target.handle }).resultHandle === value.evidence_volume_handle);
|
|
66
|
+
if (!entry)
|
|
67
|
+
return fail();
|
|
68
|
+
const spec = createDockerResourceSpec({ kind: "evidence_volume", operationHandle: entry.operation_handle, requestDigest: entry.request_digest, runId: value.run_id, selectedTargetHandle: value.selected_target.handle });
|
|
69
|
+
const authority = parseEvidenceVolumeAuthority({ labels: spec.labels, name: spec.name, resultHandle: spec.resultHandle });
|
|
70
|
+
assertExportRun(authority, { runId: value.run_id, selectedTargetHandle: value.selected_target.handle });
|
|
71
|
+
return authority;
|
|
72
|
+
};
|
|
73
|
+
const inspectAuthority = async (authority, input) => {
|
|
74
|
+
const spec = createDockerResourceSpec({ kind: "evidence_volume", operationHandle: parseOpaqueTargetHandle("opaque_0000000000000000"), requestDigest: `sha256:${"0".repeat(64)}`, runId: "a", selectedTargetHandle: parseOpaqueTargetHandle("opaque_0000000000000000") });
|
|
75
|
+
const result = await executeDockerResource({ args: ["--context", input.context, "volume", "inspect", "--format", spec.inspectionFormat, authority.name], executor: input.executor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
76
|
+
const expected = { ...spec, labels: authority.labels, name: authority.name, resultHandle: authority.resultHandle };
|
|
77
|
+
if (!isExpectedDockerResource(result.stdout, expected))
|
|
78
|
+
return fail();
|
|
79
|
+
};
|
|
80
|
+
const helperFor = async (value, input) => {
|
|
81
|
+
const bundle = input.helperArtifactBundle;
|
|
82
|
+
const binding = await input.artifactIdentityStore.resolveOperation(bundle.operationHandle, bundle.requestDigest);
|
|
83
|
+
const journal = await input.journal.read();
|
|
84
|
+
const completed = binding ? await input.journal.resolveCompletedReceipt({ operationHandle: binding.operationHandle, requestDigest: binding.requestDigest }) : null;
|
|
85
|
+
if (!binding || binding.identityKind !== "oci_image_manifest" || !completed || binding.operationHandle !== bundle.operationHandle || binding.requestDigest !== bundle.requestDigest || binding.resultHandle !== bundle.resultHandle || binding.artifactManifestDigest !== input.helperArtifactManifestDigest || binding.selectedTargetHandle !== value.selected_target.handle || journal.run_id !== value.run_id || journal.descriptor_digest !== value.descriptor_digest || !same(journal.selected_target, value.selected_target) || completed.receipt.operation !== "resolve_world_artifact" || completed.receipt.result_handle !== bundle.resultHandle || completed.receipt.operation_handle !== bundle.operationHandle || completed.receipt.request_digest !== bundle.requestDigest || completed.receipt.run_id !== value.run_id || completed.receipt.descriptor_digest !== value.descriptor_digest || !same(completed.receipt.selected_target, value.selected_target))
|
|
86
|
+
return fail();
|
|
87
|
+
const expected = createDockerArtifactSpec({ artifactManifestDigest: binding.artifactManifestDigest, imageDigest: binding.imageDigest, imageReference: binding.imageReference, operationHandle: binding.operationHandle, requestDigest: binding.requestDigest, selectedTargetHandle: binding.selectedTargetHandle });
|
|
88
|
+
if (expected.resultHandle !== binding.resultHandle)
|
|
89
|
+
return fail();
|
|
90
|
+
return createEvidenceExportHelper({ artifactManifestDigest: binding.artifactManifestDigest, imageDigest: binding.imageDigest, imageReference: binding.imageReference, resultHandle: binding.resultHandle });
|
|
91
|
+
};
|
|
92
|
+
const inspectHelperImage = async (helper, input) => {
|
|
93
|
+
const result = await executeDockerResource({ args: ["--context", input.context, "image", "inspect", "--format", "[{\"RepoDigests\":{{json .RepoDigests}},\"Config\":{\"Cmd\":{{json .Config.Cmd}},\"Entrypoint\":{{json .Config.Entrypoint}},\"Env\":{{json .Config.Env}},\"ExposedPorts\":{{json .Config.ExposedPorts}},\"Healthcheck\":{{json .Config.Healthcheck}},\"Labels\":{{json .Config.Labels}},\"User\":{{json .Config.User}},\"Volumes\":{{json .Config.Volumes}}}}]", helper.image_reference], executor: input.executor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
94
|
+
if (!isExpectedEvidenceExportImage(result.stdout, helper))
|
|
95
|
+
return fail();
|
|
96
|
+
return parseEvidenceExportImageInspection(result.stdout, helper);
|
|
97
|
+
};
|
|
98
|
+
const inspectHelperContainer = async (spec, input) => {
|
|
99
|
+
const result = await executeDockerResource({ args: ["--context", input.context, "container", "inspect", "--format", spec.inspectionFormat, spec.containerName], executor: input.executor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
100
|
+
if (!isExpectedEvidenceExportHelper(result.stdout, spec))
|
|
101
|
+
return fail();
|
|
102
|
+
};
|
|
103
|
+
const removeHelper = async (spec, input) => {
|
|
104
|
+
await executeDockerResource({ args: ["--context", input.context, "container", "rm", "-f", spec.containerName], executor: input.executor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
105
|
+
};
|
|
106
|
+
const exportArchive = async (authority, value, claim, input) => {
|
|
107
|
+
const helper = await helperFor(value, input);
|
|
108
|
+
const imageInspection = await inspectHelperImage(helper, input);
|
|
109
|
+
const spec = createEvidenceExportHelperSpec({ authority, helper, imageLabels: imageInspection.labels, operationHandle: claim.operationHandle, requestDigest: claim.requestDigest });
|
|
110
|
+
let ownedByUs = false;
|
|
111
|
+
try {
|
|
112
|
+
try {
|
|
113
|
+
await executeDockerResource({ args: ["--context", input.context, ...spec.createArgs], executor: input.executor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
114
|
+
ownedByUs = true;
|
|
115
|
+
await inspectHelperContainer(spec, input);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (ownedByUs)
|
|
119
|
+
throw error;
|
|
120
|
+
await inspectHelperContainer(spec, input);
|
|
121
|
+
ownedByUs = true;
|
|
122
|
+
}
|
|
123
|
+
const raw = await executeEvidenceExport({ args: ["--context", input.context, "container", "start", "--attach", spec.containerName], executor: input.exportExecutor, signal: input.signal, timeoutMs: input.timeoutMs });
|
|
124
|
+
const rebuilt = canonicalEvidenceArchive(raw);
|
|
125
|
+
return rebuilt;
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
if (ownedByUs) {
|
|
129
|
+
await removeHelper(spec, input).catch(fail);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const destinationScalar = (raw) => {
|
|
134
|
+
if (typeof raw !== "string" || raw.length < 2 || Buffer.from(raw, "utf8").toString("utf8") !== raw || Buffer.byteLength(raw, "utf8") > 4_096 || !path.isAbsolute(raw) || path.normalize(raw) !== raw || raw.split(path.sep).some((part) => part === ".." || part === "."))
|
|
135
|
+
return fail();
|
|
136
|
+
const base = path.basename(raw);
|
|
137
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.tar$/u.test(base))
|
|
138
|
+
return fail();
|
|
139
|
+
return raw;
|
|
140
|
+
};
|
|
141
|
+
const sameDirectory = async (value) => {
|
|
142
|
+
let current;
|
|
143
|
+
try {
|
|
144
|
+
current = await lstat(value.directory);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return fail();
|
|
148
|
+
}
|
|
149
|
+
if (!current.isDirectory() || current.isSymbolicLink() || current.dev !== value.directoryDev || current.ino !== value.directoryIno || current.uid !== (process.getuid?.() ?? -1) || (current.mode & 0o777) !== 0o700)
|
|
150
|
+
return fail();
|
|
151
|
+
};
|
|
152
|
+
const destinationFile = async (raw, allowExisting = false) => {
|
|
153
|
+
const directory = path.dirname(raw);
|
|
154
|
+
const base = path.basename(raw);
|
|
155
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.tar$/u.test(base))
|
|
156
|
+
return fail();
|
|
157
|
+
let current = path.parse(directory).root;
|
|
158
|
+
for (const part of directory.slice(current.length).split(path.sep).filter(Boolean)) {
|
|
159
|
+
current = path.join(current, part);
|
|
160
|
+
let info;
|
|
161
|
+
try {
|
|
162
|
+
info = await lstat(current);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return fail();
|
|
166
|
+
}
|
|
167
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
168
|
+
return fail();
|
|
169
|
+
}
|
|
170
|
+
let directoryHandle;
|
|
171
|
+
let directoryInfo;
|
|
172
|
+
try {
|
|
173
|
+
directoryHandle = await open(directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
174
|
+
directoryInfo = await directoryHandle.stat();
|
|
175
|
+
/* Node 22 has no descriptor-relative linkat/unlinkat API. A private,
|
|
176
|
+
* current-user directory is therefore the publication trust boundary;
|
|
177
|
+
* arbitrary same-UID concurrent mutation is outside this contract. */
|
|
178
|
+
if (!directoryInfo.isDirectory() || directoryInfo.isSymbolicLink() || directoryInfo.uid !== (process.getuid?.() ?? -1) || (directoryInfo.mode & 0o777) !== 0o700)
|
|
179
|
+
return fail();
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
return fail();
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
await directoryHandle?.close().catch(() => undefined);
|
|
186
|
+
}
|
|
187
|
+
const result = (existing) => ({ directory, directoryDev: directoryInfo.dev, directoryIno: directoryInfo.ino, existing, final: raw });
|
|
188
|
+
try {
|
|
189
|
+
const existing = await lstat(raw);
|
|
190
|
+
if (!allowExisting || !existing.isFile() || existing.isSymbolicLink() || ![1, 2].includes(existing.nlink) || existing.size > 67_108_864 || (existing.mode & 0o777) !== 0o600 || existing.uid !== (process.getuid?.() ?? -1))
|
|
191
|
+
return fail();
|
|
192
|
+
await sameDirectory(result(true));
|
|
193
|
+
return result(true);
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
if (error.code !== "ENOENT")
|
|
197
|
+
return fail();
|
|
198
|
+
}
|
|
199
|
+
await sameDirectory(result(false));
|
|
200
|
+
return result(false);
|
|
201
|
+
};
|
|
202
|
+
const proveDestination = async (raw, digest) => {
|
|
203
|
+
const destination = await destinationFile(raw, true);
|
|
204
|
+
let bytes;
|
|
205
|
+
let handle;
|
|
206
|
+
try {
|
|
207
|
+
handle = await open(destination.final, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
208
|
+
const info = await handle.stat();
|
|
209
|
+
if (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1 || info.size > 67_108_864 || (info.mode & 0o777) !== 0o600 || info.uid !== (process.getuid?.() ?? -1))
|
|
210
|
+
return fail();
|
|
211
|
+
bytes = await handle.readFile();
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return fail();
|
|
215
|
+
}
|
|
216
|
+
finally {
|
|
217
|
+
await handle?.close().catch(() => undefined);
|
|
218
|
+
}
|
|
219
|
+
if (evidenceDigest(bytes) !== digest)
|
|
220
|
+
return fail();
|
|
221
|
+
};
|
|
222
|
+
const syncDirectory = async (destination) => {
|
|
223
|
+
await sameDirectory(destination);
|
|
224
|
+
const handle = await open(destination.directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
225
|
+
try {
|
|
226
|
+
const info = await handle.stat();
|
|
227
|
+
if (!info.isDirectory() || info.dev !== destination.directoryDev || info.ino !== destination.directoryIno)
|
|
228
|
+
return fail();
|
|
229
|
+
await handle.sync();
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
await handle.close();
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const unlinkOwnedTemp = async (destination, temporary, identity) => {
|
|
236
|
+
await sameDirectory(destination);
|
|
237
|
+
let current;
|
|
238
|
+
try {
|
|
239
|
+
current = await lstat(temporary);
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
if (error.code === "ENOENT")
|
|
243
|
+
return;
|
|
244
|
+
return fail();
|
|
245
|
+
}
|
|
246
|
+
if (!current.isFile() || current.isSymbolicLink() || current.dev !== identity.dev || current.ino !== identity.ino)
|
|
247
|
+
return fail();
|
|
248
|
+
await unlink(temporary).catch((error) => { if (error.code !== "ENOENT")
|
|
249
|
+
return fail(); });
|
|
250
|
+
};
|
|
251
|
+
const publicationSnapshot = async (file) => {
|
|
252
|
+
let handle;
|
|
253
|
+
try {
|
|
254
|
+
handle = await open(file, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
if (error.code === "ENOENT")
|
|
258
|
+
return null;
|
|
259
|
+
return fail();
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
const info = await handle.stat();
|
|
263
|
+
if (!info.isFile() || ![1, 2].includes(info.nlink) || info.size > 67_108_864 || (info.mode & 0o777) !== 0o600 || info.uid !== (process.getuid?.() ?? -1))
|
|
264
|
+
return fail();
|
|
265
|
+
return { bytes: await handle.readFile(), dev: info.dev, ino: info.ino, nlink: info.nlink };
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
return fail();
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
await handle.close();
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
const pendingPath = (destination, admitted) => {
|
|
275
|
+
const name = createHash("sha256").update("spawnfile.target-evidence-export.pending.v1\0").update(admitted.operation_handle).update("\0").update(admitted.request_digest).update("\0").update(destination.final).digest("hex");
|
|
276
|
+
return path.join(destination.directory, `.spawnfile-evidence-${name}.pending`);
|
|
277
|
+
};
|
|
278
|
+
const publish = async (destination, admitted, bytes, testHooks) => {
|
|
279
|
+
const expectedDigest = evidenceDigest(bytes);
|
|
280
|
+
const temporary = pendingPath(destination, admitted);
|
|
281
|
+
if (!TEMP.test(path.basename(temporary)))
|
|
282
|
+
return fail();
|
|
283
|
+
if (destination.existing) {
|
|
284
|
+
await sameDirectory(destination);
|
|
285
|
+
const final = await publicationSnapshot(destination.final);
|
|
286
|
+
if (!final || evidenceDigest(final.bytes) !== expectedDigest)
|
|
287
|
+
return fail();
|
|
288
|
+
const pending = await publicationSnapshot(temporary);
|
|
289
|
+
if (pending) {
|
|
290
|
+
if (pending.dev !== final.dev || pending.ino !== final.ino || pending.nlink !== 2 || final.nlink !== 2 || evidenceDigest(pending.bytes) !== expectedDigest)
|
|
291
|
+
return fail();
|
|
292
|
+
await unlinkOwnedTemp(destination, temporary, pending);
|
|
293
|
+
await syncDirectory(destination);
|
|
294
|
+
const settled = await publicationSnapshot(destination.final);
|
|
295
|
+
if (!settled || settled.nlink !== 1 || evidenceDigest(settled.bytes) !== expectedDigest)
|
|
296
|
+
return fail();
|
|
297
|
+
}
|
|
298
|
+
else if (final.nlink !== 1)
|
|
299
|
+
return fail();
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
let handle;
|
|
303
|
+
let ownedTemp;
|
|
304
|
+
try {
|
|
305
|
+
await hook(testHooks?.beforePublishTempWrite);
|
|
306
|
+
await hook(testHooks?.beforePublishTempOpen ? () => testHooks.beforePublishTempOpen(temporary) : undefined);
|
|
307
|
+
await sameDirectory(destination);
|
|
308
|
+
const recovered = await publicationSnapshot(temporary);
|
|
309
|
+
if (recovered) {
|
|
310
|
+
if (recovered.nlink !== 1 || evidenceDigest(recovered.bytes) !== expectedDigest)
|
|
311
|
+
return fail();
|
|
312
|
+
ownedTemp = recovered;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
handle = await open(temporary, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW, 0o600);
|
|
316
|
+
const info = await handle.stat();
|
|
317
|
+
if (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1 || (info.mode & 0o777) !== 0o600 || info.uid !== (process.getuid?.() ?? -1))
|
|
318
|
+
return fail();
|
|
319
|
+
ownedTemp = { dev: info.dev, ino: info.ino };
|
|
320
|
+
await handle.chmod(0o600);
|
|
321
|
+
await handle.writeFile(bytes);
|
|
322
|
+
await hook(testHooks?.beforePublishTempSync);
|
|
323
|
+
await handle.sync();
|
|
324
|
+
await handle.close();
|
|
325
|
+
handle = undefined;
|
|
326
|
+
}
|
|
327
|
+
await hook(testHooks?.beforePublishFinalLink);
|
|
328
|
+
await sameDirectory(destination);
|
|
329
|
+
await link(temporary, destination.final);
|
|
330
|
+
await hook(testHooks?.beforePublishDirectorySync);
|
|
331
|
+
await syncDirectory(destination);
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
return fail();
|
|
335
|
+
}
|
|
336
|
+
finally {
|
|
337
|
+
if (handle)
|
|
338
|
+
await handle.close().catch(fail);
|
|
339
|
+
if (ownedTemp)
|
|
340
|
+
await unlinkOwnedTemp(destination, temporary, ownedTemp);
|
|
341
|
+
await syncDirectory(destination);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
const receipt = async (value, claim, index, input) => {
|
|
345
|
+
const raw = { cleanup_state: "not_requested", descriptor_digest: value.descriptor_digest, evidence_index: index, export_state: "exported", labels: index.labels.map((label) => ({ ...label })), operation: "export_evidence_volume", operation_handle: claim.operationHandle, receipt_digest: `sha256:${"0".repeat(64)}`, request_digest: claim.requestDigest, result_handle: index.export_handle, resulting_revision: (await input.journal.read()).revision + 1, run_id: value.run_id, selected_target: value.selected_target, version: "spawnfile.target-resource.receipt.v1" };
|
|
346
|
+
return { ...raw, receipt_digest: createTargetReceiptDigest(raw) };
|
|
347
|
+
};
|
|
348
|
+
class Operations {
|
|
349
|
+
#live = new Map();
|
|
350
|
+
#recovering = new Map();
|
|
351
|
+
#options;
|
|
352
|
+
constructor(options) { this.#options = options; }
|
|
353
|
+
execute(raw, destination) {
|
|
354
|
+
let value;
|
|
355
|
+
let destinationValue;
|
|
356
|
+
try {
|
|
357
|
+
value = request(raw);
|
|
358
|
+
destinationValue = destinationScalar(destination);
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
return Promise.reject(new SpawnfileError("runtime_error", EVIDENCE_EXPORT_ERROR));
|
|
362
|
+
}
|
|
363
|
+
const running = this.#live.get(value.idempotency_key);
|
|
364
|
+
if (running)
|
|
365
|
+
return same(running.request, value) && running.destination === destinationValue ? running.promise : Promise.reject(new SpawnfileError("runtime_error", EVIDENCE_EXPORT_ERROR));
|
|
366
|
+
const promise = this.owner(value, destinationValue).finally(() => { if (this.#live.get(value.idempotency_key)?.promise === promise)
|
|
367
|
+
this.#live.delete(value.idempotency_key); });
|
|
368
|
+
this.#live.set(value.idempotency_key, { destination: destinationValue, request: value, promise });
|
|
369
|
+
return promise;
|
|
370
|
+
}
|
|
371
|
+
recover(raw, destination) {
|
|
372
|
+
let value;
|
|
373
|
+
let destinationValue;
|
|
374
|
+
try {
|
|
375
|
+
value = recovery(raw);
|
|
376
|
+
destinationValue = destinationScalar(destination);
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
return Promise.reject(new SpawnfileError("runtime_error", EVIDENCE_EXPORT_ERROR));
|
|
380
|
+
}
|
|
381
|
+
const running = this.#recovering.get(value.operation_handle);
|
|
382
|
+
if (running)
|
|
383
|
+
return same(running.request, value) && running.destination === destinationValue ? running.promise : Promise.reject(new SpawnfileError("runtime_error", EVIDENCE_EXPORT_ERROR));
|
|
384
|
+
const promise = this.recoverOwner(value, destinationValue).finally(() => { if (this.#recovering.get(value.operation_handle)?.promise === promise)
|
|
385
|
+
this.#recovering.delete(value.operation_handle); });
|
|
386
|
+
this.#recovering.set(value.operation_handle, { destination: destinationValue, request: value, promise });
|
|
387
|
+
return promise;
|
|
388
|
+
}
|
|
389
|
+
async publishExport(value, admitted, authority, claim, destination) {
|
|
390
|
+
await hook(this.#options.testHooks?.beforeIndexLoad);
|
|
391
|
+
const existingIndex = await this.#options.authorityStore.loadIndex(admitted);
|
|
392
|
+
const checkedDestination = await destinationFile(destination, existingIndex !== null);
|
|
393
|
+
await hook(this.#options.testHooks?.beforeArchive);
|
|
394
|
+
const output = await exportArchive(authority, value, claim, this.#options);
|
|
395
|
+
const index = existingIndex?.index ?? { evidence_digest: evidenceDigest(output.bytes), export_handle: createEvidenceExportHandle({ evidenceVolumeHandle: value.evidence_volume_handle, operationHandle: claim.operationHandle, requestDigest: claim.requestDigest }), files: output.files.map((file) => ({ ...file })), item_count: output.files.length, labels: evidenceReceiptLabels(authority), run_id: value.run_id, source: { evidence_volume_handle: value.evidence_volume_handle, state: "preserved" }, state: "exported", version: "spawnfile.target-resource.export-index.v1" };
|
|
396
|
+
if (index.evidence_digest !== evidenceDigest(output.bytes)
|
|
397
|
+
|| index.item_count !== output.files.length
|
|
398
|
+
|| !same(index.files, output.files)
|
|
399
|
+
|| index.source.evidence_volume_handle !== value.evidence_volume_handle
|
|
400
|
+
|| index.source.state !== "preserved")
|
|
401
|
+
return fail();
|
|
402
|
+
const indexBytes = existingIndex?.bytes ?? (await (async () => { await hook(this.#options.testHooks?.beforeIndexBind); return this.#options.authorityStore.bindIndex(admitted, index); })());
|
|
403
|
+
await publish(checkedDestination, admitted, output.bytes, this.#options.testHooks);
|
|
404
|
+
await hook(this.#options.testHooks?.beforeJournalComplete);
|
|
405
|
+
const completed = await this.#options.journal.complete(claim, await receipt(value, claim, index, this.#options));
|
|
406
|
+
return { ...completed, index, indexBytes };
|
|
407
|
+
}
|
|
408
|
+
async owner(value, destination) {
|
|
409
|
+
try {
|
|
410
|
+
const reserved = await this.#options.journal.reserve(value);
|
|
411
|
+
/* A normal journal pending claim is not recovery authority. In
|
|
412
|
+
* particular, do not derive/inspect an admission, target, helper, or
|
|
413
|
+
* destination from it: another owner may still be between reservation
|
|
414
|
+
* and its first private write. Recovery has its own explicit seam. */
|
|
415
|
+
if (reserved.kind === "pending")
|
|
416
|
+
return incomplete();
|
|
417
|
+
/* Completed journal work is a proof-only path. A stale owner lease from
|
|
418
|
+
* a crash after completion must never make replay touch Docker or wait. */
|
|
419
|
+
if (reserved.kind === "replay") {
|
|
420
|
+
const completed = await this.#options.journal.resolveCompletedReceipt({ operationHandle: reserved.receipt.operation_handle, requestDigest: reserved.receipt.request_digest });
|
|
421
|
+
if (!completed || completed.receiptBytes !== reserved.receiptBytes || !same(completed.receipt, reserved.receipt))
|
|
422
|
+
return fail();
|
|
423
|
+
const admission = await this.#options.authorityStore.loadAdmission(reserved.receipt.operation_handle);
|
|
424
|
+
const stored = await this.#options.authorityStore.loadIndex(admission);
|
|
425
|
+
const durableHelper = await helperFor(value, this.#options);
|
|
426
|
+
await this.#options.authorityStore.requireDestination(admission, destination);
|
|
427
|
+
if (!stored
|
|
428
|
+
|| admission.operation_handle !== reserved.receipt.operation_handle
|
|
429
|
+
|| admission.request_digest !== reserved.receipt.request_digest
|
|
430
|
+
|| admission.run_id !== value.run_id
|
|
431
|
+
|| !same(admission.selected_target, value.selected_target)
|
|
432
|
+
|| admission.descriptor_digest !== value.descriptor_digest
|
|
433
|
+
|| admission.evidence_volume.resultHandle !== value.evidence_volume_handle
|
|
434
|
+
|| admission.helper_contract !== this.#options.helperArtifactContract
|
|
435
|
+
|| !same(admission.helper, durableHelper)
|
|
436
|
+
|| reserved.receipt.operation !== "export_evidence_volume"
|
|
437
|
+
|| reserved.receipt.export_state !== "exported"
|
|
438
|
+
|| reserved.receipt.cleanup_state !== "not_requested"
|
|
439
|
+
|| reserved.receipt.result_handle !== stored.index.export_handle
|
|
440
|
+
|| !same(reserved.receipt.evidence_index, stored.index)
|
|
441
|
+
|| reserved.receipt.run_id !== value.run_id
|
|
442
|
+
|| reserved.receipt.descriptor_digest !== value.descriptor_digest
|
|
443
|
+
|| !same(reserved.receipt.selected_target, value.selected_target)
|
|
444
|
+
|| !same(reserved.receipt.labels, stored.index.labels))
|
|
445
|
+
return fail();
|
|
446
|
+
await proveDestination(destination, stored.index.evidence_digest);
|
|
447
|
+
return { index: stored.index, indexBytes: stored.bytes, receipt: reserved.receipt, receiptBytes: reserved.receiptBytes };
|
|
448
|
+
}
|
|
449
|
+
/* These are read-only authority proofs. The private operation claim is
|
|
450
|
+
* acquired before image/container/export or private-state mutation. */
|
|
451
|
+
const authority = await authorityFor(value, this.#options);
|
|
452
|
+
await selectedContextMatches(value, this.#options);
|
|
453
|
+
const helper = await helperFor(value, this.#options);
|
|
454
|
+
const admitted = { descriptor_digest: value.descriptor_digest, evidence_volume: authority, helper, helper_contract: this.#options.helperArtifactContract, operation_handle: reserved.claim.operationHandle, request_digest: reserved.claim.requestDigest, run_id: value.run_id, selected_target: value.selected_target, version: "spawnfile.target-evidence-export.private.v1" };
|
|
455
|
+
const exportClaim = await this.#options.authorityStore.claimExport(admitted);
|
|
456
|
+
if (exportClaim === null)
|
|
457
|
+
return incomplete();
|
|
458
|
+
try {
|
|
459
|
+
await inspectAuthority(authority, this.#options);
|
|
460
|
+
await hook(this.#options.testHooks?.beforeBindAdmission);
|
|
461
|
+
await this.#options.authorityStore.bindAdmission(admitted);
|
|
462
|
+
await hook(this.#options.testHooks?.beforeBindDestination);
|
|
463
|
+
await this.#options.authorityStore.bindDestination(admitted, destination);
|
|
464
|
+
await hook(this.#options.testHooks?.beforeRequireDestination);
|
|
465
|
+
await this.#options.authorityStore.requireDestination(admitted, destination);
|
|
466
|
+
return await this.publishExport(value, admitted, authority, reserved.claim, destination);
|
|
467
|
+
}
|
|
468
|
+
finally {
|
|
469
|
+
await this.#options.authorityStore.releaseExport(admitted, exportClaim);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
catch (error) {
|
|
473
|
+
if (isEvidenceExportIncomplete(error))
|
|
474
|
+
throw error;
|
|
475
|
+
return failWithCause(error);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
async recoverOwner(value, destination) {
|
|
479
|
+
try {
|
|
480
|
+
const reserved = await this.#options.journal.reserve(value);
|
|
481
|
+
if (reserved.kind !== "pending")
|
|
482
|
+
return fail();
|
|
483
|
+
const entry = (await this.#options.journal.read()).entries.find((item) => item.operation_handle === reserved.claim.operationHandle);
|
|
484
|
+
if (!entry || entry.operation !== "export_evidence_volume" || entry.state !== "pending" || entry.request_digest !== reserved.claim.requestDigest)
|
|
485
|
+
return fail();
|
|
486
|
+
const admitted = await this.#options.authorityStore.loadAdmission(reserved.claim.operationHandle);
|
|
487
|
+
const exportValue = { descriptor_digest: admitted.descriptor_digest, evidence_volume_handle: admitted.evidence_volume.resultHandle, run_id: parseRunId(admitted.run_id), selected_target: admitted.selected_target };
|
|
488
|
+
if (admitted.operation_handle !== reserved.claim.operationHandle || admitted.request_digest !== reserved.claim.requestDigest || admitted.helper_contract !== this.#options.helperArtifactContract || exportValue.run_id !== value.run_id || exportValue.descriptor_digest !== value.descriptor_digest || !same(exportValue.selected_target, value.selected_target))
|
|
489
|
+
return fail();
|
|
490
|
+
await this.#options.authorityStore.requireDestination(admitted, destination);
|
|
491
|
+
if (await this.#options.authorityStore.clearStaleExportClaim(admitted))
|
|
492
|
+
return incomplete();
|
|
493
|
+
const exportClaim = await this.#options.authorityStore.claimExport(admitted);
|
|
494
|
+
if (exportClaim === null)
|
|
495
|
+
return incomplete();
|
|
496
|
+
try {
|
|
497
|
+
const authority = await authorityFor(exportValue, this.#options);
|
|
498
|
+
const helper = await helperFor(exportValue, this.#options);
|
|
499
|
+
await selectedContextMatches(exportValue, this.#options);
|
|
500
|
+
if (!same(admitted.evidence_volume, authority) || !same(admitted.helper, helper))
|
|
501
|
+
return fail();
|
|
502
|
+
await inspectAuthority(authority, this.#options);
|
|
503
|
+
await inspectHelperImage(helper, this.#options);
|
|
504
|
+
return await this.publishExport(exportValue, admitted, authority, reserved.claim, destination);
|
|
505
|
+
}
|
|
506
|
+
finally {
|
|
507
|
+
await this.#options.authorityStore.releaseExport(admitted, exportClaim);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
catch (error) {
|
|
511
|
+
if (isEvidenceExportIncomplete(error))
|
|
512
|
+
throw error;
|
|
513
|
+
return failWithCause(error);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
export const createEvidenceExportOperations = (raw) => new Operations(options(raw));
|
|
518
|
+
export const createEvidenceVolumeExport = createEvidenceExportOperations;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Parses evidence archives as strict canonical USTAR. */
|
|
2
|
+
export declare const canonicalEvidenceArchive: (raw: unknown) => {
|
|
3
|
+
readonly bytes: Uint8Array;
|
|
4
|
+
readonly files: readonly Readonly<{
|
|
5
|
+
bytes: number;
|
|
6
|
+
path: string;
|
|
7
|
+
sha256: `sha256:${string}`;
|
|
8
|
+
}>[];
|
|
9
|
+
readonly itemCount: number;
|
|
10
|
+
};
|