@mysten-incubation/devstack 0.1.0 → 0.2.0

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 (858) hide show
  1. package/README.md +7 -4
  2. package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
  5. package/dashboard-ui/index.html +2 -2
  6. package/dist/api/define-capabilities.d.mts +1 -20
  7. package/dist/api/define-capabilities.mjs +15 -22
  8. package/dist/api/define-capabilities.mjs.map +1 -1
  9. package/dist/api/define-devstack-with.d.mts +7 -1
  10. package/dist/api/define-devstack-with.mjs.map +1 -1
  11. package/dist/api/define-devstack.mjs.map +1 -1
  12. package/dist/api/define-plugin.d.mts +2 -1
  13. package/dist/api/inference-network.d.mts +31 -17
  14. package/dist/api/inference-network.mjs +40 -43
  15. package/dist/api/inference-network.mjs.map +1 -1
  16. package/dist/api/load-config.mjs +88 -0
  17. package/dist/api/load-config.mjs.map +1 -0
  18. package/dist/api/mode-narrowed-factory.d.mts +1 -1
  19. package/dist/api/mode-narrowed-factory.mjs.map +1 -1
  20. package/dist/api/run-stack-internal.mjs +202 -0
  21. package/dist/api/run-stack-internal.mjs.map +1 -0
  22. package/dist/api/run-stack.d.mts +82 -31
  23. package/dist/api/run-stack.mjs +22 -141
  24. package/dist/api/run-stack.mjs.map +1 -1
  25. package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
  26. package/dist/build-integrations/dapp-kit/index.mjs +58 -0
  27. package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
  28. package/dist/build-integrations/playwright/config.d.mts +1 -30
  29. package/dist/build-integrations/playwright/config.mjs +1 -27
  30. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  31. package/dist/build-integrations/playwright/errors.d.mts +4 -7
  32. package/dist/build-integrations/playwright/errors.mjs.map +1 -1
  33. package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
  34. package/dist/build-integrations/playwright/global-setup.mjs +142 -218
  35. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  36. package/dist/build-integrations/playwright/index.d.mts +2 -2
  37. package/dist/build-integrations/playwright/index.mjs +2 -2
  38. package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
  39. package/dist/build-integrations/playwright/stack-context.mjs +4 -2
  40. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  41. package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
  42. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  44. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
  46. package/dist/build-integrations/runtime/discover.d.mts +6 -4
  47. package/dist/build-integrations/runtime/discover.mjs +15 -4
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  49. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/errors.mjs.map +1 -1
  51. package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
  52. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  53. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
  54. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
  55. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
  57. package/dist/build-integrations/vite/index.d.mts +84 -19
  58. package/dist/build-integrations/vite/index.mjs +203 -28
  59. package/dist/build-integrations/vite/index.mjs.map +1 -1
  60. package/dist/build-integrations/vitest/config.d.mts +20 -2
  61. package/dist/build-integrations/vitest/config.mjs +16 -4
  62. package/dist/build-integrations/vitest/config.mjs.map +1 -1
  63. package/dist/build-integrations/vitest/env.d.mts +18 -10
  64. package/dist/build-integrations/vitest/env.mjs +11 -10
  65. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  66. package/dist/build-integrations/vitest/errors.d.mts +7 -11
  67. package/dist/build-integrations/vitest/errors.mjs +3 -4
  68. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  69. package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
  70. package/dist/build-integrations/vitest/global-setup.mjs +156 -0
  71. package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
  72. package/dist/build-integrations/vitest/index.d.mts +3 -2
  73. package/dist/build-integrations/vitest/index.mjs +3 -2
  74. package/dist/build-integrations/vitest/setup.mjs +2 -2
  75. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  76. package/dist/build-integrations/vitest/stack-context.d.mts +5 -3
  77. package/dist/build-integrations/vitest/stack-context.mjs +3 -2
  78. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  79. package/dist/cli/bail.mjs.map +1 -1
  80. package/dist/cli/doctor-probes.mjs +1 -3
  81. package/dist/cli/doctor-probes.mjs.map +1 -1
  82. package/dist/cli/main.d.mts +23 -1
  83. package/dist/cli/main.mjs +63 -8
  84. package/dist/cli/main.mjs.map +1 -1
  85. package/dist/cli/prune-direct.mjs.map +1 -1
  86. package/dist/cli/snapshot-reader.mjs.map +1 -1
  87. package/dist/cli/up-lifecycle.mjs.map +1 -1
  88. package/dist/cli/wirings/apply.mjs +28 -21
  89. package/dist/cli/wirings/apply.mjs.map +1 -1
  90. package/dist/cli/wirings/codegen.mjs +108 -0
  91. package/dist/cli/wirings/codegen.mjs.map +1 -0
  92. package/dist/cli/wirings/config-loader.mjs +12 -62
  93. package/dist/cli/wirings/config-loader.mjs.map +1 -1
  94. package/dist/cli/wirings/dump-ids.mjs +86 -0
  95. package/dist/cli/wirings/dump-ids.mjs.map +1 -0
  96. package/dist/cli/wirings/engine-command.mjs +1 -1
  97. package/dist/cli/wirings/engine-command.mjs.map +1 -1
  98. package/dist/cli/wirings/identity.mjs +2 -2
  99. package/dist/cli/wirings/identity.mjs.map +1 -1
  100. package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
  101. package/dist/cli/wirings/read-devstack-version.mjs +17 -0
  102. package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
  103. package/dist/cli/wirings/snapshot.mjs +27 -34
  104. package/dist/cli/wirings/snapshot.mjs.map +1 -1
  105. package/dist/cli/wirings/up-ipc.mjs +147 -0
  106. package/dist/cli/wirings/up-ipc.mjs.map +1 -0
  107. package/dist/cli/wirings/up.mjs +218 -198
  108. package/dist/cli/wirings/up.mjs.map +1 -1
  109. package/dist/cli/wirings/wipe.mjs +1 -1
  110. package/dist/cli/wirings/wipe.mjs.map +1 -1
  111. package/dist/contracts/chain-probe.d.mts +1 -1
  112. package/dist/contracts/chain-probe.mjs +1 -1
  113. package/dist/contracts/chain-probe.mjs.map +1 -1
  114. package/dist/contracts/codegenable.d.mts +60 -6
  115. package/dist/contracts/codegenable.mjs +28 -0
  116. package/dist/contracts/codegenable.mjs.map +1 -0
  117. package/dist/contracts/config-bindings.mjs +162 -0
  118. package/dist/contracts/config-bindings.mjs.map +1 -0
  119. package/dist/contracts/container-runtime.d.mts +23 -17
  120. package/dist/contracts/plugin-expander.mjs.map +1 -1
  121. package/dist/contracts/snapshotable.d.mts +5 -7
  122. package/dist/contracts/wallet-protocol.d.mts +2 -5
  123. package/dist/contracts/wallet-protocol.mjs +2 -5
  124. package/dist/contracts/wallet-protocol.mjs.map +1 -1
  125. package/dist/index.d.mts +21 -26
  126. package/dist/index.mjs +8 -9
  127. package/dist/orchestrators/boot.d.mts +28 -0
  128. package/dist/orchestrators/boot.mjs +440 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -31
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +286 -58
  151. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  152. package/dist/orchestrators/layers.mjs +31 -0
  153. package/dist/orchestrators/layers.mjs.map +1 -0
  154. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
  155. package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
  156. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
  157. package/dist/orchestrators/network-options.d.mts +52 -0
  158. package/dist/orchestrators/network-options.mjs +43 -0
  159. package/dist/orchestrators/network-options.mjs.map +1 -0
  160. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  161. package/dist/orchestrators/router/cors.mjs.map +1 -1
  162. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  163. package/dist/orchestrators/router/errors.mjs.map +1 -1
  164. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  165. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  166. package/dist/orchestrators/router/profile.mjs +1 -1
  167. package/dist/orchestrators/router/profile.mjs.map +1 -1
  168. package/dist/orchestrators/router/service.d.mts +2 -2
  169. package/dist/orchestrators/router/service.mjs +12 -27
  170. package/dist/orchestrators/router/service.mjs.map +1 -1
  171. package/dist/orchestrators/router/traefik-container.mjs +1 -1
  172. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  173. package/dist/orchestrators/snapshot/capture.mjs +171 -195
  174. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  175. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
  176. package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
  177. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  178. package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
  179. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
  180. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
  181. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
  182. package/dist/orchestrators/snapshot/index.mjs +1 -4
  183. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  184. package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
  185. package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
  186. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
  187. package/dist/orchestrators/snapshot/prune.mjs +40 -31
  188. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  189. package/dist/orchestrators/snapshot/restore.mjs +221 -196
  190. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  191. package/dist/orchestrators/snapshot/service.mjs +72 -62
  192. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  193. package/dist/orchestrators/snapshot/wipe.mjs +67 -56
  194. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  195. package/dist/plugins/account/codegen.mjs +3 -0
  196. package/dist/plugins/account/codegen.mjs.map +1 -1
  197. package/dist/plugins/account/errors.d.mts +2 -2
  198. package/dist/plugins/account/errors.mjs +1 -4
  199. package/dist/plugins/account/errors.mjs.map +1 -1
  200. package/dist/plugins/account/funding.mjs +3 -27
  201. package/dist/plugins/account/funding.mjs.map +1 -1
  202. package/dist/plugins/account/index.d.mts +3 -8
  203. package/dist/plugins/account/index.mjs +71 -35
  204. package/dist/plugins/account/index.mjs.map +1 -1
  205. package/dist/plugins/account/keypair.d.mts +8 -7
  206. package/dist/plugins/account/keypair.mjs +5 -18
  207. package/dist/plugins/account/keypair.mjs.map +1 -1
  208. package/dist/plugins/account/lease.mjs.map +1 -1
  209. package/dist/plugins/account/registry.d.mts +1 -46
  210. package/dist/plugins/account/registry.mjs.map +1 -1
  211. package/dist/plugins/account/service.d.mts +43 -34
  212. package/dist/plugins/account/service.mjs +9 -54
  213. package/dist/plugins/account/service.mjs.map +1 -1
  214. package/dist/plugins/account/snapshot.mjs.map +1 -1
  215. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
  216. package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
  217. package/dist/plugins/account/variants/signer.mjs.map +1 -1
  218. package/dist/plugins/action/discriminator.mjs.map +1 -1
  219. package/dist/plugins/action/errors.mjs +1 -4
  220. package/dist/plugins/action/errors.mjs.map +1 -1
  221. package/dist/plugins/action/execute.mjs +3 -4
  222. package/dist/plugins/action/execute.mjs.map +1 -1
  223. package/dist/plugins/action/index.d.mts +2 -2
  224. package/dist/plugins/action/index.mjs +7 -11
  225. package/dist/plugins/action/index.mjs.map +1 -1
  226. package/dist/plugins/action/service.d.mts +5 -7
  227. package/dist/plugins/action/service.mjs +2 -16
  228. package/dist/plugins/action/service.mjs.map +1 -1
  229. package/dist/plugins/coin/address-resolution.mjs.map +1 -1
  230. package/dist/plugins/coin/codegen.mjs +97 -16
  231. package/dist/plugins/coin/codegen.mjs.map +1 -1
  232. package/dist/plugins/coin/discovery.mjs.map +1 -1
  233. package/dist/plugins/coin/errors.mjs +1 -4
  234. package/dist/plugins/coin/errors.mjs.map +1 -1
  235. package/dist/plugins/coin/index.d.mts +4 -34
  236. package/dist/plugins/coin/index.mjs +47 -28
  237. package/dist/plugins/coin/index.mjs.map +1 -1
  238. package/dist/plugins/coin/metadata.d.mts +1 -0
  239. package/dist/plugins/coin/metadata.mjs +8 -9
  240. package/dist/plugins/coin/metadata.mjs.map +1 -1
  241. package/dist/plugins/coin/mint.mjs +7 -21
  242. package/dist/plugins/coin/mint.mjs.map +1 -1
  243. package/dist/plugins/coin/registry.mjs +33 -20
  244. package/dist/plugins/coin/registry.mjs.map +1 -1
  245. package/dist/plugins/coin/service.d.mts +1 -1
  246. package/dist/plugins/coin/service.mjs +1 -8
  247. package/dist/plugins/coin/service.mjs.map +1 -1
  248. package/dist/plugins/coin/snapshot.mjs.map +1 -1
  249. package/dist/plugins/coin/type-strings.mjs.map +1 -1
  250. package/dist/plugins/dashboard/domain.mjs +106 -167
  251. package/dist/plugins/dashboard/domain.mjs.map +1 -1
  252. package/dist/plugins/dashboard/index.mjs +13 -13
  253. package/dist/plugins/dashboard/index.mjs.map +1 -1
  254. package/dist/plugins/dashboard/origin-policy.mjs +3 -3
  255. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
  256. package/dist/plugins/dashboard/routable.mjs.map +1 -1
  257. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
  258. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
  259. package/dist/plugins/dashboard/schema/root.mjs +23 -44
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +37 -91
  262. package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
  263. package/dist/plugins/dashboard/schema.mjs.map +1 -1
  264. package/dist/plugins/dashboard/server.mjs.map +1 -1
  265. package/dist/plugins/deepbook/codegen.d.mts +12 -11
  266. package/dist/plugins/deepbook/codegen.mjs +108 -11
  267. package/dist/plugins/deepbook/codegen.mjs.map +1 -1
  268. package/dist/plugins/deepbook/deploy.mjs +7 -14
  269. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  270. package/dist/plugins/deepbook/errors.mjs +4 -2
  271. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  272. package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
  273. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  274. package/dist/plugins/deepbook/hash.mjs.map +1 -1
  275. package/dist/plugins/deepbook/index.d.mts +38 -34
  276. package/dist/plugins/deepbook/index.mjs +133 -64
  277. package/dist/plugins/deepbook/index.mjs.map +1 -1
  278. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
  279. package/dist/plugins/deepbook/pyth/index.mjs +4 -8
  280. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  281. package/dist/plugins/deepbook/snapshot.mjs +0 -1
  282. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  283. package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
  284. package/dist/plugins/deepbook/types.d.mts +2 -1
  285. package/dist/plugins/deepbook/types.mjs.map +1 -1
  286. package/dist/plugins/faucet/dispatcher.d.mts +3 -3
  287. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  288. package/dist/plugins/faucet/errors.mjs.map +1 -1
  289. package/dist/plugins/faucet/http.mjs +2 -10
  290. package/dist/plugins/faucet/http.mjs.map +1 -1
  291. package/dist/plugins/faucet/index.mjs +0 -1
  292. package/dist/plugins/faucet/index.mjs.map +1 -1
  293. package/dist/plugins/host-service/errors.d.mts +1 -3
  294. package/dist/plugins/host-service/errors.mjs +1 -2
  295. package/dist/plugins/host-service/errors.mjs.map +1 -1
  296. package/dist/plugins/host-service/index.d.mts +1 -2
  297. package/dist/plugins/host-service/index.mjs +11 -11
  298. package/dist/plugins/host-service/index.mjs.map +1 -1
  299. package/dist/plugins/host-service/routable.mjs.map +1 -1
  300. package/dist/plugins/host-service/service.mjs +13 -13
  301. package/dist/plugins/host-service/service.mjs.map +1 -1
  302. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
  303. package/dist/plugins/internal/codegen-helpers.mjs +2 -0
  304. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
  305. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
  306. package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
  307. package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
  308. package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
  309. package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
  310. package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
  311. package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
  312. package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
  313. package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
  314. package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
  315. package/dist/plugins/package/build.mjs +2 -2
  316. package/dist/plugins/package/build.mjs.map +1 -1
  317. package/dist/plugins/package/codegen.d.mts +7 -14
  318. package/dist/plugins/package/codegen.mjs +187 -59
  319. package/dist/plugins/package/codegen.mjs.map +1 -1
  320. package/dist/plugins/package/dep-resolution.mjs +51 -3
  321. package/dist/plugins/package/dep-resolution.mjs.map +1 -1
  322. package/dist/plugins/package/errors.mjs +1 -4
  323. package/dist/plugins/package/errors.mjs.map +1 -1
  324. package/dist/plugins/package/git-source.d.mts +18 -0
  325. package/dist/plugins/package/git-source.mjs +119 -0
  326. package/dist/plugins/package/git-source.mjs.map +1 -0
  327. package/dist/plugins/package/index.d.mts +28 -19
  328. package/dist/plugins/package/index.mjs +107 -32
  329. package/dist/plugins/package/index.mjs.map +1 -1
  330. package/dist/plugins/package/mode-known.mjs +2 -2
  331. package/dist/plugins/package/mode-known.mjs.map +1 -1
  332. package/dist/plugins/package/mode-local.mjs +18 -35
  333. package/dist/plugins/package/mode-local.mjs.map +1 -1
  334. package/dist/plugins/package/publish-executor.mjs +13 -8
  335. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  336. package/dist/plugins/package/publish-output.d.mts +1 -11
  337. package/dist/plugins/package/publish-output.mjs +1 -9
  338. package/dist/plugins/package/publish-output.mjs.map +1 -1
  339. package/dist/plugins/package/registry.d.mts +1 -1
  340. package/dist/plugins/package/registry.mjs +26 -14
  341. package/dist/plugins/package/registry.mjs.map +1 -1
  342. package/dist/plugins/package/service.mjs.map +1 -1
  343. package/dist/plugins/package/snapshot.mjs.map +1 -1
  344. package/dist/plugins/router-entrypoints.mjs +1 -3
  345. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  346. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
  347. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  348. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
  349. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  350. package/dist/plugins/seal/codegen.d.mts +1 -5
  351. package/dist/plugins/seal/codegen.mjs +83 -12
  352. package/dist/plugins/seal/codegen.mjs.map +1 -1
  353. package/dist/plugins/seal/config-render.mjs +2 -6
  354. package/dist/plugins/seal/config-render.mjs.map +1 -1
  355. package/dist/plugins/seal/deploy.mjs +18 -29
  356. package/dist/plugins/seal/deploy.mjs.map +1 -1
  357. package/dist/plugins/seal/errors.d.mts +4 -5
  358. package/dist/plugins/seal/errors.mjs +1 -8
  359. package/dist/plugins/seal/errors.mjs.map +1 -1
  360. package/dist/plugins/seal/index.d.mts +7 -28
  361. package/dist/plugins/seal/index.mjs +69 -47
  362. package/dist/plugins/seal/index.mjs.map +1 -1
  363. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  364. package/dist/plugins/seal/key-server.mjs +1 -6
  365. package/dist/plugins/seal/key-server.mjs.map +1 -1
  366. package/dist/plugins/seal/keygen.mjs +2 -3
  367. package/dist/plugins/seal/keygen.mjs.map +1 -1
  368. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  369. package/dist/plugins/seal/mode/live.mjs +1 -1
  370. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  371. package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
  372. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  373. package/dist/plugins/seal/plugin-key.mjs.map +1 -1
  374. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  375. package/dist/plugins/seal/routable.mjs.map +1 -1
  376. package/dist/plugins/seal/service.mjs.map +1 -1
  377. package/dist/plugins/seal/snapshot.mjs +1 -2
  378. package/dist/plugins/seal/snapshot.mjs.map +1 -1
  379. package/dist/plugins/sui/auto-tick.mjs +5 -5
  380. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  381. package/dist/plugins/sui/chain-build-container.mjs +2 -2
  382. package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
  383. package/dist/plugins/sui/chain-probe.mjs +4 -4
  384. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  385. package/dist/plugins/sui/codegen.d.mts +9 -7
  386. package/dist/plugins/sui/codegen.mjs +49 -46
  387. package/dist/plugins/sui/codegen.mjs.map +1 -1
  388. package/dist/plugins/sui/errors.d.mts +1 -1
  389. package/dist/plugins/sui/errors.mjs +1 -9
  390. package/dist/plugins/sui/errors.mjs.map +1 -1
  391. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
  392. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
  393. package/dist/plugins/sui/exec/index.mjs.map +1 -0
  394. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
  395. package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
  396. package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
  397. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
  398. package/dist/plugins/sui/fork-orchestration.mjs +13 -23
  399. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  400. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  401. package/dist/plugins/sui/index.d.mts +34 -83
  402. package/dist/plugins/sui/index.mjs +200 -68
  403. package/dist/plugins/sui/index.mjs.map +1 -1
  404. package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
  405. package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
  406. package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
  407. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
  408. package/dist/plugins/sui/log-attrs.mjs +11 -0
  409. package/dist/plugins/sui/log-attrs.mjs.map +1 -0
  410. package/dist/plugins/sui/mode/external.mjs +4 -12
  411. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  412. package/dist/plugins/sui/mode/fork.mjs +19 -16
  413. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  414. package/dist/plugins/sui/mode/live.mjs +4 -17
  415. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  416. package/dist/plugins/sui/mode/local.d.mts +1 -0
  417. package/dist/plugins/sui/mode/local.mjs +203 -61
  418. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  419. package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
  420. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  421. package/dist/plugins/sui/mode/shared.d.mts +6 -7
  422. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  423. package/dist/plugins/sui/mode/spec.d.mts +23 -6
  424. package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
  425. package/dist/plugins/sui/move/index.mjs.map +1 -0
  426. package/dist/plugins/sui/move-summary-runner.mjs +8 -4
  427. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
  428. package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
  429. package/dist/plugins/sui/network-resolver.d.mts +6 -6
  430. package/dist/plugins/sui/routable.mjs.map +1 -1
  431. package/dist/plugins/sui/service.mjs +10 -6
  432. package/dist/plugins/sui/service.mjs.map +1 -1
  433. package/dist/plugins/sui/snapshot.mjs +10 -5
  434. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  435. package/dist/plugins/wallet/codegen.d.mts +8 -6
  436. package/dist/plugins/wallet/codegen.mjs +4 -10
  437. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  438. package/dist/plugins/wallet/errors.mjs +1 -4
  439. package/dist/plugins/wallet/errors.mjs.map +1 -1
  440. package/dist/plugins/wallet/index.d.mts +3 -6
  441. package/dist/plugins/wallet/index.mjs +16 -21
  442. package/dist/plugins/wallet/index.mjs.map +1 -1
  443. package/dist/plugins/wallet/origin-policy.mjs +3 -3
  444. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  445. package/dist/plugins/wallet/pairing.mjs +6 -24
  446. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  447. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  448. package/dist/plugins/wallet/routable.mjs.map +1 -1
  449. package/dist/plugins/wallet/server.mjs +17 -24
  450. package/dist/plugins/wallet/server.mjs.map +1 -1
  451. package/dist/plugins/wallet/service.d.mts +2 -2
  452. package/dist/plugins/wallet/service.mjs +4 -15
  453. package/dist/plugins/wallet/service.mjs.map +1 -1
  454. package/dist/plugins/wallet/snapshot.mjs.map +1 -1
  455. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
  456. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  457. package/dist/plugins/walrus/codegen.d.mts +2 -13
  458. package/dist/plugins/walrus/codegen.mjs +93 -28
  459. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  460. package/dist/plugins/walrus/deploy-paths.mjs +2 -3
  461. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  462. package/dist/plugins/walrus/deploy.mjs +26 -19
  463. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  464. package/dist/plugins/walrus/errors.mjs +1 -8
  465. package/dist/plugins/walrus/errors.mjs.map +1 -1
  466. package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
  467. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  468. package/dist/plugins/walrus/index.d.mts +13 -44
  469. package/dist/plugins/walrus/index.mjs +119 -122
  470. package/dist/plugins/walrus/index.mjs.map +1 -1
  471. package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
  472. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  473. package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
  474. package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
  475. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  476. package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
  477. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  478. package/dist/plugins/walrus/routable.mjs.map +1 -1
  479. package/dist/plugins/walrus/service.mjs.map +1 -1
  480. package/dist/plugins/walrus/snapshot.mjs +3 -3
  481. package/dist/plugins/walrus/snapshot.mjs.map +1 -1
  482. package/dist/plugins/walrus/storage-nodes.mjs +53 -14
  483. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  484. package/dist/plugins/walrus/wal-swap.mjs +4 -8
  485. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  486. package/dist/primitives/artifact-publisher.mjs.map +1 -1
  487. package/dist/primitives/cache.d.mts +1 -1
  488. package/dist/runtime/docker/client.mjs +47 -3
  489. package/dist/runtime/docker/client.mjs.map +1 -1
  490. package/dist/runtime/docker/container.mjs +37 -57
  491. package/dist/runtime/docker/container.mjs.map +1 -1
  492. package/dist/runtime/docker/errors.mjs.map +1 -1
  493. package/dist/runtime/docker/exec.mjs +2 -2
  494. package/dist/runtime/docker/exec.mjs.map +1 -1
  495. package/dist/runtime/docker/image.mjs +10 -11
  496. package/dist/runtime/docker/image.mjs.map +1 -1
  497. package/dist/runtime/docker/index.mjs +0 -1
  498. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
  499. package/dist/runtime/docker/inventory.mjs +9 -9
  500. package/dist/runtime/docker/inventory.mjs.map +1 -1
  501. package/dist/runtime/docker/labels.mjs +12 -1
  502. package/dist/runtime/docker/labels.mjs.map +1 -1
  503. package/dist/runtime/docker/network.mjs +6 -6
  504. package/dist/runtime/docker/network.mjs.map +1 -1
  505. package/dist/runtime/docker/render-run-args.mjs.map +1 -1
  506. package/dist/runtime/docker/service.mjs +31 -45
  507. package/dist/runtime/docker/service.mjs.map +1 -1
  508. package/dist/runtime/docker/sweep.mjs +14 -64
  509. package/dist/runtime/docker/sweep.mjs.map +1 -1
  510. package/dist/runtime/docker/volume.mjs +1 -1
  511. package/dist/runtime/docker/volume.mjs.map +1 -1
  512. package/dist/runtime/docker/wrap.mjs +14 -2
  513. package/dist/runtime/docker/wrap.mjs.map +1 -1
  514. package/dist/substrate/brand.d.mts +2 -5
  515. package/dist/substrate/brand.mjs +3 -2
  516. package/dist/substrate/brand.mjs.map +1 -1
  517. package/dist/substrate/cross-process.mjs +2 -16
  518. package/dist/substrate/cross-process.mjs.map +1 -1
  519. package/dist/substrate/event-time.mjs +0 -2
  520. package/dist/substrate/event-time.mjs.map +1 -1
  521. package/dist/substrate/events.d.mts +46 -16
  522. package/dist/substrate/identity.d.mts +11 -5
  523. package/dist/substrate/manifest.d.mts +33 -26
  524. package/dist/substrate/manifest.mjs +8 -3
  525. package/dist/substrate/manifest.mjs.map +1 -1
  526. package/dist/substrate/options.d.mts +33 -4
  527. package/dist/substrate/plugin-ctx.d.mts +70 -0
  528. package/dist/substrate/plugin-ctx.mjs +66 -0
  529. package/dist/substrate/plugin-ctx.mjs.map +1 -0
  530. package/dist/substrate/plugin.d.mts +46 -38
  531. package/dist/substrate/plugin.mjs +13 -9
  532. package/dist/substrate/plugin.mjs.map +1 -1
  533. package/dist/substrate/projection.d.mts +1 -1
  534. package/dist/substrate/runtime/atomic-write.mjs +3 -4
  535. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  536. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  537. package/dist/substrate/runtime/cache/service.mjs +50 -20
  538. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  539. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  540. package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
  541. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
  542. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
  543. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
  544. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  545. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  546. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  547. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -1
  548. package/dist/substrate/runtime/cross-process/index.mjs +0 -2
  549. package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
  550. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
  551. package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
  552. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  553. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
  554. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
  555. package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
  556. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  557. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
  558. package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
  559. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  560. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  561. package/dist/substrate/runtime/errors.mjs +1 -13
  562. package/dist/substrate/runtime/errors.mjs.map +1 -1
  563. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
  564. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
  565. package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
  566. package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
  567. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  568. package/dist/substrate/runtime/http-probe.d.mts +1 -3
  569. package/dist/substrate/runtime/http-probe.mjs.map +1 -1
  570. package/dist/substrate/runtime/index.mjs +1 -6
  571. package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
  572. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  573. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
  574. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  575. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  576. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  578. package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
  579. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  580. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  582. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  583. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  585. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  587. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  589. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  590. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  592. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  593. package/dist/substrate/runtime/managed-container.mjs +8 -10
  594. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  595. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  596. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  597. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  598. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  599. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  600. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  602. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  603. package/dist/substrate/runtime/observability/index.mjs +4 -6
  604. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  605. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  606. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  607. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  608. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  610. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  614. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  615. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  616. package/dist/substrate/runtime/paths.mjs +27 -9
  617. package/dist/substrate/runtime/paths.mjs.map +1 -1
  618. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  619. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  620. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  621. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  622. package/dist/substrate/runtime/probes.d.mts +2 -3
  623. package/dist/substrate/runtime/probes.mjs.map +1 -1
  624. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  625. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  626. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/update.mjs +87 -11
  628. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  629. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  630. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  631. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  632. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  633. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  635. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  636. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  637. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  638. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  639. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  640. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  641. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  642. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  643. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  644. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  645. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  646. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  647. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  649. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  650. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  651. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  652. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  654. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  656. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  658. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  659. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  660. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  661. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  662. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  663. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
  665. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  666. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  667. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  668. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  670. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  671. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  672. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  673. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  674. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  675. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  676. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  677. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  678. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  679. package/dist/surfaces/cli/command-tree.mjs +49 -7
  680. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  681. package/dist/surfaces/cli/commands/config.mjs +1 -1
  682. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  683. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  685. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  686. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  689. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  690. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  692. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  693. package/dist/surfaces/cli/commands/status.mjs +1 -1
  694. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  695. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  697. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  698. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  699. package/dist/surfaces/cli/errors.mjs.map +1 -1
  700. package/dist/surfaces/cli/flags.mjs.map +1 -1
  701. package/dist/surfaces/cli/index.mjs +45 -14
  702. package/dist/surfaces/cli/index.mjs.map +1 -1
  703. package/dist/surfaces/cli/output.mjs.map +1 -1
  704. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  705. package/dist/surfaces/tui/app.mjs +0 -21
  706. package/dist/surfaces/tui/app.mjs.map +1 -1
  707. package/dist/surfaces/tui/dashboard.mjs +0 -48
  708. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  709. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  710. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  711. package/dist/surfaces/tui/errors.mjs.map +1 -1
  712. package/dist/surfaces/tui/event-log.mjs +0 -9
  713. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  714. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  715. package/dist/surfaces/tui/index.mjs +2 -2
  716. package/dist/surfaces/tui/index.mjs.map +1 -1
  717. package/dist/surfaces/tui/input.mjs.map +1 -1
  718. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  719. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  720. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  721. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  722. package/dist/surfaces/tui/resource-table.mjs +8 -10
  723. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  724. package/images/postgres/Dockerfile +0 -1
  725. package/images/sui/Dockerfile +27 -54
  726. package/images/sui/entrypoint.sh +17 -179
  727. package/package.json +23 -15
  728. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  729. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  730. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  731. package/dist/api/plugin-errors.d.mts +0 -7
  732. package/dist/api/plugin-errors.mjs +0 -10
  733. package/dist/api/plugin-errors.mjs.map +0 -1
  734. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  735. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  736. package/dist/contracts/capability-decl.d.mts +0 -40
  737. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  738. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  739. package/dist/orchestrators/run.mjs +0 -91
  740. package/dist/orchestrators/run.mjs.map +0 -1
  741. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  742. package/dist/orchestrators/runtime-composition.mjs +0 -252
  743. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  744. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  745. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  746. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  748. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  749. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  750. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  751. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  752. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  753. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  754. package/dist/plugins/account/spans.mjs +0 -16
  755. package/dist/plugins/account/spans.mjs.map +0 -1
  756. package/dist/plugins/account/variants/env.mjs +0 -24
  757. package/dist/plugins/account/variants/env.mjs.map +0 -1
  758. package/dist/plugins/account/variants/inline.mjs +0 -13
  759. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  760. package/dist/plugins/account/variants/keystore.mjs +0 -91
  761. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  762. package/dist/plugins/action/spans.mjs +0 -11
  763. package/dist/plugins/action/spans.mjs.map +0 -1
  764. package/dist/plugins/coin/spans.mjs +0 -20
  765. package/dist/plugins/coin/spans.mjs.map +0 -1
  766. package/dist/plugins/deepbook/spans.mjs +0 -18
  767. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  768. package/dist/plugins/faucet/spans.mjs +0 -12
  769. package/dist/plugins/faucet/spans.mjs.map +0 -1
  770. package/dist/plugins/package/spans.mjs +0 -14
  771. package/dist/plugins/package/spans.mjs.map +0 -1
  772. package/dist/plugins/postgres/codegen.mjs +0 -42
  773. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  774. package/dist/plugins/postgres/connection.d.mts +0 -33
  775. package/dist/plugins/postgres/connection.mjs.map +0 -1
  776. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  777. package/dist/plugins/postgres/errors.d.mts +0 -60
  778. package/dist/plugins/postgres/errors.mjs +0 -29
  779. package/dist/plugins/postgres/errors.mjs.map +0 -1
  780. package/dist/plugins/postgres/index.d.mts +0 -37
  781. package/dist/plugins/postgres/index.mjs +0 -68
  782. package/dist/plugins/postgres/index.mjs.map +0 -1
  783. package/dist/plugins/postgres/routable.mjs +0 -33
  784. package/dist/plugins/postgres/routable.mjs.map +0 -1
  785. package/dist/plugins/postgres/service.d.mts +0 -50
  786. package/dist/plugins/postgres/service.mjs +0 -179
  787. package/dist/plugins/postgres/service.mjs.map +0 -1
  788. package/dist/plugins/postgres/snapshot.mjs +0 -32
  789. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  790. package/dist/plugins/postgres/spans.mjs +0 -11
  791. package/dist/plugins/postgres/spans.mjs.map +0 -1
  792. package/dist/plugins/seal/spans.mjs +0 -18
  793. package/dist/plugins/seal/spans.mjs.map +0 -1
  794. package/dist/plugins/sui/spans.mjs +0 -17
  795. package/dist/plugins/sui/spans.mjs.map +0 -1
  796. package/dist/plugins/wallet/spans.mjs +0 -22
  797. package/dist/plugins/wallet/spans.mjs.map +0 -1
  798. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  799. package/dist/plugins/walrus/spans.mjs +0 -18
  800. package/dist/plugins/walrus/spans.mjs.map +0 -1
  801. package/dist/runtime/docker/logs.d.mts +0 -1
  802. package/dist/runtime/docker/logs.mjs +0 -34
  803. package/dist/runtime/docker/logs.mjs.map +0 -1
  804. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  805. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  806. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  807. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  808. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  809. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  810. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  811. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  812. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  813. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  814. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  815. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  816. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  818. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  819. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  820. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  821. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  822. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  823. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  826. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  829. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  830. package/dist/substrate/runtime/projection/index.mjs +0 -4
  831. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  832. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  833. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  834. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  835. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  836. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  837. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  839. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  840. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  841. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  842. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  844. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  845. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  846. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  847. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  850. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  851. package/dist/substrate/state-store.d.mts +0 -1
  852. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  853. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  854. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  855. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  856. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  857. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
  858. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"prune.mjs","names":[],"sources":["../../../src/orchestrators/snapshot/prune.ts"],"sourcesContent":["// Prune — label-scoped orphan sweep.\n//\n// Architecture § 4: the L3 prune orchestrator sweeps committed snapshot\n// byproduct images and snapshot-catalog directories whose meta document\n// is missing (partial artifacts) or unreadable. Stack-wide registry\n// pruning (engine resources / stack roster) is a sibling orchestrator and\n// lives elsewhere; this file is scoped to snapshot-adjacent artifacts.\n//\n// Image sweep scope (load-bearing): committed snapshot images are stamped\n// at `docker commit` time with `{managed, app, stack, role:\n// SNAPSHOT_IMAGE_ROLE}` (see `runtime/docker/container.ts`). Prune scopes\n// its sweep to THAT role so it reaps only snapshot byproducts. Plugin\n// BUILD images share `{managed, app, stack}` but carry the source\n// plugin's real role (or none) — never `SNAPSHOT_IMAGE_ROLE` — so the\n// sweep can NEVER untag a live stack's build images and force a silent\n// rebuild. Prune holds only `snapshot.reservation` (not stack liveness)\n// and is CLI-exposed, so this scoping is what keeps it safe against a\n// running stack.\n\nimport { Effect, FileSystem, Schema } from 'effect';\n\nimport type { ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport { SNAPSHOT_IMAGE_ROLE } from '../../runtime/docker/container.ts';\nimport { decodeJsonText } from '../../substrate/runtime/runtime-decode.ts';\nimport { SnapshotMetadataSchema, type SnapshotMetadata } from './descriptor.ts';\nimport { makePhaseFailer } from './phase-error.ts';\nimport { SNAPSHOTS_DIR_NAME } from './wipe.ts';\n\n// -----------------------------------------------------------------------------\n// Errors\n// -----------------------------------------------------------------------------\n\nexport class PrunePhaseError extends Schema.TaggedErrorClass<PrunePhaseError>()(\n\t'SnapshotPrunePhaseError',\n\t{\n\t\tphase: Schema.Literals([\n\t\t\t'enumerate-catalog',\n\t\t\t'read-meta',\n\t\t\t'sweep-images',\n\t\t\t'sweep-directories',\n\t\t]),\n\t\tdetail: Schema.String,\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n\nconst failPhase = makePhaseFailer(PrunePhaseError);\n\n// -----------------------------------------------------------------------------\n// Inputs\n// -----------------------------------------------------------------------------\n\nexport interface PruneInputs {\n\t/** Stack root containing the `snapshots/` catalog. */\n\treadonly stackRoot: string;\n\t/** App/stack scope for the committed-snapshot-image sweep. Prune\n\t * narrows this to `role: SNAPSHOT_IMAGE_ROLE` before removing images,\n\t * so only this stack's snapshot byproducts are swept — never its\n\t * build images, never a sibling stack. */\n\treadonly imageLabelFilter: { readonly app: string; readonly stack: string };\n\treadonly runtime: ContainerRuntime;\n}\n\nexport interface PruneResult {\n\treadonly inspected: number;\n\treadonly reaped: ReadonlyArray<{\n\t\treadonly id: string;\n\t\t/** Reason the artifact was reaped. Currently only `'abandoned'`\n\t\t * (partial artifact with no readable meta document). */\n\t\treadonly classification: 'abandoned';\n\t}>;\n\t/** Count of committed snapshot byproduct images removed (those stamped\n\t * with `role: SNAPSHOT_IMAGE_ROLE` in this app/stack). Build images\n\t * are never included. */\n\treadonly imagesSwept: number;\n}\n\n// -----------------------------------------------------------------------------\n// Helpers\n// -----------------------------------------------------------------------------\n\nconst readMetaOpt = (\n\tdir: string,\n): Effect.Effect<SnapshotMetadata | null, PrunePhaseError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst path = `${dir}/meta.json`;\n\t\tconst exists = yield* fs.exists(path).pipe(Effect.catch(() => Effect.succeed(false)));\n\t\tif (!exists) return null;\n\t\tconst text = yield* fs\n\t\t\t.readFileString(path)\n\t\t\t.pipe(Effect.catch(failPhase('read-meta', `read ${path} failed`)));\n\t\treturn yield* decodeJsonText(SnapshotMetadataSchema, text, {\n\t\t\tsource: path,\n\t\t\tmkError: () => null,\n\t\t}).pipe(Effect.catch(() => Effect.succeed(null)));\n\t});\n\n// -----------------------------------------------------------------------------\n// Top-level prune\n// -----------------------------------------------------------------------------\n\n/**\n * Walk the snapshot catalog and reap partial artifacts (entries whose\n * `meta.json` is missing or unparseable). Concurrent sweeps over the\n * same catalog are not supported (caller holds `snapshot.reservation`\n * or `stack.lock`).\n *\n * Also removes committed snapshot byproduct images via the runtime\n * adapter's label-filtered image cleanup, scoped to `role:\n * SNAPSHOT_IMAGE_ROLE` so build images are never touched.\n */\nexport const runPrune = (\n\tinputs: PruneInputs,\n): Effect.Effect<PruneResult, PrunePhaseError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'devstack.snapshot.phase': 'prune',\n\t\t});\n\t\tconst catalogDir = `${inputs.stackRoot}/${SNAPSHOTS_DIR_NAME}`;\n\t\tconst catalogExists = yield* fs\n\t\t\t.exists(catalogDir)\n\t\t\t.pipe(Effect.catch(() => Effect.succeed(false)));\n\t\tif (!catalogExists) {\n\t\t\treturn { inspected: 0, reaped: [], imagesSwept: 0 } satisfies PruneResult;\n\t\t}\n\t\tconst ids = yield* fs\n\t\t\t.readDirectory(catalogDir)\n\t\t\t.pipe(Effect.catch(failPhase('enumerate-catalog', `readdir ${catalogDir} failed`)));\n\n\t\tconst reaped: Array<{ id: string; classification: 'abandoned' }> = [];\n\t\tfor (const id of ids) {\n\t\t\tconst dir = `${catalogDir}/${id}`;\n\t\t\tconst meta = yield* readMetaOpt(dir);\n\t\t\t// Partial artifacts (no meta) reap to free the disk slot.\n\t\t\t// The catalog list already hides them; reaping is just GC.\n\t\t\tif (meta === null) {\n\t\t\t\tyield* fs\n\t\t\t\t\t.remove(dir, { recursive: true, force: true })\n\t\t\t\t\t.pipe(Effect.catch(failPhase('sweep-directories', `remove ${dir} failed`)));\n\t\t\t\treaped.push({ id, classification: 'abandoned' });\n\t\t\t}\n\t\t}\n\n\t\t// Sweep committed snapshot byproduct images via the runtime\n\t\t// adapter's label-scoped image cleanup. Architecture § Decision §8 —\n\t\t// committed snapshot images accumulate (a hard-killed capture can\n\t\t// leak its temp image before cleanup); the orchestrator GCs them\n\t\t// alongside catalog prune. The `role: SNAPSHOT_IMAGE_ROLE` narrowing\n\t\t// is what distinguishes these byproducts from the live stack's\n\t\t// build images (which share `{app, stack}` but carry a different\n\t\t// role / no role) — without it, prune would untag build images and\n\t\t// force silent rebuilds.\n\t\tconst imagesSwept = yield* inputs.runtime\n\t\t\t.removeManagedImages({ ...inputs.imageLabelFilter, role: SNAPSHOT_IMAGE_ROLE })\n\t\t\t.pipe(Effect.catch(failPhase('sweep-images', `image sweep failed`)));\n\n\t\treturn {\n\t\t\tinspected: ids.length,\n\t\t\treaped,\n\t\t\timagesSwept,\n\t\t} satisfies PruneResult;\n\t}).pipe(Effect.withSpan('orchestrator.snapshot.prune'));\n"],"mappings":";;;;;;;AAgCA,IAAa,kBAAb,cAAqC,OAAO,kBAAmC,CAC9E,2BACA;CACC,OAAO,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA,CAAC;CACF,QAAQ,OAAO;CACf,OAAO,OAAO,SAAS,OAAO,OAAO;CACrC,CACD,CAAC;AAEF,MAAM,YAAY,gBAAgB,gBAAgB;AAmClD,MAAM,eACL,QAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,GAAG,IAAI;AAEpB,KAAI,EAAC,OADiB,GAAG,OAAO,KAAK,CAAC,KAAK,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,EACxE,QAAO;AAIpB,QAAO,OAAO,eAAe,wBAAwB,OAHjC,GAClB,eAAe,KAAK,CACpB,KAAK,OAAO,MAAM,UAAU,aAAa,QAAQ,KAAK,SAAS,CAAC,CAAC,EACR;EAC1D,QAAQ;EACR,eAAe;EACf,CAAC,CAAC,KAAK,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC;EAChD;;;;;;;;;;;AAgBH,MAAa,YACZ,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;AAC7B,QAAO,OAAO,oBAAoB,EACjC,2BAA2B,SAC3B,CAAC;CACF,MAAM,aAAa,GAAG,OAAO,UAAU,GAAG;AAI1C,KAAI,EAAC,OAHwB,GAC3B,OAAO,WAAW,CAClB,KAAK,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,EAEhD,QAAO;EAAE,WAAW;EAAG,QAAQ,EAAE;EAAE,aAAa;EAAG;CAEpD,MAAM,MAAM,OAAO,GACjB,cAAc,WAAW,CACzB,KAAK,OAAO,MAAM,UAAU,qBAAqB,WAAW,WAAW,SAAS,CAAC,CAAC;CAEpF,MAAM,SAA6D,EAAE;AACrE,MAAK,MAAM,MAAM,KAAK;EACrB,MAAM,MAAM,GAAG,WAAW,GAAG;AAI7B,OAAI,OAHgB,YAAY,IAAI,MAGvB,MAAM;AAClB,UAAO,GACL,OAAO,KAAK;IAAE,WAAW;IAAM,OAAO;IAAM,CAAC,CAC7C,KAAK,OAAO,MAAM,UAAU,qBAAqB,UAAU,IAAI,SAAS,CAAC,CAAC;AAC5E,UAAO,KAAK;IAAE;IAAI,gBAAgB;IAAa,CAAC;;;CAalD,MAAM,cAAc,OAAO,OAAO,QAChC,oBAAoB;EAAE,GAAG,OAAO;EAAkB,MAAM;EAAqB,CAAC,CAC9E,KAAK,OAAO,MAAM,UAAU,gBAAgB,qBAAqB,CAAC,CAAC;AAErE,QAAO;EACN,WAAW,IAAI;EACf;EACA;EACA;EACA,CAAC,KAAK,OAAO,SAAS,8BAA8B,CAAC"}
1
+ {"version":3,"file":"prune.mjs","names":[],"sources":["../../../src/orchestrators/snapshot/prune.ts"],"sourcesContent":["// Prune — label-scoped orphan sweep.\n//\n// Architecture § 4: the L3 prune orchestrator sweeps committed snapshot\n// byproduct images and snapshot-catalog directories whose meta document\n// is missing (partial artifacts) or unreadable. Stack-wide registry\n// pruning (engine resources / stack roster) is a sibling orchestrator and\n// lives elsewhere; this file is scoped to snapshot-adjacent artifacts.\n//\n// Image sweep scope (load-bearing): committed snapshot images are stamped\n// at `docker commit` time with `{managed, app, stack, role:\n// SNAPSHOT_IMAGE_ROLE}` (see `runtime/docker/container.ts`). Prune scopes\n// its sweep to THAT role so it reaps only snapshot byproducts. Plugin\n// BUILD images share `{managed, app, stack}` but carry the source\n// plugin's real role (or none) — never `SNAPSHOT_IMAGE_ROLE` — so the\n// sweep can NEVER untag a live stack's build images and force a silent\n// rebuild. Prune holds `stack.lock` only briefly (not stack liveness)\n// and is CLI-exposed, so this scoping is what keeps it safe against a\n// running stack.\n\nimport { Effect, FileSystem, Schema } from 'effect';\n\nimport type { ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport { SNAPSHOT_IMAGE_ROLE } from '../../runtime/docker/container.ts';\nimport { appName, stackName } from '../../substrate/brand.ts';\nimport {\n\tlabelScope,\n\treconcileLabel,\n\treconcileSpec,\n\ttype ReconcileFsOp,\n} from '../../substrate/runtime/reconcile/index.ts';\nimport { decodeJsonText } from '../../substrate/runtime/runtime-decode.ts';\nimport { SnapshotMetadataSchema, type SnapshotMetadata } from './descriptor.ts';\nimport { makePhaseFailer } from './phase-error.ts';\nimport { SNAPSHOTS_DIR_NAME } from './wipe.ts';\n\n// -----------------------------------------------------------------------------\n// Errors\n// -----------------------------------------------------------------------------\n\nexport class PrunePhaseError extends Schema.TaggedErrorClass<PrunePhaseError>()(\n\t'SnapshotPrunePhaseError',\n\t{\n\t\tphase: Schema.Literals(['enumerate-catalog', 'read-meta', 'sweep-images', 'sweep-directories']),\n\t\tdetail: Schema.String,\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n\nconst failPhase = makePhaseFailer(PrunePhaseError);\n\n// -----------------------------------------------------------------------------\n// Inputs\n// -----------------------------------------------------------------------------\n\nexport interface PruneInputs {\n\t/** Stack root containing the `snapshots/` catalog. */\n\treadonly stackRoot: string;\n\t/** App/stack scope for the committed-snapshot-image sweep. Prune\n\t * narrows this to `role: SNAPSHOT_IMAGE_ROLE` before removing images,\n\t * so only this stack's snapshot byproducts are swept — never its\n\t * build images, never a sibling stack. */\n\treadonly imageLabelFilter: { readonly app: string; readonly stack: string };\n\treadonly runtime: ContainerRuntime;\n}\n\nexport interface PruneResult {\n\treadonly inspected: number;\n\treadonly reaped: ReadonlyArray<{\n\t\treadonly id: string;\n\t\t/** Reason the artifact was reaped. Currently only `'abandoned'`\n\t\t * (partial artifact with no readable meta document). */\n\t\treadonly classification: 'abandoned';\n\t}>;\n\t/** Count of committed snapshot byproduct images removed (those stamped\n\t * with `role: SNAPSHOT_IMAGE_ROLE` in this app/stack). Build images\n\t * are never included. */\n\treadonly imagesSwept: number;\n}\n\n// -----------------------------------------------------------------------------\n// Helpers\n// -----------------------------------------------------------------------------\n\nconst readMetaOpt = (\n\tdir: string,\n): Effect.Effect<SnapshotMetadata | null, PrunePhaseError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst path = `${dir}/meta.json`;\n\t\tconst exists = yield* fs.exists(path).pipe(Effect.catch(() => Effect.succeed(false)));\n\t\tif (!exists) return null;\n\t\tconst text = yield* fs\n\t\t\t.readFileString(path)\n\t\t\t.pipe(Effect.catch(failPhase('read-meta', `read ${path} failed`)));\n\t\treturn yield* decodeJsonText(SnapshotMetadataSchema, text, {\n\t\t\tsource: path,\n\t\t\tmkError: () => null,\n\t\t}).pipe(Effect.catch(() => Effect.succeed(null)));\n\t});\n\n// -----------------------------------------------------------------------------\n// Top-level prune\n// -----------------------------------------------------------------------------\n\n/**\n * Walk the snapshot catalog and reap partial artifacts (entries whose\n * `meta.json` is missing or unparseable). Concurrent sweeps over the\n * same catalog are not supported (caller holds `stack.lock`).\n *\n * Also removes committed snapshot byproduct images via the runtime\n * adapter's label-filtered image cleanup, scoped to `role:\n * SNAPSHOT_IMAGE_ROLE` so build images are never touched.\n *\n * Routed through the unified reconcile: a flat LABEL-scope spec narrowed\n * to `role: SNAPSHOT_IMAGE_ROLE`, carrying NO container target (prune\n * mutates no containers — `target: 'running'` is the label-scope no-op\n * container target) and an `fsPlan` of two ops — `reap-meta-missing`\n * (catalog GC) then `reap-images` (byproduct image sweep). Prune never\n * touches the live deploy cache — only the snapshot byproducts (the image\n * GC); the `PruneResult` shape carries `reaped` + `imagesSwept`.\n */\nexport const runPrune = (\n\tinputs: PruneInputs,\n): Effect.Effect<PruneResult, PrunePhaseError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst catalogDir = `${inputs.stackRoot}/${SNAPSHOTS_DIR_NAME}`;\n\n\t\t// Catalog GC reap partial artifacts (no readable meta). The\n\t\t// `isMetaMissing` classifier is prune's projection: a\n\t\t// `readMetaOpt` read+decode lifted to a predicate.\n\t\tconst reapMetaMissing: ReconcileFsOp<PrunePhaseError> = {\n\t\t\top: 'reap-meta-missing',\n\t\t\tcatalogDir,\n\t\t\tisMetaMissing: (dir) => readMetaOpt(dir).pipe(Effect.map((meta) => meta === null)),\n\t\t\tonReaddirError: failPhase('enumerate-catalog', `readdir ${catalogDir} failed`),\n\t\t\tonRemoveError: failPhase('sweep-directories', `remove catalog entry failed`),\n\t\t};\n\n\t\t// Byproduct image sweep architecture § Decision §8. The\n\t\t// `role: SNAPSHOT_IMAGE_ROLE` narrowing (carried on the label tuple)\n\t\t// distinguishes these byproducts from the live stack's build images\n\t\t// (which share `{app, stack}` but carry a different role / no role) —\n\t\t// without it, prune would untag build images and force silent\n\t\t// rebuilds.\n\t\tconst reapImages: ReconcileFsOp<PrunePhaseError> = {\n\t\t\top: 'reap-images',\n\t\t\tonError: failPhase('sweep-images', `image sweep failed`),\n\t\t};\n\n\t\tconst result = yield* reconcileLabel(\n\t\t\treconcileSpec<PrunePhaseError>({\n\t\t\t\t// No container target prune mutates no containers. Label-scope\n\t\t\t\t// only sweeps containers/networks/volumes when `target` is\n\t\t\t\t// `absent`; `running` leaves them untouched.\n\t\t\t\ttarget: 'running',\n\t\t\t\tscope: labelScope({\n\t\t\t\t\tapp: appName(inputs.imageLabelFilter.app),\n\t\t\t\t\tstack: stackName(inputs.imageLabelFilter.stack),\n\t\t\t\t\trole: SNAPSHOT_IMAGE_ROLE,\n\t\t\t\t}),\n\t\t\t\tdirection: 'drain',\n\t\t\t\tfsPlan: { ops: [reapMetaMissing, reapImages] },\n\t\t\t}),\n\t\t\t{ runtime: inputs.runtime },\n\t\t);\n\n\t\treturn {\n\t\t\tinspected: result.inspected,\n\t\t\treaped: result.reapedIds.map((id) => ({ id, classification: 'abandoned' as const })),\n\t\t\timagesSwept: result.imagesSwept,\n\t\t} satisfies PruneResult;\n\t});\n"],"mappings":";;;;;;;;;;;AAuCA,IAAa,kBAAb,cAAqC,OAAO,iBAAkC,CAAC,CAC9E,2BACA;CACC,OAAO,OAAO,SAAS;EAAC;EAAqB;EAAa;EAAgB;CAAmB,CAAC;CAC9F,QAAQ,OAAO;CACf,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CACD,CAAC,CAAC,CAAC;AAEH,MAAM,YAAY,gBAAgB,eAAe;AAmCjD,MAAM,eACL,QAEA,OAAO,IAAI,aAAa;CACvB,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,GAAG,IAAI;CAEpB,IAAI,EAAC,OADiB,GAAG,OAAO,IAAI,CAAC,CAAC,KAAK,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,IACvE,OAAO;CAIpB,OAAO,OAAO,eAAe,wBAAwB,OAHjC,GAClB,eAAe,IAAI,CAAC,CACpB,KAAK,OAAO,MAAM,UAAU,aAAa,QAAQ,KAAK,QAAQ,CAAC,CAAC,GACP;EAC1D,QAAQ;EACR,eAAe;CAChB,CAAC,CAAC,CAAC,KAAK,OAAO,YAAY,OAAO,QAAQ,IAAI,CAAC,CAAC;AACjD,CAAC;;;;;;;;;;;;;;;;;;AAuBF,MAAa,YACZ,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,GAAG,OAAO,UAAU,GAAG;CAK1C,MAAM,kBAAkD;EACvD,IAAI;EACJ;EACA,gBAAgB,QAAQ,YAAY,GAAG,CAAC,CAAC,KAAK,OAAO,KAAK,SAAS,SAAS,IAAI,CAAC;EACjF,gBAAgB,UAAU,qBAAqB,WAAW,WAAW,QAAQ;EAC7E,eAAe,UAAU,qBAAqB,6BAA6B;CAC5E;CAQA,MAAM,aAA6C;EAClD,IAAI;EACJ,SAAS,UAAU,gBAAgB,oBAAoB;CACxD;CAEA,MAAM,SAAS,OAAO,eACrB,cAA+B;EAI9B,QAAQ;EACR,OAAO,WAAW;GACjB,KAAK,QAAQ,OAAO,iBAAiB,GAAG;GACxC,OAAO,UAAU,OAAO,iBAAiB,KAAK;GAC9C,MAAM;EACP,CAAC;EACD,WAAW;EACX,QAAQ,EAAE,KAAK,CAAC,iBAAiB,UAAU,EAAE;CAC9C,CAAC,GACD,EAAE,SAAS,OAAO,QAAQ,CAC3B;CAEA,OAAO;EACN,WAAW,OAAO;EAClB,QAAQ,OAAO,UAAU,KAAK,QAAQ;GAAE;GAAI,gBAAgB;EAAqB,EAAE;EACnF,aAAa,OAAO;CACrB;AACD,CAAC"}
@@ -3,16 +3,18 @@ import { runtimeControlLockPathForStackRoot } from "../../substrate/runtime/cros
3
3
  import { COMMAND_CHANNEL_COMMANDS_FILE_NAME, COMMAND_CHANNEL_EVENTS_FILE_NAME } from "../../substrate/runtime/cross-process/command-channel/channel.mjs";
4
4
  import "../../substrate/runtime/cross-process/command-channel/index.mjs";
5
5
  import { mintRandomSuffix } from "../../substrate/runtime/random-suffix.mjs";
6
+ import { finishTarReader, makeTarReaderState, processTarChunk, skipEntry, stopScan } from "../../substrate/runtime/tar/reader.mjs";
6
7
  import { HostTreeTarError, untarHostTree, validateHostTreeTarEntries } from "../../substrate/runtime/host-tree-tar/index.mjs";
7
- import { ContributionDocSchema, DEPLOY_CACHE_NAMESPACES, SnapshotLayout, SnapshotMetadataSchema, containerImagesBundlePath, contributionPath, isRestorableContainerImageName, isSafeSnapshotPathSegment, isSafeSnapshotRelativePath, parseSnapshotId } from "./descriptor.mjs";
8
+ import { ContributionDocSchema, SnapshotLayout, SnapshotMetadataSchema, containerImagesBundlePath, contributionPath, deployCacheSubtreeRelPaths, isRestorableContainerImageName, isSafeSnapshotPathSegment, isSafeSnapshotRelativePath, parseSnapshotId } from "./descriptor.mjs";
9
+ import "../../substrate/runtime/stage-and-swap/index.mjs";
10
+ import { executeFsPlan } from "../../substrate/runtime/reconcile/fs-plan.mjs";
11
+ import "../../substrate/runtime/reconcile/index.mjs";
8
12
  import { makePhaseFailer } from "./phase-error.mjs";
9
13
  import { CACHE_DIR_NAME, SNAPSHOTS_DIR_NAME } from "./wipe.mjs";
10
14
  import { readImageBundleTags, verifyImageBundleTags } from "./image-bundle-tags.mjs";
11
15
  import { verifyArtifactIntegrity } from "./integrity.mjs";
12
- import { mergeContributions, runIdentityGuard, runRuntimeIdentityGuard } from "./identity-guard.mjs";
13
- import { readSnapshotStateDocument, writeSnapshotStateDocument } from "./state-document.mjs";
14
- import { RESTORE_PENDING_FILE_NAME, RestorePendingDocumentSchema, makePendingMarkerDocument, pendingMarkerPath, removePendingMarker, rewritePendingMarkerContainers, writePendingMarker } from "./pending-marker.mjs";
15
- import { stageAndSwap } from "../../substrate/runtime/stage-and-swap/index.mjs";
16
+ import { mergeContributions, requireIdentity, runIdentityGuard, runRuntimeIdentityGuard } from "./identity-guard.mjs";
17
+ import { clearRestoreSentinel, writeRestoreSentinel } from "./interrupted-restore.mjs";
16
18
  import { Effect, Exit, FileSystem, Schema, Stream } from "effect";
17
19
  //#region src/orchestrators/snapshot/restore.ts
18
20
  /** Tagged failure during a restore step. Phase discriminates the
@@ -22,22 +24,20 @@ var RestorePhaseError = class extends Schema.TaggedErrorClass()("SnapshotRestore
22
24
  "read-meta",
23
25
  "meta-corrupt",
24
26
  "meta-absent",
25
- "read-state",
26
27
  "read-contribution",
27
28
  "read-integrity",
28
29
  "verify-integrity",
29
30
  "preflight",
31
+ "cache-missing",
30
32
  "pre-restore-hook",
31
33
  "untar-host-tree",
32
34
  "load-image",
33
35
  "retag-image",
34
- "expand-state",
35
36
  "post-restore-hook",
36
37
  "pre-cleanup",
37
- "write-restore-pending",
38
- "read-restore-pending",
39
- "clear-restore-pending",
40
- "missing-subtree-fatal"
38
+ "resume",
39
+ "missing-subtree-fatal",
40
+ "graph-input-mismatch"
41
41
  ]),
42
42
  plugin: Schema.optional(Schema.String),
43
43
  detail: Schema.String,
@@ -55,15 +55,6 @@ const failImageBundleTagScan = (phase, plugin) => (cause) => Effect.fail(new Res
55
55
  detail: cause.detail,
56
56
  cause
57
57
  }));
58
- /** Project a `SnapshotStateDocumentError` onto a `RestorePhaseError`,
59
- * branching by `kind` so a phase classifier never inspects message
60
- * substrings. */
61
- const failStateDocument = (readPhase, writePhase, plugin) => (err) => Effect.fail(new RestorePhaseError({
62
- phase: err.kind === "write" ? writePhase : readPhase,
63
- plugin,
64
- detail: err.detail,
65
- cause: err.cause
66
- }));
67
58
  const readMeta = (artifactDir, expectedId) => Effect.gen(function* () {
68
59
  const fs = yield* FileSystem.FileSystem;
69
60
  const path = `${artifactDir}/${SnapshotLayout.metaFile}`;
@@ -90,7 +81,7 @@ const readMeta = (artifactDir, expectedId) => Effect.gen(function* () {
90
81
  if (parsedId === null) return yield* failRestore("meta-corrupt", `meta.json contains an unsafe snapshot id: ${meta.id}`);
91
82
  if (parsedId !== expectedId) return yield* failRestore("meta-corrupt", `meta.json id ${meta.id} does not match requested snapshot id ${expectedId}`);
92
83
  return meta;
93
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.read-meta"));
84
+ });
94
85
  const verifyIntegrity = (artifactDir) => verifyArtifactIntegrity(artifactDir).pipe(Effect.catchTag("SnapshotIntegrityError", (err) => Effect.fail(new RestorePhaseError({
95
86
  phase: err.kind === "missing" ? "read-integrity" : "verify-integrity",
96
87
  detail: err.detail,
@@ -107,13 +98,6 @@ const removeCapturedContainers = (meta, runtime, runtimeIdentity) => Effect.gen(
107
98
  plugin: captured.plugin,
108
99
  role: captured.role
109
100
  }).pipe(Effect.catch(failPhase("pre-cleanup", `remove managed containers for ${captured.plugin}/${captured.role} failed`, captured.plugin)));
110
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.remove-containers"));
111
- const stagedImageToPendingEntry = (image) => ({
112
- plugin: image.captured.plugin,
113
- role: image.captured.role,
114
- targetImageName: image.captured.imageName,
115
- stagedImageTag: image.stagedImageTag,
116
- digest: image.stagedRef.digest
117
101
  });
118
102
  const loadedBundleTags = (bundle) => {
119
103
  const tags = /* @__PURE__ */ new Set();
@@ -121,42 +105,6 @@ const loadedBundleTags = (bundle) => {
121
105
  return tags;
122
106
  };
123
107
  const mintRestoreStagingTag = () => `devstack-snapshot:restore-${mintRandomSuffix(24)}`;
124
- const mapMarkerIoError = (phase) => (err) => Effect.fail(new RestorePhaseError({
125
- phase,
126
- detail: err.detail,
127
- cause: err.cause
128
- }));
129
- const writeRestorePendingMarker = (args) => {
130
- if (args.stagedImages.length === 0) return Effect.void;
131
- const doc = makePendingMarkerDocument({
132
- meta: args.meta,
133
- artifactDir: args.artifactDir,
134
- containers: args.stagedImages.map(stagedImageToPendingEntry)
135
- });
136
- return writePendingMarker(args.runtimeRoot, doc).pipe(Effect.catchTag("SnapshotRestorePendingMarkerIoError", mapMarkerIoError("write-restore-pending")));
137
- };
138
- const rewriteRestorePendingMarker = (runtimeRoot, doc, stillPending) => writePendingMarker(runtimeRoot, rewritePendingMarkerContainers(doc, stillPending)).pipe(Effect.catchTag("SnapshotRestorePendingMarkerIoError", mapMarkerIoError("write-restore-pending")));
139
- const clearRestorePendingMarker = (runtimeRoot) => removePendingMarker(runtimeRoot).pipe(Effect.catchTag("SnapshotRestorePendingMarkerIoError", mapMarkerIoError("clear-restore-pending")));
140
- const readRestorePendingMarker = (runtimeRoot) => Effect.gen(function* () {
141
- const fs = yield* FileSystem.FileSystem;
142
- const path = pendingMarkerPath(runtimeRoot);
143
- if (!(yield* fs.exists(path).pipe(Effect.catch(() => Effect.succeed(false))))) return null;
144
- return yield* decodeUnknown(RestorePendingDocumentSchema, yield* parseJsonText(yield* fs.readFileString(path).pipe(Effect.catch(failPhase("read-restore-pending", `read ${RESTORE_PENDING_FILE_NAME}`))), {
145
- source: path,
146
- mkError: (issue) => new RestorePhaseError({
147
- phase: "read-restore-pending",
148
- detail: `${RESTORE_PENDING_FILE_NAME} is not valid JSON`,
149
- cause: issue.cause
150
- })
151
- }), {
152
- source: path,
153
- mkError: (issue) => new RestorePhaseError({
154
- phase: "read-restore-pending",
155
- detail: `${RESTORE_PENDING_FILE_NAME} failed schema decode`,
156
- cause: issue.cause
157
- })
158
- });
159
- });
160
108
  const requirePathSegment = (kind, value, plugin) => isSafeSnapshotPathSegment(value) ? Effect.void : failRestore("preflight", `unsafe snapshot ${kind} path segment: ${value}`, plugin);
161
109
  const requireReadableNonEmptyFile = (path, phase, detail, plugin) => Effect.gen(function* () {
162
110
  const fs = yield* FileSystem.FileSystem;
@@ -204,8 +152,6 @@ const preflightArtifact = (meta, artifactDir) => Effect.gen(function* () {
204
152
  seenSnapshotTags.set(captured.snapshotTag, captured);
205
153
  }
206
154
  for (const pluginKey of meta.participants) yield* preflightContributionDoc(pluginKey, artifactDir);
207
- const statePath = `${artifactDir}/${SnapshotLayout.stateFile}`;
208
- if (yield* fs.exists(statePath).pipe(Effect.catch(() => Effect.succeed(false)))) yield* readSnapshotStateDocument(statePath).pipe(Effect.catchTag("SnapshotStateDocumentError", failStateDocument("read-state", "expand-state")));
209
155
  if (meta.hostTreeIncluded) {
210
156
  const tarPath = `${artifactDir}/${SnapshotLayout.hostTreeTar}`;
211
157
  yield* requireReadableNonEmptyFile(tarPath, "untar-host-tree", "host-tree tar is required");
@@ -216,7 +162,7 @@ const preflightArtifact = (meta, artifactDir) => Effect.gen(function* () {
216
162
  cause
217
163
  })))).pipe(Effect.catch(failPhase("untar-host-tree", `host-tree tar entry validation failed`)));
218
164
  }
219
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.preflight"));
165
+ });
220
166
  const loadImageBundle = (tarPath, artifactDir, runtime, expectedSnapshotTags) => Effect.gen(function* () {
221
167
  const fs = yield* FileSystem.FileSystem;
222
168
  const fullTarPath = `${artifactDir}/${tarPath}`;
@@ -236,7 +182,7 @@ const loadImageBundle = (tarPath, artifactDir, runtime, expectedSnapshotTags) =>
236
182
  refsByTag.set(ref.tag, ref);
237
183
  }
238
184
  return refsByTag;
239
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.load-image-bundle"));
185
+ });
240
186
  const expectedSnapshotTagsByBundle = (containers) => {
241
187
  const byBundle = /* @__PURE__ */ new Map();
242
188
  for (const captured of containers) {
@@ -259,22 +205,24 @@ const stageLoadedImage = (captured, loadedRef, runtime, registerStagedImage) =>
259
205
  yield* registerStagedImage(stagedImage);
260
206
  yield* runtime.tagImage(loadedRef, stagedImageTag, { removeSourceAfterTag: true }).pipe(Effect.catch(failPhase("retag-image", `tag restored image ${captured.snapshotTag} as staging ref ${stagedImageTag} failed`, captured.plugin)));
261
207
  return stagedImage;
262
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.stage-image"));
208
+ });
263
209
  const cleanupRestoreStagingImages = (runtime, images) => Effect.forEach(images, (image) => runtime.removeImage(image.stagedRef).pipe(Effect.catch((cause) => Effect.logWarning(`remove restore staging image ${image.stagedImageTag} failed during restore cleanup: ${String(cause)}`))), { concurrency: "unbounded" }).pipe(Effect.asVoid);
264
- /** Promote each staged image to its recorded name, rewriting the
265
- * on-disk pending marker after each successful tag. If the loop
266
- * fails mid-way the marker reflects exactly which images are still
267
- * pending (the failed entry + every entry not yet attempted), so
268
- * the supervise-startup `recoverPendingRestore` only has to retry
269
- * the remaining set no scanning Docker for "which targets exist
270
- * already?" required. */
271
- const promoteStagedImages = (images, runtime, runtimeStackRoot, pendingDoc) => Effect.gen(function* () {
272
- for (let i = 0; i < images.length; i += 1) {
273
- const image = images[i];
210
+ /** Promote each staged image to its recorded TARGET name. The target
211
+ * name is the original image name the supervisor used for the
212
+ * container, so leaving the staged image at that name lets the next
213
+ * boot's image-match adoption (`decideRunAction`) find it locally and
214
+ * `docker run` it — no scanner, no on-disk marker. A mid-loop failure
215
+ * promotes a prefix of the images; the inner staging-cleanup scope
216
+ * prunes the un-promoted staging refs, and a re-run of restore re-stages
217
+ * and re-promotes from the snapshot artifact. */
218
+ const promoteStagedImages = (images, runtime) => Effect.gen(function* () {
219
+ for (const image of images) {
220
+ const oldDigest = yield* runtime.inspectImageDigest(image.captured.imageName).pipe(Effect.catch(() => Effect.succeed(null)));
274
221
  yield* runtime.tagImage(image.stagedRef, image.captured.imageName, { removeSourceAfterTag: true }).pipe(Effect.catch(failPhase("retag-image", `tag staged image ${image.stagedImageTag} as ${image.captured.imageName} failed`, image.captured.plugin)));
275
- if (pendingDoc !== null) yield* rewriteRestorePendingMarker(runtimeStackRoot, pendingDoc, images.slice(i + 1).map(stagedImageToPendingEntry));
222
+ const newDigest = yield* runtime.inspectImageDigest(image.captured.imageName).pipe(Effect.catch(() => Effect.succeed(null)));
223
+ if (oldDigest !== null && oldDigest !== newDigest) yield* runtime.removeImage({ digest: oldDigest }).pipe(Effect.catch((cause) => Effect.logWarning(`GC of superseded image layer ${oldDigest} for ${image.captured.imageName} failed (best-effort): ${String(cause)}`)));
276
224
  }
277
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.promote-images"));
225
+ });
278
226
  const restoreHostTree = (artifactDir, target) => Effect.gen(function* () {
279
227
  const fs = yield* FileSystem.FileSystem;
280
228
  const tarPath = `${artifactDir}/${SnapshotLayout.hostTreeTar}`;
@@ -289,150 +237,227 @@ const restoreHostTree = (artifactDir, target) => Effect.gen(function* () {
289
237
  cause
290
238
  })));
291
239
  yield* Effect.scoped(untarHostTree(tarStream, { target })).pipe(Effect.catch(failPhase("untar-host-tree", `untar ${tarPath} to ${target} failed`)));
292
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore.host-tree"));
240
+ });
293
241
  const LIVE_RESTORE_PRESERVED_PATHS = [
294
- {
295
- relativePath: SNAPSHOTS_DIR_NAME,
296
- kind: "directory"
297
- },
298
- {
299
- relativePath: COMMAND_CHANNEL_COMMANDS_FILE_NAME,
300
- kind: "file"
301
- },
302
- {
303
- relativePath: COMMAND_CHANNEL_EVENTS_FILE_NAME,
304
- kind: "file"
305
- },
306
- {
307
- relativePath: "roster.json",
308
- kind: "file"
309
- },
310
- {
311
- relativePath: "container-claims.json",
312
- kind: "file"
313
- },
314
- {
315
- relativePath: "snapshot.reservation",
316
- kind: "file"
317
- },
318
- ...DEPLOY_CACHE_NAMESPACES.map((namespace) => ({
319
- relativePath: `${CACHE_DIR_NAME}/${namespace}`,
320
- kind: "directory",
321
- overwrite: false
322
- }))
242
+ { relativePath: SNAPSHOTS_DIR_NAME },
243
+ { relativePath: COMMAND_CHANNEL_COMMANDS_FILE_NAME },
244
+ { relativePath: COMMAND_CHANNEL_EVENTS_FILE_NAME },
245
+ { relativePath: "roster.json" }
323
246
  ];
247
+ /** The deploy-cache subtree relPaths (`cache/<ns>`) the snapshot RECORDS as
248
+ * captured in its metadata. Capture tars a namespace only if it existed on disk
249
+ * (`missingTolerance: 'fine'`) and writes `meta.subtrees` AFTER a successful
250
+ * tar, so a relPath here means "this snapshot intended to carry this cache
251
+ * namespace". A disabled-plugin namespace (e.g. `cache/deepbook` in a
252
+ * deepbook-less stack) is simply absent from the list, so the preflight never
253
+ * over-requires it. */
254
+ const recordedDeployCacheRelPaths = (meta) => {
255
+ const expected = new Set(deployCacheSubtreeRelPaths(CACHE_DIR_NAME));
256
+ const recorded = [];
257
+ for (const subtree of meta.subtrees) if (expected.has(subtree.relPath)) recorded.push(subtree.relPath);
258
+ return recorded;
259
+ };
260
+ /** Stream the host-tree tar and collect which of `expectedRelPaths` physically
261
+ * appear as an entry prefix. An entry path `cache/<ns>/<chain>/<hash>.json`
262
+ * (or the bare `cache/<ns>/` directory) marks `cache/<ns>` present. Read-only:
263
+ * bodies are skipped, never buffered. */
264
+ const scanHostTreeCacheRelPaths = (artifactDir, expectedRelPaths) => Effect.gen(function* () {
265
+ const fs = yield* FileSystem.FileSystem;
266
+ const tarPath = `${artifactDir}/${SnapshotLayout.hostTreeTar}`;
267
+ const present = /* @__PURE__ */ new Set();
268
+ const state = makeTarReaderState();
269
+ const matchEntry = (entryPath) => {
270
+ for (const rel of expectedRelPaths) {
271
+ if (present.has(rel)) continue;
272
+ if (entryPath === rel || entryPath.startsWith(`${rel}/`)) present.add(rel);
273
+ }
274
+ };
275
+ const hooks = {
276
+ onEntry: (entry) => {
277
+ matchEntry(entry.path);
278
+ return present.size === expectedRelPaths.length ? stopScan() : skipEntry();
279
+ },
280
+ onExtendedError: (detail) => new RestorePhaseError({
281
+ phase: "cache-missing",
282
+ detail
283
+ })
284
+ };
285
+ const tarStream = fs.stream(tarPath).pipe(Stream.mapError((cause) => new RestorePhaseError({
286
+ phase: "cache-missing",
287
+ detail: `read host-tree tar failed at ${tarPath}`,
288
+ cause
289
+ })), Stream.takeWhile(() => !state.stopped));
290
+ yield* Stream.runForEach(tarStream, (chunk) => {
291
+ const error = processTarChunk(state, chunk, hooks);
292
+ return error === null ? Effect.void : Effect.fail(error);
293
+ });
294
+ const finalError = finishTarReader(state, (detail) => new RestorePhaseError({
295
+ phase: "cache-missing",
296
+ detail
297
+ }));
298
+ if (finalError !== null) return yield* Effect.fail(finalError);
299
+ return present;
300
+ });
324
301
  /**
325
- * Run the full restore. Bracketed-atomic via `stageAndSwap` at the
326
- * runtime-root level external watchers never observe a half-restored
327
- * tree.
302
+ * The SNAPSHOT's host-tree `cache/<DEPLOY_CACHE_NAMESPACES>` is the SOLE source
303
+ * of the on-chain deploy/mint ids on restore (capture tars `cache/<ns>` into the
304
+ * artifact; restore untars it and does NOT preserve-from-live — see
305
+ * LIVE_RESTORE_PRESERVED_PATHS). So the cache check is against the SNAPSHOT, not
306
+ * the live stack — which is exactly what makes a CROSS-MACHINE restore work: a
307
+ * fresh runner has an empty live cache, and the snapshot supplies the ids.
328
308
  *
329
- * Order:
330
- * 1. Read meta.json (refuse if absent / corrupt no mutation).
331
- * 2. Run identity-guard against runtime metadata and merged plugin
332
- * contributions (refuse on any disagreementno mutation).
333
- * 3. Pre-restore hooks (per-plugin validation; soft errors).
334
- * 4. Stage:
335
- * - Untar host-tree into staging.
336
- * - Copy state.json into staging.
337
- * - Re-read contribution docs.
338
- * - Load image bundles and stage verified snapshot tags.
339
- * - Write a restore-pending marker into the staged root.
340
- * 5. Atomic swap staging → runtime root, preserving live command /
341
- * event channel files and other explicit runtime-control files.
342
- * 6. Promote staged images to recorded refs, then remove captured
343
- * managed containers by label. If this fails, the pending marker
344
- * remains in the restored root for diagnosis/recovery.
345
- * 7. Post-restore hooks.
309
+ * Refuse (fail-closed, BEFORE any mutation, matching the identity-guard posture)
310
+ * if the snapshot's cache is NOT self-contained: every deploy-cache namespace
311
+ * the metadata RECORDS as captured must be physically present in the host-tree
312
+ * tar. A partial loss (metadata claims `cache/<ns>` but the tar lacks it a
313
+ * corrupted/tampered artifact) would let the post-restore boot re-deploy that
314
+ * namespace with FRESH ids and orphan its pre-snapshot objects. Requiring ALL
315
+ * recorded namespaces (not just ANY one) is the FIX over the prior "any one dir
316
+ * present" check, which passed a partial cache and re-minted the rest.
346
317
  *
347
- * The caller is responsible for `acquireReservation`; restore supplies
348
- * the runtime-control publish lock to `stageAndSwap`.
318
+ * A snapshot that records NO deploy-cache subtrees (a genuine pre-deploy /
319
+ * empty-stack capture) has nothing to verify and passes — there are no minted
320
+ * ids to lose. The matrix's hard-reset phase asserts the loud re-deploy on a
321
+ * post-restore live-cache wipe.
322
+ */
323
+ const requireSnapshotDeployCache = (meta, artifactDir) => Effect.gen(function* () {
324
+ const recorded = recordedDeployCacheRelPaths(meta);
325
+ if (recorded.length === 0) return;
326
+ if (!meta.hostTreeIncluded) return yield* failRestore("cache-missing", `snapshot metadata records deploy-cache subtrees (${recorded.join(", ")}) but the artifact carries no host-tree tar. The snapshot's cache is the SOLE source of the on-chain deploy/mint ids restore reuses; restoring without it would let the next boot re-deploy with FRESH ids and orphan every pre-snapshot object. Refusing.`);
327
+ const present = yield* scanHostTreeCacheRelPaths(artifactDir, recorded);
328
+ const missing = recorded.filter((rel) => !present.has(rel));
329
+ if (missing.length > 0) return yield* failRestore("cache-missing", `snapshot host-tree is missing deploy-cache namespaces it recorded as captured (${missing.join(", ")}). The snapshot's cache is the SOLE source of the on-chain deploy/mint ids restore reuses; a partial cache would let the next boot re-deploy the missing namespaces with FRESH ids and orphan their pre-snapshot objects. Refusing.`);
330
+ });
331
+ const graphInputMismatchDetail = (snapshotGraphInputId, currentGraphInputId) => `snapshot graph input id ${snapshotGraphInputId} does not match current graph input id ${currentGraphInputId}; restoring may create inconsistent state`;
332
+ const checkGraphInputCompatibility = (meta, current, policy) => {
333
+ if (current === void 0) return Effect.void;
334
+ if (meta.graphInput.graphInputId === current.graphInputId) return Effect.void;
335
+ const detail = graphInputMismatchDetail(meta.graphInput.graphInputId, current.graphInputId);
336
+ if (policy === "block") return Effect.fail(new RestorePhaseError({
337
+ phase: "graph-input-mismatch",
338
+ detail
339
+ }));
340
+ return Effect.logWarning(detail);
341
+ };
342
+ /**
343
+ * Run the full restore. Routed through the unified reconcile as an
344
+ * ORDERED 4-step body — restore is NOT a single converge target
345
+ * but a destructive ordered pair around an fs swap:
346
+ *
347
+ * step0 — PRECONDITION: identity-guard, FAIL-CLOSED BEFORE ANY MUTATION.
348
+ * The runtime-identity guard + merged plugin-contribution guard
349
+ * complete BEFORE the first mutation (the docker load/tag inside
350
+ * the swap-tree build). On mismatch the sweep / load / tag spies
351
+ * stay EMPTY — zero mutations (restore.test `:214/:263`). Keep
352
+ * the pure meta read → guard → only then mutate ordering.
353
+ * step1 — fsPlan `swap-tree(untar)`: a single-op `ReconcileFsPlan` run
354
+ * through `executeFsPlan`, which publishes the new tree via the
355
+ * UNCHANGED `stageAndSwap`. The build untars the host-tree +
356
+ * loads/stages the committed image bundle into staging; the
357
+ * atomic swap preserves the RESTORE preserve list
358
+ * (`LIVE_RESTORE_PRESERVED_PATHS` — per-namespace live cache +
359
+ * control files, a restore-direction constant, NOT wipe's
360
+ * wholesale predicate). Promote staged
361
+ * images to their captured TARGET names is the swap step's
362
+ * docker tail.
363
+ * step2 R1 — HARD container removal (target = absent, label scope,
364
+ * policy-independent, unconditional, claim-bypassing) via
365
+ * `removeManagedContainers`. STRICTLY before R2. Never expressed
366
+ * as flip-image-and-let-decideRunAction-recreate (guardrail
367
+ * §3.6).
368
+ * step2 R2 — CONVERGE (recreate-from-fresh): NOT in `runRestore`. R1
369
+ * removed the containers, so the NEXT acquire (the live
370
+ * supervisor's `doSelectiveRestart`, itself routed through
371
+ * `reconcileGraph`, or the offline CLI's next-boot acquire) sees
372
+ * facts:null → fresh → creates from the RESTORED images. Verb is
373
+ * recreate-from-fresh, NOT adopt.
374
+ *
375
+ * Bracketed-atomic at the runtime-root level — external watchers never
376
+ * observe a half-restored tree. The caller holds `stack.lock` for the
377
+ * bounded snapshot window; restore supplies the runtime-control publish lock
378
+ * to the swap-tree op.
349
379
  */
350
380
  const runRestore = (inputs) => Effect.gen(function* () {
351
- yield* Effect.annotateCurrentSpan({
352
- "devstack.snapshot.phase": "restore",
353
- "devstack.snapshot.artifact": inputs.artifactDir
354
- });
355
381
  const meta = yield* readMeta(inputs.artifactDir, inputs.snapshotId);
356
382
  yield* verifyIntegrity(inputs.artifactDir);
383
+ yield* checkGraphInputCompatibility(meta, inputs.currentGraphInput, inputs.graphInputMismatchPolicy);
357
384
  yield* runRuntimeIdentityGuard({
358
385
  app: meta.app,
359
386
  stack: meta.stack,
360
387
  network: meta.network
361
388
  }, inputs.runtimeIdentity);
362
- const liveContributions = [];
363
- for (const participant of inputs.participants) {
364
- const slice = yield* participant.liveIdentity;
365
- liveContributions.push({
366
- plugin: participant.plugin,
367
- slice
368
- });
389
+ if (inputs.participants.length === 0) yield* requireIdentity(meta.identity, "snapshot");
390
+ else {
391
+ const liveContributions = [];
392
+ for (const participant of inputs.participants) {
393
+ const slice = yield* participant.liveIdentity;
394
+ liveContributions.push({
395
+ plugin: participant.plugin,
396
+ slice
397
+ });
398
+ }
399
+ const live = yield* mergeContributions(liveContributions);
400
+ yield* runIdentityGuard(meta.identity, live);
369
401
  }
370
- const live = yield* mergeContributions(liveContributions);
371
- yield* runIdentityGuard(meta.identity, live);
402
+ yield* requireSnapshotDeployCache(meta, inputs.artifactDir);
372
403
  for (const participant of inputs.participants) if (participant.preRestore) yield* participant.preRestore.pipe(Effect.catch(failPhase("pre-restore-hook", `preRestore failed`, participant.plugin)));
373
404
  yield* preflightArtifact(meta, inputs.artifactDir);
374
405
  yield* Effect.scoped(Effect.gen(function* () {
375
406
  const stagedImages = [];
376
407
  let recoveryHandoffComplete = false;
377
408
  yield* Effect.addFinalizer((exit) => Exit.isFailure(exit) && !recoveryHandoffComplete ? cleanupRestoreStagingImages(inputs.runtime, stagedImages) : Effect.void);
378
- yield* stageAndSwap({
409
+ const swapBuild = Effect.gen(function* () {
410
+ if (meta.hostTreeIncluded) yield* restoreHostTree(inputs.artifactDir, inputs.runtimeStagingPath);
411
+ const fs = yield* FileSystem.FileSystem;
412
+ for (const pluginKey of meta.participants) {
413
+ const path = `${inputs.artifactDir}/${contributionPath(pluginKey)}`;
414
+ if (!(yield* fs.exists(path).pipe(Effect.catch(() => Effect.succeed(false))))) return yield* Effect.fail(new RestorePhaseError({
415
+ phase: "read-contribution",
416
+ plugin: pluginKey,
417
+ detail: `contribution doc absent at ${path}`
418
+ }));
419
+ }
420
+ const expectedTagsByBundle = expectedSnapshotTagsByBundle(meta.containers);
421
+ const loadedRefsBySnapshotTag = /* @__PURE__ */ new Map();
422
+ for (const [tarPath, expectedTags] of expectedTagsByBundle) {
423
+ const loadedRefs = yield* loadImageBundle(tarPath, inputs.artifactDir, inputs.runtime, expectedTags);
424
+ for (const [tag, ref] of loadedRefs) loadedRefsBySnapshotTag.set(tag, ref);
425
+ }
426
+ for (const captured of meta.containers) {
427
+ const loadedRef = loadedRefsBySnapshotTag.get(captured.snapshotTag);
428
+ if (loadedRef === void 0) return yield* failRestore("load-image", `container image bundle did not return loaded ref for ${captured.snapshotTag}`, captured.plugin);
429
+ yield* stageLoadedImage(captured, loadedRef, inputs.runtime, (image) => Effect.sync(() => {
430
+ stagedImages.push(image);
431
+ }));
432
+ }
433
+ yield* writeRestoreSentinel(inputs.runtimeStagingPath, {
434
+ snapshotId: inputs.snapshotId,
435
+ artifactDir: inputs.artifactDir
436
+ });
437
+ return stagedImages;
438
+ });
439
+ yield* executeFsPlan({ ops: [{
440
+ op: "swap-tree",
379
441
  targetPath: inputs.runtimeStackRoot,
380
442
  stagingPath: inputs.runtimeStagingPath,
381
443
  backupPath: inputs.runtimeBackupPath,
444
+ buildEffect: swapBuild,
382
445
  preserveFromTarget: LIVE_RESTORE_PRESERVED_PATHS,
383
446
  publishLockPath: runtimeControlLockPathForStackRoot(inputs.runtimeStackRoot),
384
- build: Effect.gen(function* () {
385
- if (meta.hostTreeIncluded) yield* restoreHostTree(inputs.artifactDir, inputs.runtimeStagingPath);
386
- const fs = yield* FileSystem.FileSystem;
387
- const srcState = `${inputs.artifactDir}/${SnapshotLayout.stateFile}`;
388
- if (yield* fs.exists(srcState).pipe(Effect.catch(() => Effect.succeed(false)))) {
389
- const stateDoc = yield* readSnapshotStateDocument(srcState).pipe(Effect.catchTag("SnapshotStateDocumentError", failStateDocument("read-state", "expand-state")));
390
- yield* writeSnapshotStateDocument(`${inputs.runtimeStagingPath}/${SnapshotLayout.stateFile}`, stateDoc).pipe(Effect.catchTag("SnapshotStateDocumentError", failStateDocument("expand-state", "expand-state")));
391
- }
392
- for (const pluginKey of meta.participants) {
393
- const path = `${inputs.artifactDir}/${contributionPath(pluginKey)}`;
394
- if (!(yield* fs.exists(path).pipe(Effect.catch(() => Effect.succeed(false))))) return yield* Effect.fail(new RestorePhaseError({
395
- phase: "read-contribution",
396
- plugin: pluginKey,
397
- detail: `contribution doc absent at ${path}`
398
- }));
399
- }
400
- const expectedTagsByBundle = expectedSnapshotTagsByBundle(meta.containers);
401
- const loadedRefsBySnapshotTag = /* @__PURE__ */ new Map();
402
- for (const [tarPath, expectedTags] of expectedTagsByBundle) {
403
- const loadedRefs = yield* loadImageBundle(tarPath, inputs.artifactDir, inputs.runtime, expectedTags);
404
- for (const [tag, ref] of loadedRefs) loadedRefsBySnapshotTag.set(tag, ref);
405
- }
406
- for (const captured of meta.containers) {
407
- const loadedRef = loadedRefsBySnapshotTag.get(captured.snapshotTag);
408
- if (loadedRef === void 0) return yield* failRestore("load-image", `container image bundle did not return loaded ref for ${captured.snapshotTag}`, captured.plugin);
409
- yield* stageLoadedImage(captured, loadedRef, inputs.runtime, (image) => Effect.sync(() => {
410
- stagedImages.push(image);
411
- }));
412
- }
413
- yield* writeRestorePendingMarker({
414
- runtimeRoot: inputs.runtimeStagingPath,
415
- meta,
416
- artifactDir: inputs.artifactDir,
417
- stagedImages
418
- });
419
- return stagedImages;
420
- })
421
- });
422
- if (stagedImages.length > 0) {
423
- const pendingDocAfterSwap = yield* readRestorePendingMarker(inputs.runtimeStackRoot);
424
- yield* Effect.uninterruptible(Effect.gen(function* () {
425
- yield* promoteStagedImages(stagedImages, inputs.runtime, inputs.runtimeStackRoot, pendingDocAfterSwap);
426
- yield* removeCapturedContainers(meta, inputs.runtime, inputs.runtimeIdentity);
427
- yield* clearRestorePendingMarker(inputs.runtimeStackRoot);
428
- recoveryHandoffComplete = true;
429
- }));
430
- } else recoveryHandoffComplete = true;
447
+ onSwapError: (cause) => Effect.fail(cause)
448
+ }] });
449
+ if (stagedImages.length > 0) yield* Effect.uninterruptible(Effect.gen(function* () {
450
+ yield* promoteStagedImages(stagedImages, inputs.runtime);
451
+ yield* removeCapturedContainers(meta, inputs.runtime, inputs.runtimeIdentity);
452
+ recoveryHandoffComplete = true;
453
+ }));
454
+ else recoveryHandoffComplete = true;
455
+ yield* clearRestoreSentinel(inputs.runtimeStackRoot);
431
456
  }));
432
457
  for (const participant of inputs.participants) if (participant.postRestore) yield* participant.postRestore.pipe(Effect.catch(failPhase("post-restore-hook", `postRestore failed`, participant.plugin)));
433
458
  return meta;
434
- }).pipe(Effect.withSpan("orchestrator.snapshot.restore"));
459
+ });
435
460
  //#endregion
436
- export { RestorePhaseError, runRestore };
461
+ export { RestorePhaseError, graphInputMismatchDetail, runRestore };
437
462
 
438
463
  //# sourceMappingURL=restore.mjs.map