spawnfile 0.1.32 → 0.1.34
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/trainingAuth.d.ts +2 -5
- package/dist/cli/devCommands.d.ts +1 -1
- package/dist/cli/devCommands.js +0 -66
- package/dist/cli/runCli.d.ts +1 -4
- package/dist/cli/runCli.js +2 -2
- package/dist/cli/trainCommand.js +9 -15
- package/dist/cli/trainingBooted.d.ts +7 -0
- package/dist/cli/trainingBooted.js +41 -0
- package/dist/cli/trainingExecution.d.ts +4 -7
- package/dist/cli/trainingExecution.js +4 -32
- package/dist/compiler/containerArtifacts.js +0 -5
- package/dist/compiler/containerBackedMountRender.js +5 -1
- package/dist/compiler/containerDaimonBrokerRender.d.ts +5 -50
- package/dist/compiler/containerDaimonBrokerRender.js +7 -88
- package/dist/compiler/containerDaimonGatewayRender.d.ts +50 -0
- package/dist/compiler/containerDaimonGatewayRender.js +157 -0
- package/dist/compiler/containerDaimonGrokWorkerProvisioning.d.ts +2 -10
- package/dist/compiler/containerDaimonGrokWorkerProvisioning.js +13 -25
- package/dist/compiler/containerDaimonGrokWorkerRender.d.ts +11 -49
- package/dist/compiler/containerDaimonGrokWorkerRender.js +15 -39
- package/dist/compiler/containerDaimonStartupSupervision.d.ts +8 -0
- package/dist/compiler/containerDaimonStartupSupervision.js +39 -0
- package/dist/compiler/containerDaimonUidEntrypointRender.d.ts +1 -2
- package/dist/compiler/containerDaimonUidEntrypointRender.js +26 -46
- package/dist/compiler/containerRuntimeReadinessRender.js +1 -1
- package/dist/compiler/memoryArtifacts.js +0 -1
- package/dist/compiler/moltnetArtifacts.js +1 -17
- package/dist/compiler/moltnetClientConfig.js +1 -1
- package/dist/compiler/moltnetRuntimeConfig.js +0 -10
- package/dist/compiler/runProject.d.ts +1 -0
- package/dist/compiler/runProject.js +9 -3
- package/dist/compiler/runProjectAuth.js +2 -17
- package/dist/compiler/training/contract.d.ts +0 -2
- package/dist/compiler/training/contract.js +0 -2
- package/dist/compiler/training/execution.d.ts +1 -128
- package/dist/compiler/training/execution.js +7 -68
- package/dist/compiler/training/index.d.ts +0 -8
- package/dist/compiler/training/index.js +0 -7
- package/dist/compiler/training/output.d.ts +1 -0
- package/dist/compiler/training/output.js +1 -1
- package/dist/compiler/training/trial/boot.d.ts +53 -0
- package/dist/compiler/training/trial/boot.js +147 -0
- package/dist/compiler/training/trial/docker.d.ts +8 -0
- package/dist/compiler/training/trial/docker.js +22 -0
- package/dist/compiler/training/trial/gateway.d.ts +42 -0
- package/dist/compiler/training/trial/gateway.js +98 -0
- package/dist/compiler/training/trial/index.d.ts +4 -0
- package/dist/compiler/training/trial/index.js +4 -0
- package/dist/compiler/training/trial/launcher.d.ts +32 -0
- package/dist/compiler/training/trial/launcher.js +49 -0
- package/dist/compiler/training/trial/project.d.ts +11 -0
- package/dist/compiler/training/trial/project.js +31 -0
- package/dist/compiler/upReceipt.d.ts +2 -17
- package/dist/compiler/upReceipt.js +2 -17
- package/dist/deployment/artifactsExportPlan.js +2 -18
- package/dist/deployment/privateArtifactsExport.js +1 -1
- package/dist/dev/docker.d.ts +0 -5
- package/dist/dev/docker.js +0 -46
- package/dist/dev/index.d.ts +0 -1
- package/dist/dev/index.js +0 -1
- package/dist/dev/project.d.ts +0 -16
- package/dist/dev/project.js +1 -128
- package/dist/distribution/distributionReportSchema.js +1 -1
- package/dist/distribution/imageRuntimeAuth.js +3 -2
- package/dist/release/drainControl.d.ts +5 -19
- package/dist/release/drainControl.js +12 -67
- package/dist/report/types.d.ts +3 -6
- package/dist/runtime/common.d.ts +1 -1
- package/dist/runtime/common.js +1 -1
- package/dist/runtime/container.d.ts +2 -2
- package/dist/runtime/container.js +1 -39
- package/dist/runtime/daimon/config.js +6 -12
- package/dist/runtime/daimon/contractManifest.js +0 -1
- package/dist/runtime/daimon/contractManifestSchema.js +0 -1
- package/dist/runtime/daimon/control.d.ts +31 -0
- package/dist/runtime/daimon/control.js +83 -0
- package/dist/runtime/daimon/engineDescriptorSchema.js +0 -1
- package/dist/runtime/daimon/engineDescriptors.generated.d.ts +1 -1
- package/dist/runtime/daimon/engineDescriptors.generated.js +1 -2
- package/dist/runtime/daimon/engines.js +0 -1
- package/dist/runtime/daimon/gateway.d.ts +62 -0
- package/dist/runtime/daimon/gateway.js +77 -0
- package/dist/runtime/daimon/grokWorkerContract.d.ts +0 -5
- package/dist/runtime/daimon/grokWorkerContract.js +1 -13
- package/dist/runtime/daimon/index.d.ts +2 -0
- package/dist/runtime/daimon/index.js +2 -1
- package/dist/runtime/daimon/memory.js +1 -1
- package/dist/runtime/daimon/packageName.js +0 -1
- package/dist/runtime/daimon/runAuth.js +7 -4
- package/dist/runtime/daimon/runtimeIdentity.d.ts +2 -0
- package/dist/runtime/daimon/runtimeIdentity.js +2 -0
- package/dist/runtime/daimon/subscriptionRealms.d.ts +9 -3
- package/dist/runtime/daimon/subscriptionRealms.js +22 -13
- package/dist/runtime/daimon/testHelpers.d.ts +2 -0
- package/dist/runtime/{pi → daimon}/testHelpers.js +3 -3
- package/dist/runtime/daimon/training/booted/adapter.d.ts +46 -0
- package/dist/runtime/daimon/training/booted/adapter.js +59 -0
- package/dist/runtime/daimon/training/booted/adapter.js.map +1 -0
- package/dist/runtime/daimon/training/booted/index.d.ts +2 -0
- package/dist/runtime/daimon/training/booted/index.js +2 -0
- package/dist/runtime/daimon/training/booted/index.js.map +1 -0
- package/dist/runtime/daimon/training/index.d.ts +5 -0
- package/dist/runtime/daimon/training/index.js +8 -4
- package/dist/runtime/daimon/training/index.js.map +1 -1
- package/dist/runtime/daimon/training/providers/codex-subscription/index.js.map +1 -0
- package/dist/runtime/daimon/training/providers/codex-subscription/protocol.js.map +1 -0
- package/dist/runtime/daimon/training/providers/codex-subscription/provider.js.map +1 -0
- package/dist/runtime/daimon/training/providers/codex-subscription/strict-schema.js.map +1 -0
- package/dist/runtime/daimon/training/providers/grok-subscription/cli.d.ts +1 -3
- package/dist/runtime/daimon/training/providers/grok-subscription/cli.js +5 -5
- package/dist/runtime/daimon/training/providers/grok-subscription/cli.js.map +1 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/index.d.ts +1 -2
- package/dist/runtime/daimon/training/providers/grok-subscription/index.js +0 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/index.js.map +1 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/protocol.d.ts +5 -17
- package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js +18 -31
- package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js.map +1 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/provider.js +1 -2
- package/dist/runtime/daimon/training/providers/grok-subscription/provider.js.map +1 -1
- package/dist/runtime/daimon/wakeMoments.js +0 -1
- package/dist/runtime/install.js +0 -21
- package/dist/runtime/registry.js +0 -2
- package/dist/runtime/trainingGraderProviders.js +1 -1
- package/dist/runtime/trainingProviders.d.ts +1 -2
- package/dist/runtime/trainingProviders.js +9 -19
- package/dist/runtime/trainingSubjects.d.ts +0 -121
- package/dist/runtime/trainingSubjects.js +2 -13
- package/dist/runtime/types.d.ts +1 -8
- package/dist/shared/errors.js +0 -1
- package/dist/status/lifecycleProbes.js +3 -6
- package/dist/status/moltnetWiringProbes.js +1 -17
- package/dist/training/subjects/index.d.ts +0 -1
- package/dist/training/subjects/index.js +0 -1
- package/dist/training/subjects/index.js.map +1 -1
- package/examples/README.md +0 -1
- package/examples/daimon-org/agents/mapper/Spawnfile +4 -1
- package/examples/daimon-org/teams/review/agents/reviewer/Spawnfile +4 -1
- package/examples/jungian-daimon-org/teams/luna/agents/animus/Spawnfile +5 -8
- package/examples/jungian-daimon-org/teams/luna/agents/representative/Spawnfile +1 -1
- package/examples/jungian-daimon-org/teams/luna/agents/shadow/Spawnfile +5 -8
- package/examples/jungian-daimon-org/teams/selene/agents/animus/Spawnfile +5 -8
- package/examples/jungian-daimon-org/teams/selene/agents/representative/Spawnfile +5 -8
- package/examples/jungian-daimon-org/teams/selene/agents/shadow/Spawnfile +1 -1
- package/examples/mixed-runtime-org/agents/localist/Spawnfile +7 -7
- package/package.json +4 -13
- package/runtimes.yaml +5 -15
- package/dist/compiler/containerDaimonGrokTaskClock.d.ts +0 -5
- package/dist/compiler/containerDaimonGrokTaskClock.js +0 -29
- package/dist/compiler/daimonTelemetryArtifacts.d.ts +0 -22
- package/dist/compiler/daimonTelemetryArtifacts.js +0 -56
- package/dist/compiler/training/broker/clockProbe.d.ts +0 -6
- package/dist/compiler/training/broker/clockProbe.js +0 -27
- package/dist/compiler/training/broker/declaration.d.ts +0 -54
- package/dist/compiler/training/broker/declaration.js +0 -70
- package/dist/compiler/training/broker/entrypoint.d.ts +0 -39
- package/dist/compiler/training/broker/entrypoint.js +0 -124
- package/dist/compiler/training/broker/evaluatorSecrets.d.ts +0 -2
- package/dist/compiler/training/broker/evaluatorSecrets.js +0 -62
- package/dist/compiler/training/broker/index.d.ts +0 -12
- package/dist/compiler/training/broker/index.js +0 -12
- package/dist/compiler/training/broker/main.d.ts +0 -2
- package/dist/compiler/training/broker/main.js +0 -14
- package/dist/compiler/training/broker/paths.d.ts +0 -236
- package/dist/compiler/training/broker/paths.js +0 -249
- package/dist/compiler/training/broker/processes.d.ts +0 -51
- package/dist/compiler/training/broker/processes.js +0 -102
- package/dist/compiler/training/broker/projection.d.ts +0 -61
- package/dist/compiler/training/broker/projection.js +0 -109
- package/dist/compiler/training/broker/provisioning.d.ts +0 -78
- package/dist/compiler/training/broker/provisioning.js +0 -231
- package/dist/compiler/training/broker/receipt.d.ts +0 -77
- package/dist/compiler/training/broker/receipt.js +0 -110
- package/dist/compiler/training/broker/recycleClient.d.ts +0 -33
- package/dist/compiler/training/broker/recycleClient.js +0 -112
- package/dist/compiler/training/broker/registration.d.ts +0 -46
- package/dist/compiler/training/broker/registration.js +0 -113
- package/dist/compiler/training/broker/reset.d.ts +0 -9
- package/dist/compiler/training/broker/reset.js +0 -71
- package/dist/compiler/training/broker/rootScript.d.ts +0 -32
- package/dist/compiler/training/broker/rootScript.js +0 -33
- package/dist/compiler/training/broker/runtime.d.ts +0 -22
- package/dist/compiler/training/broker/runtime.js +0 -128
- package/dist/compiler/training/broker/seccompRoutes.d.ts +0 -31
- package/dist/compiler/training/broker/seccompRoutes.js +0 -36
- package/dist/compiler/training/broker/supervisor.d.ts +0 -108
- package/dist/compiler/training/broker/supervisor.js +0 -172
- package/dist/compiler/training/broker/taskClock.d.ts +0 -5
- package/dist/compiler/training/broker/taskClock.js +0 -41
- package/dist/compiler/training/container/contract.d.ts +0 -54
- package/dist/compiler/training/container/contract.js +0 -52
- package/dist/compiler/training/container/evaluators.d.ts +0 -48
- package/dist/compiler/training/container/evaluators.js +0 -50
- package/dist/compiler/training/container/grokWriteback.d.ts +0 -8
- package/dist/compiler/training/container/grokWriteback.js +0 -26
- package/dist/compiler/training/container/index.d.ts +0 -5
- package/dist/compiler/training/container/index.js +0 -3
- package/dist/compiler/training/container/launch.d.ts +0 -21
- package/dist/compiler/training/container/launch.js +0 -280
- package/dist/compiler/training/container/nativeSlots.d.ts +0 -14
- package/dist/compiler/training/container/nativeSlots.js +0 -13
- package/dist/compiler/training/container/outputCopy.d.ts +0 -2
- package/dist/compiler/training/container/outputCopy.js +0 -72
- package/dist/compiler/training/container/outputVolume.d.ts +0 -28
- package/dist/compiler/training/container/outputVolume.js +0 -185
- package/dist/compiler/training/container/prepare.d.ts +0 -10
- package/dist/compiler/training/container/prepare.js +0 -125
- package/dist/compiler/training/container/process.d.ts +0 -14
- package/dist/compiler/training/container/process.js +0 -70
- package/dist/compiler/training/container/security.d.ts +0 -38
- package/dist/compiler/training/container/security.js +0 -68
- package/dist/compiler/training/container/subjectIsolation.d.ts +0 -5
- package/dist/compiler/training/container/subjectIsolation.js +0 -16
- package/dist/compiler/training/preparation/assets/Dockerfile +0 -100
- package/dist/compiler/training/preparation/assets/package-lock.json +0 -5483
- package/dist/compiler/training/preparation/broker.d.ts +0 -30
- package/dist/compiler/training/preparation/broker.js +0 -68
- package/dist/compiler/training/preparation/contextModes.d.ts +0 -12
- package/dist/compiler/training/preparation/contextModes.js +0 -38
- package/dist/compiler/training/preparation/contract.d.ts +0 -203
- package/dist/compiler/training/preparation/contract.js +0 -114
- package/dist/compiler/training/preparation/copyAssets.d.ts +0 -1
- package/dist/compiler/training/preparation/copyAssets.js +0 -8
- package/dist/compiler/training/preparation/daimonParent.d.ts +0 -42
- package/dist/compiler/training/preparation/daimonParent.js +0 -114
- package/dist/compiler/training/preparation/files.d.ts +0 -29
- package/dist/compiler/training/preparation/files.js +0 -146
- package/dist/compiler/training/preparation/image.d.ts +0 -28
- package/dist/compiler/training/preparation/image.js +0 -105
- package/dist/compiler/training/preparation/index.d.ts +0 -3
- package/dist/compiler/training/preparation/index.js +0 -2
- package/dist/compiler/training/preparation/inputs.d.ts +0 -24
- package/dist/compiler/training/preparation/inputs.js +0 -101
- package/dist/compiler/training/preparation/prepare.d.ts +0 -38
- package/dist/compiler/training/preparation/prepare.js +0 -224
- package/dist/compiler/training/preparation/scratch.d.ts +0 -8
- package/dist/compiler/training/preparation/scratch.js +0 -114
- package/dist/compiler/training/repair/compatibility.d.ts +0 -11
- package/dist/compiler/training/repair/compatibility.js +0 -45
- package/dist/compiler/training/repair/contract.d.ts +0 -832
- package/dist/compiler/training/repair/contract.js +0 -34
- package/dist/compiler/training/repair/index.d.ts +0 -3
- package/dist/compiler/training/repair/index.js +0 -3
- package/dist/compiler/training/repair/prepare.d.ts +0 -378
- package/dist/compiler/training/repair/prepare.js +0 -84
- package/dist/compiler/training/repair/witness.d.ts +0 -348
- package/dist/compiler/training/repair/witness.js +0 -62
- package/dist/compiler/training/subjectDeclaration.d.ts +0 -26
- package/dist/compiler/training/subjectDeclaration.js +0 -54
- package/dist/compiler/training/subjectLease.d.ts +0 -115
- package/dist/compiler/training/subjectLease.js +0 -179
- package/dist/dev/activity.d.ts +0 -14
- package/dist/dev/activity.js +0 -48
- package/dist/runtime/codex-exec/training/adapter.d.ts +0 -13
- package/dist/runtime/codex-exec/training/adapter.js +0 -101
- package/dist/runtime/codex-exec/training/adapter.js.map +0 -1
- package/dist/runtime/codex-exec/training/environment.d.ts +0 -3
- package/dist/runtime/codex-exec/training/environment.js +0 -26
- package/dist/runtime/codex-exec/training/environment.js.map +0 -1
- package/dist/runtime/codex-exec/training/index.d.ts +0 -2
- package/dist/runtime/codex-exec/training/index.js +0 -3
- package/dist/runtime/codex-exec/training/index.js.map +0 -1
- package/dist/runtime/codex-exec/training/protocol.d.ts +0 -15
- package/dist/runtime/codex-exec/training/protocol.js +0 -102
- package/dist/runtime/codex-exec/training/protocol.js.map +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/index.js.map +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/protocol.js.map +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/provider.js.map +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/strict-schema.js.map +0 -1
- package/dist/runtime/daimon/contractManifest.js.map +0 -1
- package/dist/runtime/daimon/contractManifestSchema.js.map +0 -1
- package/dist/runtime/daimon/engineDescriptorSchema.js.map +0 -1
- package/dist/runtime/daimon/engineDescriptors.generated.js.map +0 -1
- package/dist/runtime/daimon/engines.js.map +0 -1
- package/dist/runtime/daimon/index.js.map +0 -1
- package/dist/runtime/daimon/packageName.js.map +0 -1
- package/dist/runtime/daimon/training/legacy/adapter.d.ts +0 -11
- package/dist/runtime/daimon/training/legacy/adapter.js +0 -175
- package/dist/runtime/daimon/training/legacy/adapter.js.map +0 -1
- package/dist/runtime/daimon/training/legacy/index.d.ts +0 -2
- package/dist/runtime/daimon/training/legacy/index.js +0 -3
- package/dist/runtime/daimon/training/legacy/index.js.map +0 -1
- package/dist/runtime/daimon/training/legacy/public.d.ts +0 -49
- package/dist/runtime/daimon/training/legacy/public.js +0 -16
- package/dist/runtime/daimon/training/legacy/public.js.map +0 -1
- package/dist/runtime/daimon/training/native/adapter.d.ts +0 -18
- package/dist/runtime/daimon/training/native/adapter.js +0 -252
- package/dist/runtime/daimon/training/native/adapter.js.map +0 -1
- package/dist/runtime/daimon/training/native/admission.d.ts +0 -7
- package/dist/runtime/daimon/training/native/admission.js +0 -52
- package/dist/runtime/daimon/training/native/admission.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/arguments.d.ts +0 -16
- package/dist/runtime/daimon/training/native/child/arguments.js +0 -70
- package/dist/runtime/daimon/training/native/child/arguments.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/deferred-trial.d.ts +0 -24
- package/dist/runtime/daimon/training/native/child/deferred-trial.js +0 -63
- package/dist/runtime/daimon/training/native/child/deferred-trial.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/diagnostics.d.ts +0 -58
- package/dist/runtime/daimon/training/native/child/diagnostics.js +0 -215
- package/dist/runtime/daimon/training/native/child/diagnostics.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/fixture.d.ts +0 -16
- package/dist/runtime/daimon/training/native/child/fixture.js +0 -159
- package/dist/runtime/daimon/training/native/child/fixture.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/grok.d.ts +0 -14
- package/dist/runtime/daimon/training/native/child/grok.js +0 -47
- package/dist/runtime/daimon/training/native/child/grok.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/index.d.ts +0 -7
- package/dist/runtime/daimon/training/native/child/index.js +0 -5
- package/dist/runtime/daimon/training/native/child/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/lifecycle.d.ts +0 -40
- package/dist/runtime/daimon/training/native/child/lifecycle.js +0 -400
- package/dist/runtime/daimon/training/native/child/lifecycle.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/probe.d.ts +0 -2
- package/dist/runtime/daimon/training/native/child/probe.js +0 -11
- package/dist/runtime/daimon/training/native/child/probe.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/sandbox.d.ts +0 -4
- package/dist/runtime/daimon/training/native/child/sandbox.js +0 -76
- package/dist/runtime/daimon/training/native/child/sandbox.js.map +0 -1
- package/dist/runtime/daimon/training/native/child/types.d.ts +0 -15
- package/dist/runtime/daimon/training/native/child/types.js +0 -2
- package/dist/runtime/daimon/training/native/child/types.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/docker.d.ts +0 -29
- package/dist/runtime/daimon/training/native/container/docker.js +0 -105
- package/dist/runtime/daimon/training/native/container/docker.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/grok-slot.d.ts +0 -22
- package/dist/runtime/daimon/training/native/container/grok-slot.js +0 -38
- package/dist/runtime/daimon/training/native/container/grok-slot.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/index.d.ts +0 -6
- package/dist/runtime/daimon/training/native/container/index.js +0 -6
- package/dist/runtime/daimon/training/native/container/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/lifecycle.d.ts +0 -8
- package/dist/runtime/daimon/training/native/container/lifecycle.js +0 -111
- package/dist/runtime/daimon/training/native/container/lifecycle.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/manifest.d.ts +0 -17
- package/dist/runtime/daimon/training/native/container/manifest.js +0 -164
- package/dist/runtime/daimon/training/native/container/manifest.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/native-preflight.d.ts +0 -8
- package/dist/runtime/daimon/training/native/container/native-preflight.js +0 -40
- package/dist/runtime/daimon/training/native/container/native-preflight.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/preflight.d.ts +0 -15
- package/dist/runtime/daimon/training/native/container/preflight.js +0 -79
- package/dist/runtime/daimon/training/native/container/preflight.js.map +0 -1
- package/dist/runtime/daimon/training/native/container/slot.d.ts +0 -4
- package/dist/runtime/daimon/training/native/container/slot.js +0 -58
- package/dist/runtime/daimon/training/native/container/slot.js.map +0 -1
- package/dist/runtime/daimon/training/native/external.d.ts +0 -37
- package/dist/runtime/daimon/training/native/external.js +0 -75
- package/dist/runtime/daimon/training/native/external.js.map +0 -1
- package/dist/runtime/daimon/training/native/grants/authority.d.ts +0 -36
- package/dist/runtime/daimon/training/native/grants/authority.js +0 -49
- package/dist/runtime/daimon/training/native/grants/authority.js.map +0 -1
- package/dist/runtime/daimon/training/native/grants/index.d.ts +0 -2
- package/dist/runtime/daimon/training/native/grants/index.js +0 -3
- package/dist/runtime/daimon/training/native/grants/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/grants/pins.d.ts +0 -30
- package/dist/runtime/daimon/training/native/grants/pins.js +0 -20
- package/dist/runtime/daimon/training/native/grants/pins.js.map +0 -1
- package/dist/runtime/daimon/training/native/grants/test-socket.d.ts +0 -6
- package/dist/runtime/daimon/training/native/grants/test-socket.js +0 -35
- package/dist/runtime/daimon/training/native/grants/test-socket.js.map +0 -1
- package/dist/runtime/daimon/training/native/grok-fixtures.d.ts +0 -34
- package/dist/runtime/daimon/training/native/grok-fixtures.js +0 -179
- package/dist/runtime/daimon/training/native/grok-fixtures.js.map +0 -1
- package/dist/runtime/daimon/training/native/index.d.ts +0 -38
- package/dist/runtime/daimon/training/native/index.js +0 -27
- package/dist/runtime/daimon/training/native/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/live-checkout.d.ts +0 -2
- package/dist/runtime/daimon/training/native/live-checkout.js +0 -15
- package/dist/runtime/daimon/training/native/live-checkout.js.map +0 -1
- package/dist/runtime/daimon/training/native/observations.d.ts +0 -51
- package/dist/runtime/daimon/training/native/observations.js +0 -217
- package/dist/runtime/daimon/training/native/observations.js.map +0 -1
- package/dist/runtime/daimon/training/native/outcome.d.ts +0 -13
- package/dist/runtime/daimon/training/native/outcome.js +0 -37
- package/dist/runtime/daimon/training/native/outcome.js.map +0 -1
- package/dist/runtime/daimon/training/native/preparation/engine-config.d.ts +0 -21
- package/dist/runtime/daimon/training/native/preparation/engine-config.js +0 -30
- package/dist/runtime/daimon/training/native/preparation/engine-config.js.map +0 -1
- package/dist/runtime/daimon/training/native/preparation/fixtures.d.ts +0 -17
- package/dist/runtime/daimon/training/native/preparation/fixtures.js +0 -52
- package/dist/runtime/daimon/training/native/preparation/fixtures.js.map +0 -1
- package/dist/runtime/daimon/training/native/preparation/index.d.ts +0 -7
- package/dist/runtime/daimon/training/native/preparation/index.js +0 -5
- package/dist/runtime/daimon/training/native/preparation/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/preparation/layout.d.ts +0 -66
- package/dist/runtime/daimon/training/native/preparation/layout.js +0 -87
- package/dist/runtime/daimon/training/native/preparation/layout.js.map +0 -1
- package/dist/runtime/daimon/training/native/preparation/subject.d.ts +0 -14
- package/dist/runtime/daimon/training/native/preparation/subject.js +0 -67
- package/dist/runtime/daimon/training/native/preparation/subject.js.map +0 -1
- package/dist/runtime/daimon/training/native/preparation/types.d.ts +0 -69
- package/dist/runtime/daimon/training/native/preparation/types.js +0 -2
- package/dist/runtime/daimon/training/native/preparation/types.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/artifacts.d.ts +0 -25
- package/dist/runtime/daimon/training/native/receipt/artifacts.js +0 -32
- package/dist/runtime/daimon/training/native/receipt/artifacts.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/grok-clocked-pins.d.ts +0 -129
- package/dist/runtime/daimon/training/native/receipt/grok-clocked-pins.js +0 -45
- package/dist/runtime/daimon/training/native/receipt/grok-clocked-pins.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/grok.d.ts +0 -246
- package/dist/runtime/daimon/training/native/receipt/grok.js +0 -195
- package/dist/runtime/daimon/training/native/receipt/grok.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/index.d.ts +0 -11
- package/dist/runtime/daimon/training/native/receipt/index.js +0 -8
- package/dist/runtime/daimon/training/native/receipt/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/paths.d.ts +0 -3
- package/dist/runtime/daimon/training/native/receipt/paths.js +0 -18
- package/dist/runtime/daimon/training/native/receipt/paths.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/sandbox.d.ts +0 -42
- package/dist/runtime/daimon/training/native/receipt/sandbox.js +0 -35
- package/dist/runtime/daimon/training/native/receipt/sandbox.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/schema.d.ts +0 -490
- package/dist/runtime/daimon/training/native/receipt/schema.js +0 -138
- package/dist/runtime/daimon/training/native/receipt/schema.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/subscription.d.ts +0 -13
- package/dist/runtime/daimon/training/native/receipt/subscription.js +0 -13
- package/dist/runtime/daimon/training/native/receipt/subscription.js.map +0 -1
- package/dist/runtime/daimon/training/native/receipt/task-clock.d.ts +0 -19
- package/dist/runtime/daimon/training/native/receipt/task-clock.js +0 -49
- package/dist/runtime/daimon/training/native/receipt/task-clock.js.map +0 -1
- package/dist/runtime/daimon/training/native/sealed-usage.d.ts +0 -218
- package/dist/runtime/daimon/training/native/sealed-usage.js +0 -261
- package/dist/runtime/daimon/training/native/sealed-usage.js.map +0 -1
- package/dist/runtime/daimon/training/native/test-fixtures.d.ts +0 -27
- package/dist/runtime/daimon/training/native/test-fixtures.js +0 -162
- package/dist/runtime/daimon/training/native/test-fixtures.js.map +0 -1
- package/dist/runtime/daimon/training/native/transcript.d.ts +0 -96
- package/dist/runtime/daimon/training/native/transcript.js +0 -239
- package/dist/runtime/daimon/training/native/transcript.js.map +0 -1
- package/dist/runtime/daimon/training/native/transport/delivery.d.ts +0 -27
- package/dist/runtime/daimon/training/native/transport/delivery.js +0 -98
- package/dist/runtime/daimon/training/native/transport/delivery.js.map +0 -1
- package/dist/runtime/daimon/training/native/transport/http.d.ts +0 -3
- package/dist/runtime/daimon/training/native/transport/http.js +0 -81
- package/dist/runtime/daimon/training/native/transport/http.js.map +0 -1
- package/dist/runtime/daimon/training/native/transport/index.d.ts +0 -4
- package/dist/runtime/daimon/training/native/transport/index.js +0 -3
- package/dist/runtime/daimon/training/native/transport/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/transport/types.d.ts +0 -15
- package/dist/runtime/daimon/training/native/transport/types.js +0 -2
- package/dist/runtime/daimon/training/native/transport/types.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/cli.d.ts +0 -1
- package/dist/runtime/daimon/training/native/worker/cli.js +0 -17
- package/dist/runtime/daimon/training/native/worker/cli.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/control.d.ts +0 -20
- package/dist/runtime/daimon/training/native/worker/control.js +0 -266
- package/dist/runtime/daimon/training/native/worker/control.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/deliveries.d.ts +0 -38
- package/dist/runtime/daimon/training/native/worker/deliveries.js +0 -91
- package/dist/runtime/daimon/training/native/worker/deliveries.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/evidence/collect.d.ts +0 -54
- package/dist/runtime/daimon/training/native/worker/evidence/collect.js +0 -278
- package/dist/runtime/daimon/training/native/worker/evidence/collect.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/evidence/execution.d.ts +0 -102
- package/dist/runtime/daimon/training/native/worker/evidence/execution.js +0 -191
- package/dist/runtime/daimon/training/native/worker/evidence/execution.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/evidence/index.d.ts +0 -3
- package/dist/runtime/daimon/training/native/worker/evidence/index.js +0 -4
- package/dist/runtime/daimon/training/native/worker/evidence/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/evidence/io.d.ts +0 -20
- package/dist/runtime/daimon/training/native/worker/evidence/io.js +0 -130
- package/dist/runtime/daimon/training/native/worker/evidence/io.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/evidence/seal.d.ts +0 -3
- package/dist/runtime/daimon/training/native/worker/evidence/seal.js +0 -67
- package/dist/runtime/daimon/training/native/worker/evidence/seal.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/index.d.ts +0 -11
- package/dist/runtime/daimon/training/native/worker/index.js +0 -8
- package/dist/runtime/daimon/training/native/worker/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/profile.d.ts +0 -23
- package/dist/runtime/daimon/training/native/worker/profile.js +0 -149
- package/dist/runtime/daimon/training/native/worker/profile.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/public.d.ts +0 -53
- package/dist/runtime/daimon/training/native/worker/public.js +0 -22
- package/dist/runtime/daimon/training/native/worker/public.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/sandbox.d.ts +0 -4
- package/dist/runtime/daimon/training/native/worker/sandbox.js +0 -54
- package/dist/runtime/daimon/training/native/worker/sandbox.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/server.d.ts +0 -4
- package/dist/runtime/daimon/training/native/worker/server.js +0 -102
- package/dist/runtime/daimon/training/native/worker/server.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/types.d.ts +0 -318
- package/dist/runtime/daimon/training/native/worker/types.js +0 -2
- package/dist/runtime/daimon/training/native/worker/types.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/wake-delivery/index.d.ts +0 -4
- package/dist/runtime/daimon/training/native/worker/wake-delivery/index.js +0 -4
- package/dist/runtime/daimon/training/native/worker/wake-delivery/index.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/wake-delivery/source.d.ts +0 -3
- package/dist/runtime/daimon/training/native/worker/wake-delivery/source.js +0 -16
- package/dist/runtime/daimon/training/native/worker/wake-delivery/source.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/wake-delivery/terminal.d.ts +0 -4
- package/dist/runtime/daimon/training/native/worker/wake-delivery/terminal.js +0 -52
- package/dist/runtime/daimon/training/native/worker/wake-delivery/terminal.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/wake-delivery/transport.d.ts +0 -21
- package/dist/runtime/daimon/training/native/worker/wake-delivery/transport.js +0 -198
- package/dist/runtime/daimon/training/native/worker/wake-delivery/transport.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/wake-delivery/types.d.ts +0 -91
- package/dist/runtime/daimon/training/native/worker/wake-delivery/types.js +0 -2
- package/dist/runtime/daimon/training/native/worker/wake-delivery/types.js.map +0 -1
- package/dist/runtime/daimon/training/native/worker/worker.d.ts +0 -1
- package/dist/runtime/daimon/training/native/worker/worker.js +0 -105
- package/dist/runtime/daimon/training/native/worker/worker.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/broker.d.ts +0 -20
- package/dist/runtime/daimon/training/providers/grok-broker/broker.js +0 -55
- package/dist/runtime/daimon/training/providers/grok-broker/broker.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/grant-fixtures.d.ts +0 -15
- package/dist/runtime/daimon/training/providers/grok-broker/grant-fixtures.js +0 -29
- package/dist/runtime/daimon/training/providers/grok-broker/grant-fixtures.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/grant-home.d.ts +0 -16
- package/dist/runtime/daimon/training/providers/grok-broker/grant-home.js +0 -60
- package/dist/runtime/daimon/training/providers/grok-broker/grant-home.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/grant-pool.d.ts +0 -81
- package/dist/runtime/daimon/training/providers/grok-broker/grant-pool.js +0 -221
- package/dist/runtime/daimon/training/providers/grok-broker/grant-pool.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/grant-releases.d.ts +0 -31
- package/dist/runtime/daimon/training/providers/grok-broker/grant-releases.js +0 -78
- package/dist/runtime/daimon/training/providers/grok-broker/grant-releases.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/grants.d.ts +0 -63
- package/dist/runtime/daimon/training/providers/grok-broker/grants.js +0 -20
- package/dist/runtime/daimon/training/providers/grok-broker/grants.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-broker/index.d.ts +0 -3
- package/dist/runtime/daimon/training/providers/grok-broker/index.js +0 -4
- package/dist/runtime/daimon/training/providers/grok-broker/index.js.map +0 -1
- package/dist/runtime/daimon/training/public.d.ts +0 -6
- package/dist/runtime/daimon/training/public.js +0 -5
- package/dist/runtime/daimon/training/public.js.map +0 -1
- package/dist/runtime/daimon/training/services/account-lease.d.ts +0 -7
- package/dist/runtime/daimon/training/services/account-lease.js +0 -76
- package/dist/runtime/daimon/training/services/account-lease.js.map +0 -1
- package/dist/runtime/daimon/training/services/freshness.d.ts +0 -15
- package/dist/runtime/daimon/training/services/freshness.js +0 -19
- package/dist/runtime/daimon/training/services/freshness.js.map +0 -1
- package/dist/runtime/daimon/training/services/index.d.ts +0 -4
- package/dist/runtime/daimon/training/services/index.js +0 -4
- package/dist/runtime/daimon/training/services/index.js.map +0 -1
- package/dist/runtime/daimon/training/services/slot-freshness.d.ts +0 -34
- package/dist/runtime/daimon/training/services/slot-freshness.js +0 -178
- package/dist/runtime/daimon/training/services/slot-freshness.js.map +0 -1
- package/dist/runtime/daimon/wakeMoments.js.map +0 -1
- package/dist/runtime/pi/adapter.d.ts +0 -3
- package/dist/runtime/pi/adapter.js +0 -230
- package/dist/runtime/pi/appActivitySource.d.ts +0 -1
- package/dist/runtime/pi/appActivitySource.js +0 -199
- package/dist/runtime/pi/appAgentConfig.d.ts +0 -11
- package/dist/runtime/pi/appAgentConfig.js +0 -264
- package/dist/runtime/pi/appCliEnginesSource.d.ts +0 -1
- package/dist/runtime/pi/appCliEnginesSource.js +0 -183
- package/dist/runtime/pi/appCliSource.d.ts +0 -1
- package/dist/runtime/pi/appCliSource.js +0 -353
- package/dist/runtime/pi/appControlSource.d.ts +0 -1
- package/dist/runtime/pi/appControlSource.js +0 -390
- package/dist/runtime/pi/appControlWakeIdentitySource.d.ts +0 -1
- package/dist/runtime/pi/appControlWakeIdentitySource.js +0 -19
- package/dist/runtime/pi/appCoreSource.d.ts +0 -4
- package/dist/runtime/pi/appCoreSource.js +0 -244
- package/dist/runtime/pi/appPreludeSource.d.ts +0 -1
- package/dist/runtime/pi/appPreludeSource.js +0 -192
- package/dist/runtime/pi/appScheduleSource.d.ts +0 -1
- package/dist/runtime/pi/appScheduleSource.js +0 -84
- package/dist/runtime/pi/appScriptedEngine.d.ts +0 -31
- package/dist/runtime/pi/appScriptedEngine.js +0 -42
- package/dist/runtime/pi/appSource.d.ts +0 -4
- package/dist/runtime/pi/appSource.js +0 -12
- package/dist/runtime/pi/appTemplate.d.ts +0 -14
- package/dist/runtime/pi/appTemplate.js +0 -28
- package/dist/runtime/pi/appTemplateTypes.d.ts +0 -64
- package/dist/runtime/pi/appTemplateTypes.js +0 -18
- package/dist/runtime/pi/appWakeContextSource.d.ts +0 -1
- package/dist/runtime/pi/appWakeContextSource.js +0 -398
- package/dist/runtime/pi/containerTargets.d.ts +0 -4
- package/dist/runtime/pi/containerTargets.js +0 -63
- package/dist/runtime/pi/runAuth.d.ts +0 -2
- package/dist/runtime/pi/runAuth.js +0 -185
- package/dist/runtime/pi/testHelpers.d.ts +0 -2
- package/dist/shared/errors.js.map +0 -1
- package/dist/training/subjects/environment.d.ts +0 -2
- package/dist/training/subjects/environment.js +0 -14
- package/dist/training/subjects/environment.js.map +0 -1
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/index.d.ts +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/index.js +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/protocol.d.ts +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/protocol.js +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/provider.d.ts +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/provider.js +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/strict-schema.d.ts +0 -0
- /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/strict-schema.js +0 -0
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
|
-
import { posix } from 'node:path';
|
|
3
|
-
import { nativeMounts } from './manifest.js';
|
|
4
|
-
import { containerSecurityOptions } from './preflight.js';
|
|
5
|
-
import { containerPaths } from '../receipt/index.js';
|
|
6
|
-
export const ownerLabel = 'training.daimon-native.owner';
|
|
7
|
-
export const trialLabel = 'training.daimon-native.trial';
|
|
8
|
-
export function dockerCommand(command = 'docker') {
|
|
9
|
-
return async (args, options = {}) => new Promise((resolve, reject) => {
|
|
10
|
-
if (options.signal?.aborted) {
|
|
11
|
-
reject(new Error('Docker operation aborted'));
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const child = spawn(command, args, { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
15
|
-
let stdout = '';
|
|
16
|
-
let stderr = '';
|
|
17
|
-
let failure;
|
|
18
|
-
let force;
|
|
19
|
-
const abort = (reason = 'Docker operation aborted') => {
|
|
20
|
-
failure ??= new Error(reason);
|
|
21
|
-
child.kill('SIGTERM');
|
|
22
|
-
force ??= setTimeout(() => child.kill('SIGKILL'), 1000);
|
|
23
|
-
};
|
|
24
|
-
const onAbort = () => abort();
|
|
25
|
-
const timer = setTimeout(() => abort('Docker operation deadline exceeded'), options.timeoutMs ?? 15_000);
|
|
26
|
-
options.signal?.addEventListener('abort', onAbort, { once: true });
|
|
27
|
-
child.stdout.on('data', bytes => { stdout += String(bytes); if (Buffer.byteLength(stdout) > 16_777_216)
|
|
28
|
-
abort('Docker output exceeded its bound'); });
|
|
29
|
-
child.stderr.on('data', bytes => { stderr += String(bytes); if (Buffer.byteLength(stderr) > 65536)
|
|
30
|
-
abort('Docker diagnostics exceeded their bound'); });
|
|
31
|
-
child.stdin.on('error', () => undefined);
|
|
32
|
-
child.once('error', error => { failure = error; });
|
|
33
|
-
child.once('close', code => {
|
|
34
|
-
clearTimeout(timer);
|
|
35
|
-
clearTimeout(force);
|
|
36
|
-
options.signal?.removeEventListener('abort', onAbort);
|
|
37
|
-
if (failure)
|
|
38
|
-
reject(failure);
|
|
39
|
-
else
|
|
40
|
-
resolve({ code: code ?? 1, stdout, stderr });
|
|
41
|
-
});
|
|
42
|
-
child.stdin.end(options.stdin);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
export function createContainerArguments(launch, name, owner, trialId, timeoutMs, user = `${process.getuid?.() ?? 1000}:${process.getgid?.() ?? 1000}`) {
|
|
46
|
-
const security = containerSecurityOptions(launch);
|
|
47
|
-
const mounts = [...nativeMounts(launch),
|
|
48
|
-
{ source: launch.config, target: containerPaths.config, readonly: true },
|
|
49
|
-
{ source: launch.tokenFile, target: containerPaths.token, readonly: true },
|
|
50
|
-
{ source: launch.controlRoot, target: containerPaths.control, readonly: false },
|
|
51
|
-
{ source: launch.workerRoot, target: containerPaths.worker, readonly: true },
|
|
52
|
-
{ source: launch.receiptFile, target: containerPaths.receipt, readonly: true },
|
|
53
|
-
...(launch.bootstrap ? [{ source: launch.bootstrap.root, target: containerPaths.bootstrap, readonly: true }] : []),
|
|
54
|
-
];
|
|
55
|
-
return ['create', '--name', name, '--label', `${ownerLabel}=${owner}`, '--label', `${trialLabel}=${trialId}`,
|
|
56
|
-
'--pull', 'never', '--init', '--read-only', '--user', user, '--cap-drop', 'ALL',
|
|
57
|
-
'--security-opt', 'no-new-privileges', ...security, '--pids-limit', '256',
|
|
58
|
-
'--tmpfs', '/tmp:rw,nosuid,nodev,size=268435456', '--tmpfs', '/run:rw,nosuid,nodev,size=16777216',
|
|
59
|
-
'--env-file', launch.envFile, '--workdir', '/opt/training',
|
|
60
|
-
...mounts.flatMap(mount => ['--mount', `type=bind,source=${mount.source},target=${mount.target}${mount.readonly ? ',readonly' : ''}`]),
|
|
61
|
-
'--entrypoint', '/usr/local/bin/node', launch.image, '--experimental-strip-types',
|
|
62
|
-
launch.bootstrap ? posix.join(containerPaths.bootstrap, launch.bootstrap.entrypoint) : `${containerPaths.worker}/worker/cli.js`,
|
|
63
|
-
'--launch', containerPaths.receipt, '--config', containerPaths.config, '--config-sha256', launch.configSha256, '--control-root', containerPaths.control,
|
|
64
|
-
'--token-file', containerPaths.token, '--evidence', `${containerPaths.control}/evidence.json`, '--trial-id', trialId,
|
|
65
|
-
'--timeout-ms', String(timeoutMs), '--schedule-override', 'disabled'];
|
|
66
|
-
}
|
|
67
|
-
export async function inspectOwned(run, name, owner) {
|
|
68
|
-
const result = await run(['inspect', name, '--format', '{{json .}}']);
|
|
69
|
-
if (result.code !== 0) {
|
|
70
|
-
if (/No such (?:object|container)/iu.test(result.stderr))
|
|
71
|
-
return undefined;
|
|
72
|
-
throw new Error('Cannot inspect native container ownership');
|
|
73
|
-
}
|
|
74
|
-
const value = JSON.parse(result.stdout);
|
|
75
|
-
if (value.Config?.Labels?.[ownerLabel] !== owner || typeof value.State?.Running !== 'boolean') {
|
|
76
|
-
throw new Error('Native container ownership or state mismatch');
|
|
77
|
-
}
|
|
78
|
-
return value;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* `node:http` rather than `fetch`: a working worker holds the socket open for as
|
|
82
|
-
* long as its turn takes, and undici's ambient 300-second header timeout would
|
|
83
|
-
* kill a healthy one well inside a legitimate deadline. Here the caller's own
|
|
84
|
-
* deadline is the only bound, as it already was for the surrounding exec.
|
|
85
|
-
*/
|
|
86
|
-
const httpScript = `import {readFile} from 'node:fs/promises';
|
|
87
|
-
import {request} from 'node:http';
|
|
88
|
-
const input=JSON.parse(await new Promise(resolve=>{let s='';process.stdin.setEncoding('utf8');process.stdin.on('data',v=>s+=v);process.stdin.on('end',()=>resolve(s));}));
|
|
89
|
-
const token=(await readFile(input.tokenFile,'utf8')).trim();
|
|
90
|
-
const payload=input.body===undefined?undefined:JSON.stringify(input.body);
|
|
91
|
-
const value=await new Promise((resolve,reject)=>{
|
|
92
|
-
const call=request({host:'127.0.0.1',port:input.port,path:input.path,method:payload===undefined?'GET':'POST',signal:AbortSignal.timeout(input.timeoutMs),headers:{authorization:'Bearer '+token,...(payload===undefined?{}:{'content-type':'application/json'})}},response=>{
|
|
93
|
-
let text='';response.setEncoding('utf8');response.on('data',chunk=>{text+=chunk});
|
|
94
|
-
response.on('end',()=>{let parsed;try{parsed=JSON.parse(text)}catch(error){reject(error);return}
|
|
95
|
-
if(response.statusCode<200||response.statusCode>299){reject(Error('Native HTTP '+response.statusCode+': '+JSON.stringify(parsed)));return}
|
|
96
|
-
resolve(parsed)})});
|
|
97
|
-
call.on('error',reject);if(payload!==undefined)call.write(payload);call.end()});
|
|
98
|
-
process.stdout.write(JSON.stringify(value));`;
|
|
99
|
-
export async function workerRequest(run, name, path, body, timeoutMs = 5000, signal, port = 19700, tokenFile = containerPaths.token) {
|
|
100
|
-
const result = await run(['exec', '-i', name, '/usr/local/bin/node', '--input-type=module', '-e', httpScript], { signal, timeoutMs: timeoutMs + 2000, stdin: JSON.stringify({ path, body, timeoutMs, port, tokenFile }) });
|
|
101
|
-
if (result.code !== 0)
|
|
102
|
-
throw new Error(`Native worker request failed: ${result.stderr.slice(-2000)}`);
|
|
103
|
-
return JSON.parse(result.stdout);
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=docker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/container/docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAA+C,MAAM,qBAAqB,CAAC;AASlG,MAAM,CAAC,MAAM,UAAU,GAAG,8BAA8B,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,8BAA8B,CAAC;AAEzD,MAAM,UAAU,aAAa,CAAC,OAAO,GAAG,QAAQ;IAC9C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnE,IAAI,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QACvF,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KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9F,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,GAAG;;;;;;;;;;;;6CAY0B,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,aAAa,CAAI,GAAkB,EAAE,IAAY,EAAE,IAAY,EAAE,IAAc,EACnG,SAAS,GAAG,IAAI,EAAE,MAAoB,EAAE,IAAI,GAAG,KAAK,EAAE,YAAoB,cAAc,CAAC,KAAK;IAC9F,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,IAAI,EAAE,UAAU,CAAC,EAC3G,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9G,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtG,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAM,CAAC;AACxC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type GrokNativeLaunch } from '../receipt/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* What the container's own root said about this slot, read before any process starts.
|
|
4
|
-
*
|
|
5
|
-
* A Codex launch anchors every writable root and every control file inside the
|
|
6
|
-
* trial runtime home, a directory the evaluator created for this trial: a launch
|
|
7
|
-
* receipt can therefore never widen writability past the evaluator's own
|
|
8
|
-
* scratch. A Grok launch cannot use that anchor — the training container fixes
|
|
9
|
-
* its slot paths and the projection digest binds them — so the equivalent
|
|
10
|
-
* authority is this receipt. The root slot supervisor writes it after running a
|
|
11
|
-
* worker-uid denial canary over every path in the digest-bound projection, and
|
|
12
|
-
* it names the digest it certifies. Training is not that authority, so the file
|
|
13
|
-
* must be root-owned (or, outside a container, owned by this evaluator) and
|
|
14
|
-
* never group- or world-writable.
|
|
15
|
-
*
|
|
16
|
-
* Only the denial set is returned. Receipt freshness stays with the evaluator's
|
|
17
|
-
* slot freshness store, which is the single authority for nonce and generation;
|
|
18
|
-
* the projection v2 digest is checked here because it binds this denial set and
|
|
19
|
-
* the declared workerConfigVariant to this launch. The slot receipt remains v2
|
|
20
|
-
* for both worker variants; launch parsing refuses unclocked task-clock trials.
|
|
21
|
-
*/
|
|
22
|
-
export declare function readGrokSlotDenials(launch: GrokNativeLaunch): Promise<string[]>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { lstat, realpath } from 'node:fs/promises';
|
|
2
|
-
import { grokSlotPreflightSchema, readPrivateFile } from '../receipt/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* What the container's own root said about this slot, read before any process starts.
|
|
5
|
-
*
|
|
6
|
-
* A Codex launch anchors every writable root and every control file inside the
|
|
7
|
-
* trial runtime home, a directory the evaluator created for this trial: a launch
|
|
8
|
-
* receipt can therefore never widen writability past the evaluator's own
|
|
9
|
-
* scratch. A Grok launch cannot use that anchor — the training container fixes
|
|
10
|
-
* its slot paths and the projection digest binds them — so the equivalent
|
|
11
|
-
* authority is this receipt. The root slot supervisor writes it after running a
|
|
12
|
-
* worker-uid denial canary over every path in the digest-bound projection, and
|
|
13
|
-
* it names the digest it certifies. Training is not that authority, so the file
|
|
14
|
-
* must be root-owned (or, outside a container, owned by this evaluator) and
|
|
15
|
-
* never group- or world-writable.
|
|
16
|
-
*
|
|
17
|
-
* Only the denial set is returned. Receipt freshness stays with the evaluator's
|
|
18
|
-
* slot freshness store, which is the single authority for nonce and generation;
|
|
19
|
-
* the projection v2 digest is checked here because it binds this denial set and
|
|
20
|
-
* the declared workerConfigVariant to this launch. The slot receipt remains v2
|
|
21
|
-
* for both worker variants; launch parsing refuses unclocked task-clock trials.
|
|
22
|
-
*/
|
|
23
|
-
export async function readGrokSlotDenials(launch) {
|
|
24
|
-
const file = launch.broker.slotPreflightReceipt;
|
|
25
|
-
if (await realpath(file) !== file)
|
|
26
|
-
throw new Error('The Grok slot preflight receipt must be a canonical file');
|
|
27
|
-
const entry = await lstat(file);
|
|
28
|
-
const owner = process.getuid?.();
|
|
29
|
-
if ((entry.mode & 0o022) !== 0 || entry.uid !== 0 && entry.uid !== owner) {
|
|
30
|
-
throw new Error('The Grok slot preflight receipt must be written by the container root and stay unwritable to other users');
|
|
31
|
-
}
|
|
32
|
-
const receipt = grokSlotPreflightSchema.parse(JSON.parse(await readPrivateFile(file, 262_144)));
|
|
33
|
-
if (receipt.projection_sha256 !== launch.broker.projectionSha256) {
|
|
34
|
-
throw new Error('The Grok slot preflight receipt certifies a different projection than this launch declares');
|
|
35
|
-
}
|
|
36
|
-
return [...new Set(receipt.canaries.map(canary => canary.path))].sort();
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=grok-slot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grok-slot.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/container/grok-slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAyB,MAAM,qBAAqB,CAAC;AAEtG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,MAAwB;IAChE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAChD,IAAI,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC/G,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IACjC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,0GAA0G,CAAC,CAAC;IAC9H,CAAC;IACD,MAAM,OAAO,GAAG,uBAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAChG,IAAI,OAAO,CAAC,iBAAiB,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACjE,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;IAChH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1E,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { dockerCommand, createContainerArguments, inspectOwned, workerRequest, ownerLabel, trialLabel } from './docker.js';
|
|
2
|
-
export type { DockerCommand, DockerResult, ContainerInspection } from './docker.js';
|
|
3
|
-
export { startOwnedContainer } from './lifecycle.js';
|
|
4
|
-
export { loadNativeLaunch, nativeMounts } from './manifest.js';
|
|
5
|
-
export { containerSecurityOptions, grokContainerUnsupported, sandboxChecks, sandboxPreflightSchema } from './preflight.js';
|
|
6
|
-
export { assertLeasedLaunch } from './slot.js';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { dockerCommand, createContainerArguments, inspectOwned, workerRequest, ownerLabel, trialLabel } from './docker.js';
|
|
2
|
-
export { startOwnedContainer } from './lifecycle.js';
|
|
3
|
-
export { loadNativeLaunch, nativeMounts } from './manifest.js';
|
|
4
|
-
export { containerSecurityOptions, grokContainerUnsupported, sandboxChecks, sandboxPreflightSchema } from './preflight.js';
|
|
5
|
-
export { assertLeasedLaunch } from './slot.js';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/container/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3H,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { StopReceipt } from '../../../../../training/index.js';
|
|
2
|
-
import { type DockerCommand } from './docker.js';
|
|
3
|
-
import type { VerifiedNativeLaunch } from '../receipt/index.js';
|
|
4
|
-
export declare function startOwnedContainer(run: DockerCommand, launch: VerifiedNativeLaunch, trialId: string, timeoutMs: number, signal?: AbortSignal, startupMs?: number): Promise<{
|
|
5
|
-
name: string;
|
|
6
|
-
owner: `${string}-${string}-${string}-${string}-${string}`;
|
|
7
|
-
stop: (reason: string) => Promise<StopReceipt>;
|
|
8
|
-
}>;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { canonicalWireId } from '../../../../../training/index.js';
|
|
2
|
-
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { verifyNativeSandbox } from './preflight.js';
|
|
4
|
-
import { createContainerArguments, inspectOwned, workerRequest } from './docker.js';
|
|
5
|
-
import { recordNativeStartupClosure } from '../../services/index.js';
|
|
6
|
-
export async function startOwnedContainer(run, launch, trialId, timeoutMs, signal, startupMs = 60_000) {
|
|
7
|
-
const owner = randomUUID();
|
|
8
|
-
const name = `training-${owner}`;
|
|
9
|
-
let created = false;
|
|
10
|
-
let stopping;
|
|
11
|
-
const stop = (reason) => {
|
|
12
|
-
stopping ??= (async () => {
|
|
13
|
-
let native;
|
|
14
|
-
try {
|
|
15
|
-
if (!created)
|
|
16
|
-
return receipt('acknowledged', 'confirmed', reason, 'No native container was created');
|
|
17
|
-
let state = await inspectOwned(run, name, owner);
|
|
18
|
-
if (!state)
|
|
19
|
-
return receipt('acknowledged', 'confirmed', reason, 'Owned native container is absent');
|
|
20
|
-
if (state.State.Running) {
|
|
21
|
-
try {
|
|
22
|
-
native = await workerRequest(run, name, '/trial/stop', {}, 6000, undefined, launch.host.port);
|
|
23
|
-
}
|
|
24
|
-
catch { /* outer containment remains authoritative */ }
|
|
25
|
-
await run(['stop', '--time', '2', name], { timeoutMs: 5000 }).catch(() => undefined);
|
|
26
|
-
state = await inspectOwned(run, name, owner);
|
|
27
|
-
if (state?.State.Running) {
|
|
28
|
-
await run(['kill', name], { timeoutMs: 5000 });
|
|
29
|
-
const deadline = Date.now() + 3000;
|
|
30
|
-
do {
|
|
31
|
-
state = await inspectOwned(run, name, owner);
|
|
32
|
-
if (!state?.State.Running)
|
|
33
|
-
break;
|
|
34
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
35
|
-
} while (Date.now() < deadline);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (state?.State.Running)
|
|
39
|
-
throw new Error('Owned container still reports running after termination');
|
|
40
|
-
const removed = await run(['rm', name], { timeoutMs: 5000 });
|
|
41
|
-
if (removed.code !== 0 && await inspectOwned(run, name, owner))
|
|
42
|
-
throw new Error('Owned stopped container could not be removed');
|
|
43
|
-
if (await inspectOwned(run, name, owner))
|
|
44
|
-
throw new Error('Owned container remained after removal');
|
|
45
|
-
return receipt('acknowledged', 'confirmed', reason, `Owned container stopped and removed; native stop ${native?.state ?? 'unavailable'}`);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
return receipt('unknown', 'unknown', reason, `Container shutdown unconfirmed: ${String(error)}`);
|
|
49
|
-
}
|
|
50
|
-
})();
|
|
51
|
-
return stopping;
|
|
52
|
-
};
|
|
53
|
-
try {
|
|
54
|
-
const context = await run(['context', 'inspect', '--format', '{{json .Endpoints.docker.Host}}'], { signal });
|
|
55
|
-
if (context.code !== 0 || !String(JSON.parse(context.stdout)).startsWith('unix://') ||
|
|
56
|
-
process.env.DOCKER_HOST && !process.env.DOCKER_HOST.startsWith('unix://'))
|
|
57
|
-
throw new Error('Native trials require a local Docker socket context');
|
|
58
|
-
created = true;
|
|
59
|
-
const create = await run(createContainerArguments(launch, name, owner, trialId, timeoutMs), { signal, timeoutMs: 30_000 });
|
|
60
|
-
if (create.code !== 0 || !/^[a-f0-9]{64}$/u.test(create.stdout.trim()))
|
|
61
|
-
throw new Error(`Native container creation failed: ${create.stderr.slice(-1000)}`);
|
|
62
|
-
await inspectOwned(run, name, owner);
|
|
63
|
-
const started = await run(['start', name], { signal });
|
|
64
|
-
if (started.code !== 0)
|
|
65
|
-
throw new Error(`Native container start failed: ${started.stderr.slice(-1000)}`);
|
|
66
|
-
const deadline = Date.now() + startupMs;
|
|
67
|
-
let lastError = '';
|
|
68
|
-
while (Date.now() < deadline) {
|
|
69
|
-
if (signal?.aborted)
|
|
70
|
-
throw new Error('Native startup aborted');
|
|
71
|
-
const state = await inspectOwned(run, name, owner);
|
|
72
|
-
if (!state?.State.Running) {
|
|
73
|
-
const logs = await run(['logs', '--tail', '20', name]);
|
|
74
|
-
throw new Error(`Native container exited before readiness: ${logs.stderr.slice(-2000)}${logs.stdout.slice(-2000)}`);
|
|
75
|
-
}
|
|
76
|
-
let healthy = false;
|
|
77
|
-
try {
|
|
78
|
-
const health = await workerRequest(run, name, '/trial/health', undefined, 1000, signal, launch.host.port);
|
|
79
|
-
const logs = await run(['logs', '--tail', '100', name], { signal });
|
|
80
|
-
const ready = logs.stdout.split('\n').filter(Boolean).flatMap(line => { try {
|
|
81
|
-
return [JSON.parse(line)];
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
return [];
|
|
85
|
-
} })
|
|
86
|
-
.find(row => canonicalWireId(row.schema) === 'spawnfile.training.daimon-native.ready.v1' && row.trialId === trialId && row.configSha256 === launch.configSha256);
|
|
87
|
-
healthy = !!ready && health.version === 'noopolis.daimon.organization-runtime-health.v1' && health.state === 'running' &&
|
|
88
|
-
health.agents.length === 1 && health.agents[0]?.agentId === launch.agent.id;
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
lastError = String(error);
|
|
92
|
-
}
|
|
93
|
-
if (healthy) {
|
|
94
|
-
await verifyNativeSandbox(run, name, launch, trialId, signal);
|
|
95
|
-
return { name, owner, stop };
|
|
96
|
-
}
|
|
97
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
98
|
-
}
|
|
99
|
-
throw new Error(`Native startup deadline exceeded: ${lastError}`);
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
const outcome = await stop('Native startup failed');
|
|
103
|
-
if (outcome.quiescence !== 'confirmed')
|
|
104
|
-
throw new Error(`${String(error)}; ${outcome.detail}`, { cause: error });
|
|
105
|
-
throw recordNativeStartupClosure(error, true);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function receipt(state, quiescence, reason, detail) {
|
|
109
|
-
return { state, scope: 'native-handle', quiescence, remoteWork: 'unknown', reason, detail };
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/container/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAGxG,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAkB,EAAE,MAA4B,EAAE,OAAe,EAAE,SAAiB,EAC5H,MAAoB,EAAE,SAAS,GAAG,MAAM;IACxC,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;IACjC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,QAA0C,CAAC;IAC/C,MAAM,IAAI,GAAG,CAAC,MAAc,EAAwB,EAAE;QACpD,QAAQ,KAAK,CAAC,KAAK,IAAI,EAAE;YACvB,IAAI,MAAsC,CAAC;YAC3C,IAAI,CAAC;gBACH,IAAI,CAAC,OAAO;oBAAE,OAAO,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,iCAAiC,CAAC,CAAC;gBACrG,IAAI,KAAK,GAAG,MAAM,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;gBACjD,IAAI,CAAC,KAAK;oBAAE,OAAO,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,kCAAkC,CAAC,CAAC;gBACpG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;oBACxB,IAAI,CAAC;wBAAC,MAAM,GAAG,MAAM,aAAa,CAAqB,GAAG,EAAE,IAAI,EA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GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAAC,CAAC;YAC9C,IAAI,OAAO,EAAE,CAAC;gBAAC,MAAM,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;gBAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YAAC,CAAC;YAC7G,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,qCAAqC,SAAS,EAAE,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACpD,IAAI,OAAO,CAAC,UAAU,KAAK,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACjH,MAAM,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,KAA2B,EAAE,UAAqC,EAAE,MAAc,EAAE,MAAc;IACjH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC9F,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { SubjectStart } from '../../../../../training/index.js';
|
|
2
|
-
import { type NativeLaunch, type VerifiedNativeLaunch, type NativeMount } from '../receipt/index.js';
|
|
3
|
-
export declare function nativeMounts(launch: NativeLaunch): NativeMount[];
|
|
4
|
-
/**
|
|
5
|
-
* Only fresh subtrees explicitly projected by trusted preparation enter the subject.
|
|
6
|
-
*
|
|
7
|
-
* Codex anchors every writable root, control file and control root inside the
|
|
8
|
-
* trial runtime home the evaluator created for this trial. Its one subscription
|
|
9
|
-
* projection is separate persistent account state, denied by the native sandbox. A brokered Grok launch runs in
|
|
10
|
-
* a training container whose slot paths are fixed and bound by
|
|
11
|
-
* `projection_sha256`, so the same guarantee is taken from the container
|
|
12
|
-
* contract instead: the two writable roots are exactly the trial workspace and
|
|
13
|
-
* the trial runtime home the evaluator itself named (and the projection digest
|
|
14
|
-
* binds both), the control root and every control input sit inside a root
|
|
15
|
-
* attested, worker-denied slot root, and no writable root touches one.
|
|
16
|
-
*/
|
|
17
|
-
export declare function loadNativeLaunch(input: SubjectStart, child?: boolean): Promise<VerifiedNativeLaunch>;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { assertLeasedLaunch } from './slot.js';
|
|
2
|
-
import { lstat, realpath, readdir } from 'node:fs/promises';
|
|
3
|
-
import { basename, dirname, join, resolve } from 'node:path';
|
|
4
|
-
import { grokContainerUnsupported } from './preflight.js';
|
|
5
|
-
import { readGrokSlotDenials } from './grok-slot.js';
|
|
6
|
-
import { DAIMON_CODEX_SUBSCRIPTION_REALM } from '../../../index.js';
|
|
7
|
-
import { containerPaths, grokSubjectRoots, isGrokLaunch, nativeCodexAccount, nativeTrialArtifactsRoot, parseNativeLaunch, readPrivateFile, sha256, within } from '../receipt/index.js';
|
|
8
|
-
export function nativeMounts(launch) {
|
|
9
|
-
return [{ ...launch.workspace, readonly: false },
|
|
10
|
-
...launch.projections.map(({ source, target }) => ({ source, target, readonly: false })),
|
|
11
|
-
...launch.credentials.map(row => ({ ...row, readonly: true }))];
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Only fresh subtrees explicitly projected by trusted preparation enter the subject.
|
|
15
|
-
*
|
|
16
|
-
* Codex anchors every writable root, control file and control root inside the
|
|
17
|
-
* trial runtime home the evaluator created for this trial. Its one subscription
|
|
18
|
-
* projection is separate persistent account state, denied by the native sandbox. A brokered Grok launch runs in
|
|
19
|
-
* a training container whose slot paths are fixed and bound by
|
|
20
|
-
* `projection_sha256`, so the same guarantee is taken from the container
|
|
21
|
-
* contract instead: the two writable roots are exactly the trial workspace and
|
|
22
|
-
* the trial runtime home the evaluator itself named (and the projection digest
|
|
23
|
-
* binds both), the control root and every control input sit inside a root
|
|
24
|
-
* attested, worker-denied slot root, and no writable root touches one.
|
|
25
|
-
*/
|
|
26
|
-
export async function loadNativeLaunch(input, child = false) {
|
|
27
|
-
const runtime = await realpath(input.runtimeHomePath);
|
|
28
|
-
// The resolved trial runtime home, not the caller's spelling of it: preparation may reach a fixed slot
|
|
29
|
-
// root through a symlink, and the worker refuses any control file whose own path traverses one. This
|
|
30
|
-
// cannot redirect the receipt — the value comes from the evaluator's `runtimeHomePath`, never from the
|
|
31
|
-
// launch, and every check below still pins that resolved root (for Grok, to the digest-bound slot home).
|
|
32
|
-
const receiptFile = join(runtime, 'native-launch.json');
|
|
33
|
-
const launch = parseNativeLaunch(JSON.parse(await readPrivateFile(receiptFile, 65536)));
|
|
34
|
-
if (input.slot)
|
|
35
|
-
assertLeasedLaunch(launch, input.slot);
|
|
36
|
-
if (launch.agent.engine === 'grok' && !child)
|
|
37
|
-
throw new Error(grokContainerUnsupported);
|
|
38
|
-
const workspace = await realpath(input.workspacePath);
|
|
39
|
-
if (input.model !== launch.agent.model)
|
|
40
|
-
throw new Error('Subject model differs from the prepared native model');
|
|
41
|
-
if (input.tools?.length)
|
|
42
|
-
throw new Error('Fixture functions cannot replace native runtime tools');
|
|
43
|
-
if (await realpath(launch.workspace.source) !== workspace)
|
|
44
|
-
throw new Error('Native workspace must be the materialized trial workspace');
|
|
45
|
-
const instructions = await readPrivateFile(join(workspace, launch.instructions.relativePath));
|
|
46
|
-
if (instructions !== input.instructions || sha256(instructions) !== launch.instructions.sha256) {
|
|
47
|
-
throw new Error('Materialized native instruction bytes differ from the declared candidate');
|
|
48
|
-
}
|
|
49
|
-
if (sha256(await readPrivateFile(launch.config)) !== launch.configSha256)
|
|
50
|
-
throw new Error('Native launch config digest mismatch');
|
|
51
|
-
const slotDenied = isGrokLaunch(launch) ? await readGrokSlotDenials(launch) : undefined;
|
|
52
|
-
const deniedRoot = (path) => !!slotDenied?.some(root => within(root, path));
|
|
53
|
-
const touchesDenied = (path) => !!slotDenied?.some(root => within(root, path) || within(path, root));
|
|
54
|
-
const control = await realpath(launch.controlRoot);
|
|
55
|
-
if (slotDenied) {
|
|
56
|
-
const entry = await lstat(control);
|
|
57
|
-
// The receipt is the container root's own statement; a control root it does not deny to the worker uid is refused.
|
|
58
|
-
if (control !== launch.controlRoot || !entry.isDirectory() || (entry.mode & 0o077) !== 0 ||
|
|
59
|
-
!slotDenied.includes(control) || within(workspace, control)) {
|
|
60
|
-
throw new Error('Native Grok control must be a private slot directory the verified slot receipt denies to the worker');
|
|
61
|
-
}
|
|
62
|
-
// The slot control root is shared across trials and already holds Daimon's own store, so freshness is per trial.
|
|
63
|
-
if (await lstat(nativeTrialArtifactsRoot(launch, input.trialId)).then(() => true, () => false)) {
|
|
64
|
-
throw new Error('Native Grok control already holds fresh trial data for this trial identity');
|
|
65
|
-
}
|
|
66
|
-
if ((await lstat(receiptFile)).mode & 0o077)
|
|
67
|
-
throw new Error('The Grok native launch receipt must stay private inside the slot runtime home');
|
|
68
|
-
}
|
|
69
|
-
else if (!within(runtime, control) || control === runtime || within(workspace, control) || (await readdir(control)).length) {
|
|
70
|
-
throw new Error('Native control must be a fresh empty directory within the trial runtime');
|
|
71
|
-
}
|
|
72
|
-
for (const file of [launch.config, launch.tokenFile, launch.envFile]) {
|
|
73
|
-
const path = await realpath(file);
|
|
74
|
-
const anchored = slotDenied ? deniedRoot(path) : within(runtime, path);
|
|
75
|
-
if (path !== file || !anchored || within(workspace, path))
|
|
76
|
-
throw new Error('Native control inputs must be private trial files');
|
|
77
|
-
await readPrivateFile(path);
|
|
78
|
-
}
|
|
79
|
-
if (touchesDenied(workspace))
|
|
80
|
-
throw new Error('The Grok slot workspace cannot be, contain or sit inside a denied slot root');
|
|
81
|
-
const protectedRoots = await Promise.all((input.protectedPaths ?? []).map(path => realpath(path)));
|
|
82
|
-
// The engine-neutral trial runner protects its own runtime home; for a Grok slot that root is the subject's home.
|
|
83
|
-
const subjectRoots = isGrokLaunch(launch) ? grokSubjectRoots(launch) : [];
|
|
84
|
-
const home = launch.projections.find(row => row.role === 'home');
|
|
85
|
-
const account = nativeCodexAccount(launch);
|
|
86
|
-
if (account && !child && (account.realm.target !== DAIMON_CODEX_SUBSCRIPTION_REALM.durableMountPath
|
|
87
|
-
|| account.bootstrap.target !== DAIMON_CODEX_SUBSCRIPTION_REALM.bootstrapMountPath)) {
|
|
88
|
-
throw new Error('Codex container account mounts must use the native subscription realm targets');
|
|
89
|
-
}
|
|
90
|
-
const targets = new Set();
|
|
91
|
-
const writableSources = [];
|
|
92
|
-
for (const mount of nativeMounts(launch)) {
|
|
93
|
-
const source = await realpath(mount.source);
|
|
94
|
-
const stat = await lstat(source);
|
|
95
|
-
if (source !== resolve(mount.source) || !stat.isFile() && !stat.isDirectory())
|
|
96
|
-
throw new Error('Native bind source must be a real file or directory');
|
|
97
|
-
if (targets.has(mount.target))
|
|
98
|
-
throw new Error('Duplicate native bind target');
|
|
99
|
-
targets.add(mount.target);
|
|
100
|
-
if (['/', '/var', '/var/run', '/run', '/proc', '/sys', '/dev', '/etc', '/usr', '/opt', '/home', '/tmp'].includes(mount.target) ||
|
|
101
|
-
mount.target.includes('docker.sock') || source.includes('docker.sock'))
|
|
102
|
-
throw new Error('Forbidden native bind target');
|
|
103
|
-
if (Object.values(containerPaths).some(target => within(mount.target, target) || within(target, mount.target))) {
|
|
104
|
-
throw new Error('Native bind overlaps worker-owned control paths');
|
|
105
|
-
}
|
|
106
|
-
if (mount.readonly) {
|
|
107
|
-
// Only Codex has a portable ingress credential; Grok launches carry none (schema) and use the broker realm.
|
|
108
|
-
if (!account || mount.target !== account.bootstrap.target || !stat.isFile() || (stat.mode & 0o077) !== 0 || stat.nlink !== 1) {
|
|
109
|
-
throw new Error('Credential mount must be one private read-only native ingress file');
|
|
110
|
-
}
|
|
111
|
-
const exposedSources = [launch.workspace.source, ...launch.projections.map(row => row.source), launch.workerRoot,
|
|
112
|
-
...(launch.bootstrap ? [launch.bootstrap.root] : [])];
|
|
113
|
-
if (exposedSources.some(root => within(root, source)))
|
|
114
|
-
throw new Error('Credential source cannot also be exposed through another native mount');
|
|
115
|
-
if (launch.projections.some(row => within(row.target, mount.target) || within(mount.target, row.target))
|
|
116
|
-
|| within(launch.workspace.target, mount.target))
|
|
117
|
-
throw new Error('Shared bootstrap cannot overlap writable native projections');
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
if (writableSources.some(root => within(root, source) || within(source, root))) {
|
|
121
|
-
throw new Error('Writable native projections cannot overlap or alias the engine credential home');
|
|
122
|
-
}
|
|
123
|
-
writableSources.push(source);
|
|
124
|
-
if (account && mount.target === account.realm.target) {
|
|
125
|
-
// The account outlives every trial. It must be a distinct private directory,
|
|
126
|
-
// never one of the trial's writable homes, controls, or evaluator roots.
|
|
127
|
-
const excluded = [runtime, workspace, control, launch.workerRoot, ...protectedRoots,
|
|
128
|
-
...launch.projections.filter(row => row !== account.realm).map(row => row.source)];
|
|
129
|
-
if (!stat.isDirectory() || (stat.mode & 0o777) !== 0o700 || stat.uid !== process.getuid?.()
|
|
130
|
-
|| excluded.some(root => within(source, root) || within(root, source))) {
|
|
131
|
-
throw new Error('Codex subscription realm must be private persistent account state outside trial data');
|
|
132
|
-
}
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
if (source !== workspace) {
|
|
136
|
-
if (slotDenied) {
|
|
137
|
-
// Closed set: the schema admits one projection, and it must be the trial runtime home the evaluator named,
|
|
138
|
-
// which the slot projection binds as `runtimeHomePath`. Nothing the launch chose on its own is writable.
|
|
139
|
-
if (source !== runtime || touchesDenied(source)) {
|
|
140
|
-
throw new Error('Native Grok projection must be exactly the slot runtime home and outside every denied slot root');
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
const childData = child && basename(workspace) === 'workspace' && launch.projections.some(row => row.source === source && ['home', 'memory', 'state'].includes(row.role) && source === join(dirname(workspace), row.role));
|
|
145
|
-
if ((!within(runtime, source) && !childData) || source === runtime || within(source, control) || within(control, source) ||
|
|
146
|
-
[launch.config, launch.tokenFile, launch.envFile].some(path => within(source, path))) {
|
|
147
|
-
throw new Error('Native projection must be fresh trial data and exclude controls');
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (mount.target !== home.target && (within(home.target, mount.target) || within(mount.target, home.target))) {
|
|
151
|
-
throw new Error('Native projections cannot alias into the engine home');
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (protectedRoots.some(root => within(source, root) && !subjectRoots.includes(root)))
|
|
155
|
-
throw new Error('Native bind contains evaluator-owned files');
|
|
156
|
-
}
|
|
157
|
-
for (const source of [launch.workerRoot, ...(launch.bootstrap ? [launch.bootstrap.root] : [])]) {
|
|
158
|
-
if (await realpath(source) !== source || !(await lstat(source)).isDirectory() || source === '/' ||
|
|
159
|
-
protectedRoots.some(root => within(source, root) || within(root, source)))
|
|
160
|
-
throw new Error('Invalid immutable native code mount');
|
|
161
|
-
}
|
|
162
|
-
return { ...launch, receiptFile };
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=manifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/container/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAA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
|
|
3
|
-
/** Exact owner-projected policy; fresh config home because sandbox lacks exec's isolation flags. */
|
|
4
|
-
export declare const nativePolicyProbeScript = "\nimport {execFile} from 'node:child_process';\nimport {promisify} from 'node:util';\nimport {mkdtemp,mkdir,readFile,writeFile,rm} from 'node:fs/promises';\nimport {join} from 'node:path';\nconst input=JSON.parse(await new Promise(resolve=>{let s='';process.stdin.setEncoding('utf8');process.stdin.on('data',v=>s+=v);process.stdin.on('end',()=>resolve(s));}));\nconst projection=input.projection;\nconst scratch=await mkdtemp(join(projection.workspacePath,'.spawnfile-training-native-policy-'));\ntry {\n const home=join(scratch,'home'), code=join(home,'.codex'), source=join(scratch,'input'), output=join(scratch,'complete');\n await mkdir(code,{recursive:true,mode:448});\n await writeFile(source,'NATIVE_WORKSPACE_READ',{mode:384});\n const command='const fs=require(\"node:fs\");if(process.cwd()!=='+JSON.stringify(projection.workspacePath)+'||fs.readFileSync('+JSON.stringify(source)+',\"utf8\")!==\"NATIVE_WORKSPACE_READ\")throw Error(\"Native workspace read failed\");fs.writeFileSync('+JSON.stringify(output)+',\"NATIVE_POLICY_EXECUTED\");';\n await promisify(execFile)(projection.executablePath,[...projection.sandboxArgs,'--','/usr/local/bin/node','-e',command],{\n cwd:projection.workspacePath,env:{PATH:process.env.PATH,HOME:home,CODEX_HOME:code,TMPDIR:'/tmp',LANG:'C.UTF-8'},timeout:12000,maxBuffer:65536});\n if(await readFile(output,'utf8')!=='NATIVE_POLICY_EXECUTED')throw Error('Native sandbox command did not complete');\n process.stdout.write(JSON.stringify({schema:'spawnfile.training.daimon-native.policy-preflight.v1',projectionSha256:input.projectionSha256,modelCallsMade:0,workspaceReadWrite:true}));\n} finally {await rm(scratch,{recursive:true,force:true});}\n";
|
|
5
|
-
export declare function verifyPreparedNativeSandbox(run: DockerCommand, name: string, launch: VerifiedNativeLaunch, trialId: string, signal?: AbortSignal): Promise<{
|
|
6
|
-
projectionSha256: string;
|
|
7
|
-
workspaceReadWrite: true;
|
|
8
|
-
}>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { canonicalWireId } from '../../../../../training/index.js';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { parseNativeSandboxReceipt, readPrivateFile } from '../receipt/index.js';
|
|
4
|
-
/** Exact owner-projected policy; fresh config home because sandbox lacks exec's isolation flags. */
|
|
5
|
-
export const nativePolicyProbeScript = `
|
|
6
|
-
import {execFile} from 'node:child_process';
|
|
7
|
-
import {promisify} from 'node:util';
|
|
8
|
-
import {mkdtemp,mkdir,readFile,writeFile,rm} from 'node:fs/promises';
|
|
9
|
-
import {join} from 'node:path';
|
|
10
|
-
const input=JSON.parse(await new Promise(resolve=>{let s='';process.stdin.setEncoding('utf8');process.stdin.on('data',v=>s+=v);process.stdin.on('end',()=>resolve(s));}));
|
|
11
|
-
const projection=input.projection;
|
|
12
|
-
const scratch=await mkdtemp(join(projection.workspacePath,'.spawnfile-training-native-policy-'));
|
|
13
|
-
try {
|
|
14
|
-
const home=join(scratch,'home'), code=join(home,'.codex'), source=join(scratch,'input'), output=join(scratch,'complete');
|
|
15
|
-
await mkdir(code,{recursive:true,mode:448});
|
|
16
|
-
await writeFile(source,'NATIVE_WORKSPACE_READ',{mode:384});
|
|
17
|
-
const command='const fs=require("node:fs");if(process.cwd()!=='+JSON.stringify(projection.workspacePath)+'||fs.readFileSync('+JSON.stringify(source)+',"utf8")!=="NATIVE_WORKSPACE_READ")throw Error("Native workspace read failed");fs.writeFileSync('+JSON.stringify(output)+',"NATIVE_POLICY_EXECUTED");';
|
|
18
|
-
await promisify(execFile)(projection.executablePath,[...projection.sandboxArgs,'--','/usr/local/bin/node','-e',command],{
|
|
19
|
-
cwd:projection.workspacePath,env:{PATH:process.env.PATH,HOME:home,CODEX_HOME:code,TMPDIR:'/tmp',LANG:'C.UTF-8'},timeout:12000,maxBuffer:65536});
|
|
20
|
-
if(await readFile(output,'utf8')!=='NATIVE_POLICY_EXECUTED')throw Error('Native sandbox command did not complete');
|
|
21
|
-
process.stdout.write(JSON.stringify({schema:'spawnfile.training.daimon-native.policy-preflight.v1',projectionSha256:input.projectionSha256,modelCallsMade:0,workspaceReadWrite:true}));
|
|
22
|
-
} finally {await rm(scratch,{recursive:true,force:true});}
|
|
23
|
-
`;
|
|
24
|
-
export async function verifyPreparedNativeSandbox(run, name, launch, trialId, signal) {
|
|
25
|
-
const home = launch.projections.find(projection => projection.role === 'home');
|
|
26
|
-
const receipt = parseNativeSandboxReceipt(JSON.parse(await readPrivateFile(join(launch.controlRoot, 'sandbox-projection.json'), 262144)), {
|
|
27
|
-
trialId, configSha256: launch.configSha256, agentId: launch.agent.id, workspacePath: launch.workspace.target, runtimeHomePath: home.target,
|
|
28
|
-
});
|
|
29
|
-
const result = await run(['exec', '-i', name, '/usr/local/bin/node', '--input-type=module', '-e', nativePolicyProbeScript], {
|
|
30
|
-
signal, timeoutMs: 15_000, stdin: JSON.stringify({ path: 'native-policy-preflight', projectionSha256: receipt.projectionSha256, projection: receipt.projection }),
|
|
31
|
-
});
|
|
32
|
-
if (result.code !== 0)
|
|
33
|
-
throw new Error(`Exact native sandbox policy failed before cognition: ${result.stderr.slice(-3000)}`);
|
|
34
|
-
const proof = JSON.parse(result.stdout);
|
|
35
|
-
if (canonicalWireId(proof.schema) !== 'spawnfile.training.daimon-native.policy-preflight.v1' || proof.projectionSha256 !== receipt.projectionSha256 ||
|
|
36
|
-
proof.modelCallsMade !== 0 || proof.workspaceReadWrite !== true)
|
|
37
|
-
throw new Error('Exact native sandbox probe omitted bound workspace execution evidence');
|
|
38
|
-
return { projectionSha256: receipt.projectionSha256, workspaceReadWrite: true };
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=native-preflight.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"native-preflight.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/container/native-preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,C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