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,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
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { types as nodeTypes } from "node:util";
|
|
2
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
3
|
+
import { createMoltnetExternalParticipantArtifactPath } from "./moltnetArtifactPaths.js";
|
|
4
|
+
export const MOLTNET_EXTERNAL_PARTICIPANT_ARTIFACT_VERSION = "spawnfile.moltnet-external-participant.v1";
|
|
5
|
+
const idPattern = /^[a-z][a-z0-9-]{0,62}(?:\.[a-z][a-z0-9-]{0,62}){0,7}$/u;
|
|
6
|
+
const segmentPattern = /^[a-z][a-z0-9-]{0,62}$/u;
|
|
7
|
+
const envPattern = /^[A-Z_][A-Z0-9_]{0,127}$/u;
|
|
8
|
+
const MAX_HOSTILE_DEPTH = 16;
|
|
9
|
+
const MAX_HOSTILE_NODES = 512;
|
|
10
|
+
const isCanonicalMemberId = (value) => idPattern.test(value) && Buffer.byteLength(value, "ascii") <= 255;
|
|
11
|
+
const fail = (message) => { throw new SpawnfileError("validation_error", `invalid Moltnet external participant artifact: ${message}`); };
|
|
12
|
+
const isCanonicalArray = (value) => Array.isArray(value) && Object.getPrototypeOf(value) === Array.prototype;
|
|
13
|
+
const requireCanonicalArray = (value, label) => {
|
|
14
|
+
if (value && typeof value === "object" && nodeTypes.isProxy(value))
|
|
15
|
+
fail(`${label} proxy`);
|
|
16
|
+
if (!isCanonicalArray(value))
|
|
17
|
+
return fail(`${label} array prototype`);
|
|
18
|
+
const array = value;
|
|
19
|
+
if (array.length > 128)
|
|
20
|
+
fail(`${label} cardinality exceeds 128`);
|
|
21
|
+
return array;
|
|
22
|
+
};
|
|
23
|
+
const keys = (value, expected) => {
|
|
24
|
+
if (Object.getPrototypeOf(value) !== Object.prototype)
|
|
25
|
+
fail("object prototype");
|
|
26
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
27
|
+
fail("symbol property");
|
|
28
|
+
const actual = Object.getOwnPropertyNames(value).filter((key) => key !== "length");
|
|
29
|
+
if (actual.length !== expected.length || Object.keys(value).length !== expected.length || actual.some((key, index) => key !== expected[index]))
|
|
30
|
+
fail(`keys must be ${expected.join(",")}`);
|
|
31
|
+
for (const key of actual) {
|
|
32
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
33
|
+
if (!descriptor || !("value" in descriptor) || descriptor.enumerable !== true)
|
|
34
|
+
fail("accessor or non-enumerable property");
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const stringValue = (value, label, pattern = idPattern) => {
|
|
38
|
+
if (typeof value !== "string" || !pattern.test(value) || value.length > 255)
|
|
39
|
+
fail(`${label} value`);
|
|
40
|
+
return value;
|
|
41
|
+
};
|
|
42
|
+
const freezeCopy = (value, seen = new WeakSet()) => {
|
|
43
|
+
if (!value || typeof value !== "object")
|
|
44
|
+
return value;
|
|
45
|
+
if (seen.has(value))
|
|
46
|
+
fail("alias or cycle");
|
|
47
|
+
seen.add(value);
|
|
48
|
+
for (const child of Object.values(value))
|
|
49
|
+
freezeCopy(child, seen);
|
|
50
|
+
return Object.freeze(value);
|
|
51
|
+
};
|
|
52
|
+
const rejectAliases = (value, state = { nodes: 0, seen: new WeakSet() }, depth = 0) => {
|
|
53
|
+
if (!value || typeof value !== "object")
|
|
54
|
+
return;
|
|
55
|
+
if (nodeTypes.isProxy(value))
|
|
56
|
+
fail("proxy");
|
|
57
|
+
if (depth > MAX_HOSTILE_DEPTH)
|
|
58
|
+
fail("object depth exceeds 16");
|
|
59
|
+
state.nodes += 1;
|
|
60
|
+
if (state.nodes > MAX_HOSTILE_NODES)
|
|
61
|
+
fail("object node count exceeds 512");
|
|
62
|
+
if (state.seen.has(value))
|
|
63
|
+
fail("alias or cycle");
|
|
64
|
+
state.seen.add(value);
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
requireCanonicalArray(value, "array");
|
|
67
|
+
if (Object.getOwnPropertySymbols(value).length > 0 || Object.getOwnPropertyNames(value).some((key) => key !== "length" && !/^\d+$/u.test(key)))
|
|
68
|
+
fail("extended array");
|
|
69
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
70
|
+
if (!Object.hasOwn(value, index))
|
|
71
|
+
fail("sparse array");
|
|
72
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
|
|
73
|
+
if (!descriptor || !("value" in descriptor) || descriptor.enumerable !== true)
|
|
74
|
+
fail("accessor or non-enumerable property");
|
|
75
|
+
rejectAliases(value[index], state, depth + 1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const ownNames = Object.getOwnPropertyNames(value);
|
|
80
|
+
if (ownNames.length > MAX_HOSTILE_NODES)
|
|
81
|
+
fail("object property count exceeds 512");
|
|
82
|
+
for (const key of ownNames) {
|
|
83
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
84
|
+
if (!descriptor) {
|
|
85
|
+
fail("missing property descriptor");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!("value" in descriptor)) {
|
|
89
|
+
fail("accessor property");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const child = descriptor.value;
|
|
93
|
+
rejectAliases(child, state, depth + 1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
export const buildMoltnetExternalParticipantArtifact = (input) => {
|
|
98
|
+
const { participant, networkId, tokenId, tokenEnv, directMessagePeers } = input;
|
|
99
|
+
if (participant.kind !== "service" || !segmentPattern.test(participant.authoredParticipantKey) || participant.principalId !== `system:${participant.memberId}`)
|
|
100
|
+
fail("participant identity");
|
|
101
|
+
rejectAliases(directMessagePeers);
|
|
102
|
+
const peers = [...directMessagePeers];
|
|
103
|
+
if (peers.length === 0 || peers.length > 128 || new Set(peers).size !== peers.length)
|
|
104
|
+
fail("direct-message peer cardinality");
|
|
105
|
+
if (peers.some((peer) => !isCanonicalMemberId(peer) || peer === participant.memberId))
|
|
106
|
+
fail("direct-message peer identity");
|
|
107
|
+
const members = peers.sort().map((peer) => [peer, participant.memberId].sort());
|
|
108
|
+
const artifact = {
|
|
109
|
+
version: MOLTNET_EXTERNAL_PARTICIPANT_ARTIFACT_VERSION,
|
|
110
|
+
participant: { authored_key: participant.authoredParticipantKey, kind: "service", member_id: participant.memberId, principal_id: participant.principalId },
|
|
111
|
+
network: { id: stringValue(networkId, "network id", segmentPattern) },
|
|
112
|
+
auth: { mode: "bearer", token_id: stringValue(tokenId, "token id"), token_env: stringValue(tokenEnv, "token env", envPattern) },
|
|
113
|
+
direct_messages: members.map((members) => ({ members }))
|
|
114
|
+
};
|
|
115
|
+
return parseMoltnetExternalParticipantArtifact(artifact);
|
|
116
|
+
};
|
|
117
|
+
export const parseMoltnetExternalParticipantArtifact = (raw) => {
|
|
118
|
+
rejectAliases(raw);
|
|
119
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
120
|
+
fail("root object");
|
|
121
|
+
const value = raw;
|
|
122
|
+
keys(value, ["version", "participant", "network", "auth", "direct_messages"]);
|
|
123
|
+
if (value.version !== MOLTNET_EXTERNAL_PARTICIPANT_ARTIFACT_VERSION)
|
|
124
|
+
fail("version");
|
|
125
|
+
const participant = value.participant;
|
|
126
|
+
const network = value.network;
|
|
127
|
+
const auth = value.auth;
|
|
128
|
+
if (!participant || typeof participant !== "object" || Array.isArray(participant))
|
|
129
|
+
fail("participant object");
|
|
130
|
+
if (!network || typeof network !== "object" || Array.isArray(network))
|
|
131
|
+
fail("network object");
|
|
132
|
+
if (!auth || typeof auth !== "object" || Array.isArray(auth))
|
|
133
|
+
fail("auth object");
|
|
134
|
+
keys(participant, ["authored_key", "kind", "member_id", "principal_id"]);
|
|
135
|
+
keys(network, ["id"]);
|
|
136
|
+
keys(auth, ["mode", "token_id", "token_env"]);
|
|
137
|
+
const member = stringValue(participant.member_id, "member id");
|
|
138
|
+
const authoredKey = stringValue(participant.authored_key, "authored key", segmentPattern);
|
|
139
|
+
if (participant.kind !== "service" || participant.principal_id !== `system:${member}` || authoredKey !== member)
|
|
140
|
+
fail("participant");
|
|
141
|
+
if (auth.mode !== "bearer")
|
|
142
|
+
fail("auth mode");
|
|
143
|
+
const messages = value.direct_messages;
|
|
144
|
+
const directMessages = requireCanonicalArray(messages, "direct messages");
|
|
145
|
+
if (directMessages.length === 0 || directMessages.length > 128 || directMessages.some((entry) => !entry || typeof entry !== "object" || Array.isArray(entry)))
|
|
146
|
+
fail("direct message cardinality");
|
|
147
|
+
const parsed = directMessages.map((entry) => {
|
|
148
|
+
const item = entry;
|
|
149
|
+
keys(item, ["members"]);
|
|
150
|
+
const members = requireCanonicalArray(item.members, "members");
|
|
151
|
+
if (members.length !== 2 || members.some((member) => typeof member !== "string"))
|
|
152
|
+
fail("members");
|
|
153
|
+
const pair = members;
|
|
154
|
+
if (!pair.every((entry) => isCanonicalMemberId(entry)) || pair[0] >= pair[1] || !pair.includes(member) || pair[0] === pair[1])
|
|
155
|
+
fail("member ordering");
|
|
156
|
+
return { members: [pair[0], pair[1]] };
|
|
157
|
+
});
|
|
158
|
+
const peerFor = (pair) => pair[0] === member ? pair[1] : pair[0];
|
|
159
|
+
if (parsed.some((entry, index) => index > 0 && peerFor(entry.members) <= peerFor(parsed[index - 1].members)))
|
|
160
|
+
fail("message ordering");
|
|
161
|
+
const result = { version: value.version, participant: { authored_key: participant.authored_key, kind: "service", member_id: member, principal_id: participant.principal_id }, network: { id: stringValue(network.id, "network id", segmentPattern) }, auth: { mode: "bearer", token_id: stringValue(auth.token_id, "token id", segmentPattern), token_env: stringValue(auth.token_env, "token env", envPattern) }, direct_messages: parsed };
|
|
162
|
+
return freezeCopy(structuredClone(result));
|
|
163
|
+
};
|
|
164
|
+
export const renderMoltnetExternalParticipantArtifact = (artifact) => `${JSON.stringify(parseMoltnetExternalParticipantArtifact(artifact), null, 2)}\n`;
|
|
165
|
+
export const createMoltnetExternalParticipantArtifactFiles = (intents) => {
|
|
166
|
+
const ordered = [...intents].sort((left, right) => byArtifactKey(left, right));
|
|
167
|
+
const keys = new Set();
|
|
168
|
+
for (const intent of ordered) {
|
|
169
|
+
const key = `${intent.networkId}\u0000${intent.participant.memberId}`;
|
|
170
|
+
if (keys.has(key))
|
|
171
|
+
fail("duplicate external participant artifact");
|
|
172
|
+
keys.add(key);
|
|
173
|
+
}
|
|
174
|
+
const artifacts = ordered.map((intent) => buildMoltnetExternalParticipantArtifact(intent));
|
|
175
|
+
return {
|
|
176
|
+
artifacts,
|
|
177
|
+
files: artifacts.map((artifact) => ({
|
|
178
|
+
content: renderMoltnetExternalParticipantArtifact(artifact),
|
|
179
|
+
mode: 0o600,
|
|
180
|
+
path: createMoltnetExternalParticipantArtifactPath(artifact.network.id, artifact.participant.member_id)
|
|
181
|
+
}))
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
const byArtifactKey = (left, right) => {
|
|
185
|
+
const a = `${left.networkId}\u0000${left.participant.memberId}`;
|
|
186
|
+
const b = `${right.networkId}\u0000${right.participant.memberId}`;
|
|
187
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
188
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveMoltnetClientAuth } from "./moltnetConfigLowering.js";
|
|
2
2
|
import { resolveRuntimeConfig } from "./moltnetRuntimeConfig.js";
|
|
3
3
|
export const createMoltnetNodeConfigContent = ({ agentNode, attachment, networkServer, nodeSlug, plan, serverPlan }) => {
|
|
4
|
-
const clientAuth = resolveMoltnetClientAuth(networkServer, attachment.network, attachment.memberId, nodeSlug);
|
|
4
|
+
const clientAuth = resolveMoltnetClientAuth(networkServer, attachment.network, attachment.memberId, nodeSlug, attachment.auth?.tokenId);
|
|
5
5
|
const usesPerAttachmentOpenToken = clientAuth.mode === "open" &&
|
|
6
6
|
clientAuth.staticToken !== true &&
|
|
7
7
|
Boolean(clientAuth.tokenEnv || clientAuth.tokenPath);
|
|
@@ -56,7 +56,12 @@ export const createMoltnetNodeConfigContent = ({ agentNode, attachment, networkS
|
|
|
56
56
|
? {
|
|
57
57
|
dms: {
|
|
58
58
|
enabled: attachment.dms.enabled,
|
|
59
|
-
...(attachment.dms.wake ? { wake: attachment.dms.wake } : {})
|
|
59
|
+
...(attachment.dms.wake ? { wake: attachment.dms.wake } : {}),
|
|
60
|
+
...(attachment.dms.allowedWakeSenders !== undefined
|
|
61
|
+
? {
|
|
62
|
+
allowed_wake_senders: [...attachment.dms.allowedWakeSenders]
|
|
63
|
+
}
|
|
64
|
+
: {})
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
: {})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const MOLTNET_RELEASE_AUTHORITY_VERSION: "spawnfile.moltnet-release-authority.v1";
|
|
2
|
+
export type MoltnetTargetArchitecture = "amd64" | "arm64";
|
|
3
|
+
export interface TrustedMoltnetReleaseAsset {
|
|
4
|
+
readonly architecture: MoltnetTargetArchitecture;
|
|
5
|
+
readonly asset: string;
|
|
6
|
+
readonly asset_sha256: `sha256:${string}`;
|
|
7
|
+
}
|
|
8
|
+
export interface TrustedMoltnetReleaseAuthority {
|
|
9
|
+
readonly version: typeof MOLTNET_RELEASE_AUTHORITY_VERSION;
|
|
10
|
+
readonly release_version: string;
|
|
11
|
+
readonly source_revision: string;
|
|
12
|
+
readonly capabilities: readonly ["pi-bridge"];
|
|
13
|
+
readonly assets: readonly TrustedMoltnetReleaseAsset[];
|
|
14
|
+
}
|
|
15
|
+
export declare const parseTrustedMoltnetReleaseAuthority: (raw: unknown) => TrustedMoltnetReleaseAuthority;
|
|
16
|
+
export declare const readTrustedMoltnetReleaseAuthority: () => Promise<TrustedMoltnetReleaseAuthority>;
|
|
17
|
+
export declare const trustedMoltnetReleaseAsset: (authority: TrustedMoltnetReleaseAuthority, architecture: MoltnetTargetArchitecture) => TrustedMoltnetReleaseAsset;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
3
|
+
export const MOLTNET_RELEASE_AUTHORITY_VERSION = "spawnfile.moltnet-release-authority.v1";
|
|
4
|
+
const SHA256 = /^sha256:[a-f0-9]{64}$/u;
|
|
5
|
+
const REVISION = /^[a-f0-9]{40}$/u;
|
|
6
|
+
const VERSION = /^v?\d+\.\d+\.\d+(?:-\d+-g[a-f0-9]{7,40})?$/u;
|
|
7
|
+
const exactKeys = (value, keys) => Object.keys(value).sort().join("\0") === [...keys].sort().join("\0");
|
|
8
|
+
const fail = () => {
|
|
9
|
+
throw new SpawnfileError("compile_error", "Trusted Moltnet release authority is invalid");
|
|
10
|
+
};
|
|
11
|
+
export const parseTrustedMoltnetReleaseAuthority = (raw) => {
|
|
12
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
13
|
+
return fail();
|
|
14
|
+
const value = raw;
|
|
15
|
+
if (!exactKeys(value, [
|
|
16
|
+
"assets", "capabilities", "release_version", "source_revision", "version"
|
|
17
|
+
])
|
|
18
|
+
|| value.version !== MOLTNET_RELEASE_AUTHORITY_VERSION
|
|
19
|
+
|| typeof value.release_version !== "string"
|
|
20
|
+
|| !VERSION.test(value.release_version)
|
|
21
|
+
|| typeof value.source_revision !== "string"
|
|
22
|
+
|| !REVISION.test(value.source_revision)
|
|
23
|
+
|| !Array.isArray(value.capabilities)
|
|
24
|
+
|| value.capabilities.length !== 1
|
|
25
|
+
|| value.capabilities[0] !== "pi-bridge"
|
|
26
|
+
|| !Array.isArray(value.assets)
|
|
27
|
+
|| value.assets.length !== 2)
|
|
28
|
+
return fail();
|
|
29
|
+
const assets = [];
|
|
30
|
+
for (const rawAsset of value.assets) {
|
|
31
|
+
if (!rawAsset || typeof rawAsset !== "object" || Array.isArray(rawAsset))
|
|
32
|
+
return fail();
|
|
33
|
+
const asset = rawAsset;
|
|
34
|
+
if (!exactKeys(asset, ["architecture", "asset", "asset_sha256"])
|
|
35
|
+
|| asset.architecture !== "amd64" && asset.architecture !== "arm64"
|
|
36
|
+
|| asset.asset !== `moltnet_linux_${asset.architecture}.tar.gz`
|
|
37
|
+
|| typeof asset.asset_sha256 !== "string"
|
|
38
|
+
|| !SHA256.test(asset.asset_sha256))
|
|
39
|
+
return fail();
|
|
40
|
+
assets.push(Object.freeze({
|
|
41
|
+
architecture: asset.architecture,
|
|
42
|
+
asset: asset.asset,
|
|
43
|
+
asset_sha256: asset.asset_sha256
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
if (assets[0]?.architecture !== "amd64" || assets[1]?.architecture !== "arm64")
|
|
47
|
+
return fail();
|
|
48
|
+
const describedRevision = value.release_version.match(/-g([a-f0-9]{7,40})$/u)?.[1];
|
|
49
|
+
if (describedRevision && !value.source_revision.startsWith(describedRevision))
|
|
50
|
+
return fail();
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
version: MOLTNET_RELEASE_AUTHORITY_VERSION,
|
|
53
|
+
release_version: value.release_version,
|
|
54
|
+
source_revision: value.source_revision,
|
|
55
|
+
capabilities: Object.freeze(["pi-bridge"]),
|
|
56
|
+
assets: Object.freeze(assets)
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export const readTrustedMoltnetReleaseAuthority = async () => {
|
|
60
|
+
try {
|
|
61
|
+
return parseTrustedMoltnetReleaseAuthority(JSON.parse(await readFile(new URL("../../moltnet-releases.json", import.meta.url), "utf8")));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
if (error instanceof SpawnfileError)
|
|
65
|
+
throw error;
|
|
66
|
+
return fail();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export const trustedMoltnetReleaseAsset = (authority, architecture) => {
|
|
70
|
+
const parsed = parseTrustedMoltnetReleaseAuthority(authority);
|
|
71
|
+
const asset = parsed.assets.find((candidate) => candidate.architecture === architecture);
|
|
72
|
+
return asset ?? fail();
|
|
73
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type MoltnetTargetArchitecture, type TrustedMoltnetReleaseAuthority } from "./moltnetReleaseAuthority.js";
|
|
2
|
+
type ReleaseResponse = Pick<Response, "body" | "headers" | "ok" | "status" | "statusText">;
|
|
3
|
+
export interface MoltnetReleaseDownloadDependencies {
|
|
4
|
+
readonly fetchRelease?: (input: string, init: RequestInit) => Promise<ReleaseResponse>;
|
|
5
|
+
}
|
|
6
|
+
export interface DownloadedMoltnetReleaseAsset {
|
|
7
|
+
readonly assetPath: string;
|
|
8
|
+
readonly cleanup: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const trustedMoltnetReleaseDownloadUrl: (authority: TrustedMoltnetReleaseAuthority, architecture: MoltnetTargetArchitecture) => string;
|
|
11
|
+
export declare const downloadTrustedMoltnetReleaseAsset: (authority: TrustedMoltnetReleaseAuthority, architecture: MoltnetTargetArchitecture, dependencies?: MoltnetReleaseDownloadDependencies) => Promise<DownloadedMoltnetReleaseAsset>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { SpawnfileError } from "../shared/index.js";
|
|
6
|
+
import { parseTrustedMoltnetReleaseAuthority, trustedMoltnetReleaseAsset } from "./moltnetReleaseAuthority.js";
|
|
7
|
+
const MAX_RELEASE_BYTES = 64 * 1024 * 1024;
|
|
8
|
+
const DOWNLOAD_TIMEOUT_MS = 120_000;
|
|
9
|
+
export const trustedMoltnetReleaseDownloadUrl = (authority, architecture) => {
|
|
10
|
+
const parsed = parseTrustedMoltnetReleaseAuthority(authority);
|
|
11
|
+
const asset = trustedMoltnetReleaseAsset(parsed, architecture);
|
|
12
|
+
return `https://github.com/noopolis/moltnet/releases/download/${parsed.release_version}/${asset.asset}`;
|
|
13
|
+
};
|
|
14
|
+
const responseBytes = async (response) => {
|
|
15
|
+
const declaredLength = response.headers.get("content-length");
|
|
16
|
+
if (declaredLength !== null) {
|
|
17
|
+
const bytes = Number(declaredLength);
|
|
18
|
+
if (!Number.isSafeInteger(bytes) || bytes < 1 || bytes > MAX_RELEASE_BYTES) {
|
|
19
|
+
throw new SpawnfileError("compile_error", "Pinned Moltnet release has an invalid content length");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (response.body === null) {
|
|
23
|
+
throw new SpawnfileError("compile_error", "Pinned Moltnet release response has no body");
|
|
24
|
+
}
|
|
25
|
+
const chunks = [];
|
|
26
|
+
let total = 0;
|
|
27
|
+
const reader = response.body.getReader();
|
|
28
|
+
try {
|
|
29
|
+
for (;;) {
|
|
30
|
+
const item = await reader.read();
|
|
31
|
+
if (item.done)
|
|
32
|
+
break;
|
|
33
|
+
total += item.value.byteLength;
|
|
34
|
+
if (total > MAX_RELEASE_BYTES) {
|
|
35
|
+
await reader.cancel();
|
|
36
|
+
throw new SpawnfileError("compile_error", "Pinned Moltnet release exceeds the download limit");
|
|
37
|
+
}
|
|
38
|
+
chunks.push(item.value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
reader.releaseLock();
|
|
43
|
+
}
|
|
44
|
+
if (total === 0)
|
|
45
|
+
throw new SpawnfileError("compile_error", "Pinned Moltnet release is empty");
|
|
46
|
+
return Buffer.concat(chunks, total);
|
|
47
|
+
};
|
|
48
|
+
export const downloadTrustedMoltnetReleaseAsset = async (authority, architecture, dependencies = {}) => {
|
|
49
|
+
const parsed = parseTrustedMoltnetReleaseAuthority(authority);
|
|
50
|
+
const asset = trustedMoltnetReleaseAsset(parsed, architecture);
|
|
51
|
+
const url = trustedMoltnetReleaseDownloadUrl(parsed, architecture);
|
|
52
|
+
const fetchRelease = dependencies.fetchRelease ?? fetch;
|
|
53
|
+
let response;
|
|
54
|
+
try {
|
|
55
|
+
response = await fetchRelease(url, {
|
|
56
|
+
redirect: "follow",
|
|
57
|
+
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
62
|
+
throw new SpawnfileError("compile_error", `Unable to download pinned Moltnet release: ${reason}`);
|
|
63
|
+
}
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
throw new SpawnfileError("compile_error", `Unable to download pinned Moltnet release: HTTP ${response.status} ${response.statusText}`);
|
|
66
|
+
}
|
|
67
|
+
const bytes = await responseBytes(response);
|
|
68
|
+
const sha256 = `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
|
|
69
|
+
if (sha256 !== asset.asset_sha256) {
|
|
70
|
+
throw new SpawnfileError("compile_error", "Downloaded Moltnet release digest does not match trusted authority");
|
|
71
|
+
}
|
|
72
|
+
const directory = await mkdtemp(path.join(os.tmpdir(), "spawnfile-moltnet-release-"));
|
|
73
|
+
try {
|
|
74
|
+
const assetPath = path.join(directory, asset.asset);
|
|
75
|
+
await writeFile(assetPath, bytes, { flag: "wx" });
|
|
76
|
+
return Object.freeze({
|
|
77
|
+
assetPath,
|
|
78
|
+
cleanup: () => rm(directory, { force: true, recursive: true })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
await rm(directory, { force: true, recursive: true });
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { SpawnfileError } from "../shared/index.js";
|
|
2
|
+
import { resolveMoltnetClientAuth } from "./moltnetConfigLowering.js";
|
|
2
3
|
const cloneAttachment = (attachment, context) => ({
|
|
3
|
-
...(attachment.
|
|
4
|
-
|
|
4
|
+
...(attachment.auth ? { auth: { ...attachment.auth } } : {}),
|
|
5
|
+
...(attachment.dms
|
|
6
|
+
? {
|
|
7
|
+
dms: {
|
|
8
|
+
...attachment.dms,
|
|
9
|
+
...(attachment.dms.allowedWakeSenders !== undefined
|
|
10
|
+
? { allowedWakeSenders: [...attachment.dms.allowedWakeSenders] }
|
|
11
|
+
: {})
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
: {}),
|
|
15
|
+
memberId: context.resolvedMemberId ?? context.memberId,
|
|
5
16
|
network: attachment.network,
|
|
6
17
|
...(attachment.rooms
|
|
7
18
|
? {
|
|
@@ -72,6 +83,9 @@ export const resolveMoltnetAttachments = (attachments, context, nodeName) => {
|
|
|
72
83
|
if (!network) {
|
|
73
84
|
throw new SpawnfileError("validation_error", `Agent ${nodeName} references unknown Moltnet network ${attachment.network} on team ${context.teamName}`);
|
|
74
85
|
}
|
|
86
|
+
if (network.server) {
|
|
87
|
+
resolveMoltnetClientAuth(network.server, network.id, context.memberId, undefined, attachment.auth?.tokenId);
|
|
88
|
+
}
|
|
75
89
|
for (const roomId of Object.keys(attachment.rooms ?? {})) {
|
|
76
90
|
const room = network.rooms.find((entry) => entry.id === roomId);
|
|
77
91
|
if (!room) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SpawnfileError } from "../shared/index.js";
|
|
2
2
|
import { resolveMoltnetRoomMemberships } from "./moltnetRoomMemberships.js";
|
|
3
3
|
import { resolveMoltnetAttachments } from "./moltnetRepresentativeResolution.js";
|
|
4
|
+
import { resolveCanonicalAgentMemberId } from "./organizationIdentity.js";
|
|
4
5
|
export { resolveMoltnetAttachments, resolveTeamRepresentatives } from "./moltnetRepresentativeResolution.js";
|
|
5
6
|
const findTeamBySource = (plan, source) => {
|
|
6
7
|
const node = plan.nodes.find((entry) => entry.kind === "team" && entry.value.source === source);
|
|
@@ -25,12 +26,22 @@ const validateGlobalMemberIds = (plan) => {
|
|
|
25
26
|
context
|
|
26
27
|
]));
|
|
27
28
|
for (const context of uniqueContexts.values()) {
|
|
28
|
-
|
|
29
|
+
let memberId = context.memberId;
|
|
30
|
+
if (plan.organizationIdentity) {
|
|
31
|
+
const canonicalMemberId = resolveCanonicalAgentMemberId(plan, context.agentSource);
|
|
32
|
+
const matches = plan.organizationIdentity.agentMembers.filter((member) => member.memberId === canonicalMemberId);
|
|
33
|
+
if (!canonicalMemberId || matches.length !== 1) {
|
|
34
|
+
throw new SpawnfileError("validation_error", `Unable to resolve exactly one canonical Moltnet member id for ${context.agentSource}`);
|
|
35
|
+
}
|
|
36
|
+
memberId = canonicalMemberId;
|
|
37
|
+
}
|
|
38
|
+
const previous = seen.get(memberId);
|
|
29
39
|
const label = `${context.teamName} (${context.teamSource}) member ${context.memberId}`;
|
|
30
|
-
if (previous &&
|
|
31
|
-
|
|
40
|
+
if (previous &&
|
|
41
|
+
previous.agentSource !== context.agentSource) {
|
|
42
|
+
throw new SpawnfileError("validation_error", `Moltnet member_id ${memberId} is declared by multiple direct agent member slots: ${previous.label}; ${label}`);
|
|
32
43
|
}
|
|
33
|
-
seen.set(context.
|
|
44
|
+
seen.set(memberId, { agentSource: context.agentSource, label });
|
|
34
45
|
}
|
|
35
46
|
};
|
|
36
47
|
const getRoomMemberships = (plan) => {
|
|
@@ -41,25 +52,59 @@ const getRoomMemberships = (plan) => {
|
|
|
41
52
|
const synthesizeRepresentativeAttachments = (memberships) => memberships
|
|
42
53
|
.filter((membership) => membership.representedSlot !== undefined)
|
|
43
54
|
.map((membership) => ({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
agentSource: membership.agentSource,
|
|
56
|
+
directTeamSource: membership.directTeamSource,
|
|
57
|
+
attachment: {
|
|
58
|
+
contextRooms: {
|
|
59
|
+
[membership.declaringTeamSource]: [membership.roomId]
|
|
60
|
+
},
|
|
61
|
+
memberId: membership.concreteMemberId,
|
|
62
|
+
network: membership.networkId,
|
|
63
|
+
rooms: {
|
|
64
|
+
[membership.roomId]: membership.policy ? { ...membership.policy } : {}
|
|
65
|
+
},
|
|
66
|
+
teamSource: membership.declaringTeamSource
|
|
67
|
+
}
|
|
53
68
|
}));
|
|
54
|
-
const
|
|
69
|
+
const areEquivalentDmPolicy = (left, right) => {
|
|
70
|
+
if (left.enabled !== right.enabled || left.wake !== right.wake) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const leftSenders = left.allowedWakeSenders;
|
|
74
|
+
const rightSenders = right.allowedWakeSenders;
|
|
75
|
+
if (leftSenders === undefined || rightSenders === undefined) {
|
|
76
|
+
return leftSenders === rightSenders;
|
|
77
|
+
}
|
|
78
|
+
if (leftSenders.length !== rightSenders.length) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
return leftSenders.every((sender, index) => sender === rightSenders[index]);
|
|
82
|
+
};
|
|
83
|
+
const areEquivalentRoomPolicy = (left, right) => left.wake === right.wake;
|
|
55
84
|
const hasRoomPolicy = (policy) => policy.wake !== undefined;
|
|
85
|
+
const cloneMoltnetDm = (dms) => ({
|
|
86
|
+
...dms,
|
|
87
|
+
...(dms.allowedWakeSenders !== undefined
|
|
88
|
+
? { allowedWakeSenders: [...dms.allowedWakeSenders] }
|
|
89
|
+
: {})
|
|
90
|
+
});
|
|
56
91
|
const mergeAttachment = (target, next, nodeName) => {
|
|
92
|
+
if (target.auth &&
|
|
93
|
+
next.auth &&
|
|
94
|
+
target.auth.tokenId !== next.auth.tokenId) {
|
|
95
|
+
throw new SpawnfileError("validation_error", `Agent ${nodeName} declares incompatible Moltnet auth for ${next.network}/${next.memberId ?? "unknown"}`);
|
|
96
|
+
}
|
|
97
|
+
if (!target.auth && next.auth) {
|
|
98
|
+
target.auth = { ...next.auth };
|
|
99
|
+
}
|
|
57
100
|
if (target.dms &&
|
|
58
101
|
next.dms &&
|
|
59
|
-
|
|
102
|
+
!areEquivalentDmPolicy(target.dms, next.dms)) {
|
|
60
103
|
throw new SpawnfileError("validation_error", `Agent ${nodeName} declares incompatible Moltnet dms for ${next.network}/${next.memberId ?? "unknown"}`);
|
|
61
104
|
}
|
|
62
|
-
target.dms
|
|
105
|
+
if (!target.dms && next.dms) {
|
|
106
|
+
target.dms = cloneMoltnetDm(next.dms);
|
|
107
|
+
}
|
|
63
108
|
target.teamSource ??= next.teamSource;
|
|
64
109
|
target.rooms ??= {};
|
|
65
110
|
for (const [roomId, policy] of Object.entries(next.rooms ?? {})) {
|
|
@@ -68,7 +113,7 @@ const mergeAttachment = (target, next, nodeName) => {
|
|
|
68
113
|
const nextHasPolicy = hasRoomPolicy(policy);
|
|
69
114
|
if (existingHasPolicy &&
|
|
70
115
|
nextHasPolicy &&
|
|
71
|
-
|
|
116
|
+
!areEquivalentRoomPolicy(existingPolicy, policy)) {
|
|
72
117
|
throw new SpawnfileError("validation_error", `Agent ${nodeName} declares incompatible Moltnet room policy for ${next.network}/${next.memberId ?? "unknown"} room ${roomId}`);
|
|
73
118
|
}
|
|
74
119
|
target.rooms[roomId] = existingPolicy && existingHasPolicy && !nextHasPolicy
|
|
@@ -103,6 +148,7 @@ const mergeAgentAttachments = (agentNode, attachments) => {
|
|
|
103
148
|
continue;
|
|
104
149
|
}
|
|
105
150
|
merged.set(key, {
|
|
151
|
+
...(attachment.auth ? { auth: { ...attachment.auth } } : {}),
|
|
106
152
|
contextRooms: attachment.contextRooms
|
|
107
153
|
? Object.fromEntries(Object.entries(attachment.contextRooms).map(([teamSource, roomIds]) => [
|
|
108
154
|
teamSource,
|
|
@@ -111,7 +157,7 @@ const mergeAgentAttachments = (agentNode, attachments) => {
|
|
|
111
157
|
: attachment.teamSource
|
|
112
158
|
? { [attachment.teamSource]: Object.keys(attachment.rooms ?? {}).sort() }
|
|
113
159
|
: undefined,
|
|
114
|
-
...(attachment.dms ? { dms:
|
|
160
|
+
...(attachment.dms ? { dms: cloneMoltnetDm(attachment.dms) } : {}),
|
|
115
161
|
memberId: attachment.memberId,
|
|
116
162
|
network: attachment.network,
|
|
117
163
|
...(attachment.rooms
|
|
@@ -132,8 +178,12 @@ export const resolvePlanMoltnetAttachments = (plan) => {
|
|
|
132
178
|
const roomMemberships = getRoomMemberships(plan);
|
|
133
179
|
const synthesizedAttachments = synthesizeRepresentativeAttachments(roomMemberships);
|
|
134
180
|
const synthesizedByAgent = new Map();
|
|
135
|
-
for (const
|
|
136
|
-
const
|
|
181
|
+
for (const synthesized of synthesizedAttachments) {
|
|
182
|
+
const { agentSource, attachment, directTeamSource } = synthesized;
|
|
183
|
+
const representativeContext = (plan.memberships ?? []).find((context) => context.agentSource === agentSource &&
|
|
184
|
+
(plan.organizationIdentity
|
|
185
|
+
? context.teamSource === directTeamSource
|
|
186
|
+
: context.memberId === attachment.memberId));
|
|
137
187
|
if (!representativeContext) {
|
|
138
188
|
throw new SpawnfileError("validation_error", `Unable to find direct member context for synthesized Moltnet member ${attachment.memberId ?? "unknown"}`);
|
|
139
189
|
}
|
|
@@ -157,9 +207,11 @@ export const resolvePlanMoltnetAttachments = (plan) => {
|
|
|
157
207
|
continue;
|
|
158
208
|
}
|
|
159
209
|
const teamNode = findTeamBySource(plan, context.teamSource);
|
|
210
|
+
const canonicalMemberId = resolveCanonicalAgentMemberId(plan, context.agentSource) ?? context.memberId;
|
|
160
211
|
const resolved = resolveMoltnetAttachments(declaredAttachments, {
|
|
161
212
|
memberId: context.memberId,
|
|
162
213
|
networks: teamNode.networks ?? [],
|
|
214
|
+
resolvedMemberId: canonicalMemberId,
|
|
163
215
|
teamName: context.teamName,
|
|
164
216
|
teamSource: context.teamSource
|
|
165
217
|
}, agentNode.name);
|