spawnfile 0.1.33 → 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.
Files changed (585) hide show
  1. package/README.md +1 -1
  2. package/dist/auth/trainingAuth.d.ts +2 -5
  3. package/dist/cli/devCommands.d.ts +1 -1
  4. package/dist/cli/devCommands.js +0 -66
  5. package/dist/cli/runCli.d.ts +1 -4
  6. package/dist/cli/runCli.js +2 -2
  7. package/dist/cli/trainCommand.js +9 -15
  8. package/dist/cli/trainingBooted.d.ts +7 -0
  9. package/dist/cli/trainingBooted.js +41 -0
  10. package/dist/cli/trainingExecution.d.ts +4 -7
  11. package/dist/cli/trainingExecution.js +4 -32
  12. package/dist/compiler/containerArtifacts.js +0 -5
  13. package/dist/compiler/containerBackedMountRender.js +5 -1
  14. package/dist/compiler/containerDaimonBrokerRender.d.ts +5 -50
  15. package/dist/compiler/containerDaimonBrokerRender.js +7 -88
  16. package/dist/compiler/containerDaimonGatewayRender.d.ts +50 -0
  17. package/dist/compiler/containerDaimonGatewayRender.js +157 -0
  18. package/dist/compiler/containerDaimonGrokWorkerProvisioning.d.ts +2 -10
  19. package/dist/compiler/containerDaimonGrokWorkerProvisioning.js +13 -25
  20. package/dist/compiler/containerDaimonGrokWorkerRender.d.ts +11 -49
  21. package/dist/compiler/containerDaimonGrokWorkerRender.js +15 -39
  22. package/dist/compiler/containerDaimonStartupSupervision.d.ts +8 -0
  23. package/dist/compiler/containerDaimonStartupSupervision.js +39 -0
  24. package/dist/compiler/containerDaimonUidEntrypointRender.d.ts +1 -2
  25. package/dist/compiler/containerDaimonUidEntrypointRender.js +26 -46
  26. package/dist/compiler/containerRuntimeReadinessRender.js +1 -1
  27. package/dist/compiler/memoryArtifacts.js +0 -1
  28. package/dist/compiler/moltnetArtifacts.js +1 -17
  29. package/dist/compiler/moltnetClientConfig.js +1 -1
  30. package/dist/compiler/moltnetRuntimeConfig.js +0 -10
  31. package/dist/compiler/runProject.d.ts +1 -0
  32. package/dist/compiler/runProject.js +9 -3
  33. package/dist/compiler/runProjectAuth.js +2 -17
  34. package/dist/compiler/training/contract.d.ts +0 -2
  35. package/dist/compiler/training/contract.js +0 -2
  36. package/dist/compiler/training/execution.d.ts +1 -128
  37. package/dist/compiler/training/execution.js +7 -68
  38. package/dist/compiler/training/index.d.ts +0 -8
  39. package/dist/compiler/training/index.js +0 -7
  40. package/dist/compiler/training/output.d.ts +1 -0
  41. package/dist/compiler/training/output.js +1 -1
  42. package/dist/compiler/training/trial/boot.d.ts +53 -0
  43. package/dist/compiler/training/trial/boot.js +147 -0
  44. package/dist/compiler/training/trial/docker.d.ts +8 -0
  45. package/dist/compiler/training/trial/docker.js +22 -0
  46. package/dist/compiler/training/trial/gateway.d.ts +42 -0
  47. package/dist/compiler/training/trial/gateway.js +98 -0
  48. package/dist/compiler/training/trial/index.d.ts +4 -0
  49. package/dist/compiler/training/trial/index.js +4 -0
  50. package/dist/compiler/training/trial/launcher.d.ts +32 -0
  51. package/dist/compiler/training/trial/launcher.js +49 -0
  52. package/dist/compiler/training/trial/project.d.ts +11 -0
  53. package/dist/compiler/training/trial/project.js +31 -0
  54. package/dist/compiler/upReceipt.d.ts +2 -17
  55. package/dist/compiler/upReceipt.js +2 -17
  56. package/dist/deployment/artifactsExportPlan.js +2 -18
  57. package/dist/deployment/privateArtifactsExport.js +1 -1
  58. package/dist/dev/docker.d.ts +0 -5
  59. package/dist/dev/docker.js +0 -46
  60. package/dist/dev/index.d.ts +0 -1
  61. package/dist/dev/index.js +0 -1
  62. package/dist/dev/project.d.ts +0 -16
  63. package/dist/dev/project.js +1 -128
  64. package/dist/distribution/distributionReportSchema.js +1 -1
  65. package/dist/distribution/imageRuntimeAuth.js +3 -2
  66. package/dist/release/drainControl.d.ts +5 -19
  67. package/dist/release/drainControl.js +12 -67
  68. package/dist/report/types.d.ts +3 -6
  69. package/dist/runtime/common.d.ts +1 -1
  70. package/dist/runtime/common.js +1 -1
  71. package/dist/runtime/container.d.ts +2 -2
  72. package/dist/runtime/container.js +1 -39
  73. package/dist/runtime/daimon/config.js +6 -12
  74. package/dist/runtime/daimon/contractManifest.js +0 -1
  75. package/dist/runtime/daimon/contractManifestSchema.js +0 -1
  76. package/dist/runtime/daimon/control.d.ts +31 -0
  77. package/dist/runtime/daimon/control.js +83 -0
  78. package/dist/runtime/daimon/engineDescriptorSchema.js +0 -1
  79. package/dist/runtime/daimon/engineDescriptors.generated.d.ts +1 -1
  80. package/dist/runtime/daimon/engineDescriptors.generated.js +1 -2
  81. package/dist/runtime/daimon/engines.js +0 -1
  82. package/dist/runtime/daimon/gateway.d.ts +62 -0
  83. package/dist/runtime/daimon/gateway.js +77 -0
  84. package/dist/runtime/daimon/grokWorkerContract.d.ts +0 -5
  85. package/dist/runtime/daimon/grokWorkerContract.js +1 -13
  86. package/dist/runtime/daimon/index.d.ts +2 -0
  87. package/dist/runtime/daimon/index.js +2 -1
  88. package/dist/runtime/daimon/memory.js +1 -1
  89. package/dist/runtime/daimon/packageName.js +0 -1
  90. package/dist/runtime/daimon/runAuth.js +7 -4
  91. package/dist/runtime/daimon/runtimeIdentity.d.ts +2 -0
  92. package/dist/runtime/daimon/runtimeIdentity.js +2 -0
  93. package/dist/runtime/daimon/subscriptionRealms.d.ts +9 -3
  94. package/dist/runtime/daimon/subscriptionRealms.js +22 -13
  95. package/dist/runtime/daimon/testHelpers.d.ts +2 -0
  96. package/dist/runtime/{pi → daimon}/testHelpers.js +3 -3
  97. package/dist/runtime/daimon/training/booted/adapter.d.ts +46 -0
  98. package/dist/runtime/daimon/training/booted/adapter.js +59 -0
  99. package/dist/runtime/daimon/training/booted/adapter.js.map +1 -0
  100. package/dist/runtime/daimon/training/booted/index.d.ts +2 -0
  101. package/dist/runtime/daimon/training/booted/index.js +2 -0
  102. package/dist/runtime/daimon/training/booted/index.js.map +1 -0
  103. package/dist/runtime/daimon/training/index.d.ts +5 -0
  104. package/dist/runtime/daimon/training/index.js +8 -4
  105. package/dist/runtime/daimon/training/index.js.map +1 -1
  106. package/dist/runtime/daimon/training/providers/codex-subscription/index.js.map +1 -0
  107. package/dist/runtime/daimon/training/providers/codex-subscription/protocol.js.map +1 -0
  108. package/dist/runtime/daimon/training/providers/codex-subscription/provider.js.map +1 -0
  109. package/dist/runtime/daimon/training/providers/codex-subscription/strict-schema.js.map +1 -0
  110. package/dist/runtime/daimon/training/providers/grok-subscription/cli.d.ts +1 -3
  111. package/dist/runtime/daimon/training/providers/grok-subscription/cli.js +5 -5
  112. package/dist/runtime/daimon/training/providers/grok-subscription/cli.js.map +1 -1
  113. package/dist/runtime/daimon/training/providers/grok-subscription/index.d.ts +1 -2
  114. package/dist/runtime/daimon/training/providers/grok-subscription/index.js +0 -1
  115. package/dist/runtime/daimon/training/providers/grok-subscription/index.js.map +1 -1
  116. package/dist/runtime/daimon/training/providers/grok-subscription/protocol.d.ts +5 -17
  117. package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js +18 -31
  118. package/dist/runtime/daimon/training/providers/grok-subscription/protocol.js.map +1 -1
  119. package/dist/runtime/daimon/training/providers/grok-subscription/provider.js +1 -2
  120. package/dist/runtime/daimon/training/providers/grok-subscription/provider.js.map +1 -1
  121. package/dist/runtime/daimon/wakeMoments.js +0 -1
  122. package/dist/runtime/install.js +0 -21
  123. package/dist/runtime/registry.js +0 -2
  124. package/dist/runtime/trainingGraderProviders.js +1 -1
  125. package/dist/runtime/trainingProviders.d.ts +1 -2
  126. package/dist/runtime/trainingProviders.js +9 -19
  127. package/dist/runtime/trainingSubjects.d.ts +0 -121
  128. package/dist/runtime/trainingSubjects.js +2 -13
  129. package/dist/runtime/types.d.ts +1 -8
  130. package/dist/shared/errors.js +0 -1
  131. package/dist/status/lifecycleProbes.js +3 -6
  132. package/dist/status/moltnetWiringProbes.js +1 -17
  133. package/dist/training/subjects/index.d.ts +0 -1
  134. package/dist/training/subjects/index.js +0 -1
  135. package/dist/training/subjects/index.js.map +1 -1
  136. package/examples/README.md +0 -1
  137. package/examples/daimon-org/agents/mapper/Spawnfile +4 -1
  138. package/examples/daimon-org/teams/review/agents/reviewer/Spawnfile +4 -1
  139. package/examples/jungian-daimon-org/teams/luna/agents/animus/Spawnfile +5 -8
  140. package/examples/jungian-daimon-org/teams/luna/agents/representative/Spawnfile +1 -1
  141. package/examples/jungian-daimon-org/teams/luna/agents/shadow/Spawnfile +5 -8
  142. package/examples/jungian-daimon-org/teams/selene/agents/animus/Spawnfile +5 -8
  143. package/examples/jungian-daimon-org/teams/selene/agents/representative/Spawnfile +5 -8
  144. package/examples/jungian-daimon-org/teams/selene/agents/shadow/Spawnfile +1 -1
  145. package/examples/mixed-runtime-org/agents/localist/Spawnfile +7 -7
  146. package/package.json +4 -13
  147. package/runtimes.yaml +5 -15
  148. package/dist/compiler/containerDaimonGrokTaskClock.d.ts +0 -5
  149. package/dist/compiler/containerDaimonGrokTaskClock.js +0 -29
  150. package/dist/compiler/daimonTelemetryArtifacts.d.ts +0 -22
  151. package/dist/compiler/daimonTelemetryArtifacts.js +0 -56
  152. package/dist/compiler/training/broker/clockProbe.d.ts +0 -6
  153. package/dist/compiler/training/broker/clockProbe.js +0 -27
  154. package/dist/compiler/training/broker/declaration.d.ts +0 -54
  155. package/dist/compiler/training/broker/declaration.js +0 -70
  156. package/dist/compiler/training/broker/entrypoint.d.ts +0 -39
  157. package/dist/compiler/training/broker/entrypoint.js +0 -124
  158. package/dist/compiler/training/broker/evaluatorSecrets.d.ts +0 -2
  159. package/dist/compiler/training/broker/evaluatorSecrets.js +0 -62
  160. package/dist/compiler/training/broker/index.d.ts +0 -12
  161. package/dist/compiler/training/broker/index.js +0 -12
  162. package/dist/compiler/training/broker/main.d.ts +0 -2
  163. package/dist/compiler/training/broker/main.js +0 -14
  164. package/dist/compiler/training/broker/paths.d.ts +0 -236
  165. package/dist/compiler/training/broker/paths.js +0 -249
  166. package/dist/compiler/training/broker/processes.d.ts +0 -51
  167. package/dist/compiler/training/broker/processes.js +0 -102
  168. package/dist/compiler/training/broker/projection.d.ts +0 -61
  169. package/dist/compiler/training/broker/projection.js +0 -109
  170. package/dist/compiler/training/broker/provisioning.d.ts +0 -78
  171. package/dist/compiler/training/broker/provisioning.js +0 -231
  172. package/dist/compiler/training/broker/receipt.d.ts +0 -77
  173. package/dist/compiler/training/broker/receipt.js +0 -110
  174. package/dist/compiler/training/broker/recycleClient.d.ts +0 -33
  175. package/dist/compiler/training/broker/recycleClient.js +0 -112
  176. package/dist/compiler/training/broker/registration.d.ts +0 -46
  177. package/dist/compiler/training/broker/registration.js +0 -113
  178. package/dist/compiler/training/broker/reset.d.ts +0 -9
  179. package/dist/compiler/training/broker/reset.js +0 -71
  180. package/dist/compiler/training/broker/rootScript.d.ts +0 -32
  181. package/dist/compiler/training/broker/rootScript.js +0 -33
  182. package/dist/compiler/training/broker/runtime.d.ts +0 -22
  183. package/dist/compiler/training/broker/runtime.js +0 -128
  184. package/dist/compiler/training/broker/seccompRoutes.d.ts +0 -31
  185. package/dist/compiler/training/broker/seccompRoutes.js +0 -36
  186. package/dist/compiler/training/broker/supervisor.d.ts +0 -108
  187. package/dist/compiler/training/broker/supervisor.js +0 -172
  188. package/dist/compiler/training/broker/taskClock.d.ts +0 -5
  189. package/dist/compiler/training/broker/taskClock.js +0 -41
  190. package/dist/compiler/training/container/contract.d.ts +0 -54
  191. package/dist/compiler/training/container/contract.js +0 -52
  192. package/dist/compiler/training/container/evaluators.d.ts +0 -48
  193. package/dist/compiler/training/container/evaluators.js +0 -50
  194. package/dist/compiler/training/container/grokWriteback.d.ts +0 -8
  195. package/dist/compiler/training/container/grokWriteback.js +0 -26
  196. package/dist/compiler/training/container/index.d.ts +0 -5
  197. package/dist/compiler/training/container/index.js +0 -3
  198. package/dist/compiler/training/container/launch.d.ts +0 -21
  199. package/dist/compiler/training/container/launch.js +0 -280
  200. package/dist/compiler/training/container/nativeSlots.d.ts +0 -14
  201. package/dist/compiler/training/container/nativeSlots.js +0 -13
  202. package/dist/compiler/training/container/outputCopy.d.ts +0 -2
  203. package/dist/compiler/training/container/outputCopy.js +0 -72
  204. package/dist/compiler/training/container/outputVolume.d.ts +0 -28
  205. package/dist/compiler/training/container/outputVolume.js +0 -185
  206. package/dist/compiler/training/container/prepare.d.ts +0 -10
  207. package/dist/compiler/training/container/prepare.js +0 -125
  208. package/dist/compiler/training/container/process.d.ts +0 -14
  209. package/dist/compiler/training/container/process.js +0 -70
  210. package/dist/compiler/training/container/security.d.ts +0 -38
  211. package/dist/compiler/training/container/security.js +0 -68
  212. package/dist/compiler/training/container/subjectIsolation.d.ts +0 -5
  213. package/dist/compiler/training/container/subjectIsolation.js +0 -16
  214. package/dist/compiler/training/preparation/assets/Dockerfile +0 -100
  215. package/dist/compiler/training/preparation/assets/package-lock.json +0 -5483
  216. package/dist/compiler/training/preparation/broker.d.ts +0 -30
  217. package/dist/compiler/training/preparation/broker.js +0 -68
  218. package/dist/compiler/training/preparation/contextModes.d.ts +0 -12
  219. package/dist/compiler/training/preparation/contextModes.js +0 -38
  220. package/dist/compiler/training/preparation/contract.d.ts +0 -203
  221. package/dist/compiler/training/preparation/contract.js +0 -114
  222. package/dist/compiler/training/preparation/copyAssets.d.ts +0 -1
  223. package/dist/compiler/training/preparation/copyAssets.js +0 -8
  224. package/dist/compiler/training/preparation/daimonParent.d.ts +0 -42
  225. package/dist/compiler/training/preparation/daimonParent.js +0 -114
  226. package/dist/compiler/training/preparation/files.d.ts +0 -29
  227. package/dist/compiler/training/preparation/files.js +0 -146
  228. package/dist/compiler/training/preparation/image.d.ts +0 -28
  229. package/dist/compiler/training/preparation/image.js +0 -105
  230. package/dist/compiler/training/preparation/index.d.ts +0 -3
  231. package/dist/compiler/training/preparation/index.js +0 -2
  232. package/dist/compiler/training/preparation/inputs.d.ts +0 -24
  233. package/dist/compiler/training/preparation/inputs.js +0 -101
  234. package/dist/compiler/training/preparation/prepare.d.ts +0 -38
  235. package/dist/compiler/training/preparation/prepare.js +0 -224
  236. package/dist/compiler/training/preparation/scratch.d.ts +0 -8
  237. package/dist/compiler/training/preparation/scratch.js +0 -114
  238. package/dist/compiler/training/repair/compatibility.d.ts +0 -11
  239. package/dist/compiler/training/repair/compatibility.js +0 -45
  240. package/dist/compiler/training/repair/contract.d.ts +0 -832
  241. package/dist/compiler/training/repair/contract.js +0 -34
  242. package/dist/compiler/training/repair/index.d.ts +0 -3
  243. package/dist/compiler/training/repair/index.js +0 -3
  244. package/dist/compiler/training/repair/prepare.d.ts +0 -378
  245. package/dist/compiler/training/repair/prepare.js +0 -84
  246. package/dist/compiler/training/repair/witness.d.ts +0 -348
  247. package/dist/compiler/training/repair/witness.js +0 -62
  248. package/dist/compiler/training/subjectDeclaration.d.ts +0 -26
  249. package/dist/compiler/training/subjectDeclaration.js +0 -54
  250. package/dist/compiler/training/subjectLease.d.ts +0 -115
  251. package/dist/compiler/training/subjectLease.js +0 -179
  252. package/dist/dev/activity.d.ts +0 -14
  253. package/dist/dev/activity.js +0 -48
  254. package/dist/runtime/codex-exec/training/adapter.d.ts +0 -13
  255. package/dist/runtime/codex-exec/training/adapter.js +0 -101
  256. package/dist/runtime/codex-exec/training/adapter.js.map +0 -1
  257. package/dist/runtime/codex-exec/training/environment.d.ts +0 -3
  258. package/dist/runtime/codex-exec/training/environment.js +0 -26
  259. package/dist/runtime/codex-exec/training/environment.js.map +0 -1
  260. package/dist/runtime/codex-exec/training/index.d.ts +0 -2
  261. package/dist/runtime/codex-exec/training/index.js +0 -3
  262. package/dist/runtime/codex-exec/training/index.js.map +0 -1
  263. package/dist/runtime/codex-exec/training/protocol.d.ts +0 -15
  264. package/dist/runtime/codex-exec/training/protocol.js +0 -102
  265. package/dist/runtime/codex-exec/training/protocol.js.map +0 -1
  266. package/dist/runtime/codex-exec/training/providers/codex-subscription/index.js.map +0 -1
  267. package/dist/runtime/codex-exec/training/providers/codex-subscription/protocol.js.map +0 -1
  268. package/dist/runtime/codex-exec/training/providers/codex-subscription/provider.js.map +0 -1
  269. package/dist/runtime/codex-exec/training/providers/codex-subscription/strict-schema.js.map +0 -1
  270. package/dist/runtime/daimon/contractManifest.js.map +0 -1
  271. package/dist/runtime/daimon/contractManifestSchema.js.map +0 -1
  272. package/dist/runtime/daimon/engineDescriptorSchema.js.map +0 -1
  273. package/dist/runtime/daimon/engineDescriptors.generated.js.map +0 -1
  274. package/dist/runtime/daimon/engines.js.map +0 -1
  275. package/dist/runtime/daimon/index.js.map +0 -1
  276. package/dist/runtime/daimon/packageName.js.map +0 -1
  277. package/dist/runtime/daimon/training/legacy/adapter.d.ts +0 -11
  278. package/dist/runtime/daimon/training/legacy/adapter.js +0 -175
  279. package/dist/runtime/daimon/training/legacy/adapter.js.map +0 -1
  280. package/dist/runtime/daimon/training/legacy/index.d.ts +0 -2
  281. package/dist/runtime/daimon/training/legacy/index.js +0 -3
  282. package/dist/runtime/daimon/training/legacy/index.js.map +0 -1
  283. package/dist/runtime/daimon/training/legacy/public.d.ts +0 -49
  284. package/dist/runtime/daimon/training/legacy/public.js +0 -16
  285. package/dist/runtime/daimon/training/legacy/public.js.map +0 -1
  286. package/dist/runtime/daimon/training/native/adapter.d.ts +0 -18
  287. package/dist/runtime/daimon/training/native/adapter.js +0 -252
  288. package/dist/runtime/daimon/training/native/adapter.js.map +0 -1
  289. package/dist/runtime/daimon/training/native/admission.d.ts +0 -7
  290. package/dist/runtime/daimon/training/native/admission.js +0 -52
  291. package/dist/runtime/daimon/training/native/admission.js.map +0 -1
  292. package/dist/runtime/daimon/training/native/child/arguments.d.ts +0 -16
  293. package/dist/runtime/daimon/training/native/child/arguments.js +0 -70
  294. package/dist/runtime/daimon/training/native/child/arguments.js.map +0 -1
  295. package/dist/runtime/daimon/training/native/child/deferred-trial.d.ts +0 -24
  296. package/dist/runtime/daimon/training/native/child/deferred-trial.js +0 -63
  297. package/dist/runtime/daimon/training/native/child/deferred-trial.js.map +0 -1
  298. package/dist/runtime/daimon/training/native/child/diagnostics.d.ts +0 -58
  299. package/dist/runtime/daimon/training/native/child/diagnostics.js +0 -215
  300. package/dist/runtime/daimon/training/native/child/diagnostics.js.map +0 -1
  301. package/dist/runtime/daimon/training/native/child/fixture.d.ts +0 -16
  302. package/dist/runtime/daimon/training/native/child/fixture.js +0 -159
  303. package/dist/runtime/daimon/training/native/child/fixture.js.map +0 -1
  304. package/dist/runtime/daimon/training/native/child/grok.d.ts +0 -14
  305. package/dist/runtime/daimon/training/native/child/grok.js +0 -47
  306. package/dist/runtime/daimon/training/native/child/grok.js.map +0 -1
  307. package/dist/runtime/daimon/training/native/child/index.d.ts +0 -7
  308. package/dist/runtime/daimon/training/native/child/index.js +0 -5
  309. package/dist/runtime/daimon/training/native/child/index.js.map +0 -1
  310. package/dist/runtime/daimon/training/native/child/lifecycle.d.ts +0 -40
  311. package/dist/runtime/daimon/training/native/child/lifecycle.js +0 -400
  312. package/dist/runtime/daimon/training/native/child/lifecycle.js.map +0 -1
  313. package/dist/runtime/daimon/training/native/child/probe.d.ts +0 -2
  314. package/dist/runtime/daimon/training/native/child/probe.js +0 -11
  315. package/dist/runtime/daimon/training/native/child/probe.js.map +0 -1
  316. package/dist/runtime/daimon/training/native/child/sandbox.d.ts +0 -4
  317. package/dist/runtime/daimon/training/native/child/sandbox.js +0 -76
  318. package/dist/runtime/daimon/training/native/child/sandbox.js.map +0 -1
  319. package/dist/runtime/daimon/training/native/child/types.d.ts +0 -15
  320. package/dist/runtime/daimon/training/native/child/types.js +0 -2
  321. package/dist/runtime/daimon/training/native/child/types.js.map +0 -1
  322. package/dist/runtime/daimon/training/native/container/docker.d.ts +0 -29
  323. package/dist/runtime/daimon/training/native/container/docker.js +0 -105
  324. package/dist/runtime/daimon/training/native/container/docker.js.map +0 -1
  325. package/dist/runtime/daimon/training/native/container/grok-slot.d.ts +0 -22
  326. package/dist/runtime/daimon/training/native/container/grok-slot.js +0 -38
  327. package/dist/runtime/daimon/training/native/container/grok-slot.js.map +0 -1
  328. package/dist/runtime/daimon/training/native/container/index.d.ts +0 -6
  329. package/dist/runtime/daimon/training/native/container/index.js +0 -6
  330. package/dist/runtime/daimon/training/native/container/index.js.map +0 -1
  331. package/dist/runtime/daimon/training/native/container/lifecycle.d.ts +0 -8
  332. package/dist/runtime/daimon/training/native/container/lifecycle.js +0 -111
  333. package/dist/runtime/daimon/training/native/container/lifecycle.js.map +0 -1
  334. package/dist/runtime/daimon/training/native/container/manifest.d.ts +0 -17
  335. package/dist/runtime/daimon/training/native/container/manifest.js +0 -164
  336. package/dist/runtime/daimon/training/native/container/manifest.js.map +0 -1
  337. package/dist/runtime/daimon/training/native/container/native-preflight.d.ts +0 -8
  338. package/dist/runtime/daimon/training/native/container/native-preflight.js +0 -40
  339. package/dist/runtime/daimon/training/native/container/native-preflight.js.map +0 -1
  340. package/dist/runtime/daimon/training/native/container/preflight.d.ts +0 -15
  341. package/dist/runtime/daimon/training/native/container/preflight.js +0 -79
  342. package/dist/runtime/daimon/training/native/container/preflight.js.map +0 -1
  343. package/dist/runtime/daimon/training/native/container/slot.d.ts +0 -4
  344. package/dist/runtime/daimon/training/native/container/slot.js +0 -58
  345. package/dist/runtime/daimon/training/native/container/slot.js.map +0 -1
  346. package/dist/runtime/daimon/training/native/external.d.ts +0 -37
  347. package/dist/runtime/daimon/training/native/external.js +0 -75
  348. package/dist/runtime/daimon/training/native/external.js.map +0 -1
  349. package/dist/runtime/daimon/training/native/grants/authority.d.ts +0 -36
  350. package/dist/runtime/daimon/training/native/grants/authority.js +0 -49
  351. package/dist/runtime/daimon/training/native/grants/authority.js.map +0 -1
  352. package/dist/runtime/daimon/training/native/grants/index.d.ts +0 -2
  353. package/dist/runtime/daimon/training/native/grants/index.js +0 -3
  354. package/dist/runtime/daimon/training/native/grants/index.js.map +0 -1
  355. package/dist/runtime/daimon/training/native/grants/pins.d.ts +0 -30
  356. package/dist/runtime/daimon/training/native/grants/pins.js +0 -20
  357. package/dist/runtime/daimon/training/native/grants/pins.js.map +0 -1
  358. package/dist/runtime/daimon/training/native/grants/test-socket.d.ts +0 -6
  359. package/dist/runtime/daimon/training/native/grants/test-socket.js +0 -35
  360. package/dist/runtime/daimon/training/native/grants/test-socket.js.map +0 -1
  361. package/dist/runtime/daimon/training/native/grok-fixtures.d.ts +0 -34
  362. package/dist/runtime/daimon/training/native/grok-fixtures.js +0 -179
  363. package/dist/runtime/daimon/training/native/grok-fixtures.js.map +0 -1
  364. package/dist/runtime/daimon/training/native/index.d.ts +0 -38
  365. package/dist/runtime/daimon/training/native/index.js +0 -27
  366. package/dist/runtime/daimon/training/native/index.js.map +0 -1
  367. package/dist/runtime/daimon/training/native/live-checkout.d.ts +0 -2
  368. package/dist/runtime/daimon/training/native/live-checkout.js +0 -15
  369. package/dist/runtime/daimon/training/native/live-checkout.js.map +0 -1
  370. package/dist/runtime/daimon/training/native/observations.d.ts +0 -51
  371. package/dist/runtime/daimon/training/native/observations.js +0 -217
  372. package/dist/runtime/daimon/training/native/observations.js.map +0 -1
  373. package/dist/runtime/daimon/training/native/outcome.d.ts +0 -13
  374. package/dist/runtime/daimon/training/native/outcome.js +0 -37
  375. package/dist/runtime/daimon/training/native/outcome.js.map +0 -1
  376. package/dist/runtime/daimon/training/native/preparation/engine-config.d.ts +0 -21
  377. package/dist/runtime/daimon/training/native/preparation/engine-config.js +0 -30
  378. package/dist/runtime/daimon/training/native/preparation/engine-config.js.map +0 -1
  379. package/dist/runtime/daimon/training/native/preparation/fixtures.d.ts +0 -17
  380. package/dist/runtime/daimon/training/native/preparation/fixtures.js +0 -52
  381. package/dist/runtime/daimon/training/native/preparation/fixtures.js.map +0 -1
  382. package/dist/runtime/daimon/training/native/preparation/index.d.ts +0 -7
  383. package/dist/runtime/daimon/training/native/preparation/index.js +0 -5
  384. package/dist/runtime/daimon/training/native/preparation/index.js.map +0 -1
  385. package/dist/runtime/daimon/training/native/preparation/layout.d.ts +0 -66
  386. package/dist/runtime/daimon/training/native/preparation/layout.js +0 -87
  387. package/dist/runtime/daimon/training/native/preparation/layout.js.map +0 -1
  388. package/dist/runtime/daimon/training/native/preparation/subject.d.ts +0 -14
  389. package/dist/runtime/daimon/training/native/preparation/subject.js +0 -67
  390. package/dist/runtime/daimon/training/native/preparation/subject.js.map +0 -1
  391. package/dist/runtime/daimon/training/native/preparation/types.d.ts +0 -69
  392. package/dist/runtime/daimon/training/native/preparation/types.js +0 -2
  393. package/dist/runtime/daimon/training/native/preparation/types.js.map +0 -1
  394. package/dist/runtime/daimon/training/native/receipt/artifacts.d.ts +0 -25
  395. package/dist/runtime/daimon/training/native/receipt/artifacts.js +0 -32
  396. package/dist/runtime/daimon/training/native/receipt/artifacts.js.map +0 -1
  397. package/dist/runtime/daimon/training/native/receipt/grok-clocked-pins.d.ts +0 -129
  398. package/dist/runtime/daimon/training/native/receipt/grok-clocked-pins.js +0 -45
  399. package/dist/runtime/daimon/training/native/receipt/grok-clocked-pins.js.map +0 -1
  400. package/dist/runtime/daimon/training/native/receipt/grok.d.ts +0 -246
  401. package/dist/runtime/daimon/training/native/receipt/grok.js +0 -195
  402. package/dist/runtime/daimon/training/native/receipt/grok.js.map +0 -1
  403. package/dist/runtime/daimon/training/native/receipt/index.d.ts +0 -11
  404. package/dist/runtime/daimon/training/native/receipt/index.js +0 -8
  405. package/dist/runtime/daimon/training/native/receipt/index.js.map +0 -1
  406. package/dist/runtime/daimon/training/native/receipt/paths.d.ts +0 -3
  407. package/dist/runtime/daimon/training/native/receipt/paths.js +0 -18
  408. package/dist/runtime/daimon/training/native/receipt/paths.js.map +0 -1
  409. package/dist/runtime/daimon/training/native/receipt/sandbox.d.ts +0 -42
  410. package/dist/runtime/daimon/training/native/receipt/sandbox.js +0 -35
  411. package/dist/runtime/daimon/training/native/receipt/sandbox.js.map +0 -1
  412. package/dist/runtime/daimon/training/native/receipt/schema.d.ts +0 -490
  413. package/dist/runtime/daimon/training/native/receipt/schema.js +0 -138
  414. package/dist/runtime/daimon/training/native/receipt/schema.js.map +0 -1
  415. package/dist/runtime/daimon/training/native/receipt/subscription.d.ts +0 -13
  416. package/dist/runtime/daimon/training/native/receipt/subscription.js +0 -13
  417. package/dist/runtime/daimon/training/native/receipt/subscription.js.map +0 -1
  418. package/dist/runtime/daimon/training/native/receipt/task-clock.d.ts +0 -19
  419. package/dist/runtime/daimon/training/native/receipt/task-clock.js +0 -49
  420. package/dist/runtime/daimon/training/native/receipt/task-clock.js.map +0 -1
  421. package/dist/runtime/daimon/training/native/sealed-usage.d.ts +0 -218
  422. package/dist/runtime/daimon/training/native/sealed-usage.js +0 -261
  423. package/dist/runtime/daimon/training/native/sealed-usage.js.map +0 -1
  424. package/dist/runtime/daimon/training/native/test-fixtures.d.ts +0 -27
  425. package/dist/runtime/daimon/training/native/test-fixtures.js +0 -162
  426. package/dist/runtime/daimon/training/native/test-fixtures.js.map +0 -1
  427. package/dist/runtime/daimon/training/native/transcript.d.ts +0 -96
  428. package/dist/runtime/daimon/training/native/transcript.js +0 -239
  429. package/dist/runtime/daimon/training/native/transcript.js.map +0 -1
  430. package/dist/runtime/daimon/training/native/transport/delivery.d.ts +0 -27
  431. package/dist/runtime/daimon/training/native/transport/delivery.js +0 -98
  432. package/dist/runtime/daimon/training/native/transport/delivery.js.map +0 -1
  433. package/dist/runtime/daimon/training/native/transport/http.d.ts +0 -3
  434. package/dist/runtime/daimon/training/native/transport/http.js +0 -81
  435. package/dist/runtime/daimon/training/native/transport/http.js.map +0 -1
  436. package/dist/runtime/daimon/training/native/transport/index.d.ts +0 -4
  437. package/dist/runtime/daimon/training/native/transport/index.js +0 -3
  438. package/dist/runtime/daimon/training/native/transport/index.js.map +0 -1
  439. package/dist/runtime/daimon/training/native/transport/types.d.ts +0 -15
  440. package/dist/runtime/daimon/training/native/transport/types.js +0 -2
  441. package/dist/runtime/daimon/training/native/transport/types.js.map +0 -1
  442. package/dist/runtime/daimon/training/native/worker/cli.d.ts +0 -1
  443. package/dist/runtime/daimon/training/native/worker/cli.js +0 -17
  444. package/dist/runtime/daimon/training/native/worker/cli.js.map +0 -1
  445. package/dist/runtime/daimon/training/native/worker/control.d.ts +0 -20
  446. package/dist/runtime/daimon/training/native/worker/control.js +0 -266
  447. package/dist/runtime/daimon/training/native/worker/control.js.map +0 -1
  448. package/dist/runtime/daimon/training/native/worker/deliveries.d.ts +0 -38
  449. package/dist/runtime/daimon/training/native/worker/deliveries.js +0 -91
  450. package/dist/runtime/daimon/training/native/worker/deliveries.js.map +0 -1
  451. package/dist/runtime/daimon/training/native/worker/evidence/collect.d.ts +0 -54
  452. package/dist/runtime/daimon/training/native/worker/evidence/collect.js +0 -278
  453. package/dist/runtime/daimon/training/native/worker/evidence/collect.js.map +0 -1
  454. package/dist/runtime/daimon/training/native/worker/evidence/execution.d.ts +0 -102
  455. package/dist/runtime/daimon/training/native/worker/evidence/execution.js +0 -191
  456. package/dist/runtime/daimon/training/native/worker/evidence/execution.js.map +0 -1
  457. package/dist/runtime/daimon/training/native/worker/evidence/index.d.ts +0 -3
  458. package/dist/runtime/daimon/training/native/worker/evidence/index.js +0 -4
  459. package/dist/runtime/daimon/training/native/worker/evidence/index.js.map +0 -1
  460. package/dist/runtime/daimon/training/native/worker/evidence/io.d.ts +0 -20
  461. package/dist/runtime/daimon/training/native/worker/evidence/io.js +0 -130
  462. package/dist/runtime/daimon/training/native/worker/evidence/io.js.map +0 -1
  463. package/dist/runtime/daimon/training/native/worker/evidence/seal.d.ts +0 -3
  464. package/dist/runtime/daimon/training/native/worker/evidence/seal.js +0 -67
  465. package/dist/runtime/daimon/training/native/worker/evidence/seal.js.map +0 -1
  466. package/dist/runtime/daimon/training/native/worker/index.d.ts +0 -11
  467. package/dist/runtime/daimon/training/native/worker/index.js +0 -8
  468. package/dist/runtime/daimon/training/native/worker/index.js.map +0 -1
  469. package/dist/runtime/daimon/training/native/worker/profile.d.ts +0 -23
  470. package/dist/runtime/daimon/training/native/worker/profile.js +0 -149
  471. package/dist/runtime/daimon/training/native/worker/profile.js.map +0 -1
  472. package/dist/runtime/daimon/training/native/worker/public.d.ts +0 -53
  473. package/dist/runtime/daimon/training/native/worker/public.js +0 -22
  474. package/dist/runtime/daimon/training/native/worker/public.js.map +0 -1
  475. package/dist/runtime/daimon/training/native/worker/sandbox.d.ts +0 -4
  476. package/dist/runtime/daimon/training/native/worker/sandbox.js +0 -54
  477. package/dist/runtime/daimon/training/native/worker/sandbox.js.map +0 -1
  478. package/dist/runtime/daimon/training/native/worker/server.d.ts +0 -4
  479. package/dist/runtime/daimon/training/native/worker/server.js +0 -102
  480. package/dist/runtime/daimon/training/native/worker/server.js.map +0 -1
  481. package/dist/runtime/daimon/training/native/worker/types.d.ts +0 -318
  482. package/dist/runtime/daimon/training/native/worker/types.js +0 -2
  483. package/dist/runtime/daimon/training/native/worker/types.js.map +0 -1
  484. package/dist/runtime/daimon/training/native/worker/wake-delivery/index.d.ts +0 -4
  485. package/dist/runtime/daimon/training/native/worker/wake-delivery/index.js +0 -4
  486. package/dist/runtime/daimon/training/native/worker/wake-delivery/index.js.map +0 -1
  487. package/dist/runtime/daimon/training/native/worker/wake-delivery/source.d.ts +0 -3
  488. package/dist/runtime/daimon/training/native/worker/wake-delivery/source.js +0 -16
  489. package/dist/runtime/daimon/training/native/worker/wake-delivery/source.js.map +0 -1
  490. package/dist/runtime/daimon/training/native/worker/wake-delivery/terminal.d.ts +0 -4
  491. package/dist/runtime/daimon/training/native/worker/wake-delivery/terminal.js +0 -52
  492. package/dist/runtime/daimon/training/native/worker/wake-delivery/terminal.js.map +0 -1
  493. package/dist/runtime/daimon/training/native/worker/wake-delivery/transport.d.ts +0 -21
  494. package/dist/runtime/daimon/training/native/worker/wake-delivery/transport.js +0 -198
  495. package/dist/runtime/daimon/training/native/worker/wake-delivery/transport.js.map +0 -1
  496. package/dist/runtime/daimon/training/native/worker/wake-delivery/types.d.ts +0 -91
  497. package/dist/runtime/daimon/training/native/worker/wake-delivery/types.js +0 -2
  498. package/dist/runtime/daimon/training/native/worker/wake-delivery/types.js.map +0 -1
  499. package/dist/runtime/daimon/training/native/worker/worker.d.ts +0 -1
  500. package/dist/runtime/daimon/training/native/worker/worker.js +0 -105
  501. package/dist/runtime/daimon/training/native/worker/worker.js.map +0 -1
  502. package/dist/runtime/daimon/training/providers/grok-broker/broker.d.ts +0 -20
  503. package/dist/runtime/daimon/training/providers/grok-broker/broker.js +0 -55
  504. package/dist/runtime/daimon/training/providers/grok-broker/broker.js.map +0 -1
  505. package/dist/runtime/daimon/training/providers/grok-broker/grant-fixtures.d.ts +0 -15
  506. package/dist/runtime/daimon/training/providers/grok-broker/grant-fixtures.js +0 -29
  507. package/dist/runtime/daimon/training/providers/grok-broker/grant-fixtures.js.map +0 -1
  508. package/dist/runtime/daimon/training/providers/grok-broker/grant-home.d.ts +0 -16
  509. package/dist/runtime/daimon/training/providers/grok-broker/grant-home.js +0 -60
  510. package/dist/runtime/daimon/training/providers/grok-broker/grant-home.js.map +0 -1
  511. package/dist/runtime/daimon/training/providers/grok-broker/grant-pool.d.ts +0 -81
  512. package/dist/runtime/daimon/training/providers/grok-broker/grant-pool.js +0 -221
  513. package/dist/runtime/daimon/training/providers/grok-broker/grant-pool.js.map +0 -1
  514. package/dist/runtime/daimon/training/providers/grok-broker/grant-releases.d.ts +0 -31
  515. package/dist/runtime/daimon/training/providers/grok-broker/grant-releases.js +0 -78
  516. package/dist/runtime/daimon/training/providers/grok-broker/grant-releases.js.map +0 -1
  517. package/dist/runtime/daimon/training/providers/grok-broker/grants.d.ts +0 -63
  518. package/dist/runtime/daimon/training/providers/grok-broker/grants.js +0 -20
  519. package/dist/runtime/daimon/training/providers/grok-broker/grants.js.map +0 -1
  520. package/dist/runtime/daimon/training/providers/grok-broker/index.d.ts +0 -3
  521. package/dist/runtime/daimon/training/providers/grok-broker/index.js +0 -4
  522. package/dist/runtime/daimon/training/providers/grok-broker/index.js.map +0 -1
  523. package/dist/runtime/daimon/training/public.d.ts +0 -6
  524. package/dist/runtime/daimon/training/public.js +0 -5
  525. package/dist/runtime/daimon/training/public.js.map +0 -1
  526. package/dist/runtime/daimon/training/services/account-lease.d.ts +0 -7
  527. package/dist/runtime/daimon/training/services/account-lease.js +0 -76
  528. package/dist/runtime/daimon/training/services/account-lease.js.map +0 -1
  529. package/dist/runtime/daimon/training/services/freshness.d.ts +0 -15
  530. package/dist/runtime/daimon/training/services/freshness.js +0 -19
  531. package/dist/runtime/daimon/training/services/freshness.js.map +0 -1
  532. package/dist/runtime/daimon/training/services/index.d.ts +0 -4
  533. package/dist/runtime/daimon/training/services/index.js +0 -4
  534. package/dist/runtime/daimon/training/services/index.js.map +0 -1
  535. package/dist/runtime/daimon/training/services/slot-freshness.d.ts +0 -34
  536. package/dist/runtime/daimon/training/services/slot-freshness.js +0 -178
  537. package/dist/runtime/daimon/training/services/slot-freshness.js.map +0 -1
  538. package/dist/runtime/daimon/wakeMoments.js.map +0 -1
  539. package/dist/runtime/pi/adapter.d.ts +0 -3
  540. package/dist/runtime/pi/adapter.js +0 -230
  541. package/dist/runtime/pi/appActivitySource.d.ts +0 -1
  542. package/dist/runtime/pi/appActivitySource.js +0 -199
  543. package/dist/runtime/pi/appAgentConfig.d.ts +0 -11
  544. package/dist/runtime/pi/appAgentConfig.js +0 -264
  545. package/dist/runtime/pi/appCliEnginesSource.d.ts +0 -1
  546. package/dist/runtime/pi/appCliEnginesSource.js +0 -183
  547. package/dist/runtime/pi/appCliSource.d.ts +0 -1
  548. package/dist/runtime/pi/appCliSource.js +0 -353
  549. package/dist/runtime/pi/appControlSource.d.ts +0 -1
  550. package/dist/runtime/pi/appControlSource.js +0 -390
  551. package/dist/runtime/pi/appControlWakeIdentitySource.d.ts +0 -1
  552. package/dist/runtime/pi/appControlWakeIdentitySource.js +0 -19
  553. package/dist/runtime/pi/appCoreSource.d.ts +0 -4
  554. package/dist/runtime/pi/appCoreSource.js +0 -244
  555. package/dist/runtime/pi/appPreludeSource.d.ts +0 -1
  556. package/dist/runtime/pi/appPreludeSource.js +0 -192
  557. package/dist/runtime/pi/appScheduleSource.d.ts +0 -1
  558. package/dist/runtime/pi/appScheduleSource.js +0 -84
  559. package/dist/runtime/pi/appScriptedEngine.d.ts +0 -31
  560. package/dist/runtime/pi/appScriptedEngine.js +0 -42
  561. package/dist/runtime/pi/appSource.d.ts +0 -4
  562. package/dist/runtime/pi/appSource.js +0 -12
  563. package/dist/runtime/pi/appTemplate.d.ts +0 -14
  564. package/dist/runtime/pi/appTemplate.js +0 -28
  565. package/dist/runtime/pi/appTemplateTypes.d.ts +0 -64
  566. package/dist/runtime/pi/appTemplateTypes.js +0 -18
  567. package/dist/runtime/pi/appWakeContextSource.d.ts +0 -1
  568. package/dist/runtime/pi/appWakeContextSource.js +0 -398
  569. package/dist/runtime/pi/containerTargets.d.ts +0 -4
  570. package/dist/runtime/pi/containerTargets.js +0 -63
  571. package/dist/runtime/pi/runAuth.d.ts +0 -2
  572. package/dist/runtime/pi/runAuth.js +0 -185
  573. package/dist/runtime/pi/testHelpers.d.ts +0 -2
  574. package/dist/shared/errors.js.map +0 -1
  575. package/dist/training/subjects/environment.d.ts +0 -2
  576. package/dist/training/subjects/environment.js +0 -14
  577. package/dist/training/subjects/environment.js.map +0 -1
  578. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/index.d.ts +0 -0
  579. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/index.js +0 -0
  580. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/protocol.d.ts +0 -0
  581. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/protocol.js +0 -0
  582. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/provider.d.ts +0 -0
  583. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/provider.js +0 -0
  584. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/strict-schema.d.ts +0 -0
  585. /package/dist/runtime/{codex-exec → daimon}/training/providers/codex-subscription/strict-schema.js +0 -0
@@ -1,266 +0,0 @@
1
- import { describeNativeFailure, executionClosed, claimedExecution, disposedWakeExecution, deferredAfterCompletion, declaredLimitStop, DeclaredLimitStop } from './evidence/index.js';
2
- export { describeNativeFailure, admittedExecutions, validateNativeFrame, executionClosed, claimedExecution, disposedWakeExecution, AMBIGUOUS_NATIVE_EXECUTION, AMBIGUOUS_WAKE_EXECUTION } from './evidence/index.js';
3
- import { createDeliveryGate, engineWakeTimeoutMs } from './deliveries.js';
4
- import { dirname, join } from 'node:path';
5
- import { collectNativeEvidence, nativeUsageCoverage, readClosedTraces, wakeEvidenceFile, writeEvidence, settleNativeRead } from './evidence/index.js';
6
- import { isGrokLaunch } from '../receipt/index.js';
7
- import { createTransportDelivery, parseTransportSource, validateTransportExecutions } from './wake-delivery/index.js';
8
- export function createWorkerController(host, config, options, token, launch, taskClock) {
9
- const observation = {
10
- wakeReceipt: (auth, id) => settleNativeRead('wake acceptance receipt', () => host.wakeReceipt(auth, id)),
11
- activityV2: (auth) => settleNativeRead('activity acceptance/batch snapshot', () => host.activityV2(auth)),
12
- availability: (auth) => settleNativeRead('availability snapshot', () => host.availability(auth)),
13
- };
14
- const agent = config.agents[0];
15
- if (agent.engine.kind === 'grok' && (!launch || !isGrokLaunch(launch)))
16
- throw new Error('Grok native trials require their Grok broker launch receipt');
17
- const grok = launch && isGrokLaunch(launch) ? launch : undefined;
18
- const usageFile = grok ? grok.broker.usageLedgerPath : join(options.controlRoot, 'usage.jsonl');
19
- const source = grok ? { engine: 'grok', requestsFile: join(dirname(usageFile), 'requests.jsonl') } : { engine: 'codex' };
20
- const cancellation = new AbortController();
21
- const gate = createDeliveryGate(options.timeoutMs, agent.attention?.maxExecutions, launch?.delivery);
22
- const wakeTimeoutMs = engineWakeTimeoutMs(options.timeoutMs, launch);
23
- const transport = launch?.delivery === 'transport' ? createTransportDelivery(host, agent.id) : undefined;
24
- /** This trial's delivery ordinal, so each wake's frame is filed under a name no later wake reuses. */
25
- let delivered = 0;
26
- let stopping;
27
- const owned = (operation) => {
28
- if (cancellation.signal.aborted)
29
- return Promise.reject(new Error('Native trial cancelled'));
30
- return new Promise((resolve, reject) => {
31
- const aborted = () => reject(new Error('Native trial cancelled'));
32
- cancellation.signal.addEventListener('abort', aborted, { once: true });
33
- void operation.then(resolve, reject).finally(() => cancellation.signal.removeEventListener('abort', aborted));
34
- });
35
- };
36
- const stop = () => {
37
- cancellation.abort();
38
- stopping ??= (async () => {
39
- let timer;
40
- try {
41
- const native = await Promise.race([host.stop(), new Promise((_, reject) => {
42
- timer = setTimeout(() => reject(new Error('Native shutdown deadline exceeded')), 5000);
43
- })]);
44
- return { schema: 'spawnfile.training.daimon-native.stop.v1', state: 'acknowledged', quiescence: 'unknown',
45
- containmentVerification: 'parent-container-owner', native };
46
- }
47
- catch (error) {
48
- return { schema: 'spawnfile.training.daimon-native.stop.v1', state: 'unknown', quiescence: 'unknown',
49
- containmentVerification: 'parent-container-owner', error: String(error) };
50
- }
51
- finally {
52
- clearTimeout(timer);
53
- }
54
- })();
55
- return stopping;
56
- };
57
- return {
58
- // The HTTP observation routes used by child closure share the same readers.
59
- host: { start: () => host.start(), stop: () => host.stop(), health: () => host.health(),
60
- accept: value => host.accept(value), ...observation }, stop, ...(transport ? { transport } : {}),
61
- async run(wakeId, text, controls, expectedSource) {
62
- if (cancellation.signal.aborted)
63
- throw new Error('Worker accepts exactly one native trial delivery');
64
- const remaining = gate.begin(wakeId, text, controls, expectedSource);
65
- const incoming = transport?.begin(wakeId, parseTransportSource(expectedSource));
66
- const ordinal = ++delivered;
67
- /**
68
- * Every execution of this trial that is not this wake's, from the runtime's
69
- * own account of them: the ones earlier wakes closed, and the ones it runs
70
- * for another of this trial's deliveries while this wake waits. It is the
71
- * set this wake's evidence is separated FROM, never a set anything is
72
- * selected out of, and a member of it is this trial's own history rather
73
- * than foreign work.
74
- */
75
- const history = new Set(gate.executions);
76
- /**
77
- * That set at the moment it is read, with this wake's own execution taken
78
- * back out of it — the one it bound AND the one the runtime claimed for this
79
- * delivery, so a wake that failed before it could bind still keeps its own
80
- * spend and its own trace on the frame it publishes.
81
- */
82
- const others = () => [...history].filter(id => id !== executionId && id !== claimed);
83
- const startedAt = new Date().toISOString();
84
- let deliveryId = `${options.trialId}:${wakeId}`;
85
- let receipt;
86
- let activity;
87
- let availability;
88
- /** The execution the runtime bound to this delivery, once it has said which. */
89
- let claimed;
90
- let executionId;
91
- let status;
92
- let error;
93
- let blocked;
94
- let limit;
95
- let native = { traces: [], usage: [], toolReceipts: [], modelContexts: [] };
96
- let timedOut = false;
97
- const timer = setTimeout(() => { timedOut = true; void stop(); }, remaining);
98
- try {
99
- // Whatever this trial had already closed before this delivery existed. The
100
- // runtime home is asserted empty at startup and every trace in it is refused
101
- // unless it is this agent's, so the rows here are this trial's earlier wakes
102
- // by construction rather than by counting.
103
- for (const trace of await owned(readClosedTraces(agent.runtimeHomePath, agent.id)))
104
- history.add(trace.turn_id);
105
- const accepted = incoming ? await owned(incoming.accepted) : await owned(host.accept({ token, agent_id: agent.id, delivery_id: deliveryId,
106
- event: { version: 'noopolis.daimon.wake.v2', kind: 'manual', text, occurred_at: startedAt } }));
107
- if (accepted.state !== 'accepted')
108
- throw new Error(`Native acceptance refused: ${accepted.code}`);
109
- if (incoming)
110
- deliveryId = incoming.evidence.deliveryId;
111
- for (;;) {
112
- // Capture admission before any asynchronous snapshot/collection. A route
113
- // request that enters or settles meanwhile requires another full pass.
114
- const generation = incoming?.generation();
115
- while (true) {
116
- if (cancellation.signal.aborted)
117
- throw new Error(timedOut ? 'Native trial deadline exceeded' : 'Native trial cancelled');
118
- [receipt, activity, availability] = await owned(Promise.all([
119
- observation.wakeReceipt(token, accepted.acceptance_id), observation.activityV2(token), observation.availability(token),
120
- ]));
121
- if (!receipt || !activity || !availability)
122
- throw new Error('Authenticated native control evidence disappeared');
123
- if (receipt.delivery_id !== deliveryId || receipt.agent_id !== agent.id)
124
- throw new Error('Native receipt identity mismatch');
125
- if (!Array.isArray(activity.executions))
126
- throw new Error('Native activity omitted execution authority');
127
- // The runtime's own binding of this delivery to an execution, and its own
128
- // account of everything else it is running for this trial meanwhile.
129
- claimed = claimedExecution(receipt, activity, deliveryId, agent.id) ?? claimed;
130
- incoming?.observe(receipt, activity, availability, claimed);
131
- for (const row of activity.executions)
132
- if (row.agent_id === agent.id)
133
- history.add(row.execution_id);
134
- if (!activity.executions.length) {
135
- const traces = await readClosedTraces(agent.runtimeHomePath, agent.id, claimed !== undefined);
136
- // The runtime's own binding first; only for a delivery it has disposed
137
- // of, on a runtime admitting nothing, may this wake answer for the
138
- // execution that closed inside its own window instead.
139
- if (!incoming)
140
- claimed ??= disposedWakeExecution(receipt, traces, history);
141
- if (claimed) {
142
- executionId = executionClosed(activity, receipt, traces, agent.id, claimed);
143
- if (executionId) {
144
- receipt = await owned(observation.wakeReceipt(token, accepted.acceptance_id));
145
- activity = await owned(observation.activityV2(token));
146
- availability = await owned(observation.availability(token));
147
- if (!receipt || !activity || !availability)
148
- throw new Error('Authenticated terminal control evidence disappeared');
149
- if (receipt.delivery_id !== deliveryId)
150
- throw new Error('Native receipt identity mismatch');
151
- incoming?.observe(receipt, activity, availability, claimed);
152
- executionId = executionClosed(activity, receipt, traces, agent.id, claimed);
153
- if (executionId && (!incoming || incoming.closed(traces)))
154
- break;
155
- }
156
- }
157
- const failure = availability.agents.find(row => row.agent_id === agent.id)?.error;
158
- if (failure)
159
- throw new Error(`Native execution failed before terminal telemetry: ${failure}`);
160
- // Budget snapshots can pause immediately after this execution was admitted.
161
- // Only its closed trace or the bounded deadline can establish completion.
162
- }
163
- await pause(100, cancellation.signal);
164
- }
165
- native = await owned(collectNativeEvidence(agent.runtimeHomePath, usageFile, agent.id, incoming ? undefined : executionId, agent.engine.model, incoming ? [] : others(), source));
166
- if (cancellation.signal.aborted)
167
- throw new Error('Native trial cancelled');
168
- if (incoming) {
169
- // Synchronously seal against route admission before deciding a terminal
170
- // outcome. No in-flight acceptance can be omitted by this snapshot.
171
- if (!incoming.seal(generation, native.traces)) {
172
- await pause(100, cancellation.signal);
173
- continue;
174
- }
175
- validateTransportExecutions(incoming.evidence, native, activity, agent.id, wakeTimeoutMs);
176
- }
177
- // The trace this wake's own execution closed, never whichever one came
178
- // first: an unbound wake has no trace to speak for it, and reading another
179
- // wake's would report that wake's disposition as this delivery's.
180
- const trace = native.traces.find(row => row.turn_id === executionId);
181
- const failure = availability.agents.find(row => row.agent_id === agent.id)?.error;
182
- if (!native.usage.length) {
183
- // Name what WAS observed: a bare "no usage" cannot distinguish a turn that never ran from
184
- // one that ran without metering, and the runtime home is wiped with the slot.
185
- const observed = `traces=${native.traces.length} contexts=${native.modelContexts.length} requests=${native.requests?.length ?? 0}`;
186
- throw new Error(`Closed native execution omitted token usage evidence (${observed} receipt=${receipt.state} execution=${executionId ?? 'none'}${failure ? ` availability=${failure}` : ''})`);
187
- }
188
- if (!native.modelContexts.length)
189
- throw new Error('Closed native execution omitted model identity evidence');
190
- if (!failure && trace?.status === 'completed' && incoming?.evidence.deferredDeliveryIds.length) {
191
- blocked = 'awaiting-external-input';
192
- throw new Error('Native execution completed; transport batch deliveries blocked awaiting external input');
193
- }
194
- if (incoming?.evidence.unresolvedDeliveryIds.length)
195
- throw new Error('Transport trial deliveries remain unresolved');
196
- if (!failure && deferredAfterCompletion(receipt, trace))
197
- blocked = 'awaiting-external-input';
198
- if (receipt.state !== 'completed' || trace?.status !== 'completed' || failure) {
199
- // The closed execution's own sealed limit row outranks the runtime's
200
- // generic availability error, which that same limit is what raised.
201
- const limit = declaredLimitStop(trace, native.usage, wakeTimeoutMs);
202
- if (limit)
203
- throw new DeclaredLimitStop(limit, describeNativeFailure(receipt, trace, native.usage));
204
- throw new Error(failure ?? describeNativeFailure(receipt, trace, native.usage));
205
- }
206
- status = 'completed';
207
- break;
208
- }
209
- }
210
- catch (failure) {
211
- error = timedOut ? incoming && !incoming.evidence.deliveryId ? 'Transport delivery deadline exceeded: no matching delivery arrived'
212
- : 'Native trial deadline exceeded' : failure instanceof Error ? failure.message : String(failure);
213
- status = cancellation.signal.aborted && !timedOut ? 'cancelled' : 'failed';
214
- // Thrown only synchronously after the cancellation check, so a deadline or abort never carries it.
215
- if (failure instanceof DeclaredLimitStop)
216
- limit = failure.limit;
217
- if (!blocked)
218
- await stop();
219
- try {
220
- native = await collectNativeEvidence(agent.runtimeHomePath, usageFile, agent.id, incoming ? undefined : executionId, agent.engine.model, incoming ? [] : others(), source);
221
- }
222
- catch (collectionError) {
223
- blocked = undefined;
224
- limit = undefined;
225
- await stop();
226
- error += `; evidence collection failed: ${String(collectionError)}`;
227
- }
228
- }
229
- finally {
230
- clearTimeout(timer);
231
- incoming?.finish();
232
- }
233
- const continuing = gate.finish(executionId, blocked === 'awaiting-external-input');
234
- if (blocked && !continuing)
235
- await stop();
236
- const result = { schema: 'spawnfile.training.daimon-native.trial.v1', trialId: options.trialId, wakeId,
237
- agentId: agent.id, model: agent.engine.model, ...(grok ? { engine: 'grok', reasoningEffort: grok.agent.reasoningEffort } : {}), configSha256: options.configSha256, scheduleOverride: 'disabled',
238
- ...(launch ? { preparation: { sourceConfigSha256: launch.sourceConfigSha256, instructions: launch.instructions, overrides: launch.overrides } } : {}),
239
- ...(incoming ? { transport: incoming.evidence } : {}), ...(taskClock ? { taskClock } : {}),
240
- status, startedAt, completedAt: new Date().toISOString(), executionId, receipt, activity, availability, native,
241
- ...(blocked ? { blocked } : {}), ...(limit ? { limit } : {}),
242
- coverage: [{ channel: 'tools', completeness: native.toolReceipts.length || native.traces.some(trace => trace.tools.length) ? 'partial' : 'absent', ordering: 'none' },
243
- { channel: 'output', completeness: 'absent', ordering: 'none' },
244
- { channel: 'usage', completeness: native.accounting?.coverage ?? nativeUsageCoverage(native, executionId), ordering: 'source' }],
245
- ...(error ? { error } : {}) };
246
- // This wake's own frame first, under a name no other delivery of this trial
247
- // writes, then the trial's latest frame. A trial that defers runs several
248
- // wakes and each one's account is evidence about that wake: renaming over one
249
- // file had the continuation's frame replace an assignment that really bound,
250
- // and the earlier account no longer existed by the time anything read it.
251
- await writeEvidence(wakeEvidenceFile(options.evidence, ordinal), result);
252
- await writeEvidence(options.evidence, result);
253
- return result;
254
- },
255
- };
256
- }
257
- function pause(milliseconds, signal) {
258
- if (signal.aborted)
259
- return Promise.resolve();
260
- return new Promise(resolve => {
261
- const done = () => { clearTimeout(timer); signal.removeEventListener('abort', done); resolve(); };
262
- const timer = setTimeout(done, milliseconds);
263
- signal.addEventListener('abort', done, { once: true });
264
- });
265
- }
266
- //# sourceMappingURL=control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"control.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/worker/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACrL,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACrN,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAyB,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtJ,OAAO,EAAE,YAAY,EAAmD,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,2BAA2B,EAAgC,MAAM,0BAA0B,CAAC;AAmBpJ,MAAM,UAAU,sBAAsB,CAAC,IAAgB,EAAE,MAAoB,EAAE,OAAsB,EACnG,KAAa,EAAE,MAAqB,EAAE,SAAmC;IACzE,MAAM,WAAW,GAAG;QAClB,WAAW,EAAE,CAAC,IAAwB,EAAE,EAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAA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AM,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;YACzE,MAAM,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC9C,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,YAAoB,EAAE,MAAmB;IACtD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,IAAI,GAAG,GAAS,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;QACxG,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC7C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,38 +0,0 @@
1
- import { type TransportDeliverySource } from './wake-delivery/index.js';
2
- import { type NativeLaunch } from '../receipt/index.js';
3
- export interface ExternalInputSource {
4
- kind: string;
5
- id: string;
6
- sha256: string;
7
- }
8
- export interface DeliveryControls {
9
- maxExternalDeliveries?: number;
10
- source?: ExternalInputSource;
11
- }
12
- /**
13
- * The most external continuations one trial may declare, and the wakes they cost.
14
- *
15
- * `MAX_TRIAL_WAKES` is the task delivery plus those continuations, and the worker's
16
- * runtime wake ceiling is derived from it rather than declared beside it. That
17
- * ceiling is published before any delivery arrives, so a separate number there
18
- * drifts from what this gate admits — and it drifted to one, which is how a trial
19
- * accepted a continuation the runtime would then never execute: the delivery stayed
20
- * admitted, nothing ran, and the wake burned to the shared trial deadline.
21
- */
22
- export declare const MAX_EXTERNAL_DELIVERIES = 3;
23
- export declare const MAX_TRIAL_WAKES: number;
24
- /** The per-wake timeout this worker hands Daimon: broker turn overrides may only lower the registration. */
25
- export declare function engineWakeTimeoutMs(timeoutMs: number, launch: NativeLaunch | undefined): number;
26
- export declare function verifyExternalSource(source: ExternalInputSource, text: string): void;
27
- /**
28
- * One task, explicitly bounded sequential external deliveries, never autonomous nudges.
29
- *
30
- * `maxExecutions` is the runtime's own per-agent execution policy. A budget this
31
- * gate would admit above it is one whose later continuations could never execute,
32
- * so it is refused here rather than deadlocking on the wake that cannot run.
33
- */
34
- export declare function createDeliveryGate(timeoutMs: number, maxExecutions?: number, delivery?: 'direct' | 'transport'): {
35
- executions: string[];
36
- begin(wakeId: string, text: string, controls?: DeliveryControls, source?: TransportDeliverySource): number;
37
- finish(executionId: string | undefined, awaitingInput: boolean): boolean;
38
- };
@@ -1,91 +0,0 @@
1
- import { createHash } from 'node:crypto';
2
- import { parseTransportSource } from './wake-delivery/index.js';
3
- import { isGrokLaunch } from '../receipt/index.js';
4
- /**
5
- * The most external continuations one trial may declare, and the wakes they cost.
6
- *
7
- * `MAX_TRIAL_WAKES` is the task delivery plus those continuations, and the worker's
8
- * runtime wake ceiling is derived from it rather than declared beside it. That
9
- * ceiling is published before any delivery arrives, so a separate number there
10
- * drifts from what this gate admits — and it drifted to one, which is how a trial
11
- * accepted a continuation the runtime would then never execute: the delivery stayed
12
- * admitted, nothing ran, and the wake burned to the shared trial deadline.
13
- */
14
- export const MAX_EXTERNAL_DELIVERIES = 3;
15
- export const MAX_TRIAL_WAKES = MAX_EXTERNAL_DELIVERIES + 1;
16
- /** The per-wake timeout this worker hands Daimon: broker turn overrides may only lower the registration. */
17
- export function engineWakeTimeoutMs(timeoutMs, launch) {
18
- return launch && isGrokLaunch(launch) ? Math.min(timeoutMs, launch.broker.limits.timeoutMs) : timeoutMs;
19
- }
20
- export function verifyExternalSource(source, text) {
21
- if (!source || Object.keys(source).sort().join(',') !== 'id,kind,sha256' ||
22
- !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/u.test(source.id) ||
23
- !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,79}$/u.test(source.kind) ||
24
- source.sha256 !== `sha256:${createHash('sha256').update(text).digest('hex')}`) {
25
- throw new Error('External input requires an exact bounded source identity and content digest');
26
- }
27
- }
28
- /**
29
- * One task, explicitly bounded sequential external deliveries, never autonomous nudges.
30
- *
31
- * `maxExecutions` is the runtime's own per-agent execution policy. A budget this
32
- * gate would admit above it is one whose later continuations could never execute,
33
- * so it is refused here rather than deadlocking on the wake that cannot run.
34
- */
35
- export function createDeliveryGate(timeoutMs, maxExecutions = MAX_TRIAL_WAKES, delivery = 'direct') {
36
- const wakes = new Set();
37
- const executions = [];
38
- let active = false;
39
- let deferred = false;
40
- let maximum = 0;
41
- let deadline;
42
- return {
43
- executions,
44
- begin(wakeId, text, controls = {}, source) {
45
- if (Object.keys(controls).some(key => !['maxExternalDeliveries', 'source'].includes(key)))
46
- throw new Error('Unknown delivery controls');
47
- if (active || wakes.has(wakeId) || wakes.size > maximum || wakes.size > 0 && !deferred)
48
- throw new Error('Worker accepts exactly one native trial delivery unless a bounded deferred continuation is declared');
49
- if (!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u.test(wakeId) || delivery === 'direct' && !text.trim() || Buffer.byteLength(text) > 16384)
50
- throw new Error('Invalid bounded trial delivery');
51
- if (delivery === 'transport') {
52
- const expected = parseTransportSource(source);
53
- if (wakes.size && expected.deliveryId === undefined)
54
- throw new Error('Transport continuation requires an exact delivery id');
55
- }
56
- else if (source !== undefined)
57
- throw new Error('Direct delivery cannot declare a transport source');
58
- if (!wakes.size) {
59
- maximum = controls.maxExternalDeliveries ?? 0;
60
- if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > MAX_EXTERNAL_DELIVERIES || controls.source)
61
- throw new Error('Invalid external delivery bound');
62
- if (maximum + 1 > maxExecutions)
63
- throw new Error('Native execution policy admits fewer executions than the declared delivery budget');
64
- }
65
- else {
66
- if (controls.maxExternalDeliveries !== undefined || delivery === 'direct' && !controls.source)
67
- throw new Error('Continuation requires a source and cannot change its delivery budget');
68
- if (controls.source)
69
- verifyExternalSource(controls.source, text);
70
- }
71
- deadline ??= Date.now() + timeoutMs;
72
- if (Date.now() >= deadline)
73
- throw new Error('Native trial deadline exceeded');
74
- wakes.add(wakeId);
75
- active = true;
76
- deferred = false;
77
- return deadline - Date.now();
78
- },
79
- finish(executionId, awaitingInput) {
80
- if (executionId !== undefined) {
81
- if (executions.includes(executionId))
82
- throw new Error('Native execution ID was reused');
83
- executions.push(executionId);
84
- }
85
- active = false;
86
- deferred = awaitingInput;
87
- return awaitingInput && wakes.size <= maximum;
88
- },
89
- };
90
- }
91
- //# sourceMappingURL=deliveries.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deliveries.js","sourceRoot":"","sources":["../../../../../../src/runtime/daimon/training/native/worker/deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAgC,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAqB,MAAM,qBAAqB,CAAC;AAKtE;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,GAAG,CAAC,CAAC;AAE3D,4GAA4G;AAC5G,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,MAAgC;IACrF,OAAO,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1G,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAA2B,EAAE,I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,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACnE,CAAC;YACD,QAAQ,KAAK,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YACpC,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAC9E,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAAC,MAAM,GAAG,IAAI,CAAC;YAAC,QAAQ,GAAG,KAAK,CAAC;YACnD,OAAO,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,WAA+B,EAAE,aAAsB;YAC5D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;gBAC9B,IAAI,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBACxF,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/B,CAAC;YACD,MAAM,GAAG,KAAK,CAAC;YACf,QAAQ,GAAG,aAAa,CAAC;YACzB,OAAO,aAAa,IAAI,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,54 +0,0 @@
1
- import type { NativeEvidence, NativeEvidenceSource, NativeGrokUsage, NativeRequestUsage, NativeTrace, NativeTurnSeal } from '../types.js';
2
- export declare function readClosedTraces(runtimeHome: string, agentId: string, settleEmpty?: boolean): Promise<NativeTrace[]>;
3
- /**
4
- * Complete observed terminal usage requires one matching, closed native execution.
5
- *
6
- * The single trace and single usage row are this WAKE's, not this trial's: what
7
- * reaches here is already attributed to the bound execution, so a three-wake
8
- * trial still arrives with one of each per wake. The arity states that nothing
9
- * accounts for this execution twice, never how many wakes a trial may have.
10
- */
11
- export declare function nativeUsageCoverage(native: NativeEvidence, executionId?: string): 'complete' | 'partial' | 'absent';
12
- export declare function readToolReceipts(runtimeHome: string, agentId: string, engine?: NativeEvidenceSource['engine']): Promise<Record<string, unknown>[]>;
13
- /**
14
- * One wake's own evidence, separated from the rest of its trial's by attribution.
15
- *
16
- * `others` is the trial's other executions as the RUNTIME named them, never a
17
- * count. Isolation is still refused where it can actually fail: a trace or row
18
- * that is not this agent's, and a model context that is not the declared model.
19
- * What is left is this trial's own work in a runtime home this worker asserted
20
- * empty before it started, so an execution beside this wake's is its history.
21
- */
22
- export declare function collectNativeEvidence(runtimeHome: string, usageFile: string, agentId: string, executionId: string | undefined, expectedModel: string, others?: readonly string[], source?: NativeEvidenceSource): Promise<NativeEvidence>;
23
- /** Plausibility bound for one broker turn's notional USD (Daimon caps a turn at 10M tokens); larger values are malformed, not spend. */
24
- export declare const GROK_TURN_NOTIONAL_USD_MAX = 100;
25
- export declare const plausibleNotionalUsd: (value: unknown) => value is number;
26
- /**
27
- * The spend the broker sealed, read without a terminal frame to bind it to.
28
- *
29
- * The ordinary path binds every usage row to the closed execution the worker
30
- * reported. When the worker never answers, that binding does not exist and the
31
- * rows are still the only record of money already spent — the broker's proxy
32
- * metered every request and seals a failed turn's partial usage exactly as it
33
- * seals a completed one. So this reads the same ledger with the same strict
34
- * schema and the same dedupe-by-`turn`, and simply has no execution to filter
35
- * on; the per-slot ledger is wiped by every recycle, so its rows are this
36
- * trial's. It is never the path a scored trial takes.
37
- */
38
- export declare function readSealedGrokUsage(usageFile: string, agentId: string, expectedModel: string): Promise<NativeGrokUsage[]>;
39
- export declare function assertFreshNativeEvidence(runtimeHome: string, usageFile: string, agentId: string, expectedModel: string, source?: NativeEvidenceSource): Promise<void>;
40
- /**
41
- * The per-request rows the broker's proxy metered, read with no terminal frame
42
- * to bind them to.
43
- *
44
- * The sibling of `readSealedGrokUsage` over the second stream the broker writes
45
- * beside the usage ledger: one row per provider request, with the proxy's own
46
- * `started_at`/`ended_at`. It is the only record that can tell a request that
47
- * was issued and never answered (a row with a start and no end) from one that
48
- * was never issued at all (no row) — the distinction a turn killed by its
49
- * deadline cannot otherwise be diagnosed by. Same strict schema, same
50
- * dedupe-by-`turn:request`, and no execution to filter on.
51
- */
52
- export declare function readSealedGrokRequests(requestsFile: string, agentId: string, expectedModel: string): Promise<NativeRequestUsage[]>;
53
- /** Broker-sealed terminal observations; validate before attribution and deduplicate replays. */
54
- export declare function readSealedGrokTurnSeals(sealFile: string, agentId: string, expectedModel: string): Promise<NativeTurnSeal[]>;