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
|
@@ -1,25 +1,12 @@
|
|
|
1
|
+
import { resolveNoopolisRunId } from "../runtime/index.js";
|
|
1
2
|
import { SpawnfileError } from "../shared/index.js";
|
|
2
|
-
import { createMoltnetOpenTokenDirectory, createMoltnetNativeServerConfig, createMoltnetNodeConfigPath,
|
|
3
|
+
import { createMoltnetCausalDirectory, createMoltnetServerConfigPath, createMoltnetOpenTokenDirectory, createMoltnetNativeServerConfig, createMoltnetNodeConfigPath, resolveMoltnetClientAuth, resolveMoltnetStorePersistenceMountPath } from "./moltnetConfigLowering.js";
|
|
3
4
|
import { assertNetworkBindingEnvUniqueness } from "./networkBinding.js";
|
|
4
|
-
import { listConcreteMoltnetRoomMemberIds } from "./moltnetRoomMemberships.js";
|
|
5
|
-
import { assertCompatibleMoltnetNetworkName, assertCompatibleMoltnetRoomPolicy, assertCompatibleMoltnetServer } from "./moltnetRoomPolicyCompatibility.js";
|
|
6
5
|
import { createMoltnetNodeConfigContent } from "./moltnetNodeConfig.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { createPersistentVolumeName, isNetworkHttpEnabled, toContainerRootfsPath } from "./moltnetArtifactPaths.js";
|
|
7
|
+
import { createMoltnetExternalParticipantArtifactFiles } from "./moltnetExternalParticipantArtifact.js";
|
|
8
|
+
import { resolveMoltnetServerPlans } from "./moltnetServerPlans.js";
|
|
10
9
|
const createServerKey = (networkId) => networkId;
|
|
11
|
-
const truncateSegment = (value, maxLength) => value.length > maxLength ? value.slice(0, maxLength).replace(/[-_.]+$/u, "") : value;
|
|
12
|
-
const createPersistentVolumeName = (planRoot, id, explicitName) => {
|
|
13
|
-
if (explicitName && explicitName.trim().length > 0) {
|
|
14
|
-
return explicitName.trim();
|
|
15
|
-
}
|
|
16
|
-
const project = truncateSegment(slugify(planRoot.split("/").slice(-2, -1)[0] ?? "project") || "project", 32);
|
|
17
|
-
const suffix = truncateSegment(slugify(id) || "state", 48);
|
|
18
|
-
return `spawnfile-${project}-${suffix}-${createShortHash(`${planRoot}:${id}`)}`;
|
|
19
|
-
};
|
|
20
|
-
const toContainerRootfsPath = (rootfsPath) => `/${rootfsPath.replace(`${ROOTFS_PREFIX}/`, "")}`;
|
|
21
|
-
const isNetworkHttpEnabled = (network) => network.server?.mode === "managed" && network.server.human_ingress === true;
|
|
22
|
-
const resolveNetworkPort = (network, fallbackPort) => network.server?.mode === "managed" ? network.server.listen.port : fallbackPort;
|
|
23
10
|
export const generateMoltnetArtifacts = async (plan) => {
|
|
24
11
|
const teamNodes = plan.nodes
|
|
25
12
|
.filter((node) => node.kind === "team")
|
|
@@ -27,80 +14,17 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
27
14
|
if (teamNodes.length === 0) {
|
|
28
15
|
return null;
|
|
29
16
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (!server) {
|
|
36
|
-
throw new SpawnfileError("validation_error", `Moltnet network ${network.id} must declare server`);
|
|
37
|
-
}
|
|
38
|
-
const serverKey = createServerKey(network.id);
|
|
39
|
-
const existingPlan = serverPlans.get(serverKey);
|
|
40
|
-
if (existingPlan) {
|
|
41
|
-
if (existingPlan.baseUrl !== resolveMoltnetBaseUrl(server)) {
|
|
42
|
-
throw new SpawnfileError("validation_error", `Duplicate Moltnet network ${network.id} declares conflicting server URL`);
|
|
43
|
-
}
|
|
44
|
-
assertCompatibleMoltnetNetworkName(network.id, existingPlan.name, network.name);
|
|
45
|
-
assertCompatibleMoltnetServer(network.id, existingPlan.server, server);
|
|
46
|
-
for (const room of network.rooms) {
|
|
47
|
-
const concreteMembers = listConcreteMoltnetRoomMemberIds(plan, teamNode.value, network.id, room);
|
|
48
|
-
const existingRoom = existingPlan.rooms.find((entry) => entry.id === room.id);
|
|
49
|
-
if (existingRoom) {
|
|
50
|
-
existingRoom.members = [
|
|
51
|
-
...new Set([...existingRoom.members, ...concreteMembers])
|
|
52
|
-
].sort();
|
|
53
|
-
assertCompatibleMoltnetRoomPolicy(network.id, room.id, "visibility", existingRoom.visibility, room.visibility);
|
|
54
|
-
assertCompatibleMoltnetRoomPolicy(network.id, room.id, "write_policy", existingRoom.write_policy, room.write_policy);
|
|
55
|
-
existingRoom.visibility ??= room.visibility;
|
|
56
|
-
existingRoom.write_policy ??= room.write_policy;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
existingPlan.rooms.push({
|
|
60
|
-
id: room.id,
|
|
61
|
-
members: concreteMembers,
|
|
62
|
-
...(room.name ? { name: room.name } : {}),
|
|
63
|
-
...(room.visibility ? { visibility: room.visibility } : {}),
|
|
64
|
-
...(room.write_policy ? { write_policy: room.write_policy } : {})
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
existingPlan.rooms.sort((left, right) => left.id.localeCompare(right.id));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
const port = server.mode === "managed" ? resolveNetworkPort(network, nextPort) : undefined;
|
|
72
|
-
const serverId = `${teamNode.slug}-${network.id}`;
|
|
73
|
-
serverPlans.set(serverKey, {
|
|
74
|
-
baseUrl: resolveMoltnetBaseUrl(server),
|
|
75
|
-
...(server.mode === "managed"
|
|
76
|
-
? { configPath: toContainerRootfsPath(createMoltnetServerConfigPath(serverId)) }
|
|
77
|
-
: {}),
|
|
78
|
-
id: serverId,
|
|
79
|
-
mode: server.mode,
|
|
80
|
-
name: network.name,
|
|
81
|
-
networkId: network.id,
|
|
82
|
-
...(port ? { port } : {}),
|
|
83
|
-
rooms: network.rooms.map((room) => ({
|
|
84
|
-
id: room.id,
|
|
85
|
-
members: listConcreteMoltnetRoomMemberIds(plan, teamNode.value, network.id, room),
|
|
86
|
-
...(room.name ? { name: room.name } : {}),
|
|
87
|
-
...(room.visibility ? { visibility: room.visibility } : {}),
|
|
88
|
-
...(room.write_policy ? { write_policy: room.write_policy } : {})
|
|
89
|
-
})),
|
|
90
|
-
server,
|
|
91
|
-
secretPatches: [],
|
|
92
|
-
teamSource: teamNode.value.source
|
|
93
|
-
});
|
|
94
|
-
if (port) {
|
|
95
|
-
nextPort = Math.max(nextPort, port + 1);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
17
|
+
// Run-scoping key for every persistent volume name derived below (see
|
|
18
|
+
// createPersistentVolumeName's doc comment). Read once per compile so
|
|
19
|
+
// every mount in this compile agrees on the same value.
|
|
20
|
+
const runId = resolveNoopolisRunId(process.env);
|
|
21
|
+
const serverPlans = resolveMoltnetServerPlans(plan, teamNodes);
|
|
100
22
|
const nodePlans = [];
|
|
101
23
|
const nodePlanKeys = new Set();
|
|
102
24
|
const configFiles = [];
|
|
103
25
|
const persistentMounts = new Map();
|
|
26
|
+
const external = createMoltnetExternalParticipantArtifactFiles(plan.moltnetExternalParticipantIntents ?? []);
|
|
27
|
+
configFiles.push(...external.files);
|
|
104
28
|
const addPersistentMount = (mount) => {
|
|
105
29
|
const existing = persistentMounts.get(mount.id);
|
|
106
30
|
if (!existing) {
|
|
@@ -127,18 +51,32 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
127
51
|
mode: 0o600,
|
|
128
52
|
path: createMoltnetServerConfigPath(serverPlan.id)
|
|
129
53
|
});
|
|
54
|
+
// Always mounted, independent of the network's store.kind/persistence:
|
|
55
|
+
// this is the causal/social record (message.accepted/message.denied
|
|
56
|
+
// events), the A5/memetics ground truth for what happened in a run, and
|
|
57
|
+
// it must survive container teardown even for a purely in-memory
|
|
58
|
+
// (non-durable) room store — e.g. office-sim's fixture. Lives in its own
|
|
59
|
+
// `causal/` subdirectory, never the server config's own directory, so
|
|
60
|
+
// this volume never shadows a rebuilt image's Moltnet.json.
|
|
61
|
+
const causalMountId = `moltnet-${serverPlan.networkId}-causal`;
|
|
62
|
+
addPersistentMount({
|
|
63
|
+
id: causalMountId,
|
|
64
|
+
mountPath: createMoltnetCausalDirectory(serverPlan.configPath),
|
|
65
|
+
reason: `managed Moltnet causal event log for ${serverPlan.networkId}`,
|
|
66
|
+
volumeName: createPersistentVolumeName(plan.root, causalMountId, undefined, runId)
|
|
67
|
+
});
|
|
130
68
|
const storeMountPath = resolveMoltnetStorePersistenceMountPath(serverPlan.networkId, serverPlan.server.store);
|
|
131
69
|
if (storeMountPath) {
|
|
132
70
|
const mountId = `moltnet-${serverPlan.networkId}-store`;
|
|
133
71
|
const store = serverPlan.server.store;
|
|
134
|
-
const
|
|
72
|
+
const explicitVolumeName = store.kind === "sqlite" || store.kind === "json"
|
|
135
73
|
? store.persistence?.name
|
|
136
74
|
: undefined;
|
|
137
75
|
addPersistentMount({
|
|
138
76
|
id: mountId,
|
|
139
77
|
mountPath: storeMountPath,
|
|
140
78
|
reason: `managed Moltnet ${serverPlan.server.store.kind} store for ${serverPlan.networkId}`,
|
|
141
|
-
volumeName: createPersistentVolumeName(plan.root, mountId,
|
|
79
|
+
volumeName: createPersistentVolumeName(plan.root, mountId, explicitVolumeName, runId)
|
|
142
80
|
});
|
|
143
81
|
}
|
|
144
82
|
}
|
|
@@ -166,12 +104,11 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
166
104
|
if (!network) {
|
|
167
105
|
throw new SpawnfileError("validation_error", `Unable to find Moltnet network ${attachment.network} for ${agentNode.name}`);
|
|
168
106
|
}
|
|
169
|
-
if (
|
|
107
|
+
if (serverPlan.server.mode === "managed" &&
|
|
108
|
+
serverPlan.server.direct_messages === false &&
|
|
109
|
+
attachment.dms) {
|
|
170
110
|
throw new SpawnfileError("validation_error", `Moltnet network ${attachment.network} disables direct messages but ${agentNode.name} declares dms`);
|
|
171
111
|
}
|
|
172
|
-
if (!network.server) {
|
|
173
|
-
throw new SpawnfileError("validation_error", `Moltnet network ${attachment.network} must declare server`);
|
|
174
|
-
}
|
|
175
112
|
const configPath = createMoltnetNodeConfigPath(teamNode.slug, attachment.network, attachment.memberId);
|
|
176
113
|
const nodePlanKey = `${attachment.network}::${attachment.memberId}`;
|
|
177
114
|
if (nodePlanKeys.has(nodePlanKey)) {
|
|
@@ -179,7 +116,7 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
179
116
|
}
|
|
180
117
|
nodePlanKeys.add(nodePlanKey);
|
|
181
118
|
if (agentNode.runtime.name === "pi") {
|
|
182
|
-
const clientAuth = resolveMoltnetClientAuth(serverPlan.server, attachment.network, attachment.memberId, node.slug);
|
|
119
|
+
const clientAuth = resolveMoltnetClientAuth(serverPlan.server, attachment.network, attachment.memberId, node.slug, attachment.auth?.tokenId);
|
|
183
120
|
const usesPerAttachmentOpenToken = clientAuth.mode === "open" &&
|
|
184
121
|
clientAuth.staticToken !== true &&
|
|
185
122
|
Boolean(clientAuth.tokenEnv || clientAuth.tokenPath);
|
|
@@ -189,7 +126,7 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
189
126
|
id: mountId,
|
|
190
127
|
mountPath: createMoltnetOpenTokenDirectory(node.slug),
|
|
191
128
|
reason: `Moltnet open-mode generated agent tokens for ${agentNode.name}`,
|
|
192
|
-
volumeName: createPersistentVolumeName(plan.root, mountId)
|
|
129
|
+
volumeName: createPersistentVolumeName(plan.root, mountId, undefined, runId)
|
|
193
130
|
});
|
|
194
131
|
}
|
|
195
132
|
}
|
|
@@ -208,7 +145,7 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
208
145
|
id: mountId,
|
|
209
146
|
mountPath: createMoltnetOpenTokenDirectory(node.slug),
|
|
210
147
|
reason: `Moltnet open-mode generated agent tokens for ${agentNode.name}`,
|
|
211
|
-
volumeName: createPersistentVolumeName(plan.root, mountId)
|
|
148
|
+
volumeName: createPersistentVolumeName(plan.root, mountId, undefined, runId)
|
|
212
149
|
});
|
|
213
150
|
}
|
|
214
151
|
configFiles.push({
|
|
@@ -218,6 +155,12 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
218
155
|
});
|
|
219
156
|
nodePlans.push({
|
|
220
157
|
configPath: toContainerRootfsPath(configPath),
|
|
158
|
+
...(clientAuth.credentialAgentId
|
|
159
|
+
? { credentialAgentId: clientAuth.credentialAgentId }
|
|
160
|
+
: {}),
|
|
161
|
+
...(clientAuth.credentialId ? { credentialId: clientAuth.credentialId } : {}),
|
|
162
|
+
...(clientAuth.tokenEnv ? { credentialSecret: clientAuth.tokenEnv } : {}),
|
|
163
|
+
memberId: attachment.memberId,
|
|
221
164
|
networkId: attachment.network
|
|
222
165
|
});
|
|
223
166
|
}
|
|
@@ -229,6 +172,9 @@ export const generateMoltnetArtifacts = async (plan) => {
|
|
|
229
172
|
})));
|
|
230
173
|
return {
|
|
231
174
|
files: configFiles,
|
|
175
|
+
...(external.artifacts.length > 0
|
|
176
|
+
? { externalParticipantArtifacts: external.artifacts }
|
|
177
|
+
: {}),
|
|
232
178
|
nodePlans: nodePlans.sort((left, right) => left.configPath.localeCompare(right.configPath)),
|
|
233
179
|
persistentMounts: [...persistentMounts.values()].sort((left, right) => left.id.localeCompare(right.id)),
|
|
234
180
|
ports: [...new Set(managedServerPlans.map((serverPlan) => serverPlan.port).filter((port) => port !== undefined))].sort((left, right) => left - right),
|
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
import { type MoltnetTargetArchitecture } from "./moltnetReleaseAuthority.js";
|
|
2
|
+
/** Explicit operator override for a locally staged, authority-bound release. */
|
|
3
|
+
export declare const MOLTNET_RELEASE_DIR_ENV = "SPAWNFILE_MOLTNET_RELEASE_DIR";
|
|
1
4
|
export declare const MOLTNET_BIN_DIRECTORY = "moltnet-bin";
|
|
2
5
|
export declare const MOLTNET_BINARY_NAMES: readonly ["moltnet"];
|
|
3
|
-
export
|
|
6
|
+
export declare const MOLTNET_RELEASE_IDENTITY_VERSION: "spawnfile.moltnet-release-identity.v1";
|
|
7
|
+
export declare const MOLTNET_RELEASE_STAMP_VERSION: "spawnfile.moltnet-release-stamp.v1";
|
|
8
|
+
export type { MoltnetTargetArchitecture } from "./moltnetReleaseAuthority.js";
|
|
9
|
+
export interface MoltnetReleaseIdentity {
|
|
10
|
+
readonly architecture: MoltnetTargetArchitecture;
|
|
11
|
+
readonly asset: string;
|
|
12
|
+
readonly asset_sha256: `sha256:${string}`;
|
|
13
|
+
readonly capabilities: readonly ["pi-bridge"];
|
|
14
|
+
readonly release_version: string;
|
|
15
|
+
readonly source_revision: string;
|
|
16
|
+
readonly version: typeof MOLTNET_RELEASE_IDENTITY_VERSION;
|
|
17
|
+
}
|
|
18
|
+
export interface MoltnetBinaryStageOptions {
|
|
19
|
+
readonly architecture?: MoltnetTargetArchitecture;
|
|
20
|
+
/** Explicit local source directory; bytes remain bound to trusted authority. */
|
|
21
|
+
readonly releaseDirectory?: string;
|
|
22
|
+
}
|
|
4
23
|
export declare const resolveMoltnetCliCommand: () => Promise<string>;
|
|
5
|
-
export declare const stageMoltnetBinaries: (outputDirectory: string, options?:
|
|
6
|
-
architecture?: MoltnetTargetArchitecture;
|
|
7
|
-
}) => Promise<boolean>;
|
|
24
|
+
export declare const stageMoltnetBinaries: (outputDirectory: string, options?: MoltnetBinaryStageOptions) => Promise<MoltnetReleaseIdentity>;
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
2
3
|
import path from "node:path";
|
|
3
|
-
import { chmod } from "node:fs/promises";
|
|
4
|
+
import { chmod, readFile } from "node:fs/promises";
|
|
4
5
|
import { promisify } from "node:util";
|
|
5
6
|
import { ensureDirectory, fileExists } from "../filesystem/index.js";
|
|
6
7
|
import { SpawnfileError } from "../shared/index.js";
|
|
8
|
+
import { parseTrustedMoltnetReleaseAuthority, readTrustedMoltnetReleaseAuthority, trustedMoltnetReleaseAsset } from "./moltnetReleaseAuthority.js";
|
|
9
|
+
import { downloadTrustedMoltnetReleaseAsset } from "./moltnetReleaseDownload.js";
|
|
7
10
|
const execFile = promisify(execFileCallback);
|
|
8
11
|
const MOLTNET_CLI_ENV = "SPAWNFILE_MOLTNET_CLI";
|
|
9
|
-
|
|
12
|
+
/** Explicit operator override for a locally staged, authority-bound release. */
|
|
13
|
+
export const MOLTNET_RELEASE_DIR_ENV = "SPAWNFILE_MOLTNET_RELEASE_DIR";
|
|
10
14
|
const MOLTNET_TARGET_ARCH_ENV = "SPAWNFILE_MOLTNET_TARGET_ARCH";
|
|
11
|
-
const LOCAL_MOLTNET_CLI_PATH = path.resolve(process.cwd(), "moltnet", "bin", "moltnet");
|
|
12
15
|
const MOLTNET_TARGET_OS = "linux";
|
|
13
16
|
export const MOLTNET_BIN_DIRECTORY = "moltnet-bin";
|
|
14
17
|
export const MOLTNET_BINARY_NAMES = ["moltnet"];
|
|
18
|
+
export const MOLTNET_RELEASE_IDENTITY_VERSION = "spawnfile.moltnet-release-identity.v1";
|
|
19
|
+
export const MOLTNET_RELEASE_STAMP_VERSION = "spawnfile.moltnet-release-stamp.v1";
|
|
20
|
+
const SHA256 = /^[a-f0-9]{64}$/u;
|
|
21
|
+
const REVISION = /^[a-f0-9]{40}$/u;
|
|
22
|
+
const PINNED_VERSION = /^v?\d+\.\d+\.\d+(?:-\d+-g[a-f0-9]{7,40})?$/u;
|
|
15
23
|
const normalizeTargetArchitecture = (architecture) => {
|
|
16
24
|
switch (architecture) {
|
|
17
25
|
case "amd64":
|
|
@@ -43,6 +51,101 @@ const resolveTargetArchitecture = (architecture) => {
|
|
|
43
51
|
}
|
|
44
52
|
};
|
|
45
53
|
const createReleaseAssetName = (architecture) => `moltnet_${MOLTNET_TARGET_OS}_${architecture}.tar.gz`;
|
|
54
|
+
const createReleaseStampName = (architecture) => `moltnet_release_stamp_${architecture}.json`;
|
|
55
|
+
const exactKeys = (value, keys) => Object.keys(value).sort().join("\0") === [...keys].sort().join("\0");
|
|
56
|
+
const parseReleaseStamp = (raw, architecture) => {
|
|
57
|
+
let parsed;
|
|
58
|
+
try {
|
|
59
|
+
parsed = JSON.parse(raw);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
throw new SpawnfileError("compile_error", "Moltnet release capability stamp is not valid JSON");
|
|
63
|
+
}
|
|
64
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
65
|
+
throw new SpawnfileError("compile_error", "Moltnet release capability stamp has an invalid shape");
|
|
66
|
+
}
|
|
67
|
+
const value = parsed;
|
|
68
|
+
const expectedKeys = [
|
|
69
|
+
"arch", "asset", "built_at", "capabilities", "pi_bridge", "sha256",
|
|
70
|
+
"source_revision", "stamp_version", "version"
|
|
71
|
+
];
|
|
72
|
+
const capabilities = value.capabilities;
|
|
73
|
+
if (!exactKeys(value, expectedKeys)
|
|
74
|
+
|| value.stamp_version !== MOLTNET_RELEASE_STAMP_VERSION
|
|
75
|
+
|| value.arch !== architecture
|
|
76
|
+
|| value.asset !== createReleaseAssetName(architecture)
|
|
77
|
+
|| typeof value.built_at !== "string"
|
|
78
|
+
|| !Number.isFinite(Date.parse(value.built_at))
|
|
79
|
+
|| !Array.isArray(capabilities)
|
|
80
|
+
|| capabilities.length !== 1
|
|
81
|
+
|| capabilities[0] !== "pi-bridge"
|
|
82
|
+
|| value.pi_bridge !== true
|
|
83
|
+
|| typeof value.sha256 !== "string"
|
|
84
|
+
|| !SHA256.test(value.sha256)
|
|
85
|
+
|| typeof value.source_revision !== "string"
|
|
86
|
+
|| !REVISION.test(value.source_revision)
|
|
87
|
+
|| typeof value.version !== "string"
|
|
88
|
+
|| !PINNED_VERSION.test(value.version)) {
|
|
89
|
+
throw new SpawnfileError("compile_error", `Moltnet release capability stamp must be strict, pinned, and assert only the pi-bridge capability for ${architecture}`);
|
|
90
|
+
}
|
|
91
|
+
const describedRevision = value.version.match(/-g([a-f0-9]{7,40})$/u)?.[1];
|
|
92
|
+
if (describedRevision && !value.source_revision.startsWith(describedRevision)) {
|
|
93
|
+
throw new SpawnfileError("compile_error", "Moltnet release version does not match its source revision");
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
};
|
|
97
|
+
const verifyReleaseIdentity = async (releaseDirectory, architecture, authority) => {
|
|
98
|
+
const trustedAuthority = parseTrustedMoltnetReleaseAuthority(authority);
|
|
99
|
+
const trustedAsset = trustedMoltnetReleaseAsset(trustedAuthority, architecture);
|
|
100
|
+
const asset = createReleaseAssetName(architecture);
|
|
101
|
+
const assetPath = path.join(releaseDirectory, asset);
|
|
102
|
+
const stampPath = path.join(releaseDirectory, createReleaseStampName(architecture));
|
|
103
|
+
if (!(await fileExists(assetPath))) {
|
|
104
|
+
throw new SpawnfileError("compile_error", `Moltnet release asset ${assetPath} does not exist`);
|
|
105
|
+
}
|
|
106
|
+
if (!(await fileExists(stampPath))) {
|
|
107
|
+
throw new SpawnfileError("compile_error", `Moltnet release asset ${asset} has no required capability stamp ${stampPath}`);
|
|
108
|
+
}
|
|
109
|
+
const stamp = parseReleaseStamp((await readFile(stampPath)).toString("utf8"), architecture);
|
|
110
|
+
const sha256 = createHash("sha256").update(await readFile(assetPath)).digest("hex");
|
|
111
|
+
if (stamp.sha256 !== sha256) {
|
|
112
|
+
throw new SpawnfileError("compile_error", `Moltnet release stamp sha256 does not match ${asset} (stale or tampered artifact)`);
|
|
113
|
+
}
|
|
114
|
+
if (stamp.version !== trustedAuthority.release_version
|
|
115
|
+
|| stamp.source_revision !== trustedAuthority.source_revision
|
|
116
|
+
|| stamp.asset !== trustedAsset.asset
|
|
117
|
+
|| `sha256:${sha256}` !== trustedAsset.asset_sha256) {
|
|
118
|
+
throw new SpawnfileError("compile_error", `Moltnet release stamp and asset do not match trusted pinned authority for ${architecture}`);
|
|
119
|
+
}
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
architecture,
|
|
122
|
+
asset,
|
|
123
|
+
asset_sha256: `sha256:${sha256}`,
|
|
124
|
+
capabilities: Object.freeze(["pi-bridge"]),
|
|
125
|
+
release_version: stamp.version,
|
|
126
|
+
source_revision: stamp.source_revision,
|
|
127
|
+
version: MOLTNET_RELEASE_IDENTITY_VERSION
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const stageMoltnetReleaseAsset = async (outputDirectory, releaseAssetPath, identity) => {
|
|
131
|
+
const installDirectory = path.join(outputDirectory, MOLTNET_BIN_DIRECTORY);
|
|
132
|
+
await ensureDirectory(installDirectory);
|
|
133
|
+
try {
|
|
134
|
+
await execFile("tar", ["-C", installDirectory, "-xzf", releaseAssetPath]);
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
138
|
+
throw new SpawnfileError("compile_error", `Unable to extract Moltnet release asset ${releaseAssetPath}: ${reason}`);
|
|
139
|
+
}
|
|
140
|
+
for (const binaryName of MOLTNET_BINARY_NAMES) {
|
|
141
|
+
const binaryPath = path.join(installDirectory, binaryName);
|
|
142
|
+
if (!(await fileExists(binaryPath))) {
|
|
143
|
+
throw new SpawnfileError("compile_error", `Moltnet release asset ${releaseAssetPath} did not contain ${binaryName}`);
|
|
144
|
+
}
|
|
145
|
+
await chmod(binaryPath, 0o755);
|
|
146
|
+
}
|
|
147
|
+
return identity;
|
|
148
|
+
};
|
|
46
149
|
const isCommandNotFoundError = (error) => typeof error === "object" &&
|
|
47
150
|
error !== null &&
|
|
48
151
|
"code" in error &&
|
|
@@ -89,36 +192,40 @@ export const resolveMoltnetCliCommand = async () => {
|
|
|
89
192
|
if (pathCli) {
|
|
90
193
|
return pathCli;
|
|
91
194
|
}
|
|
92
|
-
if (await fileExists(LOCAL_MOLTNET_CLI_PATH)) {
|
|
93
|
-
return validateMoltnetCli(LOCAL_MOLTNET_CLI_PATH, LOCAL_MOLTNET_CLI_PATH);
|
|
94
|
-
}
|
|
95
195
|
return validateMoltnetCli("moltnet", "PATH");
|
|
96
196
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return false;
|
|
197
|
+
const stageMoltnetBinariesAtReleaseDirectory = async (outputDirectory, releaseDirectory, options = {}) => {
|
|
198
|
+
if (!path.isAbsolute(releaseDirectory) || !(await fileExists(releaseDirectory))) {
|
|
199
|
+
throw new SpawnfileError("compile_error", "Trusted Moltnet release directory is invalid");
|
|
101
200
|
}
|
|
102
201
|
const architecture = resolveTargetArchitecture(options.architecture);
|
|
202
|
+
const authority = await readTrustedMoltnetReleaseAuthority();
|
|
203
|
+
const identity = await verifyReleaseIdentity(releaseDirectory, architecture, authority);
|
|
103
204
|
const releaseAssetPath = path.join(releaseDirectory, createReleaseAssetName(architecture));
|
|
104
|
-
|
|
105
|
-
|
|
205
|
+
return stageMoltnetReleaseAsset(outputDirectory, releaseAssetPath, identity);
|
|
206
|
+
};
|
|
207
|
+
export const stageMoltnetBinaries = async (outputDirectory, options = {}) => {
|
|
208
|
+
const releaseDirectory = options.releaseDirectory
|
|
209
|
+
?? await resolveConfiguredReleaseDirectory();
|
|
210
|
+
if (releaseDirectory) {
|
|
211
|
+
return stageMoltnetBinariesAtReleaseDirectory(outputDirectory, releaseDirectory, { architecture: options.architecture });
|
|
106
212
|
}
|
|
107
|
-
const
|
|
108
|
-
await
|
|
213
|
+
const architecture = resolveTargetArchitecture(options.architecture);
|
|
214
|
+
const authority = await readTrustedMoltnetReleaseAuthority();
|
|
215
|
+
const trustedAsset = trustedMoltnetReleaseAsset(authority, architecture);
|
|
216
|
+
const downloaded = await downloadTrustedMoltnetReleaseAsset(authority, architecture);
|
|
109
217
|
try {
|
|
110
|
-
await
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
await
|
|
218
|
+
return await stageMoltnetReleaseAsset(outputDirectory, downloaded.assetPath, Object.freeze({
|
|
219
|
+
architecture,
|
|
220
|
+
asset: trustedAsset.asset,
|
|
221
|
+
asset_sha256: trustedAsset.asset_sha256,
|
|
222
|
+
capabilities: Object.freeze(["pi-bridge"]),
|
|
223
|
+
release_version: authority.release_version,
|
|
224
|
+
source_revision: authority.source_revision,
|
|
225
|
+
version: MOLTNET_RELEASE_IDENTITY_VERSION
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
await downloaded.cleanup();
|
|
122
230
|
}
|
|
123
|
-
return true;
|
|
124
231
|
};
|
|
@@ -24,7 +24,7 @@ const createAttachmentConfig = (node, artifacts, attachment, agentSlug) => {
|
|
|
24
24
|
throw new SpawnfileError("compile_error", `Moltnet client config requires a resolved member id for ${node.name}`);
|
|
25
25
|
}
|
|
26
26
|
const serverPlan = findServerPlan(artifacts, attachment);
|
|
27
|
-
const auth = resolveMoltnetClientAuth(serverPlan.server, attachment.network, attachment.memberId, agentSlug);
|
|
27
|
+
const auth = resolveMoltnetClientAuth(serverPlan.server, attachment.network, attachment.memberId, agentSlug, attachment.auth?.tokenId);
|
|
28
28
|
return {
|
|
29
29
|
agent_name: node.name,
|
|
30
30
|
auth: {
|
|
@@ -38,7 +38,12 @@ const createAttachmentConfig = (node, artifacts, attachment, agentSlug) => {
|
|
|
38
38
|
? {
|
|
39
39
|
dms: {
|
|
40
40
|
enabled: attachment.dms.enabled,
|
|
41
|
-
...(attachment.dms.wake ? { wake: attachment.dms.wake } : {})
|
|
41
|
+
...(attachment.dms.wake ? { wake: attachment.dms.wake } : {}),
|
|
42
|
+
...(attachment.dms.allowedWakeSenders !== undefined
|
|
43
|
+
? {
|
|
44
|
+
allowed_wake_senders: [...attachment.dms.allowedWakeSenders]
|
|
45
|
+
}
|
|
46
|
+
: {})
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
: {}),
|
|
@@ -4,6 +4,8 @@ export interface MoltnetSecretPatch {
|
|
|
4
4
|
jsonPath: string;
|
|
5
5
|
}
|
|
6
6
|
export interface MoltnetClientAuthPlan {
|
|
7
|
+
credentialAgentId?: string;
|
|
8
|
+
credentialId?: string;
|
|
7
9
|
mode: "bearer" | "none" | "open";
|
|
8
10
|
registration?: "disabled" | "open" | "token";
|
|
9
11
|
staticToken?: boolean;
|
|
@@ -35,12 +37,25 @@ export declare const createDefaultMoltnetStorePath: (networkId: string, kind: "j
|
|
|
35
37
|
export declare const resolveMoltnetStorePath: (networkId: string, store: ManagedMoltnetStore) => string | null;
|
|
36
38
|
export declare const resolveMoltnetStorePersistenceMountPath: (networkId: string, store: ManagedMoltnetStore) => string | null;
|
|
37
39
|
export declare const createMoltnetServerConfigPath: (serverId: string) => string;
|
|
40
|
+
/**
|
|
41
|
+
* Dedicated causal-log subdirectory, a SIBLING of (never the same directory
|
|
42
|
+
* as) the server's own Moltnet.json config file. Deliberately kept separate
|
|
43
|
+
* so a persistent volume mounted here (to survive container teardown/
|
|
44
|
+
* restart, see moltnetArtifacts.ts's causal persistent mount) never masks a
|
|
45
|
+
* rebuilt image's freshly-baked Moltnet.json — which carries secrets
|
|
46
|
+
* patched in at container start via secretPatches — with a stale copy left
|
|
47
|
+
* over in a prior run's volume. Takes the already-container-absolute
|
|
48
|
+
* `configPath` (MoltnetServerPlan.configPath, post toContainerRootfsPath),
|
|
49
|
+
* not the rootfs-prefixed emit path.
|
|
50
|
+
*/
|
|
51
|
+
export declare const createMoltnetCausalDirectory: (configPath: string) => string;
|
|
52
|
+
export declare const createMoltnetCausalEventsPath: (configPath: string) => string;
|
|
38
53
|
export declare const createMoltnetNodeConfigPath: (teamSlug: string, networkId: string, agentId: string) => string;
|
|
39
54
|
export declare const renderMoltnetListenAddr: (server: Extract<TeamNetworkServer, {
|
|
40
55
|
mode: "managed";
|
|
41
56
|
}>) => string;
|
|
42
57
|
export declare const resolveMoltnetBaseUrl: (server: TeamNetworkServer) => string;
|
|
43
|
-
export declare const resolveMoltnetClientAuth: (server: TeamNetworkServer, networkId: string, memberId: string, agentSlug?: string) => MoltnetClientAuthPlan;
|
|
58
|
+
export declare const resolveMoltnetClientAuth: (server: TeamNetworkServer, networkId: string, memberId: string, agentSlug?: string, attachmentTokenId?: string) => MoltnetClientAuthPlan;
|
|
44
59
|
export declare const createMoltnetNativeServerConfig: ({ networkId, networkName, rooms, server }: MoltnetNativeServerConfigInput) => {
|
|
45
60
|
config: Record<string, unknown>;
|
|
46
61
|
secretPatches: MoltnetSecretPatch[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
1
2
|
const pathSafeSegment = (value) => value.replace(/[^A-Za-z0-9_.-]+/g, "-").replace(/^-+|-+$/g, "") || "item";
|
|
2
3
|
const isIpv6Literal = (value) => value.includes(":");
|
|
3
4
|
const normalizePosixPath = (value) => value.replace(/\/+/g, "/").replace(/\/+$/u, "") || "/";
|
|
@@ -30,6 +31,19 @@ export const resolveMoltnetStorePersistenceMountPath = (networkId, store) => {
|
|
|
30
31
|
return storePath ? storePath.slice(0, storePath.lastIndexOf("/")) || "/" : null;
|
|
31
32
|
};
|
|
32
33
|
export const createMoltnetServerConfigPath = (serverId) => `container/rootfs/var/lib/spawnfile/moltnet/servers/${pathSafeSegment(serverId)}/Moltnet.json`;
|
|
34
|
+
/**
|
|
35
|
+
* Dedicated causal-log subdirectory, a SIBLING of (never the same directory
|
|
36
|
+
* as) the server's own Moltnet.json config file. Deliberately kept separate
|
|
37
|
+
* so a persistent volume mounted here (to survive container teardown/
|
|
38
|
+
* restart, see moltnetArtifacts.ts's causal persistent mount) never masks a
|
|
39
|
+
* rebuilt image's freshly-baked Moltnet.json — which carries secrets
|
|
40
|
+
* patched in at container start via secretPatches — with a stale copy left
|
|
41
|
+
* over in a prior run's volume. Takes the already-container-absolute
|
|
42
|
+
* `configPath` (MoltnetServerPlan.configPath, post toContainerRootfsPath),
|
|
43
|
+
* not the rootfs-prefixed emit path.
|
|
44
|
+
*/
|
|
45
|
+
export const createMoltnetCausalDirectory = (configPath) => `${configPath.slice(0, configPath.lastIndexOf("/")) || "/"}/causal`;
|
|
46
|
+
export const createMoltnetCausalEventsPath = (configPath) => `${createMoltnetCausalDirectory(configPath)}/causal.jsonl`;
|
|
33
47
|
export const createMoltnetNodeConfigPath = (teamSlug, networkId, agentId) => `container/rootfs/var/lib/spawnfile/moltnet/nodes/${pathSafeSegment(teamSlug)}-${pathSafeSegment(networkId)}-${pathSafeSegment(agentId)}.json`;
|
|
34
48
|
export const renderMoltnetListenAddr = (server) => {
|
|
35
49
|
const bind = server.listen.bind;
|
|
@@ -50,10 +64,41 @@ export const resolveMoltnetBaseUrl = (server) => {
|
|
|
50
64
|
: bind;
|
|
51
65
|
return `http://${host}:${server.listen.port}`;
|
|
52
66
|
};
|
|
53
|
-
export const resolveMoltnetClientAuth = (server, networkId, memberId, agentSlug) => {
|
|
67
|
+
export const resolveMoltnetClientAuth = (server, networkId, memberId, agentSlug, attachmentTokenId) => {
|
|
54
68
|
if (server.auth.mode === "none") {
|
|
69
|
+
if (attachmentTokenId !== undefined) {
|
|
70
|
+
throw new SpawnfileError("validation_error", `Moltnet attachment ${networkId}/${memberId} cannot select token ${attachmentTokenId} when auth.mode is none`);
|
|
71
|
+
}
|
|
55
72
|
return { mode: "none" };
|
|
56
73
|
}
|
|
74
|
+
if (attachmentTokenId !== undefined) {
|
|
75
|
+
if (server.mode !== "managed" || server.auth.mode !== "bearer") {
|
|
76
|
+
throw new SpawnfileError("validation_error", `invalid Moltnet actor token ${attachmentTokenId} for ${memberId}: token_id is supported only for managed bearer servers`);
|
|
77
|
+
}
|
|
78
|
+
const tokens = server.auth.tokens?.filter((candidate) => candidate.id === attachmentTokenId) ?? [];
|
|
79
|
+
const token = tokens[0];
|
|
80
|
+
if (tokens.length === 0 || !token) {
|
|
81
|
+
throw new SpawnfileError("validation_error", `invalid Moltnet actor token ${attachmentTokenId} for ${memberId}: attachment ${networkId}/${memberId} references unknown token ${attachmentTokenId}`);
|
|
82
|
+
}
|
|
83
|
+
if (tokens.length !== 1) {
|
|
84
|
+
throw new SpawnfileError("validation_error", `invalid Moltnet actor token ${attachmentTokenId} for ${memberId}: token id must exist exactly once`);
|
|
85
|
+
}
|
|
86
|
+
if (token.scopes.length !== 2
|
|
87
|
+
|| token.scopes[0] !== "attach"
|
|
88
|
+
|| token.scopes[1] !== "write") {
|
|
89
|
+
throw new SpawnfileError("validation_error", `invalid Moltnet actor token ${attachmentTokenId} for ${memberId}: token must include attach and write scopes exactly`);
|
|
90
|
+
}
|
|
91
|
+
if (token.agents?.length !== 1 || token.agents[0] !== memberId) {
|
|
92
|
+
throw new SpawnfileError("validation_error", `invalid Moltnet actor token ${attachmentTokenId} for ${memberId}: token must declare exactly agents: [${memberId}]`);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
credentialAgentId: memberId,
|
|
96
|
+
credentialId: token.id,
|
|
97
|
+
mode: "bearer",
|
|
98
|
+
...(server.auth.agent_registration ? { registration: server.auth.agent_registration } : {}),
|
|
99
|
+
tokenEnv: token.secret
|
|
100
|
+
};
|
|
101
|
+
}
|
|
57
102
|
const client = server.auth.client;
|
|
58
103
|
const registrationOpen = server.auth.mode === "open" || server.auth.agent_registration === "open";
|
|
59
104
|
if (registrationOpen && !client) {
|
|
@@ -69,11 +114,28 @@ export const resolveMoltnetClientAuth = (server, networkId, memberId, agentSlug)
|
|
|
69
114
|
...(server.auth.agent_registration ? { registration: server.auth.agent_registration } : {})
|
|
70
115
|
};
|
|
71
116
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
117
|
+
const selectedManagedToken = client.token_id && server.mode === "managed"
|
|
118
|
+
? server.auth.tokens?.find((token) => token.id === client.token_id)
|
|
119
|
+
: undefined;
|
|
120
|
+
if (server.mode === "managed"
|
|
121
|
+
&& server.auth.mode === "bearer"
|
|
122
|
+
&& selectedManagedToken
|
|
123
|
+
&& (!selectedManagedToken.scopes.includes("attach")
|
|
124
|
+
|| !selectedManagedToken.scopes.includes("write"))) {
|
|
125
|
+
throw new SpawnfileError("validation_error", `Moltnet attachment ${networkId}/${memberId} must select its own attach+write token; auth.client token ${selectedManagedToken.id} is operator-only`);
|
|
126
|
+
}
|
|
127
|
+
if (selectedManagedToken
|
|
128
|
+
&& (selectedManagedToken.agents?.length ?? 0) > 0
|
|
129
|
+
&& !selectedManagedToken.agents?.includes(memberId)) {
|
|
130
|
+
throw new SpawnfileError("validation_error", `Moltnet attachment ${networkId}/${memberId} is not allowed by auth.client token ${selectedManagedToken.id}`);
|
|
131
|
+
}
|
|
132
|
+
const tokenEnv = client.token_env ?? selectedManagedToken?.secret;
|
|
133
|
+
const selectedAgents = selectedManagedToken
|
|
134
|
+
? [...new Set((selectedManagedToken.agents ?? []).map((agent) => agent.trim()))].filter(Boolean)
|
|
135
|
+
: [];
|
|
76
136
|
return {
|
|
137
|
+
...(selectedAgents.length === 1 ? { credentialAgentId: selectedAgents[0] } : {}),
|
|
138
|
+
...(client.token_id ? { credentialId: client.token_id } : {}),
|
|
77
139
|
mode: server.auth.mode,
|
|
78
140
|
...(server.auth.agent_registration ? { registration: server.auth.agent_registration } : {}),
|
|
79
141
|
...(client.static_token ? { staticToken: true } : {}),
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ResolvedExternalParticipant } from "./organizationIdentity.js";
|
|
2
|
+
import type { EmittedFile } from "../runtime/index.js";
|
|
3
|
+
import type { MoltnetExternalParticipantIntent } from "./types.js";
|
|
4
|
+
export declare const MOLTNET_EXTERNAL_PARTICIPANT_ARTIFACT_VERSION: "spawnfile.moltnet-external-participant.v1";
|
|
5
|
+
export interface MoltnetExternalParticipantArtifactV1 {
|
|
6
|
+
readonly version: typeof MOLTNET_EXTERNAL_PARTICIPANT_ARTIFACT_VERSION;
|
|
7
|
+
readonly participant: {
|
|
8
|
+
readonly authored_key: string;
|
|
9
|
+
readonly kind: "service";
|
|
10
|
+
readonly member_id: string;
|
|
11
|
+
readonly principal_id: string;
|
|
12
|
+
};
|
|
13
|
+
readonly network: {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
};
|
|
16
|
+
readonly auth: {
|
|
17
|
+
readonly mode: "bearer";
|
|
18
|
+
readonly token_id: string;
|
|
19
|
+
readonly token_env: string;
|
|
20
|
+
};
|
|
21
|
+
readonly direct_messages: readonly {
|
|
22
|
+
readonly members: readonly [string, string];
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
export interface BuildMoltnetExternalParticipantArtifactInput {
|
|
26
|
+
readonly participant: ResolvedExternalParticipant;
|
|
27
|
+
readonly networkId: string;
|
|
28
|
+
readonly tokenId: string;
|
|
29
|
+
readonly tokenEnv: string;
|
|
30
|
+
readonly directMessagePeers: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export declare const buildMoltnetExternalParticipantArtifact: (input: BuildMoltnetExternalParticipantArtifactInput) => MoltnetExternalParticipantArtifactV1;
|
|
33
|
+
export declare const parseMoltnetExternalParticipantArtifact: (raw: unknown) => MoltnetExternalParticipantArtifactV1;
|
|
34
|
+
export declare const renderMoltnetExternalParticipantArtifact: (artifact: MoltnetExternalParticipantArtifactV1) => string;
|
|
35
|
+
export declare const createMoltnetExternalParticipantArtifactFiles: (intents: readonly MoltnetExternalParticipantIntent[]) => {
|
|
36
|
+
artifacts: MoltnetExternalParticipantArtifactV1[];
|
|
37
|
+
files: EmittedFile[];
|
|
38
|
+
};
|