spawnfile 0.1.12 → 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 +58 -12
- 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/runtimeCredentials.js +18 -2
- 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/devCommands.d.ts +3 -0
- package/dist/cli/devCommands.js +115 -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 -179
- 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 +15 -2
- package/dist/cli/runCli.js +31 -71
- package/dist/cli/runPublishCommands.d.ts +3 -0
- package/dist/cli/runPublishCommands.js +70 -0
- package/dist/cli/statusCommand.d.ts +3 -32
- package/dist/cli/statusCommand.js +37 -233
- 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 +20 -1
- package/dist/compiler/buildProject.js +121 -7
- package/dist/compiler/compilePlanHelpers.js +2 -0
- package/dist/compiler/compileProject.d.ts +15 -0
- package/dist/compiler/compileProject.js +29 -75
- 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 +40 -81
- 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 +60 -53
- 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/containerPackageRender.d.ts +15 -0
- package/dist/compiler/containerPackageRender.js +63 -0
- package/dist/compiler/containerTargetPlanResolution.d.ts +20 -0
- package/dist/compiler/containerTargetPlanResolution.js +97 -0
- package/dist/compiler/containerTargetResources.js +3 -1
- 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 +56 -95
- package/dist/compiler/moltnetBinaries.d.ts +21 -1
- package/dist/compiler/moltnetBinaries.js +156 -28
- package/dist/compiler/moltnetClientConfig.js +18 -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/moltnetRuntimeConfig.js +11 -0
- 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 +37 -22
- 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 +187 -19
- 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 +257 -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.d.ts +17 -0
- package/dist/deployment/dockerRecover.js +137 -0
- 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 +17 -0
- package/dist/deployment/index.js +18 -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/activity.d.ts +14 -0
- package/dist/dev/activity.js +48 -0
- package/dist/dev/docker.d.ts +16 -0
- package/dist/dev/docker.js +71 -0
- package/dist/dev/index.d.ts +2 -0
- package/dist/dev/index.js +2 -0
- package/dist/dev/project.d.ts +35 -0
- package/dist/dev/project.js +170 -0
- 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 +37 -0
- package/dist/runtime/common.js +56 -1
- package/dist/runtime/container.d.ts +29 -1
- package/dist/runtime/container.js +127 -11
- 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/install.d.ts +1 -1
- package/dist/runtime/install.js +43 -1
- 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 +4 -0
- package/dist/runtime/pi/adapter.js +231 -0
- package/dist/runtime/pi/appActivitySource.d.ts +1 -0
- package/dist/runtime/pi/appActivitySource.js +199 -0
- 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 -0
- package/dist/runtime/pi/appCoreSource.js +244 -0
- package/dist/runtime/pi/appPreludeSource.d.ts +1 -0
- package/dist/runtime/pi/appPreludeSource.js +191 -0
- 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 -0
- package/dist/runtime/pi/appSource.js +12 -0
- package/dist/runtime/pi/appTemplate.d.ts +14 -0
- package/dist/runtime/pi/appTemplate.js +27 -0
- 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.d.ts +2 -0
- package/dist/runtime/pi/runAuth.js +185 -0
- 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/registry.js +3 -0
- package/dist/runtime/scheduleUtils.d.ts +2 -0
- package/dist/runtime/scheduleUtils.js +15 -0
- package/dist/runtime/types.d.ts +26 -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/deployments.js +5 -12
- 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 +29 -8
- package/runtimes.yaml +28 -27
- 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execFile as execFileCallback } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
3
|
import { dockerContextNameForTarget } from "./target.js";
|
|
4
|
+
import { redactSensitiveText } from "../shared/index.js";
|
|
4
5
|
const execFile = promisify(execFileCallback);
|
|
5
6
|
const targetRefForUnit = (unit) => unit.container_id ?? unit.container_name;
|
|
6
7
|
const withDockerTarget = (record, args) => {
|
|
@@ -17,16 +18,7 @@ const normalizeTail = (tail) => typeof tail === "number" && Number.isInteger(tai
|
|
|
17
18
|
const redactKnownSecrets = (text, secretValues) => secretValues
|
|
18
19
|
.filter((secret) => secret.length > 0)
|
|
19
20
|
.reduce((redacted, secret) => redacted.replaceAll(secret, "[REDACTED]"), text);
|
|
20
|
-
const
|
|
21
|
-
let redacted = text;
|
|
22
|
-
redacted = redacted.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, "Bearer [REDACTED]");
|
|
23
|
-
redacted = redacted.replace(/\bmagt_v1_[A-Za-z0-9_-]{16,}\b/g, "[REDACTED]");
|
|
24
|
-
redacted = redacted.replace(/\b(?:sk|sk-proj)-[A-Za-z0-9_-]{20,}\b/g, "[REDACTED]");
|
|
25
|
-
redacted = redacted.replace(/\b([A-Z0-9_]*(?:API[_-]?KEY|TOKEN|SECRET|PASSWORD)[A-Z0-9_]*=)([^\s"'`]+)/gi, "$1[REDACTED]");
|
|
26
|
-
redacted = redacted.replace(/("([^"]*(?:api[_-]?key|token|secret|password)[^"]*)"\s*:\s*")([^"]+)(")/gi, "$1[REDACTED]$4");
|
|
27
|
-
return redacted;
|
|
28
|
-
};
|
|
29
|
-
export const redactDockerLogText = (text, secretValues = []) => redactTokenLikeText(redactKnownSecrets(text, secretValues));
|
|
21
|
+
export const redactDockerLogText = (text, secretValues = []) => redactSensitiveText(redactKnownSecrets(text, secretValues));
|
|
30
22
|
const combineLogStreams = (stdout, stderr) => {
|
|
31
23
|
if (!stdout) {
|
|
32
24
|
return stderr;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { DeploymentRecordSource } from "./record.js";
|
|
2
|
+
import type { OrganizationReadinessEvidence } from "../compiler/organizationReadyEvidence.js";
|
|
3
|
+
import { type DockerProbeExecFile } from "./dockerProbeGateway.js";
|
|
4
|
+
import { type OrganizationReadiness } from "./organizationReady.js";
|
|
2
5
|
import { type DockerDeploymentTarget, type DockerTargetExecFile } from "./target.js";
|
|
3
6
|
import { type DeploymentRecord } from "./record.js";
|
|
7
|
+
import { type OrganizationHandoff, type OrganizationHandoffInput } from "./organizationHandoffTypes.js";
|
|
8
|
+
import type { OpaqueTargetHandle, SelectedTargetReceipt } from "../target/index.js";
|
|
4
9
|
export interface DockerDeploymentNodeInput {
|
|
5
10
|
id: string;
|
|
6
11
|
kind: "agent" | "team";
|
|
@@ -20,6 +25,12 @@ export interface DockerDeploymentRunInvocationInput {
|
|
|
20
25
|
export interface DockerDeploymentReportInput {
|
|
21
26
|
compile_fingerprint?: string;
|
|
22
27
|
container?: {
|
|
28
|
+
moltnet?: {
|
|
29
|
+
server_plans: Array<{
|
|
30
|
+
mode: "external" | "managed";
|
|
31
|
+
network_id: string;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
23
34
|
runtime_instances: Array<{
|
|
24
35
|
id: string;
|
|
25
36
|
}>;
|
|
@@ -34,14 +45,39 @@ export interface WriteDockerDeploymentRecordInput {
|
|
|
34
45
|
deploymentName?: string;
|
|
35
46
|
envFilePath?: string;
|
|
36
47
|
imageTag: string;
|
|
48
|
+
networkIds?: string[];
|
|
37
49
|
nodes: DockerDeploymentNodeInput[];
|
|
38
50
|
outputDirectory: string;
|
|
51
|
+
organizationHandoff?: OrganizationHandoffInput;
|
|
52
|
+
organizationHandoffHandle?: OpaqueTargetHandle;
|
|
39
53
|
projectRoot: string;
|
|
54
|
+
runId?: string;
|
|
40
55
|
runMetadata?: DockerDeploymentRunMetadata;
|
|
41
56
|
runtimeInstanceIds: string[];
|
|
42
57
|
source?: DeploymentRecordSource;
|
|
43
58
|
target: DockerDeploymentTarget;
|
|
44
59
|
}
|
|
60
|
+
export declare const createDockerOrganizationHandoffSession: (input: {
|
|
61
|
+
readonly bindingDigest: string;
|
|
62
|
+
readonly containerName: string;
|
|
63
|
+
readonly deploymentLabels: Readonly<Record<string, string>>;
|
|
64
|
+
readonly descriptorDigest: string;
|
|
65
|
+
readonly organizationHandoff: OrganizationHandoffInput;
|
|
66
|
+
readonly runId: string;
|
|
67
|
+
readonly selectedTarget: SelectedTargetReceipt;
|
|
68
|
+
readonly selectedTargetReceiptDigest: string;
|
|
69
|
+
}) => {
|
|
70
|
+
readonly authorityInput: {
|
|
71
|
+
readonly bindingDigest: string;
|
|
72
|
+
readonly containerName: string;
|
|
73
|
+
readonly deploymentLabels: Readonly<Record<string, string>>;
|
|
74
|
+
readonly descriptorDigest: string;
|
|
75
|
+
readonly handoff: OrganizationHandoff;
|
|
76
|
+
readonly selectedTarget: SelectedTargetReceipt;
|
|
77
|
+
readonly selectedTargetReceiptDigest: string;
|
|
78
|
+
};
|
|
79
|
+
readonly organizationHandoff: OrganizationHandoff;
|
|
80
|
+
};
|
|
45
81
|
export declare const createDockerDeploymentUnitId: (deploymentName: string) => string;
|
|
46
82
|
export declare const createDockerDeploymentRecord: (input: WriteDockerDeploymentRecordInput) => DeploymentRecord;
|
|
47
83
|
export declare const createDockerProjectLabel: (projectRoot: string, projectName?: string) => string;
|
|
@@ -52,8 +88,23 @@ export declare const writeDockerDeploymentRecordForRun: (input: {
|
|
|
52
88
|
imageTag: string;
|
|
53
89
|
invocation: DockerDeploymentRunInvocationInput;
|
|
54
90
|
outputDirectory: string;
|
|
91
|
+
organizationHandoff?: OrganizationHandoffInput;
|
|
92
|
+
organizationHandoffHandle?: OpaqueTargetHandle;
|
|
55
93
|
report: DockerDeploymentReportInput;
|
|
56
94
|
runMetadata?: DockerDeploymentRunMetadata;
|
|
57
95
|
targetExecFile?: DockerTargetExecFile;
|
|
58
96
|
targetTimeoutMs?: number;
|
|
59
97
|
}) => Promise<string | null>;
|
|
98
|
+
export interface ProbeDockerOrganizationReadinessInput {
|
|
99
|
+
dockerCommand?: string;
|
|
100
|
+
evidence: OrganizationReadinessEvidence;
|
|
101
|
+
execFile?: DockerProbeExecFile;
|
|
102
|
+
record: DeploymentRecord;
|
|
103
|
+
timeoutMs?: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Performs the single manager-owned inspection, public health checks, and
|
|
107
|
+
* bounded artifact reads needed to reconcile immutable compiler evidence.
|
|
108
|
+
* It deliberately returns a safe value only; upProject owns both persistence writes.
|
|
109
|
+
*/
|
|
110
|
+
export declare const probeDockerOrganizationReadiness: (input: ProbeDockerOrganizationReadinessInput) => Promise<OrganizationReadiness>;
|
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { normalizeProjectLabelSlug } from "../distribution/index.js";
|
|
3
|
+
import { resolveNoopolisRunId } from "../runtime/index.js";
|
|
3
4
|
import { SpawnfileError } from "../shared/index.js";
|
|
5
|
+
import { inspectDockerDeployment } from "./dockerInspect.js";
|
|
4
6
|
import { normalizeDeploymentName } from "./names.js";
|
|
7
|
+
import { createDockerProbeGateway } from "./dockerProbeGateway.js";
|
|
8
|
+
import { organizationReadinessFromProbeError, reconcileOrganizationReadiness } from "./organizationReady.js";
|
|
5
9
|
import { resolveDockerDeploymentTarget } from "./target.js";
|
|
6
10
|
import { writeDeploymentRecord } from "./record.js";
|
|
11
|
+
import { createOrganizationHandoff } from "./organizationHandoffTypes.js";
|
|
12
|
+
export const createDockerOrganizationHandoffSession = (input) => {
|
|
13
|
+
const organizationHandoff = createOrganizationHandoff(input.runId, input.organizationHandoff);
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
authorityInput: Object.freeze({
|
|
16
|
+
bindingDigest: input.bindingDigest,
|
|
17
|
+
containerName: input.containerName,
|
|
18
|
+
deploymentLabels: input.deploymentLabels,
|
|
19
|
+
descriptorDigest: input.descriptorDigest,
|
|
20
|
+
handoff: organizationHandoff,
|
|
21
|
+
selectedTarget: input.selectedTarget,
|
|
22
|
+
selectedTargetReceiptDigest: input.selectedTargetReceiptDigest
|
|
23
|
+
}),
|
|
24
|
+
organizationHandoff
|
|
25
|
+
});
|
|
26
|
+
};
|
|
7
27
|
const resolveProjectSlug = (projectRoot) => {
|
|
8
28
|
const base = path.basename(projectRoot).toLowerCase() === "spawnfile"
|
|
9
29
|
? path.basename(path.dirname(projectRoot))
|
|
@@ -24,13 +44,25 @@ export const createDockerDeploymentRecord = (input) => {
|
|
|
24
44
|
manager: "docker",
|
|
25
45
|
name,
|
|
26
46
|
output_directory: path.resolve(input.outputDirectory),
|
|
47
|
+
...(input.runId ? { run_id: input.runId } : {}),
|
|
48
|
+
...(input.runId && input.organizationHandoff
|
|
49
|
+
? { organization_handoff: createOrganizationHandoff(input.runId, input.organizationHandoff) }
|
|
50
|
+
: {}),
|
|
51
|
+
...(input.runId && input.organizationHandoff && input.organizationHandoffHandle
|
|
52
|
+
? { organization_handoff_handle: input.organizationHandoffHandle }
|
|
53
|
+
: {}),
|
|
27
54
|
source: input.source ?? { kind: "project", root: path.resolve(input.projectRoot) },
|
|
28
55
|
target: input.target,
|
|
29
56
|
units: [
|
|
30
57
|
{
|
|
31
58
|
container_id: input.runMetadata?.containerId ?? null,
|
|
32
59
|
container_name: input.containerName,
|
|
33
|
-
contains:
|
|
60
|
+
contains: [
|
|
61
|
+
...input.nodes.map((node) => ({ id: node.id, kind: node.kind })),
|
|
62
|
+
...[...new Set(input.networkIds ?? [])]
|
|
63
|
+
.sort()
|
|
64
|
+
.map((id) => ({ id, kind: "network" }))
|
|
65
|
+
],
|
|
34
66
|
id: createDockerDeploymentUnitId(name),
|
|
35
67
|
image_id: input.runMetadata?.imageId ?? null,
|
|
36
68
|
image_tag: input.imageTag,
|
|
@@ -60,9 +92,20 @@ export const writeDockerDeploymentRecordForRun = async (input) => {
|
|
|
60
92
|
deploymentName: input.invocation.deploymentName,
|
|
61
93
|
envFilePath: input.envFilePath,
|
|
62
94
|
imageTag: input.imageTag,
|
|
95
|
+
networkIds: input.report.container?.moltnet?.server_plans
|
|
96
|
+
.filter((server) => server.mode === "managed")
|
|
97
|
+
.map((server) => server.network_id),
|
|
63
98
|
nodes: input.report.nodes,
|
|
64
99
|
outputDirectory: input.outputDirectory,
|
|
100
|
+
...(input.organizationHandoff ? { organizationHandoff: input.organizationHandoff } : {}),
|
|
101
|
+
...(input.organizationHandoffHandle ? { organizationHandoffHandle: input.organizationHandoffHandle } : {}),
|
|
65
102
|
projectRoot: input.report.root,
|
|
103
|
+
// Sourced from the host process env at record-write time, not the
|
|
104
|
+
// compile report: `spawnfile run`/`up --detach` always call
|
|
105
|
+
// ensureNoopolisRunId() before compiling (src/compiler/CLAUDE.md), so by
|
|
106
|
+
// the time this record is written the run id — if any — is already on
|
|
107
|
+
// process.env. A bare host env with no run id yields no `run_id` field.
|
|
108
|
+
runId: resolveNoopolisRunId(process.env),
|
|
66
109
|
runMetadata: input.runMetadata,
|
|
67
110
|
runtimeInstanceIds: input.report.container?.runtime_instances.map((instance) => instance.id) ?? [],
|
|
68
111
|
target: await resolveDockerDeploymentTarget({
|
|
@@ -74,3 +117,77 @@ export const writeDockerDeploymentRecordForRun = async (input) => {
|
|
|
74
117
|
})
|
|
75
118
|
});
|
|
76
119
|
};
|
|
120
|
+
const recordCorrelation = (record) => ({
|
|
121
|
+
compileFingerprint: record.compile_fingerprint,
|
|
122
|
+
deploymentName: record.name,
|
|
123
|
+
runId: record.run_id ?? null,
|
|
124
|
+
unitCount: record.units.length,
|
|
125
|
+
unitId: record.units[0]?.id ?? "invalid-unit"
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* Performs the single manager-owned inspection, public health checks, and
|
|
129
|
+
* bounded artifact reads needed to reconcile immutable compiler evidence.
|
|
130
|
+
* It deliberately returns a safe value only; upProject owns both persistence writes.
|
|
131
|
+
*/
|
|
132
|
+
export const probeDockerOrganizationReadiness = async (input) => {
|
|
133
|
+
const correlation = recordCorrelation(input.record);
|
|
134
|
+
try {
|
|
135
|
+
const inspections = await inspectDockerDeployment(input.record, {
|
|
136
|
+
dockerCommand: input.dockerCommand,
|
|
137
|
+
execFile: input.execFile,
|
|
138
|
+
timeoutMs: input.timeoutMs
|
|
139
|
+
});
|
|
140
|
+
const unit = input.record.units[0];
|
|
141
|
+
const inspected = unit ? inspections.get(unit.id) ?? null : null;
|
|
142
|
+
if (!unit || !inspected) {
|
|
143
|
+
return reconcileOrganizationReadiness({
|
|
144
|
+
evidence: input.evidence, inspection: null, probe: null, record: correlation
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const gateway = createDockerProbeGateway(input.record, unit, {
|
|
148
|
+
dockerCommand: input.dockerCommand,
|
|
149
|
+
execFile: input.execFile,
|
|
150
|
+
inspection: inspected,
|
|
151
|
+
timeoutMs: input.timeoutMs
|
|
152
|
+
});
|
|
153
|
+
const inspection = await gateway.inspectUnit();
|
|
154
|
+
if (input.evidence.hasExternalMoltnet || !input.evidence.worldBindings) {
|
|
155
|
+
return reconcileOrganizationReadiness({
|
|
156
|
+
evidence: input.evidence, inspection, probe: null, record: correlation
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
const networks = [];
|
|
160
|
+
for (const network of input.evidence.networks) {
|
|
161
|
+
if (network.mode !== "managed" || network.internalPort === null) {
|
|
162
|
+
return reconcileOrganizationReadiness({
|
|
163
|
+
evidence: input.evidence, inspection, probe: null, record: correlation
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const health = await gateway.httpGet(network.internalPort, "/healthz");
|
|
167
|
+
if (!health.ok) {
|
|
168
|
+
return organizationReadinessFromProbeError(input.evidence, correlation, new Error(health.error ?? "probe unavailable"));
|
|
169
|
+
}
|
|
170
|
+
networks.push({
|
|
171
|
+
healthOk: health.ok,
|
|
172
|
+
id: network.id
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const configs = new Map();
|
|
176
|
+
for (const network of input.evidence.networks) {
|
|
177
|
+
for (const node of network.nodes) {
|
|
178
|
+
const result = await gateway.exec(["cat", node.configPath]);
|
|
179
|
+
configs.set(node.configPath, result.stdout);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const bindings = await gateway.exec(["cat", input.evidence.worldBindings.artifactPath]);
|
|
183
|
+
return reconcileOrganizationReadiness({
|
|
184
|
+
evidence: input.evidence,
|
|
185
|
+
inspection,
|
|
186
|
+
probe: { configs, networks, worldBindings: bindings.stdout },
|
|
187
|
+
record: correlation
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
return organizationReadinessFromProbeError(input.evidence, correlation, error);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
@@ -19,6 +19,63 @@ const withDockerTarget = (record, args) => {
|
|
|
19
19
|
}
|
|
20
20
|
return args;
|
|
21
21
|
};
|
|
22
|
+
const imageRefForUnit = (unit) => unit.image_id
|
|
23
|
+
? (/^[a-f0-9]{64}$/u.test(unit.image_id) ? `sha256:${unit.image_id}` : unit.image_id)
|
|
24
|
+
: unit.image_tag;
|
|
25
|
+
const redactProbeText = (value, limit) => value
|
|
26
|
+
.replace(/\s+/gu, " ")
|
|
27
|
+
.replace(/(bearer|token|password|passwd|secret|authorization)[=: ]+(?:bearer[ ]+)?[^ ]+/giu, "$1=[redacted]")
|
|
28
|
+
.replace(/https?:\/\/[^ ]+/giu, "[url redacted]")
|
|
29
|
+
.slice(0, limit);
|
|
30
|
+
const boundedProbeFailure = (error) => {
|
|
31
|
+
if (!error || typeof error !== "object")
|
|
32
|
+
return redactProbeText(String(error), 240) || "probe failed";
|
|
33
|
+
const candidate = error;
|
|
34
|
+
const hasStatus = typeof candidate.status === "number" || typeof candidate.status === "string";
|
|
35
|
+
const hasCode = typeof candidate.code === "number" || typeof candidate.code === "string";
|
|
36
|
+
const status = hasStatus
|
|
37
|
+
? `status ${String(candidate.status)}`
|
|
38
|
+
: hasCode
|
|
39
|
+
? `exit ${String(candidate.code)}`
|
|
40
|
+
: "failed";
|
|
41
|
+
const stderr = typeof candidate.stderr === "string"
|
|
42
|
+
? redactProbeText(candidate.stderr, 240)
|
|
43
|
+
: "";
|
|
44
|
+
const message = typeof candidate.message === "string" ? redactProbeText(candidate.message, 160) : "";
|
|
45
|
+
if (error instanceof Error && !stderr)
|
|
46
|
+
return message || "probe failed";
|
|
47
|
+
if (stderr)
|
|
48
|
+
return `docker probe ${status}: ${stderr}`;
|
|
49
|
+
if (message)
|
|
50
|
+
return hasStatus || hasCode ? `docker probe ${status}: ${message}` : message;
|
|
51
|
+
return `docker probe ${status}`;
|
|
52
|
+
};
|
|
53
|
+
const parseCurlHttpOutput = (stdout) => {
|
|
54
|
+
const match = /\n(\d{3})$/u.exec(stdout);
|
|
55
|
+
if (!match || match.index === undefined) {
|
|
56
|
+
return { body: "", error: "malformed HTTP probe response", ok: false };
|
|
57
|
+
}
|
|
58
|
+
const status = Number(match[1]);
|
|
59
|
+
const body = stdout.slice(0, match.index);
|
|
60
|
+
return status >= 200 && status <= 299
|
|
61
|
+
? { body, ok: true }
|
|
62
|
+
: { body, error: `HTTP ${status}`, ok: false };
|
|
63
|
+
};
|
|
64
|
+
const httpProbeArgs = (targetRef, imageRef, url) => [
|
|
65
|
+
"run",
|
|
66
|
+
"--rm",
|
|
67
|
+
"--network",
|
|
68
|
+
`container:${targetRef}`,
|
|
69
|
+
"--entrypoint",
|
|
70
|
+
"curl",
|
|
71
|
+
imageRef,
|
|
72
|
+
"-sS",
|
|
73
|
+
"--output",
|
|
74
|
+
"-",
|
|
75
|
+
"--write-out",
|
|
76
|
+
"\\n%{http_code}",
|
|
77
|
+
url
|
|
78
|
+
];
|
|
22
79
|
export const createDockerProbeGateway = (record, unit, options) => {
|
|
23
80
|
const dockerCommand = options.dockerCommand ?? "docker";
|
|
24
81
|
const runExec = options.execFile ?? execFile;
|
|
@@ -30,15 +87,17 @@ export const createDockerProbeGateway = (record, unit, options) => {
|
|
|
30
87
|
return {
|
|
31
88
|
exec,
|
|
32
89
|
async httpGet(port, requestPath, headers = {}) {
|
|
90
|
+
if (Object.keys(headers).length > 0) {
|
|
91
|
+
return { body: "", error: "HTTP probe headers are forbidden", ok: false };
|
|
92
|
+
}
|
|
33
93
|
const url = `http://127.0.0.1:${port}${requestPath.startsWith("/") ? requestPath : `/${requestPath}`}`;
|
|
34
94
|
try {
|
|
35
|
-
const
|
|
36
|
-
const result = await
|
|
37
|
-
return
|
|
95
|
+
const targetRef = targetRefForUnit(unit);
|
|
96
|
+
const result = await runExec(dockerCommand, withDockerTarget(record, httpProbeArgs(targetRef, imageRefForUnit(unit), url)), { timeout });
|
|
97
|
+
return parseCurlHttpOutput(result.stdout);
|
|
38
98
|
}
|
|
39
99
|
catch (error) {
|
|
40
|
-
|
|
41
|
-
return { body: "", error: message, ok: false };
|
|
100
|
+
return { body: "", error: boundedProbeFailure(error), ok: false };
|
|
42
101
|
}
|
|
43
102
|
},
|
|
44
103
|
async inspectUnit() {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DeploymentRecord } from "./record.js";
|
|
2
|
+
import { type DockerTargetExecFile } from "./target.js";
|
|
3
|
+
export interface RecoverDockerDeploymentRecordsOptions {
|
|
4
|
+
contains?: DeploymentRecord["units"][number]["contains"];
|
|
5
|
+
context: string;
|
|
6
|
+
dockerCommand?: string;
|
|
7
|
+
execFile?: DockerTargetExecFile;
|
|
8
|
+
outputDirectory: string;
|
|
9
|
+
projectLabel: string;
|
|
10
|
+
runtimeInstanceIds?: string[];
|
|
11
|
+
sourceRoot: string;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare const recoverDockerDeploymentRecords: (options: RecoverDockerDeploymentRecordsOptions) => Promise<Array<{
|
|
15
|
+
path: string;
|
|
16
|
+
record: DeploymentRecord;
|
|
17
|
+
}>>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
4
|
+
import { dockerDeploymentLabelKeys } from "./dockerLabels.js";
|
|
5
|
+
import { resolveDockerDeploymentTarget } from "./target.js";
|
|
6
|
+
const execFile = promisify(execFileCallback);
|
|
7
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
+
const toStringOrNull = (value) => typeof value === "string" && value.length > 0 ? value : null;
|
|
9
|
+
const labelsFrom = (inspection) => {
|
|
10
|
+
const labels = inspection.Config?.Labels;
|
|
11
|
+
if (!isRecord(labels)) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
return Object.fromEntries(Object.entries(labels).filter((entry) => typeof entry[1] === "string"));
|
|
15
|
+
};
|
|
16
|
+
const withContext = (context, args) => [
|
|
17
|
+
"--context",
|
|
18
|
+
context,
|
|
19
|
+
...args
|
|
20
|
+
];
|
|
21
|
+
const containerNameFrom = (inspection) => {
|
|
22
|
+
const name = toStringOrNull(inspection.Name);
|
|
23
|
+
return name ? name.replace(/^\//u, "") : null;
|
|
24
|
+
};
|
|
25
|
+
const parseInspections = (stdout) => {
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(stdout);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw new SpawnfileError("runtime_error", `Unable to parse recovered Docker container inspection: ${error instanceof Error ? error.message : String(error)}`);
|
|
32
|
+
}
|
|
33
|
+
return Array.isArray(parsed) ? parsed.filter(isRecord) : [];
|
|
34
|
+
};
|
|
35
|
+
const deploymentNameFor = (labels) => labels[dockerDeploymentLabelKeys.deployment] ?? null;
|
|
36
|
+
const buildUnit = (inspection, labels, contains, runtimeInstanceIds) => {
|
|
37
|
+
const unitId = labels[dockerDeploymentLabelKeys.unit];
|
|
38
|
+
const imageTag = toStringOrNull(inspection.Config?.Image);
|
|
39
|
+
if (!unitId || !imageTag) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
container_id: toStringOrNull(inspection.Id),
|
|
44
|
+
container_name: containerNameFrom(inspection),
|
|
45
|
+
contains,
|
|
46
|
+
id: unitId,
|
|
47
|
+
image_id: toStringOrNull(inspection.Image),
|
|
48
|
+
image_tag: imageTag,
|
|
49
|
+
kind: "container",
|
|
50
|
+
runtime_instances: runtimeInstanceIds
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const groupByDeployment = (inspections, options, target) => {
|
|
54
|
+
const records = new Map();
|
|
55
|
+
const unitsByDeployment = new Map();
|
|
56
|
+
const contains = options.contains ?? [];
|
|
57
|
+
const runtimeInstanceIds = options.runtimeInstanceIds ?? [];
|
|
58
|
+
for (const inspection of inspections) {
|
|
59
|
+
const labels = labelsFrom(inspection);
|
|
60
|
+
if (labels[dockerDeploymentLabelKeys.project] !== options.projectLabel) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const name = deploymentNameFor(labels);
|
|
64
|
+
const compileFingerprint = labels[dockerDeploymentLabelKeys.compileFingerprint];
|
|
65
|
+
const runId = labels[dockerDeploymentLabelKeys.runId];
|
|
66
|
+
if (!name || !compileFingerprint) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const unit = buildUnit(inspection, labels, contains, runtimeInstanceIds);
|
|
70
|
+
if (!unit) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const seenUnits = unitsByDeployment.get(name) ?? new Set();
|
|
74
|
+
if (seenUnits.has(unit.id)) {
|
|
75
|
+
throw new SpawnfileError("validation_error", `Recovered deployment "${name}" has multiple containers for unit "${unit.id}"`);
|
|
76
|
+
}
|
|
77
|
+
seenUnits.add(unit.id);
|
|
78
|
+
unitsByDeployment.set(name, seenUnits);
|
|
79
|
+
const existing = records.get(name);
|
|
80
|
+
if (existing
|
|
81
|
+
&& (existing.compile_fingerprint !== compileFingerprint
|
|
82
|
+
|| existing.run_id !== runId)) {
|
|
83
|
+
throw new SpawnfileError("validation_error", `Recovered deployment "${name}" has inconsistent identity labels`);
|
|
84
|
+
}
|
|
85
|
+
const record = existing ?? {
|
|
86
|
+
auth_profile: null,
|
|
87
|
+
compile_fingerprint: compileFingerprint,
|
|
88
|
+
created_at: toStringOrNull(inspection.Created) ?? new Date().toISOString(),
|
|
89
|
+
manager: "docker",
|
|
90
|
+
name,
|
|
91
|
+
output_directory: options.outputDirectory,
|
|
92
|
+
...(runId ? { run_id: runId } : {}),
|
|
93
|
+
source: { kind: "project", root: options.sourceRoot },
|
|
94
|
+
target,
|
|
95
|
+
units: [],
|
|
96
|
+
version: "spawnfile.deployment.v2"
|
|
97
|
+
};
|
|
98
|
+
record.units.push(unit);
|
|
99
|
+
records.set(name, record);
|
|
100
|
+
}
|
|
101
|
+
return [...records.values()]
|
|
102
|
+
.sort((left, right) => left.name.localeCompare(right.name))
|
|
103
|
+
.map((record) => ({
|
|
104
|
+
path: `docker-context://${options.context}/${record.name}`,
|
|
105
|
+
record: {
|
|
106
|
+
...record,
|
|
107
|
+
units: [...record.units].sort((left, right) => left.id.localeCompare(right.id))
|
|
108
|
+
}
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
export const recoverDockerDeploymentRecords = async (options) => {
|
|
112
|
+
const resolved = {
|
|
113
|
+
dockerCommand: options.dockerCommand ?? "docker",
|
|
114
|
+
execFile: options.execFile ?? execFile,
|
|
115
|
+
timeoutMs: options.timeoutMs ?? 10_000
|
|
116
|
+
};
|
|
117
|
+
const target = await resolveDockerDeploymentTarget({
|
|
118
|
+
context: options.context,
|
|
119
|
+
dockerCommand: resolved.dockerCommand,
|
|
120
|
+
execFile: resolved.execFile,
|
|
121
|
+
timeoutMs: resolved.timeoutMs
|
|
122
|
+
});
|
|
123
|
+
const { stdout: listStdout } = await resolved.execFile(resolved.dockerCommand, withContext(options.context, [
|
|
124
|
+
"ps",
|
|
125
|
+
"-a",
|
|
126
|
+
"--filter",
|
|
127
|
+
`label=${dockerDeploymentLabelKeys.version}`,
|
|
128
|
+
"--format",
|
|
129
|
+
"{{.ID}}"
|
|
130
|
+
]), { timeout: resolved.timeoutMs });
|
|
131
|
+
const ids = listStdout.split(/\r?\n/u).map((line) => line.trim()).filter(Boolean);
|
|
132
|
+
if (ids.length === 0) {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
const { stdout } = await resolved.execFile(resolved.dockerCommand, withContext(options.context, ["inspect", ...ids]), { timeout: resolved.timeoutMs });
|
|
136
|
+
return groupByDeployment(parseInspections(stdout), options, target);
|
|
137
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DeploymentRecord } from "./record.js";
|
|
2
|
+
/** Same injectable exec shape as `artifactsExportDocker.ts`/`dockerInspect.ts` — real
|
|
3
|
+
* Docker calls are the default, tests inject a fake. */
|
|
4
|
+
export type DockerTeardownExecFile = (file: string, args: string[], options: {
|
|
5
|
+
timeout: number;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
stderr: string;
|
|
8
|
+
stdout: string;
|
|
9
|
+
}>;
|
|
10
|
+
export interface DockerTeardownRunnerOptions {
|
|
11
|
+
dockerCommand: string;
|
|
12
|
+
execFile: DockerTeardownExecFile;
|
|
13
|
+
timeoutMs: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DockerRemovalOutcome {
|
|
16
|
+
error: string | null;
|
|
17
|
+
removed: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `docker rm -f <containerRef>` — force-removes a container whether it is running or
|
|
21
|
+
* already stopped. A container Docker reports as already gone ("No such container")
|
|
22
|
+
* counts as removed: `spawnfile down` is idempotent (calling it twice, or after the
|
|
23
|
+
* container died on its own, is a success, not a partial failure).
|
|
24
|
+
*/
|
|
25
|
+
export declare const removeDockerContainer: (target: DeploymentRecord["target"], containerRef: string, options: DockerTeardownRunnerOptions) => Promise<DockerRemovalOutcome>;
|
|
26
|
+
/**
|
|
27
|
+
* `docker volume rm -f <volumeName>` — only called when the caller explicitly opts into
|
|
28
|
+
* volume removal (`spawnfile down --volumes`; the default is to retain volumes). A volume
|
|
29
|
+
* Docker reports as already gone ("No such volume") also counts as removed.
|
|
30
|
+
*/
|
|
31
|
+
export declare const removeDockerVolume: (target: DeploymentRecord["target"], volumeName: string, options: DockerTeardownRunnerOptions) => Promise<DockerRemovalOutcome>;
|
|
32
|
+
export declare const defaultDockerTeardownExecFile: DockerTeardownExecFile;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { dockerContextNameForTarget } from "./target.js";
|
|
4
|
+
const execFile = promisify(execFileCallback);
|
|
5
|
+
const withDockerTarget = (target, args) => {
|
|
6
|
+
const context = dockerContextNameForTarget(target);
|
|
7
|
+
if (context) {
|
|
8
|
+
return ["--context", context, ...args];
|
|
9
|
+
}
|
|
10
|
+
if (target.kind === "host") {
|
|
11
|
+
return ["--host", target.value, ...args];
|
|
12
|
+
}
|
|
13
|
+
return args;
|
|
14
|
+
};
|
|
15
|
+
const toErrorMessage = (error) => {
|
|
16
|
+
if (typeof error === "object" && error !== null && "stderr" in error) {
|
|
17
|
+
const stderr = error.stderr;
|
|
18
|
+
if (typeof stderr === "string" && stderr.length > 0) {
|
|
19
|
+
return stderr.trim();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return error instanceof Error ? error.message : String(error);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* `docker rm -f <containerRef>` — force-removes a container whether it is running or
|
|
26
|
+
* already stopped. A container Docker reports as already gone ("No such container")
|
|
27
|
+
* counts as removed: `spawnfile down` is idempotent (calling it twice, or after the
|
|
28
|
+
* container died on its own, is a success, not a partial failure).
|
|
29
|
+
*/
|
|
30
|
+
export const removeDockerContainer = async (target, containerRef, options) => {
|
|
31
|
+
try {
|
|
32
|
+
await options.execFile(options.dockerCommand, withDockerTarget(target, ["rm", "-f", containerRef]), { timeout: options.timeoutMs });
|
|
33
|
+
return { error: null, removed: true };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = toErrorMessage(error);
|
|
37
|
+
if (/No such container/i.test(message)) {
|
|
38
|
+
return { error: null, removed: true };
|
|
39
|
+
}
|
|
40
|
+
return { error: message, removed: false };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* `docker volume rm -f <volumeName>` — only called when the caller explicitly opts into
|
|
45
|
+
* volume removal (`spawnfile down --volumes`; the default is to retain volumes). A volume
|
|
46
|
+
* Docker reports as already gone ("No such volume") also counts as removed.
|
|
47
|
+
*/
|
|
48
|
+
export const removeDockerVolume = async (target, volumeName, options) => {
|
|
49
|
+
try {
|
|
50
|
+
await options.execFile(options.dockerCommand, withDockerTarget(target, ["volume", "rm", "-f", volumeName]), { timeout: options.timeoutMs });
|
|
51
|
+
return { error: null, removed: true };
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const message = toErrorMessage(error);
|
|
55
|
+
if (/No such volume/i.test(message)) {
|
|
56
|
+
return { error: null, removed: true };
|
|
57
|
+
}
|
|
58
|
+
return { error: message, removed: false };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
export const defaultDockerTeardownExecFile = execFile;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type DeploymentLifecycleCorrelation } from "./deploymentLifecycleCorrelation.js";
|
|
2
|
+
import { type DockerTeardownExecFile } from "./dockerTeardown.js";
|
|
3
|
+
import { type DownReceipt } from "./downReceiptTypes.js";
|
|
4
|
+
export interface DownDeploymentOptions {
|
|
5
|
+
/** Where the deployment record + compile report already live (the compile's own
|
|
6
|
+
* `--out` directory) — same convention as `exportRunArtifacts`'s `compiledOutputDirectory`. */
|
|
7
|
+
compiledOutputDirectory: string;
|
|
8
|
+
deploymentName: string;
|
|
9
|
+
dockerCommand?: string;
|
|
10
|
+
execFile?: DockerTeardownExecFile;
|
|
11
|
+
/** Auto-runs `spawnfile artifacts export` to this directory before tearing down, when
|
|
12
|
+
* this run has no export-index yet. Mutually satisfying with `force` — either one
|
|
13
|
+
* clears the export-before-teardown guard, `exportTo` by doing the export, `force` by
|
|
14
|
+
* deliberately skipping it. */
|
|
15
|
+
exportTo?: string;
|
|
16
|
+
/** Deliberately discards un-exported artifacts and proceeds without exporting. */
|
|
17
|
+
force?: boolean;
|
|
18
|
+
readerImage?: string;
|
|
19
|
+
/** Also removes this deployment's named volumes. Default: retain (see CLAUDE.md's
|
|
20
|
+
* folder rule — this is the only reversible-by-default lifecycle boundary spawnfile
|
|
21
|
+
* has: containers are cheap to recreate, the durable stores are not). */
|
|
22
|
+
removeVolumes?: boolean;
|
|
23
|
+
expectedLifecycleCorrelation?: DeploymentLifecycleCorrelation;
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* `spawnfile down` — record-driven teardown: resolves the deployment record, enforces the
|
|
28
|
+
* export-before-teardown invariant, `docker rm -f`s every recorded container unit, and
|
|
29
|
+
* (only with `--volumes`) removes named volumes. Always returns a `spawnfile.down-
|
|
30
|
+
* receipt.v1`, even when some units/volumes failed to remove (`errors` carries the
|
|
31
|
+
* per-item failures; a partial failure is never silently swallowed, but it also never
|
|
32
|
+
* stops the rest of the teardown from being attempted).
|
|
33
|
+
*/
|
|
34
|
+
export declare const downDeployment: (options: DownDeploymentOptions) => Promise<DownReceipt>;
|