spawnfile 0.1.17 → 0.1.18
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/package.json +3 -3
- package/runtimes.yaml +8 -6
|
@@ -3,7 +3,7 @@ import { createServer } from "node:net";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { SpawnfileError } from "../../../shared/index.js";
|
|
5
5
|
import { DAIMON_ORGANIZATION_UID } from "./paths.js";
|
|
6
|
-
export const TRAINING_SUPERVISOR_PROTOCOL = "spawnfile.training-slot-supervisor.
|
|
6
|
+
export const TRAINING_SUPERVISOR_PROTOCOL = "spawnfile.training-slot-supervisor.v2";
|
|
7
7
|
export const TRAINING_SUPERVISOR_MAX_REQUEST_BYTES = 4_096;
|
|
8
8
|
const NONCE = /^[a-f0-9]{64}$/u;
|
|
9
9
|
/**
|
|
@@ -22,8 +22,6 @@ const NONCE = /^[a-f0-9]{64}$/u;
|
|
|
22
22
|
* publishes, from the same canaries.
|
|
23
23
|
*/
|
|
24
24
|
export const startTrainingSlot = async (runtime, nonce) => {
|
|
25
|
-
await runtime.provision();
|
|
26
|
-
await runtime.start();
|
|
27
25
|
const canaries = await runtime.canaries();
|
|
28
26
|
const generation = await runtime.nextGeneration();
|
|
29
27
|
const receipt = await runtime.publishReceipt({ generation, nonce, canaries });
|
|
@@ -33,47 +31,48 @@ export const startTrainingSlot = async (runtime, nonce) => {
|
|
|
33
31
|
/**
|
|
34
32
|
* The single-verb root slot supervisor.
|
|
35
33
|
*
|
|
36
|
-
* One verb,
|
|
34
|
+
* One verb, slot and nonce, no path or command ever supplied by the caller: the
|
|
37
35
|
* whole point of D4 is that recycling replays the container's own audited
|
|
38
36
|
* provisioning rather than exposing a root file-system API to the evaluator.
|
|
39
|
-
* Recycles are serialized — a second caller waits rather than interleaving a
|
|
37
|
+
* Recycles of the same slot are serialized — a second caller waits rather than interleaving a
|
|
40
38
|
* wipe with a provision.
|
|
41
39
|
*/
|
|
42
40
|
export const createTrainingSlotSupervisor = (options) => {
|
|
43
41
|
const organizationUid = options.organizationUid ?? DAIMON_ORGANIZATION_UID;
|
|
44
42
|
const drainTimeoutMs = options.drainTimeoutMs ?? 120_000;
|
|
45
43
|
const now = options.now ?? Date.now;
|
|
46
|
-
|
|
47
|
-
const recycle = async (nonce, peerUid) => {
|
|
44
|
+
const queues = new Map();
|
|
45
|
+
const recycle = async (slot, nonce, peerUid) => {
|
|
48
46
|
if (peerUid !== organizationUid)
|
|
49
47
|
throw new SpawnfileError("validation_error", `Grok slot recycle refused for uid ${peerUid}`);
|
|
50
48
|
if (!NONCE.test(nonce))
|
|
51
49
|
throw new SpawnfileError("validation_error", "Grok slot recycle requires a 32-byte hex nonce");
|
|
50
|
+
if (!Number.isInteger(slot) || slot < 0 || slot >= options.runtimes.length)
|
|
51
|
+
throw new SpawnfileError("validation_error", "Grok slot recycle requires a declared slot index");
|
|
52
|
+
const runtime = options.runtimes[slot];
|
|
52
53
|
const started = now();
|
|
53
54
|
const controller = new AbortController();
|
|
54
55
|
const timer = setTimeout(() => controller.abort(), drainTimeoutMs);
|
|
55
56
|
try {
|
|
56
|
-
await
|
|
57
|
+
await runtime.reset(controller.signal);
|
|
57
58
|
}
|
|
58
59
|
finally {
|
|
59
60
|
clearTimeout(timer);
|
|
60
61
|
}
|
|
61
|
-
await
|
|
62
|
-
await
|
|
63
|
-
await
|
|
64
|
-
await
|
|
65
|
-
const
|
|
66
|
-
const generation = await options.runtime.nextGeneration();
|
|
67
|
-
const receipt = await options.runtime.publishReceipt({ generation, nonce, canaries });
|
|
62
|
+
await runtime.wipe();
|
|
63
|
+
await runtime.provision();
|
|
64
|
+
const canaries = await runtime.canaries();
|
|
65
|
+
const generation = await runtime.nextGeneration();
|
|
66
|
+
const receipt = await runtime.publishReceipt({ generation, nonce, canaries });
|
|
68
67
|
const durationMs = now() - started;
|
|
69
|
-
|
|
70
|
-
return { ok: true, verb: "recycle", generation, nonce, receipt, durationMs };
|
|
68
|
+
runtime.log(`recycle generation=${generation} canaries=${canaries.length} durationMs=${durationMs}`);
|
|
69
|
+
return { ok: true, verb: "recycle", slot, generation, nonce, receipt, durationMs };
|
|
71
70
|
};
|
|
72
71
|
return {
|
|
73
72
|
/** Serialized: a recycle already in flight completes before the next one starts. */
|
|
74
|
-
recycle: (nonce, peerUid) => {
|
|
75
|
-
const next =
|
|
76
|
-
|
|
73
|
+
recycle: (slot, nonce, peerUid) => {
|
|
74
|
+
const next = (queues.get(slot) ?? Promise.resolve()).then(() => recycle(slot, nonce, peerUid));
|
|
75
|
+
queues.set(slot, next.catch(() => undefined));
|
|
77
76
|
return next;
|
|
78
77
|
}
|
|
79
78
|
};
|
|
@@ -142,8 +141,8 @@ export const serveTrainingSlotSupervisor = (supervisor, socketPath, log, organiz
|
|
|
142
141
|
answer(failure("request is not JSON"));
|
|
143
142
|
return;
|
|
144
143
|
}
|
|
145
|
-
if (request.v !== TRAINING_SUPERVISOR_PROTOCOL || request.verb !== "recycle" || typeof request.nonce !== "string"
|
|
146
|
-
|| Object.keys(request).length !==
|
|
144
|
+
if (!request || typeof request !== "object" || Array.isArray(request) || request.v !== TRAINING_SUPERVISOR_PROTOCOL || request.verb !== "recycle" || typeof request.nonce !== "string"
|
|
145
|
+
|| typeof request.slot !== "number" || Object.keys(request).length !== 4) {
|
|
147
146
|
answer(failure("unsupported request"));
|
|
148
147
|
return;
|
|
149
148
|
}
|
|
@@ -151,7 +150,7 @@ export const serveTrainingSlotSupervisor = (supervisor, socketPath, log, organiz
|
|
|
151
150
|
answer(failure("peer identity is unavailable"));
|
|
152
151
|
return;
|
|
153
152
|
}
|
|
154
|
-
supervisor.recycle(request.nonce, peerUid)
|
|
153
|
+
supervisor.recycle(request.slot, request.nonce, peerUid)
|
|
155
154
|
.then((result) => answer(`${JSON.stringify({ v: TRAINING_SUPERVISOR_PROTOCOL, ...result })}\n`))
|
|
156
155
|
.catch((error) => {
|
|
157
156
|
const message = error instanceof Error ? error.message : "recycle failed";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DaimonGrokRegistration } from "../../containerDaimonGrokWorkerRender.js";
|
|
2
|
+
/** Reclaim only the clock subtree before the shared program clears the control root at startup. */
|
|
3
|
+
export declare const renderTrainingTaskClockReset: () => string[];
|
|
4
|
+
/** Before a receipt, bind the actual installed bytes and worker access to the clocked projection. */
|
|
5
|
+
export declare const renderTrainingTaskClockAssertions: (registration: DaimonGrokRegistration) => string[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DAIMON_GROK_ENGINE_BROKER } from "../../../runtime/daimon/contractManifest.js";
|
|
2
|
+
import { SpawnfileError } from "../../../shared/index.js";
|
|
3
|
+
import { resolveDaimonGrokClockedWorkerConfig } from "../../../runtime/daimon/grokWorkerContract.js";
|
|
4
|
+
const clock = DAIMON_GROK_ENGINE_BROKER.worker.taskClock;
|
|
5
|
+
const quote = (value) => `'${value.replace(/'/gu, `'"'"'`)}'`;
|
|
6
|
+
/** Reclaim only the clock subtree before the shared program clears the control root at startup. */
|
|
7
|
+
export const renderTrainingTaskClockReset = () => [
|
|
8
|
+
`test ! -L ${quote(clock.rootDirectoryPath)}`,
|
|
9
|
+
`if [ -d ${quote(clock.rootDirectoryPath)} ]; then chown -R 0:0 ${quote(clock.rootDirectoryPath)}; chmod -R u+rwX ${quote(clock.rootDirectoryPath)}; fi`
|
|
10
|
+
];
|
|
11
|
+
/** Before a receipt, bind the actual installed bytes and worker access to the clocked projection. */
|
|
12
|
+
export const renderTrainingTaskClockAssertions = (registration) => {
|
|
13
|
+
const pin = resolveDaimonGrokClockedWorkerConfig(registration.model, registration.reasoningEffort, registration.slot).sha256;
|
|
14
|
+
const directoryPath = clock.slotDirectoryPattern.replace("{slot}", String(registration.slot));
|
|
15
|
+
const timestampFilePath = clock.slotFilePattern.replace("{slot}", String(registration.slot));
|
|
16
|
+
if (registration.configVariant !== "clocked" || registration.configSha256 !== pin) {
|
|
17
|
+
throw new SpawnfileError("runtime_error", "Training slot requires the pinned clocked worker config");
|
|
18
|
+
}
|
|
19
|
+
const worker = [
|
|
20
|
+
`test -r ${quote(timestampFilePath)}`, `test ! -w ${quote(timestampFilePath)}`,
|
|
21
|
+
`test -x ${quote(directoryPath)}`, `test ! -w ${quote(directoryPath)}`,
|
|
22
|
+
`test -r ${quote(clock.preloadPath)}`
|
|
23
|
+
].join(" && ");
|
|
24
|
+
return [
|
|
25
|
+
`test ! -L ${quote(directoryPath)} && test -d ${quote(directoryPath)}`,
|
|
26
|
+
`test ! -L ${quote(timestampFilePath)} && test -f ${quote(timestampFilePath)}`,
|
|
27
|
+
`test "$(stat -c '%u:%g %a' ${quote(directoryPath)})" = "${clock.ownerUid}:${clock.ownerUid} ${clock.directoryMode.toString(8)}"`,
|
|
28
|
+
`test "$(stat -c '%u:%g %a %h' ${quote(timestampFilePath)})" = "${clock.ownerUid}:${clock.ownerUid} ${clock.fileMode.toString(8)} 1"`,
|
|
29
|
+
`test "$(sha256sum ${quote(`${registration.grokHome}/config.toml`)} | cut -d ' ' -f1)" = ${quote(pin)}`,
|
|
30
|
+
// The read-only image bakes both the fixed symlink and the distro target. Refuse writable or
|
|
31
|
+
// non-root-owned ancestors/targets; a missing library must never masquerade as a working clock.
|
|
32
|
+
"node <<'SPAWNFILE_TASK_CLOCK_LIBRARY'",
|
|
33
|
+
"const fs = require('node:fs'), path = require('node:path');",
|
|
34
|
+
`const preload = ${JSON.stringify(clock.preloadPath)};`,
|
|
35
|
+
"const link = fs.lstatSync(preload); if (!link.isSymbolicLink() || link.uid !== 0 || link.gid !== 0) throw new Error('unsafe task clock preload link');",
|
|
36
|
+
"const library = fs.realpathSync(preload); if (!/^\\/usr\\/lib\\/(x86_64|aarch64)-linux-gnu\\/faketime\\/libfaketime\\.so\\.1$/.test(library) || !fs.statSync(library).isFile()) throw new Error('unexpected task clock library');",
|
|
37
|
+
"for (const root of [path.dirname(preload), library]) { for (let at = root;; at = path.dirname(at)) { const info = fs.lstatSync(at); if (info.isSymbolicLink() || info.uid !== 0 || info.gid !== 0 || (info.mode & 0o022)) throw new Error(`unsafe task clock library path: ${at}`); if (at === '/') break; } }",
|
|
38
|
+
"SPAWNFILE_TASK_CLOCK_LIBRARY",
|
|
39
|
+
`setpriv --clear-groups --reuid ${registration.uid} --regid ${registration.uid} --inh-caps=-all --ambient-caps=-all --bounding-set=-all -- /bin/sh -ceu ${quote(worker)}`
|
|
40
|
+
];
|
|
41
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface CompiledAgentPaths {
|
|
2
|
+
workspace: string;
|
|
3
|
+
runtimeConfig: string;
|
|
4
|
+
home: string | null;
|
|
5
|
+
skillRoots: string[];
|
|
6
|
+
moltnet: {
|
|
7
|
+
networkId: string;
|
|
8
|
+
memberId: string;
|
|
9
|
+
nodeConfig: string;
|
|
10
|
+
serverConfig: string | null;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export interface CompiledAgent extends CompiledAgentPaths {
|
|
14
|
+
agentId: string;
|
|
15
|
+
runtime: string;
|
|
16
|
+
instanceId: string;
|
|
17
|
+
/** The same paths in the container's namespace; top-level paths address compileOut/container/rootfs. */
|
|
18
|
+
containerPaths: CompiledAgentPaths;
|
|
19
|
+
}
|
|
20
|
+
/** Read compiler facts only. Does not load runtime state, credentials, or authored manifests. */
|
|
21
|
+
export declare const resolveCompiledAgent: (compileOut: string, agentName: string) => Promise<CompiledAgent>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { WORKSPACE_SKILL_BASE_DIRECTORY } from "../../runtime/common.js";
|
|
5
|
+
const text = z.string().min(1);
|
|
6
|
+
const absolute = text.refine((value) => value.startsWith("/") && value !== "/"
|
|
7
|
+
&& path.posix.normalize(value) === value && !/[\\\0]/u.test(value), "Expected a normalized container absolute path");
|
|
8
|
+
const agentPaths = z.object({ workspace_path: absolute, home_path: absolute.nullable(), skill_roots: z.array(absolute) });
|
|
9
|
+
// Validate the consumed projection, allowing unrelated report fields to evolve.
|
|
10
|
+
const reportSchema = z.object({
|
|
11
|
+
spawnfile_version: z.literal("0.1"),
|
|
12
|
+
nodes: z.array(z.object({ id: text, kind: z.enum(["agent", "team"]) })),
|
|
13
|
+
container: z.object({
|
|
14
|
+
runtime_instances: z.array(z.object({ id: text, runtime: text, node_ids: z.array(text), config_path: absolute,
|
|
15
|
+
workspace_path: absolute, home_path: absolute.nullable(), agent_paths: z.record(text, agentPaths).optional() })),
|
|
16
|
+
moltnet: z.object({
|
|
17
|
+
node_plans: z.array(z.object({ node_id: text, member_id: text, network_id: text, config_path: absolute })),
|
|
18
|
+
server_plans: z.array(z.object({ network_id: text, mode: z.enum(["managed", "external"]), config_path: absolute.optional() }))
|
|
19
|
+
}).optional()
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
/** Read compiler facts only. Does not load runtime state, credentials, or authored manifests. */
|
|
23
|
+
export const resolveCompiledAgent = async (compileOut, agentName) => {
|
|
24
|
+
const file = path.resolve(compileOut, "spawnfile-report.json");
|
|
25
|
+
const report = reportSchema.parse(JSON.parse(await readFile(file, "utf8")));
|
|
26
|
+
const agents = report.nodes.filter((node) => node.kind === "agent");
|
|
27
|
+
const exact = agents.filter((node) => node.id === agentName);
|
|
28
|
+
const candidates = exact.length ? exact : agents.filter((node) => node.id === `agent:${agentName}`);
|
|
29
|
+
if (candidates.length !== 1)
|
|
30
|
+
throw new Error(`Unknown or ambiguous compiled agent: ${agentName}`);
|
|
31
|
+
const agentId = candidates[0].id;
|
|
32
|
+
const instances = report.container.runtime_instances.filter((instance) => instance.node_ids.includes(agentId));
|
|
33
|
+
if (instances.length !== 1)
|
|
34
|
+
throw new Error(`Expected one compiled runtime instance for ${agentId}`);
|
|
35
|
+
const instance = instances[0];
|
|
36
|
+
let paths = instance.agent_paths?.[agentId];
|
|
37
|
+
if (!paths) {
|
|
38
|
+
// Single-agent runtime adapters already report their exact workspace and home.
|
|
39
|
+
if (!["openclaw", "picoclaw"].includes(instance.runtime) || instance.node_ids.length !== 1) {
|
|
40
|
+
throw new Error(`Compile report lacks per-agent paths for ${agentId}; recompile with a current compiler`);
|
|
41
|
+
}
|
|
42
|
+
paths = { workspace_path: instance.workspace_path, home_path: instance.home_path,
|
|
43
|
+
skill_roots: [path.posix.join(instance.workspace_path, path.posix.relative("workspace", WORKSPACE_SKILL_BASE_DIRECTORY))] };
|
|
44
|
+
}
|
|
45
|
+
const moltnet = report.container.moltnet;
|
|
46
|
+
const attachments = (moltnet?.node_plans ?? []).filter((node) => node.node_id === agentId).map((node) => {
|
|
47
|
+
const servers = moltnet.server_plans.filter((server) => server.network_id === node.network_id);
|
|
48
|
+
if (servers.length !== 1 || (servers[0].mode === "managed" && !servers[0].config_path)) {
|
|
49
|
+
throw new Error(`Missing or ambiguous Moltnet server plan for ${node.network_id}`);
|
|
50
|
+
}
|
|
51
|
+
return { networkId: node.network_id, memberId: node.member_id, nodeConfig: node.config_path,
|
|
52
|
+
serverConfig: servers[0].config_path ?? null };
|
|
53
|
+
});
|
|
54
|
+
const containerPaths = { workspace: paths.workspace_path, runtimeConfig: instance.config_path,
|
|
55
|
+
home: paths.home_path, skillRoots: paths.skill_roots, moltnet: attachments };
|
|
56
|
+
const host = (value) => path.resolve(compileOut, "container/rootfs", `.${value}`);
|
|
57
|
+
return { agentId, runtime: instance.runtime, instanceId: instance.id, containerPaths,
|
|
58
|
+
workspace: host(containerPaths.workspace), runtimeConfig: host(containerPaths.runtimeConfig),
|
|
59
|
+
home: containerPaths.home === null ? null : host(containerPaths.home), skillRoots: containerPaths.skillRoots.map(host),
|
|
60
|
+
moltnet: attachments.map((entry) => ({ ...entry, nodeConfig: host(entry.nodeConfig),
|
|
61
|
+
serverConfig: entry.serverConfig === null ? null : host(entry.serverConfig) })) };
|
|
62
|
+
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Fixed libfaketime symlink installed and mode-verified by the training image. */
|
|
3
|
+
export declare const TRAINING_FAKETIME_LIBRARY_PATH: "/usr/local/lib/daimon/libfaketime.so.1";
|
|
2
4
|
export declare const trainingImageSchema: z.ZodString;
|
|
3
5
|
export declare const trainingContainerConfigSchema: z.ZodObject<{
|
|
4
6
|
version: z.ZodEnum<{
|
|
5
7
|
"spawnfile.training-container.v1": "spawnfile.training-container.v1";
|
|
6
8
|
"spawnfile.training-container.v3": "spawnfile.training-container.v3";
|
|
9
|
+
"spawnfile.training-container.v4": "spawnfile.training-container.v4";
|
|
7
10
|
}>;
|
|
11
|
+
slots: z.ZodDefault<z.ZodNumber>;
|
|
8
12
|
dockerContext: z.ZodString;
|
|
9
13
|
inputs: z.ZodArray<z.ZodObject<{
|
|
10
14
|
source: z.ZodString;
|
|
@@ -21,6 +25,25 @@ export declare const trainingContainerConfigSchema: z.ZodObject<{
|
|
|
21
25
|
claude: "claude";
|
|
22
26
|
}>;
|
|
23
27
|
}, z.core.$strict>>;
|
|
28
|
+
evaluatorRoutes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
+
purpose: z.ZodEnum<{
|
|
30
|
+
decisions: "decisions";
|
|
31
|
+
extraction: "extraction";
|
|
32
|
+
proposals: "proposals";
|
|
33
|
+
}>;
|
|
34
|
+
provider: z.ZodEnum<{
|
|
35
|
+
"codex-subscription": "codex-subscription";
|
|
36
|
+
typesafe: "typesafe";
|
|
37
|
+
}>;
|
|
38
|
+
model: z.ZodString;
|
|
39
|
+
maxRequests: z.ZodNumber;
|
|
40
|
+
maxSpendUsd: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, z.core.$strict>>>;
|
|
42
|
+
evaluatorSecrets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
provider: z.ZodLiteral<"typesafe">;
|
|
44
|
+
source: z.ZodString;
|
|
45
|
+
}, z.core.$strict>>>;
|
|
46
|
+
subjectIsolation: z.ZodOptional<z.ZodLiteral<"codex-native-sandbox">>;
|
|
24
47
|
broker: z.ZodOptional<z.ZodObject<{
|
|
25
48
|
engine: z.ZodLiteral<"grok">;
|
|
26
49
|
realmVolume: z.ZodString;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
import { trainingEvaluatorRoutesSchema, trainingEvaluatorSecretsSchema } from "./evaluators.js";
|
|
4
|
+
/** Fixed libfaketime symlink installed and mode-verified by the training image. */
|
|
5
|
+
export const TRAINING_FAKETIME_LIBRARY_PATH = "/usr/local/lib/daimon/libfaketime.so.1";
|
|
3
6
|
const hostPath = z.string().min(1).refine((value) => path.isAbsolute(value) && !/[,\r\n\0]/u.test(value), "Expected an absolute bind path");
|
|
4
7
|
const inputPath = z.string().regex(/^\/run\/training\/inputs\/[A-Za-z0-9._/-]+$/u).refine((value) => path.posix.normalize(value) === value && !value.endsWith("/"));
|
|
5
8
|
export const trainingImageSchema = z.string().regex(/^(?:sha256:[a-f0-9]{64}|[A-Za-z0-9][A-Za-z0-9._:/-]*@sha256:[a-f0-9]{64})$/u);
|
|
@@ -9,25 +12,40 @@ const brokerLaunchSchema = z.object({
|
|
|
9
12
|
realmVolume: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/u),
|
|
10
13
|
/** Host leaf of the dedicated training Grok login. Never the desktop `~/.grok/auth.json`. */
|
|
11
14
|
bootstrap: hostPath,
|
|
12
|
-
/** `spawnfile.training-broker.
|
|
15
|
+
/** `spawnfile.training-broker.v2`, written beside the launch config and bound read-only into the container. */
|
|
13
16
|
declaration: hostPath
|
|
14
17
|
}).strict();
|
|
15
18
|
export const trainingContainerConfigSchema = z.object({
|
|
16
|
-
version: z.enum(["spawnfile.training-container.v1", "spawnfile.training-container.v3"]),
|
|
19
|
+
version: z.enum(["spawnfile.training-container.v1", "spawnfile.training-container.v3", "spawnfile.training-container.v4"]),
|
|
20
|
+
slots: z.number().int().min(1).max(8).default(4),
|
|
17
21
|
dockerContext: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/u),
|
|
18
22
|
inputs: z.array(z.object({ source: hostPath, destination: inputPath }).strict()).min(1).max(64),
|
|
19
23
|
output: z.object({ source: hostPath, destination: z.literal("/run/training/output") }).strict(),
|
|
20
24
|
auth: z.array(z.object({ source: hostPath, provider: z.enum(["codex", "claude"]) }).strict()).max(2),
|
|
21
|
-
|
|
25
|
+
evaluatorRoutes: trainingEvaluatorRoutesSchema.optional(),
|
|
26
|
+
evaluatorSecrets: trainingEvaluatorSecretsSchema(hostPath).optional(),
|
|
27
|
+
subjectIsolation: z.literal("codex-native-sandbox").optional(),
|
|
28
|
+
/** Present only on `spawnfile.training-container.v4`: the brokered Grok slot this container runs as root. */
|
|
22
29
|
broker: brokerLaunchSchema.optional()
|
|
23
30
|
}).strict().superRefine((value, context) => {
|
|
31
|
+
if (value.evaluatorSecrets && !value.broker && !value.subjectIsolation)
|
|
32
|
+
context.addIssue({ code: "custom", message: "Evaluator secrets require brokered v4 isolation or explicit codex-native-sandbox subject isolation" });
|
|
33
|
+
if (value.subjectIsolation && value.version !== "spawnfile.training-container.v1")
|
|
34
|
+
context.addIssue({ code: "custom", message: "Codex native subject isolation requires a non-brokered v1 launch" });
|
|
35
|
+
if (value.subjectIsolation && !value.evaluatorRoutes?.some(route => route.provider === "typesafe"))
|
|
36
|
+
context.addIssue({ code: "custom", message: "Codex native subject isolation requires a TypeSafe evaluator route" });
|
|
37
|
+
if (value.evaluatorSecrets && !value.evaluatorRoutes?.some(route => route.provider === "typesafe")) {
|
|
38
|
+
context.addIssue({ code: "custom", message: "TypeSafe secret requires a declared evaluator route" });
|
|
39
|
+
}
|
|
40
|
+
if (value.version === "spawnfile.training-container.v3")
|
|
41
|
+
context.addIssue({ code: "custom", message: "Training-container v3 is unsupported; migrate to v4 with slots: 1" });
|
|
24
42
|
const destinations = value.inputs.map((entry) => entry.destination);
|
|
25
43
|
if (destinations.some((entry, index) => destinations.some((other, otherIndex) => otherIndex !== index && (entry === other || entry.startsWith(`${other}/`))))) {
|
|
26
44
|
context.addIssue({ code: "custom", message: "Input destinations must not overlap" });
|
|
27
45
|
}
|
|
28
46
|
if (new Set(value.auth.map((entry) => entry.provider)).size !== value.auth.length)
|
|
29
47
|
context.addIssue({ code: "custom", message: "Duplicate auth provider" });
|
|
30
|
-
if ((value.version === "spawnfile.training-container.
|
|
31
|
-
context.addIssue({ code: "custom", message: "Only spawnfile.training-container.
|
|
48
|
+
if ((value.version === "spawnfile.training-container.v4") !== (value.broker !== undefined)) {
|
|
49
|
+
context.addIssue({ code: "custom", message: "Only spawnfile.training-container.v4 declares broker slots; migrate v3 by setting version to v4 and slots to 1" });
|
|
32
50
|
}
|
|
33
51
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TRAINING_EVALUATOR_ROUTES_FILE = "/run/paideia/evaluator-routes.json";
|
|
3
|
+
export declare const TRAINING_TYPESAFE_SECRET_FILE = "/run/paideia/secrets/typesafe";
|
|
4
|
+
export declare const TRAINING_TYPESAFE_SECRET_INGRESS = "/run/paideia/secret-ingress/typesafe";
|
|
5
|
+
export declare const trainingEvaluatorRouteSchema: z.ZodObject<{
|
|
6
|
+
purpose: z.ZodEnum<{
|
|
7
|
+
decisions: "decisions";
|
|
8
|
+
extraction: "extraction";
|
|
9
|
+
proposals: "proposals";
|
|
10
|
+
}>;
|
|
11
|
+
provider: z.ZodEnum<{
|
|
12
|
+
"codex-subscription": "codex-subscription";
|
|
13
|
+
typesafe: "typesafe";
|
|
14
|
+
}>;
|
|
15
|
+
model: z.ZodString;
|
|
16
|
+
maxRequests: z.ZodNumber;
|
|
17
|
+
maxSpendUsd: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const trainingEvaluatorRoutesSchema: z.ZodArray<z.ZodObject<{
|
|
20
|
+
purpose: z.ZodEnum<{
|
|
21
|
+
decisions: "decisions";
|
|
22
|
+
extraction: "extraction";
|
|
23
|
+
proposals: "proposals";
|
|
24
|
+
}>;
|
|
25
|
+
provider: z.ZodEnum<{
|
|
26
|
+
"codex-subscription": "codex-subscription";
|
|
27
|
+
typesafe: "typesafe";
|
|
28
|
+
}>;
|
|
29
|
+
model: z.ZodString;
|
|
30
|
+
maxRequests: z.ZodNumber;
|
|
31
|
+
maxSpendUsd: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
/** Only a reference is declared. Secret bytes are never read by the compiler or launcher. */
|
|
34
|
+
export declare const trainingEvaluatorSecretsSchema: (source: z.ZodString) => z.ZodArray<z.ZodObject<{
|
|
35
|
+
provider: z.ZodLiteral<"typesafe">;
|
|
36
|
+
source: z.ZodString;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
export declare const prepareTrainingEvaluators: (root: string, config: {
|
|
39
|
+
evaluatorRoutes?: z.infer<typeof trainingEvaluatorRoutesSchema>;
|
|
40
|
+
evaluatorSecrets?: {
|
|
41
|
+
provider: "typesafe";
|
|
42
|
+
source: string;
|
|
43
|
+
}[];
|
|
44
|
+
subjectIsolation?: "codex-native-sandbox";
|
|
45
|
+
}, mappedArgs: readonly string[]) => Promise<{
|
|
46
|
+
mounts: string[];
|
|
47
|
+
env: string[];
|
|
48
|
+
}>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export const TRAINING_EVALUATOR_ROUTES_FILE = "/run/paideia/evaluator-routes.json";
|
|
5
|
+
export const TRAINING_TYPESAFE_SECRET_FILE = "/run/paideia/secrets/typesafe";
|
|
6
|
+
export const TRAINING_TYPESAFE_SECRET_INGRESS = "/run/paideia/secret-ingress/typesafe";
|
|
7
|
+
export const trainingEvaluatorRouteSchema = z.object({
|
|
8
|
+
purpose: z.enum(["extraction", "proposals", "decisions"]),
|
|
9
|
+
provider: z.enum(["codex-subscription", "typesafe"]),
|
|
10
|
+
model: z.string().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$/u),
|
|
11
|
+
maxRequests: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
12
|
+
maxSpendUsd: z.number().finite().nonnegative().optional()
|
|
13
|
+
}).strict().superRefine((route, context) => {
|
|
14
|
+
if (route.provider === "codex-subscription" ? route.purpose === "decisions" || route.maxSpendUsd !== undefined
|
|
15
|
+
: route.purpose !== "decisions" || route.maxSpendUsd === undefined) {
|
|
16
|
+
context.addIssue({ code: "custom", message: "Evaluator provider/purpose mismatch or missing TypeSafe spend budget" });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export const trainingEvaluatorRoutesSchema = z.array(trainingEvaluatorRouteSchema).min(1).max(64)
|
|
20
|
+
.refine(routes => new Set(routes.map(route => JSON.stringify([route.purpose, route.provider, route.model]))).size === routes.length, "Duplicate evaluator route");
|
|
21
|
+
/** Only a reference is declared. Secret bytes are never read by the compiler or launcher. */
|
|
22
|
+
export const trainingEvaluatorSecretsSchema = (source) => z.array(z.object({
|
|
23
|
+
provider: z.literal("typesafe"), source
|
|
24
|
+
}).strict()).min(1).max(1);
|
|
25
|
+
export const prepareTrainingEvaluators = async (root, config, mappedArgs) => {
|
|
26
|
+
const mounts = [], env = [];
|
|
27
|
+
if (config.evaluatorRoutes) {
|
|
28
|
+
const outputs = mappedArgs.flatMap((arg, index) => arg === "--out" ? [mappedArgs[index + 1]] : []);
|
|
29
|
+
const output = outputs[0];
|
|
30
|
+
if (outputs.length !== 1 || !output || path.posix.normalize(output) !== output ||
|
|
31
|
+
!(output === "/run/training/output" || output.startsWith("/run/training/output/"))) {
|
|
32
|
+
throw Error("Evaluator receipts require one mapped training --out directory");
|
|
33
|
+
}
|
|
34
|
+
const source = path.join(root, "evaluator-routes.json");
|
|
35
|
+
await writeFile(source, JSON.stringify({ version: "paideia.evaluator-routes.v1", routes: config.evaluatorRoutes,
|
|
36
|
+
receiptPath: path.posix.join(output, "evaluator-requests.jsonl") }), { mode: 0o444, flag: "wx" });
|
|
37
|
+
mounts.push(`type=bind,src=${source},dst=${TRAINING_EVALUATOR_ROUTES_FILE},readonly`);
|
|
38
|
+
env.push(`PAIDEIA_EVALUATOR_ROUTES_FILE=${TRAINING_EVALUATOR_ROUTES_FILE}`);
|
|
39
|
+
}
|
|
40
|
+
for (const secret of config.evaluatorSecrets ?? []) {
|
|
41
|
+
// The host-uid v1 launcher cannot stage a root-owned copy; bind the canonical leaf at the consumer path.
|
|
42
|
+
if (config.subjectIsolation === "codex-native-sandbox") {
|
|
43
|
+
mounts.push(`type=bind,src=${secret.source},dst=${TRAINING_TYPESAFE_SECRET_FILE},readonly`);
|
|
44
|
+
}
|
|
45
|
+
else
|
|
46
|
+
mounts.push(`type=bind,src=${secret.source},dst=${TRAINING_TYPESAFE_SECRET_INGRESS},readonly`);
|
|
47
|
+
env.push(`PAIDEIA_TYPESAFE_SECRET_FILE=${TRAINING_TYPESAFE_SECRET_FILE}`);
|
|
48
|
+
}
|
|
49
|
+
return { mounts, env };
|
|
50
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type DockerCall = (args: string[], cleanup: boolean) => Promise<{
|
|
2
|
+
code: number;
|
|
3
|
+
stdout: string;
|
|
4
|
+
stderr: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** Called only for an ownership-verified container, before removal, including failure/cancellation. */
|
|
7
|
+
export declare const persistTrainingGrokCredential: (id: string, profile: string, scratch: string, call: DockerCall) => Promise<void>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { writeBackTrainingGrokCredential } from "../../../auth/index.js";
|
|
3
|
+
import { DAIMON_GROK_ENGINE_BROKER } from "../../../runtime/daimon/contractManifest.js";
|
|
4
|
+
/** Called only for an ownership-verified container, before removal, including failure/cancellation. */
|
|
5
|
+
export const persistTrainingGrokCredential = async (id, profile, scratch, call) => {
|
|
6
|
+
const state = await call(["inspect", "--format", "{{json .State}}", id], true);
|
|
7
|
+
if (state.code !== 0)
|
|
8
|
+
throw Error("Cannot verify training credential writer state");
|
|
9
|
+
if (JSON.parse(state.stdout).Running === true) {
|
|
10
|
+
const stopped = await call(["stop", "--time", "5", id], true);
|
|
11
|
+
if (stopped.code !== 0)
|
|
12
|
+
throw Error("Cannot stop training credential writer");
|
|
13
|
+
}
|
|
14
|
+
const terminal = await call(["inspect", "--format", "{{json .State}}", id], true);
|
|
15
|
+
if (terminal.code !== 0 || JSON.parse(terminal.stdout).Running !== false)
|
|
16
|
+
throw Error("Training credential writer is still active");
|
|
17
|
+
const realm = DAIMON_GROK_ENGINE_BROKER.credentialHomePath;
|
|
18
|
+
const candidate = path.join(scratch, "grok-auth.json"), journal = path.join(scratch, "grok-journal.json");
|
|
19
|
+
// Docker writes directly into a host-private directory: no credential bytes in stdout, logs or arguments.
|
|
20
|
+
const copied = await call(["cp", `${id}:${realm}/auth.json`, candidate], true);
|
|
21
|
+
if (copied.code !== 0)
|
|
22
|
+
throw Error("Cannot export training Grok credential");
|
|
23
|
+
const journalCopy = await call(["cp", `${id}:${realm}/.daimon-broker/credential-journal.json`, journal], true);
|
|
24
|
+
// A realm that never rotated has no journal. The auth owner accepts only unchanged bytes in that case.
|
|
25
|
+
await writeBackTrainingGrokCredential(profile, candidate, journalCopy.code === 0 ? journal : `${journal}.absent`);
|
|
26
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { trainingContainerConfigSchema, trainingImageSchema } from "./contract.js";
|
|
1
|
+
export { TRAINING_FAKETIME_LIBRARY_PATH, trainingContainerConfigSchema, trainingImageSchema } from "./contract.js";
|
|
2
2
|
export type { TrainingContainerConfig } from "./contract.js";
|
|
3
3
|
export { launchTrainingContainer } from "./launch.js";
|
|
4
4
|
export type { LaunchTrainingContainerOptions } from "./launch.js";
|
|
5
|
+
export { trainingEvaluatorRouteSchema, trainingEvaluatorRoutesSchema, trainingEvaluatorSecretsSchema, TRAINING_EVALUATOR_ROUTES_FILE, TRAINING_TYPESAFE_SECRET_FILE } from "./evaluators.js";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { trainingContainerConfigSchema, trainingImageSchema } from "./contract.js";
|
|
1
|
+
export { TRAINING_FAKETIME_LIBRARY_PATH, trainingContainerConfigSchema, trainingImageSchema } from "./contract.js";
|
|
2
2
|
export { launchTrainingContainer } from "./launch.js";
|
|
3
|
+
export { trainingEvaluatorRouteSchema, trainingEvaluatorRoutesSchema, trainingEvaluatorSecretsSchema, TRAINING_EVALUATOR_ROUTES_FILE, TRAINING_TYPESAFE_SECRET_FILE } from "./evaluators.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type TrainingExecution } from "../execution.js";
|
|
1
2
|
import type { TrainingContext } from "../contract.js";
|
|
2
3
|
import { type TrainingDockerProcess } from "./process.js";
|
|
4
|
+
export declare const TRAINING_INPUTS_GID = 2000;
|
|
3
5
|
export interface LaunchTrainingContainerOptions {
|
|
4
6
|
image: string;
|
|
5
7
|
configPath: string;
|
|
@@ -12,6 +14,7 @@ export interface LaunchTrainingContainerOptions {
|
|
|
12
14
|
stderr(line: string): void;
|
|
13
15
|
};
|
|
14
16
|
process?: TrainingDockerProcess;
|
|
17
|
+
execution?: TrainingExecution;
|
|
15
18
|
preparationPath?: string;
|
|
16
19
|
repairPath?: string;
|
|
17
20
|
}
|