spawnfile 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/README.md +1 -1
  2. package/dist/auth/importers.js +21 -5
  3. package/dist/auth/index.d.ts +1 -0
  4. package/dist/auth/index.js +1 -0
  5. package/dist/auth/profileStore.js +4 -1
  6. package/dist/auth/trainingGrokWriteback.d.ts +4 -0
  7. package/dist/auth/trainingGrokWriteback.js +119 -0
  8. package/dist/auth/trainingGrokWritebackLock.d.ts +5 -0
  9. package/dist/auth/trainingGrokWritebackLock.js +56 -0
  10. package/dist/cli/authCommands.js +9 -5
  11. package/dist/cli/compileBuildCommands.js +4 -0
  12. package/dist/cli/devCommands.js +4 -2
  13. package/dist/cli/downCommand.d.ts +2 -0
  14. package/dist/cli/downCommand.js +3 -0
  15. package/dist/cli/envFileOption.d.ts +18 -0
  16. package/dist/cli/envFileOption.js +20 -0
  17. package/dist/cli/lifecycleCommands.d.ts +1 -1
  18. package/dist/cli/lifecycleCommands.js +3 -1
  19. package/dist/cli/lifecyclePlan.d.ts +1 -0
  20. package/dist/cli/lifecyclePlan.js +2 -0
  21. package/dist/cli/paideiaDelegation.d.ts +2 -1
  22. package/dist/cli/paideiaDelegation.js +5 -4
  23. package/dist/cli/recordCommands.d.ts +17 -0
  24. package/dist/cli/recordCommands.js +43 -0
  25. package/dist/cli/releaseCommand.d.ts +6 -0
  26. package/dist/cli/releaseCommand.js +91 -0
  27. package/dist/cli/runCli.d.ts +7 -1
  28. package/dist/cli/runCli.js +11 -6
  29. package/dist/cli/runPublishCommands.js +5 -3
  30. package/dist/cli/trainCommand.js +73 -20
  31. package/dist/cli/upCommand.js +5 -1
  32. package/dist/cli/volumeCommands.d.ts +8 -0
  33. package/dist/cli/volumeCommands.js +53 -0
  34. package/dist/compiler/agentNodeMerge.js +3 -2
  35. package/dist/compiler/buildCompilePlan.js +4 -0
  36. package/dist/compiler/buildCompilePlanAgent.js +3 -1
  37. package/dist/compiler/buildCompilePlanTraversal.js +2 -0
  38. package/dist/compiler/buildCompilePlanTraversalHelpers.d.ts +2 -2
  39. package/dist/compiler/buildCompilePlanTraversalHelpers.js +4 -3
  40. package/dist/compiler/buildProject.d.ts +10 -0
  41. package/dist/compiler/buildProject.js +14 -2
  42. package/dist/compiler/cleanCompileOutput.d.ts +2 -0
  43. package/dist/compiler/cleanCompileOutput.js +14 -0
  44. package/dist/compiler/compilePlanHelpers.js +2 -0
  45. package/dist/compiler/compileProject.d.ts +10 -0
  46. package/dist/compiler/compileProject.js +29 -3
  47. package/dist/compiler/containerArtifactSummaries.js +1 -0
  48. package/dist/compiler/containerArtifacts.d.ts +4 -4
  49. package/dist/compiler/containerArtifacts.js +18 -34
  50. package/dist/compiler/containerArtifactsPlans.js +7 -0
  51. package/dist/compiler/containerArtifactsTypes.d.ts +7 -0
  52. package/dist/compiler/containerDaimonBrokerRender.d.ts +3 -1
  53. package/dist/compiler/containerDaimonBrokerRender.js +6 -3
  54. package/dist/compiler/containerDaimonGrokTaskClock.d.ts +5 -0
  55. package/dist/compiler/containerDaimonGrokTaskClock.js +29 -0
  56. package/dist/compiler/containerDaimonGrokWorkerProvisioning.d.ts +1 -1
  57. package/dist/compiler/containerDaimonGrokWorkerProvisioning.js +38 -16
  58. package/dist/compiler/containerDaimonGrokWorkerRender.d.ts +33 -8
  59. package/dist/compiler/containerDaimonGrokWorkerRender.js +18 -5
  60. package/dist/compiler/containerDaimonOwnershipGuardRender.d.ts +14 -1
  61. package/dist/compiler/containerDaimonOwnershipGuardRender.js +15 -2
  62. package/dist/compiler/containerDaimonUidEntrypointRender.js +6 -12
  63. package/dist/compiler/containerTargetResources.d.ts +10 -0
  64. package/dist/compiler/containerTargetResources.js +21 -13
  65. package/dist/compiler/containerWorkspaceResourceRender.js +4 -1
  66. package/dist/compiler/index.d.ts +2 -0
  67. package/dist/compiler/index.js +2 -0
  68. package/dist/compiler/mcpPlaceholders.d.ts +11 -0
  69. package/dist/compiler/mcpPlaceholders.js +58 -0
  70. package/dist/compiler/mcpServerInheritance.d.ts +18 -0
  71. package/dist/compiler/mcpServerInheritance.js +43 -0
  72. package/dist/compiler/moltnetArtifactTypes.d.ts +1 -0
  73. package/dist/compiler/moltnetArtifacts.js +1 -0
  74. package/dist/compiler/preflightCompilePlan.d.ts +9 -0
  75. package/dist/compiler/preflightCompilePlan.js +38 -0
  76. package/dist/compiler/recordingAgentFacts.d.ts +4 -0
  77. package/dist/compiler/recordingAgentFacts.js +35 -0
  78. package/dist/compiler/recordingCapability.d.ts +4 -0
  79. package/dist/compiler/recordingCapability.js +22 -0
  80. package/dist/compiler/recordingReport.d.ts +4 -0
  81. package/dist/compiler/recordingReport.js +18 -0
  82. package/dist/compiler/runProject.d.ts +2 -1
  83. package/dist/compiler/runProject.js +2 -0
  84. package/dist/compiler/surfaces.d.ts +1 -2
  85. package/dist/compiler/surfaces.js +0 -1
  86. package/dist/compiler/syncProjectAuth.js +2 -1
  87. package/dist/compiler/training/broker/clockProbe.d.ts +6 -0
  88. package/dist/compiler/training/broker/clockProbe.js +27 -0
  89. package/dist/compiler/training/broker/declaration.d.ts +4 -2
  90. package/dist/compiler/training/broker/declaration.js +4 -2
  91. package/dist/compiler/training/broker/entrypoint.js +33 -18
  92. package/dist/compiler/training/broker/evaluatorSecrets.d.ts +2 -0
  93. package/dist/compiler/training/broker/evaluatorSecrets.js +60 -0
  94. package/dist/compiler/training/broker/index.d.ts +3 -2
  95. package/dist/compiler/training/broker/index.js +3 -2
  96. package/dist/compiler/training/broker/main.js +1 -1
  97. package/dist/compiler/training/broker/paths.d.ts +96 -56
  98. package/dist/compiler/training/broker/paths.js +97 -89
  99. package/dist/compiler/training/broker/processes.d.ts +9 -0
  100. package/dist/compiler/training/broker/processes.js +4 -1
  101. package/dist/compiler/training/broker/projection.d.ts +3 -2
  102. package/dist/compiler/training/broker/projection.js +21 -9
  103. package/dist/compiler/training/broker/provisioning.d.ts +6 -15
  104. package/dist/compiler/training/broker/provisioning.js +71 -53
  105. package/dist/compiler/training/broker/registration.d.ts +3 -1
  106. package/dist/compiler/training/broker/registration.js +29 -21
  107. package/dist/compiler/training/broker/reset.d.ts +9 -0
  108. package/dist/compiler/training/broker/reset.js +71 -0
  109. package/dist/compiler/training/broker/runtime.d.ts +10 -13
  110. package/dist/compiler/training/broker/runtime.js +69 -115
  111. package/dist/compiler/training/broker/supervisor.d.ts +10 -11
  112. package/dist/compiler/training/broker/supervisor.js +22 -23
  113. package/dist/compiler/training/broker/taskClock.d.ts +5 -0
  114. package/dist/compiler/training/broker/taskClock.js +41 -0
  115. package/dist/compiler/training/compiledAgent.d.ts +21 -0
  116. package/dist/compiler/training/compiledAgent.js +62 -0
  117. package/dist/compiler/training/container/contract.d.ts +23 -0
  118. package/dist/compiler/training/container/contract.js +23 -5
  119. package/dist/compiler/training/container/evaluators.d.ts +48 -0
  120. package/dist/compiler/training/container/evaluators.js +50 -0
  121. package/dist/compiler/training/container/grokWriteback.d.ts +8 -0
  122. package/dist/compiler/training/container/grokWriteback.js +26 -0
  123. package/dist/compiler/training/container/index.d.ts +2 -1
  124. package/dist/compiler/training/container/index.js +2 -1
  125. package/dist/compiler/training/container/launch.d.ts +3 -0
  126. package/dist/compiler/training/container/launch.js +119 -28
  127. package/dist/compiler/training/container/nativeSlots.d.ts +14 -0
  128. package/dist/compiler/training/container/nativeSlots.js +13 -0
  129. package/dist/compiler/training/container/outputCopy.d.ts +2 -0
  130. package/dist/compiler/training/container/outputCopy.js +72 -0
  131. package/dist/compiler/training/container/outputVolume.d.ts +27 -0
  132. package/dist/compiler/training/container/outputVolume.js +161 -0
  133. package/dist/compiler/training/container/prepare.d.ts +3 -1
  134. package/dist/compiler/training/container/prepare.js +57 -12
  135. package/dist/compiler/training/container/security.d.ts +5 -3
  136. package/dist/compiler/training/container/security.js +15 -5
  137. package/dist/compiler/training/container/subjectIsolation.d.ts +5 -0
  138. package/dist/compiler/training/container/subjectIsolation.js +15 -0
  139. package/dist/compiler/training/context.d.ts +8 -0
  140. package/dist/compiler/training/context.js +12 -12
  141. package/dist/compiler/training/contract.d.ts +2 -0
  142. package/dist/compiler/training/contract.js +2 -0
  143. package/dist/compiler/training/execution.d.ts +417 -0
  144. package/dist/compiler/training/execution.js +160 -0
  145. package/dist/compiler/training/index.d.ts +8 -0
  146. package/dist/compiler/training/index.js +7 -0
  147. package/dist/compiler/training/moments.d.ts +80 -0
  148. package/dist/compiler/training/moments.js +118 -0
  149. package/dist/compiler/training/output.d.ts +2 -0
  150. package/dist/compiler/training/output.js +20 -0
  151. package/dist/compiler/training/plan/contract.d.ts +287 -0
  152. package/dist/compiler/training/plan/contract.js +49 -0
  153. package/dist/compiler/training/plan/index.d.ts +5 -0
  154. package/dist/compiler/training/plan/index.js +4 -0
  155. package/dist/compiler/training/plan/load.d.ts +9 -0
  156. package/dist/compiler/training/plan/load.js +153 -0
  157. package/dist/compiler/training/plan/references.d.ts +19 -0
  158. package/dist/compiler/training/plan/references.js +57 -0
  159. package/dist/compiler/training/plan/resolve.d.ts +4 -0
  160. package/dist/compiler/training/plan/resolve.js +73 -0
  161. package/dist/compiler/training/plan/targets.d.ts +11 -0
  162. package/dist/compiler/training/plan/targets.js +71 -0
  163. package/dist/compiler/training/plan/types.d.ts +36 -0
  164. package/dist/compiler/training/plan/types.js +1 -0
  165. package/dist/compiler/training/preparation/assets/Dockerfile +13 -2
  166. package/dist/compiler/training/preparation/assets/package-lock.json +2 -2
  167. package/dist/compiler/training/preparation/broker.d.ts +3 -3
  168. package/dist/compiler/training/preparation/broker.js +6 -4
  169. package/dist/compiler/training/preparation/contract.d.ts +27 -2
  170. package/dist/compiler/training/preparation/contract.js +23 -4
  171. package/dist/compiler/training/preparation/files.d.ts +5 -1
  172. package/dist/compiler/training/preparation/files.js +76 -15
  173. package/dist/compiler/training/preparation/image.js +9 -4
  174. package/dist/compiler/training/preparation/inputs.d.ts +1 -0
  175. package/dist/compiler/training/preparation/inputs.js +18 -10
  176. package/dist/compiler/training/preparation/prepare.d.ts +5 -0
  177. package/dist/compiler/training/preparation/prepare.js +66 -29
  178. package/dist/compiler/training/preparation/scratch.d.ts +6 -17
  179. package/dist/compiler/training/preparation/scratch.js +89 -23
  180. package/dist/compiler/training/repair/contract.d.ts +338 -4
  181. package/dist/compiler/training/repair/contract.js +2 -0
  182. package/dist/compiler/training/repair/index.d.ts +1 -1
  183. package/dist/compiler/training/repair/index.js +1 -1
  184. package/dist/compiler/training/repair/prepare.d.ts +155 -3
  185. package/dist/compiler/training/repair/prepare.js +6 -2
  186. package/dist/compiler/training/repair/witness.d.ts +152 -3
  187. package/dist/compiler/training/repair/witness.js +8 -2
  188. package/dist/compiler/training/resolution.d.ts +25 -0
  189. package/dist/compiler/training/resolution.js +69 -0
  190. package/dist/compiler/training/rewind/contract.d.ts +321 -0
  191. package/dist/compiler/training/rewind/contract.js +39 -0
  192. package/dist/compiler/training/rewind/deployedResource.d.ts +22 -0
  193. package/dist/compiler/training/rewind/deployedResource.js +19 -0
  194. package/dist/compiler/training/rewind/feed.d.ts +12 -0
  195. package/dist/compiler/training/rewind/feed.js +182 -0
  196. package/dist/compiler/training/rewind/feedContent.d.ts +6 -0
  197. package/dist/compiler/training/rewind/feedContent.js +38 -0
  198. package/dist/compiler/training/rewind/git.d.ts +8 -0
  199. package/dist/compiler/training/rewind/git.js +159 -0
  200. package/dist/compiler/training/rewind/gitArchive.d.ts +2 -0
  201. package/dist/compiler/training/rewind/gitArchive.js +7 -0
  202. package/dist/compiler/training/rewind/gitHistory.d.ts +3 -0
  203. package/dist/compiler/training/rewind/gitHistory.js +55 -0
  204. package/dist/compiler/training/rewind/gitProcess.d.ts +19 -0
  205. package/dist/compiler/training/rewind/gitProcess.js +81 -0
  206. package/dist/compiler/training/rewind/gitTree.d.ts +14 -0
  207. package/dist/compiler/training/rewind/gitTree.js +90 -0
  208. package/dist/compiler/training/rewind/history.d.ts +28 -0
  209. package/dist/compiler/training/rewind/history.js +239 -0
  210. package/dist/compiler/training/rewind/index.d.ts +18 -0
  211. package/dist/compiler/training/rewind/index.js +15 -0
  212. package/dist/compiler/training/rewind/inputs.d.ts +9 -0
  213. package/dist/compiler/training/rewind/inputs.js +67 -0
  214. package/dist/compiler/training/rewind/instant.d.ts +4 -0
  215. package/dist/compiler/training/rewind/instant.js +24 -0
  216. package/dist/compiler/training/rewind/leakCheck.d.ts +10 -0
  217. package/dist/compiler/training/rewind/leakCheck.js +56 -0
  218. package/dist/compiler/training/rewind/leakFeed.d.ts +5 -0
  219. package/dist/compiler/training/rewind/leakFeed.js +25 -0
  220. package/dist/compiler/training/rewind/leakFiles.d.ts +10 -0
  221. package/dist/compiler/training/rewind/leakFiles.js +106 -0
  222. package/dist/compiler/training/rewind/leakGit.d.ts +3 -0
  223. package/dist/compiler/training/rewind/leakGit.js +78 -0
  224. package/dist/compiler/training/rewind/leakGitPayload.d.ts +4 -0
  225. package/dist/compiler/training/rewind/leakGitPayload.js +57 -0
  226. package/dist/compiler/training/rewind/leakInputs.d.ts +7 -0
  227. package/dist/compiler/training/rewind/leakInputs.js +135 -0
  228. package/dist/compiler/training/rewind/leakLayout.d.ts +2 -0
  229. package/dist/compiler/training/rewind/leakLayout.js +17 -0
  230. package/dist/compiler/training/rewind/leakProvenance.d.ts +3 -0
  231. package/dist/compiler/training/rewind/leakProvenance.js +88 -0
  232. package/dist/compiler/training/rewind/materialize.d.ts +136 -0
  233. package/dist/compiler/training/rewind/materialize.js +212 -0
  234. package/dist/compiler/training/rewind/memory.d.ts +10 -0
  235. package/dist/compiler/training/rewind/memory.js +84 -0
  236. package/dist/compiler/training/rewind/memorySchemas.d.ts +87 -0
  237. package/dist/compiler/training/rewind/memorySchemas.js +50 -0
  238. package/dist/compiler/training/rewind/moltnet.d.ts +2 -0
  239. package/dist/compiler/training/rewind/moltnet.js +54 -0
  240. package/dist/compiler/training/rewind/moltnetJson.d.ts +13 -0
  241. package/dist/compiler/training/rewind/moltnetJson.js +180 -0
  242. package/dist/compiler/training/rewind/moltnetSchemas.d.ts +1226 -0
  243. package/dist/compiler/training/rewind/moltnetSchemas.js +75 -0
  244. package/dist/compiler/training/rewind/moltnetSqlite.d.ts +31 -0
  245. package/dist/compiler/training/rewind/moltnetSqlite.js +192 -0
  246. package/dist/compiler/training/rewind/moltnetSqliteData.d.ts +10 -0
  247. package/dist/compiler/training/rewind/moltnetSqliteData.js +113 -0
  248. package/dist/compiler/training/rewind/recordInput.d.ts +40 -0
  249. package/dist/compiler/training/rewind/recordInput.js +49 -0
  250. package/dist/compiler/training/rewind/recordedBundle.d.ts +4 -0
  251. package/dist/compiler/training/rewind/recordedBundle.js +58 -0
  252. package/dist/compiler/training/rewind/recordedCommit.d.ts +2 -0
  253. package/dist/compiler/training/rewind/recordedCommit.js +10 -0
  254. package/dist/compiler/training/rewind/select.d.ts +18 -0
  255. package/dist/compiler/training/rewind/select.js +64 -0
  256. package/dist/compiler/training/rewind/snapshotManifest.d.ts +42 -0
  257. package/dist/compiler/training/rewind/snapshotManifest.js +134 -0
  258. package/dist/compiler/training/rewind/taskClock.d.ts +12 -0
  259. package/dist/compiler/training/rewind/taskClock.js +40 -0
  260. package/dist/compiler/training/rewind/timestamps.d.ts +4 -0
  261. package/dist/compiler/training/rewind/timestamps.js +26 -0
  262. package/dist/compiler/training/rewind/types.d.ts +43 -0
  263. package/dist/compiler/training/rewind/types.js +1 -0
  264. package/dist/compiler/training/rewind/volumes.d.ts +12 -0
  265. package/dist/compiler/training/rewind/volumes.js +58 -0
  266. package/dist/compiler/training/selection.d.ts +7 -0
  267. package/dist/compiler/training/selection.js +15 -0
  268. package/dist/compiler/types.d.ts +6 -3
  269. package/dist/compiler/upProject.d.ts +1 -0
  270. package/dist/compiler/upProject.js +21 -5
  271. package/dist/compiler/workspaceBundleArtifacts.d.ts +16 -1
  272. package/dist/compiler/workspaceBundleArtifacts.js +69 -20
  273. package/dist/compiler/workspaceBundleCache.d.ts +23 -0
  274. package/dist/compiler/workspaceBundleCache.js +79 -0
  275. package/dist/compiler/workspaceBundleDependencies.d.ts +21 -0
  276. package/dist/compiler/workspaceBundleDependencies.js +122 -0
  277. package/dist/compiler/workspaceBundleFiles.d.ts +51 -0
  278. package/dist/compiler/workspaceBundleFiles.js +251 -0
  279. package/dist/compiler/workspaceBundleGenerated.d.ts +25 -0
  280. package/dist/compiler/workspaceBundleGenerated.js +103 -0
  281. package/dist/compiler/workspaceBundleGit.d.ts +64 -0
  282. package/dist/compiler/workspaceBundleGit.js +154 -0
  283. package/dist/compiler/workspaceBundleKey.d.ts +34 -0
  284. package/dist/compiler/workspaceBundleKey.js +17 -0
  285. package/dist/compiler/workspaceBundleResolve.d.ts +56 -0
  286. package/dist/compiler/workspaceBundleResolve.js +144 -0
  287. package/dist/compiler/workspaceBundleRun.d.ts +41 -0
  288. package/dist/compiler/workspaceBundleRun.js +79 -0
  289. package/dist/compiler/workspaceBundleTar.d.ts +47 -0
  290. package/dist/compiler/workspaceBundleTar.js +140 -0
  291. package/dist/compiler/workspaceBundleTree.d.ts +15 -0
  292. package/dist/compiler/workspaceBundleTree.js +58 -0
  293. package/dist/compiler/workspaceGitFetch.d.ts +41 -0
  294. package/dist/compiler/workspaceGitFetch.js +155 -0
  295. package/dist/compiler/workspaceGitPins.d.ts +33 -0
  296. package/dist/compiler/workspaceGitPins.js +127 -0
  297. package/dist/compiler/workspaceResources.d.ts +5 -1
  298. package/dist/compiler/workspaceResources.js +32 -5
  299. package/dist/deployment/activation.d.ts +3 -0
  300. package/dist/deployment/activation.js +12 -0
  301. package/dist/deployment/canaryCutover.d.ts +1 -1
  302. package/dist/deployment/candidateRecording.d.ts +8 -0
  303. package/dist/deployment/candidateRecording.js +22 -0
  304. package/dist/deployment/dockerManager.d.ts +5 -3
  305. package/dist/deployment/dockerManager.js +12 -2
  306. package/dist/deployment/downDeployment.d.ts +2 -0
  307. package/dist/deployment/downDeployment.js +6 -2
  308. package/dist/deployment/homeStore.d.ts +9 -1
  309. package/dist/deployment/homeStore.js +16 -53
  310. package/dist/deployment/index.d.ts +6 -0
  311. package/dist/deployment/index.js +6 -0
  312. package/dist/deployment/pidLock.d.ts +25 -0
  313. package/dist/deployment/pidLock.js +81 -0
  314. package/dist/deployment/record.d.ts +85 -1
  315. package/dist/deployment/record.js +11 -5
  316. package/dist/deployment/recordPublication.d.ts +15 -0
  317. package/dist/deployment/recordPublication.js +76 -0
  318. package/dist/deployment/recordedMemoryRetention.d.ts +18 -0
  319. package/dist/deployment/recordedMemoryRetention.js +27 -0
  320. package/dist/deployment/resourceLog.d.ts +140 -0
  321. package/dist/deployment/resourceLog.js +78 -0
  322. package/dist/distribution/buildDistributionReport.d.ts +3 -0
  323. package/dist/distribution/buildDistributionReport.js +5 -0
  324. package/dist/distribution/consumeImage.d.ts +3 -0
  325. package/dist/distribution/consumeImage.js +23 -31
  326. package/dist/distribution/consumeImageLifecycle.d.ts +4 -1
  327. package/dist/distribution/consumeImageLifecycle.js +14 -3
  328. package/dist/distribution/consumeImageSupport.d.ts +7 -0
  329. package/dist/distribution/consumeImageSupport.js +25 -0
  330. package/dist/distribution/distributionReportSchema.d.ts +47 -0
  331. package/dist/distribution/distributionReportSchema.js +20 -0
  332. package/dist/distribution/renderImageInterface.js +1 -1
  333. package/dist/distribution/types.d.ts +15 -0
  334. package/dist/filesystem/durableWrite.d.ts +10 -0
  335. package/dist/filesystem/durableWrite.js +87 -0
  336. package/dist/filesystem/index.d.ts +2 -0
  337. package/dist/filesystem/index.js +2 -0
  338. package/dist/filesystem/retainedJsonl.d.ts +23 -0
  339. package/dist/filesystem/retainedJsonl.js +123 -0
  340. package/dist/manifest/commandSchemas.d.ts +5 -0
  341. package/dist/manifest/commandSchemas.js +5 -0
  342. package/dist/manifest/executionSchemas.d.ts +20 -0
  343. package/dist/manifest/executionSchemas.js +13 -3
  344. package/dist/manifest/index.d.ts +2 -0
  345. package/dist/manifest/index.js +2 -0
  346. package/dist/manifest/loadManifest.js +3 -26
  347. package/dist/manifest/mcpSchemas.d.ts +61 -0
  348. package/dist/manifest/mcpSchemas.js +57 -11
  349. package/dist/manifest/memorySchemas.d.ts +1 -1
  350. package/dist/manifest/memorySchemas.js +1 -1
  351. package/dist/manifest/parseManifest.d.ts +7 -0
  352. package/dist/manifest/parseManifest.js +65 -0
  353. package/dist/manifest/renderSpawnfile.js +4 -1
  354. package/dist/manifest/renderSpawnfileWorkspace.js +6 -2
  355. package/dist/manifest/schemas.d.ts +1206 -132
  356. package/dist/manifest/schemas.js +14 -4
  357. package/dist/manifest/teamNetworkSchemas.d.ts +1 -1
  358. package/dist/manifest/trainingDataSchemas.d.ts +357 -0
  359. package/dist/manifest/trainingDataSchemas.js +31 -0
  360. package/dist/manifest/trainingSchemas.d.ts +49 -0
  361. package/dist/manifest/trainingSchemas.js +44 -0
  362. package/dist/manifest/volumeFeedSchemas.d.ts +52 -0
  363. package/dist/manifest/volumeFeedSchemas.js +104 -0
  364. package/dist/manifest/workspaceSchemas.d.ts +182 -5
  365. package/dist/manifest/workspaceSchemas.js +111 -7
  366. package/dist/recording/compose.d.ts +3 -0
  367. package/dist/recording/compose.js +93 -0
  368. package/dist/recording/deployment.d.ts +15 -0
  369. package/dist/recording/deployment.js +38 -0
  370. package/dist/recording/history.d.ts +16 -0
  371. package/dist/recording/history.js +47 -0
  372. package/dist/recording/index.d.ts +9 -0
  373. package/dist/recording/index.js +9 -0
  374. package/dist/recording/moment.d.ts +61 -0
  375. package/dist/recording/moment.js +36 -0
  376. package/dist/recording/parse.d.ts +15 -0
  377. package/dist/recording/parse.js +74 -0
  378. package/dist/recording/read.d.ts +8 -0
  379. package/dist/recording/read.js +61 -0
  380. package/dist/recording/store.d.ts +10 -0
  381. package/dist/recording/store.js +94 -0
  382. package/dist/recording/sync.d.ts +24 -0
  383. package/dist/recording/sync.js +126 -0
  384. package/dist/recording/types.d.ts +45 -0
  385. package/dist/recording/types.js +2 -0
  386. package/dist/release/drainControl.d.ts +54 -0
  387. package/dist/release/drainControl.js +137 -0
  388. package/dist/release/drainPhase.d.ts +37 -0
  389. package/dist/release/drainPhase.js +161 -0
  390. package/dist/release/index.d.ts +11 -0
  391. package/dist/release/index.js +11 -0
  392. package/dist/release/ledger.d.ts +75 -0
  393. package/dist/release/ledger.js +111 -0
  394. package/dist/release/notify.d.ts +58 -0
  395. package/dist/release/notify.js +126 -0
  396. package/dist/release/pending.d.ts +35 -0
  397. package/dist/release/pending.js +60 -0
  398. package/dist/release/postDeploy.d.ts +32 -0
  399. package/dist/release/postDeploy.js +62 -0
  400. package/dist/release/releaseDefaults.d.ts +9 -0
  401. package/dist/release/releaseDefaults.js +115 -0
  402. package/dist/release/releaseDocker.d.ts +38 -0
  403. package/dist/release/releaseDocker.js +94 -0
  404. package/dist/release/releaseTypes.d.ts +94 -0
  405. package/dist/release/releaseTypes.js +1 -0
  406. package/dist/release/runRelease.d.ts +9 -0
  407. package/dist/release/runRelease.js +218 -0
  408. package/dist/release/swap.d.ts +23 -0
  409. package/dist/release/swap.js +55 -0
  410. package/dist/release/types.d.ts +50 -0
  411. package/dist/release/types.js +29 -0
  412. package/dist/report/index.d.ts +1 -0
  413. package/dist/report/index.js +1 -0
  414. package/dist/report/recording.d.ts +57 -0
  415. package/dist/report/recording.js +26 -0
  416. package/dist/report/types.d.ts +58 -0
  417. package/dist/runtime/container.js +8 -13
  418. package/dist/runtime/daimon/adapter.js +15 -4
  419. package/dist/runtime/daimon/config.d.ts +4 -0
  420. package/dist/runtime/daimon/config.js +53 -4
  421. package/dist/runtime/daimon/contract-manifest.json +1 -0
  422. package/dist/runtime/daimon/contract-manifest.sha256 +1 -0
  423. package/dist/runtime/daimon/contractManifest.d.ts +59 -8
  424. package/dist/runtime/daimon/contractManifest.js +26 -10
  425. package/dist/runtime/daimon/grokTurnLimits.d.ts +25 -0
  426. package/dist/runtime/daimon/grokTurnLimits.js +51 -0
  427. package/dist/runtime/daimon/grokWorkerConfigBytes.d.ts +17 -0
  428. package/dist/runtime/daimon/grokWorkerConfigBytes.js +17 -0
  429. package/dist/runtime/daimon/grokWorkerContract.d.ts +5 -0
  430. package/dist/runtime/daimon/grokWorkerContract.js +13 -1
  431. package/dist/runtime/daimon/recording.d.ts +19 -0
  432. package/dist/runtime/daimon/recording.js +50 -0
  433. package/dist/runtime/daimon/scheduleAuthority.d.ts +8 -0
  434. package/dist/runtime/daimon/scheduleAuthority.js +19 -5
  435. package/dist/runtime/daimon/wakeMoments.d.ts +15 -0
  436. package/dist/runtime/daimon/wakeMoments.js +17 -0
  437. package/dist/runtime/daimonInstall.d.ts +3 -0
  438. package/dist/runtime/daimonInstall.js +25 -0
  439. package/dist/runtime/index.d.ts +1 -0
  440. package/dist/runtime/index.js +1 -0
  441. package/dist/runtime/install.d.ts +2 -0
  442. package/dist/runtime/install.js +1 -0
  443. package/dist/runtime/openclaw/adapter.js +3 -0
  444. package/dist/runtime/pi/adapter.js +3 -0
  445. package/dist/runtime/pi/containerTargets.js +6 -0
  446. package/dist/runtime/picoclaw/adapter.js +3 -0
  447. package/dist/runtime/registry.d.ts +3 -0
  448. package/dist/runtime/registry.js +13 -1
  449. package/dist/runtime/types.d.ts +15 -0
  450. package/dist/runtime/usageLedgerRead.d.ts +6 -0
  451. package/dist/runtime/usageLedgerRead.js +3 -3
  452. package/dist/shared/index.d.ts +1 -0
  453. package/dist/shared/index.js +1 -0
  454. package/dist/shared/recording.d.ts +8 -0
  455. package/dist/shared/recording.js +25 -0
  456. package/dist/target/dockerCommandExecutorCore.js +1 -1
  457. package/dist/target/dockerTargetBinding.js +2 -1
  458. package/dist/volume/feedLand.d.ts +31 -0
  459. package/dist/volume/feedLand.js +174 -0
  460. package/dist/volume/feedLandings.d.ts +45 -0
  461. package/dist/volume/feedLandings.js +111 -0
  462. package/dist/volume/feedLayout.d.ts +61 -0
  463. package/dist/volume/feedLayout.js +234 -0
  464. package/dist/volume/feedLock.d.ts +7 -0
  465. package/dist/volume/feedLock.js +131 -0
  466. package/dist/volume/feedManifest.d.ts +27 -0
  467. package/dist/volume/feedManifest.js +123 -0
  468. package/dist/volume/feedPrepare.d.ts +16 -0
  469. package/dist/volume/feedPrepare.js +228 -0
  470. package/dist/volume/feedProject.d.ts +39 -0
  471. package/dist/volume/feedProject.js +92 -0
  472. package/dist/volume/feedRecord.d.ts +55 -0
  473. package/dist/volume/feedRecord.js +148 -0
  474. package/dist/volume/feedRef.d.ts +43 -0
  475. package/dist/volume/feedRef.js +117 -0
  476. package/dist/volume/feedRefresh.d.ts +15 -0
  477. package/dist/volume/feedRefresh.js +187 -0
  478. package/dist/volume/feedSource.d.ts +66 -0
  479. package/dist/volume/feedSource.js +104 -0
  480. package/dist/volume/feedTarget.d.ts +70 -0
  481. package/dist/volume/feedTarget.js +9 -0
  482. package/dist/volume/feedTestKit.d.ts +11 -0
  483. package/dist/volume/feedTestKit.js +45 -0
  484. package/dist/volume/feedVerify.d.ts +18 -0
  485. package/dist/volume/feedVerify.js +104 -0
  486. package/dist/volume/index.d.ts +13 -0
  487. package/dist/volume/index.js +13 -0
  488. package/moltnet-releases.json +4 -4
  489. package/package.json +3 -3
  490. package/runtimes.yaml +8 -6
@@ -0,0 +1,91 @@
1
+ import { createDefaultReleaseDependencies, releaseExitCode, resolveNotifierConfig, resolvePostDeployHook, runRelease } from "../release/index.js";
2
+ import { SpawnfileError } from "../shared/index.js";
3
+ import { envFileAliasOption, resolveEnvFileOption, runtimeEnvFileOption } from "./envFileOption.js";
4
+ const UNITS = { h: 3_600_000, m: 60_000, ms: 1, s: 1_000 };
5
+ /** `90s`, `30m`, `2h`, `500ms`. A bare number is refused: the unit is never guessed. */
6
+ export const parseReleaseDuration = (value, flag) => {
7
+ const match = /^(\d+)(ms|s|m|h)$/u.exec(value.trim());
8
+ if (!match)
9
+ throw new SpawnfileError("validation_error", `${flag} must be a duration like 90s, 30m or 2h`);
10
+ const ms = Number(match[1]) * UNITS[match[2]];
11
+ if (!Number.isSafeInteger(ms) || ms <= 0)
12
+ throw new SpawnfileError("validation_error", `${flag} must be positive`);
13
+ return ms;
14
+ };
15
+ export const registerReleaseCommand = (program, streams, setExitCode, dependencies = createDefaultReleaseDependencies) => {
16
+ program
17
+ .command("release")
18
+ .description("Build and deploy only when the image inputs changed, draining running turns first")
19
+ .argument("[path]", "Project directory or Spawnfile path", process.cwd())
20
+ .requiredOption("--deployment <name>", "Detached deployment to release into")
21
+ .addOption(runtimeEnvFileOption("Runtime secrets; must set SPAWNFILE_DAIMON_CONTROL_TOKEN to drain"))
22
+ .addOption(envFileAliasOption())
23
+ .option("--auth-profile <name>", "Local Spawnfile auth profile")
24
+ .option("--context <name>", "Docker context for the build and deployment target")
25
+ .option("--docker-command <command>", "Docker command")
26
+ .option("-o, --out <directory>", "Compile output directory")
27
+ .option("--image-repository <name>", "Repository for release image tags (default spawnfile-<project>)")
28
+ .option("--drain-timeout <duration>", "How long running turns may take to finish before the release is abandoned", "30m")
29
+ .option("--no-drain", "Deploy without draining (kills in-flight turns)")
30
+ .option("--force", "Release even when the running identity is unchanged")
31
+ .option("--dev-inputs", "Hash working-tree bundle inputs instead of requiring a clean commit")
32
+ .option("--notify-command <path>", "Executable run on failure; receives the notification JSON on stdin")
33
+ .option("--notify-webhook-env <name>", "Environment variable holding an https URL to POST the notification to")
34
+ .option("--notify-deferred-after <duration>", "Notify once when a release has been deferred this long", "24h")
35
+ .option("--post-deploy-command <path>", "Executable run (no shell) on the new container's host after it settled; non-zero fails the release")
36
+ .option("--post-deploy-arg <arg>", "Argument for --post-deploy-command (repeatable)", (value, previous = []) => [...previous, value])
37
+ .option("--post-deploy-timeout <duration>", "How long --post-deploy-command may run", "10m")
38
+ .action(async (inputPath, options) => {
39
+ let notifier;
40
+ try {
41
+ notifier = resolveNotifierConfig(options);
42
+ }
43
+ catch (error) {
44
+ throw new SpawnfileError("validation_error", error.message);
45
+ }
46
+ const envFile = resolveEnvFileOption(options);
47
+ let postDeploy;
48
+ try {
49
+ postDeploy = resolvePostDeployHook({ ...options, timeoutMs: parseReleaseDuration(options.postDeployTimeout, "--post-deploy-timeout") });
50
+ }
51
+ catch (error) {
52
+ throw new SpawnfileError("validation_error", error.message);
53
+ }
54
+ const drainTimeoutMs = parseReleaseDuration(options.drainTimeout, "--drain-timeout");
55
+ const notifyDeferredAfterMs = parseReleaseDuration(options.notifyDeferredAfter, "--notify-deferred-after");
56
+ const abort = new AbortController();
57
+ const onSignal = () => abort.abort();
58
+ process.once("SIGTERM", onSignal);
59
+ process.once("SIGINT", onSignal);
60
+ try {
61
+ const request = {
62
+ authProfileName: options.authProfile ?? null,
63
+ bundleIdentity: options.devInputs ? "dev" : "release",
64
+ deployment: options.deployment,
65
+ dockerCommand: options.dockerCommand ?? "docker",
66
+ ...(options.context ? { dockerContext: options.context } : {}),
67
+ drain: options.drain,
68
+ drainPollMs: 5_000,
69
+ drainTimeoutMs,
70
+ envFileEnv: {},
71
+ ...(envFile ? { envFilePath: envFile } : {}),
72
+ force: options.force === true,
73
+ ...(options.imageRepository ? { imageRepository: options.imageRepository } : {}),
74
+ inputPath,
75
+ log: streams.stdout,
76
+ notifier,
77
+ notifyDeferredAfterMs,
78
+ ...(options.out ? { outputDirectory: options.out } : {}),
79
+ postDeploy,
80
+ settle: { pollMs: 5_000, polls: 36, stablePolls: 3 },
81
+ signal: abort.signal
82
+ };
83
+ const outcome = await runRelease(request, dependencies());
84
+ setExitCode(releaseExitCode(outcome));
85
+ }
86
+ finally {
87
+ process.off("SIGTERM", onSignal);
88
+ process.off("SIGINT", onSignal);
89
+ }
90
+ });
91
+ };
@@ -1,5 +1,5 @@
1
1
  import { importClaudeCodeAuth, importCodexAuth, importGrokAuth, importEnvFile, initializeTargetSecretSourceLifecycle, provisionCredentials, requireAuthProfile } from "../auth/index.js";
2
- import { addAgentProject, addProjectSurface, addProjectModelFallback, addSubagentProject, addTeamProject, buildOrganizationView, buildCompilePlan, buildProject, buildUpReceipt, clearProjectModelFallbacks, compileProject, createTrainingContext, initProject, listInitTemplates, publishProject, upProject, removeProjectSurface, runProject, setProjectPrimaryModel, setProjectRuntime, setProjectSurfaceAccess, showProjectSurfaces, syncProjectAuth } from "../compiler/index.js";
2
+ import { addAgentProject, addProjectSurface, addProjectModelFallback, addSubagentProject, addTeamProject, buildOrganizationView, buildCompilePlan, buildProject, buildUpReceipt, clearProjectModelFallbacks, compileProject, createTrainingContext, createTrainingPlan, loadTrainingProject, resolveTrainingPlan, materializeTrainingMoment, lowerTrainingExecution, allocateTrainingOutputParent, initProject, listInitTemplates, publishProject, upProject, removeProjectSurface, runProject, setProjectPrimaryModel, setProjectRuntime, setProjectSurfaceAccess, showProjectSurfaces, syncProjectAuth } from "../compiler/index.js";
3
3
  import { devActivityProject, devApplyProject, devRestartProject, devStopProject, devUpProject } from "../dev/index.js";
4
4
  import { consumeImageUp } from "../distribution/index.js";
5
5
  import { createDockerProbeGateway, downDeployment, exportRunArtifacts, inspectDockerDeployment, listDeploymentRecords, listHomeDeploymentRecords } from "../deployment/index.js";
@@ -16,6 +16,12 @@ export interface CliRenderEnvironment {
16
16
  }
17
17
  export interface CliHandlers {
18
18
  createTrainingContext: typeof createTrainingContext;
19
+ createTrainingPlan: typeof createTrainingPlan;
20
+ lowerTrainingExecution: typeof lowerTrainingExecution;
21
+ allocateTrainingOutputParent: typeof allocateTrainingOutputParent;
22
+ loadTrainingProject: typeof loadTrainingProject;
23
+ resolveTrainingPlan: typeof resolveTrainingPlan;
24
+ materializeTrainingMoment: typeof materializeTrainingMoment;
19
25
  delegatePaideiaTraining: typeof delegatePaideiaTraining;
20
26
  buildCompilePlan: typeof buildCompilePlan;
21
27
  buildOrganizationView: typeof buildOrganizationView;
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { Command } from "commander";
3
3
  import { importClaudeCodeAuth, importCodexAuth, importGrokAuth, importEnvFile, initializeTargetSecretSourceLifecycle, provisionCredentials, requireAuthProfile } from "../auth/index.js";
4
- import { addAgentProject, addProjectSurface, addProjectModelFallback, addSubagentProject, addTeamProject, buildOrganizationView, buildCompilePlan, buildProject, buildUpReceipt, clearProjectModelFallbacks, compileProject, createTrainingContext, initProject, listInitTemplates, publishProject, upProject, removeProjectSurface, runProject, setProjectPrimaryModel, setProjectRuntime, setProjectSurfaceAccess, showProjectSurfaces, syncProjectAuth } from "../compiler/index.js";
4
+ import { addAgentProject, addProjectSurface, addProjectModelFallback, addSubagentProject, addTeamProject, buildOrganizationView, buildCompilePlan, buildProject, buildUpReceipt, clearProjectModelFallbacks, compileProject, createTrainingContext, createTrainingPlan, loadTrainingProject, resolveTrainingPlan, materializeTrainingMoment, lowerTrainingExecution, allocateTrainingOutputParent, initProject, listInitTemplates, preflightCompilePlan, publishProject, upProject, removeProjectSurface, runProject, setProjectPrimaryModel, setProjectRuntime, setProjectSurfaceAccess, showProjectSurfaces, syncProjectAuth } from "../compiler/index.js";
5
5
  import { devActivityProject, devApplyProject, devRestartProject, devStopProject, devUpProject } from "../dev/index.js";
6
6
  import { consumeImageUp } from "../distribution/index.js";
7
7
  import { createDockerProbeGateway, downDeployment, exportRunArtifacts, inspectDockerDeployment, listDeploymentRecords, listHomeDeploymentRecords } from "../deployment/index.js";
@@ -18,8 +18,10 @@ import { registerRuntimeCommands } from "./runtimeCommands.js";
18
18
  import { registerSurfaceCommands } from "./surfaceCommands.js";
19
19
  import { registerStatusCommand } from "./statusCommand.js";
20
20
  import { registerUsageCommand } from "./usageCommand.js";
21
+ import { registerRecordCommands } from "./recordCommands.js";
21
22
  import { registerProductionTargetCommands } from "./targetProductionCommands.js";
22
23
  import { registerViewCommand } from "./viewCommand.js";
24
+ import { registerVolumeCommands } from "./volumeCommands.js";
23
25
  import { registerTrainCommand } from "./trainCommand.js";
24
26
  import { delegatePaideiaTraining } from "./paideiaDelegation.js";
25
27
  const packageJsonPath = new URL("../../package.json", import.meta.url);
@@ -37,7 +39,7 @@ const createDefaultRenderEnvironment = () => ({
37
39
  stdoutIsTty: process.stdout.isTTY === true
38
40
  });
39
41
  const createDefaultHandlers = () => ({
40
- createTrainingContext, delegatePaideiaTraining,
42
+ createTrainingContext, createTrainingPlan, loadTrainingProject, resolveTrainingPlan, materializeTrainingMoment, lowerTrainingExecution, allocateTrainingOutputParent, delegatePaideiaTraining,
41
43
  buildCompilePlan, buildOrganizationView, buildProject, compileProject, publishProject,
42
44
  addAgentProject, addProjectModelFallback, addProjectSurface,
43
45
  addSubagentProject, addTeamProject, clearProjectModelFallbacks,
@@ -118,7 +120,7 @@ export const runCli = async (argv, optionsOrStreams, handlerOverrides = {}) => {
118
120
  },
119
121
  writeOut: (message) => writeCommanderOutput(streams.stdout, message)
120
122
  });
121
- registerLifecycleCommands(program, handlers, streams, cliOptions.stdin);
123
+ registerLifecycleCommands(program, handlers, streams, cliOptions.stdin, (code) => { commandExitCode = code; });
122
124
  registerDevCommands(program, handlers, streams);
123
125
  registerArtifactsCommands(program, handlers, streams);
124
126
  registerCapabilitiesCommand(program, streams, readPackageVersion());
@@ -198,9 +200,8 @@ export const runCli = async (argv, optionsOrStreams, handlerOverrides = {}) => {
198
200
  registerStatusCommand(program, handlers, streams, (exitCode) => {
199
201
  commandExitCode = exitCode;
200
202
  });
201
- registerUsageCommand(program, streams, (exitCode) => {
202
- commandExitCode = exitCode;
203
- }, handlers);
203
+ registerUsageCommand(program, streams, (exitCode) => { commandExitCode = exitCode; }, handlers);
204
+ registerRecordCommands(program, streams, (exitCode) => { commandExitCode = exitCode; }, handlers);
204
205
  registerViewCommand(program, handlers, streams, cliOptions.renderEnvironment);
205
206
  registerTrainCommand(program, handlers, streams, readPackageVersion(), (code) => {
206
207
  commandExitCode = code;
@@ -208,12 +209,16 @@ export const runCli = async (argv, optionsOrStreams, handlerOverrides = {}) => {
208
209
  registerProductionTargetCommands(program, streams, cliOptions.stdin, (exitCode) => {
209
210
  commandExitCode = exitCode;
210
211
  });
212
+ registerVolumeCommands(program, streams, (exitCode) => {
213
+ commandExitCode = exitCode;
214
+ });
211
215
  program
212
216
  .command("validate")
213
217
  .description("Validate a Spawnfile and report the resolved compile plan")
214
218
  .argument("[path]", "Project directory or Spawnfile path", process.cwd())
215
219
  .action(async (inputPath) => {
216
220
  const plan = await handlers.buildCompilePlan(inputPath);
221
+ preflightCompilePlan(plan);
217
222
  streams.stdout("validation succeeded");
218
223
  streams.stdout(formatPlanSummary(plan));
219
224
  });
@@ -1,5 +1,6 @@
1
1
  import { SpawnfileError } from "../shared/index.js";
2
2
  import { resolveCommandInput } from "./resolveCommandInput.js";
3
+ import { envFileAliasOption, resolveEnvFileOption, runtimeEnvFileOption } from "./envFileOption.js";
3
4
  export const registerRunPublishCommands = (program, handlers, streams) => {
4
5
  program
5
6
  .command("run")
@@ -12,7 +13,8 @@ export const registerRunPublishCommands = (program, handlers, streams) => {
12
13
  .option("--deployment <name>", "Detached deployment record name")
13
14
  .option("--docker-command <command>", "Docker command")
14
15
  .option("--name <container>", "Docker container name")
15
- .option("--env-file <file>", "Path to an env file for runtime secrets")
16
+ .addOption(runtimeEnvFileOption("Path to an env file for runtime secrets"))
17
+ .addOption(envFileAliasOption())
16
18
  .option("--world-bindings <file>", "Path to a versioned world-bindings artifact")
17
19
  .option("--image", "Interpret the argument as an image reference")
18
20
  .option("-d, --detach", "Run the container in detached mode")
@@ -21,7 +23,7 @@ export const registerRunPublishCommands = (program, handlers, streams) => {
21
23
  if (runInput.kind === "image" || (runInput.kind === "invalid" && options.image)) {
22
24
  throw new SpawnfileError("validation_error", `Image-mode run is not supported. Deploy the image with: ` +
23
25
  `spawnfile up ${inputPath} --auth-profile <profile> ` +
24
- "(add --env-file for any extra secrets; image deployments always detach).");
26
+ "(add --runtime-env-file for any extra secrets; image deployments always detach).");
25
27
  }
26
28
  if (runInput.kind === "invalid") {
27
29
  throw new SpawnfileError("validation_error", `Cannot resolve "${inputPath}" as a project path or image reference. ` +
@@ -34,7 +36,7 @@ export const registerRunPublishCommands = (program, handlers, streams) => {
34
36
  deploymentName: options.deployment,
35
37
  dockerCommand: options.dockerCommand,
36
38
  dockerContext: options.context,
37
- envFilePath: options.envFile,
39
+ envFilePath: resolveEnvFileOption(options),
38
40
  imageTag: options.tag,
39
41
  outputDirectory: options.out,
40
42
  ...(options.worldBindings !== undefined
@@ -1,16 +1,19 @@
1
1
  import { SpawnfileError } from "../shared/index.js";
2
- const forwarded = ["train", "test", "editable", "resource", "judge", "judge-citation-repairs", "validation-group", "optimizer-model",
3
- "bridge-command", "out", "max-trials", "max-proposals", "seed", "timeout-ms", "view", "cost-config"];
2
+ const forwarded = ["train", "validation", "test", "editable", "resource", "judge", "judge-citation-repairs", "validation-group", "optimizer-model",
3
+ "bridge-command", "out", "max-trials", "max-proposals", "seed", "timeout-ms", "experiment-timeout-ms", "trial-timeout-ms", "view", "cost-config", "concurrency"];
4
4
  const repeated = new Set(["editable", "resource", "judge", "judge-citation-repairs", "validation-group"]);
5
5
  const key = (name) => name.replace(/-([a-z])/gu, (_, letter) => letter.toUpperCase());
6
6
  export const registerTrainCommand = (program, handlers, streams, packageVersion, setExitCode, signal) => {
7
7
  const command = program.command("train")
8
- .description("Train one canonical agent through Paideia's isolated native integration")
8
+ .description("Plan, rewind, or train one canonical agent through its declared training inputs")
9
9
  .argument("[path]", "Canonical project directory or Spawnfile path", process.cwd())
10
- .option("--agent <id>", "Exact canonical agent node id (inferred only for a single-agent project)")
10
+ .option("--agent <id>", "Canonical agent id or unambiguous short name (inferred for one agent)")
11
11
  .option("--paideia-command <executable>", "Installed Paideia executable; no shell or automatic install", "paideia")
12
12
  .option("--training-image <immutable-image>", "Pinned image containing the complete training environment")
13
13
  .option("--training-config <json>", "V2 image recipe and declared inputs, or advanced v1 local bindings")
14
+ .option("--plan", "Print the resolved training authoring plan without executing training")
15
+ .option("--materialize <example>", "Rewind an authored example into --out without running training")
16
+ .option("--history <directory>", "Local recorded history for --materialize")
14
17
  .option("--dry-run", "Validate and estimate without compiling, authenticating or starting models")
15
18
  .option("--repair-measurements <parent-out>", "Fork captured work into a fresh output for authorized measurement repair")
16
19
  .option("--repair-witness <manifest>", "Explicit verified image witness for a legacy parent")
@@ -19,26 +22,48 @@ export const registerTrainCommand = (program, handlers, streams, packageVersion,
19
22
  const flag = `--${name} <value>`;
20
23
  if (repeated.has(name))
21
24
  command.option(flag, `Paideia ${name}; repeatable`, (value, previous) => [...previous, value], []);
22
- else if (name === "train")
23
- command.requiredOption(flag, `Paideia ${name}`);
24
25
  else
25
- command.option(flag, `Paideia ${name}`);
26
+ command.option(flag, name === "out" ? "Output directory for training or moment materialization" : `Paideia ${name}`);
26
27
  }
27
28
  command.action(async (inputPath, options) => {
28
- if (options.dryRun !== true && typeof options.out !== "string") {
29
- throw new SpawnfileError("validation_error", "Actual training requires --out; dry-run does not write an output directory");
29
+ if (typeof options.materialize === "string") {
30
+ if (options.plan === true) {
31
+ throw new SpawnfileError("validation_error", "--materialize and --plan are mutually exclusive");
32
+ }
33
+ if (typeof options.out !== "string") {
34
+ throw new SpawnfileError("validation_error", "--materialize requires --out");
35
+ }
36
+ const project = await handlers.loadTrainingProject(inputPath);
37
+ const plan = handlers.resolveTrainingPlan(project, options.agent, packageVersion);
38
+ const moment = await handlers.materializeTrainingMoment({ plan, project, example: options.materialize,
39
+ historyDir: options.history, out: options.out });
40
+ if (moment.status === "refused") {
41
+ streams.stderr(`error: Moment refused: ${moment.inputs.filter((input) => input.refusal !== null).length} input refusal(s), ${moment.leakCheck.findings} leak finding(s); see moment.json in --out`);
42
+ setExitCode(1);
43
+ }
44
+ else {
45
+ streams.stdout(JSON.stringify(moment, null, 2));
46
+ setExitCode(0);
47
+ }
48
+ return;
30
49
  }
31
- if (options.dryRun !== true && typeof options.trainingConfig !== "string") {
32
- throw new SpawnfileError("validation_error", "Actual training requires --training-config; v1 additionally requires --training-image; host execution is disabled");
50
+ if (options.history !== undefined) {
51
+ throw new SpawnfileError("validation_error", "--history requires --materialize");
33
52
  }
34
- const timeout = options.timeoutMs === undefined ? 3_600_000 : Number(options.timeoutMs);
35
- if (!Number.isSafeInteger(timeout) || timeout < 1 || timeout > 3_600_000 ||
36
- (options.timeoutMs !== undefined && !/^\d+$/u.test(String(options.timeoutMs)))) {
37
- throw new SpawnfileError("validation_error", "--timeout-ms must be an integer from 1 to 3600000");
53
+ if (options.plan === true) {
54
+ const plan = await handlers.createTrainingPlan(inputPath, {
55
+ agent: options.agent, packageVersion
56
+ });
57
+ streams.stdout(JSON.stringify(plan, null, 2));
58
+ setExitCode(0);
59
+ return;
60
+ }
61
+ for (const name of ["timeout-ms", "experiment-timeout-ms", "trial-timeout-ms"]) {
62
+ const value = options[key(name)], maximum = name === "trial-timeout-ms" ? 86_400_000 : 604_800_000;
63
+ if (value !== undefined && (!/^\d+$/u.test(String(value)) || !Number.isSafeInteger(Number(value)) || Number(value) < 1 || Number(value) > maximum)) {
64
+ throw new SpawnfileError("validation_error", `--${name} must be an integer from 1 to ${maximum}`);
65
+ }
38
66
  }
39
- const context = await handlers.createTrainingContext(inputPath, {
40
- agent: options.agent, packageVersion
41
- });
42
67
  const args = [];
43
68
  for (const name of forwarded) {
44
69
  const value = options[key(name)];
@@ -52,9 +77,37 @@ export const registerTrainCommand = (program, handlers, streams, packageVersion,
52
77
  args.push("--dry-run");
53
78
  if (options.resume === true)
54
79
  args.push("--resume");
55
- setExitCode(await handlers.delegatePaideiaTraining({ context, args,
80
+ const project = await handlers.loadTrainingProject(inputPath);
81
+ const plan = handlers.resolveTrainingPlan(project, options.agent, packageVersion);
82
+ const timeout = Number(options.experimentTimeoutMs ?? options.timeoutMs ?? plan.deadlines?.experiment_ms ?? 43_200_000);
83
+ if (options.experimentTimeoutMs === undefined && options.timeoutMs === undefined)
84
+ args.push("--experiment-timeout-ms", String(timeout));
85
+ if (options.trialTimeoutMs === undefined && plan.deadlines?.trial_ms !== undefined)
86
+ args.push("--trial-timeout-ms", String(plan.deadlines.trial_ms));
87
+ const lowered = plan.targets.length > 0 ? await handlers.lowerTrainingExecution({ project, plan, args,
88
+ trainingConfig: options.trainingConfig, trainingImage: options.trainingImage }) : undefined;
89
+ if (lowered && options.dryRun === true) {
90
+ streams.stdout(JSON.stringify({ ...lowered.execution, container: { configPath: lowered.trainingConfig,
91
+ declaration: lowered.declaration, ...(lowered.trainingImage ? { imageOverride: lowered.trainingImage } : {}) } }, null, 2));
92
+ setExitCode(0);
93
+ return;
94
+ }
95
+ if (!lowered && typeof options.train !== "string") {
96
+ throw new SpawnfileError("validation_error", `Agent ${plan.agent.id} has no executable training targets; supply --train`);
97
+ }
98
+ if (!lowered && options.dryRun !== true && typeof options.out !== "string") {
99
+ throw new SpawnfileError("validation_error", "Actual training requires --out when no training targets are declared");
100
+ }
101
+ if (!lowered && options.dryRun !== true && typeof options.trainingConfig !== "string") {
102
+ throw new SpawnfileError("validation_error", "Actual training requires --training-config when no training targets are declared; host execution is disabled");
103
+ }
104
+ const context = await handlers.createTrainingContext(inputPath, { agent: plan.agent.id, packageVersion });
105
+ if (lowered)
106
+ await handlers.allocateTrainingOutputParent(lowered.execution.output);
107
+ setExitCode(await handlers.delegatePaideiaTraining({ context, args: lowered?.execution.args ?? args, execution: lowered?.execution,
56
108
  repairMeasurements: options.repairMeasurements, repairWitness: options.repairWitness,
57
- trainingImage: options.trainingImage, trainingConfig: options.trainingConfig,
109
+ trainingImage: lowered?.trainingImage ?? options.trainingImage,
110
+ trainingConfig: lowered?.trainingConfig ?? options.trainingConfig,
58
111
  command: options.paideiaCommand, dryRun: options.dryRun === true,
59
112
  timeoutMs: timeout + 5000, streams, signal }));
60
113
  });
@@ -7,6 +7,7 @@ import { resolveCommandInput } from "./resolveCommandInput.js";
7
7
  import { runImageUpCommand } from "./upImageCommand.js";
8
8
  import { createUpLifecycleInvocation, createUpProjectOptions } from "./upLifecycleInvocation.js";
9
9
  import { reconcileUpLifecycle } from "./upLifecycleRecovery.js";
10
+ import { envFileAliasOption, resolveEnvFileOption, runtimeEnvFileOption } from "./envFileOption.js";
10
11
  const readSelectedTargetReceipt = async (file) => {
11
12
  if (typeof file !== "string" || file.length < 1 || Buffer.byteLength(file, "utf8") > 4096) {
12
13
  throw new SpawnfileError("validation_error", "Invalid selected target receipt");
@@ -38,7 +39,8 @@ export const registerUpCommand = (program, handlers, streams) => {
38
39
  .option("--deployment <name>", "Detached deployment record name")
39
40
  .option("--docker-command <command>", "Docker command")
40
41
  .option("--name <container>", "Docker container name")
41
- .option("--env-file <file>", "Path to an env file for runtime secrets")
42
+ .addOption(runtimeEnvFileOption("Path to an env file for runtime secrets"))
43
+ .addOption(envFileAliasOption())
42
44
  .option("--world-bindings <file>", "Path to a versioned world-bindings artifact")
43
45
  .option("--selected-target-receipt-digest <digest>", "Selected target receipt digest for an organization handoff")
44
46
  .option("--selected-target-receipt <file>", "Selected target receipt for an organization handoff")
@@ -51,6 +53,8 @@ export const registerUpCommand = (program, handlers, streams) => {
51
53
  .option("--json", "Render a spawnfile.up-receipt.v1 machine-readable receipt")
52
54
  .option("--lifecycle-invocation <id>", "Durably bind this exact JSON lifecycle invocation")
53
55
  .action(async (inputPath, options) => {
56
+ options.envFile = resolveEnvFileOption(options);
57
+ delete options.runtimeEnvFile;
54
58
  requireMachineLifecycle(options.lifecycleInvocation, options.json);
55
59
  const upInput = resolveCommandInput(inputPath, { forceImage: options.image });
56
60
  if (upInput.kind === "invalid") {
@@ -0,0 +1,8 @@
1
+ import { Command } from "commander";
2
+ import type { CliStreams } from "./runCli.js";
3
+ /**
4
+ * `spawnfile volume refresh|verify`: host-side operations on a fed volume, suitable for a timer.
5
+ * Exit 0 when the volume is clean (current, freshly landed, or another writer holds the lock); exit 1
6
+ * when anything needs a human (tampering found, repaired or not, or a refusal).
7
+ */
8
+ export declare const registerVolumeCommands: (program: Command, streams: CliStreams, setExitCode: (code: number) => void) => void;
@@ -0,0 +1,53 @@
1
+ import { InvalidArgumentError } from "commander";
2
+ import { feedResultClean, refreshVolumeFeed, resolveFeedTarget, verifyVolumeFeed } from "../volume/index.js";
3
+ const positiveInteger = (value) => {
4
+ const parsed = Number(value);
5
+ if (!Number.isInteger(parsed) || parsed < 1)
6
+ throw new InvalidArgumentError("must be a positive integer");
7
+ return parsed;
8
+ };
9
+ const targetOptions = (options) => ({
10
+ ...(options.fetch === false ? { fetch: false } : {}),
11
+ ...(options.healLimit ? { healLimit: options.healLimit } : {}),
12
+ ...(options.stateDir ? { stateDir: options.stateDir } : {}),
13
+ ...(options.volumePath ? { volumePath: options.volumePath } : {})
14
+ });
15
+ const report = (streams, result, json) => {
16
+ if (json) {
17
+ streams.stdout(JSON.stringify(result));
18
+ return;
19
+ }
20
+ streams.stdout(`${result.status}${result.revision ? ` ${result.revision}` : ""}`);
21
+ for (const finding of result.findings)
22
+ streams.stderr(`finding: ${finding}`);
23
+ };
24
+ const withShared = (command) => command
25
+ .argument("<id>", "Volume resource id that declares feed")
26
+ .argument("[path]", "Project directory or Spawnfile path", process.cwd())
27
+ .option("--volume-path <dir>", "Host directory of the volume content (default: docker volume inspect)")
28
+ .option("--state-dir <dir>", "Host state directory, outside the volume and on its filesystem")
29
+ .option("--json", "Print the result as one JSON line");
30
+ /**
31
+ * `spawnfile volume refresh|verify`: host-side operations on a fed volume, suitable for a timer.
32
+ * Exit 0 when the volume is clean (current, freshly landed, or another writer holds the lock); exit 1
33
+ * when anything needs a human (tampering found, repaired or not, or a refusal).
34
+ */
35
+ export const registerVolumeCommands = (program, streams, setExitCode) => {
36
+ const volume = program.command("volume").description("Operate host-fed volumes");
37
+ withShared(volume.command("refresh").description("Land the feed's current content by atomic swap, or verify and heal what is landed"))
38
+ .option("--no-fetch", "Do not fetch a git feed before resolving its ref")
39
+ .option("--heal-limit <n>", "Re-lands of one revision before auto-repair is suspended", positiveInteger)
40
+ .action(async (id, inputPath, options) => {
41
+ const target = await resolveFeedTarget(inputPath, id, targetOptions(options));
42
+ const result = refreshVolumeFeed(target, { log: (line) => streams.stderr(line) });
43
+ report(streams, result, options.json);
44
+ setExitCode(feedResultClean(result) ? 0 : 1);
45
+ });
46
+ withShared(volume.command("verify").description("Check a fed volume against the host record without changing it"))
47
+ .action(async (id, inputPath, options) => {
48
+ const target = await resolveFeedTarget(inputPath, id, targetOptions(options));
49
+ const result = verifyVolumeFeed(target, { log: (line) => streams.stderr(line) });
50
+ report(streams, result, options.json);
51
+ setExitCode(feedResultClean(result) ? 0 : 1);
52
+ });
53
+ };
@@ -2,11 +2,11 @@ import path from "node:path";
2
2
  import { SpawnfileError } from "../shared/index.js";
3
3
  import { stableStringify } from "./helpers.js";
4
4
  import { mergeWorkspaceResources } from "./workspaceResources.js";
5
- const assertSame = (field, existing, next, nodeName) => {
5
+ const assertSame = (field, existing, next, nodeName, errorCode = "compile_error") => {
6
6
  if (stableStringify(existing) === stableStringify(next)) {
7
7
  return;
8
8
  }
9
- throw new SpawnfileError("compile_error", `Agent ${nodeName} resolves with incompatible ${field} across team imports`);
9
+ throw new SpawnfileError(errorCode, `Agent ${nodeName} resolves with incompatible ${field} across team imports`);
10
10
  };
11
11
  const mergeEnvStrict = (existing, next, nodeName) => {
12
12
  const merged = { ...existing };
@@ -62,6 +62,7 @@ export const mergeCompatibleAgentNode = (existing, next) => {
62
62
  assertSame("source", existing.source, next.source, existing.name);
63
63
  assertSame("source path", existing.sourcePath, next.sourcePath, existing.name);
64
64
  assertSame("surfaces", existing.surfaces, next.surfaces, existing.name);
65
+ assertSame("training", existing.training, next.training, existing.name, "validation_error");
65
66
  existing.docs = mergeDocuments(existing.docs, next.docs, existing.sourcePath ?? existing.source);
66
67
  existing.env = mergeEnvStrict(existing.env, next.env, existing.name);
67
68
  existing.mcpServers = mergeByKeyStrict(existing.mcpServers, next.mcpServers, (server) => server.name, "MCP server", existing.name) ?? [];
@@ -1,11 +1,13 @@
1
1
  import { getCanonicalManifestPath, getManifestPath } from "../filesystem/index.js";
2
2
  import { loadManifest, isAgentManifest } from "../manifest/index.js";
3
3
  import { assignStableNodeIds } from "./helpers.js";
4
+ import { resolvePlanMcpPlaceholders } from "./mcpPlaceholders.js";
4
5
  import { resolvePlanMoltnetAttachments } from "./moltnetResolution.js";
5
6
  import { resolvePlanMemoryAccess } from "./memoryResolution.js";
6
7
  import { resolveMoltnetRoomMemberships } from "./moltnetRoomMemberships.js";
7
8
  import { createRuntimeGroups } from "./buildCompilePlanRuntime.js";
8
9
  import { validateAllowedWakeSenders } from "./moltnetAllowedWakeSendersValidation.js";
10
+ import { resolvePlanTrainingSources } from "./training/resolution.js";
9
11
  import { createCompilePlanTraversal } from "./buildCompilePlanTraversal.js";
10
12
  import { resolveMoltnetExternalParticipantIntents, resolveOrganizationIdentity, validateB31MoltnetAuth } from "./organizationIdentity.js";
11
13
  export const buildCompilePlan = async (inputPath) => {
@@ -49,6 +51,8 @@ export const buildCompilePlan = async (inputPath) => {
49
51
  source: node.source,
50
52
  value: node.value
51
53
  })));
54
+ resolvePlanMcpPlaceholders(nodes);
55
+ resolvePlanTrainingSources(nodes);
52
56
  const idBySource = new Map(nodes.map((node) => [node.value.source, node.id]));
53
57
  const compilePlanNodes = nodes;
54
58
  const compilePlanEdges = edges.map((edge) => ({
@@ -9,13 +9,14 @@ import { assertRuntimeSupportsExecutionModelAuth } from "./modelAuth.js";
9
9
  import { loadResolvedSkills, mergeResolvedSkills } from "./surfaces.js";
10
10
  import { assertRuntimeSupportsAgentSurfaces } from "./surfaceSupport.js";
11
11
  import { mergeWorkspaceResources } from "./workspaceResources.js";
12
+ import { mergeTrainingDeclarations, resolveTrainingDeclaration } from "./training/resolution.js";
12
13
  export const resolveAgentNode = async ({ context, manifest, manifestPath, source }) => {
13
14
  const runtime = await resolveRuntime(manifest, context);
14
15
  const execution = applyExecutionDefaults(context.isSubagent
15
16
  ? mergeExecution(context.inheritedExecution, manifest.execution)
16
17
  : manifest.execution);
17
18
  assertRuntimeSupportsExecutionModelAuth(runtime.name, execution, manifest.name);
18
- const environment = resolveEffectiveEnvironment(context.inheritedShared?.surface?.environment, manifest.environment);
19
+ const environment = resolveEffectiveEnvironment(manifest.name, context.inheritedShared?.surface?.environment, manifest.environment);
19
20
  const inheritedSkills = context.inheritedShared
20
21
  ? await loadResolvedSkills(context.inheritedShared.manifestPath, context.inheritedShared.surface?.workspace?.skills)
21
22
  : [];
@@ -49,6 +50,7 @@ export const resolveAgentNode = async ({ context, manifest, manifestPath, source
49
50
  ...(source === manifestPath ? {} : { sourcePath: manifestPath }),
50
51
  surfaces: resolveAgentSurfaces(manifest.surfaces),
51
52
  subagents: [],
53
+ training: mergeTrainingDeclarations(resolveTrainingDeclaration(context.inheritedShared?.surface?.training, context.inheritedShared?.manifestPath ?? manifestPath, context.inheritedShared?.manifestPath ?? source), resolveTrainingDeclaration(manifest.training, manifestPath, source)),
52
54
  workspaceResources
53
55
  };
54
56
  assertRuntimeSupportsAgentSurfaces(runtime.name, candidate.surfaces, manifest.name);
@@ -11,6 +11,7 @@ import { mergeWorkspaceResources } from "./workspaceResources.js";
11
11
  import { DEFAULT_POLICY_MODE, DEFAULT_POLICY_ON_DEGRADE, mergeResolvedDocuments, } from "./buildCompilePlanTraversalHelpers.js";
12
12
  import { resolveAgentNode } from "./buildCompilePlanAgent.js";
13
13
  import { createInlineAgentSource } from "./projectManifestGraph.js";
14
+ import { resolveTrainingDeclaration } from "./training/resolution.js";
14
15
  export const createCompilePlanTraversal = ({ getLoadedManifest, nodeCache, fingerprintCache, edges, memberships }) => {
15
16
  const visitStack = [];
16
17
  const recordAgentMembership = (teamSource, teamName, memberId, agent) => {
@@ -128,6 +129,7 @@ export const createCompilePlanTraversal = ({ getLoadedManifest, nodeCache, finge
128
129
  skills: sharedSkills
129
130
  },
130
131
  source: canonicalPath,
132
+ training: resolveTrainingDeclaration(manifest.shared?.training, canonicalPath, canonicalPath)
131
133
  };
132
134
  const fingerprint = getTeamFingerprint(candidate);
133
135
  const existingFingerprint = fingerprintCache.get(canonicalPath);
@@ -1,4 +1,4 @@
1
- import { type Environment, type McpServer, type Secret, type TeamWorkspace } from "../manifest/index.js";
1
+ import { type Environment, type McpServer, type Secret, type SharedEnvironment, type TeamWorkspace } from "../manifest/index.js";
2
2
  import { ResolvedDocument, ResolvedPackage, ResolvedAgentNode, ResolvedTeamNode } from "./types.js";
3
3
  export declare const DEFAULT_POLICY_MODE = "warn";
4
4
  export declare const DEFAULT_POLICY_ON_DEGRADE = "warn";
@@ -9,7 +9,7 @@ export type InternalNode = {
9
9
  };
10
10
  type ResolvedPackageArray = ResolvedPackage[] | undefined;
11
11
  export declare const mergeResolvedDocuments: (primaryPath: string, primaryDocs: TeamWorkspace["docs"] | undefined, fallbackPath: string | undefined, fallbackDocs: TeamWorkspace["docs"] | undefined) => Promise<ResolvedDocument[]>;
12
- export declare const resolveEffectiveEnvironment: (sharedEnvironment: Environment | undefined, localEnvironment: Environment | undefined) => {
12
+ export declare const resolveEffectiveEnvironment: (agentName: string, sharedEnvironment: SharedEnvironment | undefined, localEnvironment: Environment | undefined) => {
13
13
  env: Record<string, string>;
14
14
  mcpServers: McpServer[];
15
15
  packages: ResolvedPackageArray;
@@ -1,4 +1,5 @@
1
- import { loadResolvedDocuments, mergeEnv, mergeMcpServers, mergePackages, mergeSecrets } from "./surfaces.js";
1
+ import { loadResolvedDocuments, mergeEnv, mergePackages, mergeSecrets } from "./surfaces.js";
2
+ import { resolveInheritedMcpServers } from "./mcpServerInheritance.js";
2
3
  export const DEFAULT_POLICY_MODE = "warn";
3
4
  export const DEFAULT_POLICY_ON_DEGRADE = "warn";
4
5
  export const mergeResolvedDocuments = async (primaryPath, primaryDocs, fallbackPath, fallbackDocs) => {
@@ -14,9 +15,9 @@ export const mergeResolvedDocuments = async (primaryPath, primaryDocs, fallbackP
14
15
  }
15
16
  return [...merged.values()];
16
17
  };
17
- export const resolveEffectiveEnvironment = (sharedEnvironment, localEnvironment) => ({
18
+ export const resolveEffectiveEnvironment = (agentName, sharedEnvironment, localEnvironment) => ({
18
19
  env: mergeEnv(sharedEnvironment?.env, localEnvironment?.env),
19
- mcpServers: mergeMcpServers(sharedEnvironment?.mcp_servers, localEnvironment?.mcp_servers),
20
+ mcpServers: resolveInheritedMcpServers(agentName, sharedEnvironment?.mcp_servers, localEnvironment?.mcp_servers),
20
21
  packages: mergePackages(sharedEnvironment?.packages, localEnvironment?.packages),
21
22
  secrets: mergeSecrets(sharedEnvironment?.secrets, localEnvironment?.secrets)
22
23
  });
@@ -29,6 +29,7 @@ export interface BuildProjectResult extends CompileProjectResult {
29
29
  imageTag: string;
30
30
  }
31
31
  export declare const createDefaultImageTag: (projectRoot: string) => string;
32
+ export declare const resolveImageTagRoot: (inputPath: string) => string;
32
33
  export declare const createDockerBuildInvocation: (outputDirectory: string, imageTag: string, options?: string | {
33
34
  dockerCommand?: string;
34
35
  dockerContext?: string;
@@ -37,3 +38,12 @@ export declare const normalizeDockerArchitecture: (architecture: string) => Molt
37
38
  export declare const resolveDockerBuildArchitecture: (options: Pick<BuildProjectOptions, "dockerCommand" | "dockerContext">) => Promise<MoltnetTargetArchitecture | undefined>;
38
39
  export declare const runDockerBuild: DockerBuildRunner;
39
40
  export declare const buildProject: (inputPath: string, options?: BuildProjectOptions) => Promise<BuildProjectResult>;
41
+ /**
42
+ * The image half of `buildProject`, for callers that compiled first and need
43
+ * the build-context identity before deciding whether to build at all (a
44
+ * release no-ops on an unchanged identity without touching Docker).
45
+ * `contextDigest` may be passed when the caller already computed it.
46
+ */
47
+ export declare const buildCompiledProject: (inputPath: string, compileResult: CompileProjectResult, options?: Omit<BuildProjectOptions, keyof CompileProjectOptions> & {
48
+ contextDigest?: string;
49
+ }) => Promise<BuildProjectResult>;
@@ -13,7 +13,7 @@ export const createDefaultImageTag = (projectRoot) => {
13
13
  const baseName = slugify(path.basename(projectRoot));
14
14
  return `spawnfile-${baseName || "project"}`;
15
15
  };
16
- const resolveImageTagRoot = (inputPath) => {
16
+ export const resolveImageTagRoot = (inputPath) => {
17
17
  const resolvedPath = path.resolve(inputPath);
18
18
  return path.basename(resolvedPath).toLowerCase() === "spawnfile"
19
19
  ? path.dirname(resolvedPath)
@@ -78,6 +78,9 @@ export const runDockerBuild = async (invocation) => new Promise((resolve, reject
78
78
  export const buildProject = async (inputPath, options = {}) => {
79
79
  const targetArchitecture = options.containerArchitecture ?? await resolveDockerBuildArchitecture(options);
80
80
  const compileResult = await compileProject(inputPath, {
81
+ ...(options.bundleCacheDirectory !== undefined ? { bundleCacheDirectory: options.bundleCacheDirectory } : {}),
82
+ ...(options.bundleIdentity !== undefined ? { bundleIdentity: options.bundleIdentity } : {}),
83
+ ...(options.bundleDockerCommand ?? options.dockerCommand ? { bundleDockerCommand: options.bundleDockerCommand ?? options.dockerCommand } : {}),
81
84
  clean: options.clean,
82
85
  containerArchitecture: targetArchitecture,
83
86
  outputDirectory: options.outputDirectory,
@@ -86,6 +89,15 @@ export const buildProject = async (inputPath, options = {}) => {
86
89
  ? { worldBindingsPath: options.worldBindingsPath }
87
90
  : {})
88
91
  });
92
+ return buildCompiledProject(inputPath, compileResult, options);
93
+ };
94
+ /**
95
+ * The image half of `buildProject`, for callers that compiled first and need
96
+ * the build-context identity before deciding whether to build at all (a
97
+ * release no-ops on an unchanged identity without touching Docker).
98
+ * `contextDigest` may be passed when the caller already computed it.
99
+ */
100
+ export const buildCompiledProject = async (inputPath, compileResult, options = {}) => {
89
101
  const imageTag = options.imageTag ?? createDefaultImageTag(resolveImageTagRoot(inputPath));
90
102
  const invocation = createDockerBuildInvocation(compileResult.outputDirectory, imageTag, {
91
103
  dockerCommand: options.dockerCommand,
@@ -96,7 +108,7 @@ export const buildProject = async (inputPath, options = {}) => {
96
108
  const contextDigestStartedAt = performance.now();
97
109
  const [contextFiles, contextDigest] = await Promise.all([
98
110
  listDockerBuildContextFiles(compileResult.outputDirectory),
99
- createDockerBuildContextDigest(compileResult.outputDirectory)
111
+ options.contextDigest ?? createDockerBuildContextDigest(compileResult.outputDirectory)
100
112
  ]);
101
113
  const contextDigestMs = performance.now() - contextDigestStartedAt;
102
114
  let probeMs = 0;