@mysten-incubation/devstack 0.1.1 → 0.3.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 (861) hide show
  1. package/README.md +6 -3
  2. package/dashboard-ui/assets/grpc-Clz0oOtc.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-Cmqv9kiU.js +1283 -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 +203 -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 +3 -31
  29. package/dist/build-integrations/playwright/config.mjs +2 -28
  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 +114 -19
  58. package/dist/build-integrations/vite/index.mjs +239 -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 +15 -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 +8 -5
  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 +225 -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 +450 -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 -32
  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 +303 -60
  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 +124 -168
  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 +25 -46
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +52 -93
  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 +45 -37
  276. package/dist/plugins/deepbook/index.mjs +136 -67
  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 +44 -93
  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 +37 -6
  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 +2 -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/file-watcher.mjs +54 -0
  576. package/dist/substrate/runtime/lifecycle/file-watcher.mjs.map +1 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  578. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  579. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  580. package/dist/substrate/runtime/lifecycle/index.mjs +3 -2
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  582. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  583. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  585. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  587. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  589. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  590. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  592. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +76 -7
  593. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  594. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  595. package/dist/substrate/runtime/managed-container.mjs +8 -10
  596. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  597. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  598. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  599. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  600. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  602. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  603. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  604. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  605. package/dist/substrate/runtime/observability/index.mjs +4 -6
  606. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  607. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  608. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  610. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  614. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  615. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  616. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  617. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  618. package/dist/substrate/runtime/paths.mjs +27 -9
  619. package/dist/substrate/runtime/paths.mjs.map +1 -1
  620. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  621. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  622. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  623. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  624. package/dist/substrate/runtime/probes.d.mts +2 -3
  625. package/dist/substrate/runtime/probes.mjs.map +1 -1
  626. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  628. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  629. package/dist/substrate/runtime/projection/update.mjs +87 -11
  630. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  631. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  632. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  633. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  635. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  636. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  637. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  638. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  639. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  640. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  641. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  642. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  643. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  644. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  645. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  646. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  647. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  649. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  650. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  651. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  652. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  654. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  656. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  658. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  659. package/dist/substrate/runtime/supervisor/contribution-dispatcher.d.mts +1 -0
  660. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  661. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  662. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  663. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  665. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  666. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  667. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +61 -75
  668. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  670. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  671. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  672. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  673. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  674. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  675. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  676. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  677. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  678. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  679. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  680. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  681. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  682. package/dist/surfaces/cli/command-tree.mjs +49 -7
  683. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/config.mjs +1 -1
  685. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  686. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  689. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  690. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  692. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  693. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  694. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  695. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/status.mjs +1 -1
  697. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  698. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  699. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  700. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  701. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  702. package/dist/surfaces/cli/errors.mjs.map +1 -1
  703. package/dist/surfaces/cli/flags.mjs.map +1 -1
  704. package/dist/surfaces/cli/index.mjs +45 -14
  705. package/dist/surfaces/cli/index.mjs.map +1 -1
  706. package/dist/surfaces/cli/output.mjs.map +1 -1
  707. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  708. package/dist/surfaces/tui/app.mjs +0 -21
  709. package/dist/surfaces/tui/app.mjs.map +1 -1
  710. package/dist/surfaces/tui/dashboard.mjs +0 -48
  711. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  712. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  713. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  714. package/dist/surfaces/tui/errors.mjs.map +1 -1
  715. package/dist/surfaces/tui/event-log.mjs +0 -9
  716. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  717. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  718. package/dist/surfaces/tui/index.mjs +2 -2
  719. package/dist/surfaces/tui/index.mjs.map +1 -1
  720. package/dist/surfaces/tui/input.mjs.map +1 -1
  721. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  722. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  723. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  724. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  725. package/dist/surfaces/tui/resource-table.mjs +8 -10
  726. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  727. package/images/postgres/Dockerfile +0 -1
  728. package/images/sui/Dockerfile +27 -54
  729. package/images/sui/entrypoint.sh +17 -179
  730. package/package.json +23 -15
  731. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  732. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  733. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  734. package/dist/api/plugin-errors.d.mts +0 -7
  735. package/dist/api/plugin-errors.mjs +0 -10
  736. package/dist/api/plugin-errors.mjs.map +0 -1
  737. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  738. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  739. package/dist/contracts/capability-decl.d.mts +0 -40
  740. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  741. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  742. package/dist/orchestrators/run.mjs +0 -91
  743. package/dist/orchestrators/run.mjs.map +0 -1
  744. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  745. package/dist/orchestrators/runtime-composition.mjs +0 -252
  746. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  748. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  749. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  750. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  751. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  752. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  753. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  754. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  755. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  756. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  757. package/dist/plugins/account/spans.mjs +0 -16
  758. package/dist/plugins/account/spans.mjs.map +0 -1
  759. package/dist/plugins/account/variants/env.mjs +0 -24
  760. package/dist/plugins/account/variants/env.mjs.map +0 -1
  761. package/dist/plugins/account/variants/inline.mjs +0 -13
  762. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  763. package/dist/plugins/account/variants/keystore.mjs +0 -91
  764. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  765. package/dist/plugins/action/spans.mjs +0 -11
  766. package/dist/plugins/action/spans.mjs.map +0 -1
  767. package/dist/plugins/coin/spans.mjs +0 -20
  768. package/dist/plugins/coin/spans.mjs.map +0 -1
  769. package/dist/plugins/deepbook/spans.mjs +0 -18
  770. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  771. package/dist/plugins/faucet/spans.mjs +0 -12
  772. package/dist/plugins/faucet/spans.mjs.map +0 -1
  773. package/dist/plugins/package/spans.mjs +0 -14
  774. package/dist/plugins/package/spans.mjs.map +0 -1
  775. package/dist/plugins/postgres/codegen.mjs +0 -42
  776. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  777. package/dist/plugins/postgres/connection.d.mts +0 -33
  778. package/dist/plugins/postgres/connection.mjs.map +0 -1
  779. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  780. package/dist/plugins/postgres/errors.d.mts +0 -60
  781. package/dist/plugins/postgres/errors.mjs +0 -29
  782. package/dist/plugins/postgres/errors.mjs.map +0 -1
  783. package/dist/plugins/postgres/index.d.mts +0 -37
  784. package/dist/plugins/postgres/index.mjs +0 -68
  785. package/dist/plugins/postgres/index.mjs.map +0 -1
  786. package/dist/plugins/postgres/routable.mjs +0 -33
  787. package/dist/plugins/postgres/routable.mjs.map +0 -1
  788. package/dist/plugins/postgres/service.d.mts +0 -50
  789. package/dist/plugins/postgres/service.mjs +0 -179
  790. package/dist/plugins/postgres/service.mjs.map +0 -1
  791. package/dist/plugins/postgres/snapshot.mjs +0 -32
  792. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  793. package/dist/plugins/postgres/spans.mjs +0 -11
  794. package/dist/plugins/postgres/spans.mjs.map +0 -1
  795. package/dist/plugins/seal/spans.mjs +0 -18
  796. package/dist/plugins/seal/spans.mjs.map +0 -1
  797. package/dist/plugins/sui/spans.mjs +0 -17
  798. package/dist/plugins/sui/spans.mjs.map +0 -1
  799. package/dist/plugins/wallet/spans.mjs +0 -22
  800. package/dist/plugins/wallet/spans.mjs.map +0 -1
  801. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  802. package/dist/plugins/walrus/spans.mjs +0 -18
  803. package/dist/plugins/walrus/spans.mjs.map +0 -1
  804. package/dist/runtime/docker/logs.d.mts +0 -1
  805. package/dist/runtime/docker/logs.mjs +0 -34
  806. package/dist/runtime/docker/logs.mjs.map +0 -1
  807. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  808. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  809. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  810. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  811. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  812. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  813. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  814. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  815. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  816. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  818. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  819. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  820. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  821. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  822. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  823. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  826. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  829. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  830. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  831. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  832. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  833. package/dist/substrate/runtime/projection/index.mjs +0 -4
  834. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  835. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  836. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  837. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  839. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  840. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  841. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  842. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  844. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  845. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  846. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  847. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  850. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  851. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  852. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  853. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  854. package/dist/substrate/state-store.d.mts +0 -1
  855. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  856. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  857. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  858. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  859. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  860. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → lifecycle/file-watcher.d.mts} +0 -0
  861. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"wal-swap.mjs","names":[],"sources":["../../../src/plugins/walrus/wal-swap.ts"],"sourcesContent":["import { Effect, Schema } from 'effect';\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport { formatExecutedFailure } from '../../substrate/runtime/sui-execute/index.ts';\nimport { signAndDispatch } from '../../substrate/runtime/sui-execute/sign-and-dispatch.ts';\nimport type { AccountValue } from '../account/index.ts';\nimport type { SuiSdkShim } from '../sui/index.ts';\nimport { SUI_FULL_COIN_TYPE } from '../account/index.ts';\nimport { walrusPluginError, type WalrusPluginError } from './errors.ts';\nimport { WalrusSpans } from './spans.ts';\n\n/** Conservative reserve held back from the gas coin for transaction\n * gas itself. The swap call splits `paymentMist` off the gas coin\n * via `tx.coin({ useGasCoin: true })`, so the on-chain balance must\n * cover BOTH the payment AND a gas budget reserve. The exact gas\n * budget is set by the SDK at build time; this reserve is a coarse\n * upper bound used only by the pre-flight refusal — if the wire\n * call proves the reserve is too small the SDK still surfaces the\n * native `InsufficientGas` cause with the real numbers. */\nconst WAL_SWAP_GAS_RESERVE_MIST = 50_000_000n;\n\nexport interface WalExchangeHandle {\n\treadonly objectId: string;\n\treadonly packageId: string;\n}\n\nexport type WalExchangeProbeKey = { readonly kind: 'object'; readonly objectId: string };\n\nexport type WalSwapSdk = Pick<SuiSdkShim, 'client'> & {\n\treadonly core: Pick<SuiSdkShim['core'], 'getBalance'>;\n};\n\n/** Read the account's SUI balance (best-effort). Returns `null` if the\n * RPC throws or the response shape is unexpected — the pre-flight is\n * a hint, not a hard gate. */\nconst readSuiBalance = (\n\tsdk: WalSwapSdk,\n\towner: string,\n): Effect.Effect<bigint | null, never> =>\n\tEffect.promise(async () => {\n\t\ttry {\n\t\t\tconst response = await sdk.core.getBalance({ owner, coinType: SUI_FULL_COIN_TYPE });\n\t\t\tconst outer =\n\t\t\t\ttypeof response === 'object' && response !== null && 'balance' in response\n\t\t\t\t\t? (response as { readonly balance?: unknown }).balance\n\t\t\t\t\t: response;\n\t\t\tconst value =\n\t\t\t\ttypeof outer === 'object' && outer !== null && 'balance' in outer\n\t\t\t\t\t? (outer as { readonly balance?: unknown }).balance\n\t\t\t\t\t: outer;\n\t\t\tif (typeof value === 'bigint') return value;\n\t\t\tif (typeof value === 'number' && Number.isSafeInteger(value) && value >= 0)\n\t\t\t\treturn BigInt(value);\n\t\t\tif (typeof value === 'string' && /^\\d+$/.test(value)) return BigInt(value);\n\t\t\treturn null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t});\n\nexport interface WalAccountSwapRequest {\n\treadonly account: AccountValue;\n\treadonly sdk: WalSwapSdk;\n\treadonly exchange: WalExchangeHandle;\n\treadonly recipientAddress: string;\n\treadonly paymentMist: bigint;\n}\n\nconst WalExchangeObjectShape = Schema.Struct({\n\tobjectId: Schema.String,\n\ttype: Schema.String,\n});\n\nexport const resolveWalExchange = (\n\tprobe: ChainProbe<WalExchangeProbeKey>,\n\texchangeObjectId: string | undefined,\n): Effect.Effect<WalExchangeHandle | null, WalrusPluginError> =>\n\tEffect.gen(function* () {\n\t\tif (exchangeObjectId === undefined) return null;\n\t\tconst found = yield* probe\n\t\t\t.get({ kind: 'object', objectId: exchangeObjectId }, WalExchangeObjectShape, 'lenient')\n\t\t\t.pipe(\n\t\t\t\tEffect.mapError((cause) =>\n\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t'exchange',\n\t\t\t\t\t\t`walrus.exchange: failed to resolve exchange object ${exchangeObjectId}: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\t\t{ cause },\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\tif (found === null) return null;\n\t\tconst packageId = found.type.split('::')[0];\n\t\tif (packageId === undefined || !packageId.startsWith('0x')) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\twalrusPluginError(\n\t\t\t\t\t'exchange',\n\t\t\t\t\t`walrus.exchange: unexpected exchange object type \"${found.type}\" — expected \"<pkg>::wal_exchange::Exchange\"`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn { objectId: exchangeObjectId, packageId };\n\t});\n\nexport const buildWalSwapTransaction = (args: {\n\treadonly signerAddress: string;\n\treadonly recipientAddress: string;\n\treadonly exchange: WalExchangeHandle;\n\treadonly paymentMist: bigint;\n}): Transaction => {\n\tconst tx = new Transaction();\n\ttx.setSender(args.signerAddress);\n\tconst paymentCoin = tx.coin({\n\t\tbalance: args.paymentMist,\n\t\ttype: '0x2::sui::SUI',\n\t\tuseGasCoin: true,\n\t});\n\tconst walCoin = tx.moveCall({\n\t\ttarget: `${args.exchange.packageId}::wal_exchange::exchange_all_for_wal`,\n\t\targuments: [tx.object(args.exchange.objectId), paymentCoin],\n\t});\n\ttx.transferObjects([walCoin], tx.pure.address(args.recipientAddress));\n\treturn tx;\n};\n\nexport const swapAccountSuiForWal = (\n\targs: WalAccountSwapRequest,\n): Effect.Effect<{ readonly digest: string }, WalrusPluginError> =>\n\tEffect.gen(function* () {\n\t\t// Pre-flight gas-budget refusal — the swap splits `paymentMist`\n\t\t// off the gas coin via `tx.coin({ useGasCoin: true })`, so the\n\t\t// on-chain SUI balance must cover BOTH the payment AND a gas\n\t\t// reserve. Without this check the failure surfaces as an opaque\n\t\t// `Transaction.build` / chain-side `InsufficientGas` after the\n\t\t// wire call has already been attempted; the typed refusal here\n\t\t// names the numbers so the caller sees the real cause. The\n\t\t// balance read is best-effort — a `null` from the SDK falls\n\t\t// through to the wire call (the existing `mapSignError` /\n\t\t// `onFailed` paths still catch the chain-side failure).\n\t\tconst suiBalance = yield* readSuiBalance(args.sdk, args.account.address);\n\t\tconst required = args.paymentMist + WAL_SWAP_GAS_RESERVE_MIST;\n\t\tif (suiBalance !== null && suiBalance < required) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\twalrusPluginError(\n\t\t\t\t\t'fund-wal',\n\t\t\t\t\t`walrus.fundWal: account '${args.account.name}' (address=${args.account.address}) ` +\n\t\t\t\t\t\t`has insufficient SUI to swap ${args.paymentMist} for WAL — ` +\n\t\t\t\t\t\t`balance=${suiBalance} mist, required≥${required} mist ` +\n\t\t\t\t\t\t`(payment=${args.paymentMist} + gas reserve=${WAL_SWAP_GAS_RESERVE_MIST}). ` +\n\t\t\t\t\t\t`Top up the account's SUI funding before declaring the WAL funding entry.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn yield* signAndDispatch({\n\t\t\tsignerSource: args.account,\n\t\t\tbuildTxBytes: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst tx = buildWalSwapTransaction({\n\t\t\t\t\t\tsignerAddress: args.account.address,\n\t\t\t\t\t\trecipientAddress: args.recipientAddress,\n\t\t\t\t\t\texchange: args.exchange,\n\t\t\t\t\t\tpaymentMist: args.paymentMist,\n\t\t\t\t\t});\n\t\t\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: () => tx.build({ client: args.sdk.client }),\n\t\t\t\t\t\tcatch: (cause): WalrusPluginError =>\n\t\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t\t'fund-wal',\n\t\t\t\t\t\t\t\t`walrus.fundWal: transaction serialization failed for account '${args.account.name}'.`,\n\t\t\t\t\t\t\t\t{ cause },\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\tmapSignError: (cause): WalrusPluginError =>\n\t\t\t\twalrusPluginError(\n\t\t\t\t\t'fund-wal',\n\t\t\t\t\t`walrus.fundWal: SUI -> WAL swap failed for ${args.recipientAddress} ` +\n\t\t\t\t\t\t`using account '${args.account.name}' (address=${args.account.address}) ` +\n\t\t\t\t\t\t`against exchange ${args.exchange.objectId}.`,\n\t\t\t\t\t{ cause },\n\t\t\t\t),\n\t\t\tonFailed: (failure) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t'fund-wal',\n\t\t\t\t\t\t`walrus.fundWal: SUI -> WAL swap failed on-chain ` +\n\t\t\t\t\t\t\t`(exchange=${args.exchange.objectId}) ` +\n\t\t\t\t\t\t\tformatExecutedFailure(failure),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tonSuccess: (ok) => Effect.succeed({ digest: ok.digest }),\n\t\t});\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.walrus.fundWal', {\n\t\t\tattributes: {\n\t\t\t\t[WalrusSpans.fundAccount]: args.account.name,\n\t\t\t\t[WalrusSpans.fundAddress]: args.recipientAddress,\n\t\t\t\t[WalrusSpans.fundExchange]: args.exchange.objectId,\n\t\t\t},\n\t\t}),\n\t);\n"],"mappings":"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"}
1
+ {"version":3,"file":"wal-swap.mjs","names":[],"sources":["../../../src/plugins/walrus/wal-swap.ts"],"sourcesContent":["import { Effect, Schema } from 'effect';\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { AccountValue } from '../account/index.ts';\nimport { formatExecutedFailure, signAndDispatch, type SuiSdkShim } from '../sui/index.ts';\nimport { SUI_FULL_COIN_TYPE } from '../account/index.ts';\nimport { walrusPluginError, type WalrusPluginError } from './errors.ts';\n\n/** Conservative reserve held back from the gas coin for transaction\n * gas itself. The swap call splits `paymentMist` off the gas coin\n * via `tx.coin({ useGasCoin: true })`, so the on-chain balance must\n * cover BOTH the payment AND a gas budget reserve. The exact gas\n * budget is set by the SDK at build time; this reserve is a coarse\n * upper bound used only by the pre-flight refusal — if the wire\n * call proves the reserve is too small the SDK still surfaces the\n * native `InsufficientGas` cause with the real numbers. */\nconst WAL_SWAP_GAS_RESERVE_MIST = 50_000_000n;\n\nexport interface WalExchangeHandle {\n\treadonly objectId: string;\n\treadonly packageId: string;\n}\n\nexport type WalExchangeProbeKey = { readonly kind: 'object'; readonly objectId: string };\n\nexport type WalSwapSdk = Pick<SuiSdkShim, 'client'> & {\n\treadonly core: Pick<SuiSdkShim['core'], 'getBalance'>;\n};\n\n/** Read the account's SUI balance (best-effort). Returns `null` if the\n * RPC throws or the response shape is unexpected — the pre-flight is\n * a hint, not a hard gate. */\nconst readSuiBalance = (sdk: WalSwapSdk, owner: string): Effect.Effect<bigint | null, never> =>\n\tEffect.promise(async () => {\n\t\ttry {\n\t\t\tconst response = await sdk.core.getBalance({ owner, coinType: SUI_FULL_COIN_TYPE });\n\t\t\tconst outer =\n\t\t\t\ttypeof response === 'object' && response !== null && 'balance' in response\n\t\t\t\t\t? (response as { readonly balance?: unknown }).balance\n\t\t\t\t\t: response;\n\t\t\tconst value =\n\t\t\t\ttypeof outer === 'object' && outer !== null && 'balance' in outer\n\t\t\t\t\t? (outer as { readonly balance?: unknown }).balance\n\t\t\t\t\t: outer;\n\t\t\tif (typeof value === 'bigint') return value;\n\t\t\tif (typeof value === 'number' && Number.isSafeInteger(value) && value >= 0)\n\t\t\t\treturn BigInt(value);\n\t\t\tif (typeof value === 'string' && /^\\d+$/.test(value)) return BigInt(value);\n\t\t\treturn null;\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t});\n\nexport interface WalAccountSwapRequest {\n\treadonly account: AccountValue;\n\treadonly sdk: WalSwapSdk;\n\treadonly exchange: WalExchangeHandle;\n\treadonly recipientAddress: string;\n\treadonly paymentMist: bigint;\n}\n\nconst WalExchangeObjectShape = Schema.Struct({\n\tobjectId: Schema.String,\n\ttype: Schema.String,\n});\n\nexport const resolveWalExchange = (\n\tprobe: ChainProbe<WalExchangeProbeKey>,\n\texchangeObjectId: string | undefined,\n): Effect.Effect<WalExchangeHandle | null, WalrusPluginError> =>\n\tEffect.gen(function* () {\n\t\tif (exchangeObjectId === undefined) return null;\n\t\tconst found = yield* probe\n\t\t\t.get({ kind: 'object', objectId: exchangeObjectId }, WalExchangeObjectShape, 'lenient')\n\t\t\t.pipe(\n\t\t\t\tEffect.mapError((cause) =>\n\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t'exchange',\n\t\t\t\t\t\t`walrus.exchange: failed to resolve exchange object ${exchangeObjectId}: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\t\t{ cause },\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\tif (found === null) return null;\n\t\tconst packageId = found.type.split('::')[0];\n\t\tif (packageId === undefined || !packageId.startsWith('0x')) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\twalrusPluginError(\n\t\t\t\t\t'exchange',\n\t\t\t\t\t`walrus.exchange: unexpected exchange object type \"${found.type}\" — expected \"<pkg>::wal_exchange::Exchange\"`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn { objectId: exchangeObjectId, packageId };\n\t});\n\nexport const buildWalSwapTransaction = (args: {\n\treadonly signerAddress: string;\n\treadonly recipientAddress: string;\n\treadonly exchange: WalExchangeHandle;\n\treadonly paymentMist: bigint;\n}): Transaction => {\n\tconst tx = new Transaction();\n\ttx.setSender(args.signerAddress);\n\tconst paymentCoin = tx.coin({\n\t\tbalance: args.paymentMist,\n\t\ttype: '0x2::sui::SUI',\n\t\tuseGasCoin: true,\n\t});\n\tconst walCoin = tx.moveCall({\n\t\ttarget: `${args.exchange.packageId}::wal_exchange::exchange_all_for_wal`,\n\t\targuments: [tx.object(args.exchange.objectId), paymentCoin],\n\t});\n\ttx.transferObjects([walCoin], tx.pure.address(args.recipientAddress));\n\treturn tx;\n};\n\nexport const swapAccountSuiForWal = (\n\targs: WalAccountSwapRequest,\n): Effect.Effect<{ readonly digest: string }, WalrusPluginError> =>\n\tEffect.gen(function* () {\n\t\t// Pre-flight gas-budget refusal — the swap splits `paymentMist`\n\t\t// off the gas coin via `tx.coin({ useGasCoin: true })`, so the\n\t\t// on-chain SUI balance must cover BOTH the payment AND a gas\n\t\t// reserve. Without this check the failure surfaces as an opaque\n\t\t// `Transaction.build` / chain-side `InsufficientGas` after the\n\t\t// wire call has already been attempted; the typed refusal here\n\t\t// names the numbers so the caller sees the real cause. The\n\t\t// balance read is best-effort — a `null` from the SDK falls\n\t\t// through to the wire call (the existing `mapSignError` /\n\t\t// `onFailed` paths still catch the chain-side failure).\n\t\tconst suiBalance = yield* readSuiBalance(args.sdk, args.account.address);\n\t\tconst required = args.paymentMist + WAL_SWAP_GAS_RESERVE_MIST;\n\t\tif (suiBalance !== null && suiBalance < required) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\twalrusPluginError(\n\t\t\t\t\t'fund-wal',\n\t\t\t\t\t`walrus.fundWal: account '${args.account.name}' (address=${args.account.address}) ` +\n\t\t\t\t\t\t`has insufficient SUI to swap ${args.paymentMist} for WAL — ` +\n\t\t\t\t\t\t`balance=${suiBalance} mist, required≥${required} mist ` +\n\t\t\t\t\t\t`(payment=${args.paymentMist} + gas reserve=${WAL_SWAP_GAS_RESERVE_MIST}). ` +\n\t\t\t\t\t\t`Top up the account's SUI funding before declaring the WAL funding entry.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn yield* signAndDispatch({\n\t\t\tsignerSource: args.account,\n\t\t\tbuildTxBytes: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst tx = buildWalSwapTransaction({\n\t\t\t\t\t\tsignerAddress: args.account.address,\n\t\t\t\t\t\trecipientAddress: args.recipientAddress,\n\t\t\t\t\t\texchange: args.exchange,\n\t\t\t\t\t\tpaymentMist: args.paymentMist,\n\t\t\t\t\t});\n\t\t\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: () => tx.build({ client: args.sdk.client }),\n\t\t\t\t\t\tcatch: (cause): WalrusPluginError =>\n\t\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t\t'fund-wal',\n\t\t\t\t\t\t\t\t`walrus.fundWal: transaction serialization failed for account '${args.account.name}'.`,\n\t\t\t\t\t\t\t\t{ cause },\n\t\t\t\t\t\t\t),\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t\tmapSignError: (cause): WalrusPluginError =>\n\t\t\t\twalrusPluginError(\n\t\t\t\t\t'fund-wal',\n\t\t\t\t\t`walrus.fundWal: SUI -> WAL swap failed for ${args.recipientAddress} ` +\n\t\t\t\t\t\t`using account '${args.account.name}' (address=${args.account.address}) ` +\n\t\t\t\t\t\t`against exchange ${args.exchange.objectId}.`,\n\t\t\t\t\t{ cause },\n\t\t\t\t),\n\t\t\tonFailed: (failure) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t'fund-wal',\n\t\t\t\t\t\t`walrus.fundWal: SUI -> WAL swap failed on-chain ` +\n\t\t\t\t\t\t\t`(exchange=${args.exchange.objectId}) ` +\n\t\t\t\t\t\t\tformatExecutedFailure(failure),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tonSuccess: (ok) => Effect.succeed({ digest: ok.digest }),\n\t\t});\n\t});\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-publisher.mjs","names":[],"sources":["../../src/primitives/artifact-publisher.ts"],"sourcesContent":["// ArtifactPublisher — L0 substrate primitive (architecture §10).\n//\n// Unifies the discipline that recurs across many on-chain\n// produce/verify plugins (substrate must remain service-name-blind;\n// the plugin index is the authoritative list). cache → verify →\n// produce → register on EVERY cycle.\n//\n// This is callable from any plugin; there is NO plugin-side contract\n// to implement. Plugins pass in:\n//\n// - a namespace + cache-key derivation,\n// - a verify procedure (calls ChainProbe with a typed Schema,\n// lenient mode),\n// - a produce procedure (run on miss / verify-fail),\n// - a register procedure (fires on EVERY cycle — hit AND miss).\n\nimport type { Effect, Scope } from 'effect';\n\nimport type { ChainId, ContentHash } from '../substrate/brand.ts';\n\n/** Lenient retry profile constants — shared with ChainProbe.\n * Architecture: 15 attempts, 90s budget, 500ms initial, 1.5×\n * backoff, [0.8, 1.2) jitter. */\nexport const LENIENT_RETRY_PROFILE = {\n\tattempts: 15,\n\ttotalBudgetMillis: 90_000,\n\tinitialMillis: 500,\n\tbackoffMultiplier: 1.5,\n\tjitterRange: [0.8, 1.2] as const,\n} as const;\n\n/** Input contract for ArtifactPublisher.publish. */\nexport interface ArtifactSpec<Produced, Verified> {\n\t/** Cache namespace — plugin-chosen, e.g. `package`. */\n\treadonly namespace: string;\n\t/** Chain identity — substrate folds into the cache key. */\n\treadonly chain: ChainId;\n\t/** Content-hash of canonical input bytes. */\n\treadonly contentHash: ContentHash;\n\t/** Verify probe — typed Schema; lenient mode. Returns null on\n\t * not-found OR transient failure.\n\t *\n\t * The substrate decodes the cached payload (if any) and passes it\n\t * in as `cached`. Plugins that key their on-chain probe off a\n\t * field of the cached payload (e.g. action's `digest`, package's\n\t * `packageId`) read it from here directly — no in-process\n\t * registry-hop required. Plugins that don't care about the\n\t * cached payload ignore the parameter.\n\t *\n\t * When the cache is empty (cold boot) OR decode failed\n\t * (corruption) the substrate short-circuits to \"miss\" before\n\t * invoking this; callers can therefore assume `cached` is\n\t * defined on every call. */\n\treadonly verify: (cached: Produced) => Effect.Effect<Verified | null, never>;\n\t/** Produce procedure — runs on cache miss OR verify-fail. */\n\treadonly produce: Effect.Effect<Produced, ArtifactPublishError, Scope.Scope>;\n\t/** Register procedure — fires on EVERY cycle (hit AND miss). The\n\t * substrate always hands back the decoded `Produced` payload (on\n\t * cache hit) or the freshly produced one (on miss); the verify\n\t * shape is a probe-only signal, never surfaced to callers. */\n\treadonly register: (artifact: Produced) => Effect.Effect<void, never>;\n}\n\n/** Tagged error from a publish round. */\nexport interface ArtifactPublishError {\n\treadonly _tag: 'ArtifactPublishError';\n\treadonly reason: 'produce-failed' | 'verify-exhausted' | 'cache-corrupt';\n\treadonly detail: string;\n}\n\n/** Constructor for `ArtifactPublishError`. Centralising the literal\n * shape (single `_tag` site, no `as const` ceremony at call sites)\n * per STYLE_GUIDE §2: tagged errors expose a factory at every\n * plugin/public boundary. Every plugin's `produce` /\n * `Effect.mapError` path goes through this. */\nexport const artifactPublishError = (\n\treason: ArtifactPublishError['reason'],\n\tdetail: string,\n): ArtifactPublishError => ({\n\t_tag: 'ArtifactPublishError',\n\treason,\n\tdetail,\n});\n\n/** The publisher service. Plugins call `publish`; substrate handles\n * cache lookup, verify, produce-on-miss, idempotent register.\n *\n * Returns the `Produced` payload on EVERY path:\n * - cache hit + verify succeeds → the decoded cached `Produced`,\n * - cache miss or verify-fail → the freshly produced `Produced`.\n *\n * The `Verified` shape is a probe-only signal (drives the lenient\n * null/non-null decision inside the substrate); it is never returned\n * to plugin callers. Callers therefore type-narrow trivially against\n * `Produced` and avoid the `'<sentinel>'` projection dance. */\nexport interface ArtifactPublisher {\n\treadonly publish: <Produced, Verified>(\n\t\tspec: ArtifactSpec<Produced, Verified>,\n\t) => Effect.Effect<Produced, ArtifactPublishError, Scope.Scope>;\n}\n"],"mappings":";;;;;;AA2EA,MAAa,wBACZ,QACA,YAC2B;CAC3B,MAAM;CACN;CACA;CACA"}
1
+ {"version":3,"file":"artifact-publisher.mjs","names":[],"sources":["../../src/primitives/artifact-publisher.ts"],"sourcesContent":["// ArtifactPublisher — L0 substrate primitive (architecture §10).\n//\n// Unifies the discipline that recurs across many on-chain\n// produce/verify plugins (substrate must remain service-name-blind;\n// the plugin index is the authoritative list). cache → verify →\n// produce → register on EVERY cycle.\n//\n// This is callable from any plugin; there is NO plugin-side contract\n// to implement. Plugins pass in:\n//\n// - a namespace + cache-key derivation,\n// - a verify procedure (calls ChainProbe with a typed Schema,\n// lenient mode),\n// - a produce procedure (run on miss / verify-fail),\n// - a register procedure (fires on EVERY cycle — hit AND miss).\n\nimport type { Effect, Scope } from 'effect';\n\nimport type { ContentHash } from '../substrate/brand.ts';\n\n/** Input contract for ArtifactPublisher.publish. */\nexport interface ArtifactSpec<Produced, Verified> {\n\t/** Cache namespace — plugin-chosen, e.g. `package`. */\n\treadonly namespace: string;\n\t/** Chain identity (plain string value) — substrate folds into the cache key. */\n\treadonly chain: string;\n\t/** Content-hash of canonical input bytes. */\n\treadonly contentHash: ContentHash;\n\t/** Verify probe — typed Schema; lenient mode. Returns null on\n\t * not-found OR transient failure.\n\t *\n\t * The substrate decodes the cached payload (if any) and passes it\n\t * in as `cached`. Plugins that key their on-chain probe off a\n\t * field of the cached payload (e.g. action's `digest`, package's\n\t * `packageId`) read it from here directly — no in-process\n\t * registry-hop required. Plugins that don't care about the\n\t * cached payload ignore the parameter.\n\t *\n\t * When the cache is empty (cold boot) OR decode failed\n\t * (corruption) the substrate short-circuits to \"miss\" before\n\t * invoking this; callers can therefore assume `cached` is\n\t * defined on every call. */\n\treadonly verify: (cached: Produced) => Effect.Effect<Verified | null, never>;\n\t/** Produce procedure — runs on cache miss OR verify-fail. */\n\treadonly produce: Effect.Effect<Produced, ArtifactPublishError, Scope.Scope>;\n\t/** Register procedure — fires on EVERY cycle (hit AND miss). The\n\t * substrate always hands back the decoded `Produced` payload (on\n\t * cache hit) or the freshly produced one (on miss); the verify\n\t * shape is a probe-only signal, never surfaced to callers. */\n\treadonly register: (artifact: Produced) => Effect.Effect<void, never>;\n}\n\n/** Tagged error from a publish round. */\nexport interface ArtifactPublishError {\n\treadonly _tag: 'ArtifactPublishError';\n\treadonly reason: 'produce-failed' | 'verify-exhausted' | 'cache-corrupt';\n\treadonly detail: string;\n}\n\n/** Constructor for `ArtifactPublishError`. Centralising the literal\n * shape (single `_tag` site, no `as const` ceremony at call sites)\n * per STYLE_GUIDE §2: tagged errors expose a factory at every\n * plugin/public boundary. Every plugin's `produce` /\n * `Effect.mapError` path goes through this. */\nexport const artifactPublishError = (\n\treason: ArtifactPublishError['reason'],\n\tdetail: string,\n): ArtifactPublishError => ({\n\t_tag: 'ArtifactPublishError',\n\treason,\n\tdetail,\n});\n\n/** The publisher service. Plugins call `publish`; substrate handles\n * cache lookup, verify, produce-on-miss, idempotent register.\n *\n * Returns the `Produced` payload on EVERY path:\n * - cache hit + verify succeeds → the decoded cached `Produced`,\n * - cache miss or verify-fail → the freshly produced `Produced`.\n *\n * The `Verified` shape is a probe-only signal (drives the lenient\n * null/non-null decision inside the substrate); it is never returned\n * to plugin callers. Callers therefore type-narrow trivially against\n * `Produced` and avoid the `'<sentinel>'` projection dance. */\nexport interface ArtifactPublisher {\n\treadonly publish: <Produced, Verified>(\n\t\tspec: ArtifactSpec<Produced, Verified>,\n\t) => Effect.Effect<Produced, ArtifactPublishError, Scope.Scope>;\n}\n"],"mappings":";;;;;;AAgEA,MAAa,wBACZ,QACA,YAC2B;CAC3B,MAAM;CACN;CACA;AACD"}
@@ -1 +1 @@
1
- import { Effect } from "effect";
1
+ import { Effect, Scope } from "effect";
@@ -1,5 +1,8 @@
1
1
  import { capture } from "../../substrate/runtime/observability/subprocess-capture.mjs";
2
2
  import { Context, Effect, Layer } from "effect";
3
+ import { existsSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { homedir, tmpdir } from "node:os";
3
6
  import { ChildProcess } from "effect/unstable/process";
4
7
  //#region src/runtime/docker/client.ts
5
8
  var DockerHost = class extends Context.Service()("@devstack/runtime-docker/DockerHost") {};
@@ -8,11 +11,52 @@ const layerDockerHostDefault = Layer.succeed(DockerHost)({});
8
11
  * inject a stub. In production this is `ChildProcessSpawner.make()`
9
12
  * from `effect/unstable/process` (provided via `@effect/platform-node`). */
10
13
  var DockerSpawner = class extends Context.Service()("@devstack/runtime-docker/DockerSpawner") {};
11
- const buildEnv = (host) => {
12
- const env = {};
14
+ let sanitizedDockerConfig = null;
15
+ const sourceDockerConfigDir = () => process.env.DOCKER_CONFIG ?? join(homedir(), ".docker");
16
+ const originalDockerConfig = (sourceDir) => {
17
+ try {
18
+ const parsed = JSON.parse(readFileSync(join(sourceDir, "config.json"), "utf8"));
19
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) return { ...parsed };
20
+ } catch {}
21
+ return {};
22
+ };
23
+ const symlinkDockerConfigDir = (sourceDir, targetDir, name) => {
24
+ const source = join(sourceDir, name);
25
+ if (!existsSync(source)) return;
26
+ try {
27
+ symlinkSync(source, join(targetDir, name));
28
+ } catch {}
29
+ };
30
+ const dockerConfigDir = () => {
31
+ const source = sourceDockerConfigDir();
32
+ if (sanitizedDockerConfig !== null && sanitizedDockerConfig.sourceDir === source) return sanitizedDockerConfig.dir;
33
+ const dir = mkdtempSync(join(tmpdir(), "devstack-docker-config-"));
34
+ for (const name of [
35
+ "cli-plugins",
36
+ "buildx",
37
+ "contexts"
38
+ ]) symlinkDockerConfigDir(source, dir, name);
39
+ const { credsStore: _credsStore, credHelpers: _credHelpers, ...config } = originalDockerConfig(source);
40
+ if (!("auths" in config)) config.auths = {};
41
+ writeFileSync(join(dir, "config.json"), `${JSON.stringify(config)}\n`, { mode: 384 });
42
+ process.once("exit", () => {
43
+ rmSync(dir, {
44
+ recursive: true,
45
+ force: true
46
+ });
47
+ });
48
+ sanitizedDockerConfig = {
49
+ sourceDir: source,
50
+ dir
51
+ };
52
+ return dir;
53
+ };
54
+ const dockerCliEnv = (host = {}) => {
55
+ const env = { DOCKER_CONFIG: dockerConfigDir() };
13
56
  if (host.dockerHost !== void 0) env.DOCKER_HOST = host.dockerHost;
14
57
  return env;
15
58
  };
59
+ const buildEnv = (host) => dockerCliEnv(host);
16
60
  /** Grace period between the scope-close SIGTERM and the escalation
17
61
  * SIGKILL. Without `forceKillAfter` the Node spawner sends ONE SIGTERM
18
62
  * on scope close and then waits indefinitely for the child to die — so
@@ -62,6 +106,6 @@ const dockerRunOk = (verb, args, opts) => Effect.gen(function* () {
62
106
  });
63
107
  });
64
108
  //#endregion
65
- export { DockerHost, DockerSpawner, dockerCommand, dockerRun, dockerRunOk, layerDockerHostDefault };
109
+ export { DockerHost, DockerSpawner, dockerCliEnv, dockerCommand, dockerRun, dockerRunOk, layerDockerHostDefault };
66
110
 
67
111
  //# sourceMappingURL=client.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../../../src/runtime/docker/client.ts"],"sourcesContent":["// Thin `docker` CLI wrapper.\n//\n// Every subprocess invocation flows through the L0 subprocess-capture\n// primitive (one capture function, one error class). This module owns:\n//\n// - The argv constructor (`dockerArgv`).\n// - The `DOCKER_HOST` env passthrough (architecture §7: one-daemon\n// assumption, env override supported).\n// - Two convenience verbs: `run` (capture-with-success-or-fail-by-exit)\n// and `runOk` (capture, return CaptureResult regardless of exit so\n// the caller can classify stderr). NO docker compose anywhere.\n//\n// No service names appear here. No stderr-pattern classification —\n// that's in `wrap.ts`. This file is mechanical argv + spawn.\n\nimport { Context, Effect, Layer } from 'effect';\nimport { ChildProcess } from 'effect/unstable/process';\nimport { ChildProcessSpawner } from 'effect/unstable/process';\n\nimport {\n\tcapture,\n\ttype CaptureError,\n\ttype CaptureOptions,\n\ttype CaptureResult,\n} from '../../substrate/runtime/observability/subprocess-capture.ts';\n\n// -----------------------------------------------------------------------------\n// Daemon-host configuration\n// -----------------------------------------------------------------------------\n\n/** Optional `DOCKER_HOST` override. When absent we let the docker CLI\n * resolve its default socket (Unix: `/var/run/docker.sock`; macOS\n * Desktop: `unix:///var/run/docker.sock`; remote daemon if the user\n * set `DOCKER_HOST` in their own env). */\nexport interface DockerHostShape {\n\treadonly dockerHost?: string;\n\t/** Optional explicit binary path (default `docker`). Tests use\n\t * this to point at a stub; otherwise we resolve via PATH. */\n\treadonly bin?: string;\n}\n\nexport class DockerHost extends Context.Service<DockerHost, DockerHostShape>()(\n\t'@devstack/runtime-docker/DockerHost',\n) {}\n\nexport const layerDockerHostDefault: Layer.Layer<DockerHost> = Layer.succeed(DockerHost)({});\n\nexport const layerDockerHost = (shape: DockerHostShape): Layer.Layer<DockerHost> =>\n\tLayer.succeed(DockerHost)(shape);\n\n// -----------------------------------------------------------------------------\n// Spawner injection\n// -----------------------------------------------------------------------------\n\n/** A spawner service exposing `spawn`. Held as a service so tests can\n * inject a stub. In production this is `ChildProcessSpawner.make()`\n * from `effect/unstable/process` (provided via `@effect/platform-node`). */\nexport class DockerSpawner extends Context.Service<\n\tDockerSpawner,\n\tReturnType<typeof ChildProcessSpawner.make>\n>()('@devstack/runtime-docker/DockerSpawner') {}\n\n// -----------------------------------------------------------------------------\n// Argv construction\n// -----------------------------------------------------------------------------\n\nconst buildEnv = (host: DockerHostShape): Record<string, string> => {\n\tconst env: Record<string, string> = {};\n\tif (host.dockerHost !== undefined) env.DOCKER_HOST = host.dockerHost;\n\treturn env;\n};\n\n/** Grace period between the scope-close SIGTERM and the escalation\n * SIGKILL. Without `forceKillAfter` the Node spawner sends ONE SIGTERM\n * on scope close and then waits indefinitely for the child to die — so\n * a timeout-interrupt (see `exec.ts` / `dockerRunOneShot` `Effect.timeout`)\n * blocks on scope-close if the docker CLI ignores SIGTERM. A few\n * seconds lets a well-behaved CLI flush and exit cleanly before we\n * force-kill the wedged case. */\nconst KILL_GRACE = '5 seconds';\n\n/** Build a `ChildProcess.Command` from `(verb, ...args)`. The verb is\n * separate so observability span attributes can pin the\n * high-cardinality `args` separately from the `devstack.op` tag.\n *\n * `forceKillAfter` makes scope-close termination escalate\n * SIGTERM→SIGKILL so an interrupt (timeout) can't wedge on a docker CLI\n * that ignores SIGTERM. */\nexport const dockerCommand = (\n\thost: DockerHostShape,\n\tverb: string,\n\targs: ReadonlyArray<string>,\n\toverrideEnv: Readonly<Record<string, string>> = {},\n): ChildProcess.Command => {\n\tconst bin = host.bin ?? 'docker';\n\tconst env = { ...buildEnv(host), ...overrideEnv };\n\treturn ChildProcess.make(bin, [verb, ...args], {\n\t\tenv,\n\t\textendEnv: true,\n\t\tforceKillAfter: KILL_GRACE,\n\t});\n};\n\n// -----------------------------------------------------------------------------\n// Capture verbs\n// -----------------------------------------------------------------------------\n\n/** Capture a docker invocation, fail on non-zero exit. Use when any\n * non-zero exit is a failure case (most write operations). */\nexport const dockerRun = (\n\tverb: string,\n\targs: ReadonlyArray<string>,\n\topts?: Omit<CaptureOptions, 'op' | 'nonZeroIsFailure'>,\n): Effect.Effect<CaptureResult, CaptureError, DockerHost | DockerSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst host = yield* DockerHost;\n\t\tconst spawner = yield* DockerSpawner;\n\t\treturn yield* capture(spawner, dockerCommand(host, verb, args), {\n\t\t\t...opts,\n\t\t\top: `docker.${verb}`,\n\t\t\tnonZeroIsFailure: true,\n\t\t});\n\t});\n\n/** Capture a docker invocation, return the `CaptureResult` regardless\n * of exit. Use when the caller classifies stderr or wants the exit\n * code (lifecycle state machine, inventory). */\nexport const dockerRunOk = (\n\tverb: string,\n\targs: ReadonlyArray<string>,\n\topts?: Omit<CaptureOptions, 'op' | 'nonZeroIsFailure'>,\n): Effect.Effect<CaptureResult, CaptureError, DockerHost | DockerSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst host = yield* DockerHost;\n\t\tconst spawner = yield* DockerSpawner;\n\t\treturn yield* capture(spawner, dockerCommand(host, verb, args), {\n\t\t\t...opts,\n\t\t\top: `docker.${verb}`,\n\t\t\tnonZeroIsFailure: false,\n\t\t});\n\t});\n"],"mappings":";;;;AAyCA,IAAa,aAAb,cAAgC,QAAQ,SAAsC,CAC7E,sCACA,CAAC;AAEF,MAAa,yBAAkD,MAAM,QAAQ,WAAW,CAAC,EAAE,CAAC;;;;AAY5F,IAAa,gBAAb,cAAmC,QAAQ,SAGxC,CAAC,yCAAyC,CAAC;AAM9C,MAAM,YAAY,SAAkD;CACnE,MAAM,MAA8B,EAAE;AACtC,KAAI,KAAK,eAAe,KAAA,EAAW,KAAI,cAAc,KAAK;AAC1D,QAAO;;;;;;;;;AAUR,MAAM,aAAa;;;;;;;;AASnB,MAAa,iBACZ,MACA,MACA,MACA,cAAgD,EAAE,KACxB;CAC1B,MAAM,MAAM,KAAK,OAAO;CACxB,MAAM,MAAM;EAAE,GAAG,SAAS,KAAK;EAAE,GAAG;EAAa;AACjD,QAAO,aAAa,KAAK,KAAK,CAAC,MAAM,GAAG,KAAK,EAAE;EAC9C;EACA,WAAW;EACX,gBAAgB;EAChB,CAAC;;;;AASH,MAAa,aACZ,MACA,MACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;AAEpB,QAAO,OAAO,QAAQ,OADC,eACQ,cAAc,MAAM,MAAM,KAAK,EAAE;EAC/D,GAAG;EACH,IAAI,UAAU;EACd,kBAAkB;EAClB,CAAC;EACD;;;;AAKH,MAAa,eACZ,MACA,MACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;AAEpB,QAAO,OAAO,QAAQ,OADC,eACQ,cAAc,MAAM,MAAM,KAAK,EAAE;EAC/D,GAAG;EACH,IAAI,UAAU;EACd,kBAAkB;EAClB,CAAC;EACD"}
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../../../src/runtime/docker/client.ts"],"sourcesContent":["// Thin `docker` CLI wrapper.\n//\n// Every subprocess invocation flows through the L0 subprocess-capture\n// primitive (one capture function, one error class). This module owns:\n//\n// - The argv constructor (`dockerArgv`).\n// - The `DOCKER_HOST` env passthrough (architecture §7: one-daemon\n// assumption, env override supported).\n// - Two convenience verbs: `run` (capture-with-success-or-fail-by-exit)\n// and `runOk` (capture, return CaptureResult regardless of exit so\n// the caller can classify stderr). NO docker compose anywhere.\n//\n// No service names appear here. No stderr-pattern classification —\n// that's in `wrap.ts`. This file is mechanical argv + spawn.\n\nimport { existsSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';\nimport { homedir, tmpdir } from 'node:os';\nimport { join } from 'node:path';\n\nimport { Context, Effect, Layer } from 'effect';\nimport { ChildProcess } from 'effect/unstable/process';\nimport { ChildProcessSpawner } from 'effect/unstable/process';\n\nimport {\n\tcapture,\n\ttype CaptureError,\n\ttype CaptureOptions,\n\ttype CaptureResult,\n} from '../../substrate/runtime/observability/subprocess-capture.ts';\n\n// -----------------------------------------------------------------------------\n// Daemon-host configuration\n// -----------------------------------------------------------------------------\n\n/** Optional `DOCKER_HOST` override. When absent we let the docker CLI\n * resolve its default socket (Unix: `/var/run/docker.sock`; macOS\n * Desktop: `unix:///var/run/docker.sock`; remote daemon if the user\n * set `DOCKER_HOST` in their own env). */\nexport interface DockerHostShape {\n\treadonly dockerHost?: string;\n\t/** Optional explicit binary path (default `docker`). Tests use\n\t * this to point at a stub; otherwise we resolve via PATH. */\n\treadonly bin?: string;\n}\n\nexport class DockerHost extends Context.Service<DockerHost, DockerHostShape>()(\n\t'@devstack/runtime-docker/DockerHost',\n) {}\n\nexport const layerDockerHostDefault: Layer.Layer<DockerHost> = Layer.succeed(DockerHost)({});\n\nexport const layerDockerHost = (shape: DockerHostShape): Layer.Layer<DockerHost> =>\n\tLayer.succeed(DockerHost)(shape);\n\n// -----------------------------------------------------------------------------\n// Spawner injection\n// -----------------------------------------------------------------------------\n\n/** A spawner service exposing `spawn`. Held as a service so tests can\n * inject a stub. In production this is `ChildProcessSpawner.make()`\n * from `effect/unstable/process` (provided via `@effect/platform-node`). */\nexport class DockerSpawner extends Context.Service<\n\tDockerSpawner,\n\tReturnType<typeof ChildProcessSpawner.make>\n>()('@devstack/runtime-docker/DockerSpawner') {}\n\n// -----------------------------------------------------------------------------\n// Argv construction\n// -----------------------------------------------------------------------------\n\nlet sanitizedDockerConfig: {\n\treadonly sourceDir: string;\n\treadonly dir: string;\n} | null = null;\n\nconst sourceDockerConfigDir = (): string => process.env.DOCKER_CONFIG ?? join(homedir(), '.docker');\n\nconst originalDockerConfig = (sourceDir: string): Record<string, unknown> => {\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(readFileSync(join(sourceDir, 'config.json'), 'utf8'));\n\t\tif (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {\n\t\t\treturn { ...(parsed as Record<string, unknown>) };\n\t\t}\n\t} catch {\n\t\t// Missing or malformed Docker config: let the CLI fall back to defaults.\n\t}\n\treturn {};\n};\n\nconst symlinkDockerConfigDir = (sourceDir: string, targetDir: string, name: string): void => {\n\tconst source = join(sourceDir, name);\n\tif (!existsSync(source)) return;\n\ttry {\n\t\tsymlinkSync(source, join(targetDir, name));\n\t} catch {\n\t\t// Best effort. Docker can still run without these; buildx/context\n\t\t// preservation only avoids changing behavior for Desktop/remote users.\n\t}\n};\n\nconst dockerConfigDir = (): string => {\n\tconst source = sourceDockerConfigDir();\n\tif (sanitizedDockerConfig !== null && sanitizedDockerConfig.sourceDir === source) {\n\t\treturn sanitizedDockerConfig.dir;\n\t}\n\tconst dir = mkdtempSync(join(tmpdir(), 'devstack-docker-config-'));\n\tfor (const name of ['cli-plugins', 'buildx', 'contexts']) {\n\t\tsymlinkDockerConfigDir(source, dir, name);\n\t}\n\t// Docker Desktop's `credsStore: \"desktop\"` helper can block forever on\n\t// public image metadata resolution. Give the CLI a process-local config with\n\t// credential helpers stripped while preserving static auth entries, proxies,\n\t// custom headers, contexts, and other non-helper Docker config.\n\tconst {\n\t\tcredsStore: _credsStore,\n\t\tcredHelpers: _credHelpers,\n\t\t...config\n\t} = originalDockerConfig(source);\n\tif (!('auths' in config)) config.auths = {};\n\twriteFileSync(join(dir, 'config.json'), `${JSON.stringify(config)}\\n`, {\n\t\tmode: 0o600,\n\t});\n\tprocess.once('exit', () => {\n\t\trmSync(dir, { recursive: true, force: true });\n\t});\n\tsanitizedDockerConfig = { sourceDir: source, dir };\n\treturn dir;\n};\n\nexport const dockerCliEnv = (host: DockerHostShape = {}): Record<string, string> => {\n\tconst env: Record<string, string> = { DOCKER_CONFIG: dockerConfigDir() };\n\tif (host.dockerHost !== undefined) env.DOCKER_HOST = host.dockerHost;\n\treturn env;\n};\n\nconst buildEnv = (host: DockerHostShape): Record<string, string> => dockerCliEnv(host);\n\n/** Grace period between the scope-close SIGTERM and the escalation\n * SIGKILL. Without `forceKillAfter` the Node spawner sends ONE SIGTERM\n * on scope close and then waits indefinitely for the child to die — so\n * a timeout-interrupt (see `exec.ts` / `dockerRunOneShot` `Effect.timeout`)\n * blocks on scope-close if the docker CLI ignores SIGTERM. A few\n * seconds lets a well-behaved CLI flush and exit cleanly before we\n * force-kill the wedged case. */\nconst KILL_GRACE = '5 seconds';\n\n/** Build a `ChildProcess.Command` from `(verb, ...args)`. The verb is\n * separate so observability span attributes can pin the\n * high-cardinality `args` separately from the `devstack.op` tag.\n *\n * `forceKillAfter` makes scope-close termination escalate\n * SIGTERM→SIGKILL so an interrupt (timeout) can't wedge on a docker CLI\n * that ignores SIGTERM. */\nexport const dockerCommand = (\n\thost: DockerHostShape,\n\tverb: string,\n\targs: ReadonlyArray<string>,\n\toverrideEnv: Readonly<Record<string, string>> = {},\n): ChildProcess.Command => {\n\tconst bin = host.bin ?? 'docker';\n\tconst env = { ...buildEnv(host), ...overrideEnv };\n\treturn ChildProcess.make(bin, [verb, ...args], {\n\t\tenv,\n\t\textendEnv: true,\n\t\tforceKillAfter: KILL_GRACE,\n\t});\n};\n\n// -----------------------------------------------------------------------------\n// Capture verbs\n// -----------------------------------------------------------------------------\n\n/** Capture a docker invocation, fail on non-zero exit. Use when any\n * non-zero exit is a failure case (most write operations). */\nexport const dockerRun = (\n\tverb: string,\n\targs: ReadonlyArray<string>,\n\topts?: Omit<CaptureOptions, 'op' | 'nonZeroIsFailure'>,\n): Effect.Effect<CaptureResult, CaptureError, DockerHost | DockerSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst host = yield* DockerHost;\n\t\tconst spawner = yield* DockerSpawner;\n\t\treturn yield* capture(spawner, dockerCommand(host, verb, args), {\n\t\t\t...opts,\n\t\t\top: `docker.${verb}`,\n\t\t\tnonZeroIsFailure: true,\n\t\t});\n\t});\n\n/** Capture a docker invocation, return the `CaptureResult` regardless\n * of exit. Use when the caller classifies stderr or wants the exit\n * code (lifecycle state machine, inventory). */\nexport const dockerRunOk = (\n\tverb: string,\n\targs: ReadonlyArray<string>,\n\topts?: Omit<CaptureOptions, 'op' | 'nonZeroIsFailure'>,\n): Effect.Effect<CaptureResult, CaptureError, DockerHost | DockerSpawner> =>\n\tEffect.gen(function* () {\n\t\tconst host = yield* DockerHost;\n\t\tconst spawner = yield* DockerSpawner;\n\t\treturn yield* capture(spawner, dockerCommand(host, verb, args), {\n\t\t\t...opts,\n\t\t\top: `docker.${verb}`,\n\t\t\tnonZeroIsFailure: false,\n\t\t});\n\t});\n"],"mappings":";;;;;;;AA6CA,IAAa,aAAb,cAAgC,QAAQ,QAAqC,CAAC,CAC7E,qCACD,CAAC,CAAC,CAAC;AAEH,MAAa,yBAAkD,MAAM,QAAQ,UAAU,CAAC,CAAC,CAAC,CAAC;;;;AAY3F,IAAa,gBAAb,cAAmC,QAAQ,QAGzC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC;AAM/C,IAAI,wBAGO;AAEX,MAAM,8BAAsC,QAAQ,IAAI,iBAAiB,KAAK,QAAQ,GAAG,SAAS;AAElG,MAAM,wBAAwB,cAA+C;CAC5E,IAAI;EACH,MAAM,SAAkB,KAAK,MAAM,aAAa,KAAK,WAAW,aAAa,GAAG,MAAM,CAAC;EACvF,IAAI,WAAW,QAAQ,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,MAAM,GACzE,OAAO,EAAE,GAAI,OAAmC;CAElD,QAAQ,CAER;CACA,OAAO,CAAC;AACT;AAEA,MAAM,0BAA0B,WAAmB,WAAmB,SAAuB;CAC5F,MAAM,SAAS,KAAK,WAAW,IAAI;CACnC,IAAI,CAAC,WAAW,MAAM,GAAG;CACzB,IAAI;EACH,YAAY,QAAQ,KAAK,WAAW,IAAI,CAAC;CAC1C,QAAQ,CAGR;AACD;AAEA,MAAM,wBAAgC;CACrC,MAAM,SAAS,sBAAsB;CACrC,IAAI,0BAA0B,QAAQ,sBAAsB,cAAc,QACzE,OAAO,sBAAsB;CAE9B,MAAM,MAAM,YAAY,KAAK,OAAO,GAAG,yBAAyB,CAAC;CACjE,KAAK,MAAM,QAAQ;EAAC;EAAe;EAAU;CAAU,GACtD,uBAAuB,QAAQ,KAAK,IAAI;CAMzC,MAAM,EACL,YAAY,aACZ,aAAa,cACb,GAAG,WACA,qBAAqB,MAAM;CAC/B,IAAI,EAAE,WAAW,SAAS,OAAO,QAAQ,CAAC;CAC1C,cAAc,KAAK,KAAK,aAAa,GAAG,GAAG,KAAK,UAAU,MAAM,EAAE,KAAK,EACtE,MAAM,IACP,CAAC;CACD,QAAQ,KAAK,cAAc;EAC1B,OAAO,KAAK;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;CAC7C,CAAC;CACD,wBAAwB;EAAE,WAAW;EAAQ;CAAI;CACjD,OAAO;AACR;AAEA,MAAa,gBAAgB,OAAwB,CAAC,MAA8B;CACnF,MAAM,MAA8B,EAAE,eAAe,gBAAgB,EAAE;CACvE,IAAI,KAAK,eAAe,KAAA,GAAW,IAAI,cAAc,KAAK;CAC1D,OAAO;AACR;AAEA,MAAM,YAAY,SAAkD,aAAa,IAAI;;;;;;;;AASrF,MAAM,aAAa;;;;;;;;AASnB,MAAa,iBACZ,MACA,MACA,MACA,cAAgD,CAAC,MACvB;CAC1B,MAAM,MAAM,KAAK,OAAO;CACxB,MAAM,MAAM;EAAE,GAAG,SAAS,IAAI;EAAG,GAAG;CAAY;CAChD,OAAO,aAAa,KAAK,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG;EAC9C;EACA,WAAW;EACX,gBAAgB;CACjB,CAAC;AACF;;;AAQA,MAAa,aACZ,MACA,MACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;CAEpB,OAAO,OAAO,QAAQ,OADC,eACQ,cAAc,MAAM,MAAM,IAAI,GAAG;EAC/D,GAAG;EACH,IAAI,UAAU;EACd,kBAAkB;CACnB,CAAC;AACF,CAAC;;;;AAKF,MAAa,eACZ,MACA,MACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;CAEpB,OAAO,OAAO,QAAQ,OADC,eACQ,cAAc,MAAM,MAAM,IAAI,GAAG;EAC/D,GAAG;EACH,IAAI,UAAU;EACd,kBAAkB;CACnB,CAAC;AACF,CAAC"}
@@ -1,5 +1,3 @@
1
- import { StackPathsService } from "../../substrate/runtime/paths.mjs";
2
- import { addClaim, removeClaim } from "../../substrate/runtime/cross-process/roster.mjs";
3
1
  import { dockerRun, dockerRunOk } from "./client.mjs";
4
2
  import { ContainerCreateFailed, ContainerNameCollisionUnrecoverable, DaemonUnreachable, ForeignDockerResource, RecreateRefused } from "./errors.mjs";
5
3
  import { classifyExit, isDaemonUnreachableStderr, isNameCollisionStderr, isNoSuchContainerStderr, wrapCreateError, wrapGeneric } from "./wrap.mjs";
@@ -65,10 +63,6 @@ const decideRunAction = (facts, desiredImage, policy, desiredPortBindings = [],
65
63
  kind: "refuse",
66
64
  reason: "unclean-shutdown"
67
65
  };
68
- return {
69
- kind: "resume",
70
- id: facts.id
71
- };
72
66
  }
73
67
  return {
74
68
  kind: "resume",
@@ -234,7 +228,7 @@ const inspectContainer = (name) => Effect.gen(function* () {
234
228
  networks,
235
229
  networkAttachments
236
230
  };
237
- }).pipe(Effect.withSpan("runtime.docker.container.inspect"));
231
+ });
238
232
  const normalizeNetworkAttachment = (entry) => typeof entry === "string" ? { name: entry } : entry.aliases === void 0 || entry.aliases.length === 0 ? { name: entry.name } : {
239
233
  name: entry.name,
240
234
  aliases: entry.aliases
@@ -268,9 +262,8 @@ const handleOf = (id, name, imageName, status, ips, ports, labels) => ({
268
262
  /** Force-remove by name. Used by recreate. Idempotent on
269
263
  * "no such container". */
270
264
  const forceRemove = (name) => Effect.gen(function* () {
271
- const res = yield* dockerRunOk("rm", ["-f", name]).pipe(Effect.mapError(wrapGeneric("docker.rm")));
272
- if (res.exitCode !== 0 && !isNoSuchContainerStderr(res.stderr)) yield* Effect.annotateCurrentSpan({ "docker.rm.warning": res.stderr });
273
- }).pipe(Effect.withSpan("runtime.docker.container.forceRemove"));
265
+ yield* dockerRunOk("rm", ["-f", name]).pipe(Effect.mapError(wrapGeneric("docker.rm")));
266
+ });
274
267
  const ownershipFailure = (name, expected, actual, detail) => new ForeignDockerResource({
275
268
  resource: "container",
276
269
  name,
@@ -295,7 +288,7 @@ const assertContainerHandleOwned = (handle) => Effect.gen(function* () {
295
288
  if (facts === null) return yield* Effect.fail(ownershipFailure(handle.name, expected, {}, "container is missing"));
296
289
  if (facts.id !== handle.id) return yield* Effect.fail(ownershipFailure(handle.name, expected, facts.labels ?? {}, `id changed to ${facts.id}`));
297
290
  yield* assertOwnedFacts(handle.name, facts, handle.labels);
298
- }).pipe(Effect.withSpan("runtime.docker.container.assertOwned"));
291
+ });
299
292
  const forceRemoveOwned = (name, id, labels) => Effect.gen(function* () {
300
293
  const current = yield* inspectContainer(name);
301
294
  if (current === null) return;
@@ -337,9 +330,34 @@ const startAndAdopt = (name, labels) => Effect.gen(function* () {
337
330
  detail: `start-and-adopt failed: ${cls.stderr}`
338
331
  }));
339
332
  });
333
+ /** `docker run` create with a single `imageRef`. The typed
334
+ * `ImageNotFound` (from `wrapCreateError`) is propagated as-is so the
335
+ * caller can decide whether a digest fallback is available. */
336
+ const createWithImageRef = (spec, cycle, imageRef) => Effect.gen(function* () {
337
+ return (yield* dockerRun("run", createArgv(spec, cycle, imageRef)).pipe(Effect.mapError(wrapCreateError(spec.name)))).stdout.trim();
338
+ });
340
339
  const freshCreate = (spec, cycle) => Effect.gen(function* () {
341
- return (yield* dockerRun("run", createArgv(spec, cycle, spec.image.tag ?? spec.image.digest)).pipe(Effect.mapError(wrapCreateError(spec.name)))).stdout.trim();
340
+ const taggedRef = spec.image.tag ?? spec.image.digest;
341
+ const digestRef = spec.image.digest;
342
+ return yield* createWithImageRef(spec, cycle, taggedRef).pipe(Effect.catchTag("ImageNotFound", (notFound) => {
343
+ if (digestRef === taggedRef) return Effect.fail(missingImageError(spec, taggedRef));
344
+ return createWithImageRef(spec, cycle, digestRef).pipe(Effect.catchTag("ImageNotFound", () => Effect.fail(missingImageError(spec, taggedRef, digestRef, notFound))));
345
+ }));
342
346
  });
347
+ /** Clear, actionable failure when neither the tagged nor digest ref
348
+ * could be created because the image is absent locally. Names the
349
+ * missing image and points at restore so an operator knows the fix is
350
+ * re-running restore (which re-promotes / re-loads the image) rather
351
+ * than a generic create failure. */
352
+ const missingImageError = (spec, taggedRef, digestRef, cause) => {
353
+ const tried = digestRef !== void 0 && digestRef !== taggedRef ? `tag '${taggedRef}' and digest '${digestRef}'` : `image '${taggedRef}'`;
354
+ const causeDetail = cause === void 0 ? "" : ` (${cause.detail})`;
355
+ return new ContainerCreateFailed({
356
+ name: spec.name,
357
+ stderr: `required image is not present locally — tried ${tried}${causeDetail}. Re-run restore to re-promote / re-load the target image before booting.`,
358
+ exitCode: void 0
359
+ });
360
+ };
343
361
  const resumeStart = (name) => Effect.gen(function* () {
344
362
  const res = yield* dockerRunOk("start", [name]).pipe(Effect.mapError(wrapGeneric("docker.start")));
345
363
  if (res.exitCode === 0) return { ok: true };
@@ -462,48 +480,16 @@ const releasePerNameLock = (lock, name) => Effect.gen(function* () {
462
480
  * helper releases the lock. */
463
481
  const withSerializedContainerOp = (name, lock, body) => Effect.acquireUseRelease(acquirePerNameLock(lock, name), () => body, () => releasePerNameLock(lock, name));
464
482
  /** Idempotent ensure: apply the state machine, register a scope
465
- * finalizer that stops the container + releases the cross-process
466
- * claim.
483
+ * finalizer that stops the container.
467
484
  *
468
485
  * Returns the running container handle (id + name + status + ips). */
469
486
  const ensureContainer = (spec, deps) => Effect.gen(function* () {
470
487
  const desiredImageRef = spec.image.tag ?? spec.image.digest;
471
- const paths = yield* StackPathsService;
472
- const mapSubstrateClaimError = (eff) => eff.pipe(Effect.catchTags({
473
- RosterIoError: (cause) => Effect.fail(new DaemonUnreachable({
474
- op: "cross-process.claim.roster-io",
475
- detail: `roster IO failed at ${cause.path}`,
476
- cause
477
- })),
478
- RosterCorruptError: (cause) => Effect.fail(new DaemonUnreachable({
479
- op: "cross-process.claim.roster-corrupt",
480
- detail: `roster ledger corrupt at ${cause.path}`,
481
- cause
482
- })),
483
- StackLockTimeoutError: (cause) => Effect.fail(new DaemonUnreachable({
484
- op: "cross-process.claim.stack-lock-timeout",
485
- detail: `stack-lock acquire timed out after ${cause.waitedMillis}ms at ${cause.path}`,
486
- cause
487
- })),
488
- StackLockIoError: (cause) => Effect.fail(new DaemonUnreachable({
489
- op: "cross-process.claim.stack-lock-io",
490
- detail: `stack-lock IO failed at ${cause.path}`,
491
- cause
492
- }))
493
- }));
494
488
  const registerStopFinalizer = (id) => Effect.addFinalizer(() => Effect.gen(function* () {
495
489
  if ((yield* inspectContainer(spec.name).pipe(Effect.tapCause((cause) => Effect.logDebug("container inspect during scope-close failed", {
496
490
  name: spec.name,
497
491
  cause
498
- })), Effect.catch(() => Effect.succeed(null))))?.id === id) yield* stopWithGrace(spec.name, spec.stopGraceSeconds ?? 10);
499
- yield* removeClaim({
500
- stackLockFile: paths.stackLockFile,
501
- rosterFile: paths.rosterFile,
502
- containerClaimsFile: paths.containerClaimsFile
503
- }, spec.name).pipe(Effect.tapCause((cause) => Effect.logDebug("removeClaim during scope-close failed", {
504
- name: spec.name,
505
- cause
506
- })), Effect.catch(() => Effect.succeed({ lastClaimReleased: false })));
492
+ })), Effect.catch(() => Effect.succeed(null))))?.id === id) yield* stopWithGrace(spec.name, spec.stopGraceSeconds ?? 10, spec.stopSignal);
507
493
  }).pipe(Effect.uninterruptible));
508
494
  const { id, ips, ports } = yield* withSerializedContainerOp(spec.name, deps.perNameLock, Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
509
495
  const facts = yield* inspectContainer(spec.name);
@@ -526,15 +512,9 @@ const ensureContainer = (spec, deps) => Effect.gen(function* () {
526
512
  }
527
513
  const ips = yield* readIps(spec.name);
528
514
  const refreshedFacts = yield* inspectContainer(spec.name);
529
- const ports = refreshedFacts?.effectivePorts ?? refreshedFacts?.ports ?? spec.ports;
530
- yield* mapSubstrateClaimError(addClaim({
531
- stackLockFile: paths.stackLockFile,
532
- rosterFile: paths.rosterFile,
533
- containerClaimsFile: paths.containerClaimsFile
534
- }, spec.name));
535
515
  return {
536
516
  ips,
537
- ports
517
+ ports: refreshedFacts?.effectivePorts ?? refreshedFacts?.ports ?? spec.ports
538
518
  };
539
519
  }));
540
520
  return {
@@ -544,7 +524,7 @@ const ensureContainer = (spec, deps) => Effect.gen(function* () {
544
524
  };
545
525
  })));
546
526
  return handleOf(id, spec.name, spec.image.tag ?? spec.image.digest, "running", ips, ports, spec.labels);
547
- }).pipe(Effect.withSpan("runtime.docker.container.ensure"));
527
+ });
548
528
  /** Apply the decided action. Recovers from name-collision via
549
529
  * one-shot start-and-adopt; second collision surfaces typed. */
550
530
  const applyAction = (action, spec, deps) => Effect.gen(function* () {
@@ -588,10 +568,10 @@ const createWithCollisionRecovery = (spec, deps) => freshCreate(spec, deps.cycle
588
568
  const stop = (name, graceSeconds, signal) => stopWithGrace(name, graceSeconds, signal).pipe(Effect.asVoid);
589
569
  const pause = (name) => Effect.gen(function* () {
590
570
  yield* dockerRun("pause", [name]).pipe(Effect.mapError(wrapGeneric("docker.pause")));
591
- }).pipe(Effect.withSpan("runtime.docker.container.pause"));
571
+ });
592
572
  const unpause = (name) => Effect.gen(function* () {
593
573
  yield* dockerRun("unpause", [name]).pipe(Effect.mapError(wrapGeneric("docker.unpause")));
594
- }).pipe(Effect.withSpan("runtime.docker.container.unpause"));
574
+ });
595
575
  /** Reserved `devstack.role` value stamped on every committed snapshot
596
576
  * byproduct image. Plugin BUILD images carry the source plugin's real
597
577
  * role (`db`, `validator`, …) or no role at all; committed snapshot
@@ -642,7 +622,7 @@ const commit = (name, tag) => Effect.gen(function* () {
642
622
  exitCode: 0
643
623
  }));
644
624
  return digest;
645
- }).pipe(Effect.withSpan("runtime.docker.container.commit"));
625
+ });
646
626
  //#endregion
647
627
  export { SNAPSHOT_IMAGE_ROLE, assertContainerHandleOwned, commit, decideRunAction, ensureContainer, inspectContainer, pause, stop, unpause };
648
628