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,200 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { types as nodeTypes } from "node:util";
|
|
3
|
+
import { DockerOrganizationAttachmentProviderError } from "./organizationAttachmentProvider.js";
|
|
4
|
+
import { DockerArtifactProviderError } from "./dockerArtifactsProvider.js";
|
|
5
|
+
import { DockerResourceProviderError } from "./dockerResourcesProvider.js";
|
|
6
|
+
import { DockerSecretProviderError } from "./dockerSecretsProvider.js";
|
|
7
|
+
import { DockerWorldServiceProviderError } from "./dockerWorldServiceProvider.js";
|
|
8
|
+
import { MAX_TARGET_PUBLIC_ARTIFACT_BYTES } from "./publicArtifactSnapshot.js";
|
|
9
|
+
import { DOCKER_COMMAND_ERROR, DockerCommandFailure, executeDockerCommandCore } from "./dockerCommandExecutorCore.js";
|
|
10
|
+
const role = (args) => {
|
|
11
|
+
if (args[0] === "--context") {
|
|
12
|
+
return args.length >= 3 && /^[a-z][a-z0-9_-]{0,63}$/u.test(args[1]) ? args.slice(2) : [];
|
|
13
|
+
}
|
|
14
|
+
if (args[0] === "--config") {
|
|
15
|
+
return args.length >= 5 && typeof args[1] === "string" && args[1].startsWith("/")
|
|
16
|
+
&& args[1].length <= 4_096 && !/\s/u.test(args[1])
|
|
17
|
+
&& args[2] === "--context" && /^[a-z][a-z0-9_-]{0,63}$/u.test(args[3])
|
|
18
|
+
? args.slice(4) : [];
|
|
19
|
+
}
|
|
20
|
+
return args;
|
|
21
|
+
};
|
|
22
|
+
const exactMissingImageReference = (requested, reported) => {
|
|
23
|
+
if (requested === undefined || reported === requested)
|
|
24
|
+
return reported === requested;
|
|
25
|
+
const lastSlash = requested.lastIndexOf("/");
|
|
26
|
+
const lastColon = requested.lastIndexOf(":");
|
|
27
|
+
const hasExplicitTagOrDigest = requested.includes("@") || lastColon > lastSlash;
|
|
28
|
+
return !hasExplicitTagOrDigest && reported === `${requested}:latest`;
|
|
29
|
+
};
|
|
30
|
+
const exactVolumeAbsence = (kind, command, message) => {
|
|
31
|
+
if (kind !== "resource" && kind !== "secret")
|
|
32
|
+
return undefined;
|
|
33
|
+
const inspect = command.length === 3 && command[0] === "volume" && command[1] === "inspect"
|
|
34
|
+
|| command.length === 5 && command[0] === "volume" && command[1] === "inspect"
|
|
35
|
+
&& command[2] === "--format" && typeof command[3] === "string" && command[3].length > 0;
|
|
36
|
+
const remove = command.length === 3 && command[0] === "volume" && command[1] === "rm";
|
|
37
|
+
if (!inspect && !remove)
|
|
38
|
+
return undefined;
|
|
39
|
+
const oldForm = /^(?:Error response from daemon: )?No such volume: ([A-Za-z0-9_.:-]+)$/u.exec(message);
|
|
40
|
+
const docker29Form = /^Error response from daemon: get ([A-Za-z0-9_.:-]+): no such volume$/u.exec(message);
|
|
41
|
+
const reported = oldForm?.[1] ?? docker29Form?.[1];
|
|
42
|
+
if (reported === undefined || reported !== command.at(-1))
|
|
43
|
+
return undefined;
|
|
44
|
+
return kind === "resource"
|
|
45
|
+
? new DockerResourceProviderError("not_found")
|
|
46
|
+
: new DockerSecretProviderError("not_found");
|
|
47
|
+
};
|
|
48
|
+
const classify = (kind, args, error) => {
|
|
49
|
+
if (!(error instanceof DockerCommandFailure)
|
|
50
|
+
|| !Number.isInteger(error.code) || error.code <= 0)
|
|
51
|
+
return new Error(DOCKER_COMMAND_ERROR);
|
|
52
|
+
const command = role(args);
|
|
53
|
+
const message = error.stderr.trim();
|
|
54
|
+
const missingImage = /^(?:Error response from daemon: )?No such image: ([A-Za-z0-9_.:@/-]+)$/u.exec(message);
|
|
55
|
+
if (kind === "artifact" && command[0] === "image" && command[1] === "inspect"
|
|
56
|
+
&& missingImage && exactMissingImageReference(command.at(-1), missingImage[1])) {
|
|
57
|
+
return new DockerArtifactProviderError("image_not_found");
|
|
58
|
+
}
|
|
59
|
+
const missingVolume = exactVolumeAbsence(kind, command, message);
|
|
60
|
+
if (missingVolume)
|
|
61
|
+
return missingVolume;
|
|
62
|
+
const docker29MissingNetwork = /^Error response from daemon: network ([A-Za-z0-9_.:-]+) not found$/u.exec(message);
|
|
63
|
+
if (kind === "resource" && command[0] === "network"
|
|
64
|
+
&& (command[1] === "inspect" || command[1] === "rm")
|
|
65
|
+
&& docker29MissingNetwork?.[1] === command.at(-1)) {
|
|
66
|
+
return new DockerResourceProviderError("not_found");
|
|
67
|
+
}
|
|
68
|
+
let collisionNoun;
|
|
69
|
+
if (/^(?:Error response from daemon: )?network with name [A-Za-z0-9_.:-]+ already exists$/u.test(message))
|
|
70
|
+
collisionNoun = "network";
|
|
71
|
+
else if (/^(?:Error response from daemon: )?volume [A-Za-z0-9_.:-]+ already exists$/u.test(message))
|
|
72
|
+
collisionNoun = "volume";
|
|
73
|
+
else if (/^(?:Error response from daemon: )?Conflict\. The container name "[A-Za-z0-9_.:/-]+" is already in use by container "[a-f0-9]{12,64}"\.$/u.test(message))
|
|
74
|
+
collisionNoun = "container";
|
|
75
|
+
const createNoun = command[0] === "run" ? "container"
|
|
76
|
+
: command[1] === "create" && ["container", "network", "volume"].includes(command[0])
|
|
77
|
+
? command[0] : undefined;
|
|
78
|
+
if (collisionNoun && collisionNoun === createNoun) {
|
|
79
|
+
if (kind === "resource" && collisionNoun !== "container")
|
|
80
|
+
return new DockerResourceProviderError("collision");
|
|
81
|
+
if (kind === "secret" && (collisionNoun === "volume" || collisionNoun === "container"))
|
|
82
|
+
return new DockerSecretProviderError("collision");
|
|
83
|
+
if (kind === "world" && collisionNoun === "container")
|
|
84
|
+
return new DockerWorldServiceProviderError("collision");
|
|
85
|
+
}
|
|
86
|
+
const missing = /^(?:Error response from daemon: )?No such (container|network): [A-Za-z0-9_.:/-]+$/u.exec(message);
|
|
87
|
+
const noun = command[0];
|
|
88
|
+
const mutation = command[1];
|
|
89
|
+
const roleEligible = kind === "resource"
|
|
90
|
+
? (noun === "network" || noun === "volume")
|
|
91
|
+
&& (mutation === "inspect" || mutation === "rm")
|
|
92
|
+
: kind === "secret"
|
|
93
|
+
? noun === "volume" && (mutation === "inspect" || mutation === "rm")
|
|
94
|
+
|| noun === "container" && ["inspect", "rm", "wait", "stop"].includes(mutation)
|
|
95
|
+
: kind === "attachment"
|
|
96
|
+
? noun === "container" && mutation === "inspect"
|
|
97
|
+
|| noun === "network" && ["inspect", "connect", "disconnect"].includes(mutation)
|
|
98
|
+
: noun === "container" && ["inspect", "rm", "stop"].includes(mutation);
|
|
99
|
+
const nounMatches = Boolean(missing) && (missing[1] === command[0]
|
|
100
|
+
|| kind === "attachment" && command[0] === "network"
|
|
101
|
+
&& (mutation === "connect" || mutation === "disconnect")
|
|
102
|
+
&& (missing[1] === "network" || missing[1] === "container"));
|
|
103
|
+
if (roleEligible && nounMatches) {
|
|
104
|
+
if (kind === "resource" && missing[1] === "network")
|
|
105
|
+
return new DockerResourceProviderError("not_found");
|
|
106
|
+
if (kind === "secret" && missing[1] === "container")
|
|
107
|
+
return new DockerSecretProviderError("not_found");
|
|
108
|
+
if (kind === "attachment")
|
|
109
|
+
return new DockerOrganizationAttachmentProviderError("not_found");
|
|
110
|
+
if (kind === "world" && missing[1] === "container")
|
|
111
|
+
return new DockerWorldServiceProviderError("not_found");
|
|
112
|
+
}
|
|
113
|
+
return new Error(DOCKER_COMMAND_ERROR);
|
|
114
|
+
};
|
|
115
|
+
const normalizeCommandOptions = (raw, allowStdin) => {
|
|
116
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw) || nodeTypes.isProxy(raw)
|
|
117
|
+
|| Object.getPrototypeOf(raw) !== Object.prototype)
|
|
118
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
119
|
+
const keys = Reflect.ownKeys(raw);
|
|
120
|
+
const allowed = allowStdin ? ["signal", "stdin", "timeout"] : ["signal", "timeout"];
|
|
121
|
+
if (keys.some((key) => typeof key !== "string" || !allowed.includes(key))
|
|
122
|
+
|| !keys.includes("timeout"))
|
|
123
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
124
|
+
const descriptors = Object.getOwnPropertyDescriptors(raw);
|
|
125
|
+
if (Object.values(descriptors).some((descriptor) => !descriptor.enumerable || !("value" in descriptor)))
|
|
126
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
127
|
+
return {
|
|
128
|
+
signal: descriptors.signal?.value,
|
|
129
|
+
stdin: descriptors.stdin?.value,
|
|
130
|
+
timeout: descriptors.timeout.value
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
export const createDockerTargetExecutors = (options = {}) => {
|
|
134
|
+
if (!options || typeof options !== "object" || Array.isArray(options)
|
|
135
|
+
|| nodeTypes.isProxy(options) || Object.getPrototypeOf(options) !== Object.prototype) {
|
|
136
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
137
|
+
}
|
|
138
|
+
const descriptors = Object.getOwnPropertyDescriptors(options);
|
|
139
|
+
if (Reflect.ownKeys(options).some((key) => typeof key !== "string"
|
|
140
|
+
|| !["dockerCommand", "spawn"].includes(key))
|
|
141
|
+
|| Object.values(descriptors).some((descriptor) => !("value" in descriptor))) {
|
|
142
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
143
|
+
}
|
|
144
|
+
const spawnCommand = descriptors.spawn?.value
|
|
145
|
+
?? spawn;
|
|
146
|
+
const dockerCommand = descriptors.dockerCommand?.value ?? "docker";
|
|
147
|
+
if (typeof spawnCommand !== "function")
|
|
148
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
149
|
+
const text = (kind) => async (file, args, commandOptions) => {
|
|
150
|
+
try {
|
|
151
|
+
if (file !== "docker")
|
|
152
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
153
|
+
const normalized = normalizeCommandOptions(commandOptions, true);
|
|
154
|
+
const result = await executeDockerCommandCore(spawnCommand, dockerCommand, args, {
|
|
155
|
+
...normalized, binary: false
|
|
156
|
+
});
|
|
157
|
+
return { stderr: result.stderr, stdout: result.stdout };
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
throw kind ? classify(kind, args, error) : new Error(DOCKER_COMMAND_ERROR);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
artifact: text("artifact"),
|
|
165
|
+
attachment: text("attachment"),
|
|
166
|
+
evidenceExport: async (file, args, commandOptions) => {
|
|
167
|
+
try {
|
|
168
|
+
if (file !== "docker")
|
|
169
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
170
|
+
const normalized = normalizeCommandOptions(commandOptions, false);
|
|
171
|
+
const result = await executeDockerCommandCore(spawnCommand, dockerCommand, args, {
|
|
172
|
+
...normalized, binary: true
|
|
173
|
+
});
|
|
174
|
+
return { bytes: result.stdout };
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
publicArtifact: async (file, args, commandOptions) => {
|
|
181
|
+
try {
|
|
182
|
+
if (file !== "docker")
|
|
183
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
184
|
+
const normalized = normalizeCommandOptions(commandOptions, false);
|
|
185
|
+
const result = await executeDockerCommandCore(spawnCommand, dockerCommand, args, {
|
|
186
|
+
...normalized,
|
|
187
|
+
binary: true,
|
|
188
|
+
stdoutCap: MAX_TARGET_PUBLIC_ARTIFACT_BYTES
|
|
189
|
+
});
|
|
190
|
+
return { bytes: Uint8Array.from(result.stdout) };
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
resource: text("resource"),
|
|
197
|
+
secret: text("secret"),
|
|
198
|
+
world: text("world")
|
|
199
|
+
});
|
|
200
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
2
|
+
export declare const DOCKER_COMMAND_ERROR = "Docker command failed";
|
|
3
|
+
export declare const DOCKER_TEXT_CAP = 32768;
|
|
4
|
+
export declare const DOCKER_BINARY_CAP = 67108864;
|
|
5
|
+
export interface SpawnedDockerCommand {
|
|
6
|
+
readonly stderr: Readable;
|
|
7
|
+
readonly stdin: Writable;
|
|
8
|
+
readonly stdout: Readable;
|
|
9
|
+
kill(signal?: NodeJS.Signals): boolean;
|
|
10
|
+
off(event: string, listener: (...args: never[]) => void): this;
|
|
11
|
+
on(event: string, listener: (...args: never[]) => void): this;
|
|
12
|
+
once(event: string, listener: (...args: never[]) => void): this;
|
|
13
|
+
}
|
|
14
|
+
export type DockerCommandSpawn = (file: string, args: readonly string[], options: {
|
|
15
|
+
readonly shell: false;
|
|
16
|
+
readonly stdio: ["pipe", "pipe", "pipe"];
|
|
17
|
+
}) => SpawnedDockerCommand;
|
|
18
|
+
export declare class DockerCommandFailure extends Error {
|
|
19
|
+
readonly code: number;
|
|
20
|
+
readonly stderr: string;
|
|
21
|
+
constructor(code: number, stderr: string);
|
|
22
|
+
}
|
|
23
|
+
export interface DockerCommandCoreOptions {
|
|
24
|
+
readonly binary: boolean;
|
|
25
|
+
readonly signal?: AbortSignal;
|
|
26
|
+
readonly stdin?: Uint8Array;
|
|
27
|
+
readonly stdoutCap?: number;
|
|
28
|
+
readonly timeout: number;
|
|
29
|
+
}
|
|
30
|
+
export interface DockerCommandCoreResult {
|
|
31
|
+
readonly stderr: string;
|
|
32
|
+
readonly stdout: string | Uint8Array;
|
|
33
|
+
}
|
|
34
|
+
export declare const executeDockerCommandCore: (spawnCommand: DockerCommandSpawn, file: string, args: readonly string[], rawOptions: DockerCommandCoreOptions) => Promise<DockerCommandCoreResult>;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { types as nodeTypes } from "node:util";
|
|
3
|
+
export const DOCKER_COMMAND_ERROR = "Docker command failed";
|
|
4
|
+
export const DOCKER_TEXT_CAP = 32_768;
|
|
5
|
+
export const DOCKER_BINARY_CAP = 67_108_864;
|
|
6
|
+
const FALLBACK_MS = 50;
|
|
7
|
+
export class DockerCommandFailure extends Error {
|
|
8
|
+
code;
|
|
9
|
+
stderr;
|
|
10
|
+
constructor(code, stderr) {
|
|
11
|
+
super(DOCKER_COMMAND_ERROR);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.stderr = stderr;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const ordinaryOptions = (raw) => {
|
|
17
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw) || nodeTypes.isProxy(raw)
|
|
18
|
+
|| Object.getPrototypeOf(raw) !== Object.prototype)
|
|
19
|
+
return false;
|
|
20
|
+
const value = raw;
|
|
21
|
+
const keys = Reflect.ownKeys(value);
|
|
22
|
+
if (keys.some((key) => typeof key !== "string"))
|
|
23
|
+
return false;
|
|
24
|
+
const names = keys.sort();
|
|
25
|
+
const data = Object.fromEntries(names.map((key) => {
|
|
26
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
27
|
+
return [key, descriptor && "value" in descriptor && descriptor.enumerable
|
|
28
|
+
? descriptor.value : Symbol("invalid")];
|
|
29
|
+
}));
|
|
30
|
+
if (!names.every((key) => ["binary", "signal", "stdin", "stdoutCap", "timeout"].includes(key))
|
|
31
|
+
|| !names.includes("binary") || !names.includes("timeout")
|
|
32
|
+
|| typeof data.binary !== "boolean"
|
|
33
|
+
|| data.stdoutCap !== undefined && (!Number.isSafeInteger(data.stdoutCap)
|
|
34
|
+
|| data.stdoutCap < 1
|
|
35
|
+
|| data.stdoutCap > (data.binary ? DOCKER_BINARY_CAP : DOCKER_TEXT_CAP))
|
|
36
|
+
|| !Number.isSafeInteger(data.timeout) || data.timeout < 1
|
|
37
|
+
|| data.timeout > 120_000
|
|
38
|
+
|| data.signal !== undefined && !(data.signal instanceof AbortSignal)
|
|
39
|
+
|| data.stdin !== undefined && (!(data.stdin instanceof Uint8Array)
|
|
40
|
+
|| nodeTypes.isProxy(data.stdin)))
|
|
41
|
+
return false;
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
const validate = (file, args, options) => {
|
|
45
|
+
if (typeof file !== "string" || file.length < 1 || file.length > 128 || file.includes("\0")
|
|
46
|
+
|| Buffer.from(file, "utf8").toString("utf8") !== file
|
|
47
|
+
|| !Array.isArray(args) || nodeTypes.isProxy(args)
|
|
48
|
+
|| Object.getPrototypeOf(args) !== Array.prototype || args.length > 1_024
|
|
49
|
+
|| !ordinaryOptions(options))
|
|
50
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
51
|
+
const ownKeys = Reflect.ownKeys(args);
|
|
52
|
+
if (ownKeys.length !== args.length + 1 || !ownKeys.includes("length")) {
|
|
53
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
54
|
+
}
|
|
55
|
+
let total = 0;
|
|
56
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
57
|
+
const descriptor = Object.getOwnPropertyDescriptor(args, String(index));
|
|
58
|
+
if (!descriptor || !("value" in descriptor) || !descriptor.enumerable) {
|
|
59
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
60
|
+
}
|
|
61
|
+
const arg = descriptor.value;
|
|
62
|
+
if (typeof arg !== "string" || arg.includes("\0")
|
|
63
|
+
|| Buffer.from(arg, "utf8").toString("utf8") !== arg)
|
|
64
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
65
|
+
total += Buffer.byteLength(arg, "utf8");
|
|
66
|
+
if (total > 262_144)
|
|
67
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const decode = (chunks) => {
|
|
71
|
+
try {
|
|
72
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks));
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
throw new Error(DOCKER_COMMAND_ERROR);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
export const executeDockerCommandCore = (spawnCommand, file, args, rawOptions) => {
|
|
79
|
+
validate(file, args, rawOptions);
|
|
80
|
+
const options = rawOptions;
|
|
81
|
+
if (options.signal?.aborted)
|
|
82
|
+
return Promise.reject(new Error(DOCKER_COMMAND_ERROR));
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
let child;
|
|
85
|
+
try {
|
|
86
|
+
child = spawnCommand(file, args, { shell: false, stdio: ["pipe", "pipe", "pipe"] });
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
reject(new Error(DOCKER_COMMAND_ERROR));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const stdoutChunks = [];
|
|
93
|
+
const stderrChunks = [];
|
|
94
|
+
let stdin = options.stdin;
|
|
95
|
+
let stdoutBytes = 0;
|
|
96
|
+
let stderrBytes = 0;
|
|
97
|
+
let childClosed = false;
|
|
98
|
+
let stdoutClosed = false;
|
|
99
|
+
let stderrClosed = false;
|
|
100
|
+
let stdinDone = false;
|
|
101
|
+
let stdinClosed = false;
|
|
102
|
+
let closeCode = null;
|
|
103
|
+
let terminal;
|
|
104
|
+
let settled = false;
|
|
105
|
+
let killed = false;
|
|
106
|
+
let fallback;
|
|
107
|
+
const swallow = () => undefined;
|
|
108
|
+
const clearBuffers = () => {
|
|
109
|
+
stdoutChunks.splice(0);
|
|
110
|
+
stderrChunks.splice(0);
|
|
111
|
+
stdin = undefined;
|
|
112
|
+
};
|
|
113
|
+
const cleanup = () => {
|
|
114
|
+
clearTimeout(timeout);
|
|
115
|
+
if (fallback)
|
|
116
|
+
clearTimeout(fallback);
|
|
117
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
118
|
+
child.off("error", onChildError);
|
|
119
|
+
child.off("close", onChildClose);
|
|
120
|
+
child.stdout.off("data", onStdoutData);
|
|
121
|
+
child.stderr.off("data", onStderrData);
|
|
122
|
+
child.stdout.off("error", onStreamError);
|
|
123
|
+
child.stderr.off("error", onStreamError);
|
|
124
|
+
child.stdin.off("error", onStreamError);
|
|
125
|
+
child.stdout.off("close", onStdoutClose);
|
|
126
|
+
child.stderr.off("close", onStderrClose);
|
|
127
|
+
child.stdin.off("close", onStdinClose);
|
|
128
|
+
clearBuffers();
|
|
129
|
+
};
|
|
130
|
+
const absorbUntilClose = (stream, alreadyClosed) => {
|
|
131
|
+
if (alreadyClosed)
|
|
132
|
+
return;
|
|
133
|
+
const release = () => { stream.off("error", swallow); };
|
|
134
|
+
stream.on("error", swallow);
|
|
135
|
+
stream.once("close", release);
|
|
136
|
+
};
|
|
137
|
+
const absorbLateErrors = () => {
|
|
138
|
+
if (!childClosed) {
|
|
139
|
+
const release = () => { child.off("error", swallow); };
|
|
140
|
+
child.on("error", swallow);
|
|
141
|
+
child.once("close", release);
|
|
142
|
+
}
|
|
143
|
+
absorbUntilClose(child.stdout, stdoutClosed);
|
|
144
|
+
absorbUntilClose(child.stderr, stderrClosed);
|
|
145
|
+
absorbUntilClose(child.stdin, stdinClosed);
|
|
146
|
+
};
|
|
147
|
+
const settle = (error, result, absorbLate = true) => {
|
|
148
|
+
if (settled)
|
|
149
|
+
return;
|
|
150
|
+
settled = true;
|
|
151
|
+
cleanup();
|
|
152
|
+
if (absorbLate)
|
|
153
|
+
absorbLateErrors();
|
|
154
|
+
if (error)
|
|
155
|
+
reject(error);
|
|
156
|
+
else
|
|
157
|
+
resolve(result);
|
|
158
|
+
};
|
|
159
|
+
const settleTerminated = () => settle(terminal ?? new Error(DOCKER_COMMAND_ERROR), undefined, true);
|
|
160
|
+
const requestTermination = (error) => {
|
|
161
|
+
if (settled || terminal)
|
|
162
|
+
return;
|
|
163
|
+
terminal = error;
|
|
164
|
+
if (!killed) {
|
|
165
|
+
killed = true;
|
|
166
|
+
try {
|
|
167
|
+
child.kill("SIGKILL");
|
|
168
|
+
}
|
|
169
|
+
catch { /* bounded fallback settles safely */ }
|
|
170
|
+
}
|
|
171
|
+
fallback = setTimeout(settleTerminated, FALLBACK_MS);
|
|
172
|
+
};
|
|
173
|
+
const maybeSettle = () => {
|
|
174
|
+
if (settled)
|
|
175
|
+
return;
|
|
176
|
+
if (terminal) {
|
|
177
|
+
if (childClosed)
|
|
178
|
+
settleTerminated();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (!childClosed || !stdoutClosed || !stderrClosed || !stdinDone)
|
|
182
|
+
return;
|
|
183
|
+
if (!Number.isInteger(closeCode) || closeCode === null || closeCode < 0) {
|
|
184
|
+
settle(new Error(DOCKER_COMMAND_ERROR));
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
let stderr;
|
|
188
|
+
let stdout;
|
|
189
|
+
try {
|
|
190
|
+
stderr = decode(stderrChunks);
|
|
191
|
+
stdout = options.binary
|
|
192
|
+
? Uint8Array.from(Buffer.concat(stdoutChunks))
|
|
193
|
+
: decode(stdoutChunks);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
settle(new Error(DOCKER_COMMAND_ERROR));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (closeCode !== 0) {
|
|
200
|
+
settle(new DockerCommandFailure(closeCode, stderr));
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
settle(undefined, { stderr, stdout });
|
|
204
|
+
};
|
|
205
|
+
const append = (target, chunk, current, cap) => {
|
|
206
|
+
let value;
|
|
207
|
+
try {
|
|
208
|
+
value = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
requestTermination(new Error(DOCKER_COMMAND_ERROR));
|
|
212
|
+
return current;
|
|
213
|
+
}
|
|
214
|
+
const next = current + value.byteLength;
|
|
215
|
+
if (next > cap) {
|
|
216
|
+
requestTermination(new Error(DOCKER_COMMAND_ERROR));
|
|
217
|
+
return next;
|
|
218
|
+
}
|
|
219
|
+
target.push(Buffer.from(value));
|
|
220
|
+
return next;
|
|
221
|
+
};
|
|
222
|
+
function onStdoutData(chunk) {
|
|
223
|
+
stdoutBytes = append(stdoutChunks, chunk, stdoutBytes, options.stdoutCap ?? (options.binary ? DOCKER_BINARY_CAP : DOCKER_TEXT_CAP));
|
|
224
|
+
}
|
|
225
|
+
function onStderrData(chunk) {
|
|
226
|
+
stderrBytes = append(stderrChunks, chunk, stderrBytes, DOCKER_TEXT_CAP);
|
|
227
|
+
}
|
|
228
|
+
function onChildError() { requestTermination(new Error(DOCKER_COMMAND_ERROR)); }
|
|
229
|
+
function onStreamError() { requestTermination(new Error(DOCKER_COMMAND_ERROR)); }
|
|
230
|
+
function onChildClose(code) {
|
|
231
|
+
childClosed = true;
|
|
232
|
+
closeCode = code;
|
|
233
|
+
maybeSettle();
|
|
234
|
+
}
|
|
235
|
+
function onStdoutClose() { stdoutClosed = true; maybeSettle(); }
|
|
236
|
+
function onStderrClose() { stderrClosed = true; maybeSettle(); }
|
|
237
|
+
function onStdinClose() { stdinClosed = true; }
|
|
238
|
+
function onAbort() { requestTermination(new Error(DOCKER_COMMAND_ERROR)); }
|
|
239
|
+
child.stdout.on("data", onStdoutData);
|
|
240
|
+
child.stderr.on("data", onStderrData);
|
|
241
|
+
child.on("error", onChildError);
|
|
242
|
+
child.on("close", onChildClose);
|
|
243
|
+
child.stdout.on("error", onStreamError);
|
|
244
|
+
child.stderr.on("error", onStreamError);
|
|
245
|
+
child.stdin.on("error", onStreamError);
|
|
246
|
+
child.stdout.on("close", onStdoutClose);
|
|
247
|
+
child.stderr.on("close", onStderrClose);
|
|
248
|
+
child.stdin.on("close", onStdinClose);
|
|
249
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
250
|
+
const timeout = setTimeout(() => requestTermination(new Error(DOCKER_COMMAND_ERROR)), options.timeout);
|
|
251
|
+
if (options.signal?.aborted)
|
|
252
|
+
requestTermination(new Error(DOCKER_COMMAND_ERROR));
|
|
253
|
+
if (settled || terminal)
|
|
254
|
+
return;
|
|
255
|
+
try {
|
|
256
|
+
const view = stdin
|
|
257
|
+
? Buffer.from(stdin.buffer, stdin.byteOffset, stdin.byteLength)
|
|
258
|
+
: undefined;
|
|
259
|
+
child.stdin.end(view, (error) => {
|
|
260
|
+
if (error) {
|
|
261
|
+
requestTermination(new Error(DOCKER_COMMAND_ERROR));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
stdinDone = true;
|
|
265
|
+
stdin = undefined;
|
|
266
|
+
maybeSettle();
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
requestTermination(new Error(DOCKER_COMMAND_ERROR));
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DockerArtifactExecutor } from "./dockerArtifactsProvider.js";
|
|
2
|
+
import type { DockerTargetLocalBundleBuilder } from "./containerBundle.js";
|
|
3
|
+
/** Private Docker lowering. It refuses tag adoption; durable post-build recovery uses inspect() instead. */
|
|
4
|
+
export declare const createDockerTargetLocalBundleBuilder: (input: {
|
|
5
|
+
readonly context: string;
|
|
6
|
+
readonly executor: DockerArtifactExecutor;
|
|
7
|
+
readonly timeoutMs?: number;
|
|
8
|
+
}) => DockerTargetLocalBundleBuilder;
|