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
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import * as ts from "typescript";
|
|
4
|
+
const normalize = (value) => value.replace(/\\/g, "/");
|
|
5
|
+
const fixturePath = (value) => {
|
|
6
|
+
const normalized = normalize(value);
|
|
7
|
+
const index = normalized.toLowerCase().indexOf("ecosystem/simfile/fixtures");
|
|
8
|
+
if (index < 0 || (index > 0 && !/[\\/]/u.test(normalized[index - 1])))
|
|
9
|
+
return null;
|
|
10
|
+
return normalized.slice(index);
|
|
11
|
+
};
|
|
12
|
+
const aliasesFor = (sourceFile) => {
|
|
13
|
+
const namespaceAliases = new Set();
|
|
14
|
+
const functionAliases = new Map();
|
|
15
|
+
for (const statement of sourceFile.statements) {
|
|
16
|
+
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)
|
|
17
|
+
|| !["node:path", "path"].includes(statement.moduleSpecifier.text))
|
|
18
|
+
continue;
|
|
19
|
+
const clause = statement.importClause;
|
|
20
|
+
if (!clause)
|
|
21
|
+
continue;
|
|
22
|
+
if (clause.name)
|
|
23
|
+
namespaceAliases.add(clause.name.text);
|
|
24
|
+
if (!clause.namedBindings)
|
|
25
|
+
continue;
|
|
26
|
+
if (ts.isNamespaceImport(clause.namedBindings))
|
|
27
|
+
namespaceAliases.add(clause.namedBindings.name.text);
|
|
28
|
+
if (ts.isNamedImports(clause.namedBindings)) {
|
|
29
|
+
for (const element of clause.namedBindings.elements) {
|
|
30
|
+
const imported = element.propertyName?.text ?? element.name.text;
|
|
31
|
+
if (imported === "join" || imported === "resolve")
|
|
32
|
+
functionAliases.set(element.name.text, imported);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { namespaceAliases, functionAliases };
|
|
37
|
+
};
|
|
38
|
+
const pathCallViolations = (node, aliases, sourceFile) => {
|
|
39
|
+
const callee = node.expression;
|
|
40
|
+
let kind = null;
|
|
41
|
+
if (ts.isPropertyAccessExpression(callee) && ts.isIdentifier(callee.expression)
|
|
42
|
+
&& aliases.namespaceAliases.has(callee.expression.text) && ["join", "resolve"].includes(callee.name.text)) {
|
|
43
|
+
kind = callee.name.text;
|
|
44
|
+
}
|
|
45
|
+
else if (ts.isIdentifier(callee)) {
|
|
46
|
+
kind = aliases.functionAliases.get(callee.text) ?? null;
|
|
47
|
+
}
|
|
48
|
+
if (!kind)
|
|
49
|
+
return [];
|
|
50
|
+
const segments = node.arguments.map((argument) => ts.isStringLiteral(argument) || ts.isNoSubstitutionTemplateLiteral(argument) ? normalize(argument.text) : null);
|
|
51
|
+
const start = segments.findIndex((segment, index) => index <= segments.length - 3 && segment === "ecosystem" && segments[index + 1] === "simfile" && segments[index + 2] === "fixtures");
|
|
52
|
+
if (start < 0)
|
|
53
|
+
return [];
|
|
54
|
+
const matchedSegments = [];
|
|
55
|
+
for (const segment of segments.slice(start)) {
|
|
56
|
+
if (segment === null)
|
|
57
|
+
break;
|
|
58
|
+
matchedSegments.push(segment);
|
|
59
|
+
}
|
|
60
|
+
return [{
|
|
61
|
+
file: path.relative(process.cwd(), sourceFile.fileName),
|
|
62
|
+
classification: kind === "join" ? "simfile-scenario-path-join" : "simfile-scenario-path-resolve",
|
|
63
|
+
matchedPath: matchedSegments.join("/")
|
|
64
|
+
}];
|
|
65
|
+
};
|
|
66
|
+
export const scanSimfileFixtureSource = (text, file = "synthetic.ts") => {
|
|
67
|
+
const sourceFile = ts.createSourceFile(file, text, ts.ScriptTarget.ES2022, true, ts.ScriptKind.TS);
|
|
68
|
+
const aliases = aliasesFor(sourceFile);
|
|
69
|
+
const violations = [];
|
|
70
|
+
const visit = (node) => {
|
|
71
|
+
if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) {
|
|
72
|
+
const matchedPath = fixturePath(node.text);
|
|
73
|
+
if (matchedPath)
|
|
74
|
+
violations.push({ file, classification: "simfile-scenario-direct-literal", matchedPath });
|
|
75
|
+
}
|
|
76
|
+
if (ts.isCallExpression(node))
|
|
77
|
+
violations.push(...pathCallViolations(node, aliases, sourceFile));
|
|
78
|
+
ts.forEachChild(node, visit);
|
|
79
|
+
};
|
|
80
|
+
visit(sourceFile);
|
|
81
|
+
return violations;
|
|
82
|
+
};
|
|
83
|
+
export const scanSimfileFixtureFile = async (file) => scanSimfileFixtureSource(await readFile(file, "utf8"), file);
|
|
84
|
+
const typescriptFiles = async (directory) => {
|
|
85
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
86
|
+
const nested = await Promise.all(entries.map(async (entry) => {
|
|
87
|
+
const file = path.join(directory, entry.name);
|
|
88
|
+
if (entry.isDirectory())
|
|
89
|
+
return typescriptFiles(file);
|
|
90
|
+
return entry.isFile() && entry.name.endsWith(".ts") ? [file] : [];
|
|
91
|
+
}));
|
|
92
|
+
return nested.flat();
|
|
93
|
+
};
|
|
94
|
+
export const scanSimfileFixtureTree = async (repositoryRoot) => {
|
|
95
|
+
const excluded = new Set([
|
|
96
|
+
path.resolve(repositoryRoot, "src/deployment/providerRuntimeBoundary.test.ts"),
|
|
97
|
+
path.resolve(repositoryRoot, "src/deployment/simfileFixtureBoundary.test-helper.ts")
|
|
98
|
+
]);
|
|
99
|
+
const files = (await typescriptFiles(path.join(repositoryRoot, "src")))
|
|
100
|
+
.map((file) => path.resolve(file))
|
|
101
|
+
.filter((file) => !excluded.has(file));
|
|
102
|
+
return (await Promise.all(files.map(scanSimfileFixtureFile))).flat();
|
|
103
|
+
};
|
|
@@ -1,35 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
endpoint_fingerprint: string;
|
|
3
|
-
kind: "context";
|
|
4
|
-
name: string;
|
|
5
|
-
} | {
|
|
6
|
-
endpoint_fingerprint: string;
|
|
7
|
-
kind: "docker-context";
|
|
8
|
-
context: string;
|
|
9
|
-
} | {
|
|
10
|
-
kind: "host";
|
|
11
|
-
value: string;
|
|
12
|
-
};
|
|
13
|
-
export type DockerTargetExecFile = (file: string, args: string[], options: {
|
|
14
|
-
timeout: number;
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
stderr: string;
|
|
17
|
-
stdout: string;
|
|
18
|
-
}>;
|
|
19
|
-
export interface ResolveDockerDeploymentTargetOptions {
|
|
20
|
-
context?: string | null;
|
|
21
|
-
dockerCommand?: string;
|
|
22
|
-
dockerHost?: string | null;
|
|
23
|
-
execFile?: DockerTargetExecFile;
|
|
24
|
-
timeoutMs?: number;
|
|
25
|
-
}
|
|
26
|
-
export declare const createEndpointFingerprint: (endpoint: string) => string;
|
|
27
|
-
export declare const createDockerDeploymentTarget: (input: {
|
|
28
|
-
context?: string;
|
|
29
|
-
endpoint?: string;
|
|
30
|
-
host?: string;
|
|
31
|
-
}) => DockerDeploymentTarget;
|
|
32
|
-
export declare const dockerContextNameForTarget: (target: DockerDeploymentTarget) => string | null;
|
|
33
|
-
export declare const dockerHostValueForTarget: (target: DockerDeploymentTarget) => string | null;
|
|
34
|
-
export declare const resolveDockerDeploymentTarget: (input?: ResolveDockerDeploymentTargetOptions) => Promise<DockerDeploymentTarget>;
|
|
35
|
-
export declare const verifyDockerDeploymentTarget: (target: DockerDeploymentTarget, options?: Omit<ResolveDockerDeploymentTargetOptions, "context" | "dockerHost">) => Promise<string | null>;
|
|
1
|
+
export * from "../target/dockerTarget.js";
|
|
@@ -1,96 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { execFile as execFileCallback } from "node:child_process";
|
|
3
|
-
import { promisify } from "node:util";
|
|
4
|
-
import { SpawnfileError } from "../shared/index.js";
|
|
5
|
-
const execFile = promisify(execFileCallback);
|
|
6
|
-
export const createEndpointFingerprint = (endpoint) => {
|
|
7
|
-
const normalized = endpoint.trim();
|
|
8
|
-
if (normalized.length === 0) {
|
|
9
|
-
throw new SpawnfileError("validation_error", "Deployment target endpoint must not be empty");
|
|
10
|
-
}
|
|
11
|
-
return `sha256:${createHash("sha256").update(normalized).digest("hex").slice(0, 32)}`;
|
|
12
|
-
};
|
|
13
|
-
const parseDockerEndpoint = (stdout) => {
|
|
14
|
-
const trimmed = stdout.trim();
|
|
15
|
-
if (trimmed.length === 0) {
|
|
16
|
-
throw new SpawnfileError("runtime_error", "Docker context endpoint was empty");
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
const parsed = JSON.parse(trimmed);
|
|
20
|
-
if (typeof parsed === "string" && parsed.trim().length > 0) {
|
|
21
|
-
return parsed.trim();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
// Docker/podman variants may return a plain string instead of JSON.
|
|
26
|
-
}
|
|
27
|
-
return trimmed;
|
|
28
|
-
};
|
|
29
|
-
const resolveDockerContextEndpoint = async (context, options) => {
|
|
30
|
-
try {
|
|
31
|
-
const { stdout } = await options.execFile(options.dockerCommand, ["context", "inspect", context, "--format", "{{json .Endpoints.docker.Host}}"], { timeout: options.timeoutMs });
|
|
32
|
-
return parseDockerEndpoint(stdout);
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
36
|
-
throw new SpawnfileError("runtime_error", `Unable to resolve Docker context "${context}": ${reason}`);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export const createDockerDeploymentTarget = (input) => {
|
|
40
|
-
const host = input.host?.trim();
|
|
41
|
-
if (host) {
|
|
42
|
-
return {
|
|
43
|
-
kind: "host",
|
|
44
|
-
value: host
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const context = input.context?.trim();
|
|
48
|
-
const endpoint = input.endpoint?.trim();
|
|
49
|
-
if (!context || !endpoint) {
|
|
50
|
-
throw new SpawnfileError("validation_error", "Docker context deployment targets require both context and endpoint");
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
name: context,
|
|
54
|
-
endpoint_fingerprint: createEndpointFingerprint(endpoint),
|
|
55
|
-
kind: "context"
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export const dockerContextNameForTarget = (target) => target.kind === "context"
|
|
59
|
-
? target.name
|
|
60
|
-
: target.kind === "docker-context"
|
|
61
|
-
? target.context
|
|
62
|
-
: null;
|
|
63
|
-
export const dockerHostValueForTarget = (target) => target.kind === "host" ? target.value : null;
|
|
64
|
-
export const resolveDockerDeploymentTarget = async (input = {}) => {
|
|
65
|
-
const explicitContext = input.context?.trim();
|
|
66
|
-
const host = explicitContext ? undefined : input.dockerHost?.trim() ?? process.env.DOCKER_HOST?.trim();
|
|
67
|
-
if (host) {
|
|
68
|
-
return createDockerDeploymentTarget({ host });
|
|
69
|
-
}
|
|
70
|
-
const resolvedOptions = {
|
|
71
|
-
dockerCommand: input.dockerCommand ?? "docker",
|
|
72
|
-
execFile: input.execFile ?? execFile,
|
|
73
|
-
timeoutMs: input.timeoutMs ?? 10_000
|
|
74
|
-
};
|
|
75
|
-
const context = explicitContext || "default";
|
|
76
|
-
const endpoint = await resolveDockerContextEndpoint(context, resolvedOptions);
|
|
77
|
-
return createDockerDeploymentTarget({ context, endpoint });
|
|
78
|
-
};
|
|
79
|
-
export const verifyDockerDeploymentTarget = async (target, options = {}) => {
|
|
80
|
-
if (target.kind === "host") {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const context = dockerContextNameForTarget(target);
|
|
84
|
-
if (!context) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const current = await resolveDockerDeploymentTarget({
|
|
88
|
-
...options,
|
|
89
|
-
context
|
|
90
|
-
});
|
|
91
|
-
const currentFingerprint = current.kind === "host" ? null : current.endpoint_fingerprint;
|
|
92
|
-
if (currentFingerprint !== target.endpoint_fingerprint) {
|
|
93
|
-
throw new SpawnfileError("runtime_error", `Docker context "${context}" endpoint changed since deployment`);
|
|
94
|
-
}
|
|
95
|
-
return context;
|
|
96
|
-
};
|
|
1
|
+
export * from "../target/dockerTarget.js";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type OrganizationReadiness } from "./organizationReady.js";
|
|
3
|
+
import { type OrganizationHandoff } from "./organizationHandoffTypes.js";
|
|
4
|
+
import { type OpaqueTargetHandle } from "../target/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* `spawnfile.up-receipt.v1` — the machine contract `spawnfile up --json` writes to stdout
|
|
7
|
+
* (contracts.md's Spawnfile up-receipt registry row; Decision 21's Piece 4). It is thin by
|
|
8
|
+
* design: enough for a non-Docker caller (simfile's sim harness, later its supervisor) to
|
|
9
|
+
* drive lifecycle without touching Docker directly, per `contracts.md`'s rule that
|
|
10
|
+
* "Simfile -> spawnfile only through documented CLI + versioned receipts".
|
|
11
|
+
*
|
|
12
|
+
* `compiled_schedule` is populated even though nothing consumes it yet — it freezes the
|
|
13
|
+
* shape simfile's wake-diff (the expected-wake denominator oracle, see contracts.md's
|
|
14
|
+
* `simfile.run-manifest.v1` field notes) will read from later, so the receipt shape does
|
|
15
|
+
* not need to change again when that consumer lands.
|
|
16
|
+
*
|
|
17
|
+
* No credentials/tokens ever belong on this contract (contracts.md: "No credentials in
|
|
18
|
+
* exchanged artifacts") — `moltnet_base_url` is a bare URL, never an auth header/token.
|
|
19
|
+
*/
|
|
20
|
+
export declare const UP_RECEIPT_VERSION: "spawnfile.up-receipt.v1";
|
|
21
|
+
declare const readinessStateSchema: z.ZodUnion<readonly [z.ZodLiteral<"running">, z.ZodLiteral<"exited">, z.ZodLiteral<"unknown">]>;
|
|
22
|
+
export type UpReceiptReadinessState = z.infer<typeof readinessStateSchema>;
|
|
23
|
+
declare const compiledScheduleEntrySchema: z.ZodObject<{
|
|
24
|
+
agent: z.ZodString;
|
|
25
|
+
cron: z.ZodString;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type CompiledScheduleEntry = z.infer<typeof compiledScheduleEntrySchema>;
|
|
28
|
+
/**
|
|
29
|
+
* `{agent, engine}` disclosure entry (Piece 5, Slice B): ground truth for the
|
|
30
|
+
* run-manifest's `pinned-engine` field, so a `scripted` (or any non-default)
|
|
31
|
+
* pi engine is visibly disclosed rather than an invisible test-only branch.
|
|
32
|
+
* Derived in `buildUpReceipt` from the compiled report's
|
|
33
|
+
* `container.runtime_instances[].engine_by_node_id`. Optional on the schema
|
|
34
|
+
* so existing (pre-Piece-5) receipts without this field still validate.
|
|
35
|
+
*/
|
|
36
|
+
declare const compiledEngineEntrySchema: z.ZodObject<{
|
|
37
|
+
agent: z.ZodString;
|
|
38
|
+
engine: z.ZodString;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export type CompiledEngineEntry = z.infer<typeof compiledEngineEntrySchema>;
|
|
41
|
+
declare const moltnetReleaseIdentitySchema: z.ZodObject<{
|
|
42
|
+
architecture: z.ZodUnion<readonly [z.ZodLiteral<"amd64">, z.ZodLiteral<"arm64">]>;
|
|
43
|
+
asset: z.ZodString;
|
|
44
|
+
asset_sha256: z.ZodString;
|
|
45
|
+
capabilities: z.ZodTuple<[z.ZodLiteral<"pi-bridge">], null>;
|
|
46
|
+
release_version: z.ZodString;
|
|
47
|
+
source_revision: z.ZodString;
|
|
48
|
+
version: z.ZodLiteral<"spawnfile.moltnet-release-identity.v1">;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export type MoltnetReleaseReceiptIdentity = z.infer<typeof moltnetReleaseIdentitySchema>;
|
|
51
|
+
export declare const upReceiptSchema: z.ZodPreprocess<z.ZodObject<{
|
|
52
|
+
version: z.ZodLiteral<"spawnfile.up-receipt.v1">;
|
|
53
|
+
run_id: z.ZodNullable<z.ZodString>;
|
|
54
|
+
fingerprint: z.ZodString;
|
|
55
|
+
deployment: z.ZodObject<{
|
|
56
|
+
name: z.ZodNullable<z.ZodString>;
|
|
57
|
+
container_ids: z.ZodArray<z.ZodString>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
readiness: z.ZodObject<{
|
|
60
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"running">, z.ZodLiteral<"exited">, z.ZodLiteral<"unknown">]>;
|
|
61
|
+
moltnet_base_url: z.ZodNullable<z.ZodString>;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
compiled_schedule: z.ZodArray<z.ZodObject<{
|
|
64
|
+
agent: z.ZodString;
|
|
65
|
+
cron: z.ZodString;
|
|
66
|
+
}, z.core.$strict>>;
|
|
67
|
+
engines: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
68
|
+
agent: z.ZodString;
|
|
69
|
+
engine: z.ZodString;
|
|
70
|
+
}, z.core.$strict>>>;
|
|
71
|
+
moltnet_release: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
architecture: z.ZodUnion<readonly [z.ZodLiteral<"amd64">, z.ZodLiteral<"arm64">]>;
|
|
73
|
+
asset: z.ZodString;
|
|
74
|
+
asset_sha256: z.ZodString;
|
|
75
|
+
capabilities: z.ZodTuple<[z.ZodLiteral<"pi-bridge">], null>;
|
|
76
|
+
release_version: z.ZodString;
|
|
77
|
+
source_revision: z.ZodString;
|
|
78
|
+
version: z.ZodLiteral<"spawnfile.moltnet-release-identity.v1">;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
organization_handoff: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
binding_digest: z.ZodString;
|
|
82
|
+
deployment_handle: z.ZodString;
|
|
83
|
+
lifecycle_receipts: z.ZodObject<{
|
|
84
|
+
down: z.ZodLiteral<"spawnfile.down-receipt.v1">;
|
|
85
|
+
export: z.ZodLiteral<"spawnfile.export-index.v1">;
|
|
86
|
+
up: z.ZodLiteral<"spawnfile.up-receipt.v1">;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
network_attachment_handle: z.ZodString;
|
|
89
|
+
run_id: z.ZodString;
|
|
90
|
+
selected_target_receipt_digest: z.ZodString;
|
|
91
|
+
version: z.ZodLiteral<"spawnfile.organization-handoff.v1">;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
organization_handoff_handle: z.ZodOptional<z.ZodString>;
|
|
94
|
+
organization_ready: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
95
|
+
code: z.ZodUnion<readonly [z.ZodLiteral<"organization_ready">, z.ZodLiteral<"external_moltnet">, z.ZodLiteral<"compiled_evidence_missing">, z.ZodLiteral<"unit_unavailable">, z.ZodLiteral<"unit_restarted">, z.ZodLiteral<"probe_unavailable">, z.ZodLiteral<"identity_mismatch">, z.ZodLiteral<"topology_mismatch">, z.ZodLiteral<"probe_timeout">, z.ZodLiteral<"probe_cancelled">]>;
|
|
96
|
+
compile_fingerprint: z.ZodString;
|
|
97
|
+
run_id: z.ZodNullable<z.ZodString>;
|
|
98
|
+
state: z.ZodUnion<readonly [z.ZodLiteral<"ready">, z.ZodLiteral<"pending">, z.ZodLiteral<"failed">, z.ZodLiteral<"cancelled">]>;
|
|
99
|
+
unit_id: z.ZodString;
|
|
100
|
+
version: z.ZodLiteral<"spawnfile.organization-ready.v1">;
|
|
101
|
+
world_binding_digest: z.ZodNullable<z.ZodString>;
|
|
102
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strict>>>;
|
|
104
|
+
}, z.core.$strict>>;
|
|
105
|
+
export type UpReceipt = Omit<z.infer<typeof upReceiptSchema>, "organization_handoff" | "organization_handoff_handle" | "organization_ready"> & {
|
|
106
|
+
organization_handoff?: OrganizationHandoff;
|
|
107
|
+
organization_handoff_handle?: OpaqueTargetHandle;
|
|
108
|
+
organization_ready?: OrganizationReadiness;
|
|
109
|
+
};
|
|
110
|
+
export declare const parseUpReceipt: (raw: unknown) => UpReceipt;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { organizationReadinessSchema, parseOrganizationReadiness } from "./organizationReady.js";
|
|
3
|
+
import { ORGANIZATION_HANDOFF_VERSION, parseOrganizationHandoff } from "./organizationHandoffTypes.js";
|
|
4
|
+
import { assertOrdinaryJsonGraph, parseOpaqueTargetHandle } from "../target/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* `spawnfile.up-receipt.v1` — the machine contract `spawnfile up --json` writes to stdout
|
|
7
|
+
* (contracts.md's Spawnfile up-receipt registry row; Decision 21's Piece 4). It is thin by
|
|
8
|
+
* design: enough for a non-Docker caller (simfile's sim harness, later its supervisor) to
|
|
9
|
+
* drive lifecycle without touching Docker directly, per `contracts.md`'s rule that
|
|
10
|
+
* "Simfile -> spawnfile only through documented CLI + versioned receipts".
|
|
11
|
+
*
|
|
12
|
+
* `compiled_schedule` is populated even though nothing consumes it yet — it freezes the
|
|
13
|
+
* shape simfile's wake-diff (the expected-wake denominator oracle, see contracts.md's
|
|
14
|
+
* `simfile.run-manifest.v1` field notes) will read from later, so the receipt shape does
|
|
15
|
+
* not need to change again when that consumer lands.
|
|
16
|
+
*
|
|
17
|
+
* No credentials/tokens ever belong on this contract (contracts.md: "No credentials in
|
|
18
|
+
* exchanged artifacts") — `moltnet_base_url` is a bare URL, never an auth header/token.
|
|
19
|
+
*/
|
|
20
|
+
export const UP_RECEIPT_VERSION = "spawnfile.up-receipt.v1";
|
|
21
|
+
const readinessStateSchema = z.union([
|
|
22
|
+
z.literal("running"),
|
|
23
|
+
z.literal("exited"),
|
|
24
|
+
z.literal("unknown")
|
|
25
|
+
]);
|
|
26
|
+
const compiledScheduleEntrySchema = z
|
|
27
|
+
.object({
|
|
28
|
+
agent: z.string().min(1),
|
|
29
|
+
cron: z.string().min(1)
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
/**
|
|
33
|
+
* `{agent, engine}` disclosure entry (Piece 5, Slice B): ground truth for the
|
|
34
|
+
* run-manifest's `pinned-engine` field, so a `scripted` (or any non-default)
|
|
35
|
+
* pi engine is visibly disclosed rather than an invisible test-only branch.
|
|
36
|
+
* Derived in `buildUpReceipt` from the compiled report's
|
|
37
|
+
* `container.runtime_instances[].engine_by_node_id`. Optional on the schema
|
|
38
|
+
* so existing (pre-Piece-5) receipts without this field still validate.
|
|
39
|
+
*/
|
|
40
|
+
const compiledEngineEntrySchema = z
|
|
41
|
+
.object({
|
|
42
|
+
agent: z.string().min(1),
|
|
43
|
+
engine: z.string().min(1)
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
const moltnetReleaseIdentitySchema = z.object({
|
|
47
|
+
architecture: z.union([z.literal("amd64"), z.literal("arm64")]),
|
|
48
|
+
asset: z.string().regex(/^moltnet_linux_(amd64|arm64)\.tar\.gz$/u),
|
|
49
|
+
asset_sha256: z.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
50
|
+
capabilities: z.tuple([z.literal("pi-bridge")]),
|
|
51
|
+
release_version: z.string().regex(/^v?\d+\.\d+\.\d+(?:-\d+-g[a-f0-9]{7,40})?$/u),
|
|
52
|
+
source_revision: z.string().regex(/^[a-f0-9]{40}$/u),
|
|
53
|
+
version: z.literal("spawnfile.moltnet-release-identity.v1")
|
|
54
|
+
}).strict().superRefine((value, context) => {
|
|
55
|
+
if (!value.asset.includes(`_${value.architecture}.`)) {
|
|
56
|
+
context.addIssue({
|
|
57
|
+
code: z.ZodIssueCode.custom,
|
|
58
|
+
path: ["asset"],
|
|
59
|
+
message: "Moltnet asset architecture must match identity architecture"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const describedRevision = value.release_version.match(/-g([a-f0-9]{7,40})$/u)?.[1];
|
|
63
|
+
if (describedRevision && !value.source_revision.startsWith(describedRevision)) {
|
|
64
|
+
context.addIssue({
|
|
65
|
+
code: z.ZodIssueCode.custom,
|
|
66
|
+
path: ["source_revision"],
|
|
67
|
+
message: "Moltnet release version must match source revision"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const organizationHandoffReceiptSchema = z.object({
|
|
72
|
+
binding_digest: z.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
73
|
+
deployment_handle: z.string().regex(/^sf-oh1-[a-f0-9]{64}$/u),
|
|
74
|
+
lifecycle_receipts: z.object({
|
|
75
|
+
down: z.literal("spawnfile.down-receipt.v1"),
|
|
76
|
+
export: z.literal("spawnfile.export-index.v1"),
|
|
77
|
+
up: z.literal(UP_RECEIPT_VERSION)
|
|
78
|
+
}).strict(),
|
|
79
|
+
network_attachment_handle: z.string().regex(/^opaque_[a-z0-9]{16,64}$/u),
|
|
80
|
+
run_id: z.string().min(1),
|
|
81
|
+
selected_target_receipt_digest: z.string().regex(/^sha256:[a-f0-9]{64}$/u),
|
|
82
|
+
version: z.literal(ORGANIZATION_HANDOFF_VERSION)
|
|
83
|
+
}).strict().superRefine((value, context) => {
|
|
84
|
+
try {
|
|
85
|
+
parseOrganizationHandoff(value);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
context.addIssue({ code: z.ZodIssueCode.custom, message: "invalid organization handoff" });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const INVALID_JSON_GRAPH = Symbol("invalid-json-graph");
|
|
92
|
+
const upReceiptObjectSchema = z
|
|
93
|
+
.object({
|
|
94
|
+
version: z.literal(UP_RECEIPT_VERSION),
|
|
95
|
+
run_id: z.string().min(1).nullable(),
|
|
96
|
+
fingerprint: z.string().min(1),
|
|
97
|
+
deployment: z
|
|
98
|
+
.object({
|
|
99
|
+
name: z.string().min(1).nullable(),
|
|
100
|
+
container_ids: z.array(z.string().min(1))
|
|
101
|
+
})
|
|
102
|
+
.strict(),
|
|
103
|
+
readiness: z
|
|
104
|
+
.object({
|
|
105
|
+
state: readinessStateSchema,
|
|
106
|
+
moltnet_base_url: z.string().min(1).nullable()
|
|
107
|
+
})
|
|
108
|
+
.strict(),
|
|
109
|
+
compiled_schedule: z.array(compiledScheduleEntrySchema),
|
|
110
|
+
engines: z.array(compiledEngineEntrySchema).optional(),
|
|
111
|
+
moltnet_release: moltnetReleaseIdentitySchema.optional(),
|
|
112
|
+
organization_handoff: organizationHandoffReceiptSchema.optional(),
|
|
113
|
+
organization_handoff_handle: z.string().optional(),
|
|
114
|
+
organization_ready: organizationReadinessSchema.optional()
|
|
115
|
+
})
|
|
116
|
+
.strict()
|
|
117
|
+
.superRefine((value, context) => {
|
|
118
|
+
if (value.organization_handoff && (value.run_id === null || value.run_id !== value.organization_handoff.run_id)) {
|
|
119
|
+
context.addIssue({
|
|
120
|
+
code: z.ZodIssueCode.custom,
|
|
121
|
+
path: ["organization_handoff", "run_id"],
|
|
122
|
+
message: "organization handoff run_id must match receipt run_id"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
if (value.organization_handoff_handle !== undefined) {
|
|
126
|
+
if (!value.organization_handoff) {
|
|
127
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["organization_handoff_handle"], message: "organization handoff handle requires organization handoff" });
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
parseOpaqueTargetHandle(value.organization_handoff_handle);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["organization_handoff_handle"], message: "invalid organization handoff handle" });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
export const upReceiptSchema = z
|
|
138
|
+
.preprocess((value) => {
|
|
139
|
+
try {
|
|
140
|
+
assertOrdinaryJsonGraph(value);
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return INVALID_JSON_GRAPH;
|
|
145
|
+
}
|
|
146
|
+
}, upReceiptObjectSchema);
|
|
147
|
+
export const parseUpReceipt = (raw) => {
|
|
148
|
+
try {
|
|
149
|
+
assertOrdinaryJsonGraph(raw);
|
|
150
|
+
const result = upReceiptSchema.safeParse(raw);
|
|
151
|
+
if (!result.success)
|
|
152
|
+
throw new TypeError();
|
|
153
|
+
const { organization_handoff: handoff, organization_handoff_handle: handoffHandle, organization_ready: readiness, ...receipt } = result.data;
|
|
154
|
+
return {
|
|
155
|
+
...receipt,
|
|
156
|
+
...(handoff ? { organization_handoff: parseOrganizationHandoff(handoff) } : {}),
|
|
157
|
+
...(handoffHandle ? { organization_handoff_handle: parseOpaqueTargetHandle(handoffHandle) } : {}),
|
|
158
|
+
...(readiness ? { organization_ready: parseOrganizationReadiness(readiness) } : {})
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
throw new Error(`invalid ${UP_RECEIPT_VERSION}`);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DevExecFile } from "./docker.js";
|
|
2
|
+
import { type DevProjectOptions } from "./project.js";
|
|
3
|
+
export interface DevActivityProjectOptions extends DevProjectOptions {
|
|
4
|
+
agent?: string;
|
|
5
|
+
execFile?: DevExecFile;
|
|
6
|
+
tail?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface DevActivityProjectResult {
|
|
9
|
+
containerName: string;
|
|
10
|
+
deploymentName: string;
|
|
11
|
+
events: unknown[];
|
|
12
|
+
outputDirectory: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const devActivityProject: (inputPath: string, options?: DevActivityProjectOptions) => Promise<DevActivityProjectResult>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defaultExecFile, dockerArgsForRecord, firstContainerName, runDocker } from "./docker.js";
|
|
2
|
+
import { PI_CONTROL_URL, resolveDevOutputDirectory, selectDeploymentRecord } from "./project.js";
|
|
3
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
4
|
+
const activityPath = (options) => {
|
|
5
|
+
const params = new URLSearchParams();
|
|
6
|
+
if (options.agent) {
|
|
7
|
+
params.set("agent", options.agent);
|
|
8
|
+
}
|
|
9
|
+
if (typeof options.tail === "number" && Number.isInteger(options.tail) && options.tail > 0) {
|
|
10
|
+
params.set("tail", String(options.tail));
|
|
11
|
+
}
|
|
12
|
+
const query = params.toString();
|
|
13
|
+
return `${PI_CONTROL_URL}/spawnfile/activity${query ? `?${query}` : ""}`;
|
|
14
|
+
};
|
|
15
|
+
const parseActivityEvents = (stdout) => {
|
|
16
|
+
let parsed;
|
|
17
|
+
try {
|
|
18
|
+
parsed = JSON.parse(stdout);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new SpawnfileError("runtime_error", "Pi activity endpoint returned invalid JSON");
|
|
22
|
+
}
|
|
23
|
+
if (typeof parsed !== "object" ||
|
|
24
|
+
parsed === null ||
|
|
25
|
+
!Array.isArray(parsed.events)) {
|
|
26
|
+
throw new SpawnfileError("runtime_error", "Pi activity endpoint response did not include an events array");
|
|
27
|
+
}
|
|
28
|
+
return parsed.events;
|
|
29
|
+
};
|
|
30
|
+
export const devActivityProject = async (inputPath, options = {}) => {
|
|
31
|
+
const outputDirectory = await resolveDevOutputDirectory(inputPath, options.outputDirectory);
|
|
32
|
+
const record = await selectDeploymentRecord(outputDirectory, options.deploymentName);
|
|
33
|
+
const containerName = firstContainerName(record);
|
|
34
|
+
const stdout = await runDocker(options.dockerCommand ?? "docker", [
|
|
35
|
+
...dockerArgsForRecord(record),
|
|
36
|
+
"exec",
|
|
37
|
+
containerName,
|
|
38
|
+
"curl",
|
|
39
|
+
"-fsS",
|
|
40
|
+
activityPath(options)
|
|
41
|
+
], options.execFile ?? defaultExecFile);
|
|
42
|
+
return {
|
|
43
|
+
containerName,
|
|
44
|
+
deploymentName: record.name,
|
|
45
|
+
events: parseActivityEvents(stdout),
|
|
46
|
+
outputDirectory
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CompileProjectResult } from "../compiler/index.js";
|
|
2
|
+
import { type DeploymentRecord } from "../deployment/index.js";
|
|
3
|
+
export type DevExecFile = (file: string, args: string[], options: {
|
|
4
|
+
timeout: number;
|
|
5
|
+
}) => Promise<{
|
|
6
|
+
stderr: string;
|
|
7
|
+
stdout: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const defaultExecFile: DevExecFile;
|
|
10
|
+
export declare const dockerArgsForRecord: (record: DeploymentRecord) => string[];
|
|
11
|
+
export declare const firstContainerName: (record: DeploymentRecord) => string;
|
|
12
|
+
export declare const compileForDevApply: (inputPath: string, outputDirectory: string, record: DeploymentRecord, dockerCommand: string, execFileImpl: DevExecFile) => Promise<CompileProjectResult>;
|
|
13
|
+
export declare const runDocker: (command: string, args: string[], execFileImpl: DevExecFile, timeout?: number) => Promise<string>;
|
|
14
|
+
export declare const copyIntoContainer: (dockerCommand: string, dockerPrefix: string[], source: string, destination: string, execFileImpl: DevExecFile) => Promise<void>;
|
|
15
|
+
export declare const ensureContainerDirectories: (dockerCommand: string, dockerPrefix: string[], containerName: string, paths: string[], execFileImpl: DevExecFile) => Promise<void>;
|
|
16
|
+
export declare const chownContainerPaths: (dockerCommand: string, dockerPrefix: string[], containerName: string, paths: string[], execFileImpl: DevExecFile) => Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { compileProject, normalizeDockerArchitecture } from "../compiler/index.js";
|
|
4
|
+
import { dockerContextNameForTarget, dockerHostValueForTarget } from "../deployment/index.js";
|
|
5
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
6
|
+
export const defaultExecFile = promisify(execFileCallback);
|
|
7
|
+
export const dockerArgsForRecord = (record) => {
|
|
8
|
+
const context = dockerContextNameForTarget(record.target);
|
|
9
|
+
if (context) {
|
|
10
|
+
return ["--context", context];
|
|
11
|
+
}
|
|
12
|
+
const host = dockerHostValueForTarget(record.target);
|
|
13
|
+
return host ? ["--host", host] : [];
|
|
14
|
+
};
|
|
15
|
+
export const firstContainerName = (record) => {
|
|
16
|
+
const unit = record.units.find((candidate) => candidate.kind === "container") ?? record.units[0];
|
|
17
|
+
const name = unit?.container_name;
|
|
18
|
+
if (!name) {
|
|
19
|
+
throw new SpawnfileError("runtime_error", `Deployment "${record.name}" has no recorded container name`);
|
|
20
|
+
}
|
|
21
|
+
return name;
|
|
22
|
+
};
|
|
23
|
+
export const compileForDevApply = async (inputPath, outputDirectory, record, dockerCommand, execFileImpl) => {
|
|
24
|
+
const dockerContext = dockerContextNameForTarget(record.target) ?? undefined;
|
|
25
|
+
const architecture = dockerContext
|
|
26
|
+
? normalizeDockerArchitecture((await execFileImpl(dockerCommand, ["--context", dockerContext, "info", "--format", "{{.Architecture}}"], { timeout: 10_000 })).stdout)
|
|
27
|
+
: undefined;
|
|
28
|
+
return compileProject(inputPath, {
|
|
29
|
+
clean: false,
|
|
30
|
+
containerArchitecture: architecture,
|
|
31
|
+
outputDirectory
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const runDocker = async (command, args, execFileImpl, timeout = 30_000) => {
|
|
35
|
+
const { stdout } = await execFileImpl(command, args, { timeout });
|
|
36
|
+
return stdout;
|
|
37
|
+
};
|
|
38
|
+
export const copyIntoContainer = async (dockerCommand, dockerPrefix, source, destination, execFileImpl) => {
|
|
39
|
+
await runDocker(dockerCommand, [...dockerPrefix, "cp", source, destination], execFileImpl, 60_000);
|
|
40
|
+
};
|
|
41
|
+
export const ensureContainerDirectories = async (dockerCommand, dockerPrefix, containerName, paths, execFileImpl) => {
|
|
42
|
+
if (paths.length === 0) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await runDocker(dockerCommand, [
|
|
46
|
+
...dockerPrefix,
|
|
47
|
+
"exec",
|
|
48
|
+
"--user",
|
|
49
|
+
"root",
|
|
50
|
+
containerName,
|
|
51
|
+
"mkdir",
|
|
52
|
+
"-p",
|
|
53
|
+
...paths
|
|
54
|
+
], execFileImpl);
|
|
55
|
+
};
|
|
56
|
+
export const chownContainerPaths = async (dockerCommand, dockerPrefix, containerName, paths, execFileImpl) => {
|
|
57
|
+
if (paths.length === 0) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
await runDocker(dockerCommand, [
|
|
61
|
+
...dockerPrefix,
|
|
62
|
+
"exec",
|
|
63
|
+
"--user",
|
|
64
|
+
"root",
|
|
65
|
+
containerName,
|
|
66
|
+
"chown",
|
|
67
|
+
"-R",
|
|
68
|
+
"spawnfile:spawnfile",
|
|
69
|
+
...paths
|
|
70
|
+
], execFileImpl);
|
|
71
|
+
};
|