spawnfile 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -11
- package/dist/audit/auditCli.d.ts +19 -0
- package/dist/audit/auditCli.js +63 -0
- package/dist/audit/checks.d.ts +100 -0
- package/dist/audit/checks.js +279 -0
- package/dist/audit/checksShared.d.ts +74 -0
- package/dist/audit/checksShared.js +37 -0
- package/dist/audit/generateAudit.d.ts +19 -0
- package/dist/audit/generateAudit.js +122 -0
- package/dist/audit/index.d.ts +4 -0
- package/dist/audit/index.js +4 -0
- package/dist/audit/readAudit.d.ts +50 -0
- package/dist/audit/readAudit.js +59 -0
- package/dist/audit/types.d.ts +40 -0
- package/dist/audit/types.js +8 -0
- package/dist/auth/credentialEnvFile.d.ts +11 -0
- package/dist/auth/credentialEnvFile.js +60 -0
- package/dist/auth/credentialProvisioning.d.ts +15 -0
- package/dist/auth/credentialProvisioning.js +75 -0
- package/dist/auth/credentialProvisioningReceipt.d.ts +28 -0
- package/dist/auth/credentialProvisioningReceipt.js +70 -0
- package/dist/auth/credentialProvisioningRequest.d.ts +51 -0
- package/dist/auth/credentialProvisioningRequest.js +169 -0
- package/dist/auth/credentialWorldBindings.d.ts +21 -0
- package/dist/auth/credentialWorldBindings.js +104 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/paths.d.ts +11 -0
- package/dist/auth/paths.js +21 -0
- package/dist/auth/targetSecretSourceAuthor.d.ts +18 -0
- package/dist/auth/targetSecretSourceAuthor.js +52 -0
- package/dist/auth/targetSecretSourceFsPublish.d.ts +15 -0
- package/dist/auth/targetSecretSourceFsPublish.js +49 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.d.ts +16 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.js +435 -0
- package/dist/auth/targetSecretSourceFsRead.d.ts +14 -0
- package/dist/auth/targetSecretSourceFsRead.js +198 -0
- package/dist/auth/targetSecretSourceGrant.d.ts +16 -0
- package/dist/auth/targetSecretSourceGrant.js +99 -0
- package/dist/auth/targetSecretSourceGrantRecords.d.ts +84 -0
- package/dist/auth/targetSecretSourceGrantRecords.js +214 -0
- package/dist/auth/targetSecretSourceLifecycle.d.ts +30 -0
- package/dist/auth/targetSecretSourceLifecycle.js +52 -0
- package/dist/auth/targetSecretSourceOwnerEntropy.d.ts +6 -0
- package/dist/auth/targetSecretSourceOwnerEntropy.js +28 -0
- package/dist/auth/targetSecretSourceRecordCommon.d.ts +14 -0
- package/dist/auth/targetSecretSourceRecordCommon.js +100 -0
- package/dist/auth/targetSecretSourceRecordPublish.d.ts +10 -0
- package/dist/auth/targetSecretSourceRecordPublish.js +104 -0
- package/dist/auth/targetSecretSourceResolver.d.ts +10 -0
- package/dist/auth/targetSecretSourceResolver.js +137 -0
- package/dist/auth/targetSecretSourceRevoke.d.ts +20 -0
- package/dist/auth/targetSecretSourceRevoke.js +92 -0
- package/dist/auth/targetSecretSourceRotate.d.ts +19 -0
- package/dist/auth/targetSecretSourceRotate.js +121 -0
- package/dist/auth/targetSecretSourceVersionRecords.d.ts +49 -0
- package/dist/auth/targetSecretSourceVersionRecords.js +166 -0
- package/dist/cli/artifactsCommands.d.ts +27 -0
- package/dist/cli/artifactsCommands.js +132 -0
- package/dist/cli/authCommands.d.ts +5 -0
- package/dist/cli/authCommands.js +221 -0
- package/dist/cli/compileBuildCommands.d.ts +3 -0
- package/dist/cli/compileBuildCommands.js +35 -0
- package/dist/cli/containerBundleCommand.d.ts +6 -0
- package/dist/cli/containerBundleCommand.js +116 -0
- package/dist/cli/downCommand.d.ts +25 -0
- package/dist/cli/downCommand.js +134 -0
- package/dist/cli/index.js +6 -3
- package/dist/cli/lifecycleCommands.d.ts +1 -1
- package/dist/cli/lifecycleCommands.js +11 -181
- package/dist/cli/lifecycleMachine.d.ts +19 -0
- package/dist/cli/lifecycleMachine.js +78 -0
- package/dist/cli/lifecyclePlan.d.ts +35 -0
- package/dist/cli/lifecyclePlan.js +240 -0
- package/dist/cli/lifecyclePlanningCommands.d.ts +3 -0
- package/dist/cli/lifecyclePlanningCommands.js +30 -0
- package/dist/cli/runCli.d.ts +9 -2
- package/dist/cli/runCli.js +27 -71
- package/dist/cli/runPublishCommands.d.ts +3 -0
- package/dist/cli/runPublishCommands.js +70 -0
- package/dist/cli/statusCommand.d.ts +3 -33
- package/dist/cli/statusCommand.js +19 -249
- package/dist/cli/statusCommandLive.d.ts +20 -0
- package/dist/cli/statusCommandLive.js +188 -0
- package/dist/cli/statusCommandOptions.d.ts +40 -0
- package/dist/cli/statusCommandOptions.js +42 -0
- package/dist/cli/targetCliRoute.d.ts +2 -0
- package/dist/cli/targetCliRoute.js +30 -0
- package/dist/cli/targetCommands.d.ts +33 -0
- package/dist/cli/targetCommands.js +257 -0
- package/dist/cli/targetComposedPreparationCommand.d.ts +6 -0
- package/dist/cli/targetComposedPreparationCommand.js +39 -0
- package/dist/cli/targetDefaultArtifactAuthority.d.ts +5 -0
- package/dist/cli/targetDefaultArtifactAuthority.js +28 -0
- package/dist/cli/targetDefaultAuthorities.d.ts +53 -0
- package/dist/cli/targetDefaultAuthorities.js +210 -0
- package/dist/cli/targetDefaultConfig.d.ts +68 -0
- package/dist/cli/targetDefaultConfig.js +317 -0
- package/dist/cli/targetDefaultConfigStdin.d.ts +13 -0
- package/dist/cli/targetDefaultConfigStdin.js +215 -0
- package/dist/cli/targetDefaultEnvelope.d.ts +1 -0
- package/dist/cli/targetDefaultEnvelope.js +13 -0
- package/dist/cli/targetDefaultHandlerFactory.d.ts +28 -0
- package/dist/cli/targetDefaultHandlerFactory.js +247 -0
- package/dist/cli/targetDefaultHandlers.d.ts +21 -0
- package/dist/cli/targetDefaultHandlers.js +72 -0
- package/dist/cli/targetDefaultJournalAuthority.d.ts +35 -0
- package/dist/cli/targetDefaultJournalAuthority.js +135 -0
- package/dist/cli/targetDefaultWorldClock.d.ts +4 -0
- package/dist/cli/targetDefaultWorldClock.js +14 -0
- package/dist/cli/targetDefaultWorldQueries.d.ts +5 -0
- package/dist/cli/targetDefaultWorldQueries.js +11 -0
- package/dist/cli/targetDefaultWorldReadiness.d.ts +4 -0
- package/dist/cli/targetDefaultWorldReadiness.js +17 -0
- package/dist/cli/targetEvidenceHelperResolution.d.ts +14 -0
- package/dist/cli/targetEvidenceHelperResolution.js +23 -0
- package/dist/cli/targetLookupCli.d.ts +3 -0
- package/dist/cli/targetLookupCli.js +31 -0
- package/dist/cli/targetLookupCommands.d.ts +12 -0
- package/dist/cli/targetLookupCommands.js +69 -0
- package/dist/cli/targetOperationDispatch.d.ts +58 -0
- package/dist/cli/targetOperationDispatch.js +21 -0
- package/dist/cli/targetReceiptOutput.d.ts +14 -0
- package/dist/cli/targetReceiptOutput.js +21 -0
- package/dist/cli/targetRequestFile.d.ts +14 -0
- package/dist/cli/targetRequestFile.js +63 -0
- package/dist/cli/targetSecretSourceInput.d.ts +28 -0
- package/dist/cli/targetSecretSourceInput.js +121 -0
- package/dist/cli/targetWorldClockCommand.d.ts +10 -0
- package/dist/cli/targetWorldClockCommand.js +42 -0
- package/dist/cli/targetWorldClockCrossProcess.test-helper.d.ts +13 -0
- package/dist/cli/targetWorldClockCrossProcess.test-helper.js +109 -0
- package/dist/cli/targetWorldReadinessCommand.d.ts +10 -0
- package/dist/cli/targetWorldReadinessCommand.js +43 -0
- package/dist/cli/upCommand.d.ts +3 -0
- package/dist/cli/upCommand.js +133 -0
- package/dist/cli/upImageCommand.d.ts +11 -0
- package/dist/cli/upImageCommand.js +41 -0
- package/dist/cli/upLifecycleInvocation.d.ts +41 -0
- package/dist/cli/upLifecycleInvocation.js +48 -0
- package/dist/cli/upLifecycleRecovery.d.ts +4 -0
- package/dist/cli/upLifecycleRecovery.js +53 -0
- package/dist/compiler/agentNodeMerge.d.ts +2 -0
- package/dist/compiler/agentNodeMerge.js +79 -0
- package/dist/compiler/agentSurfaces.js +11 -1
- package/dist/compiler/buildCompilePlan.js +17 -0
- package/dist/compiler/buildCompilePlanAgent.d.ts +11 -0
- package/dist/compiler/buildCompilePlanAgent.js +56 -0
- package/dist/compiler/buildCompilePlanTeams.d.ts +1 -0
- package/dist/compiler/buildCompilePlanTeams.js +4 -1
- package/dist/compiler/buildCompilePlanTraversal.js +75 -82
- package/dist/compiler/buildProject.d.ts +11 -0
- package/dist/compiler/buildProject.js +77 -2
- package/dist/compiler/compilePlanHelpers.js +2 -0
- package/dist/compiler/compileProject.d.ts +13 -0
- package/dist/compiler/compileProject.js +26 -74
- package/dist/compiler/compileProjectPolicy.d.ts +5 -0
- package/dist/compiler/compileProjectPolicy.js +21 -0
- package/dist/compiler/compileProjectReports.d.ts +9 -0
- package/dist/compiler/compileProjectReports.js +52 -0
- package/dist/compiler/containerArtifactSummaries.d.ts +7 -0
- package/dist/compiler/containerArtifactSummaries.js +138 -0
- package/dist/compiler/containerArtifacts.d.ts +10 -0
- package/dist/compiler/containerArtifacts.js +126 -125
- package/dist/compiler/containerArtifactsPlans.d.ts +5 -3
- package/dist/compiler/containerArtifactsPlans.js +31 -118
- package/dist/compiler/containerArtifactsRender.d.ts +3 -1
- package/dist/compiler/containerArtifactsRender.js +15 -12
- package/dist/compiler/containerArtifactsTypes.d.ts +12 -0
- package/dist/compiler/containerConfigEnvRender.d.ts +3 -0
- package/dist/compiler/containerConfigEnvRender.js +54 -0
- package/dist/compiler/containerEntrypointRender.d.ts +1 -0
- package/dist/compiler/containerEntrypointRender.js +56 -52
- package/dist/compiler/containerEntrypointShell.d.ts +5 -0
- package/dist/compiler/containerEntrypointShell.js +29 -0
- package/dist/compiler/containerPackageOverrides.d.ts +27 -0
- package/dist/compiler/containerPackageOverrides.js +63 -0
- package/dist/compiler/containerTargetPlanResolution.d.ts +20 -0
- package/dist/compiler/containerTargetPlanResolution.js +97 -0
- package/dist/compiler/daimonTelemetryArtifacts.d.ts +22 -0
- package/dist/compiler/daimonTelemetryArtifacts.js +61 -0
- package/dist/compiler/dockerBuildContext.d.ts +16 -0
- package/dist/compiler/dockerBuildContext.js +159 -0
- package/dist/compiler/dockerBuildSkip.d.ts +30 -0
- package/dist/compiler/dockerBuildSkip.js +81 -0
- package/dist/compiler/index.d.ts +4 -0
- package/dist/compiler/index.js +4 -0
- package/dist/compiler/memoryArtifacts.d.ts +26 -0
- package/dist/compiler/memoryArtifacts.js +134 -0
- package/dist/compiler/memoryResolution.d.ts +4 -0
- package/dist/compiler/memoryResolution.js +147 -0
- package/dist/compiler/modelEnv.d.ts +2 -0
- package/dist/compiler/modelEnv.js +6 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.d.ts +2 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.js +42 -0
- package/dist/compiler/moltnetArtifactPaths.d.ts +26 -0
- package/dist/compiler/moltnetArtifactPaths.js +49 -0
- package/dist/compiler/moltnetArtifactTypes.d.ts +46 -0
- package/dist/compiler/moltnetArtifactTypes.js +1 -0
- package/dist/compiler/moltnetArtifacts.d.ts +2 -40
- package/dist/compiler/moltnetArtifacts.js +43 -97
- package/dist/compiler/moltnetBinaries.d.ts +21 -4
- package/dist/compiler/moltnetBinaries.js +134 -27
- package/dist/compiler/moltnetClientConfig.js +7 -2
- package/dist/compiler/moltnetConfigLowering.d.ts +16 -1
- package/dist/compiler/moltnetConfigLowering.js +67 -5
- package/dist/compiler/moltnetExternalParticipantArtifact.d.ts +38 -0
- package/dist/compiler/moltnetExternalParticipantArtifact.js +188 -0
- package/dist/compiler/moltnetNodeConfig.js +7 -2
- package/dist/compiler/moltnetReleaseAuthority.d.ts +17 -0
- package/dist/compiler/moltnetReleaseAuthority.js +73 -0
- package/dist/compiler/moltnetReleaseDownload.d.ts +12 -0
- package/dist/compiler/moltnetReleaseDownload.js +85 -0
- package/dist/compiler/moltnetRepresentativeResolution.d.ts +1 -0
- package/dist/compiler/moltnetRepresentativeResolution.js +16 -2
- package/dist/compiler/moltnetResolution.js +72 -20
- package/dist/compiler/moltnetRoomMemberships.js +37 -9
- package/dist/compiler/moltnetServerPlans.d.ts +9 -0
- package/dist/compiler/moltnetServerPlans.js +132 -0
- package/dist/compiler/organizationIdentity.d.ts +27 -0
- package/dist/compiler/organizationIdentity.js +297 -0
- package/dist/compiler/organizationReadyEvidence.d.ts +49 -0
- package/dist/compiler/organizationReadyEvidence.js +261 -0
- package/dist/compiler/projectManifestGraph.d.ts +4 -0
- package/dist/compiler/projectManifestGraph.js +24 -0
- package/dist/compiler/runProject.d.ts +4 -0
- package/dist/compiler/runProject.js +30 -21
- package/dist/compiler/runProjectAuth.d.ts +7 -1
- package/dist/compiler/runProjectAuth.js +87 -9
- package/dist/compiler/runProjectDocker.d.ts +7 -0
- package/dist/compiler/runProjectDocker.js +31 -8
- package/dist/compiler/runProjectLifecycle.d.ts +7 -0
- package/dist/compiler/runProjectLifecycle.js +40 -0
- package/dist/compiler/syncProjectAuth.js +4 -1
- package/dist/compiler/teamContextActiveEnvironments.d.ts +13 -0
- package/dist/compiler/teamContextActiveEnvironments.js +255 -0
- package/dist/compiler/teamContextSupport.js +32 -40
- package/dist/compiler/teamContextTypes.d.ts +2 -0
- package/dist/compiler/types.d.ts +82 -1
- package/dist/compiler/upProject.d.ts +5 -0
- package/dist/compiler/upProject.js +256 -20
- package/dist/compiler/upReceipt.d.ts +36 -0
- package/dist/compiler/upReceipt.js +82 -0
- package/dist/compiler/updateProjectModels.js +42 -60
- package/dist/compiler/updateProjectRuntime.js +22 -35
- package/dist/compiler/updateProjectSurfaces.js +53 -47
- package/dist/compiler/worldBindings.d.ts +39 -0
- package/dist/compiler/worldBindings.js +247 -0
- package/dist/compiler/worldBindingsFile.d.ts +5 -0
- package/dist/compiler/worldBindingsFile.js +162 -0
- package/dist/deployment/artifactsExport.d.ts +49 -0
- package/dist/deployment/artifactsExport.js +217 -0
- package/dist/deployment/artifactsExportDocker.d.ts +48 -0
- package/dist/deployment/artifactsExportDocker.js +91 -0
- package/dist/deployment/artifactsExportPlan.d.ts +24 -0
- package/dist/deployment/artifactsExportPlan.js +135 -0
- package/dist/deployment/artifactsExportTypes.d.ts +50 -0
- package/dist/deployment/artifactsExportTypes.js +52 -0
- package/dist/deployment/buildImageCacheStore.d.ts +23 -0
- package/dist/deployment/buildImageCacheStore.js +54 -0
- package/dist/deployment/deploymentLifecycleCorrelation.d.ts +11 -0
- package/dist/deployment/deploymentLifecycleCorrelation.js +33 -0
- package/dist/deployment/dockerInspect.d.ts +9 -0
- package/dist/deployment/dockerInspect.js +24 -1
- package/dist/deployment/dockerLabels.d.ts +2 -0
- package/dist/deployment/dockerLabels.js +2 -0
- package/dist/deployment/dockerLogs.js +2 -10
- package/dist/deployment/dockerManager.d.ts +51 -0
- package/dist/deployment/dockerManager.js +118 -1
- package/dist/deployment/dockerProbeGateway.js +64 -5
- package/dist/deployment/dockerRecover.js +9 -1
- package/dist/deployment/dockerTeardown.d.ts +32 -0
- package/dist/deployment/dockerTeardown.js +61 -0
- package/dist/deployment/downDeployment.d.ts +34 -0
- package/dist/deployment/downDeployment.js +147 -0
- package/dist/deployment/downReceiptTypes.d.ts +21 -0
- package/dist/deployment/downReceiptTypes.js +30 -0
- package/dist/deployment/index.d.ts +16 -0
- package/dist/deployment/index.js +17 -0
- package/dist/deployment/lifecycleCompletion.d.ts +37 -0
- package/dist/deployment/lifecycleCompletion.js +236 -0
- package/dist/deployment/lifecycleCompletionContracts.d.ts +158 -0
- package/dist/deployment/lifecycleCompletionContracts.js +106 -0
- package/dist/deployment/lifecycleCompletionHeartbeat.d.ts +2 -0
- package/dist/deployment/lifecycleCompletionHeartbeat.js +50 -0
- package/dist/deployment/lifecycleCompletionLookup.d.ts +18 -0
- package/dist/deployment/lifecycleCompletionLookup.js +88 -0
- package/dist/deployment/lifecycleCompletionOwner.d.ts +8 -0
- package/dist/deployment/lifecycleCompletionOwner.js +31 -0
- package/dist/deployment/lifecycleCompletionParsing.d.ts +12 -0
- package/dist/deployment/lifecycleCompletionParsing.js +108 -0
- package/dist/deployment/lifecycleCompletionPaths.d.ts +9 -0
- package/dist/deployment/lifecycleCompletionPaths.js +16 -0
- package/dist/deployment/lifecycleCompletionPublication.d.ts +5 -0
- package/dist/deployment/lifecycleCompletionPublication.js +35 -0
- package/dist/deployment/lifecycleCompletionRecovery.d.ts +21 -0
- package/dist/deployment/lifecycleCompletionRecovery.js +56 -0
- package/dist/deployment/lifecycleCompletionRoot.d.ts +21 -0
- package/dist/deployment/lifecycleCompletionRoot.js +243 -0
- package/dist/deployment/lifecycleCompletionStore.d.ts +6 -0
- package/dist/deployment/lifecycleCompletionStore.js +151 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.d.ts +17 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.js +132 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.js +285 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.js +26 -0
- package/dist/deployment/organizationHandoffAuthorityStore.d.ts +41 -0
- package/dist/deployment/organizationHandoffAuthorityStore.js +348 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.d.ts +76 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.js +148 -0
- package/dist/deployment/organizationHandoffTypes.d.ts +29 -0
- package/dist/deployment/organizationHandoffTypes.js +80 -0
- package/dist/deployment/organizationReady.d.ts +52 -0
- package/dist/deployment/organizationReady.js +200 -0
- package/dist/deployment/privateArtifactsExport.d.ts +18 -0
- package/dist/deployment/privateArtifactsExport.js +80 -0
- package/dist/deployment/providerRuntimeBoundaryScanner.test-helper.d.ts +8 -0
- package/dist/deployment/providerRuntimeBoundaryScanner.test-helper.js +60 -0
- package/dist/deployment/record.d.ts +26 -1
- package/dist/deployment/record.js +49 -4
- package/dist/deployment/simfileFixtureBoundary.test-helper.d.ts +8 -0
- package/dist/deployment/simfileFixtureBoundary.test-helper.js +103 -0
- package/dist/deployment/target.d.ts +1 -35
- package/dist/deployment/target.js +1 -96
- package/dist/deployment/upReceiptTypes.d.ts +111 -0
- package/dist/deployment/upReceiptTypes.js +164 -0
- package/dist/dev/project.js +15 -9
- package/dist/distribution/buildDistributionReport.d.ts +2 -1
- package/dist/distribution/buildDistributionReport.js +2 -1
- package/dist/distribution/distributionReportSchema.d.ts +5 -0
- package/dist/distribution/distributionReportSchema.js +7 -2
- package/dist/distribution/index.d.ts +2 -2
- package/dist/distribution/index.js +1 -1
- package/dist/distribution/types.d.ts +7 -0
- package/dist/distribution/types.js +1 -0
- package/dist/filesystem/paths.js +10 -1
- package/dist/ledger/causalConformanceCli.d.ts +1 -0
- package/dist/ledger/causalConformanceCli.js +41 -0
- package/dist/ledger/causeNamespace.d.ts +8 -0
- package/dist/ledger/causeNamespace.js +24 -0
- package/dist/ledger/conformance.d.ts +83 -0
- package/dist/ledger/conformance.js +259 -0
- package/dist/ledger/emitters.d.ts +76 -0
- package/dist/ledger/emitters.js +188 -0
- package/dist/ledger/index.d.ts +4 -0
- package/dist/ledger/index.js +4 -0
- package/dist/ledger/principal.d.ts +96 -0
- package/dist/ledger/principal.js +121 -0
- package/dist/manifest/externalParticipantSchemas.d.ts +18 -0
- package/dist/manifest/externalParticipantSchemas.js +17 -0
- package/dist/manifest/index.d.ts +1 -0
- package/dist/manifest/index.js +1 -0
- package/dist/manifest/inlineAgentMember.d.ts +2 -0
- package/dist/manifest/inlineAgentMember.js +9 -0
- package/dist/manifest/loadManifest.js +14 -8
- package/dist/manifest/mcpSchemas.d.ts +17 -0
- package/dist/manifest/mcpSchemas.js +41 -0
- package/dist/manifest/memorySchemas.d.ts +245 -0
- package/dist/manifest/memorySchemas.js +148 -0
- package/dist/manifest/renderSpawnfile.js +22 -131
- package/dist/manifest/renderSpawnfileNetworks.js +9 -2
- package/dist/manifest/renderSpawnfileSurfaces.d.ts +2 -0
- package/dist/manifest/renderSpawnfileSurfaces.js +134 -0
- package/dist/manifest/schemas.d.ts +1868 -99
- package/dist/manifest/schemas.js +78 -32
- package/dist/manifest/surfaceSchemas.d.ts +17 -0
- package/dist/manifest/surfaceSchemas.js +24 -1
- package/dist/manifest/teamNetworkAccessSchemas.d.ts +1 -1
- package/dist/manifest/teamNetworkAuthSchemas.d.ts +48 -0
- package/dist/manifest/teamNetworkAuthSchemas.js +103 -0
- package/dist/manifest/teamNetworkSchemas.d.ts +8 -187
- package/dist/manifest/teamNetworkSchemas.js +3 -317
- package/dist/manifest/teamNetworkServerSchemas.d.ts +150 -0
- package/dist/manifest/teamNetworkServerSchemas.js +199 -0
- package/dist/ownership/siblingBuildFreshness.d.ts +20 -0
- package/dist/ownership/siblingBuildFreshness.js +20 -0
- package/dist/ownership/simfileRunOperatorInputs.d.ts +103 -0
- package/dist/ownership/simfileRunOperatorInputs.js +139 -0
- package/dist/report/types.d.ts +142 -0
- package/dist/runtime/common.d.ts +35 -0
- package/dist/runtime/common.js +55 -0
- package/dist/runtime/container.d.ts +28 -1
- package/dist/runtime/container.js +38 -5
- package/dist/runtime/containerPackageOverrides.d.ts +37 -0
- package/dist/runtime/containerPackageOverrides.js +33 -0
- package/dist/runtime/index.d.ts +2 -0
- package/dist/runtime/index.js +2 -0
- package/dist/runtime/mnemeMcp.d.ts +15 -0
- package/dist/runtime/mnemeMcp.js +109 -0
- package/dist/runtime/openclaw/adapter.js +15 -4
- package/dist/runtime/openclaw/mcp.d.ts +10 -0
- package/dist/runtime/openclaw/mcp.js +69 -0
- package/dist/runtime/openclaw/runAuth.js +2 -2
- package/dist/runtime/openclaw/scaffold.js +1 -1
- package/dist/runtime/openclaw/schedules.d.ts +38 -0
- package/dist/runtime/openclaw/schedules.js +74 -0
- package/dist/runtime/pi/adapter.d.ts +1 -1
- package/dist/runtime/pi/adapter.js +86 -53
- package/dist/runtime/pi/appActivitySource.js +114 -2
- package/dist/runtime/pi/appAgentConfig.d.ts +11 -0
- package/dist/runtime/pi/appAgentConfig.js +264 -0
- package/dist/runtime/pi/appCliEnginesSource.d.ts +1 -0
- package/dist/runtime/pi/appCliEnginesSource.js +183 -0
- package/dist/runtime/pi/appCliSource.d.ts +1 -0
- package/dist/runtime/pi/appCliSource.js +353 -0
- package/dist/runtime/pi/appControlSource.d.ts +1 -0
- package/dist/runtime/pi/appControlSource.js +390 -0
- package/dist/runtime/pi/appControlWakeIdentitySource.d.ts +1 -0
- package/dist/runtime/pi/appControlWakeIdentitySource.js +19 -0
- package/dist/runtime/pi/appCoreSource.d.ts +4 -1
- package/dist/runtime/pi/appCoreSource.js +104 -214
- package/dist/runtime/pi/appPreludeSource.js +140 -52
- package/dist/runtime/pi/appScheduleSource.d.ts +1 -0
- package/dist/runtime/pi/appScheduleSource.js +80 -0
- package/dist/runtime/pi/appScriptedEngine.d.ts +31 -0
- package/dist/runtime/pi/appScriptedEngine.js +42 -0
- package/dist/runtime/pi/appSource.d.ts +4 -1
- package/dist/runtime/pi/appSource.js +6 -2
- package/dist/runtime/pi/appTemplate.d.ts +8 -22
- package/dist/runtime/pi/appTemplate.js +9 -126
- package/dist/runtime/pi/appTemplateTypes.d.ts +64 -0
- package/dist/runtime/pi/appTemplateTypes.js +18 -0
- package/dist/runtime/pi/appWakeContextSource.d.ts +1 -0
- package/dist/runtime/pi/appWakeContextSource.js +398 -0
- package/dist/runtime/pi/containerTargets.d.ts +4 -0
- package/dist/runtime/pi/containerTargets.js +57 -0
- package/dist/runtime/pi/runAuth.js +126 -9
- package/dist/runtime/pi/testHelpers.d.ts +2 -0
- package/dist/runtime/pi/testHelpers.js +40 -0
- package/dist/runtime/picoclaw/adapter.js +23 -27
- package/dist/runtime/picoclaw/mcp.d.ts +4 -0
- package/dist/runtime/picoclaw/mcp.js +43 -0
- package/dist/runtime/picoclaw/memory.d.ts +7 -0
- package/dist/runtime/picoclaw/memory.js +17 -0
- package/dist/runtime/picoclaw/runAuth.js +1 -1
- package/dist/runtime/picoclaw/scaffold.js +1 -1
- package/dist/runtime/picoclaw/schedules.d.ts +26 -0
- package/dist/runtime/picoclaw/schedules.js +62 -3
- package/dist/runtime/scheduleUtils.d.ts +2 -0
- package/dist/runtime/scheduleUtils.js +15 -0
- package/dist/runtime/types.d.ts +25 -2
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +2 -2
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/redaction.d.ts +2 -0
- package/dist/shared/redaction.js +10 -0
- package/dist/status/buildStatus.d.ts +1 -0
- package/dist/status/buildStatus.js +2 -0
- package/dist/status/compileReport.d.ts +22 -0
- package/dist/status/compileReport.js +16 -2
- package/dist/status/compiledProbeCollection.d.ts +21 -0
- package/dist/status/compiledProbeCollection.js +27 -0
- package/dist/status/imageStatusReport.js +6 -0
- package/dist/status/index.d.ts +3 -0
- package/dist/status/index.js +3 -0
- package/dist/status/lifecycleProbes.d.ts +19 -0
- package/dist/status/lifecycleProbes.js +174 -0
- package/dist/status/moltnetProbes.d.ts +7 -8
- package/dist/status/moltnetProbes.js +27 -198
- package/dist/status/moltnetWiringProbes.d.ts +19 -0
- package/dist/status/moltnetWiringProbes.js +178 -0
- package/dist/target/cleanupRun.d.ts +41 -0
- package/dist/target/cleanupRun.js +139 -0
- package/dist/target/cleanupRunDocker.d.ts +16 -0
- package/dist/target/cleanupRunDocker.js +66 -0
- package/dist/target/cleanupRunDocker.test-helper.d.ts +67 -0
- package/dist/target/cleanupRunDocker.test-helper.js +238 -0
- package/dist/target/cleanupRunDockerPreflight.d.ts +17 -0
- package/dist/target/cleanupRunDockerPreflight.js +224 -0
- package/dist/target/composedPreparation.d.ts +205 -0
- package/dist/target/composedPreparation.js +223 -0
- package/dist/target/containerBundle.d.ts +82 -0
- package/dist/target/containerBundle.js +243 -0
- package/dist/target/containerBundleArchive.d.ts +31 -0
- package/dist/target/containerBundleArchive.js +140 -0
- package/dist/target/containerBundleAuthority.d.ts +25 -0
- package/dist/target/containerBundleAuthority.js +65 -0
- package/dist/target/containerBundleContracts.d.ts +114 -0
- package/dist/target/containerBundleContracts.js +173 -0
- package/dist/target/containerBundleFilesystemStore.d.ts +3 -0
- package/dist/target/containerBundleFilesystemStore.js +247 -0
- package/dist/target/containerBundlePolicy.d.ts +33 -0
- package/dist/target/containerBundlePolicy.js +64 -0
- package/dist/target/containerBundleStore.d.ts +127 -0
- package/dist/target/containerBundleStore.js +284 -0
- package/dist/target/contracts.d.ts +538 -0
- package/dist/target/contracts.js +373 -0
- package/dist/target/dockerArtifactIdentityTypes.d.ts +56 -0
- package/dist/target/dockerArtifactIdentityTypes.js +1 -0
- package/dist/target/dockerArtifactInspection.d.ts +40 -0
- package/dist/target/dockerArtifactInspection.js +125 -0
- package/dist/target/dockerArtifacts.d.ts +21 -0
- package/dist/target/dockerArtifacts.js +110 -0
- package/dist/target/dockerArtifactsProvider.d.ts +41 -0
- package/dist/target/dockerArtifactsProvider.js +449 -0
- package/dist/target/dockerCommandExecutor.d.ts +27 -0
- package/dist/target/dockerCommandExecutor.js +200 -0
- package/dist/target/dockerCommandExecutorCore.d.ts +34 -0
- package/dist/target/dockerCommandExecutorCore.js +273 -0
- package/dist/target/dockerContainerBundleBuilder.d.ts +8 -0
- package/dist/target/dockerContainerBundleBuilder.js +256 -0
- package/dist/target/dockerContextSnapshot.d.ts +21 -0
- package/dist/target/dockerContextSnapshot.js +158 -0
- package/dist/target/dockerEndpointFingerprint.d.ts +1 -0
- package/dist/target/dockerEndpointFingerprint.js +9 -0
- package/dist/target/dockerPreparedArtifact.d.ts +48 -0
- package/dist/target/dockerPreparedArtifact.js +131 -0
- package/dist/target/dockerProjectionJson.d.ts +1 -0
- package/dist/target/dockerProjectionJson.js +80 -0
- package/dist/target/dockerPublicArtifactSnapshot.d.ts +17 -0
- package/dist/target/dockerPublicArtifactSnapshot.js +99 -0
- package/dist/target/dockerResources.d.ts +26 -0
- package/dist/target/dockerResources.js +162 -0
- package/dist/target/dockerResourcesProvider.d.ts +44 -0
- package/dist/target/dockerResourcesProvider.js +207 -0
- package/dist/target/dockerSecrets.d.ts +39 -0
- package/dist/target/dockerSecrets.js +249 -0
- package/dist/target/dockerSecretsAuthority.d.ts +26 -0
- package/dist/target/dockerSecretsAuthority.js +216 -0
- package/dist/target/dockerSecretsLifecycle.d.ts +25 -0
- package/dist/target/dockerSecretsLifecycle.js +133 -0
- package/dist/target/dockerSecretsProvider.d.ts +68 -0
- package/dist/target/dockerSecretsProvider.js +329 -0
- package/dist/target/dockerTarget.d.ts +52 -0
- package/dist/target/dockerTarget.js +48 -0
- package/dist/target/dockerTargetBinding.d.ts +14 -0
- package/dist/target/dockerTargetBinding.js +96 -0
- package/dist/target/dockerWorldClock.d.ts +17 -0
- package/dist/target/dockerWorldClock.js +111 -0
- package/dist/target/dockerWorldReadiness.d.ts +17 -0
- package/dist/target/dockerWorldReadiness.js +119 -0
- package/dist/target/dockerWorldService.d.ts +23 -0
- package/dist/target/dockerWorldService.js +216 -0
- package/dist/target/dockerWorldServiceAuthority.d.ts +80 -0
- package/dist/target/dockerWorldServiceAuthority.js +182 -0
- package/dist/target/dockerWorldServiceLifecycle.d.ts +41 -0
- package/dist/target/dockerWorldServiceLifecycle.js +275 -0
- package/dist/target/dockerWorldServiceProvider.d.ts +60 -0
- package/dist/target/dockerWorldServiceProvider.js +318 -0
- package/dist/target/dockerWorldServiceStore.d.ts +73 -0
- package/dist/target/dockerWorldServiceStore.js +367 -0
- package/dist/target/evidenceExport.d.ts +55 -0
- package/dist/target/evidenceExport.js +518 -0
- package/dist/target/evidenceExportArchive.d.ts +10 -0
- package/dist/target/evidenceExportArchive.js +302 -0
- package/dist/target/evidenceExportContract.d.ts +27 -0
- package/dist/target/evidenceExportContract.js +40 -0
- package/dist/target/evidenceExportOperationsTestKit.d.ts +87 -0
- package/dist/target/evidenceExportOperationsTestKit.js +312 -0
- package/dist/target/evidenceExportProvider.d.ts +85 -0
- package/dist/target/evidenceExportProvider.js +187 -0
- package/dist/target/evidenceExportPublicationTypes.d.ts +16 -0
- package/dist/target/evidenceExportPublicationTypes.js +1 -0
- package/dist/target/evidenceExportStore.d.ts +70 -0
- package/dist/target/evidenceExportStore.js +498 -0
- package/dist/target/evidenceExportStorePublication.d.ts +7 -0
- package/dist/target/evidenceExportStorePublication.js +395 -0
- package/dist/target/handles.d.ts +20 -0
- package/dist/target/handles.js +56 -0
- package/dist/target/index.d.ts +12 -0
- package/dist/target/index.js +11 -0
- package/dist/target/journal.d.ts +59 -0
- package/dist/target/journal.js +529 -0
- package/dist/target/journalFilesystem.d.ts +3 -0
- package/dist/target/journalFilesystem.js +111 -0
- package/dist/target/journalRoot.d.ts +4 -0
- package/dist/target/journalRoot.js +6 -0
- package/dist/target/organizationAttachment.d.ts +23 -0
- package/dist/target/organizationAttachment.js +263 -0
- package/dist/target/organizationAttachmentAuthority.d.ts +65 -0
- package/dist/target/organizationAttachmentAuthority.js +161 -0
- package/dist/target/organizationAttachmentLifecycle.d.ts +17 -0
- package/dist/target/organizationAttachmentLifecycle.js +101 -0
- package/dist/target/organizationAttachmentProvider.d.ts +76 -0
- package/dist/target/organizationAttachmentProvider.js +289 -0
- package/dist/target/organizationAttachmentStore.d.ts +51 -0
- package/dist/target/organizationAttachmentStore.js +316 -0
- package/dist/target/publicArtifactSnapshot.d.ts +41 -0
- package/dist/target/publicArtifactSnapshot.js +150 -0
- package/dist/target/topologyActivation.d.ts +51 -0
- package/dist/target/topologyActivation.js +149 -0
- package/dist/target/topologyAttestation.d.ts +37 -0
- package/dist/target/topologyAttestation.js +300 -0
- package/dist/target/topologyAttestationErrors.d.ts +1 -0
- package/dist/target/topologyAttestationErrors.js +1 -0
- package/dist/target/worldClock.d.ts +60 -0
- package/dist/target/worldClock.js +129 -0
- package/dist/target/worldReadiness.d.ts +103 -0
- package/dist/target/worldReadiness.js +153 -0
- package/moltnet-releases.json +20 -0
- package/package.json +27 -11
- package/runtimes.yaml +8 -23
- package/dist/runtime/openclaw/scaffold-assets/CLAUDE.md +0 -5
- package/dist/runtime/picoclaw/scaffold-assets/CLAUDE.md +0 -5
- /package/dist/runtime/openclaw/scaffold-assets/{AGENTS.md → WORKSPACE_AGENTS.md} +0 -0
- /package/dist/runtime/picoclaw/scaffold-assets/{AGENTS.md → WORKSPACE_AGENTS.md} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type SelectedTargetReceipt } from "../target/contracts.js";
|
|
2
|
+
export declare const CREDENTIAL_PROVISIONING_REQUEST_VERSION: "spawnfile.auth.credential-provisioning.request.v1";
|
|
3
|
+
export declare const MAX_CREDENTIAL_PROVISIONING_REQUEST_BYTES = 65536;
|
|
4
|
+
export type GeneratedTokenCredentialRequest = Readonly<{
|
|
5
|
+
bytes: number;
|
|
6
|
+
env: string;
|
|
7
|
+
kind: "generated-token";
|
|
8
|
+
name: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* `derived-config.content` is DECLARATIVE, non-secret configuration that the caller
|
|
12
|
+
* authored into the request by design — it is stored as a target secret for uniform
|
|
13
|
+
* handling, but it is not minted material and its presence in the caller's own request
|
|
14
|
+
* file is not a leak.
|
|
15
|
+
*/
|
|
16
|
+
export type DerivedConfigCredentialRequest = Readonly<{
|
|
17
|
+
content: unknown;
|
|
18
|
+
env: string;
|
|
19
|
+
kind: "derived-config";
|
|
20
|
+
name: string;
|
|
21
|
+
}>;
|
|
22
|
+
export type CredentialProvisioningCredentialRequest = GeneratedTokenCredentialRequest | DerivedConfigCredentialRequest;
|
|
23
|
+
export type CredentialProvisioningWorldMember = Readonly<{
|
|
24
|
+
id: string;
|
|
25
|
+
principal_id: string;
|
|
26
|
+
token_credential_name: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type CredentialProvisioningWorldBindings = Readonly<{
|
|
29
|
+
json_url: string;
|
|
30
|
+
mcp_url: string;
|
|
31
|
+
members: readonly CredentialProvisioningWorldMember[];
|
|
32
|
+
world_instance_id: string;
|
|
33
|
+
}>;
|
|
34
|
+
export type CredentialProvisioningModelEngineAuth = Readonly<{
|
|
35
|
+
from?: string;
|
|
36
|
+
kind: "codex";
|
|
37
|
+
profile: string;
|
|
38
|
+
}>;
|
|
39
|
+
export type CredentialProvisioningRequest = Readonly<{
|
|
40
|
+
credentials: readonly CredentialProvisioningCredentialRequest[];
|
|
41
|
+
descriptor_digest: string;
|
|
42
|
+
model_engine_auth?: CredentialProvisioningModelEngineAuth;
|
|
43
|
+
run_id: string;
|
|
44
|
+
scope: string;
|
|
45
|
+
selected_target: SelectedTargetReceipt;
|
|
46
|
+
version: typeof CREDENTIAL_PROVISIONING_REQUEST_VERSION;
|
|
47
|
+
world_bindings?: CredentialProvisioningWorldBindings;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const parseCredentialProvisioningRequest: (raw: unknown) => CredentialProvisioningRequest;
|
|
50
|
+
export declare const parseCredentialProvisioningRequestBytes: (raw: Uint8Array) => CredentialProvisioningRequest;
|
|
51
|
+
export declare const readCredentialProvisioningRequestFile: (filePath: string) => Promise<CredentialProvisioningRequest>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { open } from "node:fs/promises";
|
|
3
|
+
import { parseRunId, parseSelectedTargetReceipt } from "../target/contracts.js";
|
|
4
|
+
import { TARGET_SECRET_SOURCE_ERROR, assertOrdinaryJsonGraph } from "./targetSecretSourceRecordCommon.js";
|
|
5
|
+
export const CREDENTIAL_PROVISIONING_REQUEST_VERSION = "spawnfile.auth.credential-provisioning.request.v1";
|
|
6
|
+
export const MAX_CREDENTIAL_PROVISIONING_REQUEST_BYTES = 65_536;
|
|
7
|
+
const DIGEST = /^sha256:[a-f0-9]{64}$/u;
|
|
8
|
+
const ENV = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/u;
|
|
9
|
+
const FORBIDDEN_KEYS = new Set(["bearer", "material", "password", "secret", "token", "value"]);
|
|
10
|
+
const fail = () => { throw new Error(TARGET_SECRET_SOURCE_ERROR); };
|
|
11
|
+
const normalize = (work) => {
|
|
12
|
+
try {
|
|
13
|
+
return work();
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return fail();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const exact = (raw, required, optional = []) => {
|
|
20
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw))
|
|
21
|
+
return fail();
|
|
22
|
+
const record = raw;
|
|
23
|
+
const keys = Object.keys(record);
|
|
24
|
+
const allowed = new Set([...required, ...optional]);
|
|
25
|
+
if (keys.some((key) => !allowed.has(key)) || required.some((key) => !Object.hasOwn(record, key)))
|
|
26
|
+
fail();
|
|
27
|
+
return record;
|
|
28
|
+
};
|
|
29
|
+
const string = (raw) => typeof raw === "string" && raw.length > 0 ? raw : fail();
|
|
30
|
+
const nonEmptyArray = (raw) => Array.isArray(raw) && raw.length > 0 ? raw : fail();
|
|
31
|
+
const generatedByteCount = (raw) => typeof raw === "number"
|
|
32
|
+
&& Number.isInteger(raw)
|
|
33
|
+
&& raw >= 16
|
|
34
|
+
&& raw <= 128
|
|
35
|
+
? raw
|
|
36
|
+
: fail();
|
|
37
|
+
const descriptorDigest = (raw) => typeof raw === "string" && DIGEST.test(raw) ? raw : fail();
|
|
38
|
+
const rejectForbiddenKeys = (raw) => {
|
|
39
|
+
const pending = [raw];
|
|
40
|
+
while (pending.length > 0) {
|
|
41
|
+
const value = pending.pop();
|
|
42
|
+
if (value === null || typeof value !== "object")
|
|
43
|
+
continue;
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
pending.push(...value);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
49
|
+
if (FORBIDDEN_KEYS.has(key.toLowerCase()))
|
|
50
|
+
fail();
|
|
51
|
+
pending.push(nested);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const parseCredential = (raw) => {
|
|
56
|
+
const base = exact(raw, ["env", "kind", "name"], ["bytes", "content"]);
|
|
57
|
+
const name = string(base.name);
|
|
58
|
+
const env = string(base.env);
|
|
59
|
+
if (!ENV.test(env))
|
|
60
|
+
fail();
|
|
61
|
+
if (base.kind === "generated-token") {
|
|
62
|
+
const record = exact(raw, ["bytes", "env", "kind", "name"]);
|
|
63
|
+
const bytes = generatedByteCount(record.bytes);
|
|
64
|
+
return Object.freeze({ bytes, env, kind: "generated-token", name });
|
|
65
|
+
}
|
|
66
|
+
if (base.kind === "derived-config") {
|
|
67
|
+
const record = exact(raw, ["content", "env", "kind", "name"]);
|
|
68
|
+
assertOrdinaryJsonGraph(record.content);
|
|
69
|
+
return Object.freeze({ content: structuredClone(record.content), env, kind: "derived-config", name });
|
|
70
|
+
}
|
|
71
|
+
return fail();
|
|
72
|
+
};
|
|
73
|
+
const parseWorldBindings = (raw) => {
|
|
74
|
+
const record = exact(raw, ["json_url", "mcp_url", "members", "world_instance_id"]);
|
|
75
|
+
const rawMembers = nonEmptyArray(record.members);
|
|
76
|
+
const members = rawMembers.map((entry) => {
|
|
77
|
+
const member = exact(entry, ["id", "principal_id", "token_credential_name"]);
|
|
78
|
+
return Object.freeze({
|
|
79
|
+
id: string(member.id),
|
|
80
|
+
principal_id: string(member.principal_id),
|
|
81
|
+
token_credential_name: string(member.token_credential_name)
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
return Object.freeze({
|
|
85
|
+
json_url: string(record.json_url),
|
|
86
|
+
mcp_url: string(record.mcp_url),
|
|
87
|
+
members: Object.freeze(members),
|
|
88
|
+
world_instance_id: string(record.world_instance_id)
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
const parseModelEngineAuth = (raw) => {
|
|
92
|
+
const record = exact(raw, ["kind", "profile"], ["from"]);
|
|
93
|
+
if (record.kind !== "codex")
|
|
94
|
+
fail();
|
|
95
|
+
const from = record.from === undefined ? undefined : string(record.from);
|
|
96
|
+
return Object.freeze({
|
|
97
|
+
...(from === undefined ? {} : { from }),
|
|
98
|
+
kind: "codex",
|
|
99
|
+
profile: string(record.profile)
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export const parseCredentialProvisioningRequest = (raw) => normalize(() => {
|
|
103
|
+
assertOrdinaryJsonGraph(raw);
|
|
104
|
+
rejectForbiddenKeys(raw);
|
|
105
|
+
const record = exact(raw, ["credentials", "descriptor_digest", "run_id", "scope", "selected_target", "version"], ["model_engine_auth", "world_bindings"]);
|
|
106
|
+
if (record.version !== CREDENTIAL_PROVISIONING_REQUEST_VERSION)
|
|
107
|
+
fail();
|
|
108
|
+
const parsedDescriptorDigest = descriptorDigest(record.descriptor_digest);
|
|
109
|
+
const rawCredentials = nonEmptyArray(record.credentials);
|
|
110
|
+
const credentials = rawCredentials.map(parseCredential);
|
|
111
|
+
if (new Set(credentials.map(({ name }) => name)).size !== credentials.length
|
|
112
|
+
|| new Set(credentials.map(({ env }) => env)).size !== credentials.length)
|
|
113
|
+
fail();
|
|
114
|
+
const worldBindings = record.world_bindings === undefined
|
|
115
|
+
? undefined
|
|
116
|
+
: parseWorldBindings(record.world_bindings);
|
|
117
|
+
if (worldBindings) {
|
|
118
|
+
const names = new Set(credentials.map(({ name }) => name));
|
|
119
|
+
if (worldBindings.members.some(({ token_credential_name: name }) => !names.has(name)))
|
|
120
|
+
fail();
|
|
121
|
+
}
|
|
122
|
+
const modelEngineAuth = record.model_engine_auth === undefined
|
|
123
|
+
? undefined
|
|
124
|
+
: parseModelEngineAuth(record.model_engine_auth);
|
|
125
|
+
return Object.freeze({
|
|
126
|
+
credentials: Object.freeze(credentials),
|
|
127
|
+
descriptor_digest: parsedDescriptorDigest,
|
|
128
|
+
...(modelEngineAuth === undefined ? {} : { model_engine_auth: modelEngineAuth }),
|
|
129
|
+
run_id: parseRunId(record.run_id),
|
|
130
|
+
scope: string(record.scope),
|
|
131
|
+
selected_target: parseSelectedTargetReceipt(record.selected_target),
|
|
132
|
+
version: CREDENTIAL_PROVISIONING_REQUEST_VERSION,
|
|
133
|
+
...(worldBindings === undefined ? {} : { world_bindings: worldBindings })
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
export const parseCredentialProvisioningRequestBytes = (raw) => normalize(() => {
|
|
137
|
+
if (!(raw instanceof Uint8Array) || raw.length < 1 || raw.length > MAX_CREDENTIAL_PROVISIONING_REQUEST_BYTES)
|
|
138
|
+
fail();
|
|
139
|
+
const text = new TextDecoder("utf-8", { fatal: true }).decode(raw);
|
|
140
|
+
return parseCredentialProvisioningRequest(JSON.parse(text));
|
|
141
|
+
});
|
|
142
|
+
export const readCredentialProvisioningRequestFile = async (filePath) => {
|
|
143
|
+
let bytes;
|
|
144
|
+
let handle;
|
|
145
|
+
try {
|
|
146
|
+
handle = await open(filePath, "r");
|
|
147
|
+
const info = await handle.stat();
|
|
148
|
+
if (!info.isFile() || info.size < 1 || info.size > MAX_CREDENTIAL_PROVISIONING_REQUEST_BYTES)
|
|
149
|
+
fail();
|
|
150
|
+
bytes = Buffer.alloc(info.size + 1);
|
|
151
|
+
let offset = 0;
|
|
152
|
+
while (offset < bytes.length) {
|
|
153
|
+
const result = await handle.read(bytes, offset, bytes.length - offset, offset);
|
|
154
|
+
if (result.bytesRead === 0)
|
|
155
|
+
break;
|
|
156
|
+
offset += result.bytesRead;
|
|
157
|
+
}
|
|
158
|
+
if (offset !== info.size)
|
|
159
|
+
fail();
|
|
160
|
+
return parseCredentialProvisioningRequestBytes(bytes.subarray(0, offset));
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return fail();
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
bytes?.fill(0);
|
|
167
|
+
await handle?.close().catch(() => undefined);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SimfileWorldBindingsV1 } from "../compiler/worldBindings.js";
|
|
2
|
+
import type { CredentialProvisioningReceipt } from "./credentialProvisioningReceipt.js";
|
|
3
|
+
import type { CredentialProvisioningRequest } from "./credentialProvisioningRequest.js";
|
|
4
|
+
export declare const RESOLVED_WORLD_GRANTS_VERSION: "spawnfile.auth.resolved-world-grants.v1";
|
|
5
|
+
export type ResolvedWorldGrant = Readonly<{
|
|
6
|
+
capability_manifest: unknown;
|
|
7
|
+
member_id: string;
|
|
8
|
+
principal_id: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type ResolvedWorldGrants = Readonly<{
|
|
11
|
+
grants: readonly ResolvedWorldGrant[];
|
|
12
|
+
run_id: string;
|
|
13
|
+
version: typeof RESOLVED_WORLD_GRANTS_VERSION;
|
|
14
|
+
world_instance_id: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const parseResolvedWorldGrants: (raw: unknown) => ResolvedWorldGrants;
|
|
17
|
+
export declare const buildProvisionedWorldBindings: (input: Readonly<{
|
|
18
|
+
receipt: CredentialProvisioningReceipt;
|
|
19
|
+
request: CredentialProvisioningRequest;
|
|
20
|
+
resolved: unknown;
|
|
21
|
+
}>) => SimfileWorldBindingsV1;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { SIMFILE_WORLD_BINDINGS_VERSION, parseSimfileWorldBindings } from "../compiler/worldBindings.js";
|
|
3
|
+
import { TARGET_SECRET_SOURCE_ERROR, assertOrdinaryJsonGraph, createCanonicalTargetSecretSourceJson } from "./targetSecretSourceRecordCommon.js";
|
|
4
|
+
export const RESOLVED_WORLD_GRANTS_VERSION = "spawnfile.auth.resolved-world-grants.v1";
|
|
5
|
+
const fail = () => { throw new Error(TARGET_SECRET_SOURCE_ERROR); };
|
|
6
|
+
const exact = (raw, keys) => {
|
|
7
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw))
|
|
8
|
+
return fail();
|
|
9
|
+
const record = raw;
|
|
10
|
+
const actual = Object.keys(record).sort();
|
|
11
|
+
const expected = [...keys].sort();
|
|
12
|
+
if (actual.length !== expected.length || actual.some((key, index) => key !== expected[index]))
|
|
13
|
+
fail();
|
|
14
|
+
return record;
|
|
15
|
+
};
|
|
16
|
+
const string = (raw) => typeof raw === "string" && raw.length > 0 ? raw : fail();
|
|
17
|
+
const nonEmptyArray = (raw) => Array.isArray(raw) && raw.length > 0 ? raw : fail();
|
|
18
|
+
export const parseResolvedWorldGrants = (raw) => {
|
|
19
|
+
try {
|
|
20
|
+
assertOrdinaryJsonGraph(raw);
|
|
21
|
+
const record = exact(raw, ["grants", "run_id", "version", "world_instance_id"]);
|
|
22
|
+
if (record.version !== RESOLVED_WORLD_GRANTS_VERSION)
|
|
23
|
+
fail();
|
|
24
|
+
const rawGrants = nonEmptyArray(record.grants);
|
|
25
|
+
const grants = rawGrants.map((rawGrant) => {
|
|
26
|
+
const grant = exact(rawGrant, ["capability_manifest", "member_id", "principal_id"]);
|
|
27
|
+
assertOrdinaryJsonGraph(grant.capability_manifest);
|
|
28
|
+
return Object.freeze({
|
|
29
|
+
capability_manifest: structuredClone(grant.capability_manifest),
|
|
30
|
+
member_id: string(grant.member_id),
|
|
31
|
+
principal_id: string(grant.principal_id)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
grants: Object.freeze(grants),
|
|
36
|
+
run_id: string(record.run_id),
|
|
37
|
+
version: RESOLVED_WORLD_GRANTS_VERSION,
|
|
38
|
+
world_instance_id: string(record.world_instance_id)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return fail();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const buildProvisionedWorldBindings = (input) => {
|
|
46
|
+
try {
|
|
47
|
+
const world = input.request.world_bindings ?? fail();
|
|
48
|
+
if (input.receipt.run_id !== input.request.run_id
|
|
49
|
+
|| input.receipt.scope !== input.request.scope)
|
|
50
|
+
fail();
|
|
51
|
+
const resolved = parseResolvedWorldGrants(input.resolved);
|
|
52
|
+
if (resolved.run_id !== input.request.run_id
|
|
53
|
+
|| resolved.world_instance_id !== world.world_instance_id
|
|
54
|
+
|| resolved.grants.length !== world.members.length)
|
|
55
|
+
fail();
|
|
56
|
+
const declared = new Map(world.members.map((member) => [member.id, member]));
|
|
57
|
+
if (declared.size !== world.members.length)
|
|
58
|
+
fail();
|
|
59
|
+
const receiptByName = new Map(input.receipt.credentials.map((credential) => [credential.name, credential]));
|
|
60
|
+
const digests = new Set();
|
|
61
|
+
const bindings = resolved.grants.map((grant) => {
|
|
62
|
+
const member = declared.get(grant.member_id) ?? fail();
|
|
63
|
+
if (member.principal_id !== grant.principal_id)
|
|
64
|
+
fail();
|
|
65
|
+
const credential = receiptByName.get(member.token_credential_name) ?? fail();
|
|
66
|
+
const requestedCredential = input.request.credentials.find(({ name }) => name === member.token_credential_name) ?? fail();
|
|
67
|
+
if (credential.env !== requestedCredential.env)
|
|
68
|
+
fail();
|
|
69
|
+
let canonical;
|
|
70
|
+
try {
|
|
71
|
+
canonical = createCanonicalTargetSecretSourceJson(grant.capability_manifest);
|
|
72
|
+
const capabilityDigest = `sha256:${createHash("sha256").update(canonical).digest("hex")}`;
|
|
73
|
+
if (digests.has(capabilityDigest))
|
|
74
|
+
fail();
|
|
75
|
+
digests.add(capabilityDigest);
|
|
76
|
+
return {
|
|
77
|
+
capability_manifest_digest: capabilityDigest,
|
|
78
|
+
json: { auth: "bearer", url: world.json_url },
|
|
79
|
+
mcp: {
|
|
80
|
+
auth: "bearer",
|
|
81
|
+
transport: "streamable_http",
|
|
82
|
+
url: world.mcp_url
|
|
83
|
+
},
|
|
84
|
+
member: { id: member.id, principal_id: member.principal_id },
|
|
85
|
+
run_id: input.request.run_id,
|
|
86
|
+
token_env: credential.env,
|
|
87
|
+
world_instance_id: world.world_instance_id
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
canonical?.fill(0);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
if (bindings.length !== declared.size)
|
|
95
|
+
fail();
|
|
96
|
+
return parseSimfileWorldBindings({
|
|
97
|
+
bindings,
|
|
98
|
+
schema: SIMFILE_WORLD_BINDINGS_VERSION
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return fail();
|
|
103
|
+
}
|
|
104
|
+
};
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -3,3 +3,10 @@ export * from "./paths.js";
|
|
|
3
3
|
export * from "./profileStore.js";
|
|
4
4
|
export * from "./runtimeCredentials.js";
|
|
5
5
|
export * from "./types.js";
|
|
6
|
+
export * from "./credentialEnvFile.js";
|
|
7
|
+
export * from "./credentialProvisioning.js";
|
|
8
|
+
export * from "./credentialProvisioningReceipt.js";
|
|
9
|
+
export * from "./credentialProvisioningRequest.js";
|
|
10
|
+
export * from "./credentialWorldBindings.js";
|
|
11
|
+
export * from "./targetSecretSourceLifecycle.js";
|
|
12
|
+
export * from "./targetSecretSourceResolver.js";
|
package/dist/auth/index.js
CHANGED
|
@@ -3,3 +3,10 @@ export * from "./paths.js";
|
|
|
3
3
|
export * from "./profileStore.js";
|
|
4
4
|
export * from "./runtimeCredentials.js";
|
|
5
5
|
export * from "./types.js";
|
|
6
|
+
export * from "./credentialEnvFile.js";
|
|
7
|
+
export * from "./credentialProvisioning.js";
|
|
8
|
+
export * from "./credentialProvisioningReceipt.js";
|
|
9
|
+
export * from "./credentialProvisioningRequest.js";
|
|
10
|
+
export * from "./credentialWorldBindings.js";
|
|
11
|
+
export * from "./targetSecretSourceLifecycle.js";
|
|
12
|
+
export * from "./targetSecretSourceResolver.js";
|
package/dist/auth/paths.d.ts
CHANGED
|
@@ -4,3 +4,14 @@ export declare const resolveProfilesRoot: () => string;
|
|
|
4
4
|
export declare const resolveProfileDirectory: (profileName: string) => string;
|
|
5
5
|
export declare const resolveProfilePath: (profileName: string) => string;
|
|
6
6
|
export declare const resolveImportedAuthDirectory: (profileName: string, kind: "claude-code" | "codex") => string;
|
|
7
|
+
export declare const resolveTargetSecretsRoot: () => string;
|
|
8
|
+
export declare const resolveTargetSecretVersionsDirectory: () => string;
|
|
9
|
+
export declare const resolveTargetSecretVersionPath: (versionKey: string) => string;
|
|
10
|
+
export declare const resolveTargetSecretGrantsDirectory: () => string;
|
|
11
|
+
export declare const resolveTargetSecretGrantPath: (grantKey: string) => string;
|
|
12
|
+
export declare const resolveTargetSecretRedemptionsDirectory: () => string;
|
|
13
|
+
export declare const resolveTargetSecretRedemptionPath: (redemptionKey: string) => string;
|
|
14
|
+
export declare const resolveTargetSecretRevocationsDirectory: () => string;
|
|
15
|
+
export declare const resolveTargetSecretRevocationPath: (revocationKey: string) => string;
|
|
16
|
+
export declare const resolveTargetSecretAliasesDirectory: () => string;
|
|
17
|
+
export declare const resolveTargetSecretAliasPath: (aliasKey: string) => string;
|
package/dist/auth/paths.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
const DEFAULT_SPAWNFILE_HOME = "~/.spawnfile";
|
|
4
|
+
const OPAQUE_TARGET_SECRET_HANDLE_PATTERN = /^opaque_[a-z0-9]{16,64}$/u;
|
|
5
|
+
const assertCanonicalTargetSecretKey = (targetSecretKey) => {
|
|
6
|
+
if (!OPAQUE_TARGET_SECRET_HANDLE_PATTERN.test(targetSecretKey)) {
|
|
7
|
+
throw new Error("Invalid target-secret path key");
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const resolveTargetSecretLeafPath = (leafDirectory, targetSecretKey) => {
|
|
11
|
+
assertCanonicalTargetSecretKey(targetSecretKey);
|
|
12
|
+
return path.join(leafDirectory, targetSecretKey);
|
|
13
|
+
};
|
|
4
14
|
const expandHomePath = (inputPath) => {
|
|
5
15
|
if (inputPath === "~") {
|
|
6
16
|
return os.homedir();
|
|
@@ -16,3 +26,14 @@ export const resolveProfilesRoot = () => path.join(resolveAuthHome(), "profiles"
|
|
|
16
26
|
export const resolveProfileDirectory = (profileName) => path.join(resolveProfilesRoot(), profileName);
|
|
17
27
|
export const resolveProfilePath = (profileName) => path.join(resolveProfileDirectory(profileName), "profile.json");
|
|
18
28
|
export const resolveImportedAuthDirectory = (profileName, kind) => path.join(resolveProfileDirectory(profileName), "imports", kind);
|
|
29
|
+
export const resolveTargetSecretsRoot = () => path.join(resolveAuthHome(), "target-secrets");
|
|
30
|
+
export const resolveTargetSecretVersionsDirectory = () => path.join(resolveTargetSecretsRoot(), "versions");
|
|
31
|
+
export const resolveTargetSecretVersionPath = (versionKey) => resolveTargetSecretLeafPath(resolveTargetSecretVersionsDirectory(), versionKey);
|
|
32
|
+
export const resolveTargetSecretGrantsDirectory = () => path.join(resolveTargetSecretsRoot(), "grants");
|
|
33
|
+
export const resolveTargetSecretGrantPath = (grantKey) => resolveTargetSecretLeafPath(resolveTargetSecretGrantsDirectory(), grantKey);
|
|
34
|
+
export const resolveTargetSecretRedemptionsDirectory = () => path.join(resolveTargetSecretsRoot(), "redemptions");
|
|
35
|
+
export const resolveTargetSecretRedemptionPath = (redemptionKey) => resolveTargetSecretLeafPath(resolveTargetSecretRedemptionsDirectory(), redemptionKey);
|
|
36
|
+
export const resolveTargetSecretRevocationsDirectory = () => path.join(resolveTargetSecretsRoot(), "revocations");
|
|
37
|
+
export const resolveTargetSecretRevocationPath = (revocationKey) => resolveTargetSecretLeafPath(resolveTargetSecretRevocationsDirectory(), revocationKey);
|
|
38
|
+
export const resolveTargetSecretAliasesDirectory = () => path.join(resolveTargetSecretsRoot(), "aliases");
|
|
39
|
+
export const resolveTargetSecretAliasPath = (aliasKey) => resolveTargetSecretLeafPath(resolveTargetSecretAliasesDirectory(), aliasKey);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type OpaqueTargetSecretSourceHandle } from "./targetSecretSourceRecordCommon.js";
|
|
2
|
+
import { type TargetSecretSourceFsPublish } from "./targetSecretSourceFsPublish.js";
|
|
3
|
+
import { type TargetSecretSourceRecordPublish } from "./targetSecretSourceRecordPublish.js";
|
|
4
|
+
import { type TargetSecretSourceEntropy } from "./targetSecretSourceVersionRecords.js";
|
|
5
|
+
export interface TargetSecretSourceAuthor {
|
|
6
|
+
authorVersion(secret: Uint8Array): Promise<Readonly<{
|
|
7
|
+
source_handle: OpaqueTargetSecretSourceHandle;
|
|
8
|
+
}>>;
|
|
9
|
+
}
|
|
10
|
+
export interface TargetSecretSourceAuthorOptions {
|
|
11
|
+
readonly aliasEntropy?: TargetSecretSourceEntropy;
|
|
12
|
+
readonly aliasPublicationEntropy?: TargetSecretSourceEntropy;
|
|
13
|
+
readonly recordPublisher?: Pick<TargetSecretSourceRecordPublish, "publishAlias">;
|
|
14
|
+
readonly versionEntropy?: TargetSecretSourceEntropy;
|
|
15
|
+
readonly versionPublicationEntropy?: TargetSecretSourceEntropy;
|
|
16
|
+
readonly versionPublisher?: Pick<TargetSecretSourceFsPublish, "publishVersion">;
|
|
17
|
+
}
|
|
18
|
+
export declare const initializeTargetSecretSourceAuthor: (options?: TargetSecretSourceAuthorOptions) => Promise<TargetSecretSourceAuthor>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TARGET_SECRET_SOURCE_ERROR } from "./targetSecretSourceRecordCommon.js";
|
|
2
|
+
import { initializeTargetSecretSourceFsPublish } from "./targetSecretSourceFsPublish.js";
|
|
3
|
+
import { initializeTargetSecretSourceRecordPublish } from "./targetSecretSourceRecordPublish.js";
|
|
4
|
+
import { createTargetSecretSourceAliasRecordBytes, createTargetSecretSourceVersionRecordBytes } from "./targetSecretSourceVersionRecords.js";
|
|
5
|
+
const fail = () => { throw new Error(TARGET_SECRET_SOURCE_ERROR); };
|
|
6
|
+
export const initializeTargetSecretSourceAuthor = async (options = {}) => {
|
|
7
|
+
// Both defaults establish and pin the same auth-owned directory hierarchy.
|
|
8
|
+
// Initialize them sequentially so a fresh home has no mkdir election race.
|
|
9
|
+
const versionPublisher = options.versionPublisher ?? await initializeTargetSecretSourceFsPublish();
|
|
10
|
+
const recordPublisher = options.recordPublisher ?? await initializeTargetSecretSourceRecordPublish();
|
|
11
|
+
return Object.freeze({
|
|
12
|
+
authorVersion: async (secret) => {
|
|
13
|
+
let workingSecret;
|
|
14
|
+
let versionBytes;
|
|
15
|
+
let aliasBytes;
|
|
16
|
+
try {
|
|
17
|
+
if (!(secret instanceof Uint8Array))
|
|
18
|
+
fail();
|
|
19
|
+
workingSecret = Uint8Array.from(secret);
|
|
20
|
+
const version = createTargetSecretSourceVersionRecordBytes(workingSecret, {
|
|
21
|
+
entropy: options.versionEntropy,
|
|
22
|
+
publicationEntropy: options.versionPublicationEntropy
|
|
23
|
+
});
|
|
24
|
+
versionBytes = version.private_bytes;
|
|
25
|
+
const alias = createTargetSecretSourceAliasRecordBytes(version.metadata, {
|
|
26
|
+
entropy: options.aliasEntropy,
|
|
27
|
+
publicationEntropy: options.aliasPublicationEntropy
|
|
28
|
+
});
|
|
29
|
+
aliasBytes = alias.private_bytes;
|
|
30
|
+
if (alias.metadata.source_handle === version.private_metadata.publication_handle
|
|
31
|
+
|| alias.private_metadata.publication_handle === version.private_metadata.publication_handle)
|
|
32
|
+
fail();
|
|
33
|
+
// Alias publication is the public commit point. A process interruption
|
|
34
|
+
// before it may leave only an unreachable immutable version record.
|
|
35
|
+
await versionPublisher.publishVersion({
|
|
36
|
+
bytes: versionBytes,
|
|
37
|
+
private_metadata: version.private_metadata
|
|
38
|
+
});
|
|
39
|
+
await recordPublisher.publishAlias(aliasBytes);
|
|
40
|
+
return Object.freeze({ source_handle: alias.metadata.source_handle });
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return fail();
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
workingSecret?.fill(0);
|
|
47
|
+
versionBytes?.fill(0);
|
|
48
|
+
aliasBytes?.fill(0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TargetSecretSourceFsPublishImmutablePhase } from "./targetSecretSourceFsPublishImmutable.js";
|
|
2
|
+
import { type TargetSecretSourcePrivateVersionMetadata } from "./targetSecretSourceVersionRecords.js";
|
|
3
|
+
export type TargetSecretSourceFsPublishPhase = TargetSecretSourceFsPublishImmutablePhase;
|
|
4
|
+
export interface TargetSecretSourceFsPublishInput {
|
|
5
|
+
readonly bytes: Uint8Array;
|
|
6
|
+
readonly private_metadata: Pick<TargetSecretSourcePrivateVersionMetadata, "publication_handle" | "source_version_handle">;
|
|
7
|
+
}
|
|
8
|
+
export interface TargetSecretSourceFsPublishOptions {
|
|
9
|
+
readonly hookForTest?: (phase: TargetSecretSourceFsPublishPhase, path: string) => Promise<void> | void;
|
|
10
|
+
readonly maxWriteBytesForTest?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TargetSecretSourceFsPublish {
|
|
13
|
+
publishVersion(input: TargetSecretSourceFsPublishInput): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const initializeTargetSecretSourceFsPublish: (options?: TargetSecretSourceFsPublishOptions) => Promise<TargetSecretSourceFsPublish>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { resolveAuthHome, resolveSpawnfileHome, resolveTargetSecretVersionPath, resolveTargetSecretVersionsDirectory, resolveTargetSecretsRoot } from "./paths.js";
|
|
2
|
+
import { TARGET_SECRET_SOURCE_ERROR, parseTargetSecretSourceOpaqueHandle } from "./targetSecretSourceRecordCommon.js";
|
|
3
|
+
import { initializeTargetSecretSourceFsPublishImmutable } from "./targetSecretSourceFsPublishImmutable.js";
|
|
4
|
+
import { initializeTargetSecretSourceFsRead } from "./targetSecretSourceFsRead.js";
|
|
5
|
+
import { parseTargetSecretSourceVersionRecordBytes } from "./targetSecretSourceVersionRecords.js";
|
|
6
|
+
const fail = () => { throw new Error(TARGET_SECRET_SOURCE_ERROR); };
|
|
7
|
+
export const initializeTargetSecretSourceFsPublish = async (options = {}) => {
|
|
8
|
+
await initializeTargetSecretSourceFsRead();
|
|
9
|
+
const publisher = await initializeTargetSecretSourceFsPublishImmutable({
|
|
10
|
+
directory_chain: [
|
|
11
|
+
resolveSpawnfileHome(),
|
|
12
|
+
resolveAuthHome(),
|
|
13
|
+
resolveTargetSecretsRoot(),
|
|
14
|
+
resolveTargetSecretVersionsDirectory()
|
|
15
|
+
],
|
|
16
|
+
hookForTest: options.hookForTest,
|
|
17
|
+
maxWriteBytesForTest: options.maxWriteBytesForTest
|
|
18
|
+
});
|
|
19
|
+
const publishVersion = async (input) => {
|
|
20
|
+
try {
|
|
21
|
+
if (!input || typeof input !== "object" || !(input.bytes instanceof Uint8Array)
|
|
22
|
+
|| !input.private_metadata || typeof input.private_metadata !== "object")
|
|
23
|
+
fail();
|
|
24
|
+
const sourceVersionHandle = parseTargetSecretSourceOpaqueHandle(input.private_metadata.source_version_handle);
|
|
25
|
+
const publicationHandle = parseTargetSecretSourceOpaqueHandle(input.private_metadata.publication_handle);
|
|
26
|
+
if (sourceVersionHandle === publicationHandle)
|
|
27
|
+
fail();
|
|
28
|
+
await publisher.publishImmutable({
|
|
29
|
+
bytes: input.bytes,
|
|
30
|
+
final_path: resolveTargetSecretVersionPath(sourceVersionHandle),
|
|
31
|
+
publication_handle: publicationHandle,
|
|
32
|
+
proveExact: (bytes) => {
|
|
33
|
+
const parsed = parseTargetSecretSourceVersionRecordBytes(bytes, sourceVersionHandle);
|
|
34
|
+
try {
|
|
35
|
+
if (parsed.publication_handle !== publicationHandle)
|
|
36
|
+
fail();
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
parsed.secret.fill(0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
fail();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return Object.freeze({ publishVersion });
|
|
49
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TargetSecretSourceFsPublishImmutablePhase = "after_token_create" | "after_claim_link" | "after_claim_snapshot" | "after_mismatch_snapshot" | "after_exact_token_snapshot" | "after_final_create" | "after_partial_write" | "after_file_sync" | "before_directory_sync" | "after_directory_sync" | "after_token_cleanup" | "after_claim_cleanup";
|
|
2
|
+
export interface TargetSecretSourceFsPublishImmutableInput {
|
|
3
|
+
readonly bytes: Uint8Array;
|
|
4
|
+
readonly final_path: string;
|
|
5
|
+
readonly publication_handle: string;
|
|
6
|
+
readonly proveExact: (bytes: Uint8Array) => Promise<void> | void;
|
|
7
|
+
}
|
|
8
|
+
export interface TargetSecretSourceFsPublishImmutableOptions {
|
|
9
|
+
readonly directory_chain: readonly string[];
|
|
10
|
+
readonly hookForTest?: (phase: TargetSecretSourceFsPublishImmutablePhase, path: string) => Promise<void> | void;
|
|
11
|
+
readonly maxWriteBytesForTest?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface TargetSecretSourceFsPublishImmutable {
|
|
14
|
+
publishImmutable(input: TargetSecretSourceFsPublishImmutableInput): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const initializeTargetSecretSourceFsPublishImmutable: (options: TargetSecretSourceFsPublishImmutableOptions) => Promise<TargetSecretSourceFsPublishImmutable>;
|