spawnfile 0.1.13 → 0.1.17
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 +61 -121
- 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/importers.d.ts +10 -0
- package/dist/auth/importers.js +29 -4
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/paths.d.ts +12 -1
- package/dist/auth/paths.js +21 -0
- package/dist/auth/profileStore.js +9 -9
- package/dist/auth/targetSecretSourceAuthor.d.ts +18 -0
- package/dist/auth/targetSecretSourceAuthor.js +52 -0
- package/dist/auth/targetSecretSourceFsIdentity.d.ts +40 -0
- package/dist/auth/targetSecretSourceFsIdentity.js +42 -0
- package/dist/auth/targetSecretSourceFsPublish.d.ts +17 -0
- package/dist/auth/targetSecretSourceFsPublish.js +51 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.d.ts +17 -0
- package/dist/auth/targetSecretSourceFsPublishImmutable.js +468 -0
- package/dist/auth/targetSecretSourceFsRead.d.ts +14 -0
- package/dist/auth/targetSecretSourceFsRead.js +189 -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/auth/trainingAuth.d.ts +21 -0
- package/dist/auth/trainingAuth.js +86 -0
- package/dist/auth/types.d.ts +1 -1
- 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 +230 -0
- package/dist/cli/canaryCutoverCommand.d.ts +2 -0
- package/dist/cli/canaryCutoverCommand.js +30 -0
- package/dist/cli/capabilitiesCommand.d.ts +3 -0
- package/dist/cli/capabilitiesCommand.js +12 -0
- package/dist/cli/capabilitiesReceipt.d.ts +56 -0
- package/dist/cli/capabilitiesReceipt.js +56 -0
- package/dist/cli/compileBuildCommands.d.ts +3 -0
- package/dist/cli/compileBuildCommands.js +48 -0
- package/dist/cli/composedLifecycleContractSet.d.ts +21 -0
- package/dist/cli/composedLifecycleContractSet.js +204 -0
- package/dist/cli/containerBundleCommand.d.ts +6 -0
- package/dist/cli/containerBundleCommand.js +116 -0
- package/dist/cli/devCommands.js +2 -0
- package/dist/cli/downCommand.d.ts +25 -0
- package/dist/cli/downCommand.js +145 -0
- package/dist/cli/evidenceExportHelperCommand.d.ts +13 -0
- package/dist/cli/evidenceExportHelperCommand.js +51 -0
- package/dist/cli/index.js +15 -3
- package/dist/cli/lifecycleCommands.d.ts +1 -1
- package/dist/cli/lifecycleCommands.js +11 -181
- package/dist/cli/lifecycleMachine.d.ts +25 -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/paideiaDelegation.d.ts +17 -0
- package/dist/cli/paideiaDelegation.js +210 -0
- package/dist/cli/paideiaSupervisor.d.ts +17 -0
- package/dist/cli/paideiaSupervisor.js +48 -0
- package/dist/cli/productStateCloneCommand.d.ts +2 -0
- package/dist/cli/productStateCloneCommand.js +34 -0
- package/dist/cli/runCli.d.ts +19 -2
- package/dist/cli/runCli.js +58 -74
- 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 +30 -0
- package/dist/cli/targetCommands.js +227 -0
- package/dist/cli/targetComposedPreparationCommand.d.ts +6 -0
- package/dist/cli/targetComposedPreparationCommand.js +39 -0
- package/dist/cli/targetConfigPreparedPlan.d.ts +3 -0
- package/dist/cli/targetConfigPreparedPlan.js +74 -0
- package/dist/cli/targetConfigResolver.d.ts +3 -0
- package/dist/cli/targetConfigResolver.js +111 -0
- package/dist/cli/targetConfigResolverCommand.d.ts +6 -0
- package/dist/cli/targetConfigResolverCommand.js +43 -0
- package/dist/cli/targetConfigResolverContracts.d.ts +56 -0
- package/dist/cli/targetConfigResolverContracts.js +30 -0
- package/dist/cli/targetConfigResolverDocker.d.ts +4 -0
- package/dist/cli/targetConfigResolverDocker.js +47 -0
- package/dist/cli/targetConfigResolverValidation.d.ts +10 -0
- package/dist/cli/targetConfigResolverValidation.js +94 -0
- package/dist/cli/targetDefaultArtifactAuthority.d.ts +5 -0
- package/dist/cli/targetDefaultArtifactAuthority.js +28 -0
- package/dist/cli/targetDefaultAuthorities.d.ts +55 -0
- package/dist/cli/targetDefaultAuthorities.js +213 -0
- package/dist/cli/targetDefaultConfig.d.ts +75 -0
- package/dist/cli/targetDefaultConfig.js +334 -0
- package/dist/cli/targetDefaultConfigStdin.d.ts +13 -0
- package/dist/cli/targetDefaultConfigStdin.js +221 -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 +268 -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/targetProductionCommands.d.ts +5 -0
- package/dist/cli/targetProductionCommands.js +45 -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/targetWorldReadinessCommand.d.ts +10 -0
- package/dist/cli/targetWorldReadinessCommand.js +43 -0
- package/dist/cli/trainCommand.d.ts +3 -0
- package/dist/cli/trainCommand.js +61 -0
- package/dist/cli/upCommand.d.ts +3 -0
- package/dist/cli/upCommand.js +162 -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 +197 -0
- package/dist/cli/usageCommand.d.ts +40 -0
- package/dist/cli/usageCommand.js +284 -0
- package/dist/cli/usageCommandLive.d.ts +84 -0
- package/dist/cli/usageCommandLive.js +95 -0
- package/dist/cli/usageDeploymentSource.d.ts +9 -0
- package/dist/cli/usageDeploymentSource.js +22 -0
- package/dist/cli/workspaceResourceMigrationCommand.d.ts +8 -0
- package/dist/cli/workspaceResourceMigrationCommand.js +36 -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 +2 -1
- package/dist/compiler/buildCompilePlanTeams.js +9 -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 +5 -0
- package/dist/compiler/compileProject.d.ts +15 -0
- package/dist/compiler/compileProject.js +31 -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/compileProjectSupport.js +9 -0
- package/dist/compiler/containerArtifactSummaries.d.ts +7 -0
- package/dist/compiler/containerArtifactSummaries.js +138 -0
- package/dist/compiler/containerArtifacts.d.ts +12 -0
- package/dist/compiler/containerArtifacts.js +180 -127
- package/dist/compiler/containerArtifactsPlans.d.ts +5 -3
- package/dist/compiler/containerArtifactsPlans.js +54 -124
- package/dist/compiler/containerArtifactsRender.d.ts +5 -2
- package/dist/compiler/containerArtifactsRender.js +106 -70
- package/dist/compiler/containerArtifactsTypes.d.ts +20 -0
- package/dist/compiler/containerBackedMountRender.d.ts +56 -0
- package/dist/compiler/containerBackedMountRender.js +101 -0
- package/dist/compiler/containerConfigEnvRender.d.ts +3 -0
- package/dist/compiler/containerConfigEnvRender.js +54 -0
- package/dist/compiler/containerDaimonBrokerRender.d.ts +112 -0
- package/dist/compiler/containerDaimonBrokerRender.js +191 -0
- package/dist/compiler/containerDaimonGrokWorkerProvisioning.d.ts +38 -0
- package/dist/compiler/containerDaimonGrokWorkerProvisioning.js +108 -0
- package/dist/compiler/containerDaimonGrokWorkerRender.d.ts +172 -0
- package/dist/compiler/containerDaimonGrokWorkerRender.js +268 -0
- package/dist/compiler/containerDaimonOwnershipGuardRender.d.ts +12 -0
- package/dist/compiler/containerDaimonOwnershipGuardRender.js +191 -0
- package/dist/compiler/containerDaimonUidEntrypointRender.d.ts +24 -0
- package/dist/compiler/containerDaimonUidEntrypointRender.js +297 -0
- package/dist/compiler/containerEntrypointRender.d.ts +8 -0
- package/dist/compiler/containerEntrypointRender.js +82 -72
- 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/containerPersistentMounts.d.ts +30 -0
- package/dist/compiler/containerPersistentMounts.js +66 -0
- package/dist/compiler/containerReadinessPaths.d.ts +1 -0
- package/dist/compiler/containerReadinessPaths.js +1 -0
- package/dist/compiler/containerRuntimeLinkMaterializer.d.ts +2 -0
- package/dist/compiler/containerRuntimeLinkMaterializer.js +12 -0
- package/dist/compiler/containerRuntimeReadinessRender.d.ts +7 -0
- package/dist/compiler/containerRuntimeReadinessRender.js +40 -0
- package/dist/compiler/containerStateOwnershipRender.d.ts +4 -0
- package/dist/compiler/containerStateOwnershipRender.js +75 -0
- package/dist/compiler/containerTargetPlanResolution.d.ts +20 -0
- package/dist/compiler/containerTargetPlanResolution.js +97 -0
- package/dist/compiler/containerTargetResources.d.ts +22 -1
- package/dist/compiler/containerTargetResources.js +94 -2
- package/dist/compiler/containerVolumeBootstrap.d.ts +3 -0
- package/dist/compiler/containerVolumeBootstrap.js +3 -0
- package/dist/compiler/containerWorkspaceResourceRender.js +49 -1
- package/dist/compiler/daimonTelemetryArtifacts.d.ts +22 -0
- package/dist/compiler/daimonTelemetryArtifacts.js +56 -0
- package/dist/compiler/deploymentLineage.d.ts +40 -0
- package/dist/compiler/deploymentLineage.js +50 -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 +7 -0
- package/dist/compiler/index.js +7 -0
- package/dist/compiler/initProject.d.ts +2 -0
- package/dist/compiler/initProject.js +39 -1
- package/dist/compiler/localMoltnetAuthority.d.ts +64 -0
- package/dist/compiler/localMoltnetAuthority.js +177 -0
- package/dist/compiler/memoryArtifacts.d.ts +26 -0
- package/dist/compiler/memoryArtifacts.js +210 -0
- package/dist/compiler/memoryResolution.d.ts +4 -0
- package/dist/compiler/memoryResolution.js +147 -0
- package/dist/compiler/modelEnv.d.ts +7 -0
- package/dist/compiler/modelEnv.js +13 -1
- package/dist/compiler/moltnetAllowedWakeSendersValidation.d.ts +2 -0
- package/dist/compiler/moltnetAllowedWakeSendersValidation.js +42 -0
- package/dist/compiler/moltnetArtifactPaths.d.ts +31 -0
- package/dist/compiler/moltnetArtifactPaths.js +51 -0
- package/dist/compiler/moltnetArtifactTypes.d.ts +56 -0
- package/dist/compiler/moltnetArtifactTypes.js +1 -0
- package/dist/compiler/moltnetArtifacts.d.ts +3 -41
- package/dist/compiler/moltnetArtifacts.js +87 -101
- package/dist/compiler/moltnetBinaries.d.ts +33 -4
- package/dist/compiler/moltnetBinaries.js +173 -26
- package/dist/compiler/moltnetClientConfig.js +7 -2
- package/dist/compiler/moltnetConfigLowering.d.ts +18 -1
- package/dist/compiler/moltnetConfigLowering.js +92 -6
- 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 +40 -0
- package/dist/compiler/moltnetReleaseAuthority.js +102 -0
- package/dist/compiler/moltnetReleaseDownload.d.ts +12 -0
- package/dist/compiler/moltnetReleaseDownload.js +85 -0
- package/dist/compiler/moltnetRepresentativeResolution.d.ts +2 -1
- package/dist/compiler/moltnetRepresentativeResolution.js +17 -3
- package/dist/compiler/moltnetResolution.js +67 -21
- package/dist/compiler/moltnetRoomMemberships.js +52 -9
- package/dist/compiler/moltnetRoomPolicyCompatibility.d.ts +1 -1
- package/dist/compiler/moltnetRoomPolicyCompatibility.js +3 -1
- package/dist/compiler/moltnetRuntimeConfig.d.ts +1 -1
- package/dist/compiler/moltnetRuntimeConfig.js +22 -2
- package/dist/compiler/moltnetServerPlans.d.ts +9 -0
- package/dist/compiler/moltnetServerPlans.js +151 -0
- package/dist/compiler/organizationExternalParticipants.d.ts +3 -0
- package/dist/compiler/organizationExternalParticipants.js +176 -0
- package/dist/compiler/organizationIdentity.d.ts +21 -0
- package/dist/compiler/organizationIdentity.js +64 -0
- package/dist/compiler/organizationIdentityGraph.d.ts +15 -0
- package/dist/compiler/organizationIdentityGraph.js +115 -0
- package/dist/compiler/organizationReadyEvidence.d.ts +57 -0
- package/dist/compiler/organizationReadyEvidence.js +281 -0
- package/dist/compiler/projectManifestGraph.d.ts +4 -0
- package/dist/compiler/projectManifestGraph.js +24 -0
- package/dist/compiler/runProject.d.ts +8 -2
- package/dist/compiler/runProject.js +62 -27
- package/dist/compiler/runProjectAuth.d.ts +10 -2
- package/dist/compiler/runProjectAuth.js +105 -11
- package/dist/compiler/runProjectDaimonCodexDocker.d.ts +3 -0
- package/dist/compiler/runProjectDaimonCodexDocker.js +36 -0
- package/dist/compiler/runProjectDocker.d.ts +11 -0
- package/dist/compiler/runProjectDocker.js +64 -16
- package/dist/compiler/runProjectDockerDaimonGuards.d.ts +15 -0
- package/dist/compiler/runProjectDockerDaimonGuards.js +122 -0
- package/dist/compiler/runProjectDockerReservation.d.ts +3 -0
- package/dist/compiler/runProjectDockerReservation.js +118 -0
- 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/training/broker/declaration.d.ts +45 -0
- package/dist/compiler/training/broker/declaration.js +55 -0
- package/dist/compiler/training/broker/entrypoint.d.ts +39 -0
- package/dist/compiler/training/broker/entrypoint.js +111 -0
- package/dist/compiler/training/broker/index.d.ts +10 -0
- package/dist/compiler/training/broker/index.js +10 -0
- package/dist/compiler/training/broker/main.d.ts +2 -0
- package/dist/compiler/training/broker/main.js +14 -0
- package/dist/compiler/training/broker/paths.d.ts +196 -0
- package/dist/compiler/training/broker/paths.js +241 -0
- package/dist/compiler/training/broker/processes.d.ts +42 -0
- package/dist/compiler/training/broker/processes.js +99 -0
- package/dist/compiler/training/broker/projection.d.ts +51 -0
- package/dist/compiler/training/broker/projection.js +76 -0
- package/dist/compiler/training/broker/provisioning.d.ts +87 -0
- package/dist/compiler/training/broker/provisioning.js +213 -0
- package/dist/compiler/training/broker/receipt.d.ts +77 -0
- package/dist/compiler/training/broker/receipt.js +110 -0
- package/dist/compiler/training/broker/registration.d.ts +41 -0
- package/dist/compiler/training/broker/registration.js +102 -0
- package/dist/compiler/training/broker/runtime.d.ts +25 -0
- package/dist/compiler/training/broker/runtime.js +173 -0
- package/dist/compiler/training/broker/seccompRoutes.d.ts +31 -0
- package/dist/compiler/training/broker/seccompRoutes.js +36 -0
- package/dist/compiler/training/broker/supervisor.d.ts +109 -0
- package/dist/compiler/training/broker/supervisor.js +173 -0
- package/dist/compiler/training/container/contract.d.ts +31 -0
- package/dist/compiler/training/container/contract.js +33 -0
- package/dist/compiler/training/container/index.d.ts +4 -0
- package/dist/compiler/training/container/index.js +2 -0
- package/dist/compiler/training/container/launch.d.ts +18 -0
- package/dist/compiler/training/container/launch.js +173 -0
- package/dist/compiler/training/container/prepare.d.ts +8 -0
- package/dist/compiler/training/container/prepare.js +80 -0
- package/dist/compiler/training/container/process.d.ts +14 -0
- package/dist/compiler/training/container/process.js +70 -0
- package/dist/compiler/training/container/security.d.ts +36 -0
- package/dist/compiler/training/container/security.js +58 -0
- package/dist/compiler/training/context.d.ts +7 -0
- package/dist/compiler/training/context.js +93 -0
- package/dist/compiler/training/contract.d.ts +142 -0
- package/dist/compiler/training/contract.js +34 -0
- package/dist/compiler/training/index.d.ts +4 -0
- package/dist/compiler/training/index.js +3 -0
- package/dist/compiler/training/preparation/assets/Dockerfile +98 -0
- package/dist/compiler/training/preparation/assets/package-lock.json +3787 -0
- package/dist/compiler/training/preparation/broker.d.ts +21 -0
- package/dist/compiler/training/preparation/broker.js +43 -0
- package/dist/compiler/training/preparation/contextModes.d.ts +12 -0
- package/dist/compiler/training/preparation/contextModes.js +38 -0
- package/dist/compiler/training/preparation/contract.d.ts +182 -0
- package/dist/compiler/training/preparation/contract.js +94 -0
- package/dist/compiler/training/preparation/copyAssets.d.ts +1 -0
- package/dist/compiler/training/preparation/copyAssets.js +8 -0
- package/dist/compiler/training/preparation/daimonParent.d.ts +42 -0
- package/dist/compiler/training/preparation/daimonParent.js +114 -0
- package/dist/compiler/training/preparation/files.d.ts +25 -0
- package/dist/compiler/training/preparation/files.js +85 -0
- package/dist/compiler/training/preparation/image.d.ts +28 -0
- package/dist/compiler/training/preparation/image.js +102 -0
- package/dist/compiler/training/preparation/index.d.ts +3 -0
- package/dist/compiler/training/preparation/index.js +2 -0
- package/dist/compiler/training/preparation/inputs.d.ts +23 -0
- package/dist/compiler/training/preparation/inputs.js +93 -0
- package/dist/compiler/training/preparation/prepare.d.ts +33 -0
- package/dist/compiler/training/preparation/prepare.js +186 -0
- package/dist/compiler/training/preparation/scratch.d.ts +19 -0
- package/dist/compiler/training/preparation/scratch.js +48 -0
- package/dist/compiler/training/repair/compatibility.d.ts +11 -0
- package/dist/compiler/training/repair/compatibility.js +34 -0
- package/dist/compiler/training/repair/contract.d.ts +506 -0
- package/dist/compiler/training/repair/contract.js +31 -0
- package/dist/compiler/training/repair/index.d.ts +3 -0
- package/dist/compiler/training/repair/index.js +3 -0
- package/dist/compiler/training/repair/prepare.d.ts +230 -0
- package/dist/compiler/training/repair/prepare.js +74 -0
- package/dist/compiler/training/repair/witness.d.ts +203 -0
- package/dist/compiler/training/repair/witness.js +42 -0
- package/dist/compiler/types.d.ts +84 -1
- package/dist/compiler/upProject.d.ts +31 -1
- package/dist/compiler/upProject.js +197 -22
- package/dist/compiler/upProjectHandoff.d.ts +62 -0
- package/dist/compiler/upProjectHandoff.js +204 -0
- package/dist/compiler/upReceipt.d.ts +36 -0
- package/dist/compiler/upReceipt.js +127 -0
- package/dist/compiler/updateProjectModels.js +43 -60
- package/dist/compiler/updateProjectRuntime.js +22 -35
- package/dist/compiler/updateProjectSurfaces.js +53 -47
- package/dist/compiler/view/types.d.ts +1 -1
- package/dist/compiler/workspaceBundleArtifacts.d.ts +3 -0
- package/dist/compiler/workspaceBundleArtifacts.js +106 -0
- package/dist/compiler/workspaceResources.d.ts +4 -1
- package/dist/compiler/workspaceResources.js +12 -7
- 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 +185 -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/canaryCutover.d.ts +42 -0
- package/dist/deployment/canaryCutover.js +140 -0
- package/dist/deployment/candidateDiagnostics.d.ts +15 -0
- package/dist/deployment/candidateDiagnostics.js +90 -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 +5 -10
- package/dist/deployment/dockerManager.d.ts +51 -0
- package/dist/deployment/dockerManager.js +124 -1
- package/dist/deployment/dockerProbeGateway.d.ts +17 -0
- package/dist/deployment/dockerProbeGateway.js +80 -6
- 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 +39 -0
- package/dist/deployment/downDeployment.js +248 -0
- package/dist/deployment/downReceiptTypes.d.ts +36 -0
- package/dist/deployment/downReceiptTypes.js +45 -0
- package/dist/deployment/index.d.ts +20 -0
- package/dist/deployment/index.js +21 -0
- package/dist/deployment/lifecycleCompletion.d.ts +37 -0
- package/dist/deployment/lifecycleCompletion.js +236 -0
- package/dist/deployment/lifecycleCompletionContracts.d.ts +224 -0
- package/dist/deployment/lifecycleCompletionContracts.js +140 -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 +12 -0
- package/dist/deployment/lifecycleCompletionPaths.js +19 -0
- package/dist/deployment/lifecycleCompletionPublication.d.ts +7 -0
- package/dist/deployment/lifecycleCompletionPublication.js +49 -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/lifecycleUpRecords.d.ts +11 -0
- package/dist/deployment/lifecycleUpRecords.js +127 -0
- package/dist/deployment/native/AGENTS.md +11 -0
- package/dist/deployment/native/rename-noreplace-arm64 +0 -0
- package/dist/deployment/native/rename-noreplace-arm64.provenance.json +1 -0
- package/dist/deployment/native/rename-noreplace-x64 +0 -0
- package/dist/deployment/native/rename-noreplace-x64.provenance.json +1 -0
- package/dist/deployment/noReplaceActivation.d.ts +17 -0
- package/dist/deployment/noReplaceActivation.js +50 -0
- package/dist/deployment/organizationHandoffAuthorityFsBudget.d.ts +110 -0
- package/dist/deployment/organizationHandoffAuthorityFsBudget.js +156 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.d.ts +17 -0
- package/dist/deployment/organizationHandoffAuthorityFsClient.js +187 -0
- package/dist/deployment/organizationHandoffAuthorityFsElection.d.ts +21 -0
- package/dist/deployment/organizationHandoffAuthorityFsElection.js +57 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorker.js +431 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerParent.fixture.js +26 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerStall.fixture.d.ts +1 -0
- package/dist/deployment/organizationHandoffAuthorityFsWorkerStall.fixture.js +16 -0
- package/dist/deployment/organizationHandoffAuthorityStore.d.ts +41 -0
- package/dist/deployment/organizationHandoffAuthorityStore.js +355 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.d.ts +76 -0
- package/dist/deployment/organizationHandoffAuthorityTypes.js +149 -0
- package/dist/deployment/organizationHandoffTypes.d.ts +29 -0
- package/dist/deployment/organizationHandoffTypes.js +80 -0
- package/dist/deployment/organizationReady.d.ts +54 -0
- package/dist/deployment/organizationReady.js +232 -0
- package/dist/deployment/privateArtifactsExport.d.ts +18 -0
- package/dist/deployment/privateArtifactsExport.js +80 -0
- package/dist/deployment/productStateClone.d.ts +43 -0
- package/dist/deployment/productStateClone.js +319 -0
- package/dist/deployment/record.d.ts +26 -1
- package/dist/deployment/record.js +49 -4
- package/dist/deployment/target.d.ts +1 -35
- package/dist/deployment/target.js +1 -96
- package/dist/deployment/upLifecycleRecoveryState.d.ts +23 -0
- package/dist/deployment/upLifecycleRecoveryState.js +12 -0
- package/dist/deployment/upReceiptTypes.d.ts +137 -0
- package/dist/deployment/upReceiptTypes.js +191 -0
- package/dist/deployment/workspaceResourceMigration.d.ts +55 -0
- package/dist/deployment/workspaceResourceMigration.js +315 -0
- package/dist/dev/project.d.ts +7 -0
- package/dist/dev/project.js +24 -9
- package/dist/distribution/buildDistributionReport.d.ts +2 -1
- package/dist/distribution/buildDistributionReport.js +2 -1
- package/dist/distribution/consumeImage.d.ts +2 -0
- package/dist/distribution/consumeImage.js +98 -73
- package/dist/distribution/consumeImageDaimonDocker.d.ts +3 -0
- package/dist/distribution/consumeImageDaimonDocker.js +45 -0
- package/dist/distribution/consumeImageLifecycle.d.ts +17 -0
- package/dist/distribution/consumeImageLifecycle.js +231 -0
- package/dist/distribution/consumeImageSupport.d.ts +12 -0
- package/dist/distribution/consumeImageSupport.js +15 -0
- package/dist/distribution/distributionReportSchema.d.ts +16 -1
- package/dist/distribution/distributionReportSchema.js +21 -3
- package/dist/distribution/dockerRunner.d.ts +6 -1
- package/dist/distribution/dockerRunner.js +31 -4
- package/dist/distribution/imageRuntimeAuth.d.ts +9 -1
- package/dist/distribution/imageRuntimeAuth.js +70 -1
- package/dist/distribution/index.d.ts +3 -3
- package/dist/distribution/index.js +2 -2
- package/dist/distribution/preflight.js +5 -1
- package/dist/distribution/types.d.ts +21 -1
- package/dist/distribution/types.js +4 -0
- package/dist/evidenceExportHelper/boundedExecutor.d.ts +3 -0
- package/dist/evidenceExportHelper/boundedExecutor.js +33 -0
- package/dist/evidenceExportHelper/helperProgram.mjs +156 -0
- package/dist/evidenceExportHelper/index.d.ts +4 -0
- package/dist/evidenceExportHelper/index.js +4 -0
- package/dist/evidenceExportHelper/preparedAuthority.d.ts +64 -0
- package/dist/evidenceExportHelper/preparedAuthority.js +228 -0
- package/dist/evidenceExportHelper/preparedBuilder.d.ts +10 -0
- package/dist/evidenceExportHelper/preparedBuilder.js +183 -0
- package/dist/evidenceExportHelper/preparedBuilderTypes.d.ts +19 -0
- package/dist/evidenceExportHelper/preparedBuilderTypes.js +1 -0
- package/dist/evidenceExportHelper/recipe.d.ts +7 -0
- package/dist/evidenceExportHelper/recipe.js +83 -0
- package/dist/filesystem/io.d.ts +2 -0
- package/dist/filesystem/io.js +16 -1
- 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/executionSchemas.d.ts +27 -0
- package/dist/manifest/executionSchemas.js +21 -2
- 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 +18 -0
- package/dist/manifest/mcpSchemas.js +44 -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 +20 -2
- package/dist/manifest/renderSpawnfileSurfaces.d.ts +2 -0
- package/dist/manifest/renderSpawnfileSurfaces.js +134 -0
- package/dist/manifest/renderSpawnfileWorkspace.js +5 -0
- package/dist/manifest/scheduleSchemas.d.ts +3 -1
- package/dist/manifest/scheduleSchemas.js +91 -5
- package/dist/manifest/schemas.d.ts +2034 -40
- package/dist/manifest/schemas.js +82 -33
- package/dist/manifest/surfaceSchemas.d.ts +17 -0
- package/dist/manifest/surfaceSchemas.js +24 -1
- package/dist/manifest/teamNetworkAccessSchemas.d.ts +6 -2
- package/dist/manifest/teamNetworkAccessSchemas.js +11 -0
- package/dist/manifest/teamNetworkAuthSchemas.d.ts +48 -0
- package/dist/manifest/teamNetworkAuthSchemas.js +103 -0
- package/dist/manifest/teamNetworkSchemas.d.ts +25 -190
- package/dist/manifest/teamNetworkSchemas.js +21 -317
- package/dist/manifest/teamNetworkServerSchemas.d.ts +155 -0
- package/dist/manifest/teamNetworkServerSchemas.js +215 -0
- package/dist/manifest/workspaceSchemas.d.ts +16 -0
- package/dist/manifest/workspaceSchemas.js +11 -0
- package/dist/ownership/siblingBuildFreshness.d.ts +20 -0
- package/dist/ownership/siblingBuildFreshness.js +20 -0
- package/dist/report/types.d.ts +173 -1
- package/dist/runtime/common.d.ts +63 -1
- package/dist/runtime/common.js +88 -3
- package/dist/runtime/container.d.ts +28 -1
- package/dist/runtime/container.js +78 -29
- package/dist/runtime/containerPackageOverrides.d.ts +37 -0
- package/dist/runtime/containerPackageOverrides.js +33 -0
- package/dist/runtime/daimon/adapter.d.ts +14 -0
- package/dist/runtime/daimon/adapter.js +243 -0
- package/dist/runtime/daimon/attention.d.ts +8 -0
- package/dist/runtime/daimon/attention.js +32 -0
- package/dist/runtime/daimon/config.d.ts +25 -0
- package/dist/runtime/daimon/config.js +272 -0
- package/dist/runtime/daimon/contractManifest.d.ts +295 -0
- package/dist/runtime/daimon/contractManifest.js +319 -0
- package/dist/runtime/daimon/grokModel.d.ts +19 -0
- package/dist/runtime/daimon/grokModel.js +33 -0
- package/dist/runtime/daimon/grokWorkerConfigBytes.d.ts +26 -0
- package/dist/runtime/daimon/grokWorkerConfigBytes.js +36 -0
- package/dist/runtime/daimon/grokWorkerContract.d.ts +22 -0
- package/dist/runtime/daimon/grokWorkerContract.js +48 -0
- package/dist/runtime/daimon/memory.d.ts +57 -0
- package/dist/runtime/daimon/memory.js +125 -0
- package/dist/runtime/daimon/runAuth.d.ts +51 -0
- package/dist/runtime/daimon/runAuth.js +279 -0
- package/dist/runtime/daimon/runtimeIdentity.d.ts +22 -0
- package/dist/runtime/daimon/runtimeIdentity.js +22 -0
- package/dist/runtime/daimon/scheduleAuthority.d.ts +3 -0
- package/dist/runtime/daimon/scheduleAuthority.js +17 -0
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/index.js +6 -0
- package/dist/runtime/install.d.ts +3 -0
- package/dist/runtime/install.js +3 -0
- package/dist/runtime/localDaimonAuthority.d.ts +11 -0
- package/dist/runtime/localDaimonAuthority.js +77 -0
- package/dist/runtime/mnemeMcp.d.ts +28 -0
- package/dist/runtime/mnemeMcp.js +135 -0
- package/dist/runtime/openclaw/adapter.js +17 -6
- 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 -2
- package/dist/runtime/pi/adapter.js +87 -58
- 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 +84 -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 +25 -29
- 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.d.ts +3 -0
- package/dist/runtime/registry.js +19 -2
- package/dist/runtime/scheduleUtils.d.ts +3 -0
- package/dist/runtime/scheduleUtils.js +19 -0
- package/dist/runtime/types.d.ts +50 -2
- package/dist/runtime/usageLedger.d.ts +158 -0
- package/dist/runtime/usageLedger.js +269 -0
- package/dist/runtime/usageLedgerRead.d.ts +48 -0
- package/dist/runtime/usageLedgerRead.js +102 -0
- package/dist/runtime/usageRequestLedger.d.ts +42 -0
- package/dist/runtime/usageRequestLedger.js +72 -0
- package/dist/shared/daimonCodexDocker.d.ts +32 -0
- package/dist/shared/daimonCodexDocker.js +120 -0
- package/dist/shared/daimonGrokSeccompProfile.d.ts +10 -0
- package/dist/shared/daimonGrokSeccompProfile.js +11 -0
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.js +2 -2
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.js +3 -0
- package/dist/shared/redaction.d.ts +2 -0
- package/dist/shared/redaction.js +10 -0
- package/dist/shared/types.d.ts +1 -1
- package/dist/shared/volumeNames.d.ts +6 -0
- package/dist/shared/volumeNames.js +14 -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/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 +476 -0
- package/dist/target/dockerBaseImage.d.ts +2 -0
- package/dist/target/dockerBaseImage.js +11 -0
- package/dist/target/dockerCommandExecutor.d.ts +38 -0
- package/dist/target/dockerCommandExecutor.js +251 -0
- package/dist/target/dockerCommandExecutorCore.d.ts +35 -0
- package/dist/target/dockerCommandExecutorCore.js +275 -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 +83 -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 +53 -0
- package/dist/target/dockerTarget.js +48 -0
- package/dist/target/dockerTargetBinding.d.ts +13 -0
- package/dist/target/dockerTargetBinding.js +95 -0
- package/dist/target/dockerTargetExecFile.d.ts +19 -0
- package/dist/target/dockerTargetExecFile.js +194 -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 +64 -0
- package/dist/target/dockerWorldServiceProvider.js +330 -0
- package/dist/target/dockerWorldServiceStore.d.ts +73 -0
- package/dist/target/dockerWorldServiceStore.js +367 -0
- package/dist/target/evidenceExport.d.ts +57 -0
- package/dist/target/evidenceExport.js +527 -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 +87 -0
- package/dist/target/evidenceExportProvider.js +197 -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 +72 -0
- package/dist/target/publicArtifactSnapshot.js +184 -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/examples/README.md +45 -0
- package/examples/agent-with-subagents/AGENTS.md +3 -0
- package/examples/agent-with-subagents/Spawnfile +30 -0
- package/examples/agent-with-subagents/subagents/critic/AGENTS.md +3 -0
- package/examples/agent-with-subagents/subagents/critic/Spawnfile +15 -0
- package/examples/agent-with-subagents/subagents/researcher/AGENTS.md +3 -0
- package/examples/agent-with-subagents/subagents/researcher/Spawnfile +17 -0
- package/examples/daimon-org/Spawnfile +68 -0
- package/examples/daimon-org/TEAM.md +4 -0
- package/examples/daimon-org/agents/mapper/AGENTS.md +4 -0
- package/examples/daimon-org/agents/mapper/Spawnfile +37 -0
- package/examples/daimon-org/shared/skills/file-note/SKILL.md +9 -0
- package/examples/daimon-org/teams/review/Spawnfile +53 -0
- package/examples/daimon-org/teams/review/agents/reviewer/AGENTS.md +4 -0
- package/examples/daimon-org/teams/review/agents/reviewer/Spawnfile +37 -0
- package/examples/daimon-public-host/AGENTS.md +3 -0
- package/examples/daimon-public-host/Spawnfile +21 -0
- package/examples/distribution-org/Spawnfile +43 -0
- package/examples/distribution-org/TEAM.md +4 -0
- package/examples/distribution-org/agents/coordinator/AGENTS.md +1 -0
- package/examples/distribution-org/agents/coordinator/Spawnfile +20 -0
- package/examples/distribution-org/agents/researcher/AGENTS.md +1 -0
- package/examples/distribution-org/agents/researcher/Spawnfile +20 -0
- package/examples/jungian-daimon-org/Spawnfile +41 -0
- package/examples/jungian-daimon-org/TEAM.md +21 -0
- package/examples/jungian-daimon-org/teams/luna/Spawnfile +47 -0
- package/examples/jungian-daimon-org/teams/luna/TEAM.md +4 -0
- package/examples/jungian-daimon-org/teams/luna/agents/animus/AGENTS.md +10 -0
- package/examples/jungian-daimon-org/teams/luna/agents/animus/Spawnfile +33 -0
- package/examples/jungian-daimon-org/teams/luna/agents/representative/AGENTS.md +21 -0
- package/examples/jungian-daimon-org/teams/luna/agents/representative/Spawnfile +30 -0
- package/examples/jungian-daimon-org/teams/luna/agents/shadow/AGENTS.md +10 -0
- package/examples/jungian-daimon-org/teams/luna/agents/shadow/Spawnfile +33 -0
- package/examples/jungian-daimon-org/teams/selene/Spawnfile +47 -0
- package/examples/jungian-daimon-org/teams/selene/TEAM.md +4 -0
- package/examples/jungian-daimon-org/teams/selene/agents/animus/AGENTS.md +10 -0
- package/examples/jungian-daimon-org/teams/selene/agents/animus/Spawnfile +33 -0
- package/examples/jungian-daimon-org/teams/selene/agents/representative/AGENTS.md +19 -0
- package/examples/jungian-daimon-org/teams/selene/agents/representative/Spawnfile +33 -0
- package/examples/jungian-daimon-org/teams/selene/agents/shadow/AGENTS.md +10 -0
- package/examples/jungian-daimon-org/teams/selene/agents/shadow/Spawnfile +30 -0
- package/examples/mixed-runtime-org/Spawnfile +71 -0
- package/examples/mixed-runtime-org/TEAM.md +8 -0
- package/examples/mixed-runtime-org/agents/analyst/AGENTS.md +8 -0
- package/examples/mixed-runtime-org/agents/analyst/Spawnfile +27 -0
- package/examples/mixed-runtime-org/agents/conductor/AGENTS.md +8 -0
- package/examples/mixed-runtime-org/agents/conductor/Spawnfile +27 -0
- package/examples/mixed-runtime-org/agents/localist/AGENTS.md +7 -0
- package/examples/mixed-runtime-org/agents/localist/Spawnfile +50 -0
- package/examples/moltnet-team-chat/Spawnfile +43 -0
- package/examples/moltnet-team-chat/TEAM.md +5 -0
- package/examples/moltnet-team-chat/agents/coordinator/AGENTS.md +9 -0
- package/examples/moltnet-team-chat/agents/coordinator/Spawnfile +26 -0
- package/examples/moltnet-team-chat/teams/analysis/Spawnfile +23 -0
- package/examples/moltnet-team-chat/teams/analysis/TEAM.md +3 -0
- package/examples/moltnet-team-chat/teams/analysis/agents/observer/AGENTS.md +5 -0
- package/examples/moltnet-team-chat/teams/analysis/agents/observer/Spawnfile +19 -0
- package/examples/moltnet-team-chat/teams/analysis/agents/representative/AGENTS.md +5 -0
- package/examples/moltnet-team-chat/teams/analysis/agents/representative/Spawnfile +19 -0
- package/examples/moltnet-team-chat/teams/field/Spawnfile +41 -0
- package/examples/moltnet-team-chat/teams/field/TEAM.md +3 -0
- package/examples/moltnet-team-chat/teams/field/agents/observer/AGENTS.md +5 -0
- package/examples/moltnet-team-chat/teams/field/agents/observer/Spawnfile +26 -0
- package/examples/moltnet-team-chat/teams/field/agents/representative/AGENTS.md +11 -0
- package/examples/moltnet-team-chat/teams/field/agents/representative/Spawnfile +26 -0
- package/examples/single-agent/AGENTS.md +3 -0
- package/examples/single-agent/HEARTBEAT.md +3 -0
- package/examples/single-agent/IDENTITY.md +3 -0
- package/examples/single-agent/MEMORY.md +3 -0
- package/examples/single-agent/SOUL.md +3 -0
- package/examples/single-agent/Spawnfile +41 -0
- package/examples/single-agent/skills/web_search/SKILL.md +6 -0
- package/moltnet-releases.json +21 -0
- package/package.json +57 -14
- package/runtimes.yaml +11 -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,85 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createReadStream } from "node:fs";
|
|
3
|
+
import { copyFile, lstat, mkdir, readdir, realpath, chmod } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
export const within = (root, file) => file === root || file.startsWith(root + path.sep);
|
|
7
|
+
export const hashJson = (value) => `sha256:${createHash("sha256").update(JSON.stringify(value)).digest("hex")}`;
|
|
8
|
+
const ignored = new Set(["node_modules", ".venv", ".git", "__pycache__", "coverage", "coverage.json", ".coverage", ".pytest_cache", ".runtime", "AGENTS.md", "CLAUDE.md"]);
|
|
9
|
+
export function assertInputRoot(source, auth) {
|
|
10
|
+
const home = os.homedir();
|
|
11
|
+
if (["/", "/etc", "/var", "/run", "/tmp", "/opt", "/usr", "/Users", "/home", home].includes(source) ||
|
|
12
|
+
[".codex", ".claude", ".grok", ".ssh", ".config"].some(name => within(path.join(home, name), source)) ||
|
|
13
|
+
auth.some(leaf => within(source, leaf) || within(leaf, source)))
|
|
14
|
+
throw Error("Training input exposes a protected host root or auth leaf");
|
|
15
|
+
}
|
|
16
|
+
export async function exactPath(source) {
|
|
17
|
+
const absolute = path.resolve(source);
|
|
18
|
+
if (await realpath(absolute) !== absolute || (await lstat(absolute)).isSymbolicLink())
|
|
19
|
+
throw Error("Training source must be canonical, without symlink aliases");
|
|
20
|
+
return absolute;
|
|
21
|
+
}
|
|
22
|
+
export async function sealFile(source, destination) {
|
|
23
|
+
await exactPath(source);
|
|
24
|
+
const before = await lstat(source, { bigint: true });
|
|
25
|
+
if (!before.isFile() || before.size > 536870912n)
|
|
26
|
+
throw Error("Training source must be a regular file no larger than 512 MiB");
|
|
27
|
+
const digest = createHash("sha256");
|
|
28
|
+
let size = 0;
|
|
29
|
+
for await (const chunk of createReadStream(source)) {
|
|
30
|
+
size += chunk.length;
|
|
31
|
+
if (size > 536_870_912)
|
|
32
|
+
throw Error("Training source exceeded its size limit");
|
|
33
|
+
digest.update(chunk);
|
|
34
|
+
}
|
|
35
|
+
const after = await lstat(source, { bigint: true });
|
|
36
|
+
if (BigInt(size) !== before.size || after.size !== before.size || after.ino !== before.ino || after.ctimeNs !== before.ctimeNs || after.dev !== before.dev)
|
|
37
|
+
throw Error("Training source changed while hashing");
|
|
38
|
+
return { source, destination, sha256: `sha256:${digest.digest("hex")}`, mode: Number(before.mode & 511n), size };
|
|
39
|
+
}
|
|
40
|
+
/** Only explicitly selected trees are traversed. Symlinks never enter Docker context. */
|
|
41
|
+
export async function sealTree(source, destination, options = {}) {
|
|
42
|
+
await exactPath(source);
|
|
43
|
+
const files = [];
|
|
44
|
+
const walk = async (root, target, depth) => {
|
|
45
|
+
if (depth > 32 || files.length > 10000)
|
|
46
|
+
throw Error("Training source tree exceeds bounds");
|
|
47
|
+
let stat = await lstat(root);
|
|
48
|
+
if (stat.isSymbolicLink()) {
|
|
49
|
+
const actual = await realpath(root);
|
|
50
|
+
if (!options.internalSymlinks || !within(source, actual))
|
|
51
|
+
throw Error("Training source trees must not contain escaping symlinks");
|
|
52
|
+
root = actual;
|
|
53
|
+
stat = await lstat(root);
|
|
54
|
+
}
|
|
55
|
+
if (stat.isDirectory()) {
|
|
56
|
+
for (const entry of (await readdir(root)).sort()) {
|
|
57
|
+
if (options.ignoreGit && entry === ".git")
|
|
58
|
+
continue;
|
|
59
|
+
if (options.ignoreDevelopment && (ignored.has(entry) || /(?:\.test\.[cm]?[jt]s|_test\.py|\.pyc)$/u.test(entry)))
|
|
60
|
+
continue;
|
|
61
|
+
await walk(path.join(root, entry), path.posix.join(target, entry), depth + 1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
files.push(await sealFile(root, target));
|
|
66
|
+
};
|
|
67
|
+
await walk(source, destination, 0);
|
|
68
|
+
if (files.length > 10000 || files.reduce((sum, file) => sum + file.size, 0) > 1_073_741_824)
|
|
69
|
+
throw Error("Training source tree exceeds bounds");
|
|
70
|
+
return files;
|
|
71
|
+
}
|
|
72
|
+
export async function copySealed(files, root) {
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
const target = path.resolve(root, file.destination);
|
|
75
|
+
if (!within(root, target) || target === root)
|
|
76
|
+
throw Error("Training destination escapes owned staging");
|
|
77
|
+
await mkdir(path.dirname(target), { recursive: true, mode: 0o700 });
|
|
78
|
+
await copyFile(file.source, target, 1);
|
|
79
|
+
await chmod(target, file.mode);
|
|
80
|
+
const copied = await sealFile(target, file.destination);
|
|
81
|
+
if (copied.sha256 !== file.sha256 || copied.size !== file.size)
|
|
82
|
+
throw Error("Training source changed during staging");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export const fileIdentity = (files) => files.map(({ destination, sha256, mode, size }) => ({ destination, sha256, mode, size }));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TrainingDockerProcess } from "../container/process.js";
|
|
2
|
+
import type { TrainingImageBuild } from "./contract.js";
|
|
3
|
+
import { type SealedFile } from "./files.js";
|
|
4
|
+
export declare const trainingAssets: string;
|
|
5
|
+
export interface TrainingImagePlan {
|
|
6
|
+
digest: string;
|
|
7
|
+
files: SealedFile[];
|
|
8
|
+
dockerfile: string;
|
|
9
|
+
entry: string;
|
|
10
|
+
brokerEntry: string;
|
|
11
|
+
build: TrainingImageBuild;
|
|
12
|
+
}
|
|
13
|
+
export declare function planTrainingImage(build: TrainingImageBuild, root: string, auth: readonly string[], ownRoot?: string, declarationPath?: string): Promise<TrainingImagePlan>;
|
|
14
|
+
/** Cache is content-addressed and still requires a matching immutable image and label. */
|
|
15
|
+
export declare function buildTrainingImage(plan: TrainingImagePlan, options: {
|
|
16
|
+
parent: string;
|
|
17
|
+
dockerContext: string;
|
|
18
|
+
process: TrainingDockerProcess;
|
|
19
|
+
timeoutMs: number;
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
streams: {
|
|
22
|
+
stdout(line: string): void;
|
|
23
|
+
stderr(line: string): void;
|
|
24
|
+
};
|
|
25
|
+
}): Promise<{
|
|
26
|
+
imageId: string;
|
|
27
|
+
cached: boolean;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { assertInputRoot, copySealed, fileIdentity, hashJson, sealFile, sealTree } from "./files.js";
|
|
5
|
+
import { bindDaimonParentVerification, resolveTrainingDaimonParent } from "./daimonParent.js";
|
|
6
|
+
import { normalizeTrainingContext } from "./contextModes.js";
|
|
7
|
+
const packageRoot = fileURLToPath(new URL("../../../../", import.meta.url));
|
|
8
|
+
export const trainingAssets = path.extname(fileURLToPath(import.meta.url)) === ".ts"
|
|
9
|
+
? path.join(packageRoot, "runtime-images/training") : fileURLToPath(new URL("./assets/", import.meta.url));
|
|
10
|
+
async function packageFiles(root, target, withDist, lockSource = path.join(root, "package-lock.json")) {
|
|
11
|
+
const manifest = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
|
|
12
|
+
const lock = JSON.parse(await readFile(lockSource, "utf8"));
|
|
13
|
+
if (![2, 3].includes(lock.lockfileVersion) || !lock.packages?.[""] ||
|
|
14
|
+
JSON.stringify(manifest.dependencies ?? {}) !== JSON.stringify(lock.packages[""].dependencies ?? {}))
|
|
15
|
+
throw Error(`Training package manifest/lock mismatch: ${target}`);
|
|
16
|
+
if (Object.values(lock.packages).some(entry => {
|
|
17
|
+
const item = entry;
|
|
18
|
+
return item.link || item.resolved?.startsWith("file:") || item.resolved?.startsWith("../");
|
|
19
|
+
}))
|
|
20
|
+
throw Error(`Training package ${target} has unsupported local dependencies; provide a complete registry-locked distribution`);
|
|
21
|
+
return [await sealFile(path.join(root, "package.json"), `${target}/package.json`),
|
|
22
|
+
await sealFile(lockSource, `${target}/package-lock.json`),
|
|
23
|
+
...withDist ? await sealTree(path.join(root, "dist"), `${target}/dist`, { ignoreDevelopment: true }) : []];
|
|
24
|
+
}
|
|
25
|
+
export async function planTrainingImage(build, root, auth, ownRoot = packageRoot, declarationPath = root) {
|
|
26
|
+
const resolve = (value) => path.resolve(root, value);
|
|
27
|
+
// Before any Docker call, including --dry-run: the attested Daimon runtime identity
|
|
28
|
+
// and the declared native parent must name one rebuild (see daimonParent.ts).
|
|
29
|
+
const daimonParent = await resolveTrainingDaimonParent(build, declarationPath);
|
|
30
|
+
for (const source of [build.paideia, build.bridge, build.claude, build.integration.source, ...build.compiler ? [build.compiler] : [], ...build.bootstrap ? [build.bootstrap] : []])
|
|
31
|
+
assertInputRoot(resolve(source), auth);
|
|
32
|
+
const assets = ownRoot === packageRoot ? trainingAssets : path.join(ownRoot, "runtime-images/training");
|
|
33
|
+
const recipe = await readFile(path.join(assets, "Dockerfile"), "utf8");
|
|
34
|
+
const dockerfile = daimonParent ? bindDaimonParentVerification(recipe, daimonParent) : recipe;
|
|
35
|
+
const ownLock = path.extname(fileURLToPath(import.meta.url)) === ".ts" || ownRoot !== packageRoot
|
|
36
|
+
? path.join(ownRoot, "package-lock.json") : path.join(assets, "package-lock.json");
|
|
37
|
+
const files = [
|
|
38
|
+
...await packageFiles(resolve(build.paideia), "paideia", true),
|
|
39
|
+
...await packageFiles(ownRoot, "spawnfile", true, ownLock),
|
|
40
|
+
...await packageFiles(build.compiler ? resolve(build.compiler) : ownRoot, "compiler", true, build.compiler ? path.join(resolve(build.compiler), "package-lock.json") : ownLock),
|
|
41
|
+
...await packageFiles(resolve(build.claude), "claude", false),
|
|
42
|
+
...await sealTree(resolve(build.bridge), "bridge", { ignoreDevelopment: true }),
|
|
43
|
+
...await sealTree(resolve(build.integration.source), "integration", { ignoreDevelopment: true }),
|
|
44
|
+
...build.bootstrap ? await sealTree(resolve(build.bootstrap), "bootstrap", { ignoreDevelopment: true }) : [],
|
|
45
|
+
await sealFile(path.join(ownRoot, "runtimes.yaml"), "spawnfile/runtimes.yaml"),
|
|
46
|
+
await sealFile(path.join(ownRoot, "moltnet-releases.json"), "spawnfile/moltnet-releases.json"),
|
|
47
|
+
...await Promise.all(["runtimes.yaml", "moltnet-releases.json"].map(name => sealFile(path.join(build.compiler ? resolve(build.compiler) : ownRoot, name), `compiler/${name}`)))
|
|
48
|
+
];
|
|
49
|
+
for (const required of [`integration/${build.integration.entry}`, "bridge/pyproject.toml", "bridge/requirements.lock", "bridge/paideia_dspy/__init__.py", "paideia/dist/src/cli/main.js", "spawnfile/dist/cli/index.js", "compiler/dist/cli/index.js"]) {
|
|
50
|
+
if (!files.some(file => file.destination === required))
|
|
51
|
+
throw Error(`Training distribution is missing ${required}`);
|
|
52
|
+
}
|
|
53
|
+
const entry = `#!/bin/sh\nexec /usr/local/bin/node --experimental-strip-types ${JSON.stringify(`/opt/training/integration/${build.integration.entry}`)} "$@"\n`;
|
|
54
|
+
// The broker-capable entrypoint is the image's own Spawnfile distribution, never a host-written script.
|
|
55
|
+
const brokerEntry = `#!/bin/sh\nexec /usr/local/bin/node /opt/training/spawnfile/dist/compiler/training/broker/main.js "$@"\n`;
|
|
56
|
+
const digest = hashJson({ recipe: build.recipe, nativeImage: build.nativeImage, pythonImage: build.pythonImage, platform: build.platform,
|
|
57
|
+
files: fileIdentity(files), dockerfile, entry, brokerEntry });
|
|
58
|
+
return { digest, files, dockerfile, entry, brokerEntry, build };
|
|
59
|
+
}
|
|
60
|
+
/** Cache is content-addressed and still requires a matching immutable image and label. */
|
|
61
|
+
export async function buildTrainingImage(plan, options) {
|
|
62
|
+
const tag = `spawnfile-training:${plan.digest.slice(7)}`;
|
|
63
|
+
const call = (args, stream = false) => options.process(["--context", options.dockerContext, ...args], {
|
|
64
|
+
timeoutMs: options.timeoutMs, signal: options.signal, ...stream ? options.streams : {}
|
|
65
|
+
});
|
|
66
|
+
const inspect = async () => {
|
|
67
|
+
const result = await call(["image", "inspect", tag, "--format", '{{json .Id}}\n{{json (index .Config.Labels "com.spawnfile.training.recipe")}}']);
|
|
68
|
+
if (result.code !== 0)
|
|
69
|
+
return undefined;
|
|
70
|
+
try {
|
|
71
|
+
const [id, digest] = result.stdout.trim().split("\n").map(line => JSON.parse(line));
|
|
72
|
+
return /^sha256:[a-f0-9]{64}$/u.test(id) && digest === plan.digest ? id : undefined;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const cached = await inspect();
|
|
79
|
+
if (cached)
|
|
80
|
+
return { imageId: cached, cached: true };
|
|
81
|
+
const staging = await mkdtemp(path.join(options.parent, ".spawnfile-training-image-"));
|
|
82
|
+
try {
|
|
83
|
+
await copySealed(plan.files, staging);
|
|
84
|
+
await mkdir(path.join(staging, "bootstrap"), { recursive: true, mode: 0o700 });
|
|
85
|
+
await writeFile(path.join(staging, "Dockerfile"), `${plan.dockerfile}\nLABEL com.spawnfile.training.recipe=${JSON.stringify(plan.digest)}\n`, { mode: 0o600 });
|
|
86
|
+
await writeFile(path.join(staging, "train"), plan.entry, { mode: 0o755 });
|
|
87
|
+
await writeFile(path.join(staging, "train-broker"), plan.brokerEntry, { mode: 0o755 });
|
|
88
|
+
// Last, after every staged file exists: it fixes the modes and mtimes COPY will reproduce in the image.
|
|
89
|
+
await normalizeTrainingContext(staging);
|
|
90
|
+
const result = await call(["build", "--platform", plan.build.platform, "--build-arg", `NATIVE_IMAGE=${plan.build.nativeImage}`,
|
|
91
|
+
"--build-arg", `PYTHON_IMAGE=${plan.build.pythonImage}`, "--tag", tag, staging], true);
|
|
92
|
+
if (result.code !== 0)
|
|
93
|
+
throw Error("Training image build failed; inspect the streamed build diagnostic");
|
|
94
|
+
const imageId = await inspect();
|
|
95
|
+
if (!imageId)
|
|
96
|
+
throw Error("Training image build did not produce a verified immutable image");
|
|
97
|
+
return { imageId, cached: false };
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
await rm(staging, { recursive: true, force: true });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TrainingPreparationConfig } from "./contract.js";
|
|
2
|
+
import { type SealedFile } from "./files.js";
|
|
3
|
+
export interface PlannedInput {
|
|
4
|
+
id: string;
|
|
5
|
+
source: string;
|
|
6
|
+
destination: string;
|
|
7
|
+
digest: string;
|
|
8
|
+
files?: SealedFile[];
|
|
9
|
+
git?: {
|
|
10
|
+
revision: string;
|
|
11
|
+
tree: string;
|
|
12
|
+
common: string;
|
|
13
|
+
overlays: SealedFile[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function planInputs(config: TrainingPreparationConfig, root: string, auth: string[]): Promise<PlannedInput[]>;
|
|
17
|
+
/** A real self-contained Git object store, never a copied worktree pointer. */
|
|
18
|
+
export declare function stageInput(input: PlannedInput, target: string): Promise<string>;
|
|
19
|
+
export declare function verifyCanonicalPins(inputs: PlannedInput[], sources: readonly {
|
|
20
|
+
sourcePath: string;
|
|
21
|
+
sha256: string;
|
|
22
|
+
}[], staged: readonly string[]): Promise<void>;
|
|
23
|
+
export declare function readBoundedJson(file: string): Promise<unknown>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
import { assertInputRoot, copySealed, exactPath, fileIdentity, hashJson, sealFile, sealTree } from "./files.js";
|
|
7
|
+
const execute = promisify(execFile);
|
|
8
|
+
const git = async (cwd, args) => {
|
|
9
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => !name.startsWith("GIT_")));
|
|
10
|
+
return (await execute("git", ["-c", "core.hooksPath=/dev/null", "-c", "core.fsmonitor=false", ...args], {
|
|
11
|
+
cwd, env: { ...env, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: "/dev/null", GIT_ATTR_NOSYSTEM: "1", GIT_TERMINAL_PROMPT: "0" },
|
|
12
|
+
timeout: 120000, maxBuffer: 8 * 1024 * 1024
|
|
13
|
+
})).stdout;
|
|
14
|
+
};
|
|
15
|
+
export async function planInputs(config, root, auth) {
|
|
16
|
+
return Promise.all(config.inputs.map(async (input) => {
|
|
17
|
+
const source = await exactPath(path.resolve(root, input.source));
|
|
18
|
+
assertInputRoot(source, auth);
|
|
19
|
+
if (input.include) {
|
|
20
|
+
const files = [];
|
|
21
|
+
for (const selected of input.include)
|
|
22
|
+
files.push(...await sealTree(path.join(source, selected), selected, { internalSymlinks: true }));
|
|
23
|
+
if (new Set(files.map(file => file.destination)).size !== files.length)
|
|
24
|
+
throw Error("Selected training input paths overlap");
|
|
25
|
+
return { id: input.id, source, destination: input.destination, files, digest: hashJson(fileIdentity(files)) };
|
|
26
|
+
}
|
|
27
|
+
if (!input.git)
|
|
28
|
+
return { id: input.id, source, destination: input.destination, digest: hashJson(fileIdentity(await sealTree(source, "input", { ignoreGit: true, internalSymlinks: true }))) };
|
|
29
|
+
if ((await git(source, ["rev-parse", "--show-prefix"])).trim())
|
|
30
|
+
throw Error("Pinned Git input source must be a repository root");
|
|
31
|
+
const common = await exactPath((await git(source, ["rev-parse", "--path-format=absolute", "--git-common-dir"])).trim());
|
|
32
|
+
const tree = (await git(source, ["rev-parse", `${input.git.revision}^{tree}`])).trim();
|
|
33
|
+
const entries = (await git(source, ["ls-tree", "-rz", "--full-tree", input.git.revision])).split("\0").filter(Boolean);
|
|
34
|
+
if (!/^[a-f0-9]{40}$/u.test(tree) || entries.some(entry => !/^(100644|100755|120000) blob [a-f0-9]{40}\t/u.test(entry)))
|
|
35
|
+
throw Error("Pinned Git inputs require regular files or confined links; submodules are unsupported");
|
|
36
|
+
for (const entry of entries.filter(entry => entry.startsWith("120000"))) {
|
|
37
|
+
const split = entry.indexOf("\t"), file = entry.slice(split + 1), object = entry.slice(0, split).split(" ")[2];
|
|
38
|
+
const link = (await git(source, ["cat-file", "blob", object])).trim();
|
|
39
|
+
const target = path.posix.normalize(path.posix.join(path.posix.dirname(file), link));
|
|
40
|
+
if (!link || path.posix.isAbsolute(link) || link.includes("\\") || target === ".." || target.startsWith("../") || target.split("/").includes(".git"))
|
|
41
|
+
throw Error("Git symlink escapes the pinned input tree");
|
|
42
|
+
}
|
|
43
|
+
const overlays = [];
|
|
44
|
+
for (const overlay of input.git.overlays) {
|
|
45
|
+
const overlaySource = path.resolve(root, overlay.source);
|
|
46
|
+
assertInputRoot(overlaySource, auth);
|
|
47
|
+
const file = await sealFile(overlaySource, overlay.path);
|
|
48
|
+
if (file.sha256 !== overlay.sha256 || overlays.some(previous => previous.destination === file.destination))
|
|
49
|
+
throw Error("Git overlay digest mismatch or duplicate destination");
|
|
50
|
+
overlays.push(file);
|
|
51
|
+
}
|
|
52
|
+
return { id: input.id, source, destination: input.destination, git: { revision: input.git.revision, tree, common, overlays },
|
|
53
|
+
digest: hashJson({ revision: input.git.revision, tree, overlays: fileIdentity(overlays) }) };
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
/** A real self-contained Git object store, never a copied worktree pointer. */
|
|
57
|
+
export async function stageInput(input, target) {
|
|
58
|
+
if (input.files) {
|
|
59
|
+
await mkdir(target, { mode: 0o700 });
|
|
60
|
+
await copySealed(input.files, target);
|
|
61
|
+
return target;
|
|
62
|
+
}
|
|
63
|
+
if (!input.git)
|
|
64
|
+
return input.source;
|
|
65
|
+
await mkdir(target, { mode: 0o700 });
|
|
66
|
+
await git(target, ["init", "--quiet", "--template="]);
|
|
67
|
+
await git(target, ["-c", "protocol.file.allow=always", "fetch", "--quiet", "--depth=1", pathToFileURL(input.git.common).href, input.git.revision]);
|
|
68
|
+
await git(target, ["-c", "advice.detachedHead=false", "checkout", "--quiet", "--detach", input.git.revision]);
|
|
69
|
+
if ((await git(target, ["rev-parse", "HEAD^{tree}"])).trim() !== input.git.tree ||
|
|
70
|
+
(await git(target, ["rev-parse", "--path-format=absolute", "--git-common-dir"])).trim() !== path.join(target, ".git"))
|
|
71
|
+
throw Error("Git training snapshot identity mismatch");
|
|
72
|
+
await git(target, ["fsck", "--full", "--no-dangling"]);
|
|
73
|
+
await copySealed(input.git.overlays, target);
|
|
74
|
+
return target;
|
|
75
|
+
}
|
|
76
|
+
export async function verifyCanonicalPins(inputs, sources, staged) {
|
|
77
|
+
for (const source of sources) {
|
|
78
|
+
const index = inputs.findIndex(input => source.sourcePath === input.source || source.sourcePath.startsWith(input.source + path.sep));
|
|
79
|
+
if (index < 0)
|
|
80
|
+
throw Error("Canonical training source is outside declared inputs");
|
|
81
|
+
if (!inputs[index].git && !inputs[index].files)
|
|
82
|
+
continue;
|
|
83
|
+
const file = path.join(staged[index], path.relative(inputs[index].source, source.sourcePath));
|
|
84
|
+
if ((await sealFile(file, "pin")).sha256 !== source.sha256)
|
|
85
|
+
throw Error("Pinned Git snapshot differs from the selected canonical agent");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export async function readBoundedJson(file) {
|
|
89
|
+
const source = await readFile(file, "utf8");
|
|
90
|
+
if (Buffer.byteLength(source) > 1024 * 1024)
|
|
91
|
+
throw Error("Training preparation JSON exceeds 1 MiB");
|
|
92
|
+
return JSON.parse(source);
|
|
93
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TrainingContext } from "../contract.js";
|
|
2
|
+
import type { TrainingDockerProcess } from "../container/process.js";
|
|
3
|
+
export interface PrepareTrainingOptions {
|
|
4
|
+
configPath: string;
|
|
5
|
+
context: TrainingContext;
|
|
6
|
+
args: readonly string[];
|
|
7
|
+
dryRun: boolean;
|
|
8
|
+
process: TrainingDockerProcess;
|
|
9
|
+
timeoutMs: number;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
streams: {
|
|
12
|
+
stdout(line: string): void;
|
|
13
|
+
stderr(line: string): void;
|
|
14
|
+
};
|
|
15
|
+
/** Test-only package fixture; production always resolves its own installed distribution. */
|
|
16
|
+
packageRoot?: string;
|
|
17
|
+
repairMeasurements?: string;
|
|
18
|
+
repairWitness?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PreparedTraining {
|
|
21
|
+
digest: string;
|
|
22
|
+
image: string;
|
|
23
|
+
configPath: string;
|
|
24
|
+
preparationPath: string;
|
|
25
|
+
repairPath?: string;
|
|
26
|
+
context: TrainingContext;
|
|
27
|
+
args: string[];
|
|
28
|
+
}
|
|
29
|
+
/** Reads only until the explicit dry-run boundary; preparation never executes project code. */
|
|
30
|
+
export declare function prepareTraining(options: PrepareTrainingOptions): Promise<PreparedTraining | {
|
|
31
|
+
digest: string;
|
|
32
|
+
dryRun: true;
|
|
33
|
+
}>;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { lstat, mkdir, readFile, realpath, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { trainingContainerConfigSchema } from "../container/contract.js";
|
|
4
|
+
import { trainingPreparationSchema, parseTrainingMappedPreparation } from "./contract.js";
|
|
5
|
+
import { assertInputRoot, exactPath, fileIdentity, hashJson, sealTree, within } from "./files.js";
|
|
6
|
+
import { planInputs, readBoundedJson, stageInput, verifyCanonicalPins } from "./inputs.js";
|
|
7
|
+
import { planTrainingImage, buildTrainingImage } from "./image.js";
|
|
8
|
+
import { planMeasurementRepair, stageMeasurementRepair, writeTrainingWitness } from "../repair/index.js";
|
|
9
|
+
import { prepareTrainingBroker } from "./broker.js";
|
|
10
|
+
import { claimTrainingPreparationScratch } from "./scratch.js";
|
|
11
|
+
function mappedReceipt(digest, image, config) {
|
|
12
|
+
return parseTrainingMappedPreparation({ version: "spawnfile.training-preparation.v1", preparationDigest: digest, imageId: image,
|
|
13
|
+
bindings: config.inputs.map(input => ({ inputId: input.id, destination: input.destination })), outputRoot: "/run/training/output",
|
|
14
|
+
packagePaths: { spawnfile: "build" in config.image && config.image.build.compiler
|
|
15
|
+
? "/opt/training/compiler/dist/cli/index.js" : "/opt/training/spawnfile/dist/cli/index.js", paideia: "/opt/training/paideia", bridge: "/opt/training/paideia/bridges/dspy",
|
|
16
|
+
nativeWorker: "/opt/training/paideia/dist/src/adapters/daimon-native", integration: "/opt/training/integration", bootstrap: "/opt/training/bootstrap" }, integration: config.integration });
|
|
17
|
+
}
|
|
18
|
+
/** Reads only until the explicit dry-run boundary; preparation never executes project code. */
|
|
19
|
+
export async function prepareTraining(options) {
|
|
20
|
+
const config = trainingPreparationSchema.parse(await readBoundedJson(options.configPath));
|
|
21
|
+
// A v2 declaration still lowers to the unchanged v1 launch config; only v3 carries a broker slot into Docker.
|
|
22
|
+
const launchVersion = config.version === "spawnfile.training-container.v3" ? config.version : "spawnfile.training-container.v1";
|
|
23
|
+
const root = path.dirname(path.resolve(options.configPath));
|
|
24
|
+
const auth = config.auth.map(entry => ({ ...entry, source: path.resolve(root, entry.source) }));
|
|
25
|
+
const output = path.resolve(root, config.output.source), parent = path.dirname(output);
|
|
26
|
+
for (let index = 0; index < options.args.length; index++) {
|
|
27
|
+
if (options.args[index] !== "--out")
|
|
28
|
+
continue;
|
|
29
|
+
const declared = options.args[++index];
|
|
30
|
+
if (declared === undefined || path.resolve(declared) !== output)
|
|
31
|
+
throw Error("Training --out must match configured output");
|
|
32
|
+
}
|
|
33
|
+
assertInputRoot(output, auth.map(entry => entry.source));
|
|
34
|
+
if (await realpath(parent) !== parent)
|
|
35
|
+
throw Error("Training output parent must be canonical and already exist");
|
|
36
|
+
const inputs = await planInputs(config, root, auth.map(entry => entry.source));
|
|
37
|
+
const roots = inputs.map(input => input.source);
|
|
38
|
+
for (let index = 0; index < inputs.length; index++) {
|
|
39
|
+
const input = inputs[index];
|
|
40
|
+
if (within(input.source, output) || within(output, input.source))
|
|
41
|
+
throw Error("Training output overlaps readonly input");
|
|
42
|
+
for (const other of inputs.slice(index + 1))
|
|
43
|
+
if (within(input.source, other.source) || within(other.source, input.source) ||
|
|
44
|
+
within(input.destination, other.destination) || within(other.destination, input.destination))
|
|
45
|
+
throw Error("Training inputs overlap");
|
|
46
|
+
}
|
|
47
|
+
const imagePlan = "build" in config.image
|
|
48
|
+
? await planTrainingImage(config.image.build, root, auth.map(entry => entry.source), options.packageRoot, path.resolve(options.configPath))
|
|
49
|
+
: undefined;
|
|
50
|
+
if (options.repairWitness && !options.repairMeasurements)
|
|
51
|
+
throw Error("A repair witness requires --repair-measurements");
|
|
52
|
+
if (options.repairMeasurements && !imagePlan)
|
|
53
|
+
throw Error("Measurement repair requires a verifiable image build recipe");
|
|
54
|
+
const repair = options.repairMeasurements ? await planMeasurementRepair({ parent: options.repairMeasurements,
|
|
55
|
+
witness: options.repairWitness, output, auth: auth.map(entry => entry.source), image: imagePlan, inputs,
|
|
56
|
+
context: options.context, resume: options.args.includes("--resume") }) : undefined;
|
|
57
|
+
if (repair && hashJson(config.integration) !== hashJson(repair.witness.manifest.config.integration))
|
|
58
|
+
throw Error("Repair integration settings binding changed");
|
|
59
|
+
const digest = hashJson({ config, sources: inputs.map(input => ({ id: input.id, digest: input.digest })), image: imagePlan?.digest ?? config.image,
|
|
60
|
+
canonical: options.context.project.sourceDigest, ...(repair ? { repair: { witness: repair.witness.digest, parent: repair.manifestDigest } } : {}) });
|
|
61
|
+
if (config.broker)
|
|
62
|
+
await prepareTrainingBroker(config.broker, root, path.dirname(path.resolve(options.configPath)), false);
|
|
63
|
+
if (options.dryRun)
|
|
64
|
+
return { digest, dryRun: true };
|
|
65
|
+
options.signal?.throwIfAborted();
|
|
66
|
+
for (const entry of auth)
|
|
67
|
+
if (await exactPath(entry.source) !== entry.source || !(await lstat(entry.source)).isFile())
|
|
68
|
+
throw Error("Training auth must be a canonical regular leaf");
|
|
69
|
+
const execute = (args) => options.process(args, { timeoutMs: options.timeoutMs, signal: options.signal });
|
|
70
|
+
const endpoint = await execute(["context", "inspect", config.dockerContext, "--format", "{{json .Endpoints.docker.Host}}"]);
|
|
71
|
+
if (endpoint.code !== 0 || !/^unix:\/\//u.test(JSON.parse(endpoint.stdout)))
|
|
72
|
+
throw Error("Training preparation requires a local Unix Docker context");
|
|
73
|
+
if (repair) {
|
|
74
|
+
const label = await execute(["--context", config.dockerContext, "image", "inspect", repair.witness.manifest.parentImage,
|
|
75
|
+
"--format", '{{json .Id}}\n{{json (index .Config.Labels "com.spawnfile.training.recipe")}}']);
|
|
76
|
+
const values = label.stdout.trim().split("\n").map(value => JSON.parse(value));
|
|
77
|
+
if (label.code !== 0 || values[0] !== repair.witness.manifest.parentImage || values[1] !== repair.witness.manifest.imagePlanDigest)
|
|
78
|
+
throw Error("Parent image recipe witness is unverified");
|
|
79
|
+
}
|
|
80
|
+
const staging = path.join(parent, `.spawnfile-training-preparation-${hashJson(output).slice(7, 23)}`);
|
|
81
|
+
const configPath = path.join(staging, "launch.json"), preparationPath = path.join(staging, "mapped.json"), statePath = path.join(staging, "state.json");
|
|
82
|
+
const resume = options.args.includes("--resume");
|
|
83
|
+
let image, staged;
|
|
84
|
+
if (resume) {
|
|
85
|
+
const previous = JSON.parse(await readFile(statePath, "utf8"));
|
|
86
|
+
if (previous.digest !== digest || !/^sha256:[a-f0-9]{64}$/u.test(previous.image) ||
|
|
87
|
+
JSON.stringify(previous.staged) !== JSON.stringify(inputs.map(input => input.git || input.files ? path.join(staging, input.id) : input.source)))
|
|
88
|
+
throw Error("Training preparation changed; exact resume rejected");
|
|
89
|
+
image = previous.image;
|
|
90
|
+
staged = previous.staged;
|
|
91
|
+
const snapshots = await Promise.all(inputs.map(async (input, index) => input.git || input.files ? hashJson(fileIdentity(await sealTree(staged[index], "input", { ignoreGit: true, internalSymlinks: true }))) : null));
|
|
92
|
+
if (JSON.stringify(previous.snapshots) !== JSON.stringify(snapshots))
|
|
93
|
+
throw Error("Persisted training input snapshot changed");
|
|
94
|
+
const mapped = parseTrainingMappedPreparation(await readBoundedJson(preparationPath));
|
|
95
|
+
if (mapped.preparationDigest !== digest || mapped.imageId !== image)
|
|
96
|
+
throw Error("Persisted training preparation identity mismatch");
|
|
97
|
+
await verifyCanonicalPins(inputs, options.context.sources, staged);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
let owned = false;
|
|
101
|
+
try {
|
|
102
|
+
await claimTrainingPreparationScratch(staging, digest, options.streams.stderr);
|
|
103
|
+
owned = true;
|
|
104
|
+
try {
|
|
105
|
+
await mkdir(output, { mode: 0o700 });
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (error.code !== "EEXIST" || !(await lstat(output)).isDirectory() || await realpath(output) !== output)
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
staged = await Promise.all(inputs.map(input => stageInput(input, path.join(staging, input.id))));
|
|
112
|
+
await verifyCanonicalPins(inputs, options.context.sources, staged);
|
|
113
|
+
image = imagePlan ? (await buildTrainingImage(imagePlan, { parent, dockerContext: config.dockerContext, process: options.process,
|
|
114
|
+
timeoutMs: options.timeoutMs, signal: options.signal, streams: options.streams })).imageId : "ref" in config.image ? config.image.ref : "";
|
|
115
|
+
if (!image.startsWith("sha256:")) {
|
|
116
|
+
const inspected = await execute(["--context", config.dockerContext, "image", "inspect", image, "--format", "{{.Id}}"]);
|
|
117
|
+
if (inspected.code !== 0)
|
|
118
|
+
throw Error("Training image is unavailable");
|
|
119
|
+
image = inspected.stdout.trim();
|
|
120
|
+
}
|
|
121
|
+
const mapped = mappedReceipt(digest, image, config);
|
|
122
|
+
const preparedBroker = config.broker ? await prepareTrainingBroker(config.broker, root, staging, true) : undefined;
|
|
123
|
+
const launch = trainingContainerConfigSchema.parse({ version: launchVersion, dockerContext: config.dockerContext,
|
|
124
|
+
inputs: inputs.map((input, index) => ({ source: staged[index], destination: input.destination })), output: { source: output, destination: "/run/training/output" }, auth,
|
|
125
|
+
...(preparedBroker ? { broker: preparedBroker.launch } : {}) });
|
|
126
|
+
await writeFile(configPath, JSON.stringify(launch), { flag: "wx", mode: 0o600 });
|
|
127
|
+
await writeFile(preparationPath, JSON.stringify(parseTrainingMappedPreparation(mapped)), { flag: "wx", mode: 0o400 });
|
|
128
|
+
const snapshots = await Promise.all(inputs.map(async (input, index) => input.git || input.files ? hashJson(fileIdentity(await sealTree(staged[index], "input", { ignoreGit: true, internalSymlinks: true }))) : null));
|
|
129
|
+
await writeFile(statePath, JSON.stringify({ digest, image, staged, snapshots }), { flag: "wx", mode: 0o600 });
|
|
130
|
+
if (imagePlan)
|
|
131
|
+
await writeTrainingWitness({ directory: staging, digest, image, config, context: options.context,
|
|
132
|
+
args: options.args, inputs, staged, snapshots, plan: imagePlan,
|
|
133
|
+
...(repair ? { repair: { witness: repair.witness.digest, parent: repair.manifestDigest } } : {}) });
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (owned)
|
|
137
|
+
await rm(staging, { recursive: true, force: true });
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const expectedBroker = config.broker ? await prepareTrainingBroker(config.broker, root, staging, false) : undefined;
|
|
142
|
+
const expectedLaunch = trainingContainerConfigSchema.parse({ version: launchVersion, dockerContext: config.dockerContext,
|
|
143
|
+
inputs: inputs.map((input, index) => ({ source: staged[index], destination: input.destination })), output: { source: output, destination: "/run/training/output" }, auth,
|
|
144
|
+
...(expectedBroker ? { broker: expectedBroker.launch } : {}) });
|
|
145
|
+
if (hashJson(await readBoundedJson(configPath)) !== hashJson(expectedLaunch) ||
|
|
146
|
+
hashJson(await readBoundedJson(preparationPath)) !== hashJson(mappedReceipt(digest, image, config)))
|
|
147
|
+
throw Error("Saved training launch or mapped receipt changed");
|
|
148
|
+
const inspected = await execute(["--context", config.dockerContext, "image", "inspect", image, "--format", "{{.Id}}"]);
|
|
149
|
+
if (inspected.code !== 0 || inspected.stdout.trim() !== image)
|
|
150
|
+
throw Error("Saved training image is missing or changed");
|
|
151
|
+
const map = (file) => {
|
|
152
|
+
const absolute = path.resolve(file);
|
|
153
|
+
const index = roots.findIndex(source => within(source, absolute));
|
|
154
|
+
return index < 0 ? absolute : path.join(staged[index], path.relative(roots[index], absolute));
|
|
155
|
+
};
|
|
156
|
+
const context = { ...options.context,
|
|
157
|
+
project: { ...options.context.project, root: map(options.context.project.root), manifest: map(options.context.project.manifest) },
|
|
158
|
+
agent: { ...options.context.agent, source: map(options.context.agent.source) },
|
|
159
|
+
sources: options.context.sources.map(source => ({ ...source, sourcePath: map(source.sourcePath) })),
|
|
160
|
+
documents: options.context.documents.map(source => ({ ...source, sourcePath: map(source.sourcePath) })),
|
|
161
|
+
skills: options.context.skills.map(source => ({ ...source, sourcePath: map(source.sourcePath) })) };
|
|
162
|
+
const args = [...options.args];
|
|
163
|
+
for (let index = 0; index < args.length; index++) {
|
|
164
|
+
if (["--train", "--test", "--cost-config"].includes(args[index]))
|
|
165
|
+
args[++index] = map(args[index]);
|
|
166
|
+
else if (args[index] === "--resource") {
|
|
167
|
+
const value = args[++index], split = value.indexOf("=");
|
|
168
|
+
args[index] = `${value.slice(0, split)}=${map(value.slice(split + 1))}`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (repair) {
|
|
172
|
+
const projected = await stageMeasurementRepair(repair, staging, image, options.context.project.sourceDigest, resume);
|
|
173
|
+
const repairLaunch = { ...expectedLaunch, inputs: [...expectedLaunch.inputs,
|
|
174
|
+
{ source: projected.root, destination: "/run/training/inputs/repair-parent" }] };
|
|
175
|
+
const repairConfig = path.join(staging, "repair-launch.json");
|
|
176
|
+
if (resume) {
|
|
177
|
+
if (hashJson(await readBoundedJson(repairConfig)) !== hashJson(repairLaunch))
|
|
178
|
+
throw Error("Saved repair launch changed");
|
|
179
|
+
}
|
|
180
|
+
else
|
|
181
|
+
await writeFile(repairConfig, JSON.stringify(repairLaunch), { flag: "wx", mode: 0o600 });
|
|
182
|
+
return { digest, image, configPath: repairConfig, preparationPath, repairPath: projected.repairPath, context,
|
|
183
|
+
args: [...args, "--repair-measurements", "/run/training/inputs/repair-parent", "--repair-context", "/run/paideia/repair.json"] };
|
|
184
|
+
}
|
|
185
|
+
return { digest, image, configPath, preparationPath, context, args };
|
|
186
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claims the private preparation scratch directory for one launch.
|
|
3
|
+
*
|
|
4
|
+
* A launch that fails anywhere past staging — a failed build, a container that
|
|
5
|
+
* aborted in its entrypoint — leaves this directory behind, and the next
|
|
6
|
+
* attempt used to die on `EEXIST: mkdir '.spawnfile-training-preparation-…'`
|
|
7
|
+
* before it could report anything useful. A live P8 run lost its second attempt
|
|
8
|
+
* to exactly that.
|
|
9
|
+
*
|
|
10
|
+
* Leftovers from the *same* preparation are reclaimed: `state.json` records the
|
|
11
|
+
* preparation digest, which pins the config, every input identity, the image
|
|
12
|
+
* plan and the canonical source digest, so a matching one can only have staged
|
|
13
|
+
* the same bytes and nothing is lost by staging them again (the image is
|
|
14
|
+
* content-addressed and resolves from its tag). Anything else — a different
|
|
15
|
+
* digest, or a run that aborted before it wrote its state — is left untouched
|
|
16
|
+
* and reported by name, because only the operator can know whether it is
|
|
17
|
+
* wanted or whether another launch is still using it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const claimTrainingPreparationScratch: (staging: string, digest: string, notify: (line: string) => void) => Promise<void>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { lstat, mkdir, readFile, realpath, rm } from "node:fs/promises";
|
|
2
|
+
/**
|
|
3
|
+
* Claims the private preparation scratch directory for one launch.
|
|
4
|
+
*
|
|
5
|
+
* A launch that fails anywhere past staging — a failed build, a container that
|
|
6
|
+
* aborted in its entrypoint — leaves this directory behind, and the next
|
|
7
|
+
* attempt used to die on `EEXIST: mkdir '.spawnfile-training-preparation-…'`
|
|
8
|
+
* before it could report anything useful. A live P8 run lost its second attempt
|
|
9
|
+
* to exactly that.
|
|
10
|
+
*
|
|
11
|
+
* Leftovers from the *same* preparation are reclaimed: `state.json` records the
|
|
12
|
+
* preparation digest, which pins the config, every input identity, the image
|
|
13
|
+
* plan and the canonical source digest, so a matching one can only have staged
|
|
14
|
+
* the same bytes and nothing is lost by staging them again (the image is
|
|
15
|
+
* content-addressed and resolves from its tag). Anything else — a different
|
|
16
|
+
* digest, or a run that aborted before it wrote its state — is left untouched
|
|
17
|
+
* and reported by name, because only the operator can know whether it is
|
|
18
|
+
* wanted or whether another launch is still using it.
|
|
19
|
+
*/
|
|
20
|
+
export const claimTrainingPreparationScratch = async (staging, digest, notify) => {
|
|
21
|
+
try {
|
|
22
|
+
await mkdir(staging, { mode: 0o700 });
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error.code !== "EEXIST")
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
const info = await lstat(staging);
|
|
30
|
+
if (!info.isDirectory() || info.isSymbolicLink() || await realpath(staging) !== staging) {
|
|
31
|
+
throw Error(`Training preparation scratch ${staging} is not a canonical directory; remove it and retry`);
|
|
32
|
+
}
|
|
33
|
+
let previous;
|
|
34
|
+
try {
|
|
35
|
+
previous = JSON.parse(await readFile(`${staging}/state.json`, "utf8"));
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
previous = undefined;
|
|
39
|
+
}
|
|
40
|
+
if (previous?.digest !== digest) {
|
|
41
|
+
throw Error(previous === undefined
|
|
42
|
+
? `Training preparation scratch ${staging} is left over from an interrupted launch that never recorded its identity; remove it to retry: rm -rf ${JSON.stringify(staging)}`
|
|
43
|
+
: `Training preparation scratch ${staging} belongs to a different preparation (${String(previous.digest)}); remove it to retry: rm -rf ${JSON.stringify(staging)}`);
|
|
44
|
+
}
|
|
45
|
+
notify(`Reusing the preparation scratch left by an earlier launch of this exact preparation: ${staging}`);
|
|
46
|
+
await rm(staging, { recursive: true, force: true });
|
|
47
|
+
await mkdir(staging, { mode: 0o700 });
|
|
48
|
+
};
|