spawnfile 0.1.33 → 0.1.35
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/audit/readAudit.d.ts +3 -3
- package/dist/auth/profileStore.d.ts +3 -1
- package/dist/auth/profileStore.js +31 -30
- package/dist/auth/trainingAuth.d.ts +2 -5
- package/dist/auth/types.d.ts +16 -0
- package/dist/cli/authCommands.d.ts +1 -1
- package/dist/cli/authCommands.js +21 -1
- package/dist/cli/devCommands.d.ts +1 -1
- package/dist/cli/devCommands.js +0 -66
- package/dist/cli/runCli.d.ts +3 -4
- package/dist/cli/runCli.js +4 -3
- package/dist/cli/trainCommand.js +9 -15
- package/dist/cli/trainingBooted.d.ts +9 -0
- package/dist/cli/trainingBooted.js +45 -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 +19 -90
- package/dist/compiler/containerDaimonGatewayRender.d.ts +50 -0
- package/dist/compiler/containerDaimonGatewayRender.js +161 -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 +29 -47
- 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 +3 -0
- package/dist/compiler/runProject.js +12 -5
- package/dist/compiler/runProjectAuth.js +6 -18
- 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/rewind/contract.d.ts +6 -6
- package/dist/compiler/training/trial/boot.d.ts +72 -0
- package/dist/compiler/training/trial/boot.js +225 -0
- package/dist/compiler/training/trial/docker.d.ts +10 -0
- package/dist/compiler/training/trial/docker.js +22 -0
- package/dist/compiler/training/trial/gateway.d.ts +47 -0
- package/dist/compiler/training/trial/gateway.js +113 -0
- package/dist/compiler/training/trial/homeLogin.d.ts +31 -0
- package/dist/compiler/training/trial/homeLogin.js +69 -0
- package/dist/compiler/training/trial/index.d.ts +8 -0
- package/dist/compiler/training/trial/index.js +8 -0
- package/dist/compiler/training/trial/judge.d.ts +15 -0
- package/dist/compiler/training/trial/judge.js +42 -0
- package/dist/compiler/training/trial/launcher.d.ts +47 -0
- package/dist/compiler/training/trial/launcher.js +193 -0
- package/dist/compiler/training/trial/login.d.ts +35 -0
- package/dist/compiler/training/trial/login.js +85 -0
- package/dist/compiler/training/trial/project.d.ts +11 -0
- package/dist/compiler/training/trial/project.js +31 -0
- package/dist/compiler/training/trial/realmTurns.d.ts +20 -0
- package/dist/compiler/training/trial/realmTurns.js +69 -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/manifest/renderSpawnfile.js +2 -1
- 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 +8 -14
- 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 +15 -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 +27 -3
- package/dist/runtime/daimon/subscriptionRealms.js +35 -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 +50 -0
- package/dist/runtime/daimon/training/booted/adapter.js +60 -0
- package/dist/runtime/daimon/training/booted/adapter.js.map +1 -0
- package/dist/runtime/daimon/training/booted/index.d.ts +4 -0
- package/dist/runtime/daimon/training/booted/index.js +3 -0
- package/dist/runtime/daimon/training/booted/index.js.map +1 -0
- package/dist/runtime/daimon/training/booted/judge.d.ts +39 -0
- package/dist/runtime/daimon/training/booted/judge.js +122 -0
- package/dist/runtime/daimon/training/booted/judge.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/wakeMoments.js +0 -1
- package/dist/runtime/install.js +0 -21
- package/dist/runtime/registry.js +0 -2
- package/dist/runtime/trainingGraderProviders.js +10 -4
- package/dist/runtime/trainingProviders.d.ts +5 -3
- package/dist/runtime/trainingProviders.js +21 -24
- 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/runtime/usageRequestLedger.d.ts +2 -0
- package/dist/runtime/usageRequestLedger.js +3 -1
- package/dist/shared/errors.js +0 -1
- package/dist/shared/trainingLegacy/trainingLegacyHashDomains.d.ts +1 -0
- package/dist/shared/trainingLegacy/trainingLegacyHashDomains.js +1 -0
- package/dist/shared/trainingLegacy/trainingLegacyHashDomains.js.map +1 -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.d.ts +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/index.js +0 -2
- package/dist/runtime/codex-exec/training/providers/codex-subscription/index.js.map +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/protocol.d.ts +0 -17
- package/dist/runtime/codex-exec/training/providers/codex-subscription/protocol.js +0 -80
- package/dist/runtime/codex-exec/training/providers/codex-subscription/protocol.js.map +0 -1
- package/dist/runtime/codex-exec/training/providers/codex-subscription/provider.d.ts +0 -12
- package/dist/runtime/codex-exec/training/providers/codex-subscription/provider.js +0 -125
- 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.d.ts +0 -6
- package/dist/runtime/codex-exec/training/providers/codex-subscription/strict-schema.js +0 -219
- 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/providers/grok-subscription/cli.d.ts +0 -21
- package/dist/runtime/daimon/training/providers/grok-subscription/cli.js +0 -81
- package/dist/runtime/daimon/training/providers/grok-subscription/cli.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/index.d.ts +0 -4
- package/dist/runtime/daimon/training/providers/grok-subscription/index.js +0 -5
- package/dist/runtime/daimon/training/providers/grok-subscription/index.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/protocol.d.ts +0 -26
- package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js +0 -102
- package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js.map +0 -1
- package/dist/runtime/daimon/training/providers/grok-subscription/provider.d.ts +0 -9
- package/dist/runtime/daimon/training/providers/grok-subscription/provider.js +0 -38
- package/dist/runtime/daimon/training/providers/grok-subscription/provider.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
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { matchTransportSource } from './source.js';
|
|
2
|
-
/** Trial admission is separate from Daimon's schema and acceptance responses. */
|
|
3
|
-
export class TransportAdmissionClosedError extends Error {
|
|
4
|
-
constructor() { super('transport_admission_sealed'); }
|
|
5
|
-
}
|
|
6
|
-
/** Only the HTTP route calls accept. run() arms and observes this mailbox. */
|
|
7
|
-
export function createTransportDelivery(host, agentId) {
|
|
8
|
-
let armed;
|
|
9
|
-
let sealed = true;
|
|
10
|
-
const seen = new Set();
|
|
11
|
-
const admittedIdentities = new Set();
|
|
12
|
-
const agentAcceptances = new Map();
|
|
13
|
-
const arrivals = new Map();
|
|
14
|
-
const envelopes = new Map();
|
|
15
|
-
const selected = new Map();
|
|
16
|
-
const batches = new Map();
|
|
17
|
-
const select = (id) => {
|
|
18
|
-
if (!selected.has(id))
|
|
19
|
-
selected.set(id, { executionIds: new Set() });
|
|
20
|
-
return selected.get(id);
|
|
21
|
-
};
|
|
22
|
-
const snapshot = (evidence) => {
|
|
23
|
-
evidence.deliveries = [...selected.keys()].flatMap(id => envelopes.has(id) ? [structuredClone(envelopes.get(id))] : []);
|
|
24
|
-
evidence.selectedDeliveries = [...selected].map(([deliveryId, row]) => ({ deliveryId,
|
|
25
|
-
executionIds: [...row.executionIds], ...(row.receipt ? { receipt: structuredClone(row.receipt) } : {}) }));
|
|
26
|
-
evidence.batches = structuredClone([...batches.values()]);
|
|
27
|
-
evidence.deferredDeliveryIds = [...selected].filter(([, row]) => row.receipt?.state === 'accepted' && row.receipt.deferred === true).map(([id]) => id);
|
|
28
|
-
evidence.unresolvedDeliveryIds = [...selected].filter(([, row]) => row.receipt?.state !== 'completed').map(([id]) => id);
|
|
29
|
-
};
|
|
30
|
-
const bind = (queue) => {
|
|
31
|
-
if (queue.decided)
|
|
32
|
-
return;
|
|
33
|
-
while (queue.attempts[0]?.outcome === 'refused')
|
|
34
|
-
queue.attempts.shift();
|
|
35
|
-
const first = queue.attempts[0];
|
|
36
|
-
if (!first?.outcome)
|
|
37
|
-
return;
|
|
38
|
-
const result = first.outcome;
|
|
39
|
-
queue.decided = true;
|
|
40
|
-
const { run: current, request } = first;
|
|
41
|
-
const fresh = !seen.has(result.acceptance_id);
|
|
42
|
-
seen.add(result.acceptance_id);
|
|
43
|
-
if (fresh && current && current === armed && request.agent_id === agentId && result.agent_id === agentId &&
|
|
44
|
-
result.delivery_id === request.delivery_id && matchTransportSource(current.evidence.source, request.delivery_id)) {
|
|
45
|
-
// Every matching acceptance is trial work, even if queued behind this batch.
|
|
46
|
-
select(request.delivery_id);
|
|
47
|
-
if (!current.first) {
|
|
48
|
-
current.first = result;
|
|
49
|
-
current.evidence.deliveryId = request.delivery_id;
|
|
50
|
-
current.evidence.acceptanceId = result.acceptance_id;
|
|
51
|
-
current.resolve(result);
|
|
52
|
-
}
|
|
53
|
-
snapshot(current.evidence);
|
|
54
|
-
}
|
|
55
|
-
queue.attempts.length = 0;
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
state() {
|
|
59
|
-
return armed ? { state: armed.first ? 'observing' : 'waiting', wakeId: armed.wakeId, source: armed.evidence.source } : { state: 'idle' };
|
|
60
|
-
},
|
|
61
|
-
begin(wakeId, source) {
|
|
62
|
-
let resolve;
|
|
63
|
-
const accepted = new Promise(done => { resolve = done; });
|
|
64
|
-
const evidence = { source, deliveries: [], deferredDeliveryIds: [], unresolvedDeliveryIds: [], renderedAllowances: 'unavailable-public-api' };
|
|
65
|
-
const current = { wakeId, evidence, resolve, generation: 0, pending: 0 };
|
|
66
|
-
let observed = [];
|
|
67
|
-
let nativePending;
|
|
68
|
-
let nativeDeferred;
|
|
69
|
-
const disposed = (row) => ['completed', 'failed', 'stopped'].includes(row.state) ||
|
|
70
|
-
row.state === 'accepted' && row.deferred === true && selected.has(row.delivery_id);
|
|
71
|
-
const closed = (traces) => {
|
|
72
|
-
// Daimon includes accepted deferrals in pending. The selection map counts
|
|
73
|
-
// delivery identities once, even when receipt and activity both name them.
|
|
74
|
-
const deferred = [...selected.values()].filter(row => row.receipt?.state === 'accepted' && row.receipt.deferred === true).length;
|
|
75
|
-
return nativePending === deferred && (nativeDeferred ?? 0) === deferred && observed.every(disposed) &&
|
|
76
|
-
[...agentAcceptances].every(([id, acceptance]) => observed.some(row => row.delivery_id === id && row.acceptance_id === acceptance && disposed(row))) &&
|
|
77
|
-
[...selected.values()].every(row => row.receipt && disposed(row.receipt) &&
|
|
78
|
-
[...row.executionIds].every(id => traces.some(trace => trace.turn_id === id)));
|
|
79
|
-
};
|
|
80
|
-
armed = current;
|
|
81
|
-
return {
|
|
82
|
-
accepted, evidence, closed,
|
|
83
|
-
generation: () => current.generation,
|
|
84
|
-
/** Synchronous admission/sealing linearization point: no await may split it. */
|
|
85
|
-
seal(generation, traces) {
|
|
86
|
-
if (current !== armed || current.pending !== 0 || current.generation !== generation || !closed(traces))
|
|
87
|
-
return false;
|
|
88
|
-
armed = undefined;
|
|
89
|
-
sealed = true;
|
|
90
|
-
return true;
|
|
91
|
-
},
|
|
92
|
-
observe(receipt, activity, availability, executionId) {
|
|
93
|
-
observed = structuredClone([...activity.items, receipt].filter(row => row.agent_id === agentId));
|
|
94
|
-
nativePending = availability.agents.find(row => row.agent_id === agentId)?.pending;
|
|
95
|
-
nativeDeferred = availability.agents.find(row => row.agent_id === agentId)?.deferred;
|
|
96
|
-
for (const batch of activity.executions ?? []) {
|
|
97
|
-
if (batch.agent_id !== agentId || !batch.delivery_ids.some(id => selected.has(id)))
|
|
98
|
-
continue;
|
|
99
|
-
const primary = batch.delivery_ids.includes(evidence.deliveryId);
|
|
100
|
-
if (primary && executionId !== undefined && batch.execution_id !== executionId)
|
|
101
|
-
throw new Error('Transport execution binding changed');
|
|
102
|
-
const previous = batches.get(batch.execution_id);
|
|
103
|
-
if (previous && JSON.stringify(previous.deliveryIds) !== JSON.stringify(batch.delivery_ids))
|
|
104
|
-
throw new Error('Transport batch membership changed');
|
|
105
|
-
const observedAt = new Date().toISOString();
|
|
106
|
-
// Read separately from active executions. This is current availability,
|
|
107
|
-
// not the snapshot a daimon_inbox tool call might return to the model.
|
|
108
|
-
const budget = availability.agents.find(row => row.agent_id === agentId)?.budget;
|
|
109
|
-
const allowances = budget === undefined ? undefined : { source: 'availability', observedAt, budget };
|
|
110
|
-
const observed = previous ?? { executionId: batch.execution_id, deliveryIds: [...batch.delivery_ids], observedAt, ...(allowances ? { allowances } : {}) };
|
|
111
|
-
batches.set(batch.execution_id, observed);
|
|
112
|
-
for (const id of batch.delivery_ids)
|
|
113
|
-
select(id).executionIds.add(batch.execution_id);
|
|
114
|
-
if (primary) {
|
|
115
|
-
evidence.batch = { executionId: observed.executionId, deliveryIds: [...observed.deliveryIds], observedAt: observed.observedAt };
|
|
116
|
-
evidence.allowances ??= allowances;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
for (const row of [...activity.items, receipt]) {
|
|
120
|
-
const selection = selected.get(row.delivery_id);
|
|
121
|
-
if (row.agent_id !== agentId || !selection)
|
|
122
|
-
continue;
|
|
123
|
-
const envelope = envelopes.get(row.delivery_id);
|
|
124
|
-
if (envelope && row.acceptance_id !== envelope.acceptanceId)
|
|
125
|
-
throw new Error('Transport receipt acceptance identity changed');
|
|
126
|
-
selection.receipt = structuredClone(row);
|
|
127
|
-
if (row.execution_id !== undefined)
|
|
128
|
-
selection.executionIds.add(row.execution_id);
|
|
129
|
-
}
|
|
130
|
-
snapshot(evidence);
|
|
131
|
-
},
|
|
132
|
-
finish() { if (armed === current) {
|
|
133
|
-
armed = undefined;
|
|
134
|
-
sealed = true;
|
|
135
|
-
} },
|
|
136
|
-
};
|
|
137
|
-
},
|
|
138
|
-
async accept(value) {
|
|
139
|
-
// Capture the arm before awaiting fsync. A request begun before this run
|
|
140
|
-
// cannot bind merely because its acceptance completed after arming.
|
|
141
|
-
// Only observe identity here. Daimon's host owns parsing and structured
|
|
142
|
-
// schema rejection, including non-object JSON values.
|
|
143
|
-
const request = value;
|
|
144
|
-
const identity = JSON.stringify([request?.agent_id, request?.delivery_id]);
|
|
145
|
-
// Once a run seals, only real native idempotency keys can pass until the
|
|
146
|
-
// next arm. A publisher still in flight must see refusal, not start work
|
|
147
|
-
// that the already-sealed terminal frame can never account for.
|
|
148
|
-
if (!armed && sealed && !admittedIdentities.has(identity))
|
|
149
|
-
throw new TransportAdmissionClosedError();
|
|
150
|
-
const current = armed;
|
|
151
|
-
if (current) {
|
|
152
|
-
current.generation++;
|
|
153
|
-
current.pending++;
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
if (!request || typeof request.agent_id !== 'string' || typeof request.delivery_id !== 'string')
|
|
157
|
-
return await host.accept(value);
|
|
158
|
-
const arrival = { run: armed, request };
|
|
159
|
-
const queue = arrivals.get(identity) ?? { attempts: [], decided: false };
|
|
160
|
-
arrivals.set(identity, queue);
|
|
161
|
-
if (!queue.decided)
|
|
162
|
-
queue.attempts.push(arrival);
|
|
163
|
-
let result;
|
|
164
|
-
try {
|
|
165
|
-
result = await host.accept(value);
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
arrival.outcome = 'refused';
|
|
169
|
-
bind(queue);
|
|
170
|
-
throw error;
|
|
171
|
-
}
|
|
172
|
-
if (result.state !== 'accepted') {
|
|
173
|
-
arrival.outcome = 'refused';
|
|
174
|
-
bind(queue);
|
|
175
|
-
return result;
|
|
176
|
-
}
|
|
177
|
-
if (result.agent_id === request.agent_id && result.delivery_id === request.delivery_id)
|
|
178
|
-
admittedIdentities.add(identity);
|
|
179
|
-
if (request.agent_id === agentId && result.agent_id === agentId && result.delivery_id === request.delivery_id && !envelopes.has(request.delivery_id)) {
|
|
180
|
-
envelopes.set(request.delivery_id, { acceptanceId: result.acceptance_id, deliveryId: request.delivery_id, event: structuredClone(request.event) });
|
|
181
|
-
}
|
|
182
|
-
if (current && result.agent_id === agentId && result.delivery_id === request.delivery_id) {
|
|
183
|
-
agentAcceptances.set(request.delivery_id, result.acceptance_id);
|
|
184
|
-
}
|
|
185
|
-
arrival.outcome = result;
|
|
186
|
-
bind(queue);
|
|
187
|
-
return result;
|
|
188
|
-
}
|
|
189
|
-
finally {
|
|
190
|
-
if (current) {
|
|
191
|
-
current.pending--;
|
|
192
|
-
current.generation++;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../../../../../src/runtime/daimon/training/native/worker/wake-delivery/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcnD,iFAAiF;AACjF,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD,gBAAgB,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC;CACvD;AAED,8EAA8E;AAC9E,MAAM,UAAU,uBAAuB,CAAC,IAAgB,EAAE,OAAe;IACvE,IAAI,KAA2B,CAAC;IAChC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC7C,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;IACrD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAm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EAAE,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACrJ,CAAC;gBACD,IAAI,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC;oBACzF,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;gBAClE,CAAC;gBACD,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;gBAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtC,OAAO,MAAM,CAAC;YAChB,CAAC;oBAAS,CAAC;gBAAC,IAAI,OAAO,EAAE,CAAC;oBAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBAAC,OAAO,CAAC,UAAU,EAAE,CAAC;gBAAC,CAAC;YAAC,CAAC;QACzE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { NativeReceipt } from '../types.js';
|
|
2
|
-
export type TransportDeliverySource = {
|
|
3
|
-
kind: 'transport';
|
|
4
|
-
deliveryId: string;
|
|
5
|
-
deliveryIdPrefix?: never;
|
|
6
|
-
} | {
|
|
7
|
-
kind: 'transport';
|
|
8
|
-
deliveryIdPrefix: string;
|
|
9
|
-
deliveryId?: never;
|
|
10
|
-
};
|
|
11
|
-
export interface NativeWakeRequest {
|
|
12
|
-
token?: string;
|
|
13
|
-
agent_id: string;
|
|
14
|
-
delivery_id: string;
|
|
15
|
-
event: {
|
|
16
|
-
version: 'noopolis.daimon.wake.v2';
|
|
17
|
-
kind: 'manual' | 'message' | 'schedule' | 'external';
|
|
18
|
-
text: string;
|
|
19
|
-
occurred_at: string;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export interface NativeAcceptance {
|
|
23
|
-
state: 'accepted';
|
|
24
|
-
acceptance_id: string;
|
|
25
|
-
version?: string;
|
|
26
|
-
agent_id?: string;
|
|
27
|
-
delivery_id?: string;
|
|
28
|
-
request_digest?: string;
|
|
29
|
-
accepted_at?: string;
|
|
30
|
-
}
|
|
31
|
-
export type NativeAcceptanceResult = NativeAcceptance | {
|
|
32
|
-
state: 'rejected' | 'stopped';
|
|
33
|
-
code: string;
|
|
34
|
-
version?: string;
|
|
35
|
-
blocked?: {
|
|
36
|
-
version: string;
|
|
37
|
-
reason: string;
|
|
38
|
-
retry_after_ms: number;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export interface TransportEvidence {
|
|
42
|
-
source: TransportDeliverySource;
|
|
43
|
-
deliveryId?: string;
|
|
44
|
-
acceptanceId?: string;
|
|
45
|
-
/** Verbatim producer metadata; no token and no second task-clock projection. */
|
|
46
|
-
deliveries: {
|
|
47
|
-
acceptanceId: string;
|
|
48
|
-
deliveryId: string;
|
|
49
|
-
event: NativeWakeRequest['event'];
|
|
50
|
-
}[];
|
|
51
|
-
/** Complete only when the public active execution projection was observed. */
|
|
52
|
-
batch?: {
|
|
53
|
-
executionId: string;
|
|
54
|
-
deliveryIds: string[];
|
|
55
|
-
observedAt: string;
|
|
56
|
-
};
|
|
57
|
-
/** Every selected delivery, including peers without a route-observed envelope. */
|
|
58
|
-
selectedDeliveries?: {
|
|
59
|
-
deliveryId: string;
|
|
60
|
-
executionIds: string[];
|
|
61
|
-
receipt?: NativeReceipt;
|
|
62
|
-
}[];
|
|
63
|
-
/** All observed executions of selected deliveries, including deferred revisits. */
|
|
64
|
-
batches?: {
|
|
65
|
-
executionId: string;
|
|
66
|
-
deliveryIds: string[];
|
|
67
|
-
observedAt: string;
|
|
68
|
-
allowances?: {
|
|
69
|
-
source: 'availability';
|
|
70
|
-
observedAt: string;
|
|
71
|
-
budget: unknown;
|
|
72
|
-
};
|
|
73
|
-
}[];
|
|
74
|
-
deferredDeliveryIds: string[];
|
|
75
|
-
/** Selected across this trial's wakes; later input cannot erase unfinished work. */
|
|
76
|
-
unresolvedDeliveryIds: string[];
|
|
77
|
-
/** A current control observation, never claimed to be the model's rendered snapshot. */
|
|
78
|
-
allowances?: {
|
|
79
|
-
source: 'availability';
|
|
80
|
-
observedAt: string;
|
|
81
|
-
budget: unknown;
|
|
82
|
-
};
|
|
83
|
-
renderedAllowances: 'unavailable-public-api';
|
|
84
|
-
}
|
|
85
|
-
export type TransportRunState = {
|
|
86
|
-
state: 'idle';
|
|
87
|
-
} | {
|
|
88
|
-
state: 'waiting' | 'observing';
|
|
89
|
-
wakeId: string;
|
|
90
|
-
source: TransportDeliverySource;
|
|
91
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/runtime/daimon/training/native/worker/wake-delivery/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function runDaimonNativeWorker(args: readonly string[]): Promise<void>;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { readdir } from 'node:fs/promises';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { createWorkerController } from './control.js';
|
|
4
|
-
import { MAX_TRIAL_WAKES, engineWakeTimeoutMs } from './deliveries.js';
|
|
5
|
-
import { assertFreshNativeEvidence } from './evidence/index.js';
|
|
6
|
-
import { assertNativeProfile, verifyNativeWorkerStartup, verifyWorkerPaths } from './profile.js';
|
|
7
|
-
import { configureNativeTaskClock, isGrokLaunch, nativeCodexAccount, nativeTrialArtifactsRoot, readPrivateFile } from '../receipt/index.js';
|
|
8
|
-
import { loadDaimonRuntime } from './public.js';
|
|
9
|
-
import { createWorkerServer, listenWorker } from './server.js';
|
|
10
|
-
import { persistNativeSandboxProjection } from './sandbox.js';
|
|
11
|
-
export async function runDaimonNativeWorker(args) {
|
|
12
|
-
if (process.platform !== 'linux')
|
|
13
|
-
throw new Error('Canonical attention acceptance requires a Linux container');
|
|
14
|
-
// The same validation preparation can run through the public `verifyNativeWorkerStartup`.
|
|
15
|
-
const { options, launch } = await verifyNativeWorkerStartup(args);
|
|
16
|
-
const bytes = await readPrivateFile(options.config);
|
|
17
|
-
const runtime = await loadDaimonRuntime(launch.agent.engine, launch.delivery);
|
|
18
|
-
const grok = isGrokLaunch(launch) ? launch : undefined;
|
|
19
|
-
const { createOrganizationRuntimeControlHost, parseOrganizationRuntimeConfig } = runtime;
|
|
20
|
-
// Re-checked against Daimon's own parsed config, which may normalize what the raw bytes declared.
|
|
21
|
-
const config = parseOrganizationRuntimeConfig(JSON.parse(bytes));
|
|
22
|
-
assertNativeProfile(config, launch);
|
|
23
|
-
await verifyWorkerPaths(config, options, launch);
|
|
24
|
-
// Codex: the control root itself. Grok: this trial's own directory inside the container's fixed slot control root,
|
|
25
|
-
// which also holds Daimon's store and the previous trials' artifacts and can therefore never be empty.
|
|
26
|
-
const artifacts = nativeTrialArtifactsRoot(launch, options.trialId);
|
|
27
|
-
if ((await readdir(artifacts)).length)
|
|
28
|
-
throw new Error('Native control root must be empty before startup');
|
|
29
|
-
const token = (await readPrivateFile(options.tokenFile, 4096)).trim();
|
|
30
|
-
if (token.length < 24 || /\s/u.test(token))
|
|
31
|
-
throw new Error('Invalid isolated control token');
|
|
32
|
-
// Codex meters in this process; the Grok broker is the single sealed writer of its per-slot ledger.
|
|
33
|
-
const usageFile = grok ? grok.broker.usageLedgerPath : join(artifacts, 'usage.jsonl');
|
|
34
|
-
const requestsFile = grok ? join(dirname(usageFile), 'requests.jsonl') : join(artifacts, 'requests.jsonl');
|
|
35
|
-
await assertFreshNativeEvidence(config.agents[0].runtimeHomePath, usageFile, config.agents[0].id, launch.agent.model, grok ? { engine: 'grok', requestsFile } : { engine: 'codex' });
|
|
36
|
-
process.env[config.host.controlTokenEnv] = token;
|
|
37
|
-
process.env.NOOPOLIS_RUN_ID = options.trialId;
|
|
38
|
-
process.env.DAIMON_RUNTIME_ACCEPTANCE_STORE = artifacts;
|
|
39
|
-
process.env.DAIMON_TURN_USAGE_LEDGER_PATH = usageFile;
|
|
40
|
-
process.env.DAIMON_TURN_REQUESTS_LEDGER_PATH = requestsFile;
|
|
41
|
-
process.env.DAIMON_WAKE_FUSE_DIRECTORY = artifacts;
|
|
42
|
-
process.env.DAIMON_WAKE_FUSE_EPOCH = options.trialId;
|
|
43
|
-
// This owned worker has one verified launch; never inherit another slot's routing.
|
|
44
|
-
if (grok)
|
|
45
|
-
process.env.DAIMON_ENGINE_BROKER_SLOT = String(grok.broker.slot);
|
|
46
|
-
else
|
|
47
|
-
delete process.env.DAIMON_ENGINE_BROKER_SLOT;
|
|
48
|
-
// Derived, never a second number: a trial must be able to execute every
|
|
49
|
-
// continuation its own delivery gate will admit. One hard-coded wake here
|
|
50
|
-
// accepted a continuation the runtime then refused to run at all.
|
|
51
|
-
process.env.DAIMON_WAKE_FUSE_MAX_WAKES = String(MAX_TRIAL_WAKES);
|
|
52
|
-
process.env.DAIMON_WAKE_FUSE_MAX_TOKENS = String(launch.limits.maxTokens);
|
|
53
|
-
delete process.env.DAIMON_WAKE_FUSE;
|
|
54
|
-
// Engine-neutral names; the Codex aliases stay equal so older Codex runtimes keep their bound and Daimon never sees a conflict.
|
|
55
|
-
// Broker turn overrides may only lower the registered limits; the trial deadline still spans all wakes.
|
|
56
|
-
process.env.DAIMON_ENGINE_WAKE_TIMEOUT_MS = String(engineWakeTimeoutMs(options.timeoutMs, launch));
|
|
57
|
-
process.env.DAIMON_ENGINE_WAKE_TOKEN_CEILING = String(grok ? Math.min(launch.limits.wakeTokenCeiling, grok.broker.limits.maxTokens) : launch.limits.wakeTokenCeiling);
|
|
58
|
-
process.env.DAIMON_CODEX_WAKE_TIMEOUT_MS = process.env.DAIMON_ENGINE_WAKE_TIMEOUT_MS;
|
|
59
|
-
process.env.DAIMON_CODEX_WAKE_TOKEN_CEILING = process.env.DAIMON_ENGINE_WAKE_TOKEN_CEILING;
|
|
60
|
-
// Set only after this worker is running. Daimon consumes the loader path for
|
|
61
|
-
// child gates and strips it from engines; this process is never preloaded.
|
|
62
|
-
const taskClock = configureNativeTaskClock(launch.taskClock, options.timeoutMs);
|
|
63
|
-
const account = nativeCodexAccount(launch);
|
|
64
|
-
const host = createOrganizationRuntimeControlHost(config, { acceptanceStorePath: artifacts, controlToken: token,
|
|
65
|
-
...(account ? { subscriptionRealmPaths: { codex: { durablePath: account.realm.target, bootstrapPath: account.bootstrap.target } } } : {}) });
|
|
66
|
-
const controller = createWorkerController(host, config, options, token, launch, taskClock);
|
|
67
|
-
const server = createWorkerServer(controller, token);
|
|
68
|
-
try {
|
|
69
|
-
await host.start();
|
|
70
|
-
const health = await host.health();
|
|
71
|
-
const activity = await host.activityV2(token);
|
|
72
|
-
if (health.state !== 'running' || !activity || !Array.isArray(activity.executions) || activity.executions.length || activity.items.length) {
|
|
73
|
-
throw new Error('Native host did not start as a fresh idle runtime');
|
|
74
|
-
}
|
|
75
|
-
await persistNativeSandboxProjection(runtime, config, options, launch);
|
|
76
|
-
await listenWorker(server, config.host.bindHost, config.host.port);
|
|
77
|
-
process.stdout.write(`${JSON.stringify({ schema: 'spawnfile.training.daimon-native.ready.v1', trialId: options.trialId,
|
|
78
|
-
agentId: config.agents[0].id, model: config.agents[0].engine.model,
|
|
79
|
-
...(grok ? { engine: 'grok', reasoningEffort: config.agents[0].engine.reasoningEffort } : {}), configSha256: options.configSha256,
|
|
80
|
-
...(taskClock ? { taskClock } : {}), ...(launch.delivery === 'transport' ? { delivery: 'transport' } : {}),
|
|
81
|
-
port: config.host.port, nativeHealth: health, nativeActivity: activity })}\n`);
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
await controller.stop();
|
|
85
|
-
server.closeAllConnections();
|
|
86
|
-
server.close();
|
|
87
|
-
throw error;
|
|
88
|
-
}
|
|
89
|
-
let shuttingDown = false;
|
|
90
|
-
const shutdown = () => {
|
|
91
|
-
if (shuttingDown)
|
|
92
|
-
return;
|
|
93
|
-
shuttingDown = true;
|
|
94
|
-
void controller.stop().then(receipt => {
|
|
95
|
-
process.stdout.write(`${JSON.stringify(receipt)}\n`);
|
|
96
|
-
server.closeAllConnections();
|
|
97
|
-
server.close();
|
|
98
|
-
if (receipt.state !== 'acknowledged')
|
|
99
|
-
process.exitCode = 1;
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
process.once('SIGTERM', shutdown);
|
|
103
|
-
process.once('SIGINT', shutdown);
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/worker/worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC5I,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAAuB;IACjE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/G,0FAA0F;IAC1F,MAAM,EAAE,OAAO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AAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type GrokGrantPurpose, type GrokGrantReasoningEffort } from './grants.js';
|
|
2
|
-
import type { InferenceProvider } from '../../../../../training/index.js';
|
|
3
|
-
import type { runProcess } from '../../../../../training/index.js';
|
|
4
|
-
import type { GrokGrantPool } from './grant-pool.js';
|
|
5
|
-
export interface GrokBrokerInferenceOptions {
|
|
6
|
-
pool: GrokGrantPool;
|
|
7
|
-
/** Container-provisioned evaluator root for private GROK_HOMEs; absent fails closed. */
|
|
8
|
-
homeRoot: string | undefined;
|
|
9
|
-
purpose: GrokGrantPurpose;
|
|
10
|
-
reasoningEffort: GrokGrantReasoningEffort;
|
|
11
|
-
command?: string;
|
|
12
|
-
timeoutMs?: number;
|
|
13
|
-
process?: typeof runProcess;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Grok judge/optimizer inference through a Daimon broker inference grant. Never
|
|
17
|
-
* uses a desktop login: every failure to reach the broker, verify the client pin
|
|
18
|
-
* or provision the private home is a failure, not a fallback.
|
|
19
|
-
*/
|
|
20
|
-
export declare function createGrokBrokerInference(options: GrokBrokerInferenceOptions): InferenceProvider;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { grokGrantModels, grokGrantPurposes, grokGrantReasoningEfforts } from './grants.js';
|
|
2
|
-
import { InferenceFailure } from '../../../../../training/index.js';
|
|
3
|
-
import { validateInferenceSchema } from '../../../../../training/index.js';
|
|
4
|
-
import { runGrokCli } from '../grok-subscription/index.js';
|
|
5
|
-
import { prepareGrokGrantCall } from './grant-home.js';
|
|
6
|
-
/**
|
|
7
|
-
* Grok judge/optimizer inference through a Daimon broker inference grant. Never
|
|
8
|
-
* uses a desktop login: every failure to reach the broker, verify the client pin
|
|
9
|
-
* or provision the private home is a failure, not a fallback.
|
|
10
|
-
*/
|
|
11
|
-
export function createGrokBrokerInference(options) {
|
|
12
|
-
const { pool } = options;
|
|
13
|
-
return {
|
|
14
|
-
id: 'grok-broker-grant',
|
|
15
|
-
capabilities: { tools: 'disabled', billing: 'subscription', temperature: false, seed: false, credentialAuthority: `grok-broker-grant:${pool.id}` },
|
|
16
|
-
async generate(request) {
|
|
17
|
-
validateInferenceSchema(request.responseSchema);
|
|
18
|
-
const responseSchema = request.responseSchema === undefined ? undefined : structuredClone(request.responseSchema);
|
|
19
|
-
if (!grokGrantReasoningEfforts.includes(options.reasoningEffort) || !grokGrantPurposes.includes(options.purpose)) {
|
|
20
|
-
throw new InferenceFailure('unsupported', 'Invalid Grok broker-grant controls');
|
|
21
|
-
}
|
|
22
|
-
if (!request.prompt.trim() || !grokGrantModels.includes(request.model) ||
|
|
23
|
-
request.temperature !== undefined || request.seed !== undefined)
|
|
24
|
-
throw new InferenceFailure('unsupported', 'Invalid Grok broker-grant inference controls');
|
|
25
|
-
if (options.homeRoot === undefined)
|
|
26
|
-
throw new InferenceFailure('unsupported', 'Grok broker-grant inference requires a provisioned private home root');
|
|
27
|
-
if (request.signal?.aborted)
|
|
28
|
-
throw new InferenceFailure('cancelled', 'Grok cancelled before launch');
|
|
29
|
-
const timeoutMs = options.timeoutMs ?? 180_000;
|
|
30
|
-
const lease = await pool.acquire({ model: request.model, reasoningEffort: options.reasoningEffort, purpose: options.purpose }, timeoutMs, request.signal);
|
|
31
|
-
let result;
|
|
32
|
-
try {
|
|
33
|
-
const call = await prepareGrokGrantCall(options.homeRoot, lease.authority, lease.grant, request.prompt);
|
|
34
|
-
try {
|
|
35
|
-
result = await runGrokCli({ command: options.command ?? 'grok', cwd: call.work, promptFile: call.promptFile, env: call.env,
|
|
36
|
-
timeoutMs: lease.callTimeoutMs, cliModel: lease.authority.clientModelId, reasoningEffort: options.reasoningEffort, request, responseSchema,
|
|
37
|
-
mode: { auth: 'broker-grant', clientModelId: lease.authority.clientModelId, grantModel: lease.grant.model }, process: options.process });
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
await call.cleanup();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
finally {
|
|
45
|
-
await lease.settle(result === undefined ? { ok: false } : { ok: true, tokens: spent(result.usage) });
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function spent(usage) {
|
|
51
|
-
if (usage === null || usage.inputTokens === null || usage.outputTokens === null)
|
|
52
|
-
return null;
|
|
53
|
-
return usage.inputTokens + usage.outputTokens;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=broker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"broker.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/providers/grok-broker/broker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,yBAAyB,EACrC,MAAM,aAAa,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAcvD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAmC;IAC3E,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,OAAO;QACL,EAAE,EAAE,mBAAmB;QACvB,YAAY,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,IAAI,CAAC,EAAE,EAAE,EAAE;QAClJ,KAAK,CAAC,QAAQ,CAAC,OAAO;YACpB,uBAAuB,CAAC,OAAO,CAAC,c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,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC;AAChD,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { GrokGrantRefusal, type GrokInferenceGrantAuthority } from './grants.js';
|
|
2
|
-
/** Test-only broker double: deterministic grants, recorded requests/releases, and a pin over its own rendered bytes. */
|
|
3
|
-
export declare function fakeGrantAuthority(patch?: Partial<GrokInferenceGrantAuthority> & {
|
|
4
|
-
ttlMs?: number;
|
|
5
|
-
now?: () => number;
|
|
6
|
-
refusals?: GrokGrantRefusal[];
|
|
7
|
-
}): {
|
|
8
|
-
authority: GrokInferenceGrantAuthority;
|
|
9
|
-
requests: {
|
|
10
|
-
model: import("./grants.js").GrokGrantModel;
|
|
11
|
-
reasoningEffort: import("./grants.js").GrokGrantReasoningEffort;
|
|
12
|
-
purpose: import("./grants.js").GrokGrantPurpose;
|
|
13
|
-
}[];
|
|
14
|
-
releases: string[];
|
|
15
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
/** Test-only broker double: deterministic grants, recorded requests/releases, and a pin over its own rendered bytes. */
|
|
3
|
-
export function fakeGrantAuthority(patch = {}) {
|
|
4
|
-
let next = 0;
|
|
5
|
-
const requests = [];
|
|
6
|
-
const releases = [];
|
|
7
|
-
const render = (input) => `[model.daimon-inference-grok]\nmodel = "${input.model}"\nbase_url = "${input.baseUrl}"\nenv_key = "${input.envKey}"\nreasoning = "${input.reasoningEffort}"\n`;
|
|
8
|
-
const authority = {
|
|
9
|
-
clientModelId: 'daimon-inference-grok', envKey: 'DAIMON_INFERENCE_GRANT', maxLiveGrants: 8,
|
|
10
|
-
async request(input) {
|
|
11
|
-
requests.push(input);
|
|
12
|
-
const refusal = patch.refusals?.shift();
|
|
13
|
-
if (refusal)
|
|
14
|
-
throw refusal;
|
|
15
|
-
next++;
|
|
16
|
-
const grant = { grantId: next.toString(16).padStart(32, '0'), token: `inference_${'T'.repeat(40)}${String(next).padStart(3, '0')}`,
|
|
17
|
-
baseUrl: 'http://127.0.0.1:43123/v1', ...input, expiresAt: new Date((patch.now ?? Date.now)() + (patch.ttlMs ?? 600_000)).toISOString(),
|
|
18
|
-
limits: { maxRequests: 64, maxTokens: 2_000_000, timeoutMs: 600_000 } };
|
|
19
|
-
return grant;
|
|
20
|
-
},
|
|
21
|
-
async release(grantId) { releases.push(grantId); return true; },
|
|
22
|
-
renderClientConfig: render,
|
|
23
|
-
// Pinned over this authority's own declared env key, so an unexpected key fails the key rule, not the pin.
|
|
24
|
-
pinnedClientConfigSha256: (model, reasoningEffort) => createHash('sha256').update(render({ baseUrl: 'http://127.0.0.1:43123/v1', model, reasoningEffort, envKey: patch.envKey ?? 'DAIMON_INFERENCE_GRANT' })).digest('hex'),
|
|
25
|
-
...patch,
|
|
26
|
-
};
|
|
27
|
-
return { authority, requests, releases };
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=grant-fixtures.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grant-fixtures.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/providers/grok-broker/grant-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,wHAAwH;AACxH,MAAM,UAAU,kBAAkB,CAAC,QAAsH,EAAE;IACzJ,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,QAAQ,GAA4D,EAAE,CAAC;IAC7E,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,CAAC,KAAuE,EAAE,EAAE,CACzF,2CAA2C,KAAK,CAAC,KAAK,kBAAkB,KAAK,CAAC,OAAO,iBAAiB,KAAK,CAAC,MAAM,mBAAmB,KAAK,CAAC,eAAe,KAAK,CAAC;IAClK,MAAM,SAAS,GAAgC;QAC7C,aAAa,EAAE,uBAAuB,EAAE,MAAM,EAAE,wBAAwB,EAAE,aAAa,EAAE,CAAC;Q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AE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QACnP,GAAG,KAAK;KACT,CAAC;IACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type GrokInferenceGrant, type GrokInferenceGrantAuthority } from './grants.js';
|
|
2
|
-
export interface GrokGrantCall {
|
|
3
|
-
/** Disposable workspace: cwd, HOME and TMPDIR of the CLI. */
|
|
4
|
-
work: string;
|
|
5
|
-
promptFile: string;
|
|
6
|
-
/** Complete child environment. The grant token exists only here. */
|
|
7
|
-
env: NodeJS.ProcessEnv;
|
|
8
|
-
cleanup(): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A private per-call GROK_HOME (0700, owned by this uid) under a caller-provisioned
|
|
12
|
-
* evaluator root, holding exactly the client config bytes whose sha256 equals the
|
|
13
|
-
* independent pin. Nothing from the ambient HOME, GROK_HOME or API-key variables
|
|
14
|
-
* reaches the child, so a desktop login can never be used instead of the grant.
|
|
15
|
-
*/
|
|
16
|
-
export declare function prepareGrokGrantCall(root: string, authority: GrokInferenceGrantAuthority, grant: GrokInferenceGrant, prompt: string): Promise<GrokGrantCall>;
|