spawnfile 0.1.17 → 0.1.19
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 +1 -1
- package/dist/auth/importers.js +21 -5
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.js +1 -0
- package/dist/auth/profileStore.js +4 -1
- package/dist/auth/trainingGrokWriteback.d.ts +4 -0
- package/dist/auth/trainingGrokWriteback.js +119 -0
- package/dist/auth/trainingGrokWritebackLock.d.ts +5 -0
- package/dist/auth/trainingGrokWritebackLock.js +56 -0
- package/dist/cli/authCommands.js +9 -5
- package/dist/cli/compileBuildCommands.js +4 -0
- package/dist/cli/devCommands.js +4 -2
- package/dist/cli/downCommand.d.ts +2 -0
- package/dist/cli/downCommand.js +3 -0
- package/dist/cli/envFileOption.d.ts +18 -0
- package/dist/cli/envFileOption.js +20 -0
- package/dist/cli/lifecycleCommands.d.ts +1 -1
- package/dist/cli/lifecycleCommands.js +3 -1
- package/dist/cli/lifecyclePlan.d.ts +1 -0
- package/dist/cli/lifecyclePlan.js +2 -0
- package/dist/cli/paideiaDelegation.d.ts +2 -1
- package/dist/cli/paideiaDelegation.js +5 -4
- package/dist/cli/recordCommands.d.ts +17 -0
- package/dist/cli/recordCommands.js +43 -0
- package/dist/cli/releaseCommand.d.ts +6 -0
- package/dist/cli/releaseCommand.js +91 -0
- package/dist/cli/runCli.d.ts +7 -1
- package/dist/cli/runCli.js +11 -6
- package/dist/cli/runPublishCommands.js +5 -3
- package/dist/cli/trainCommand.js +73 -20
- package/dist/cli/upCommand.js +5 -1
- package/dist/cli/volumeCommands.d.ts +8 -0
- package/dist/cli/volumeCommands.js +53 -0
- package/dist/compiler/agentNodeMerge.js +3 -2
- package/dist/compiler/buildCompilePlan.js +4 -0
- package/dist/compiler/buildCompilePlanAgent.js +3 -1
- package/dist/compiler/buildCompilePlanTraversal.js +2 -0
- package/dist/compiler/buildCompilePlanTraversalHelpers.d.ts +2 -2
- package/dist/compiler/buildCompilePlanTraversalHelpers.js +4 -3
- package/dist/compiler/buildProject.d.ts +10 -0
- package/dist/compiler/buildProject.js +14 -2
- package/dist/compiler/cleanCompileOutput.d.ts +2 -0
- package/dist/compiler/cleanCompileOutput.js +14 -0
- package/dist/compiler/compilePlanHelpers.js +2 -0
- package/dist/compiler/compileProject.d.ts +10 -0
- package/dist/compiler/compileProject.js +29 -3
- package/dist/compiler/containerArtifactSummaries.js +1 -0
- package/dist/compiler/containerArtifacts.d.ts +4 -4
- package/dist/compiler/containerArtifacts.js +18 -34
- package/dist/compiler/containerArtifactsPlans.js +7 -0
- package/dist/compiler/containerArtifactsTypes.d.ts +7 -0
- package/dist/compiler/containerDaimonBrokerRender.d.ts +3 -1
- package/dist/compiler/containerDaimonBrokerRender.js +6 -3
- package/dist/compiler/containerDaimonGrokTaskClock.d.ts +5 -0
- package/dist/compiler/containerDaimonGrokTaskClock.js +29 -0
- package/dist/compiler/containerDaimonGrokWorkerProvisioning.d.ts +1 -1
- package/dist/compiler/containerDaimonGrokWorkerProvisioning.js +38 -16
- package/dist/compiler/containerDaimonGrokWorkerRender.d.ts +33 -8
- package/dist/compiler/containerDaimonGrokWorkerRender.js +18 -5
- package/dist/compiler/containerDaimonOwnershipGuardRender.d.ts +14 -1
- package/dist/compiler/containerDaimonOwnershipGuardRender.js +15 -2
- package/dist/compiler/containerDaimonUidEntrypointRender.js +6 -12
- package/dist/compiler/containerTargetResources.d.ts +10 -0
- package/dist/compiler/containerTargetResources.js +21 -13
- package/dist/compiler/containerWorkspaceResourceRender.js +4 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/index.js +2 -0
- package/dist/compiler/mcpPlaceholders.d.ts +11 -0
- package/dist/compiler/mcpPlaceholders.js +58 -0
- package/dist/compiler/mcpServerInheritance.d.ts +18 -0
- package/dist/compiler/mcpServerInheritance.js +43 -0
- package/dist/compiler/moltnetArtifactTypes.d.ts +1 -0
- package/dist/compiler/moltnetArtifacts.js +1 -0
- package/dist/compiler/preflightCompilePlan.d.ts +9 -0
- package/dist/compiler/preflightCompilePlan.js +38 -0
- package/dist/compiler/recordingAgentFacts.d.ts +4 -0
- package/dist/compiler/recordingAgentFacts.js +35 -0
- package/dist/compiler/recordingCapability.d.ts +4 -0
- package/dist/compiler/recordingCapability.js +22 -0
- package/dist/compiler/recordingReport.d.ts +4 -0
- package/dist/compiler/recordingReport.js +18 -0
- package/dist/compiler/runProject.d.ts +2 -1
- package/dist/compiler/runProject.js +2 -0
- package/dist/compiler/surfaces.d.ts +1 -2
- package/dist/compiler/surfaces.js +0 -1
- package/dist/compiler/syncProjectAuth.js +2 -1
- package/dist/compiler/training/broker/clockProbe.d.ts +6 -0
- package/dist/compiler/training/broker/clockProbe.js +27 -0
- package/dist/compiler/training/broker/declaration.d.ts +4 -2
- package/dist/compiler/training/broker/declaration.js +4 -2
- package/dist/compiler/training/broker/entrypoint.js +33 -18
- package/dist/compiler/training/broker/evaluatorSecrets.d.ts +2 -0
- package/dist/compiler/training/broker/evaluatorSecrets.js +60 -0
- package/dist/compiler/training/broker/index.d.ts +3 -2
- package/dist/compiler/training/broker/index.js +3 -2
- package/dist/compiler/training/broker/main.js +1 -1
- package/dist/compiler/training/broker/paths.d.ts +96 -56
- package/dist/compiler/training/broker/paths.js +97 -89
- package/dist/compiler/training/broker/processes.d.ts +9 -0
- package/dist/compiler/training/broker/processes.js +4 -1
- package/dist/compiler/training/broker/projection.d.ts +3 -2
- package/dist/compiler/training/broker/projection.js +21 -9
- package/dist/compiler/training/broker/provisioning.d.ts +6 -15
- package/dist/compiler/training/broker/provisioning.js +71 -53
- package/dist/compiler/training/broker/registration.d.ts +3 -1
- package/dist/compiler/training/broker/registration.js +29 -21
- package/dist/compiler/training/broker/reset.d.ts +9 -0
- package/dist/compiler/training/broker/reset.js +71 -0
- package/dist/compiler/training/broker/runtime.d.ts +10 -13
- package/dist/compiler/training/broker/runtime.js +69 -115
- package/dist/compiler/training/broker/supervisor.d.ts +10 -11
- package/dist/compiler/training/broker/supervisor.js +22 -23
- package/dist/compiler/training/broker/taskClock.d.ts +5 -0
- package/dist/compiler/training/broker/taskClock.js +41 -0
- package/dist/compiler/training/compiledAgent.d.ts +21 -0
- package/dist/compiler/training/compiledAgent.js +62 -0
- package/dist/compiler/training/container/contract.d.ts +23 -0
- package/dist/compiler/training/container/contract.js +23 -5
- package/dist/compiler/training/container/evaluators.d.ts +48 -0
- package/dist/compiler/training/container/evaluators.js +50 -0
- package/dist/compiler/training/container/grokWriteback.d.ts +8 -0
- package/dist/compiler/training/container/grokWriteback.js +26 -0
- package/dist/compiler/training/container/index.d.ts +2 -1
- package/dist/compiler/training/container/index.js +2 -1
- package/dist/compiler/training/container/launch.d.ts +3 -0
- package/dist/compiler/training/container/launch.js +119 -28
- package/dist/compiler/training/container/nativeSlots.d.ts +14 -0
- package/dist/compiler/training/container/nativeSlots.js +13 -0
- package/dist/compiler/training/container/outputCopy.d.ts +2 -0
- package/dist/compiler/training/container/outputCopy.js +72 -0
- package/dist/compiler/training/container/outputVolume.d.ts +27 -0
- package/dist/compiler/training/container/outputVolume.js +161 -0
- package/dist/compiler/training/container/prepare.d.ts +3 -1
- package/dist/compiler/training/container/prepare.js +57 -12
- package/dist/compiler/training/container/security.d.ts +5 -3
- package/dist/compiler/training/container/security.js +15 -5
- package/dist/compiler/training/container/subjectIsolation.d.ts +5 -0
- package/dist/compiler/training/container/subjectIsolation.js +15 -0
- package/dist/compiler/training/context.d.ts +8 -0
- package/dist/compiler/training/context.js +12 -12
- package/dist/compiler/training/contract.d.ts +2 -0
- package/dist/compiler/training/contract.js +2 -0
- package/dist/compiler/training/execution.d.ts +417 -0
- package/dist/compiler/training/execution.js +160 -0
- package/dist/compiler/training/index.d.ts +8 -0
- package/dist/compiler/training/index.js +7 -0
- package/dist/compiler/training/moments.d.ts +80 -0
- package/dist/compiler/training/moments.js +118 -0
- package/dist/compiler/training/output.d.ts +2 -0
- package/dist/compiler/training/output.js +20 -0
- package/dist/compiler/training/plan/contract.d.ts +287 -0
- package/dist/compiler/training/plan/contract.js +49 -0
- package/dist/compiler/training/plan/index.d.ts +5 -0
- package/dist/compiler/training/plan/index.js +4 -0
- package/dist/compiler/training/plan/load.d.ts +9 -0
- package/dist/compiler/training/plan/load.js +153 -0
- package/dist/compiler/training/plan/references.d.ts +19 -0
- package/dist/compiler/training/plan/references.js +57 -0
- package/dist/compiler/training/plan/resolve.d.ts +4 -0
- package/dist/compiler/training/plan/resolve.js +73 -0
- package/dist/compiler/training/plan/targets.d.ts +11 -0
- package/dist/compiler/training/plan/targets.js +71 -0
- package/dist/compiler/training/plan/types.d.ts +36 -0
- package/dist/compiler/training/plan/types.js +1 -0
- package/dist/compiler/training/preparation/assets/Dockerfile +13 -2
- package/dist/compiler/training/preparation/assets/package-lock.json +2 -2
- package/dist/compiler/training/preparation/broker.d.ts +3 -3
- package/dist/compiler/training/preparation/broker.js +6 -4
- package/dist/compiler/training/preparation/contract.d.ts +27 -2
- package/dist/compiler/training/preparation/contract.js +23 -4
- package/dist/compiler/training/preparation/files.d.ts +5 -1
- package/dist/compiler/training/preparation/files.js +76 -15
- package/dist/compiler/training/preparation/image.js +9 -4
- package/dist/compiler/training/preparation/inputs.d.ts +1 -0
- package/dist/compiler/training/preparation/inputs.js +18 -10
- package/dist/compiler/training/preparation/prepare.d.ts +5 -0
- package/dist/compiler/training/preparation/prepare.js +66 -29
- package/dist/compiler/training/preparation/scratch.d.ts +6 -17
- package/dist/compiler/training/preparation/scratch.js +89 -23
- package/dist/compiler/training/repair/contract.d.ts +338 -4
- package/dist/compiler/training/repair/contract.js +2 -0
- package/dist/compiler/training/repair/index.d.ts +1 -1
- package/dist/compiler/training/repair/index.js +1 -1
- package/dist/compiler/training/repair/prepare.d.ts +155 -3
- package/dist/compiler/training/repair/prepare.js +6 -2
- package/dist/compiler/training/repair/witness.d.ts +152 -3
- package/dist/compiler/training/repair/witness.js +8 -2
- package/dist/compiler/training/resolution.d.ts +25 -0
- package/dist/compiler/training/resolution.js +69 -0
- package/dist/compiler/training/rewind/contract.d.ts +321 -0
- package/dist/compiler/training/rewind/contract.js +39 -0
- package/dist/compiler/training/rewind/deployedResource.d.ts +22 -0
- package/dist/compiler/training/rewind/deployedResource.js +19 -0
- package/dist/compiler/training/rewind/feed.d.ts +12 -0
- package/dist/compiler/training/rewind/feed.js +182 -0
- package/dist/compiler/training/rewind/feedContent.d.ts +6 -0
- package/dist/compiler/training/rewind/feedContent.js +38 -0
- package/dist/compiler/training/rewind/git.d.ts +8 -0
- package/dist/compiler/training/rewind/git.js +159 -0
- package/dist/compiler/training/rewind/gitArchive.d.ts +2 -0
- package/dist/compiler/training/rewind/gitArchive.js +7 -0
- package/dist/compiler/training/rewind/gitHistory.d.ts +3 -0
- package/dist/compiler/training/rewind/gitHistory.js +55 -0
- package/dist/compiler/training/rewind/gitProcess.d.ts +19 -0
- package/dist/compiler/training/rewind/gitProcess.js +81 -0
- package/dist/compiler/training/rewind/gitTree.d.ts +14 -0
- package/dist/compiler/training/rewind/gitTree.js +90 -0
- package/dist/compiler/training/rewind/history.d.ts +28 -0
- package/dist/compiler/training/rewind/history.js +239 -0
- package/dist/compiler/training/rewind/index.d.ts +18 -0
- package/dist/compiler/training/rewind/index.js +15 -0
- package/dist/compiler/training/rewind/inputs.d.ts +9 -0
- package/dist/compiler/training/rewind/inputs.js +67 -0
- package/dist/compiler/training/rewind/instant.d.ts +4 -0
- package/dist/compiler/training/rewind/instant.js +24 -0
- package/dist/compiler/training/rewind/leakCheck.d.ts +10 -0
- package/dist/compiler/training/rewind/leakCheck.js +56 -0
- package/dist/compiler/training/rewind/leakFeed.d.ts +5 -0
- package/dist/compiler/training/rewind/leakFeed.js +25 -0
- package/dist/compiler/training/rewind/leakFiles.d.ts +10 -0
- package/dist/compiler/training/rewind/leakFiles.js +106 -0
- package/dist/compiler/training/rewind/leakGit.d.ts +3 -0
- package/dist/compiler/training/rewind/leakGit.js +78 -0
- package/dist/compiler/training/rewind/leakGitPayload.d.ts +4 -0
- package/dist/compiler/training/rewind/leakGitPayload.js +57 -0
- package/dist/compiler/training/rewind/leakInputs.d.ts +7 -0
- package/dist/compiler/training/rewind/leakInputs.js +135 -0
- package/dist/compiler/training/rewind/leakLayout.d.ts +2 -0
- package/dist/compiler/training/rewind/leakLayout.js +17 -0
- package/dist/compiler/training/rewind/leakProvenance.d.ts +3 -0
- package/dist/compiler/training/rewind/leakProvenance.js +88 -0
- package/dist/compiler/training/rewind/materialize.d.ts +136 -0
- package/dist/compiler/training/rewind/materialize.js +212 -0
- package/dist/compiler/training/rewind/memory.d.ts +10 -0
- package/dist/compiler/training/rewind/memory.js +84 -0
- package/dist/compiler/training/rewind/memorySchemas.d.ts +87 -0
- package/dist/compiler/training/rewind/memorySchemas.js +50 -0
- package/dist/compiler/training/rewind/moltnet.d.ts +2 -0
- package/dist/compiler/training/rewind/moltnet.js +54 -0
- package/dist/compiler/training/rewind/moltnetJson.d.ts +13 -0
- package/dist/compiler/training/rewind/moltnetJson.js +180 -0
- package/dist/compiler/training/rewind/moltnetSchemas.d.ts +1226 -0
- package/dist/compiler/training/rewind/moltnetSchemas.js +75 -0
- package/dist/compiler/training/rewind/moltnetSqlite.d.ts +31 -0
- package/dist/compiler/training/rewind/moltnetSqlite.js +192 -0
- package/dist/compiler/training/rewind/moltnetSqliteData.d.ts +10 -0
- package/dist/compiler/training/rewind/moltnetSqliteData.js +113 -0
- package/dist/compiler/training/rewind/recordInput.d.ts +40 -0
- package/dist/compiler/training/rewind/recordInput.js +49 -0
- package/dist/compiler/training/rewind/recordedBundle.d.ts +4 -0
- package/dist/compiler/training/rewind/recordedBundle.js +58 -0
- package/dist/compiler/training/rewind/recordedCommit.d.ts +2 -0
- package/dist/compiler/training/rewind/recordedCommit.js +10 -0
- package/dist/compiler/training/rewind/select.d.ts +18 -0
- package/dist/compiler/training/rewind/select.js +64 -0
- package/dist/compiler/training/rewind/snapshotManifest.d.ts +42 -0
- package/dist/compiler/training/rewind/snapshotManifest.js +134 -0
- package/dist/compiler/training/rewind/taskClock.d.ts +12 -0
- package/dist/compiler/training/rewind/taskClock.js +40 -0
- package/dist/compiler/training/rewind/timestamps.d.ts +4 -0
- package/dist/compiler/training/rewind/timestamps.js +26 -0
- package/dist/compiler/training/rewind/types.d.ts +43 -0
- package/dist/compiler/training/rewind/types.js +1 -0
- package/dist/compiler/training/rewind/volumes.d.ts +12 -0
- package/dist/compiler/training/rewind/volumes.js +58 -0
- package/dist/compiler/training/selection.d.ts +7 -0
- package/dist/compiler/training/selection.js +15 -0
- package/dist/compiler/types.d.ts +6 -3
- package/dist/compiler/upProject.d.ts +1 -0
- package/dist/compiler/upProject.js +21 -5
- package/dist/compiler/workspaceBundleArtifacts.d.ts +16 -1
- package/dist/compiler/workspaceBundleArtifacts.js +69 -20
- package/dist/compiler/workspaceBundleCache.d.ts +23 -0
- package/dist/compiler/workspaceBundleCache.js +79 -0
- package/dist/compiler/workspaceBundleDependencies.d.ts +21 -0
- package/dist/compiler/workspaceBundleDependencies.js +122 -0
- package/dist/compiler/workspaceBundleFiles.d.ts +51 -0
- package/dist/compiler/workspaceBundleFiles.js +251 -0
- package/dist/compiler/workspaceBundleGenerated.d.ts +25 -0
- package/dist/compiler/workspaceBundleGenerated.js +103 -0
- package/dist/compiler/workspaceBundleGit.d.ts +64 -0
- package/dist/compiler/workspaceBundleGit.js +154 -0
- package/dist/compiler/workspaceBundleKey.d.ts +34 -0
- package/dist/compiler/workspaceBundleKey.js +17 -0
- package/dist/compiler/workspaceBundleResolve.d.ts +56 -0
- package/dist/compiler/workspaceBundleResolve.js +144 -0
- package/dist/compiler/workspaceBundleRun.d.ts +41 -0
- package/dist/compiler/workspaceBundleRun.js +79 -0
- package/dist/compiler/workspaceBundleTar.d.ts +47 -0
- package/dist/compiler/workspaceBundleTar.js +140 -0
- package/dist/compiler/workspaceBundleTree.d.ts +15 -0
- package/dist/compiler/workspaceBundleTree.js +58 -0
- package/dist/compiler/workspaceGitFetch.d.ts +41 -0
- package/dist/compiler/workspaceGitFetch.js +155 -0
- package/dist/compiler/workspaceGitPins.d.ts +33 -0
- package/dist/compiler/workspaceGitPins.js +127 -0
- package/dist/compiler/workspaceResources.d.ts +5 -1
- package/dist/compiler/workspaceResources.js +32 -5
- package/dist/deployment/activation.d.ts +3 -0
- package/dist/deployment/activation.js +12 -0
- package/dist/deployment/canaryCutover.d.ts +1 -1
- package/dist/deployment/candidateRecording.d.ts +8 -0
- package/dist/deployment/candidateRecording.js +22 -0
- package/dist/deployment/dockerManager.d.ts +5 -3
- package/dist/deployment/dockerManager.js +12 -2
- package/dist/deployment/downDeployment.d.ts +2 -0
- package/dist/deployment/downDeployment.js +6 -2
- package/dist/deployment/homeStore.d.ts +9 -1
- package/dist/deployment/homeStore.js +16 -53
- package/dist/deployment/index.d.ts +6 -0
- package/dist/deployment/index.js +6 -0
- package/dist/deployment/pidLock.d.ts +25 -0
- package/dist/deployment/pidLock.js +81 -0
- package/dist/deployment/record.d.ts +85 -1
- package/dist/deployment/record.js +11 -5
- package/dist/deployment/recordPublication.d.ts +15 -0
- package/dist/deployment/recordPublication.js +76 -0
- package/dist/deployment/recordedMemoryRetention.d.ts +18 -0
- package/dist/deployment/recordedMemoryRetention.js +27 -0
- package/dist/deployment/resourceLog.d.ts +140 -0
- package/dist/deployment/resourceLog.js +78 -0
- package/dist/distribution/buildDistributionReport.d.ts +3 -0
- package/dist/distribution/buildDistributionReport.js +5 -0
- package/dist/distribution/consumeImage.d.ts +3 -0
- package/dist/distribution/consumeImage.js +23 -31
- package/dist/distribution/consumeImageLifecycle.d.ts +4 -1
- package/dist/distribution/consumeImageLifecycle.js +14 -3
- package/dist/distribution/consumeImageSupport.d.ts +7 -0
- package/dist/distribution/consumeImageSupport.js +25 -0
- package/dist/distribution/distributionReportSchema.d.ts +47 -0
- package/dist/distribution/distributionReportSchema.js +20 -0
- package/dist/distribution/renderImageInterface.js +1 -1
- package/dist/distribution/types.d.ts +15 -0
- package/dist/filesystem/durableWrite.d.ts +10 -0
- package/dist/filesystem/durableWrite.js +87 -0
- package/dist/filesystem/index.d.ts +2 -0
- package/dist/filesystem/index.js +2 -0
- package/dist/filesystem/retainedJsonl.d.ts +23 -0
- package/dist/filesystem/retainedJsonl.js +123 -0
- package/dist/manifest/commandSchemas.d.ts +5 -0
- package/dist/manifest/commandSchemas.js +5 -0
- package/dist/manifest/executionSchemas.d.ts +20 -0
- package/dist/manifest/executionSchemas.js +13 -3
- package/dist/manifest/index.d.ts +2 -0
- package/dist/manifest/index.js +2 -0
- package/dist/manifest/loadManifest.js +3 -26
- package/dist/manifest/mcpSchemas.d.ts +61 -0
- package/dist/manifest/mcpSchemas.js +57 -11
- package/dist/manifest/memorySchemas.d.ts +1 -1
- package/dist/manifest/memorySchemas.js +1 -1
- package/dist/manifest/parseManifest.d.ts +7 -0
- package/dist/manifest/parseManifest.js +65 -0
- package/dist/manifest/renderSpawnfile.js +4 -1
- package/dist/manifest/renderSpawnfileWorkspace.js +6 -2
- package/dist/manifest/schemas.d.ts +1206 -132
- package/dist/manifest/schemas.js +14 -4
- package/dist/manifest/teamNetworkSchemas.d.ts +1 -1
- package/dist/manifest/trainingDataSchemas.d.ts +357 -0
- package/dist/manifest/trainingDataSchemas.js +31 -0
- package/dist/manifest/trainingSchemas.d.ts +49 -0
- package/dist/manifest/trainingSchemas.js +44 -0
- package/dist/manifest/volumeFeedSchemas.d.ts +52 -0
- package/dist/manifest/volumeFeedSchemas.js +104 -0
- package/dist/manifest/workspaceSchemas.d.ts +182 -5
- package/dist/manifest/workspaceSchemas.js +111 -7
- package/dist/recording/compose.d.ts +3 -0
- package/dist/recording/compose.js +93 -0
- package/dist/recording/deployment.d.ts +15 -0
- package/dist/recording/deployment.js +38 -0
- package/dist/recording/history.d.ts +16 -0
- package/dist/recording/history.js +47 -0
- package/dist/recording/index.d.ts +9 -0
- package/dist/recording/index.js +9 -0
- package/dist/recording/moment.d.ts +61 -0
- package/dist/recording/moment.js +36 -0
- package/dist/recording/parse.d.ts +15 -0
- package/dist/recording/parse.js +74 -0
- package/dist/recording/read.d.ts +8 -0
- package/dist/recording/read.js +61 -0
- package/dist/recording/store.d.ts +10 -0
- package/dist/recording/store.js +94 -0
- package/dist/recording/sync.d.ts +24 -0
- package/dist/recording/sync.js +126 -0
- package/dist/recording/types.d.ts +45 -0
- package/dist/recording/types.js +2 -0
- package/dist/release/drainControl.d.ts +54 -0
- package/dist/release/drainControl.js +137 -0
- package/dist/release/drainPhase.d.ts +37 -0
- package/dist/release/drainPhase.js +161 -0
- package/dist/release/index.d.ts +11 -0
- package/dist/release/index.js +11 -0
- package/dist/release/ledger.d.ts +75 -0
- package/dist/release/ledger.js +111 -0
- package/dist/release/notify.d.ts +58 -0
- package/dist/release/notify.js +126 -0
- package/dist/release/pending.d.ts +35 -0
- package/dist/release/pending.js +60 -0
- package/dist/release/postDeploy.d.ts +32 -0
- package/dist/release/postDeploy.js +62 -0
- package/dist/release/releaseDefaults.d.ts +9 -0
- package/dist/release/releaseDefaults.js +115 -0
- package/dist/release/releaseDocker.d.ts +38 -0
- package/dist/release/releaseDocker.js +94 -0
- package/dist/release/releaseTypes.d.ts +94 -0
- package/dist/release/releaseTypes.js +1 -0
- package/dist/release/runRelease.d.ts +9 -0
- package/dist/release/runRelease.js +218 -0
- package/dist/release/swap.d.ts +23 -0
- package/dist/release/swap.js +55 -0
- package/dist/release/types.d.ts +50 -0
- package/dist/release/types.js +29 -0
- package/dist/report/index.d.ts +1 -0
- package/dist/report/index.js +1 -0
- package/dist/report/recording.d.ts +57 -0
- package/dist/report/recording.js +26 -0
- package/dist/report/types.d.ts +58 -0
- package/dist/runtime/container.js +8 -13
- package/dist/runtime/daimon/adapter.js +15 -4
- package/dist/runtime/daimon/config.d.ts +4 -0
- package/dist/runtime/daimon/config.js +53 -4
- package/dist/runtime/daimon/contract-manifest.json +1 -0
- package/dist/runtime/daimon/contract-manifest.sha256 +1 -0
- package/dist/runtime/daimon/contractManifest.d.ts +59 -8
- package/dist/runtime/daimon/contractManifest.js +26 -10
- package/dist/runtime/daimon/grokTurnLimits.d.ts +25 -0
- package/dist/runtime/daimon/grokTurnLimits.js +51 -0
- package/dist/runtime/daimon/grokWorkerConfigBytes.d.ts +17 -0
- package/dist/runtime/daimon/grokWorkerConfigBytes.js +17 -0
- package/dist/runtime/daimon/grokWorkerContract.d.ts +5 -0
- package/dist/runtime/daimon/grokWorkerContract.js +13 -1
- package/dist/runtime/daimon/recording.d.ts +19 -0
- package/dist/runtime/daimon/recording.js +50 -0
- package/dist/runtime/daimon/scheduleAuthority.d.ts +8 -0
- package/dist/runtime/daimon/scheduleAuthority.js +19 -5
- package/dist/runtime/daimon/wakeMoments.d.ts +15 -0
- package/dist/runtime/daimon/wakeMoments.js +17 -0
- package/dist/runtime/daimonInstall.d.ts +3 -0
- package/dist/runtime/daimonInstall.js +25 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/install.d.ts +2 -0
- package/dist/runtime/install.js +1 -0
- package/dist/runtime/openclaw/adapter.js +3 -0
- package/dist/runtime/pi/adapter.js +3 -0
- package/dist/runtime/pi/containerTargets.js +6 -0
- package/dist/runtime/picoclaw/adapter.js +3 -0
- package/dist/runtime/registry.d.ts +3 -0
- package/dist/runtime/registry.js +13 -1
- package/dist/runtime/types.d.ts +15 -0
- package/dist/runtime/usageLedgerRead.d.ts +6 -0
- package/dist/runtime/usageLedgerRead.js +3 -3
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/recording.d.ts +8 -0
- package/dist/shared/recording.js +25 -0
- package/dist/target/dockerCommandExecutorCore.js +1 -1
- package/dist/target/dockerTargetBinding.js +2 -1
- package/dist/volume/feedLand.d.ts +31 -0
- package/dist/volume/feedLand.js +174 -0
- package/dist/volume/feedLandings.d.ts +45 -0
- package/dist/volume/feedLandings.js +111 -0
- package/dist/volume/feedLayout.d.ts +61 -0
- package/dist/volume/feedLayout.js +234 -0
- package/dist/volume/feedLock.d.ts +7 -0
- package/dist/volume/feedLock.js +131 -0
- package/dist/volume/feedManifest.d.ts +27 -0
- package/dist/volume/feedManifest.js +123 -0
- package/dist/volume/feedPrepare.d.ts +16 -0
- package/dist/volume/feedPrepare.js +228 -0
- package/dist/volume/feedProject.d.ts +39 -0
- package/dist/volume/feedProject.js +92 -0
- package/dist/volume/feedRecord.d.ts +55 -0
- package/dist/volume/feedRecord.js +148 -0
- package/dist/volume/feedRef.d.ts +43 -0
- package/dist/volume/feedRef.js +117 -0
- package/dist/volume/feedRefresh.d.ts +15 -0
- package/dist/volume/feedRefresh.js +187 -0
- package/dist/volume/feedSource.d.ts +66 -0
- package/dist/volume/feedSource.js +104 -0
- package/dist/volume/feedTarget.d.ts +70 -0
- package/dist/volume/feedTarget.js +9 -0
- package/dist/volume/feedTestKit.d.ts +11 -0
- package/dist/volume/feedTestKit.js +45 -0
- package/dist/volume/feedVerify.d.ts +18 -0
- package/dist/volume/feedVerify.js +104 -0
- package/dist/volume/index.d.ts +13 -0
- package/dist/volume/index.js +13 -0
- package/moltnet-releases.json +4 -4
- package/package.json +3 -3
- package/runtimes.yaml +8 -6
|
@@ -13,8 +13,10 @@ import { type DaimonGrokRegistration } from "../../containerDaimonGrokWorkerRend
|
|
|
13
13
|
* the profile outright, and masks cannot nest, so an entry covered by another
|
|
14
14
|
* entry is a provisioning bug rather than something to silently drop.
|
|
15
15
|
*/
|
|
16
|
-
export declare const resolveTrainingGrokDenyPaths: (added?: readonly string[]) => string[];
|
|
16
|
+
export declare const resolveTrainingGrokDenyPaths: (added?: readonly string[] | undefined, slot?: number, slots?: number) => string[];
|
|
17
17
|
export interface TrainingGrokSlotInput {
|
|
18
|
+
slot?: number;
|
|
19
|
+
slots?: number;
|
|
18
20
|
agentId: string;
|
|
19
21
|
model: DaimonGrokBrokerModel;
|
|
20
22
|
reasoningEffort: DaimonGrokBrokerReasoningEffort;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { SpawnfileError } from "../../../shared/index.js";
|
|
3
3
|
import { DAIMON_GROK_BROKER_MODELS, DAIMON_GROK_BROKER_REASONING_EFFORTS, DAIMON_GROK_ENGINE_BROKER } from "../../../runtime/daimon/contractManifest.js";
|
|
4
|
-
import { DAIMON_GROK_WORKER_HOME_DIRECTORY, daimonGrokWorkerSandboxProfileSha256, renderDaimonGrokWorkerSandboxProfile,
|
|
4
|
+
import { DAIMON_GROK_WORKER_HOME_DIRECTORY, daimonGrokWorkerSandboxProfileSha256, renderDaimonGrokWorkerSandboxProfile, resolveDaimonGrokClockedWorkerConfig } from "../../../runtime/daimon/grokWorkerContract.js";
|
|
5
5
|
import { DAIMON_GROK_BASE_PROFILE_GRANTS, assertCanonicalRegisteredPath } from "../../containerDaimonGrokWorkerRender.js";
|
|
6
|
-
import {
|
|
6
|
+
import { trainingSlotPaths, trainingEvaluatorPaths, TRAINING_BOOTSTRAP_MOUNT, TRAINING_REALM_MOUNT, TRAINING_DEFERRED_DENY_PATHS } from "./paths.js";
|
|
7
7
|
const fail = (message) => {
|
|
8
8
|
throw new SpawnfileError("compile_error", message);
|
|
9
9
|
};
|
|
@@ -21,26 +21,32 @@ const within = (candidate, root) => candidate === root || candidate.startsWith(`
|
|
|
21
21
|
* the profile outright, and masks cannot nest, so an entry covered by another
|
|
22
22
|
* entry is a provisioning bug rather than something to silently drop.
|
|
23
23
|
*/
|
|
24
|
-
export const resolveTrainingGrokDenyPaths = (added =
|
|
25
|
-
|
|
24
|
+
export const resolveTrainingGrokDenyPaths = (added = undefined, slot = 0, slots = 1) => {
|
|
25
|
+
const p = trainingSlotPaths(slot);
|
|
26
|
+
const required = trainingEvaluatorPaths(slot, slots).map(entry => entry.path);
|
|
27
|
+
// The wake-acceptance store is masked through `p.state`, never directly: Grok 1.0.34
|
|
26
28
|
// materializes every deny target inside bubblewrap AS THE WORKER UID, and the store's parent is
|
|
27
29
|
// `2000:2000 0700`, so the store itself is unplaceable and would make Grok refuse the whole profile
|
|
28
30
|
// (`.runtime/grok-deny-placement/EVIDENCE.md`). The state root covers it and nothing else lives there.
|
|
29
|
-
const daimonOwn = [TRAINING_BOOTSTRAP_MOUNT, TRAINING_REALM_MOUNT,
|
|
30
|
-
const grokHome = path.posix.join(
|
|
31
|
+
const daimonOwn = [TRAINING_BOOTSTRAP_MOUNT, TRAINING_REALM_MOUNT, p.state];
|
|
32
|
+
const grokHome = path.posix.join(p.workerHome, DAIMON_GROK_WORKER_HOME_DIRECTORY);
|
|
31
33
|
const grants = [
|
|
32
|
-
...DAIMON_GROK_BASE_PROFILE_GRANTS,
|
|
33
|
-
path.posix.join(grokHome, "sessions"), path.posix.join(
|
|
34
|
+
...DAIMON_GROK_BASE_PROFILE_GRANTS, p.workspace, grokHome,
|
|
35
|
+
path.posix.join(grokHome, "sessions"), path.posix.join(p.workerHome, "tmp")
|
|
34
36
|
];
|
|
35
|
-
const candidates = [...new Set([...daimonOwn, ...added])].sort();
|
|
37
|
+
const candidates = [...new Set([...daimonOwn, ...required, ...(added ?? [])])].sort();
|
|
36
38
|
for (const entry of candidates) {
|
|
37
39
|
assertCanonicalRegisteredPath("deny path", entry);
|
|
38
40
|
const grant = grants.find((candidate) => within(candidate, entry));
|
|
39
41
|
if (grant)
|
|
40
42
|
fail(`Training Grok deny path ${entry} equals or contains the base profile grant ${grant}; Grok refuses such a profile`);
|
|
41
|
-
if (within(
|
|
43
|
+
if (within(p.workspace, entry) || within(p.workerHome, entry) || within(p.runtimeHome, entry)) {
|
|
42
44
|
fail(`Training Grok deny path ${entry} would hide the subject's own workspace, home, or runtime home`);
|
|
43
45
|
}
|
|
46
|
+
if ([p.clockFile, DAIMON_GROK_ENGINE_BROKER.worker.taskClock.preloadPath,
|
|
47
|
+
"/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1", "/usr/lib/aarch64-linux-gnu/faketime/libfaketime.so.1"].some(file => within(file, entry))) {
|
|
48
|
+
fail(`Training Grok deny path ${entry} would hide the subject's task clock`);
|
|
49
|
+
}
|
|
44
50
|
const ancestor = candidates.find((other) => other !== entry && within(entry, other));
|
|
45
51
|
if (ancestor)
|
|
46
52
|
fail(`Training Grok deny path ${ancestor} would cover ${entry}; masks cannot nest`);
|
|
@@ -55,26 +61,28 @@ export const resolveTrainingGrokDenyPaths = (added = TRAINING_ADDED_DENY_PATHS)
|
|
|
55
61
|
* not exist here.
|
|
56
62
|
*/
|
|
57
63
|
export const resolveTrainingGrokRegistration = (input) => {
|
|
64
|
+
const p = trainingSlotPaths(input.slot ?? 0);
|
|
58
65
|
if (!input.agentId.trim())
|
|
59
66
|
fail("Training Grok slot requires an agent id");
|
|
60
67
|
if (!DAIMON_GROK_BROKER_MODELS.includes(input.model)
|
|
61
68
|
|| !DAIMON_GROK_BROKER_REASONING_EFFORTS.includes(input.reasoningEffort)) {
|
|
62
69
|
fail(`Training Grok slot has no declared broker model and reasoning effort: ${input.agentId}`);
|
|
63
70
|
}
|
|
64
|
-
const home = assertCanonicalRegisteredPath("home",
|
|
71
|
+
const home = assertCanonicalRegisteredPath("home", p.workerHome);
|
|
65
72
|
const grokHome = path.posix.join(home, DAIMON_GROK_WORKER_HOME_DIRECTORY);
|
|
66
|
-
const config =
|
|
67
|
-
const denyPaths = resolveTrainingGrokDenyPaths(input.denyPaths);
|
|
73
|
+
const config = resolveDaimonGrokClockedWorkerConfig(input.model, input.reasoningEffort, p.slot);
|
|
74
|
+
const denyPaths = resolveTrainingGrokDenyPaths(input.denyPaths, p.slot, input.slots ?? 1);
|
|
68
75
|
const profile = renderDaimonGrokWorkerSandboxProfile(denyPaths);
|
|
69
76
|
const eventsPath = path.posix.join(grokHome, DAIMON_GROK_ENGINE_BROKER.worker.home.sandboxEvents.relativePath);
|
|
70
77
|
const profilePath = path.posix.join(grokHome, "sandbox.toml");
|
|
71
78
|
for (const [label, value] of [["GROK_HOME", grokHome], ["profile", profilePath], ["events", eventsPath],
|
|
72
|
-
["workspace",
|
|
73
|
-
["usage ledger",
|
|
79
|
+
["workspace", p.workspace], ["runtime home", p.runtimeHome],
|
|
80
|
+
["usage ledger", p.usageLedger]])
|
|
74
81
|
assertCanonicalRegisteredPath(label, value);
|
|
75
82
|
return {
|
|
76
83
|
agentId: input.agentId,
|
|
77
84
|
config: config.bytes,
|
|
85
|
+
configVariant: "clocked",
|
|
78
86
|
...(input.limits === undefined ? {} : { limits: { ...input.limits } }),
|
|
79
87
|
configSha256: config.sha256,
|
|
80
88
|
deferredDenyPaths: denyPaths.filter((entry) => TRAINING_DEFERRED_DENY_PATHS.includes(entry)),
|
|
@@ -88,15 +96,15 @@ export const resolveTrainingGrokRegistration = (input) => {
|
|
|
88
96
|
profileSha256: daimonGrokWorkerSandboxProfileSha256(denyPaths),
|
|
89
97
|
privateTmp: path.posix.join(home, DAIMON_GROK_ENGINE_BROKER.worker.home.privateTmp.relativeToWorkerHome),
|
|
90
98
|
reasoningEffort: input.reasoningEffort,
|
|
91
|
-
runtimeHome:
|
|
99
|
+
runtimeHome: p.runtimeHome,
|
|
92
100
|
// Empty on purpose: training has no persistent mounts at all. Everything a trial writes under the slot
|
|
93
101
|
// runtime home is per-slot tmpfs the recycle wipes, and the only thing provisioned inside it is the
|
|
94
102
|
// setgid `tool-output/` spill directory, so the traversable `0710` home exposes nothing else.
|
|
95
103
|
runtimeHomeMounts: [],
|
|
96
|
-
slot:
|
|
97
|
-
spillDirectory: path.posix.join(
|
|
98
|
-
uid:
|
|
99
|
-
usageLedgerPath:
|
|
100
|
-
workspace:
|
|
104
|
+
slot: p.slot,
|
|
105
|
+
spillDirectory: path.posix.join(p.runtimeHome, DAIMON_GROK_ENGINE_BROKER.worker.home.spillDirectory.relativeToRuntimeHome),
|
|
106
|
+
uid: p.workerUid,
|
|
107
|
+
usageLedgerPath: p.usageLedger,
|
|
108
|
+
workspace: p.workspace
|
|
101
109
|
};
|
|
102
110
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Root uses the broker's slot reset seam; the broker owns active-turn, worker-reap and clock checks. */
|
|
2
|
+
export declare const resetTrainingBrokerSlot: (slot: number, signal: AbortSignal, socketPath?: "/run/daimon-engine-broker/control.sock") => Promise<void>;
|
|
3
|
+
/** The native control relay authenticates SO_PEERCRED uid 2000 and rejects root. */
|
|
4
|
+
export declare const resetTrainingBrokerSlotAsOrganization: (slot: number, signal: AbortSignal, execute?: (file: string, args: string[], options: {
|
|
5
|
+
signal: AbortSignal;
|
|
6
|
+
timeout: number;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
stdout: string;
|
|
9
|
+
}>) => Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { createConnection } from "node:net";
|
|
5
|
+
import { DAIMON_GROK_ENGINE_BROKER } from "../../../runtime/daimon/contractManifest.js";
|
|
6
|
+
import { trainingSlotPaths } from "./paths.js";
|
|
7
|
+
/** Root uses the broker's slot reset seam; the broker owns active-turn, worker-reap and clock checks. */
|
|
8
|
+
export const resetTrainingBrokerSlot = (slot, signal, socketPath = DAIMON_GROK_ENGINE_BROKER.controlSocketPath) => {
|
|
9
|
+
trainingSlotPaths(slot);
|
|
10
|
+
signal.throwIfAborted();
|
|
11
|
+
const requestId = randomUUID();
|
|
12
|
+
const version = DAIMON_GROK_ENGINE_BROKER.controlProtocolVersion;
|
|
13
|
+
const payload = Buffer.from(JSON.stringify({ version, kind: "reset_slot", requestId, slot }));
|
|
14
|
+
const frame = Buffer.alloc(4 + payload.length);
|
|
15
|
+
frame.writeUInt32BE(payload.length);
|
|
16
|
+
payload.copy(frame, 4);
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
const socket = createConnection(socketPath);
|
|
19
|
+
let buffer = Buffer.alloc(0), settled = false;
|
|
20
|
+
const finish = (error) => {
|
|
21
|
+
if (settled)
|
|
22
|
+
return;
|
|
23
|
+
settled = true;
|
|
24
|
+
signal.removeEventListener("abort", abort);
|
|
25
|
+
socket.destroy();
|
|
26
|
+
if (error)
|
|
27
|
+
reject(error);
|
|
28
|
+
else
|
|
29
|
+
resolve();
|
|
30
|
+
};
|
|
31
|
+
const abort = () => finish(new Error("Training broker reset aborted; slot must be quarantined"));
|
|
32
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
33
|
+
socket.once("error", error => finish(error));
|
|
34
|
+
socket.once("close", () => finish(new Error("Training broker reset refused: slot active, unavailable, or reset failed")));
|
|
35
|
+
socket.once("connect", () => socket.write(frame));
|
|
36
|
+
socket.on("data", chunk => {
|
|
37
|
+
buffer = Buffer.concat([buffer, chunk]);
|
|
38
|
+
if (buffer.length < 4)
|
|
39
|
+
return;
|
|
40
|
+
const size = buffer.readUInt32BE(0);
|
|
41
|
+
if (size < 2 || size > 4096 || buffer.length > size + 4) {
|
|
42
|
+
finish(new Error("Invalid broker reset response frame"));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (buffer.length < size + 4)
|
|
46
|
+
return;
|
|
47
|
+
try {
|
|
48
|
+
const response = JSON.parse(buffer.subarray(4).toString("utf8"));
|
|
49
|
+
if (!response || response.version !== version || response.kind !== "slot_reset" || response.requestId !== requestId
|
|
50
|
+
|| response.slot !== slot || Object.keys(response).length !== 4)
|
|
51
|
+
throw Error("Invalid broker reset acknowledgement");
|
|
52
|
+
finish();
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
finish(error instanceof Error ? error : new Error("Invalid broker reset response"));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
/** The native control relay authenticates SO_PEERCRED uid 2000 and rejects root. */
|
|
61
|
+
export const resetTrainingBrokerSlotAsOrganization = async (slot, signal, execute = promisify(execFile)) => {
|
|
62
|
+
trainingSlotPaths(slot);
|
|
63
|
+
signal.throwIfAborted();
|
|
64
|
+
const uid = DAIMON_GROK_ENGINE_BROKER.identities.organizationUid;
|
|
65
|
+
const program = `import { resetTrainingBrokerSlot } from ${JSON.stringify(import.meta.url)}; await resetTrainingBrokerSlot(Number(process.argv[1]), AbortSignal.timeout(10000)); process.stdout.write("slot-reset-complete\\n");`;
|
|
66
|
+
const result = await execute("setpriv", ["--clear-groups", `--reuid=${uid}`, `--regid=${uid}`,
|
|
67
|
+
"--inh-caps=-all", "--ambient-caps=-all", "--bounding-set=-all", "--", process.execPath,
|
|
68
|
+
"--input-type=module", "--eval", program, String(slot)], { signal, timeout: 15_000 });
|
|
69
|
+
if (result.stdout !== "slot-reset-complete\n")
|
|
70
|
+
throw Error("Broker reset child returned no verified acknowledgement");
|
|
71
|
+
};
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import type { DaimonGrokRegistration } from "../../containerDaimonGrokWorkerRender.js";
|
|
2
2
|
import type { TrainingBrokerDeclaration } from "./declaration.js";
|
|
3
|
-
import { type BrokerChild } from "./processes.js";
|
|
4
3
|
import type { TrainingSlotRuntime } from "./supervisor.js";
|
|
5
4
|
export interface TrainingSlotRuntimeOptions {
|
|
6
5
|
declaration: TrainingBrokerDeclaration;
|
|
7
6
|
registration: DaimonGrokRegistration;
|
|
8
7
|
projectionSha256: string;
|
|
8
|
+
reset: (slot: number, signal: AbortSignal) => Promise<void>;
|
|
9
9
|
/** Test seam: the shell the provisioning script runs in and the `/proc` it reads identities from. */
|
|
10
10
|
shell?: string;
|
|
11
11
|
procRoot?: string;
|
|
12
12
|
logPath?: string;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export declare const createTrainingSlotRuntime: (options: TrainingSlotRuntimeOptions) => TrainingSlotRuntime & {
|
|
24
|
-
children(): readonly BrokerChild[];
|
|
25
|
-
};
|
|
14
|
+
export declare const createTrainingSlotRuntime: (options: TrainingSlotRuntimeOptions) => TrainingSlotRuntime;
|
|
15
|
+
/** Never remove or change the ownership/mode of a worker home or tmp: siblings attest those inodes. */
|
|
16
|
+
export declare const renderTrainingSlotWipe: (slot: number) => string[];
|
|
17
|
+
/** A failed privilege drop is not evidence of denial; require a positive worker verdict. */
|
|
18
|
+
export declare const probeTrainingWorker: (uid: number, target: string, depth: "read" | "enter", execute?: (command: string, args: string[], options: {
|
|
19
|
+
timeout: number;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
stdout: string;
|
|
22
|
+
}>) => Promise<boolean>;
|
|
@@ -1,68 +1,23 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { appendFileSync } from "node:fs";
|
|
4
|
-
import { chmod, chown, mkdir, readFile,
|
|
4
|
+
import { chmod, chown, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { setTimeout as pause } from "node:timers/promises";
|
|
7
6
|
import { promisify } from "node:util";
|
|
8
7
|
import { SpawnfileError } from "../../../shared/index.js";
|
|
9
|
-
import { DAIMON_GROK_ENGINE_BROKER } from "../../../runtime/daimon/contractManifest.js";
|
|
10
8
|
import { MOUNT_AWARE_CLEAR_HELPER } from "../../containerDaimonBrokerRender.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { probeTrainingSiblingClock } from "./clockProbe.js";
|
|
10
|
+
import { renderTrainingTaskClockAssertions } from "./taskClock.js";
|
|
11
|
+
import { renderTrainingSlotProvisioning } from "./provisioning.js";
|
|
13
12
|
import { buildTrainingSlotReceipt, readGrokExecutableSha256, resolveTrainingCanaries } from "./receipt.js";
|
|
14
|
-
import { DAIMON_ORGANIZATION_UID, TRAINING_HOST_BIND_DENY_PATHS, TRAINING_SEALED_DENY_PATHS,
|
|
13
|
+
import { DAIMON_ORGANIZATION_UID, TRAINING_HOST_BIND_DENY_PATHS, TRAINING_SEALED_DENY_PATHS, trainingSlotPaths, trainingWipeTargets, trainingClearTargets, TRAINING_SUPERVISOR_LOG } from "./paths.js";
|
|
15
14
|
const run = promisify(execFile);
|
|
16
15
|
const quote = (value) => `'${value.replace(/'/gu, `'"'"'`)}'`;
|
|
17
|
-
const CREDENTIAL_JOURNAL = `${DAIMON_GROK_ENGINE_BROKER.credentialHomePath}/.daimon-broker/credential-journal.json`;
|
|
18
|
-
/** State the broker's credential authority may be left in; only `promoted` (or no journal at all) is settled. */
|
|
19
|
-
const settledJournal = async () => {
|
|
20
|
-
const raw = await readFile(CREDENTIAL_JOURNAL, "utf8").catch((error) => {
|
|
21
|
-
if (error.code === "ENOENT")
|
|
22
|
-
return undefined;
|
|
23
|
-
throw error;
|
|
24
|
-
});
|
|
25
|
-
if (raw === undefined)
|
|
26
|
-
return "settled";
|
|
27
|
-
const journal = JSON.parse(raw);
|
|
28
|
-
if (journal.version !== "noopolis.daimon.broker-credential-journal.v1")
|
|
29
|
-
throw new SpawnfileError("runtime_error", "The broker credential journal is not a recognised version");
|
|
30
|
-
return journal.state === "promoted" ? "settled" : journal.state === "refreshing" ? "refreshing" : "stale";
|
|
31
|
-
};
|
|
32
|
-
/** A turn is active while its registry record says so; a terminal record is finished work and never blocks a recycle. */
|
|
33
|
-
const activeTurns = async () => {
|
|
34
|
-
const names = await readdir(TRAINING_SLOT_TURN_STORE).catch((error) => {
|
|
35
|
-
if (error.code === "ENOENT")
|
|
36
|
-
return [];
|
|
37
|
-
throw error;
|
|
38
|
-
});
|
|
39
|
-
let active = 0;
|
|
40
|
-
for (const name of names) {
|
|
41
|
-
if (!name.endsWith(".json"))
|
|
42
|
-
continue;
|
|
43
|
-
const raw = await readFile(path.join(TRAINING_SLOT_TURN_STORE, name), "utf8").catch(() => "");
|
|
44
|
-
try {
|
|
45
|
-
if (JSON.parse(raw).state === "active")
|
|
46
|
-
active += 1;
|
|
47
|
-
}
|
|
48
|
-
catch { /* a half-written record is not an active turn */ }
|
|
49
|
-
}
|
|
50
|
-
return active;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* The real slot runtime: what `recycle` actually does to this container.
|
|
54
|
-
*
|
|
55
|
-
* Every mutation goes through the same rendered provisioning the root
|
|
56
|
-
* entrypoint ran at startup, so a recycled slot is byte-identically
|
|
57
|
-
* provisioned — including the credential journal recovery, which is how a
|
|
58
|
-
* recycle that lands on a `refreshing` or `stale` realm either recovers or
|
|
59
|
-
* fails closed with a named error instead of leaving a silently stale realm.
|
|
60
|
-
*/
|
|
61
16
|
export const createTrainingSlotRuntime = (options) => {
|
|
62
17
|
const shell = options.shell ?? "/bin/bash";
|
|
63
18
|
const logPath = options.logPath ?? TRAINING_SUPERVISOR_LOG;
|
|
64
|
-
const
|
|
65
|
-
|
|
19
|
+
const p = trainingSlotPaths(options.registration.slot);
|
|
20
|
+
const script = renderTrainingSlotProvisioning(options.registration).join("\n");
|
|
66
21
|
const log = (line) => {
|
|
67
22
|
const entry = `${new Date().toISOString()} ${line}\n`;
|
|
68
23
|
process.stderr.write(`[slot-supervisor] ${entry}`);
|
|
@@ -71,61 +26,18 @@ export const createTrainingSlotRuntime = (options) => {
|
|
|
71
26
|
}
|
|
72
27
|
catch { /* the log is diagnostics, never the gate */ }
|
|
73
28
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* can be unreadable (`test -r` fails) and still searchable, and a subject
|
|
80
|
-
* that knows `test.paideia.yaml` by name needs only search permission.
|
|
81
|
-
*/
|
|
82
|
-
const probe = async (target, depth) => {
|
|
83
|
-
const quoted = JSON.stringify(target);
|
|
84
|
-
const reachable = depth === "enter"
|
|
85
|
-
? `test -r ${quoted} || test -x ${quoted} || ls -1 ${quoted} >/dev/null 2>&1`
|
|
86
|
-
: `test -r ${quoted}`;
|
|
87
|
-
try {
|
|
88
|
-
await run("setpriv", ["--clear-groups", `--reuid=${options.registration.uid}`, `--regid=${options.registration.uid}`,
|
|
89
|
-
"--inh-caps=-all", "--ambient-caps=-all", "--bounding-set=-all", "--", "/bin/sh", "-c", reachable], { timeout: 10_000 });
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
29
|
+
const siblingClocks = Array.from({ length: options.declaration.slots }, (_, slot) => trainingSlotPaths(slot))
|
|
30
|
+
.filter(peer => peer.slot !== p.slot).map(peer => peer.clockDirectory);
|
|
31
|
+
const probe = (target, depth) => siblingClocks.includes(target)
|
|
32
|
+
? probeTrainingSiblingClock(p.slot, target)
|
|
33
|
+
: probeTrainingWorker(options.registration.uid, target, depth);
|
|
96
34
|
return {
|
|
97
35
|
log,
|
|
98
|
-
|
|
99
|
-
drain: async (signal) => {
|
|
100
|
-
for (;;) {
|
|
101
|
-
signal.throwIfAborted();
|
|
102
|
-
const state = await settledJournal();
|
|
103
|
-
if (state === "stale") {
|
|
104
|
-
// The audited provisioning below owns stale-realm recovery; it promotes the bootstrap or refuses outright.
|
|
105
|
-
log("credential journal is stale; the recycle will replay the root credential recovery");
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (state === "settled" && await activeTurns() === 0)
|
|
109
|
-
return;
|
|
110
|
-
await pause(100);
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
stop: async () => { await stopBrokerProcesses(children, log); children = []; },
|
|
36
|
+
reset: signal => options.reset(p.slot, signal),
|
|
114
37
|
wipe: async () => {
|
|
115
38
|
// Root holds `CAP_CHOWN` and `CAP_DAC_READ_SEARCH` but not `CAP_DAC_OVERRIDE`, so it cannot delete
|
|
116
39
|
// inside a directory it handed to the worker or the broker. Reclaim each tree first, then remove it.
|
|
117
|
-
const
|
|
118
|
-
const contents = [TRAINING_SLOT_WORKSPACE, TRAINING_SLOT_USAGE_DIRECTORY];
|
|
119
|
-
const script = [
|
|
120
|
-
...MOUNT_AWARE_CLEAR_HELPER,
|
|
121
|
-
// The parent has to be reclaimed too: unlinking is a write to the *directory*, and the slot hands
|
|
122
|
-
// several of these parents to uid 2000 or the broker. Provisioning restores every mode right after.
|
|
123
|
-
'reclaim() { parent=$(dirname "$1"); chown 0:0 "$parent"; chmod u+rwx "$parent"; if [ -e "$1" ]; then chown -R 0:0 "$1"; chmod -R u+rwX "$1"; fi; }',
|
|
124
|
-
...targets.map((target) => `reclaim ${quote(target)}; spawnfile_remove_tree ${quote(target)}`),
|
|
125
|
-
// The workspace and the per-slot ledger directory keep their own root: the registered paths must
|
|
126
|
-
// stay canonical across a recycle, so only what a trial put inside them goes.
|
|
127
|
-
...contents.map((target) => `reclaim ${quote(target)}; spawnfile_clear_tree ${quote(target)}`)
|
|
128
|
-
].join("\n");
|
|
40
|
+
const script = renderTrainingSlotWipe(p.slot).join("\n");
|
|
129
41
|
await run(shell, ["--noprofile", "--norc", "-ceu", script], { maxBuffer: 1024 * 1024 }).catch((error) => {
|
|
130
42
|
const detail = error;
|
|
131
43
|
throw new SpawnfileError("runtime_error", `Training slot wipe failed: ${(detail.stderr ?? "").slice(-1024).trim() || "no diagnostic"}`);
|
|
@@ -139,19 +51,21 @@ export const createTrainingSlotRuntime = (options) => {
|
|
|
139
51
|
if (result.stdout.trim())
|
|
140
52
|
log(`provisioning: ${result.stdout.trim().slice(-2048)}`);
|
|
141
53
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
54
|
+
canaries: async () => {
|
|
55
|
+
await run(shell, ["--noprofile", "--norc", "-ceu", renderTrainingTaskClockAssertions(options.registration).join("\n")]);
|
|
56
|
+
return resolveTrainingCanaries({
|
|
57
|
+
denyPaths: options.registration.denyPaths, probe, log, hostBindPaths: TRAINING_HOST_BIND_DENY_PATHS,
|
|
58
|
+
sealedPaths: TRAINING_SEALED_DENY_PATHS,
|
|
59
|
+
mountinfo: await readFile(`${options.procRoot ?? "/proc"}/self/mountinfo`, "utf8"),
|
|
60
|
+
unenforcedBindPolicy: options.declaration.unenforcedBindPolicy
|
|
61
|
+
});
|
|
62
|
+
},
|
|
149
63
|
nextGeneration: async () => {
|
|
150
|
-
const previous = await readFile(
|
|
64
|
+
const previous = await readFile(p.generationFile, "utf8").catch(() => "");
|
|
151
65
|
const parsed = Number.parseInt(JSON.parse(previous || "{}").generation ?? "0", 10);
|
|
152
66
|
// Seeded from the wall clock so a container restart cannot hand out a generation an evaluator already accepted.
|
|
153
67
|
const generation = Math.max(Number.isSafeInteger(parsed) && parsed > 0 ? parsed + 1 : 1, Math.floor(Date.now() / 1000));
|
|
154
|
-
await writeFile(
|
|
68
|
+
await writeFile(p.generationFile, `${JSON.stringify({ generation })}\n`, { mode: 0o600 });
|
|
155
69
|
return generation;
|
|
156
70
|
},
|
|
157
71
|
publishReceipt: async ({ generation, nonce, canaries }) => {
|
|
@@ -161,13 +75,53 @@ export const createTrainingSlotRuntime = (options) => {
|
|
|
161
75
|
seccompProfileSha256: options.declaration.seccompProfileSha256,
|
|
162
76
|
grokExecutableSha256: readGrokExecutableSha256(), canaries, createdAt: new Date()
|
|
163
77
|
});
|
|
164
|
-
const temporary = `${
|
|
165
|
-
await mkdir(path.dirname(
|
|
78
|
+
const temporary = `${p.preflightReceipt}.${randomUUID()}.tmp`;
|
|
79
|
+
await mkdir(path.dirname(p.preflightReceipt), { recursive: true });
|
|
166
80
|
await writeFile(temporary, `${JSON.stringify(receipt)}\n`, { mode: 0o600, flag: "wx" });
|
|
167
81
|
await chown(temporary, 0, DAIMON_ORGANIZATION_UID);
|
|
168
82
|
await chmod(temporary, 0o640);
|
|
169
|
-
await rename(temporary,
|
|
170
|
-
return
|
|
83
|
+
await rename(temporary, p.preflightReceipt);
|
|
84
|
+
return p.preflightReceipt;
|
|
171
85
|
}
|
|
172
86
|
};
|
|
173
87
|
};
|
|
88
|
+
/** Never remove or change the ownership/mode of a worker home or tmp: siblings attest those inodes. */
|
|
89
|
+
export const renderTrainingSlotWipe = (slot) => {
|
|
90
|
+
const p = trainingSlotPaths(slot);
|
|
91
|
+
const worker = `setpriv --clear-groups --reuid=${p.workerUid} --regid=${p.workerUid} --inh-caps=-all --ambient-caps=-all --bounding-set=-all --`;
|
|
92
|
+
return [
|
|
93
|
+
...MOUNT_AWARE_CLEAR_HELPER,
|
|
94
|
+
// Attested roots must still be canonical before any recursive mutation.
|
|
95
|
+
...[p.workerHome, p.privateTmp, ...trainingWipeTargets(slot), ...trainingClearTargets(slot)].map(target => `if [ -e ${quote(target)} ] || [ -L ${quote(target)} ]; then if [ -L ${quote(target)} ] || [ "$(realpath ${quote(target)})" != ${quote(target)} ]; then echo "noncanonical slot wipe target" >&2; exit 1; fi; fi`),
|
|
96
|
+
'reclaim() { parent=$(dirname "$1"); chown 0:0 "$parent"; chmod u+rwx "$parent"; if [ -e "$1" ]; then chown -R 0:0 "$1"; chmod -R u+rwX "$1"; fi; }',
|
|
97
|
+
...trainingWipeTargets(slot).map(target => `reclaim ${quote(target)}; spawnfile_remove_tree ${quote(target)}`),
|
|
98
|
+
...trainingClearTargets(slot).map(target => `reclaim ${quote(target)}; spawnfile_clear_tree ${quote(target)}`),
|
|
99
|
+
// Reclaim descendants only, then unlink as the worker, who owns the stable parent. No sibling inode changes.
|
|
100
|
+
`for worker_entry in ${quote(p.workerHome)}/* ${quote(p.workerHome)}/.[!.]* ${quote(p.workerHome)}/..?*; do`,
|
|
101
|
+
' if [ ! -e "$worker_entry" ] && [ ! -L "$worker_entry" ]; then continue; fi',
|
|
102
|
+
` if [ "$worker_entry" = ${quote(p.privateTmp)} ]; then continue; fi`,
|
|
103
|
+
' if spawnfile_holds_mount "$worker_entry"; then echo "worker home contains a mount" >&2; exit 1; fi',
|
|
104
|
+
` chown -hR ${p.workerUid}:${p.workerUid} "$worker_entry"`,
|
|
105
|
+
` ${worker} /bin/sh -ceu 'if [ ! -L "$1" ]; then chmod -R u+rwX "$1"; fi; rm -rf "$1"' sh "$worker_entry"`,
|
|
106
|
+
'done',
|
|
107
|
+
`for worker_entry in ${quote(p.privateTmp)}/* ${quote(p.privateTmp)}/.[!.]* ${quote(p.privateTmp)}/..?*; do`,
|
|
108
|
+
' if [ ! -e "$worker_entry" ] && [ ! -L "$worker_entry" ]; then continue; fi',
|
|
109
|
+
' if spawnfile_holds_mount "$worker_entry"; then echo "worker tmp contains a mount" >&2; exit 1; fi',
|
|
110
|
+
` chown -hR ${p.workerUid}:${p.workerUid} "$worker_entry"`,
|
|
111
|
+
` ${worker} /bin/sh -ceu 'if [ ! -L "$1" ]; then chmod -R u+rwX "$1"; fi; rm -rf "$1"' sh "$worker_entry"`,
|
|
112
|
+
'done'
|
|
113
|
+
];
|
|
114
|
+
};
|
|
115
|
+
/** A failed privilege drop is not evidence of denial; require a positive worker verdict. */
|
|
116
|
+
export const probeTrainingWorker = async (uid, target, depth, execute = run) => {
|
|
117
|
+
const q = quote(target);
|
|
118
|
+
const reachable = depth === "enter" ? `test -r ${q} || test -x ${q} || ls -1 ${q} >/dev/null 2>&1` : `test -r ${q}`;
|
|
119
|
+
const result = await execute("setpriv", ["--clear-groups", `--reuid=${uid}`, `--regid=${uid}`,
|
|
120
|
+
"--inh-caps=-all", "--ambient-caps=-all", "--bounding-set=-all", "--", "/bin/sh", "-c",
|
|
121
|
+
`if ${reachable}; then echo reachable; else echo denied; fi`], { timeout: 10_000 });
|
|
122
|
+
if (result.stdout.trim() === "denied")
|
|
123
|
+
return true;
|
|
124
|
+
if (result.stdout.trim() === "reachable")
|
|
125
|
+
return false;
|
|
126
|
+
throw new SpawnfileError("runtime_error", "Training worker canary returned no verified verdict");
|
|
127
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const TRAINING_SUPERVISOR_PROTOCOL: "spawnfile.training-slot-supervisor.
|
|
1
|
+
export declare const TRAINING_SUPERVISOR_PROTOCOL: "spawnfile.training-slot-supervisor.v2";
|
|
2
2
|
export declare const TRAINING_SUPERVISOR_MAX_REQUEST_BYTES = 4096;
|
|
3
3
|
/**
|
|
4
4
|
* Everything the recycle verb does to the running slot. It is an interface so
|
|
@@ -8,14 +8,12 @@ export declare const TRAINING_SUPERVISOR_MAX_REQUEST_BYTES = 4096;
|
|
|
8
8
|
* of bug a live check finds far too late.
|
|
9
9
|
*/
|
|
10
10
|
export interface TrainingSlotRuntime {
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Removes worker home, slot workspace, wake-acceptance, turn store, per-slot ledger and Grok session state. */
|
|
11
|
+
/** Broker refuses active turns and live workers, then resets only this slot clock/turn store. */
|
|
12
|
+
reset(signal: AbortSignal): Promise<void>;
|
|
13
|
+
/** Clears this slot while preserving the worker-home/tmp identities attested by sibling turns. */
|
|
15
14
|
wipe(): Promise<void>;
|
|
16
|
-
/**
|
|
15
|
+
/** Reuses the audited worker provisioning; shared broker files are untouched. */
|
|
17
16
|
provision(): Promise<void>;
|
|
18
|
-
start(): Promise<void>;
|
|
19
17
|
/** Worker-uid denial canaries over every deny path; throws when one is still reachable. */
|
|
20
18
|
canaries(): Promise<{
|
|
21
19
|
path: string;
|
|
@@ -57,7 +55,7 @@ export declare const startTrainingSlot: (runtime: TrainingSlotRuntime, nonce: st
|
|
|
57
55
|
canaries: number;
|
|
58
56
|
}>;
|
|
59
57
|
export interface TrainingSlotSupervisorOptions {
|
|
60
|
-
|
|
58
|
+
runtimes: readonly TrainingSlotRuntime[];
|
|
61
59
|
/** Only this uid may recycle. Paideia, DSPy and the judges all run as it; every worker uid is refused. */
|
|
62
60
|
organizationUid?: number;
|
|
63
61
|
drainTimeoutMs?: number;
|
|
@@ -66,6 +64,7 @@ export interface TrainingSlotSupervisorOptions {
|
|
|
66
64
|
export interface TrainingRecycleResult {
|
|
67
65
|
ok: true;
|
|
68
66
|
verb: "recycle";
|
|
67
|
+
slot: number;
|
|
69
68
|
generation: number;
|
|
70
69
|
nonce: string;
|
|
71
70
|
receipt: string;
|
|
@@ -74,15 +73,15 @@ export interface TrainingRecycleResult {
|
|
|
74
73
|
/**
|
|
75
74
|
* The single-verb root slot supervisor.
|
|
76
75
|
*
|
|
77
|
-
* One verb,
|
|
76
|
+
* One verb, slot and nonce, no path or command ever supplied by the caller: the
|
|
78
77
|
* whole point of D4 is that recycling replays the container's own audited
|
|
79
78
|
* provisioning rather than exposing a root file-system API to the evaluator.
|
|
80
|
-
* Recycles are serialized — a second caller waits rather than interleaving a
|
|
79
|
+
* Recycles of the same slot are serialized — a second caller waits rather than interleaving a
|
|
81
80
|
* wipe with a provision.
|
|
82
81
|
*/
|
|
83
82
|
export declare const createTrainingSlotSupervisor: (options: TrainingSlotSupervisorOptions) => {
|
|
84
83
|
/** Serialized: a recycle already in flight completes before the next one starts. */
|
|
85
|
-
recycle: (nonce: string, peerUid: number) => Promise<TrainingRecycleResult>;
|
|
84
|
+
recycle: (slot: number, nonce: string, peerUid: number) => Promise<TrainingRecycleResult>;
|
|
86
85
|
};
|
|
87
86
|
export type TrainingSlotSupervisor = ReturnType<typeof createTrainingSlotSupervisor>;
|
|
88
87
|
/**
|