@mysten-incubation/devstack 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/README.md +7 -4
  2. package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
  5. package/dashboard-ui/index.html +2 -2
  6. package/dist/api/define-capabilities.d.mts +1 -20
  7. package/dist/api/define-capabilities.mjs +15 -22
  8. package/dist/api/define-capabilities.mjs.map +1 -1
  9. package/dist/api/define-devstack-with.d.mts +7 -1
  10. package/dist/api/define-devstack-with.mjs.map +1 -1
  11. package/dist/api/define-devstack.mjs.map +1 -1
  12. package/dist/api/define-plugin.d.mts +2 -1
  13. package/dist/api/inference-network.d.mts +31 -17
  14. package/dist/api/inference-network.mjs +40 -43
  15. package/dist/api/inference-network.mjs.map +1 -1
  16. package/dist/api/load-config.mjs +88 -0
  17. package/dist/api/load-config.mjs.map +1 -0
  18. package/dist/api/mode-narrowed-factory.d.mts +1 -1
  19. package/dist/api/mode-narrowed-factory.mjs.map +1 -1
  20. package/dist/api/run-stack-internal.mjs +202 -0
  21. package/dist/api/run-stack-internal.mjs.map +1 -0
  22. package/dist/api/run-stack.d.mts +82 -31
  23. package/dist/api/run-stack.mjs +22 -141
  24. package/dist/api/run-stack.mjs.map +1 -1
  25. package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
  26. package/dist/build-integrations/dapp-kit/index.mjs +58 -0
  27. package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
  28. package/dist/build-integrations/playwright/config.d.mts +1 -30
  29. package/dist/build-integrations/playwright/config.mjs +1 -27
  30. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  31. package/dist/build-integrations/playwright/errors.d.mts +4 -7
  32. package/dist/build-integrations/playwright/errors.mjs.map +1 -1
  33. package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
  34. package/dist/build-integrations/playwright/global-setup.mjs +142 -218
  35. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  36. package/dist/build-integrations/playwright/index.d.mts +2 -2
  37. package/dist/build-integrations/playwright/index.mjs +2 -2
  38. package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
  39. package/dist/build-integrations/playwright/stack-context.mjs +4 -2
  40. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  41. package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
  42. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  44. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
  46. package/dist/build-integrations/runtime/discover.d.mts +6 -4
  47. package/dist/build-integrations/runtime/discover.mjs +15 -4
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  49. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/errors.mjs.map +1 -1
  51. package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
  52. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  53. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
  54. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
  55. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
  57. package/dist/build-integrations/vite/index.d.mts +84 -19
  58. package/dist/build-integrations/vite/index.mjs +203 -28
  59. package/dist/build-integrations/vite/index.mjs.map +1 -1
  60. package/dist/build-integrations/vitest/config.d.mts +20 -2
  61. package/dist/build-integrations/vitest/config.mjs +16 -4
  62. package/dist/build-integrations/vitest/config.mjs.map +1 -1
  63. package/dist/build-integrations/vitest/env.d.mts +18 -10
  64. package/dist/build-integrations/vitest/env.mjs +11 -10
  65. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  66. package/dist/build-integrations/vitest/errors.d.mts +7 -11
  67. package/dist/build-integrations/vitest/errors.mjs +3 -4
  68. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  69. package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
  70. package/dist/build-integrations/vitest/global-setup.mjs +156 -0
  71. package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
  72. package/dist/build-integrations/vitest/index.d.mts +3 -2
  73. package/dist/build-integrations/vitest/index.mjs +3 -2
  74. package/dist/build-integrations/vitest/setup.mjs +2 -2
  75. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  76. package/dist/build-integrations/vitest/stack-context.d.mts +5 -3
  77. package/dist/build-integrations/vitest/stack-context.mjs +3 -2
  78. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  79. package/dist/cli/bail.mjs.map +1 -1
  80. package/dist/cli/doctor-probes.mjs +1 -3
  81. package/dist/cli/doctor-probes.mjs.map +1 -1
  82. package/dist/cli/main.d.mts +23 -1
  83. package/dist/cli/main.mjs +63 -8
  84. package/dist/cli/main.mjs.map +1 -1
  85. package/dist/cli/prune-direct.mjs.map +1 -1
  86. package/dist/cli/snapshot-reader.mjs.map +1 -1
  87. package/dist/cli/up-lifecycle.mjs.map +1 -1
  88. package/dist/cli/wirings/apply.mjs +28 -21
  89. package/dist/cli/wirings/apply.mjs.map +1 -1
  90. package/dist/cli/wirings/codegen.mjs +108 -0
  91. package/dist/cli/wirings/codegen.mjs.map +1 -0
  92. package/dist/cli/wirings/config-loader.mjs +12 -62
  93. package/dist/cli/wirings/config-loader.mjs.map +1 -1
  94. package/dist/cli/wirings/dump-ids.mjs +86 -0
  95. package/dist/cli/wirings/dump-ids.mjs.map +1 -0
  96. package/dist/cli/wirings/engine-command.mjs +1 -1
  97. package/dist/cli/wirings/engine-command.mjs.map +1 -1
  98. package/dist/cli/wirings/identity.mjs +2 -2
  99. package/dist/cli/wirings/identity.mjs.map +1 -1
  100. package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
  101. package/dist/cli/wirings/read-devstack-version.mjs +17 -0
  102. package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
  103. package/dist/cli/wirings/snapshot.mjs +27 -34
  104. package/dist/cli/wirings/snapshot.mjs.map +1 -1
  105. package/dist/cli/wirings/up-ipc.mjs +147 -0
  106. package/dist/cli/wirings/up-ipc.mjs.map +1 -0
  107. package/dist/cli/wirings/up.mjs +218 -198
  108. package/dist/cli/wirings/up.mjs.map +1 -1
  109. package/dist/cli/wirings/wipe.mjs +1 -1
  110. package/dist/cli/wirings/wipe.mjs.map +1 -1
  111. package/dist/contracts/chain-probe.d.mts +1 -1
  112. package/dist/contracts/chain-probe.mjs +1 -1
  113. package/dist/contracts/chain-probe.mjs.map +1 -1
  114. package/dist/contracts/codegenable.d.mts +60 -6
  115. package/dist/contracts/codegenable.mjs +28 -0
  116. package/dist/contracts/codegenable.mjs.map +1 -0
  117. package/dist/contracts/config-bindings.mjs +162 -0
  118. package/dist/contracts/config-bindings.mjs.map +1 -0
  119. package/dist/contracts/container-runtime.d.mts +23 -17
  120. package/dist/contracts/plugin-expander.mjs.map +1 -1
  121. package/dist/contracts/snapshotable.d.mts +5 -7
  122. package/dist/contracts/wallet-protocol.d.mts +2 -5
  123. package/dist/contracts/wallet-protocol.mjs +2 -5
  124. package/dist/contracts/wallet-protocol.mjs.map +1 -1
  125. package/dist/index.d.mts +21 -26
  126. package/dist/index.mjs +8 -9
  127. package/dist/orchestrators/boot.d.mts +28 -0
  128. package/dist/orchestrators/boot.mjs +440 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -31
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +286 -58
  151. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  152. package/dist/orchestrators/layers.mjs +31 -0
  153. package/dist/orchestrators/layers.mjs.map +1 -0
  154. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
  155. package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
  156. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
  157. package/dist/orchestrators/network-options.d.mts +52 -0
  158. package/dist/orchestrators/network-options.mjs +43 -0
  159. package/dist/orchestrators/network-options.mjs.map +1 -0
  160. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  161. package/dist/orchestrators/router/cors.mjs.map +1 -1
  162. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  163. package/dist/orchestrators/router/errors.mjs.map +1 -1
  164. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  165. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  166. package/dist/orchestrators/router/profile.mjs +1 -1
  167. package/dist/orchestrators/router/profile.mjs.map +1 -1
  168. package/dist/orchestrators/router/service.d.mts +2 -2
  169. package/dist/orchestrators/router/service.mjs +12 -27
  170. package/dist/orchestrators/router/service.mjs.map +1 -1
  171. package/dist/orchestrators/router/traefik-container.mjs +1 -1
  172. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  173. package/dist/orchestrators/snapshot/capture.mjs +171 -195
  174. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  175. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
  176. package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
  177. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  178. package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
  179. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
  180. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
  181. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
  182. package/dist/orchestrators/snapshot/index.mjs +1 -4
  183. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  184. package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
  185. package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
  186. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
  187. package/dist/orchestrators/snapshot/prune.mjs +40 -31
  188. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  189. package/dist/orchestrators/snapshot/restore.mjs +221 -196
  190. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  191. package/dist/orchestrators/snapshot/service.mjs +72 -62
  192. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  193. package/dist/orchestrators/snapshot/wipe.mjs +67 -56
  194. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  195. package/dist/plugins/account/codegen.mjs +3 -0
  196. package/dist/plugins/account/codegen.mjs.map +1 -1
  197. package/dist/plugins/account/errors.d.mts +2 -2
  198. package/dist/plugins/account/errors.mjs +1 -4
  199. package/dist/plugins/account/errors.mjs.map +1 -1
  200. package/dist/plugins/account/funding.mjs +3 -27
  201. package/dist/plugins/account/funding.mjs.map +1 -1
  202. package/dist/plugins/account/index.d.mts +3 -8
  203. package/dist/plugins/account/index.mjs +71 -35
  204. package/dist/plugins/account/index.mjs.map +1 -1
  205. package/dist/plugins/account/keypair.d.mts +8 -7
  206. package/dist/plugins/account/keypair.mjs +5 -18
  207. package/dist/plugins/account/keypair.mjs.map +1 -1
  208. package/dist/plugins/account/lease.mjs.map +1 -1
  209. package/dist/plugins/account/registry.d.mts +1 -46
  210. package/dist/plugins/account/registry.mjs.map +1 -1
  211. package/dist/plugins/account/service.d.mts +43 -34
  212. package/dist/plugins/account/service.mjs +9 -54
  213. package/dist/plugins/account/service.mjs.map +1 -1
  214. package/dist/plugins/account/snapshot.mjs.map +1 -1
  215. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
  216. package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
  217. package/dist/plugins/account/variants/signer.mjs.map +1 -1
  218. package/dist/plugins/action/discriminator.mjs.map +1 -1
  219. package/dist/plugins/action/errors.mjs +1 -4
  220. package/dist/plugins/action/errors.mjs.map +1 -1
  221. package/dist/plugins/action/execute.mjs +3 -4
  222. package/dist/plugins/action/execute.mjs.map +1 -1
  223. package/dist/plugins/action/index.d.mts +2 -2
  224. package/dist/plugins/action/index.mjs +7 -11
  225. package/dist/plugins/action/index.mjs.map +1 -1
  226. package/dist/plugins/action/service.d.mts +5 -7
  227. package/dist/plugins/action/service.mjs +2 -16
  228. package/dist/plugins/action/service.mjs.map +1 -1
  229. package/dist/plugins/coin/address-resolution.mjs.map +1 -1
  230. package/dist/plugins/coin/codegen.mjs +97 -16
  231. package/dist/plugins/coin/codegen.mjs.map +1 -1
  232. package/dist/plugins/coin/discovery.mjs.map +1 -1
  233. package/dist/plugins/coin/errors.mjs +1 -4
  234. package/dist/plugins/coin/errors.mjs.map +1 -1
  235. package/dist/plugins/coin/index.d.mts +4 -34
  236. package/dist/plugins/coin/index.mjs +47 -28
  237. package/dist/plugins/coin/index.mjs.map +1 -1
  238. package/dist/plugins/coin/metadata.d.mts +1 -0
  239. package/dist/plugins/coin/metadata.mjs +8 -9
  240. package/dist/plugins/coin/metadata.mjs.map +1 -1
  241. package/dist/plugins/coin/mint.mjs +7 -21
  242. package/dist/plugins/coin/mint.mjs.map +1 -1
  243. package/dist/plugins/coin/registry.mjs +33 -20
  244. package/dist/plugins/coin/registry.mjs.map +1 -1
  245. package/dist/plugins/coin/service.d.mts +1 -1
  246. package/dist/plugins/coin/service.mjs +1 -8
  247. package/dist/plugins/coin/service.mjs.map +1 -1
  248. package/dist/plugins/coin/snapshot.mjs.map +1 -1
  249. package/dist/plugins/coin/type-strings.mjs.map +1 -1
  250. package/dist/plugins/dashboard/domain.mjs +106 -167
  251. package/dist/plugins/dashboard/domain.mjs.map +1 -1
  252. package/dist/plugins/dashboard/index.mjs +13 -13
  253. package/dist/plugins/dashboard/index.mjs.map +1 -1
  254. package/dist/plugins/dashboard/origin-policy.mjs +3 -3
  255. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
  256. package/dist/plugins/dashboard/routable.mjs.map +1 -1
  257. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
  258. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
  259. package/dist/plugins/dashboard/schema/root.mjs +23 -44
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +37 -91
  262. package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
  263. package/dist/plugins/dashboard/schema.mjs.map +1 -1
  264. package/dist/plugins/dashboard/server.mjs.map +1 -1
  265. package/dist/plugins/deepbook/codegen.d.mts +12 -11
  266. package/dist/plugins/deepbook/codegen.mjs +108 -11
  267. package/dist/plugins/deepbook/codegen.mjs.map +1 -1
  268. package/dist/plugins/deepbook/deploy.mjs +7 -14
  269. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  270. package/dist/plugins/deepbook/errors.mjs +4 -2
  271. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  272. package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
  273. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  274. package/dist/plugins/deepbook/hash.mjs.map +1 -1
  275. package/dist/plugins/deepbook/index.d.mts +38 -34
  276. package/dist/plugins/deepbook/index.mjs +133 -64
  277. package/dist/plugins/deepbook/index.mjs.map +1 -1
  278. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
  279. package/dist/plugins/deepbook/pyth/index.mjs +4 -8
  280. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  281. package/dist/plugins/deepbook/snapshot.mjs +0 -1
  282. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  283. package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
  284. package/dist/plugins/deepbook/types.d.mts +2 -1
  285. package/dist/plugins/deepbook/types.mjs.map +1 -1
  286. package/dist/plugins/faucet/dispatcher.d.mts +3 -3
  287. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  288. package/dist/plugins/faucet/errors.mjs.map +1 -1
  289. package/dist/plugins/faucet/http.mjs +2 -10
  290. package/dist/plugins/faucet/http.mjs.map +1 -1
  291. package/dist/plugins/faucet/index.mjs +0 -1
  292. package/dist/plugins/faucet/index.mjs.map +1 -1
  293. package/dist/plugins/host-service/errors.d.mts +1 -3
  294. package/dist/plugins/host-service/errors.mjs +1 -2
  295. package/dist/plugins/host-service/errors.mjs.map +1 -1
  296. package/dist/plugins/host-service/index.d.mts +1 -2
  297. package/dist/plugins/host-service/index.mjs +11 -11
  298. package/dist/plugins/host-service/index.mjs.map +1 -1
  299. package/dist/plugins/host-service/routable.mjs.map +1 -1
  300. package/dist/plugins/host-service/service.mjs +13 -13
  301. package/dist/plugins/host-service/service.mjs.map +1 -1
  302. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
  303. package/dist/plugins/internal/codegen-helpers.mjs +2 -0
  304. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
  305. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
  306. package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
  307. package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
  308. package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
  309. package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
  310. package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
  311. package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
  312. package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
  313. package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
  314. package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
  315. package/dist/plugins/package/build.mjs +2 -2
  316. package/dist/plugins/package/build.mjs.map +1 -1
  317. package/dist/plugins/package/codegen.d.mts +7 -14
  318. package/dist/plugins/package/codegen.mjs +187 -59
  319. package/dist/plugins/package/codegen.mjs.map +1 -1
  320. package/dist/plugins/package/dep-resolution.mjs +51 -3
  321. package/dist/plugins/package/dep-resolution.mjs.map +1 -1
  322. package/dist/plugins/package/errors.mjs +1 -4
  323. package/dist/plugins/package/errors.mjs.map +1 -1
  324. package/dist/plugins/package/git-source.d.mts +18 -0
  325. package/dist/plugins/package/git-source.mjs +119 -0
  326. package/dist/plugins/package/git-source.mjs.map +1 -0
  327. package/dist/plugins/package/index.d.mts +28 -19
  328. package/dist/plugins/package/index.mjs +107 -32
  329. package/dist/plugins/package/index.mjs.map +1 -1
  330. package/dist/plugins/package/mode-known.mjs +2 -2
  331. package/dist/plugins/package/mode-known.mjs.map +1 -1
  332. package/dist/plugins/package/mode-local.mjs +18 -35
  333. package/dist/plugins/package/mode-local.mjs.map +1 -1
  334. package/dist/plugins/package/publish-executor.mjs +13 -8
  335. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  336. package/dist/plugins/package/publish-output.d.mts +1 -11
  337. package/dist/plugins/package/publish-output.mjs +1 -9
  338. package/dist/plugins/package/publish-output.mjs.map +1 -1
  339. package/dist/plugins/package/registry.d.mts +1 -1
  340. package/dist/plugins/package/registry.mjs +26 -14
  341. package/dist/plugins/package/registry.mjs.map +1 -1
  342. package/dist/plugins/package/service.mjs.map +1 -1
  343. package/dist/plugins/package/snapshot.mjs.map +1 -1
  344. package/dist/plugins/router-entrypoints.mjs +1 -3
  345. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  346. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
  347. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  348. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
  349. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  350. package/dist/plugins/seal/codegen.d.mts +1 -5
  351. package/dist/plugins/seal/codegen.mjs +83 -12
  352. package/dist/plugins/seal/codegen.mjs.map +1 -1
  353. package/dist/plugins/seal/config-render.mjs +2 -6
  354. package/dist/plugins/seal/config-render.mjs.map +1 -1
  355. package/dist/plugins/seal/deploy.mjs +18 -29
  356. package/dist/plugins/seal/deploy.mjs.map +1 -1
  357. package/dist/plugins/seal/errors.d.mts +4 -5
  358. package/dist/plugins/seal/errors.mjs +1 -8
  359. package/dist/plugins/seal/errors.mjs.map +1 -1
  360. package/dist/plugins/seal/index.d.mts +7 -28
  361. package/dist/plugins/seal/index.mjs +69 -47
  362. package/dist/plugins/seal/index.mjs.map +1 -1
  363. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  364. package/dist/plugins/seal/key-server.mjs +1 -6
  365. package/dist/plugins/seal/key-server.mjs.map +1 -1
  366. package/dist/plugins/seal/keygen.mjs +2 -3
  367. package/dist/plugins/seal/keygen.mjs.map +1 -1
  368. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  369. package/dist/plugins/seal/mode/live.mjs +1 -1
  370. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  371. package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
  372. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  373. package/dist/plugins/seal/plugin-key.mjs.map +1 -1
  374. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  375. package/dist/plugins/seal/routable.mjs.map +1 -1
  376. package/dist/plugins/seal/service.mjs.map +1 -1
  377. package/dist/plugins/seal/snapshot.mjs +1 -2
  378. package/dist/plugins/seal/snapshot.mjs.map +1 -1
  379. package/dist/plugins/sui/auto-tick.mjs +5 -5
  380. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  381. package/dist/plugins/sui/chain-build-container.mjs +2 -2
  382. package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
  383. package/dist/plugins/sui/chain-probe.mjs +4 -4
  384. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  385. package/dist/plugins/sui/codegen.d.mts +9 -7
  386. package/dist/plugins/sui/codegen.mjs +49 -46
  387. package/dist/plugins/sui/codegen.mjs.map +1 -1
  388. package/dist/plugins/sui/errors.d.mts +1 -1
  389. package/dist/plugins/sui/errors.mjs +1 -9
  390. package/dist/plugins/sui/errors.mjs.map +1 -1
  391. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
  392. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
  393. package/dist/plugins/sui/exec/index.mjs.map +1 -0
  394. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
  395. package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
  396. package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
  397. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
  398. package/dist/plugins/sui/fork-orchestration.mjs +13 -23
  399. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  400. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  401. package/dist/plugins/sui/index.d.mts +34 -83
  402. package/dist/plugins/sui/index.mjs +200 -68
  403. package/dist/plugins/sui/index.mjs.map +1 -1
  404. package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
  405. package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
  406. package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
  407. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
  408. package/dist/plugins/sui/log-attrs.mjs +11 -0
  409. package/dist/plugins/sui/log-attrs.mjs.map +1 -0
  410. package/dist/plugins/sui/mode/external.mjs +4 -12
  411. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  412. package/dist/plugins/sui/mode/fork.mjs +19 -16
  413. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  414. package/dist/plugins/sui/mode/live.mjs +4 -17
  415. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  416. package/dist/plugins/sui/mode/local.d.mts +1 -0
  417. package/dist/plugins/sui/mode/local.mjs +203 -61
  418. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  419. package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
  420. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  421. package/dist/plugins/sui/mode/shared.d.mts +6 -7
  422. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  423. package/dist/plugins/sui/mode/spec.d.mts +23 -6
  424. package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
  425. package/dist/plugins/sui/move/index.mjs.map +1 -0
  426. package/dist/plugins/sui/move-summary-runner.mjs +8 -4
  427. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
  428. package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
  429. package/dist/plugins/sui/network-resolver.d.mts +6 -6
  430. package/dist/plugins/sui/routable.mjs.map +1 -1
  431. package/dist/plugins/sui/service.mjs +10 -6
  432. package/dist/plugins/sui/service.mjs.map +1 -1
  433. package/dist/plugins/sui/snapshot.mjs +10 -5
  434. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  435. package/dist/plugins/wallet/codegen.d.mts +8 -6
  436. package/dist/plugins/wallet/codegen.mjs +4 -10
  437. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  438. package/dist/plugins/wallet/errors.mjs +1 -4
  439. package/dist/plugins/wallet/errors.mjs.map +1 -1
  440. package/dist/plugins/wallet/index.d.mts +3 -6
  441. package/dist/plugins/wallet/index.mjs +16 -21
  442. package/dist/plugins/wallet/index.mjs.map +1 -1
  443. package/dist/plugins/wallet/origin-policy.mjs +3 -3
  444. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  445. package/dist/plugins/wallet/pairing.mjs +6 -24
  446. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  447. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  448. package/dist/plugins/wallet/routable.mjs.map +1 -1
  449. package/dist/plugins/wallet/server.mjs +17 -24
  450. package/dist/plugins/wallet/server.mjs.map +1 -1
  451. package/dist/plugins/wallet/service.d.mts +2 -2
  452. package/dist/plugins/wallet/service.mjs +4 -15
  453. package/dist/plugins/wallet/service.mjs.map +1 -1
  454. package/dist/plugins/wallet/snapshot.mjs.map +1 -1
  455. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
  456. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  457. package/dist/plugins/walrus/codegen.d.mts +2 -13
  458. package/dist/plugins/walrus/codegen.mjs +93 -28
  459. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  460. package/dist/plugins/walrus/deploy-paths.mjs +2 -3
  461. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  462. package/dist/plugins/walrus/deploy.mjs +26 -19
  463. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  464. package/dist/plugins/walrus/errors.mjs +1 -8
  465. package/dist/plugins/walrus/errors.mjs.map +1 -1
  466. package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
  467. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  468. package/dist/plugins/walrus/index.d.mts +13 -44
  469. package/dist/plugins/walrus/index.mjs +119 -122
  470. package/dist/plugins/walrus/index.mjs.map +1 -1
  471. package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
  472. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  473. package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
  474. package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
  475. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  476. package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
  477. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  478. package/dist/plugins/walrus/routable.mjs.map +1 -1
  479. package/dist/plugins/walrus/service.mjs.map +1 -1
  480. package/dist/plugins/walrus/snapshot.mjs +3 -3
  481. package/dist/plugins/walrus/snapshot.mjs.map +1 -1
  482. package/dist/plugins/walrus/storage-nodes.mjs +53 -14
  483. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  484. package/dist/plugins/walrus/wal-swap.mjs +4 -8
  485. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  486. package/dist/primitives/artifact-publisher.mjs.map +1 -1
  487. package/dist/primitives/cache.d.mts +1 -1
  488. package/dist/runtime/docker/client.mjs +47 -3
  489. package/dist/runtime/docker/client.mjs.map +1 -1
  490. package/dist/runtime/docker/container.mjs +37 -57
  491. package/dist/runtime/docker/container.mjs.map +1 -1
  492. package/dist/runtime/docker/errors.mjs.map +1 -1
  493. package/dist/runtime/docker/exec.mjs +2 -2
  494. package/dist/runtime/docker/exec.mjs.map +1 -1
  495. package/dist/runtime/docker/image.mjs +10 -11
  496. package/dist/runtime/docker/image.mjs.map +1 -1
  497. package/dist/runtime/docker/index.mjs +0 -1
  498. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
  499. package/dist/runtime/docker/inventory.mjs +9 -9
  500. package/dist/runtime/docker/inventory.mjs.map +1 -1
  501. package/dist/runtime/docker/labels.mjs +12 -1
  502. package/dist/runtime/docker/labels.mjs.map +1 -1
  503. package/dist/runtime/docker/network.mjs +6 -6
  504. package/dist/runtime/docker/network.mjs.map +1 -1
  505. package/dist/runtime/docker/render-run-args.mjs.map +1 -1
  506. package/dist/runtime/docker/service.mjs +31 -45
  507. package/dist/runtime/docker/service.mjs.map +1 -1
  508. package/dist/runtime/docker/sweep.mjs +14 -64
  509. package/dist/runtime/docker/sweep.mjs.map +1 -1
  510. package/dist/runtime/docker/volume.mjs +1 -1
  511. package/dist/runtime/docker/volume.mjs.map +1 -1
  512. package/dist/runtime/docker/wrap.mjs +14 -2
  513. package/dist/runtime/docker/wrap.mjs.map +1 -1
  514. package/dist/substrate/brand.d.mts +2 -5
  515. package/dist/substrate/brand.mjs +3 -2
  516. package/dist/substrate/brand.mjs.map +1 -1
  517. package/dist/substrate/cross-process.mjs +2 -16
  518. package/dist/substrate/cross-process.mjs.map +1 -1
  519. package/dist/substrate/event-time.mjs +0 -2
  520. package/dist/substrate/event-time.mjs.map +1 -1
  521. package/dist/substrate/events.d.mts +46 -16
  522. package/dist/substrate/identity.d.mts +11 -5
  523. package/dist/substrate/manifest.d.mts +33 -26
  524. package/dist/substrate/manifest.mjs +8 -3
  525. package/dist/substrate/manifest.mjs.map +1 -1
  526. package/dist/substrate/options.d.mts +33 -4
  527. package/dist/substrate/plugin-ctx.d.mts +70 -0
  528. package/dist/substrate/plugin-ctx.mjs +66 -0
  529. package/dist/substrate/plugin-ctx.mjs.map +1 -0
  530. package/dist/substrate/plugin.d.mts +46 -38
  531. package/dist/substrate/plugin.mjs +13 -9
  532. package/dist/substrate/plugin.mjs.map +1 -1
  533. package/dist/substrate/projection.d.mts +1 -1
  534. package/dist/substrate/runtime/atomic-write.mjs +3 -4
  535. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  536. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  537. package/dist/substrate/runtime/cache/service.mjs +50 -20
  538. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  539. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  540. package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
  541. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
  542. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
  543. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
  544. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  545. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  546. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  547. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -1
  548. package/dist/substrate/runtime/cross-process/index.mjs +0 -2
  549. package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
  550. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
  551. package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
  552. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  553. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
  554. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
  555. package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
  556. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  557. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
  558. package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
  559. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  560. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  561. package/dist/substrate/runtime/errors.mjs +1 -13
  562. package/dist/substrate/runtime/errors.mjs.map +1 -1
  563. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
  564. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
  565. package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
  566. package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
  567. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  568. package/dist/substrate/runtime/http-probe.d.mts +1 -3
  569. package/dist/substrate/runtime/http-probe.mjs.map +1 -1
  570. package/dist/substrate/runtime/index.mjs +1 -6
  571. package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
  572. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  573. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
  574. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  575. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  576. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  578. package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
  579. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  580. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  582. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  583. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  585. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  587. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  589. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  590. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  592. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  593. package/dist/substrate/runtime/managed-container.mjs +8 -10
  594. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  595. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  596. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  597. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  598. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  599. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  600. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  602. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  603. package/dist/substrate/runtime/observability/index.mjs +4 -6
  604. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  605. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  606. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  607. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  608. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  610. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  614. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  615. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  616. package/dist/substrate/runtime/paths.mjs +27 -9
  617. package/dist/substrate/runtime/paths.mjs.map +1 -1
  618. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  619. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  620. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  621. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  622. package/dist/substrate/runtime/probes.d.mts +2 -3
  623. package/dist/substrate/runtime/probes.mjs.map +1 -1
  624. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  625. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  626. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/update.mjs +87 -11
  628. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  629. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  630. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  631. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  632. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  633. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  635. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  636. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  637. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  638. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  639. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  640. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  641. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  642. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  643. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  644. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  645. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  646. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  647. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  649. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  650. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  651. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  652. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  654. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  656. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  658. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  659. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  660. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  661. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  662. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  663. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
  665. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  666. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  667. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  668. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  670. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  671. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  672. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  673. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  674. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  675. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  676. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  677. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  678. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  679. package/dist/surfaces/cli/command-tree.mjs +49 -7
  680. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  681. package/dist/surfaces/cli/commands/config.mjs +1 -1
  682. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  683. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  685. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  686. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  689. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  690. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  692. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  693. package/dist/surfaces/cli/commands/status.mjs +1 -1
  694. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  695. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  697. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  698. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  699. package/dist/surfaces/cli/errors.mjs.map +1 -1
  700. package/dist/surfaces/cli/flags.mjs.map +1 -1
  701. package/dist/surfaces/cli/index.mjs +45 -14
  702. package/dist/surfaces/cli/index.mjs.map +1 -1
  703. package/dist/surfaces/cli/output.mjs.map +1 -1
  704. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  705. package/dist/surfaces/tui/app.mjs +0 -21
  706. package/dist/surfaces/tui/app.mjs.map +1 -1
  707. package/dist/surfaces/tui/dashboard.mjs +0 -48
  708. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  709. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  710. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  711. package/dist/surfaces/tui/errors.mjs.map +1 -1
  712. package/dist/surfaces/tui/event-log.mjs +0 -9
  713. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  714. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  715. package/dist/surfaces/tui/index.mjs +2 -2
  716. package/dist/surfaces/tui/index.mjs.map +1 -1
  717. package/dist/surfaces/tui/input.mjs.map +1 -1
  718. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  719. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  720. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  721. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  722. package/dist/surfaces/tui/resource-table.mjs +8 -10
  723. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  724. package/images/postgres/Dockerfile +0 -1
  725. package/images/sui/Dockerfile +27 -54
  726. package/images/sui/entrypoint.sh +17 -179
  727. package/package.json +23 -15
  728. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  729. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  730. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  731. package/dist/api/plugin-errors.d.mts +0 -7
  732. package/dist/api/plugin-errors.mjs +0 -10
  733. package/dist/api/plugin-errors.mjs.map +0 -1
  734. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  735. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  736. package/dist/contracts/capability-decl.d.mts +0 -40
  737. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  738. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  739. package/dist/orchestrators/run.mjs +0 -91
  740. package/dist/orchestrators/run.mjs.map +0 -1
  741. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  742. package/dist/orchestrators/runtime-composition.mjs +0 -252
  743. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  744. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  745. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  746. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  748. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  749. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  750. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  751. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  752. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  753. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  754. package/dist/plugins/account/spans.mjs +0 -16
  755. package/dist/plugins/account/spans.mjs.map +0 -1
  756. package/dist/plugins/account/variants/env.mjs +0 -24
  757. package/dist/plugins/account/variants/env.mjs.map +0 -1
  758. package/dist/plugins/account/variants/inline.mjs +0 -13
  759. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  760. package/dist/plugins/account/variants/keystore.mjs +0 -91
  761. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  762. package/dist/plugins/action/spans.mjs +0 -11
  763. package/dist/plugins/action/spans.mjs.map +0 -1
  764. package/dist/plugins/coin/spans.mjs +0 -20
  765. package/dist/plugins/coin/spans.mjs.map +0 -1
  766. package/dist/plugins/deepbook/spans.mjs +0 -18
  767. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  768. package/dist/plugins/faucet/spans.mjs +0 -12
  769. package/dist/plugins/faucet/spans.mjs.map +0 -1
  770. package/dist/plugins/package/spans.mjs +0 -14
  771. package/dist/plugins/package/spans.mjs.map +0 -1
  772. package/dist/plugins/postgres/codegen.mjs +0 -42
  773. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  774. package/dist/plugins/postgres/connection.d.mts +0 -33
  775. package/dist/plugins/postgres/connection.mjs.map +0 -1
  776. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  777. package/dist/plugins/postgres/errors.d.mts +0 -60
  778. package/dist/plugins/postgres/errors.mjs +0 -29
  779. package/dist/plugins/postgres/errors.mjs.map +0 -1
  780. package/dist/plugins/postgres/index.d.mts +0 -37
  781. package/dist/plugins/postgres/index.mjs +0 -68
  782. package/dist/plugins/postgres/index.mjs.map +0 -1
  783. package/dist/plugins/postgres/routable.mjs +0 -33
  784. package/dist/plugins/postgres/routable.mjs.map +0 -1
  785. package/dist/plugins/postgres/service.d.mts +0 -50
  786. package/dist/plugins/postgres/service.mjs +0 -179
  787. package/dist/plugins/postgres/service.mjs.map +0 -1
  788. package/dist/plugins/postgres/snapshot.mjs +0 -32
  789. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  790. package/dist/plugins/postgres/spans.mjs +0 -11
  791. package/dist/plugins/postgres/spans.mjs.map +0 -1
  792. package/dist/plugins/seal/spans.mjs +0 -18
  793. package/dist/plugins/seal/spans.mjs.map +0 -1
  794. package/dist/plugins/sui/spans.mjs +0 -17
  795. package/dist/plugins/sui/spans.mjs.map +0 -1
  796. package/dist/plugins/wallet/spans.mjs +0 -22
  797. package/dist/plugins/wallet/spans.mjs.map +0 -1
  798. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  799. package/dist/plugins/walrus/spans.mjs +0 -18
  800. package/dist/plugins/walrus/spans.mjs.map +0 -1
  801. package/dist/runtime/docker/logs.d.mts +0 -1
  802. package/dist/runtime/docker/logs.mjs +0 -34
  803. package/dist/runtime/docker/logs.mjs.map +0 -1
  804. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  805. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  806. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  807. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  808. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  809. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  810. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  811. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  812. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  813. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  814. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  815. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  816. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  818. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  819. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  820. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  821. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  822. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  823. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  826. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  829. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  830. package/dist/substrate/runtime/projection/index.mjs +0 -4
  831. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  832. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  833. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  834. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  835. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  836. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  837. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  839. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  840. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  841. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  842. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  844. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  845. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  846. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  847. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  850. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  851. package/dist/substrate/state-store.d.mts +0 -1
  852. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  853. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  854. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  855. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  856. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  857. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
  858. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/sui/index.ts"],"sourcesContent":["// Sui plugin — barrel + factories.\n//\n// Architecture: Sui is the most-depended-on plugin in the stack.\n// Every consumer (Account/Coin/Wallet/Faucet/Package; Walrus/Seal/\n// Deepbook fork variants) reads its resolved `SuiClient` via the\n// `suiResource`. The factory at this file folds the four modes behind:\n//\n// - `sui(opts?)` — local shorthand. Defaults to an in-stack\n// local validator; pass a typed `opts`\n// record to select a different mode.\n// - `suiFor(network)` — mode-narrowed factory namespace (per\n// architecture Tension 11). Returns\n// `{ local: …, live: …, fork: … }`\n// narrowed to the network's mode.\n//\n// The plugin emits FOUR capability decls:\n//\n// 1. `chain-probe:<chainId>` strategy contributor — the\n// schema-validated read surface (`makeSuiChainProbe`).\n// 2. Snapshotable — mode-aware container + bind-mount capture.\n// 3. Codegenable — `sui-network` bindings (chain id, rpc, etc.).\n// 4. Faucet strategy contributor — local-coin dispensing for the\n// mode's chain id.\n//\n// Routable contributions are MODE-DEPENDENT (local + fork yes;\n// local-rpc + live no — the caller fronts their own RPC). They land\n// in the per-mode builder under `mode/*.ts`; this barrel composes\n// them into the plugin capability array.\n\nimport { Effect } from 'effect';\n\nimport { defineModeNamespace } from '../../api/mode-narrowed-factory.ts';\nimport { definePlugin, resource } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport type { AcquireContext } from '../../substrate/plugin.ts';\n\nimport { chainProbeCapabilityKey } from '../../contracts/chain-probe.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { LeaseBrokerService, type LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\nimport { PortBrokerService } from '../../substrate/runtime/port-broker/index.ts';\nimport { makeCodegenable } from './codegen.ts';\nimport type { SuiProbeKey } from './chain-probe.ts';\nimport { makeSnapshotable } from './snapshot.ts';\nimport { bootSuiService } from './service.ts';\nimport { SUI_ERROR_TAGS, type SuiPluginError } from './errors.ts';\nimport { makeSuiForkRoutables, makeSuiLocalRoutables } from './routable.ts';\nimport { faucetCapabilityKey, type FaucetStrategy } from '../faucet/index.ts';\nimport { suiLocalStrategy } from './local-faucet-strategy.ts';\nimport { suiForkFaucetStrategy } from './fork-faucet-strategy.ts';\nimport { selectSufficientForkCoin } from './fork-transaction.ts';\nimport { FORK_FAUCET_WHALE_MIN_COIN_MIST, resolveForkWhale } from './mode/fork.ts';\nimport type { SuiClient } from './mode/shared.ts';\nimport type {\n\tSuiForkOptions,\n\tSuiLiveOptions,\n\tSuiLocalRpcOptions,\n\tSuiLocalOptions,\n\tSuiOptions,\n} from './mode/spec.ts';\n\n// ---------------------------------------------------------------------------\n// Resource identity\n// ---------------------------------------------------------------------------\n\ntype SuiResolved = SuiClient & {\n\treadonly mode: SuiOptions['mode'];\n};\n\n/** Internal extension of `SuiResolved` carrying the pre-built funding\n * faucet strategy. `start` owns the `LeaseBrokerService` instance for\n * serialization; building the strategy at start-time (where the broker\n * is reachable) lets the capabilities factory consume a flat value\n * without threading the broker through a side channel. Local/live wrap\n * the HTTP faucet; fork impersonates a whale; `null` on networks with\n * no faucet (live-mainnet, external-rpc-without-faucet, faucet-disabled\n * fork). */\ntype SuiResolvedRuntime = SuiResolved & {\n\treadonly fundingFaucetStrategy: FaucetStrategy | null;\n};\n\n/** The Sui plugin's resource identity. The id is `'sui'` (singular). */\nexport const suiResource = resource<'sui', SuiResolved>('sui');\nconst suiErrorContributions = pluginErrorContributions(SUI_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Plugin construction (internal — used by sui() + suiFor())\n// ---------------------------------------------------------------------------\n\n/** Build the funds-ready faucet strategy for the resolved network, or\n * `null` when the network has none. Local/live wrap the HTTP faucet;\n * fork mode impersonates a whale (resolved + validated here). */\nconst resolveFundingFaucetStrategy = (\n\topts: SuiOptions,\n\tclient: SuiClient,\n\tbroker: LeaseBroker,\n): Effect.Effect<FaucetStrategy | null, SuiPluginError> => {\n\tif (opts.mode === 'fork') {\n\t\treturn resolveForkFaucetStrategy(opts, client, broker);\n\t}\n\tif (client.fundingFaucetUrl === null) {\n\t\treturn Effect.succeed(null);\n\t}\n\treturn Effect.succeed(\n\t\tsuiLocalStrategy({\n\t\t\tfaucetUrl: client.fundingFaucetUrl,\n\t\t\tserialization: {\n\t\t\t\tbroker,\n\t\t\t\tkey: `sui-faucet:${client.chain}`,\n\t\t\t\towner: `sui-faucet:${client.chain}`,\n\t\t\t},\n\t\t}),\n\t);\n};\n\n/** Fork-mode faucet: resolve the whale, validate it holds a large enough\n * SUI coin, then build the impersonation strategy. A whale the user set\n * explicitly that fails validation hard-fails the boot; a per-upstream\n * default whale only warns and disables the faucet so the fork still\n * comes up (account funding then surfaces the \"no faucet strategy\"\n * error only if something actually needs SUI). */\nconst resolveForkFaucetStrategy = (\n\topts: SuiForkOptions,\n\tclient: SuiClient,\n\tbroker: LeaseBroker,\n): Effect.Effect<FaucetStrategy | null, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tconst resolved = resolveForkWhale(opts);\n\t\tconst fork = client.fork;\n\t\tif (resolved === null || fork === null) {\n\t\t\treturn null;\n\t\t}\n\t\tconst strategy = suiForkFaucetStrategy({\n\t\t\twhale: resolved.whale,\n\t\t\tfork,\n\t\t\tsdk: client.sdk,\n\t\t\tperRequestCapMist: resolved.perRequestCapMist,\n\t\t\tserialization: {\n\t\t\t\tbroker,\n\t\t\t\tkey: `sui-fork-faucet:${client.chain}`,\n\t\t\t\towner: `sui-fork-faucet:${client.chain}`,\n\t\t\t},\n\t\t});\n\t\treturn yield* selectSufficientForkCoin(\n\t\t\tclient.sdk.core,\n\t\t\tresolved.whale,\n\t\t\tFORK_FAUCET_WHALE_MIN_COIN_MIST,\n\t\t).pipe(\n\t\t\tEffect.as(strategy),\n\t\t\tEffect.catchTag('SuiPluginError', (cause) =>\n\t\t\t\tresolved.explicit\n\t\t\t\t\t? Effect.fail(cause)\n\t\t\t\t\t: Effect.logWarning(\n\t\t\t\t\t\t\t`sui fork mode: default faucet whale ${resolved.whale} is unusable ` +\n\t\t\t\t\t\t\t\t`(${cause.message}); disabling the fork faucet. Set faucet.whale to override.`,\n\t\t\t\t\t\t).pipe(Effect.as(null)),\n\t\t\t),\n\t\t);\n\t});\n\nconst buildPlugin = (opts: SuiOptions) => {\n\treturn definePlugin({\n\t\tid: suiResource.id,\n\t\trole: 'service',\n\t\tsection: 'service',\n\t\tstart: () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// The substrate threads `ContainerRuntime` + `IdentityContext`\n\t\t\t\t// via the plugin runtime context; the supervisor provides\n\t\t\t\t// these before this body runs.\n\t\t\t\tconst runtime = yield* ContainerRuntimeService;\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst paths = yield* StackPathsService;\n\t\t\t\tconst portBroker = yield* PortBrokerService;\n\t\t\t\tconst fundingFaucetLeaseBroker = yield* LeaseBrokerService;\n\t\t\t\tconst { client } = yield* bootSuiService(runtime, identity, portBroker, paths, opts);\n\n\t\t\t\tconst fundingFaucetStrategy = yield* resolveFundingFaucetStrategy(\n\t\t\t\t\topts,\n\t\t\t\t\tclient,\n\t\t\t\t\tfundingFaucetLeaseBroker,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\t...client,\n\t\t\t\t\tmode: opts.mode,\n\t\t\t\t\tfundingFaucetStrategy,\n\t\t\t\t} satisfies SuiResolvedRuntime;\n\t\t\t}),\n\t\tcapabilities: ({ value, runtime }) => makePluginCapabilities(opts, value, runtime),\n\t\terrorContributions: suiErrorContributions,\n\t});\n};\n\n/** Construct the capability tuple POST-acquire. Receives the resolved\n * `SuiClient` + acquire context so decls can stamp REAL chain ids /\n * rpc URLs into their fields instead of factory-time placeholders.\n *\n * StrategyContributor declarations here carry real post-acquire\n * strategy values. The generic strategy sink registers them on the\n * scope-local `StrategyRegistry`. */\nconst makePluginCapabilities = (\n\topts: SuiOptions,\n\tresolved: SuiResolved,\n\tacquireCtx: AcquireContext,\n) => {\n\tconst realChain = resolved.chain;\n\tconst resolvedRuntime = resolved as SuiResolvedRuntime;\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\topts.mode,\n\t\tacquireCtx.identity.app,\n\t\tacquireCtx.identity.stack,\n\t\trealChain,\n\t);\n\tconst codegen: CodegenableDecl<'sui-network'> = makeCodegenable({\n\t\tmode: opts.mode,\n\t\tchain: realChain,\n\t\trpc: resolved.rpcUrl,\n\t\tsource: 'default',\n\t\t...(resolved.faucetUrl !== null ? { faucet: resolved.faucetUrl } : {}),\n\t\t...(resolved.graphqlUrl !== null ? { graphql: resolved.graphqlUrl } : {}),\n\t});\n\n\tconst chainProbeContribution: StrategyContributorDecl<\n\t\t`chain-probe:${string}`,\n\t\tChainProbe<SuiProbeKey>\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: chainProbeCapabilityKey(realChain),\n\t\tstrategy: resolved.chainProbe,\n\t\tautoMounted: true,\n\t};\n\n\tconst faucetContribution =\n\t\tresolvedRuntime.fundingFaucetStrategy === null\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tkind: 'strategy-contributor',\n\t\t\t\t\t\tcapabilityKey: faucetCapabilityKey(realChain),\n\t\t\t\t\t\tstrategy: resolvedRuntime.fundingFaucetStrategy,\n\t\t\t\t\t\tautoMounted: true,\n\t\t\t\t\t} satisfies StrategyContributorDecl<\n\t\t\t\t\t\t`faucet:request:${string}`,\n\t\t\t\t\t\tReturnType<typeof suiLocalStrategy>\n\t\t\t\t\t>,\n\t\t\t\t];\n\n\tconst localRoutables =\n\t\topts.mode === 'local'\n\t\t\t? makeSuiLocalRoutables({\n\t\t\t\t\tcontainerName: `devstack-${acquireCtx.identity.app}-${acquireCtx.identity.stack}-sui-validator`,\n\t\t\t\t\tincludeGraphql: true,\n\t\t\t\t})\n\t\t\t: [];\n\tconst forkRoutables =\n\t\topts.mode === 'fork'\n\t\t\t? makeSuiForkRoutables({\n\t\t\t\t\tcontainerName: `devstack-${acquireCtx.identity.app}-${acquireCtx.identity.stack}-sui-fork`,\n\t\t\t\t})\n\t\t\t: [];\n\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tchainProbeContribution,\n\t\t...faucetContribution,\n\t\t...localRoutables,\n\t\t...forkRoutables,\n\t] as const;\n};\n\n// ---------------------------------------------------------------------------\n// User-facing factories\n// ---------------------------------------------------------------------------\n\n/** Local Sui shorthand. Network/env selection belongs to the CLI or\n * `defineDevstackWith(...)`; plain `sui()` always means an in-stack\n * local validator. */\nexport const sui = (opts: SuiOptions = { mode: 'local' }) => buildPlugin(opts);\n\n/** Mode-narrowed factory namespace.\n *\n * Usage:\n * const network = { mode: 'local', chain: 'sui:localnet' } as const;\n * suiFor(network).local({...}) // OK\n * suiFor(network).fork({...}) // type error: 'fork' not in 'local' branch\n *\n * The namespace MIRRORS the four mode option records: `local`,\n * `localRpc` (mapped onto the substrate `'local'` branch),\n * `live`, `fork`. */\nexport const suiFor = defineModeNamespace({\n\tlocal: {\n\t\tlocal: (opts: Omit<SuiLocalOptions, 'mode'> = {}) => buildPlugin({ mode: 'local', ...opts }),\n\t\tlocalRpc: (opts: Omit<SuiLocalRpcOptions, 'mode'>) =>\n\t\t\tbuildPlugin({ mode: 'local-rpc', ...opts }),\n\t},\n\tlive: {\n\t\ttestnet: (opts: Omit<SuiLiveOptions, 'mode' | 'network'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'testnet', ...opts }),\n\t\tmainnet: (opts: Omit<SuiLiveOptions, 'mode' | 'network'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'mainnet', ...opts }),\n\t\tdevnet: (opts: Omit<SuiLiveOptions, 'mode' | 'network'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'devnet', ...opts }),\n\t\tcustom: (opts: Omit<SuiLiveOptions, 'mode' | 'network'>) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'custom', ...opts }),\n\t},\n\tfork: {\n\t\tmainnet: (opts: Omit<SuiForkOptions, 'mode' | 'upstream'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'fork', upstream: 'mainnet', ...opts }),\n\t\ttestnet: (opts: Omit<SuiForkOptions, 'mode' | 'upstream'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'fork', upstream: 'testnet', ...opts }),\n\t\tdevnet: (opts: Omit<SuiForkOptions, 'mode' | 'upstream'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'fork', upstream: 'devnet', ...opts }),\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// Re-exports for advanced callers (Account/Coin/Wallet/etc.) and for\n// the sibling plugins (Walrus/Seal/Deepbook fork variants).\n// ---------------------------------------------------------------------------\n\nexport type { SuiClient, ForkAdminSurface, WaitForTransactionsReady } from './mode/shared.ts';\nexport type { ResolvedSuiNetwork } from './network-resolver.ts';\nexport type {\n\tSuiOptions,\n\tSuiLocalOptions,\n\tSuiLocalRpcOptions,\n\tSuiLiveOptions,\n\tSuiForkOptions,\n\tSuiPluginMode,\n} from './mode/spec.ts';\nexport type { SuiNetworkBindings } from './codegen.ts';\nexport type {\n\tSuiError,\n\tSuiPluginError,\n\tSuiCliError,\n\tSuiConfigError,\n\tForkUnsupportedError,\n} from './errors.ts';\nexport { SUI_ERROR_TAGS } from './errors.ts';\n\n// Cross-plugin seams (consumed by Walrus/Seal/Deepbook fork variants\n// and by Account/Coin/Wallet/Package).\nexport {\n\tchainProbeCapabilityKey,\n\ttype ChainProbe,\n\ttype ChainProbeError,\n\ttype ChainProbeMode,\n} from '../../contracts/chain-probe.ts';\nexport {\n\tFORK_UNSUPPORTED_SURFACES,\n\twrapWithForkGuard,\n\ttype ForkLockHolder,\n} from './fork-orchestration.ts';\nexport type { SuiProbeKey, SuiSdkShim } from './chain-probe.ts';\nexport { SuiSpans } from './spans.ts';\n\n/** The shape `Transaction.build({ client })` and every `sdk.core.*` call\n * accepts. Re-exported from `@mysten/sui/client` so callers cast\n * `sui.sdk.client as ClientWithCoreApi` without each having to know the\n * SDK subpath. */\nexport type { ClientWithCoreApi } from '@mysten/sui/client';\n// Cross-plugin seams: fork impersonation + chain-build container.\n// Consumed by `action` (Move-call execution against fork) and\n// `package` (publish-to-fork + Move-build orchestration). Wave 2\n// switches consumer plugins from internal-module imports to these\n// barrel entries.\nexport {\n\tbuildForkImpersonationTransactionBytes,\n\tprepareForkImpersonationTransaction,\n\tverifyForkImpersonationSender,\n\tselectSufficientForkCoin,\n\tFORK_IMPERSONATION_GAS_BUDGET,\n\tFORK_IMPERSONATION_GAS_PRICE,\n\ttype ForkGasCoin,\n\ttype ForkImpersonationGasClient,\n} from './fork-transaction.ts';\nexport {\n\tsuiForkFaucetStrategy,\n\ttype SuiForkFaucetStrategyOptions,\n\ttype SuiForkFaucetSerialization,\n} from './fork-faucet-strategy.ts';\nexport {\n\tacquireChainBuildContainer,\n\tcontainerNameForApp,\n\tmoveBuildLockPathFor,\n\tMOVE_BUILD_LOCK_TIMEOUT_MS,\n\ttype ChainBuildContainer,\n\ttype ChainBuildContainerSpec,\n} from './chain-build-container.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,MAAa,cAAc,SAA6B,MAAM;AAC9D,MAAM,wBAAwB,yBAAyB,eAAe;;;;AAStE,MAAM,gCACL,MACA,QACA,WAC0D;AAC1D,KAAI,KAAK,SAAS,OACjB,QAAO,0BAA0B,MAAM,QAAQ,OAAO;AAEvD,KAAI,OAAO,qBAAqB,KAC/B,QAAO,OAAO,QAAQ,KAAK;AAE5B,QAAO,OAAO,QACb,iBAAiB;EAChB,WAAW,OAAO;EAClB,eAAe;GACd;GACA,KAAK,cAAc,OAAO;GAC1B,OAAO,cAAc,OAAO;GAC5B;EACD,CAAC,CACF;;;;;;;;AASF,MAAM,6BACL,MACA,QACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,iBAAiB,KAAK;CACvC,MAAM,OAAO,OAAO;AACpB,KAAI,aAAa,QAAQ,SAAS,KACjC,QAAO;CAER,MAAM,WAAW,sBAAsB;EACtC,OAAO,SAAS;EAChB;EACA,KAAK,OAAO;EACZ,mBAAmB,SAAS;EAC5B,eAAe;GACd;GACA,KAAK,mBAAmB,OAAO;GAC/B,OAAO,mBAAmB,OAAO;GACjC;EACD,CAAC;AACF,QAAO,OAAO,yBACb,OAAO,IAAI,MACX,SAAS,OACT,gCACA,CAAC,KACD,OAAO,GAAG,SAAS,EACnB,OAAO,SAAS,mBAAmB,UAClC,SAAS,WACN,OAAO,KAAK,MAAM,GA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AC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/sui/index.ts"],"sourcesContent":["// Sui plugin — barrel + factories.\n//\n// Architecture: Sui is the most-depended-on plugin in the stack.\n// Every consumer (Account/Coin/Wallet/Faucet/Package; Walrus/Seal/\n// Deepbook fork variants) reads its resolved `SuiClient` via the\n// `suiResource`. The factory at this file folds the four modes behind:\n//\n// - `sui(opts?)` — local shorthand. Defaults to an in-stack\n// local validator; pass a typed `opts`\n// record to select a different mode.\n// - `suiFor(network)` — mode-narrowed factory namespace (per\n// architecture Tension 11). Returns\n// `{ local: …, live: …, fork: … }`\n// narrowed to the network's mode.\n//\n// During `start`, the plugin emits (via the typed `ctx.*` verbs):\n//\n// 1. `ctx.provides` — `chain-probe:<chainId>` strategy contributor,\n// the schema-validated read surface (`makeSuiChainProbe`).\n// 2. `ctx.snapshotExtra` — mode-aware container + bind-mount capture.\n// 3. `ctx.codegen` — `sui-network` bindings (chain id, rpc, etc.).\n// 4. `ctx.provides` — faucet strategy contributor, local-coin\n// dispensing for the mode's chain id.\n//\n// `ctx.endpoint` contributions are MODE-DEPENDENT (local + fork yes;\n// local-rpc + live no — the caller fronts their own RPC). They land\n// in the per-mode builder under `mode/*.ts`; this barrel emits them\n// alongside the rest during `start`.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { defineModeNamespace } from '../../api/mode-narrowed-factory.ts';\nimport { definePlugin, resource, staticInputIdentity } from '../../api/define-plugin.ts';\nimport {\n\tbootPostgresSidecar,\n\tcredentialedUrl,\n\twithDatabase,\n} from '../internal/postgres-sidecar/index.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { emitContributions, PluginContext } from '../../substrate/plugin-ctx.ts';\n\nimport { chainProbeCapabilityKey } from '../../contracts/chain-probe.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport type {\n\tContainerRuntime,\n\tContainerRuntimeError,\n\tImageRef,\n} from '../../contracts/container-runtime.ts';\nimport type { Identity } from '../../substrate/identity.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { sanitizeAlias } from '../../substrate/runtime/managed-container.ts';\nimport {\n\tLeaseBrokerService,\n\ttype LeaseBroker,\n} from '../../substrate/runtime/lease-broker/index.ts';\nimport { PortBrokerService } from '../../substrate/runtime/port-broker/index.ts';\nimport { makeCodegenable, makeStaticCodegen } from './codegen.ts';\nimport type { SuiProbeKey } from './chain-probe.ts';\nimport { makeSnapshotable } from './snapshot.ts';\nimport { bootSuiService } from './service.ts';\nimport { suiPluginError, type SuiPluginError } from './errors.ts';\nimport { makeSuiForkRoutables, makeSuiLocalRoutables } from './routable.ts';\nimport { faucetCapabilityKey, type FaucetStrategy } from '../faucet/index.ts';\nimport { resolveNetworkOptions } from '../../orchestrators/network-options.ts';\nimport { suiLocalStrategy } from './local-faucet-strategy.ts';\nimport { suiForkFaucetStrategy } from './fork-faucet-strategy.ts';\nimport { selectSufficientForkCoin } from './fork-transaction.ts';\nimport { FORK_FAUCET_WHALE_MIN_COIN_MIST, resolveForkWhale } from './mode/fork.ts';\nimport { resolveImage, SUI_INDEXER_DB_ROLE, type LocalIndexer } from './mode/local.ts';\nimport type { SuiClient } from './mode/shared.ts';\nimport type {\n\tSuiForkOptions,\n\tSuiLiveOptions,\n\tSuiLocalRpcOptions,\n\tSuiLocalOptions,\n\tSuiOptions,\n} from './mode/spec.ts';\n\n// ---------------------------------------------------------------------------\n// Resource identity\n// ---------------------------------------------------------------------------\n\ntype SuiResolved = SuiClient & {\n\treadonly mode: SuiOptions['mode'];\n};\n\n/** Internal extension of `SuiResolved` carrying the pre-built funding\n * faucet strategy. `start` owns the `LeaseBrokerService` instance for\n * serialization; building the strategy at start-time (where the broker\n * is reachable) lets the capabilities factory consume a flat value\n * without threading the broker through a side channel. Local/live wrap\n * the HTTP faucet; fork impersonates a whale; `null` on networks with\n * no faucet (live-mainnet, external-rpc-without-faucet, faucet-disabled\n * fork). */\ntype SuiResolvedRuntime = SuiResolved & {\n\treadonly fundingFaucetStrategy: FaucetStrategy | null;\n};\n\n/** The Sui plugin's resource identity. The id is `'sui'` (singular). */\nexport const suiResource = resource<'sui', SuiResolved>('sui');\n\n// ---------------------------------------------------------------------------\n// Plugin construction (internal — used by sui() + suiFor())\n// ---------------------------------------------------------------------------\n\n/** Build the funds-ready faucet strategy for the resolved network, or\n * `null` when the network has none. Local/live wrap the HTTP faucet;\n * fork mode impersonates a whale (resolved + validated here). */\nconst resolveFundingFaucetStrategy = (\n\topts: SuiOptions,\n\tclient: SuiClient,\n\tbroker: LeaseBroker,\n): Effect.Effect<FaucetStrategy | null, SuiPluginError> => {\n\tif (opts.mode === 'fork') {\n\t\treturn resolveForkFaucetStrategy(opts, client, broker);\n\t}\n\tif (client.fundingFaucetUrl === null) {\n\t\treturn Effect.succeed(null);\n\t}\n\treturn Effect.succeed(\n\t\tsuiLocalStrategy({\n\t\t\tfaucetUrl: client.fundingFaucetUrl,\n\t\t\tserialization: {\n\t\t\t\tbroker,\n\t\t\t\tkey: `sui-faucet:${client.chainId}`,\n\t\t\t\towner: `sui-faucet:${client.chainId}`,\n\t\t\t},\n\t\t}),\n\t);\n};\n\n/** Fork-mode faucet: resolve the whale, validate it holds a large enough\n * SUI coin, then build the impersonation strategy. A whale the user set\n * explicitly that fails validation hard-fails the boot; a per-upstream\n * default whale only warns and disables the faucet so the fork still\n * comes up (account funding then surfaces the \"no faucet strategy\"\n * error only if something actually needs SUI). */\nconst resolveForkFaucetStrategy = (\n\topts: SuiForkOptions,\n\tclient: SuiClient,\n\tbroker: LeaseBroker,\n): Effect.Effect<FaucetStrategy | null, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tconst resolved = resolveForkWhale(opts);\n\t\tconst fork = client.fork;\n\t\tif (resolved === null || fork === null) {\n\t\t\treturn null;\n\t\t}\n\t\tconst strategy = suiForkFaucetStrategy({\n\t\t\twhale: resolved.whale,\n\t\t\tfork,\n\t\t\tsdk: client.sdk,\n\t\t\tperRequestCapMist: resolved.perRequestCapMist,\n\t\t\tserialization: {\n\t\t\t\tbroker,\n\t\t\t\tkey: `sui-fork-faucet:${client.chainId}`,\n\t\t\t\towner: `sui-fork-faucet:${client.chainId}`,\n\t\t\t},\n\t\t});\n\t\treturn yield* selectSufficientForkCoin(\n\t\t\tclient.sdk.core,\n\t\t\tresolved.whale,\n\t\t\tFORK_FAUCET_WHALE_MIN_COIN_MIST,\n\t\t).pipe(\n\t\t\tEffect.as(strategy),\n\t\t\tEffect.catchTag('SuiPluginError', (cause) =>\n\t\t\t\tresolved.explicit\n\t\t\t\t\t? Effect.fail(cause)\n\t\t\t\t\t: Effect.logWarning(\n\t\t\t\t\t\t\t`sui fork mode: default faucet whale ${resolved.whale} is unusable ` +\n\t\t\t\t\t\t\t\t`(${cause.message}); disabling the fork faucet. Set faucet.whale to override.`,\n\t\t\t\t\t\t).pipe(Effect.as(null)),\n\t\t\t),\n\t\t);\n\t});\n\n/** Default name for sui's GraphQL-indexer database. */\nconst DEFAULT_INDEXER_DATABASE = 'sui_indexer';\n\n/** In-network DNS alias siblings dial the indexer-db sidecar by. */\nconst SUI_INDEXER_DB_ALIAS = 'sui-indexer-db';\n\nconst suiInputIdentity = (opts: SuiOptions): unknown => {\n\tconst { readyTimeout: _readyTimeout, ...authored } = opts;\n\tif (authored.mode !== 'local') return { plugin: 'sui', ...authored };\n\treturn {\n\t\tplugin: 'sui',\n\t\t...authored,\n\t\tindexer: authored.indexer !== false,\n\t\tindexerDb:\n\t\t\tauthored.indexerDb === undefined\n\t\t\t\t? undefined\n\t\t\t\t: {\n\t\t\t\t\t\t...authored.indexerDb,\n\t\t\t\t\t\tdatabase: authored.indexerDb.database ?? DEFAULT_INDEXER_DATABASE,\n\t\t\t\t\t},\n\t};\n};\n\n/** Compose the indexer-db sidecar's stable `configHash` from validator\n * inputs known before local mode starts. A validator image change recreates\n * the validator, so the sidecar's mount-less PGDATA must reset with it.\n *\n * Validator data-layer resets that are not config values (absent validator\n * or last exit `137`) are handled by `validatorNeedsIndexerReset`, which\n * removes the sidecar before this hash is applied. */\nexport const composeIndexerConfigHash = (imageRef: string): string =>\n\t['indexer-db', `validator-img=${imageRef}`].join('|');\n\n/** Append a database segment to a BYO DSN only when it has no path (so a\n * caller-supplied `.../mydb` is respected). Rebuilds via the URL object\n * so the db slots into `pathname` BEFORE `?search` — a naive string\n * append on a `host:5432?sslmode=require` DSN (path-less but with a\n * query) would wrongly yield `...?sslmode=require/sui_indexer`. The\n * catch fallback (non-URL-parseable DSN) splits the query off first. */\nconst appendDatabaseIfMissing = (url: string, database: string): string => {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\tconst hasPath = parsed.pathname !== '' && parsed.pathname !== '/';\n\t\tif (hasPath) return url;\n\t\tparsed.pathname = `/${database}`;\n\t\treturn parsed.toString();\n\t} catch {\n\t\tconst queryAt = url.indexOf('?');\n\t\tconst base = queryAt === -1 ? url : url.slice(0, queryAt);\n\t\tconst query = queryAt === -1 ? '' : url.slice(queryAt);\n\t\tconst afterScheme = base.replace(/^postgres(ql)?:\\/\\//, '');\n\t\tif (/\\/[^/]+$/.test(afterScheme)) return url;\n\t\treturn `${base.replace(/\\/$/, '')}/${encodeURIComponent(database)}${query}`;\n\t}\n};\n\n/** Whether the Sui-owned indexer DB must be deleted before boot.\n *\n * The validator's chain identity lives in its writable layer. If the\n * validator container is absent, the next boot creates a new layer and a\n * new chain. If it last exited `137`, the runtime's `on-failure` policy\n * also recreates it. Both cases make any existing indexer DB stale. */\nexport const validatorNeedsIndexerReset = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n): Effect.Effect<boolean, ContainerRuntimeError> =>\n\truntime\n\t\t.inspectByLabels({\n\t\t\tapp: identity.app,\n\t\t\tstack: identity.stack,\n\t\t\tplugin: 'sui',\n\t\t\trole: 'validator',\n\t\t})\n\t\t.pipe(\n\t\t\tEffect.map((handles) => {\n\t\t\t\tconst validator = handles[0];\n\t\t\t\treturn validator === undefined || validator.lastExitCode === 137;\n\t\t\t}),\n\t\t);\n\n/** Provision the GraphQL-indexer DB wiring for local mode.\n *\n * Default: sui OWNS a postgres sidecar (labelled under sui) — boot it on\n * a per-stack network and compose the DSN from its in-network alias (NOT\n * the per-stack container DNS host, which isn't parallel-stack-portable).\n * The sidecar resets on the same validator inputs that can make its rows\n * stale: absent/exited-`137` validator state removes the sidecar before\n * boot, and validator image identity is folded into its `configHash`.\n *\n * `validatorImage` is the SAME `ImageRef` the barrel hands `bootLocalMode`\n * for the validator container, so the image the sidecar hashed and the image\n * the validator runs cannot drift.\n *\n * BYO: when `indexerDb` is set, no sidecar — pass the caller's DSN +\n * network straight through (appending the default db iff the DSN has no\n * path). The caller owns that DB's lifecycle. */\nexport const provisionLocalIndexer = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\topts: SuiLocalOptions,\n\tvalidatorImage: ImageRef,\n): Effect.Effect<LocalIndexer, SuiPluginError, Scope.Scope> => {\n\tconst database = opts.indexerDb?.database ?? DEFAULT_INDEXER_DATABASE;\n\tif (opts.indexerDb !== undefined) {\n\t\treturn Effect.succeed({\n\t\t\turl: appendDatabaseIfMissing(opts.indexerDb.url, database),\n\t\t\tnetwork: opts.indexerDb.network,\n\t\t});\n\t}\n\tconst network = sanitizeAlias(`devstack-${identity.app}-${identity.stack}-sui-indexer`);\n\treturn Effect.gen(function* () {\n\t\tconst resetExistingSidecar = yield* validatorNeedsIndexerReset(runtime, identity);\n\t\tif (resetExistingSidecar) {\n\t\t\tyield* runtime.removeManagedContainers({\n\t\t\t\tapp: identity.app,\n\t\t\t\tstack: identity.stack,\n\t\t\t\tplugin: 'sui',\n\t\t\t\trole: SUI_INDEXER_DB_ROLE,\n\t\t\t});\n\t\t}\n\t\tconst imageRef = validatorImage.tag ?? validatorImage.digest;\n\t\tconst { handle } = yield* bootPostgresSidecar(runtime, identity, {\n\t\t\tnetwork,\n\t\t\talias: SUI_INDEXER_DB_ALIAS,\n\t\t\trole: SUI_INDEXER_DB_ROLE,\n\t\t\tdatabase,\n\t\t\tconfigHash: composeIndexerConfigHash(imageRef),\n\t\t});\n\t\treturn {\n\t\t\turl: withDatabase(\n\t\t\t\tcredentialedUrl({\n\t\t\t\t\tuser: handle.user,\n\t\t\t\t\tpassword: handle.password,\n\t\t\t\t\thost: handle.networkAlias,\n\t\t\t\t\tport: handle.port,\n\t\t\t\t}),\n\t\t\t\tdatabase,\n\t\t\t),\n\t\t\tnetwork: handle.containerNetwork,\n\t\t} satisfies LocalIndexer;\n\t}).pipe(\n\t\t// Postgres / runtime-domain failures wrap into the sui error channel\n\t\t// — the sidecar is a sui implementation detail. Nothing in the gen\n\t\t// body produces a `SuiPluginError` directly, so we wrap every cause.\n\t\tEffect.mapError((cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'container-start',\n\t\t\t\t`sui local mode: failed to provision the GraphQL indexer postgres sidecar (${cause._tag})`,\n\t\t\t\tcause,\n\t\t\t),\n\t\t),\n\t);\n};\n\n/** Shared boot + inline contribution emission, parameterised by the\n * resolved external-indexer wiring (`undefined` = no GraphQL, the\n * zero-config / non-local case) and, for local mode, the validator image\n * the barrel pre-resolved (so the sidecar's `configHash` and the validator\n * container share one `ImageRef`; `undefined` on the no-sidecar paths,\n * where `bootLocalMode` resolves it inline). */\nconst bootAndEmit = (\n\topts: SuiOptions,\n\tindexer: LocalIndexer | undefined,\n\tprebuiltImage?: ImageRef,\n) =>\n\tEffect.gen(function* () {\n\t\tconst ctx = yield* PluginContext;\n\t\t// The substrate threads `ContainerRuntime` + `IdentityContext`\n\t\t// via the plugin runtime context; the supervisor provides\n\t\t// these before this body runs.\n\t\tconst runtime = yield* ContainerRuntimeService;\n\t\tconst identity = yield* IdentityContext;\n\t\tconst paths = yield* StackPathsService;\n\t\tconst portBroker = yield* PortBrokerService;\n\t\tconst fundingFaucetLeaseBroker = yield* LeaseBrokerService;\n\t\tconst { client } = yield* bootSuiService(\n\t\t\truntime,\n\t\t\tidentity,\n\t\t\tportBroker,\n\t\t\tpaths,\n\t\t\topts,\n\t\t\tindexer,\n\t\t\tprebuiltImage,\n\t\t);\n\n\t\tconst fundingFaucetStrategy = yield* resolveFundingFaucetStrategy(\n\t\t\topts,\n\t\t\tclient,\n\t\t\tfundingFaucetLeaseBroker,\n\t\t);\n\t\tconst value = {\n\t\t\t...client,\n\t\t\tmode: opts.mode,\n\t\t\tfundingFaucetStrategy,\n\t\t} satisfies SuiResolvedRuntime;\n\t\t// Emit the resolved contributions inline, top-to-bottom: the\n\t\t// decls stamp REAL chain ids / rpc URLs / container names\n\t\t// (the genesis-digest chain id, not the network name).\n\t\t// (`value` is the just-resolved runtime; `identity` from\n\t\t// `IdentityContext`, NOT re-fetched). The shared\n\t\t// `emitContributions` routes each by `kind`. Faucet (conditional\n\t\t// on a resolved strategy) and routables (mode-dependent) are the\n\t\t// only optional members; order is load-bearing.\n\t\tconst realChainId = value.chainId;\n\t\t// Per-network faucet gate (per-network options: ON for every network\n\t\t// EXCEPT live `mainnet`, where the funding faucet must NEVER run).\n\t\t// `identity.network` is the resolved network name. The gate honours\n\t\t// ONLY the POLICY DEFAULT, NOT any author per-network override: the\n\t\t// override RECORD (`networkOptions`) is an orchestrator-level concern\n\t\t// that the name-blind substrate does not forward into plugins, and\n\t\t// this plugin only receives `IdentityContext`. So a per-network\n\t\t// `{ <network>: { faucet: false } }` override is deliberately NOT\n\t\t// applied here (unlike `devWallet`/`autoApproveSigning`, which the\n\t\t// orchestrator resolves against the forwarded `networkOptions`); see\n\t\t// `orchestrators/network-options.ts`. The policy default already\n\t\t// carries the load-bearing mainnet hard-clamp, so a resolved strategy\n\t\t// on `mainnet` (none of the live modes build one today, but a future\n\t\t// faucet-bearing mainnet config could) is suppressed and the strategy\n\t\t// registry never exposes `faucet:request:<mainnet-chain-id>`; account\n\t\t// funding then surfaces the actionable \"no faucet strategy\" error\n\t\t// rather than silently faucet-funding against a production network.\n\t\tconst faucetEnabled = resolveNetworkOptions(identity.network).faucet;\n\t\tconst faucetContribution: ReadonlyArray<StrategyContributorDecl> =\n\t\t\t!faucetEnabled || value.fundingFaucetStrategy === null\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: 'strategy-contributor',\n\t\t\t\t\t\t\tcapabilityKey: faucetCapabilityKey(realChainId),\n\t\t\t\t\t\t\tstrategy: value.fundingFaucetStrategy,\n\t\t\t\t\t\t\tautoMounted: true,\n\t\t\t\t\t\t} satisfies StrategyContributorDecl<\n\t\t\t\t\t\t\t`faucet:request:${string}`,\n\t\t\t\t\t\t\tReturnType<typeof suiLocalStrategy>\n\t\t\t\t\t\t>,\n\t\t\t\t\t];\n\t\tconst localRoutables =\n\t\t\topts.mode === 'local'\n\t\t\t\t? makeSuiLocalRoutables({\n\t\t\t\t\t\tcontainerName: `devstack-${identity.app}-${identity.stack}-sui-validator`,\n\t\t\t\t\t\t// GraphQL routes only when the external indexer is wired.\n\t\t\t\t\t\tincludeGraphql: indexer !== undefined,\n\t\t\t\t\t})\n\t\t\t\t: [];\n\t\tconst forkRoutables =\n\t\t\topts.mode === 'fork'\n\t\t\t\t? makeSuiForkRoutables({\n\t\t\t\t\t\tcontainerName: `devstack-${identity.app}-${identity.stack}-sui-fork`,\n\t\t\t\t\t})\n\t\t\t\t: [];\n\t\temitContributions(ctx, [\n\t\t\t// `hasIndexer` (local only) folds the sui-owned indexer-db\n\t\t\t// sidecar into the captured containers; `indexer !== undefined`\n\t\t\t// is the same gate `bootAndEmit`'s caller resolved GraphQL on.\n\t\t\tmakeSnapshotable(opts.mode, identity.app, identity.stack, realChainId, indexer !== undefined),\n\t\t\tmakeCodegenable({\n\t\t\t\tmode: opts.mode,\n\t\t\t\tchainId: realChainId,\n\t\t\t\trpc: value.rpcUrl,\n\t\t\t\tsource: 'default',\n\t\t\t\t...(value.faucetUrl !== null ? { faucet: value.faucetUrl } : {}),\n\t\t\t\t...(value.graphqlUrl !== null ? { graphql: value.graphqlUrl } : {}),\n\t\t\t}),\n\t\t\t{\n\t\t\t\tkind: 'strategy-contributor',\n\t\t\t\tcapabilityKey: chainProbeCapabilityKey(realChainId),\n\t\t\t\tstrategy: value.chainProbe,\n\t\t\t\tautoMounted: true,\n\t\t\t} satisfies StrategyContributorDecl<`chain-probe:${string}`, ChainProbe<SuiProbeKey>>,\n\t\t\t...faucetContribution,\n\t\t\t...localRoutables,\n\t\t\t...forkRoutables,\n\t\t]);\n\t\treturn value;\n\t});\n\n/** The single sui plugin builder. No sibling `dependsOn`: in local mode\n * with the indexer on (the default), `start` provisions the GraphQL\n * indexer DB itself — a sui-owned postgres sidecar — inside the boot\n * scope BEFORE the boot-time validator (so the validator can join its\n * network), then boots + emits. Resolution order:\n * - `indexerDb` present → BYO DB (no sidecar)\n * - `indexer === false` → opt out (RPC + faucet only, GraphQL off)\n * - else (local default) → sui-owned sidecar\n * Non-local modes never touch the indexer (GraphQL off). */\nconst buildSuiPlugin = (opts: SuiOptions) =>\n\tdefinePlugin({\n\t\tid: suiResource.id,\n\t\trole: 'service',\n\t\tsection: 'service',\n\t\tinputIdentity: staticInputIdentity(suiInputIdentity(opts)),\n\t\t// Stack-free codegen: the `codegen` verb derives the committed\n\t\t// `config.ts`'s `network`/`networks` from this hook. Both are\n\t\t// environment/live data (dynamic local rpc port; a real deployment\n\t\t// names a different network), so the committed tree carries\n\t\t// `resolveNetwork()`/`resolveNetworks()` raw expressions that resolve\n\t\t// at app build/dev time via the injected `__DEVSTACK_IDS__` global —\n\t\t// never literal values. No id-resolver input needed.\n\t\tstaticCodegen: makeStaticCodegen(),\n\t\t// Zero-arg `start` (no `dependsOn`); the substrate supplies the\n\t\t// container runtime + identity via the plugin runtime context.\n\t\tstart: () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// Resolution order: BYO `indexerDb` wins; then an explicit\n\t\t\t\t// `indexer: false` opt-out; then the sui-owned sidecar default.\n\t\t\t\t// Non-local modes never wire the indexer.\n\t\t\t\tif (opts.mode !== 'local' || (opts.indexerDb === undefined && opts.indexer === false)) {\n\t\t\t\t\treturn yield* bootAndEmit(opts, undefined);\n\t\t\t\t}\n\t\t\t\tconst runtime = yield* ContainerRuntimeService;\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\t// Resolve the validator image ONCE, before the sidecar — single\n\t\t\t\t// source for both the sidecar's configHash (it folds the resolved\n\t\t\t\t// image ref so an image bump resets the indexer DB) and the\n\t\t\t\t// validator container `bootAndEmit` boots below. `resolveImage`\n\t\t\t\t// is deterministic (content-addressed build/pull) so this is the\n\t\t\t\t// SAME ref the validator runs; resolving it here, not twice,\n\t\t\t\t// avoids a redundant build AND any drift from `decideRunAction`.\n\t\t\t\tconst validatorImage = yield* resolveImage(runtime, identity, opts);\n\t\t\t\t// The sidecar boots first; if the validator boot below fails, the\n\t\t\t\t// sidecar's finalizer lingers on the plugin acquire scope until\n\t\t\t\t// teardown/retry. Benign and intentional — the stable name +\n\t\t\t\t// labels mean a retry ADOPTS the existing sidecar container\n\t\t\t\t// (no scope-threading machinery needed).\n\t\t\t\tconst indexer = yield* provisionLocalIndexer(runtime, identity, opts, validatorImage);\n\t\t\t\treturn yield* bootAndEmit(opts, indexer, validatorImage);\n\t\t\t}),\n\t});\n\nconst buildPlugin = <O extends SuiOptions>(opts: O) => buildSuiPlugin(opts);\n\n// ---------------------------------------------------------------------------\n// User-facing factories\n// ---------------------------------------------------------------------------\n\n/** Local Sui shorthand. Network/env selection belongs to the CLI or\n * `defineDevstackWith(...)`; plain `sui()` always means an in-stack\n * local validator (GraphQL/indexer/Postgres on by default via a\n * sui-owned sidecar). */\nexport const sui = <const O extends SuiOptions = { mode: 'local' }>(\n\topts: O = { mode: 'local' } as O,\n) => buildPlugin(opts);\n\n/** Mode-narrowed factory namespace.\n *\n * Usage:\n * const network = { mode: 'local' } as const;\n * suiFor(network).local({...}) // OK\n * suiFor(network).fork({...}) // type error: 'fork' not in 'local' branch\n *\n * The namespace MIRRORS the four mode option records: `local`,\n * `localRpc` (mapped onto the substrate `'local'` branch),\n * `live`, `fork`. */\nexport const suiFor = defineModeNamespace({\n\tlocal: {\n\t\tlocal: <const O extends Omit<SuiLocalOptions, 'mode'>>(opts: O = {} as O) =>\n\t\t\tbuildPlugin({ mode: 'local', ...opts }),\n\t\tlocalRpc: (opts: Omit<SuiLocalRpcOptions, 'mode'>) =>\n\t\t\tbuildPlugin({ mode: 'local-rpc', ...opts }),\n\t},\n\tlive: {\n\t\ttestnet: (opts: Omit<SuiLiveOptions, 'mode' | 'network'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'testnet', ...opts }),\n\t\tmainnet: (opts: Omit<SuiLiveOptions, 'mode' | 'network'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'mainnet', ...opts }),\n\t\tdevnet: (opts: Omit<SuiLiveOptions, 'mode' | 'network'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'devnet', ...opts }),\n\t\tcustom: (opts: Omit<SuiLiveOptions, 'mode' | 'network'>) =>\n\t\t\tbuildPlugin({ mode: 'live', network: 'custom', ...opts }),\n\t},\n\tfork: {\n\t\tmainnet: (opts: Omit<SuiForkOptions, 'mode' | 'upstream'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'fork', upstream: 'mainnet', ...opts }),\n\t\ttestnet: (opts: Omit<SuiForkOptions, 'mode' | 'upstream'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'fork', upstream: 'testnet', ...opts }),\n\t\tdevnet: (opts: Omit<SuiForkOptions, 'mode' | 'upstream'> = {}) =>\n\t\t\tbuildPlugin({ mode: 'fork', upstream: 'devnet', ...opts }),\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// Re-exports for advanced callers (Account/Coin/Wallet/etc.) and for\n// the sibling plugins (Walrus/Seal/Deepbook fork variants).\n// ---------------------------------------------------------------------------\n\nexport type { SuiClient, ForkAdminSurface, WaitForTransactionsReady } from './mode/shared.ts';\nexport type { ResolvedSuiNetwork } from './network-resolver.ts';\nexport type {\n\tNetworkConfig,\n\tNetworkMode,\n\tDevstackNetworkModeRegistry,\n\tDefaultNetwork,\n} from './network-config.ts';\nexport type {\n\tSuiOptions,\n\tSuiLocalOptions,\n\tSuiLocalRpcOptions,\n\tSuiLiveOptions,\n\tSuiForkOptions,\n\tSuiPluginMode,\n} from './mode/spec.ts';\nexport type { SuiNetworkConfigEntry } from './codegen.ts';\nexport type {\n\tSuiError,\n\tSuiPluginError,\n\tSuiCliError,\n\tSuiConfigError,\n\tForkUnsupportedError,\n} from './errors.ts';\n\n// Cross-plugin seams (consumed by Walrus/Seal/Deepbook fork variants\n// and by Account/Coin/Wallet/Package).\nexport {\n\tchainProbeCapabilityKey,\n\ttype ChainProbe,\n\ttype ChainProbeError,\n\ttype ChainProbeMode,\n} from '../../contracts/chain-probe.ts';\nexport {\n\tFORK_UNSUPPORTED_SURFACES,\n\twrapWithForkGuard,\n\ttype ForkLockHolder,\n} from './fork-orchestration.ts';\nexport type { SuiProbeKey, SuiSdkShim } from './chain-probe.ts';\nexport { SuiLogAttr } from './log-attrs.ts';\n\n/** The shape `Transaction.build({ client })` and every `sdk.core.*` call\n * accepts. Re-exported from `@mysten/sui/client` so callers cast\n * `sui.sdk.client as ClientWithCoreApi` without each having to know the\n * SDK subpath. */\nexport type { ClientWithCoreApi } from '@mysten/sui/client';\n// Cross-plugin seams: fork impersonation + chain-build container.\n// Consumed by `action` (Move-call execution against fork) and\n// `package` (publish-to-fork + Move-build orchestration). Consumer\n// plugins import these barrel entries rather than internal modules.\nexport {\n\tbuildForkImpersonationTransactionBytes,\n\tprepareForkImpersonationTransaction,\n\tverifyForkImpersonationSender,\n\tselectSufficientForkCoin,\n\tFORK_IMPERSONATION_GAS_BUDGET,\n\tFORK_IMPERSONATION_GAS_PRICE,\n\ttype ForkGasCoin,\n\ttype ForkImpersonationGasClient,\n} from './fork-transaction.ts';\nexport {\n\tsuiForkFaucetStrategy,\n\ttype SuiForkFaucetStrategyOptions,\n\ttype SuiForkFaucetSerialization,\n} from './fork-faucet-strategy.ts';\nexport {\n\tacquireChainBuildContainer,\n\tcontainerNameForApp,\n\tmoveBuildLockPathFor,\n\tMOVE_BUILD_LOCK_TIMEOUT_MS,\n\ttype ChainBuildContainer,\n\ttype ChainBuildContainerSpec,\n} from './chain-build-container.ts';\n\n// Cross-plugin seams: hoisted exec / move / ledger helpers.\n// Consumed by Account/Action/Coin/Deepbook/Package/Seal/Walrus. These\n// barrel entries route those consumers through the sibling plugin's\n// barrel per the `plugin-boundary` invariant, rather than reaching into\n// the deep `sui/exec`, `sui/move`, and `sui/ledger` internal modules.\nexport {\n\textractExecuteDigest,\n\tformatExecutedFailure,\n\texecuteSuiTx,\n\tisSuiStaleObjectVersionError,\n\ttype ResolvedSigner,\n\ttype ExecutedFailure,\n\ttype ExecutedReceipt,\n\ttype TransactionSignerScope,\n} from './exec/index.ts';\nexport { signAndDispatch } from './exec/sign-and-dispatch.ts';\nexport {\n\thashMoveSources,\n\trunMoveBuild,\n\tscrubLocksHost,\n\twithMoveBuildLock,\n\ttype BuildOutput,\n\ttype MoveBuildContainer,\n\ttype MoveBuildError,\n} from './move/index.ts';\nexport { currentLedgerObjectRef } from './ledger/object-ref.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGA,MAAa,cAAc,SAA6B,KAAK;;;;AAS7D,MAAM,gCACL,MACA,QACA,WAC0D;CAC1D,IAAI,KAAK,SAAS,QACjB,OAAO,0BAA0B,MAAM,QAAQ,MAAM;CAEtD,IAAI,OAAO,qBAAqB,MAC/B,OAAO,OAAO,QAAQ,IAAI;CAE3B,OAAO,OAAO,QACb,iBAAiB;EAChB,WAAW,OAAO;EAClB,eAAe;GACd;GACA,KAAK,cAAc,OAAO;GAC1B,OAAO,cAAc,OAAO;EAC7B;CACD,CAAC,CACF;AACD;;;;;;;AAQA,MAAM,6BACL,MACA,QACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,WA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AY;GAAE,MAAM;GAAQ,SAAS;GAAU,GAAG;EAAK,CAAC;EACzD,SAAS,SACR,YAAY;GAAE,MAAM;GAAQ,SAAS;GAAU,GAAG;EAAK,CAAC;CAC1D;CACA,MAAM;EACL,UAAU,OAAkD,CAAC,MAC5D,YAAY;GAAE,MAAM;GAAQ,UAAU;GAAW,GAAG;EAAK,CAAC;EAC3D,UAAU,OAAkD,CAAC,MAC5D,YAAY;GAAE,MAAM;GAAQ,UAAU;GAAW,GAAG;EAAK,CAAC;EAC3D,SAAS,OAAkD,CAAC,MAC3D,YAAY;GAAE,MAAM;GAAQ,UAAU;GAAU,GAAG;EAAK,CAAC;CAC3D;AACD,CAAC"}
@@ -1,4 +1,4 @@
1
- //#region src/substrate/runtime/sui-ledger/object-ref.ts
1
+ //#region src/plugins/sui/ledger/object-ref.ts
2
2
  /** Re-cast a `SuiSdkShim` as the gRPC ledger-service client. The
3
3
  * `unknown` hop is required because `ClientWithCoreApi` doesn't
4
4
  * structurally overlap with `{ledgerService: …}`. */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-ref.mjs","names":[],"sources":["../../../../src/plugins/sui/ledger/object-ref.ts"],"sourcesContent":["// plugins/sui/ledger — `ledgerService.getObject` workaround.\n//\n// `SuiSdkShim.core.getObject` returns the simplified `core`-surface\n// projection (no version/digest) per `@mysten/sui`'s `ClientWithCoreApi`\n// shape. The gRPC ledger service provides the BCS-encoded object\n// envelope WITH version + digest under a `readMask` projection — see\n// `@mysten/sui/docs/clients/grpc.md` § Ledger service.\n//\n// The cast `sdk.client as unknown as {ledgerService: {…}}` is the\n// sanctioned escape hatch — `ClientWithCoreApi` doesn't structurally\n// overlap with the gRPC `{ledgerService}` shape, so a direct cast fails.\n// Folded into one helper so every plugin that needs an up-to-date\n// `{objectId, version, digest}` ObjectRef goes through the same\n// projection (and the same `unknown`-cast escape hatch) rather than\n// re-deriving it.\n//\n// NOTE: not exported from the public barrel — this is an internal\n// primitive used by plugins, not a published API.\n\nimport type { SuiSdkShim } from '../index.ts';\n\n/** Shape of the gRPC ledger-service projection we need. Hand-written\n * because the public `ClientWithCoreApi` surface doesn't include the\n * ledger service. */\ninterface LedgerObjectClient {\n\treadonly ledgerService: {\n\t\treadonly getObject: (args: {\n\t\t\treadonly objectId: string;\n\t\t\treadonly readMask?: { readonly paths: ReadonlyArray<string> };\n\t\t}) => Promise<{\n\t\t\treadonly response?: {\n\t\t\t\treadonly object?: {\n\t\t\t\t\treadonly objectId?: string;\n\t\t\t\t\treadonly version?: string | number | bigint;\n\t\t\t\t\treadonly digest?: string;\n\t\t\t\t};\n\t\t\t};\n\t\t}>;\n\t};\n}\n\n/** Re-cast a `SuiSdkShim` as the gRPC ledger-service client. The\n * `unknown` hop is required because `ClientWithCoreApi` doesn't\n * structurally overlap with `{ledgerService: …}`. */\nconst ledgerObjectClient = (sdk: SuiSdkShim): LedgerObjectClient =>\n\tsdk.client as unknown as LedgerObjectClient;\n\n/** Up-to-date `{objectId, version, digest}` ObjectRef for `objectId`,\n * fetched through the gRPC ledger service.\n *\n * Throws if the response envelope is missing any of `objectId` /\n * `version` / `digest` — e.g. when the object was deleted or never\n * existed. The error message includes the requested object id so\n * call-site context surfaces in plugin error traces. */\nexport const currentLedgerObjectRef = async (\n\tsdk: SuiSdkShim,\n\tobjectId: string,\n): Promise<{\n\treadonly objectId: string;\n\treadonly version: string;\n\treadonly digest: string;\n}> => {\n\tconst raw = await ledgerObjectClient(sdk).ledgerService.getObject({\n\t\tobjectId,\n\t\treadMask: { paths: ['object_id', 'version', 'digest'] },\n\t});\n\tconst object = raw.response?.object;\n\tif (\n\t\tobject === undefined ||\n\t\tobject.objectId === undefined ||\n\t\tobject.version === undefined ||\n\t\tobject.digest === undefined\n\t) {\n\t\tthrow new Error(\n\t\t\t`currentLedgerObjectRef: object '${objectId}' was not found (response missing one of objectId/version/digest).`,\n\t\t);\n\t}\n\treturn {\n\t\tobjectId: object.objectId,\n\t\tversion: object.version.toString(),\n\t\tdigest: object.digest,\n\t};\n};\n"],"mappings":";;;;AA4CA,MAAM,sBAAsB,QAC3B,IAAI;;;;;;;;AASL,MAAa,yBAAyB,OACrC,KACA,aAKK;CAKL,MAAM,UAAS,MAJG,mBAAmB,GAAG,CAAC,CAAC,cAAc,UAAU;EACjE;EACA,UAAU,EAAE,OAAO;GAAC;GAAa;GAAW;EAAQ,EAAE;CACvD,CAAC,EAAA,CACkB,UAAU;CAC7B,IACC,WAAW,KAAA,KACX,OAAO,aAAa,KAAA,KACpB,OAAO,YAAY,KAAA,KACnB,OAAO,WAAW,KAAA,GAElB,MAAM,IAAI,MACT,mCAAmC,SAAS,mEAC7C;CAED,OAAO;EACN,UAAU,OAAO;EACjB,SAAS,OAAO,QAAQ,SAAS;EACjC,QAAQ,OAAO;CAChB;AACD"}
@@ -1,6 +1,5 @@
1
1
  import { leaseKey } from "../../substrate/runtime/lease-broker/service.mjs";
2
2
  import "../../substrate/runtime/lease-broker/index.mjs";
3
- import { SuiSpans } from "./spans.mjs";
4
3
  import { requestFundsWithRetry } from "../faucet/http.mjs";
5
4
  import "../faucet/index.mjs";
6
5
  import { Effect } from "effect";
@@ -10,10 +9,7 @@ const withSerialization = (serialization, effect) => {
10
9
  return Effect.scoped(Effect.gen(function* () {
11
10
  yield* serialization.broker.acquire(leaseKey(serialization.key), serialization.owner);
12
11
  yield* effect;
13
- })).pipe(Effect.withSpan("devstack.plugin.sui.localFaucet.serializedRequest", { attributes: {
14
- [SuiSpans.localFaucetLeaseKey]: serialization.key,
15
- [SuiSpans.localFaucetLeaseOwner]: serialization.owner
16
- } }));
12
+ }));
17
13
  };
18
14
  /** Build a SUI local-faucet HTTP strategy. */
19
15
  const suiLocalStrategy = (opts) => ({ request: ({ address, amount }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"local-faucet-strategy.mjs","names":[],"sources":["../../../src/plugins/sui/local-faucet-strategy.ts"],"sourcesContent":["// SUI local-faucet HTTP strategy.\n//\n// Architecture: the Sui plugin OWNS the local-faucet endpoint\n// conceptually — it spins up the `sui-faucet` container in\n// `mode/local.ts`. The strategy CLOSES OVER the faucet URL at\n// construction so the dispatch site never sees Sui context, and is\n// registered into the `faucet:request:<chainId>` strategy registry\n// via a `StrategyContributor` decl from `sui/index.ts`.\n//\n// `FaucetStrategy` (the dispatch shape) is the faucet plugin's\n// contract surface and is imported from `../faucet/index.ts` — the\n// sui plugin only depends on faucet for the type, not for the\n// implementation. That keeps the dependency direction faucet ← sui,\n// matching the user-facing fact that `sui()` is the owner of the\n// faucet container.\n//\n// Amount semantics: the local faucet returns a fixed-amount grant\n// per request (the binary doesn't honor a variable amount today).\n// We carry `amount` through to error payloads so exhaustion errors\n// match the strategy-native unit (MIST), but the wire request\n// itself does not include it.\n\nimport { Effect } from 'effect';\n\nimport { leaseKey, type LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\nimport { requestFundsWithRetry, type FaucetStrategy, type RetryOptions } from '../faucet/index.ts';\n\nimport { SuiSpans } from './spans.ts';\n\n/** Optional serialization for faucet backends that spend a shared funding coin. */\nexport interface SuiLocalFaucetSerialization {\n\t/** Stack-local broker; callers choose the resource key shape. */\n\treadonly broker: LeaseBroker;\n\t/** Opaque lease key, typically scoped by chain id. */\n\treadonly key: string;\n\t/** Diagnostic owner reported by the lease broker. */\n\treadonly owner: string;\n}\n\n/** Per-strategy options. */\nexport interface SuiLocalStrategyOptions {\n\t/** Faucet base URL — e.g. `http://localhost:9123`. The strategy\n\t * appends `/v2/gas` internally. */\n\treadonly faucetUrl: string;\n\t/** Wall-clock budget; forwarded to `requestFundsWithRetry`. */\n\treadonly timeoutMs?: number;\n\t/** Max retry attempts; forwarded to `requestFundsWithRetry`. */\n\treadonly maxAttempts?: number;\n\t/** Serialize requests when the faucet backend shares one funding coin. */\n\treadonly serialization?: SuiLocalFaucetSerialization;\n}\n\nconst withSerialization = <E>(\n\tserialization: SuiLocalFaucetSerialization | undefined,\n\teffect: Effect.Effect<void, E>,\n): Effect.Effect<void, E> => {\n\tif (serialization === undefined) {\n\t\treturn effect;\n\t}\n\treturn Effect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tyield* serialization.broker.acquire(leaseKey(serialization.key), serialization.owner);\n\t\t\tyield* effect;\n\t\t}),\n\t).pipe(\n\t\tEffect.withSpan('devstack.plugin.sui.localFaucet.serializedRequest', {\n\t\t\tattributes: {\n\t\t\t\t[SuiSpans.localFaucetLeaseKey]: serialization.key,\n\t\t\t\t[SuiSpans.localFaucetLeaseOwner]: serialization.owner,\n\t\t\t},\n\t\t}),\n\t);\n};\n\n/** Build a SUI local-faucet HTTP strategy. */\nexport const suiLocalStrategy = (opts: SuiLocalStrategyOptions): FaucetStrategy => ({\n\trequest: ({ address, amount }) => {\n\t\tconst retryOpts: RetryOptions = {\n\t\t\tfaucetUrl: opts.faucetUrl,\n\t\t\taddress,\n\t\t\tamount,\n\t\t\t...(opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}),\n\t\t\t...(opts.maxAttempts !== undefined ? { maxAttempts: opts.maxAttempts } : {}),\n\t\t};\n\t\treturn withSerialization(opts.serialization, requestFundsWithRetry(retryOpts));\n\t},\n});\n"],"mappings":";;;;;;;AAoDA,MAAM,qBACL,eACA,WAC4B;AAC5B,KAAI,kBAAkB,KAAA,EACrB,QAAO;AAER,QAAO,OAAO,OACb,OAAO,IAAI,aAAa;AACvB,SAAO,cAAc,OAAO,QAAQ,SAAS,cAAc,IAAI,EAAE,cAAc,MAAM;AACrF,SAAO;GACN,CACF,CAAC,KACD,OAAO,SAAS,qDAAqD,EACpE,YAAY;GACV,SAAS,sBAAsB,cAAc;GAC7C,SAAS,wBAAwB,cAAc;EAChD,EACD,CAAC,CACF;;;AAIF,MAAa,oBAAoB,UAAmD,EACnF,UAAU,EAAE,SAAS,aAAa;CACjC,MAAM,YAA0B;EAC/B,WAAW,KAAK;EAChB;EACA;EACA,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,WAAW,KAAK,WAAW,GAAG,EAAE;EACrE,GAAI,KAAK,gBAAgB,KAAA,IAAY,EAAE,aAAa,KAAK,aAAa,GAAG,EAAE;EAC3E;AACD,QAAO,kBAAkB,KAAK,eAAe,sBAAsB,UAAU,CAAC;GAE/E"}
1
+ {"version":3,"file":"local-faucet-strategy.mjs","names":[],"sources":["../../../src/plugins/sui/local-faucet-strategy.ts"],"sourcesContent":["// SUI local-faucet HTTP strategy.\n//\n// Architecture: the Sui plugin OWNS the local-faucet endpoint\n// conceptually — it spins up the `sui-faucet` container in\n// `mode/local.ts`. The strategy CLOSES OVER the faucet URL at\n// construction so the dispatch site never sees Sui context, and is\n// registered into the `faucet:request:<chainId>` strategy registry\n// via a `StrategyContributor` decl from `sui/index.ts`.\n//\n// `FaucetStrategy` (the dispatch shape) is the faucet plugin's\n// contract surface and is imported from `../faucet/index.ts` — the\n// sui plugin only depends on faucet for the type, not for the\n// implementation. That keeps the dependency direction faucet ← sui,\n// matching the user-facing fact that `sui()` is the owner of the\n// faucet container.\n//\n// Amount semantics: the local faucet returns a fixed-amount grant\n// per request (the binary doesn't honor a variable amount today).\n// We carry `amount` through to error payloads so exhaustion errors\n// match the strategy-native unit (MIST), but the wire request\n// itself does not include it.\n\nimport { Effect } from 'effect';\n\nimport { leaseKey, type LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\nimport { requestFundsWithRetry, type FaucetStrategy, type RetryOptions } from '../faucet/index.ts';\n\n/** Optional serialization for faucet backends that spend a shared funding coin. */\nexport interface SuiLocalFaucetSerialization {\n\t/** Stack-local broker; callers choose the resource key shape. */\n\treadonly broker: LeaseBroker;\n\t/** Opaque lease key, typically scoped by chain id. */\n\treadonly key: string;\n\t/** Diagnostic owner reported by the lease broker. */\n\treadonly owner: string;\n}\n\n/** Per-strategy options. */\nexport interface SuiLocalStrategyOptions {\n\t/** Faucet base URL — e.g. `http://localhost:9123`. The strategy\n\t * appends `/v2/gas` internally. */\n\treadonly faucetUrl: string;\n\t/** Wall-clock budget; forwarded to `requestFundsWithRetry`. */\n\treadonly timeoutMs?: number;\n\t/** Max retry attempts; forwarded to `requestFundsWithRetry`. */\n\treadonly maxAttempts?: number;\n\t/** Serialize requests when the faucet backend shares one funding coin. */\n\treadonly serialization?: SuiLocalFaucetSerialization;\n}\n\nconst withSerialization = <E>(\n\tserialization: SuiLocalFaucetSerialization | undefined,\n\teffect: Effect.Effect<void, E>,\n): Effect.Effect<void, E> => {\n\tif (serialization === undefined) {\n\t\treturn effect;\n\t}\n\treturn Effect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tyield* serialization.broker.acquire(leaseKey(serialization.key), serialization.owner);\n\t\t\tyield* effect;\n\t\t}),\n\t);\n};\n\n/** Build a SUI local-faucet HTTP strategy. */\nexport const suiLocalStrategy = (opts: SuiLocalStrategyOptions): FaucetStrategy => ({\n\trequest: ({ address, amount }) => {\n\t\tconst retryOpts: RetryOptions = {\n\t\t\tfaucetUrl: opts.faucetUrl,\n\t\t\taddress,\n\t\t\tamount,\n\t\t\t...(opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : {}),\n\t\t\t...(opts.maxAttempts !== undefined ? { maxAttempts: opts.maxAttempts } : {}),\n\t\t};\n\t\treturn withSerialization(opts.serialization, requestFundsWithRetry(retryOpts));\n\t},\n});\n"],"mappings":";;;;;;AAkDA,MAAM,qBACL,eACA,WAC4B;CAC5B,IAAI,kBAAkB,KAAA,GACrB,OAAO;CAER,OAAO,OAAO,OACb,OAAO,IAAI,aAAa;EACvB,OAAO,cAAc,OAAO,QAAQ,SAAS,cAAc,GAAG,GAAG,cAAc,KAAK;EACpF,OAAO;CACR,CAAC,CACF;AACD;;AAGA,MAAa,oBAAoB,UAAmD,EACnF,UAAU,EAAE,SAAS,aAAa;CACjC,MAAM,YAA0B;EAC/B,WAAW,KAAK;EAChB;EACA;EACA,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;EACpE,GAAI,KAAK,gBAAgB,KAAA,IAAY,EAAE,aAAa,KAAK,YAAY,IAAI,CAAC;CAC3E;CACA,OAAO,kBAAkB,KAAK,eAAe,sBAAsB,SAAS,CAAC;AAC9E,EACD"}
@@ -0,0 +1,11 @@
1
+ //#region src/plugins/sui/log-attrs.ts
2
+ const SuiLogAttr = {
3
+ autoTickIntervalMs: "sui.autoTick.intervalMs",
4
+ chain: "sui.chain",
5
+ container: "sui.container",
6
+ mode: "sui.mode"
7
+ };
8
+ //#endregion
9
+ export { SuiLogAttr };
10
+
11
+ //# sourceMappingURL=log-attrs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-attrs.mjs","names":[],"sources":["../../../src/plugins/sui/log-attrs.ts"],"sourcesContent":["// Sui plugin attribute-key vocabulary. Plugin-local — substrate's\n// `LogAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// These keys back leveled log annotations (`Effect.annotateLogs({\n// [SuiLogAttr.container]: value })`) and the account plugin's\n// cross-cutting funding annotations. Free-form string literals are a\n// STYLE_GUIDE §16 violation.\n\nexport const SuiLogAttr = {\n\tautoTickIntervalMs: 'sui.autoTick.intervalMs',\n\tchain: 'sui.chain',\n\tcontainer: 'sui.container',\n\tmode: 'sui.mode',\n} as const;\n"],"mappings":";AASA,MAAa,aAAa;CACzB,oBAAoB;CACpB,OAAO;CACP,WAAW;CACX,MAAM;AACP"}
@@ -1,7 +1,5 @@
1
- import { SpanAttr } from "../../../substrate/runtime/observability/spans.mjs";
2
1
  import { suiPluginError } from "../errors.mjs";
3
2
  import { formatUnknownError } from "../../../substrate/runtime/format-unknown-error.mjs";
4
- import { SuiSpans } from "../spans.mjs";
5
3
  import { assembleSuiClient, buildWaitForTransactionsReady, fetchChainId, makeResolvedNetwork, noopWaitForTransactionsReady } from "./shared-boot.mjs";
6
4
  import { Duration, Effect } from "effect";
7
5
  import { SuiGrpcClient } from "@mysten/sui/grpc";
@@ -20,14 +18,11 @@ const bootLocalRpcMode = (opts) => Effect.gen(function* () {
20
18
  }),
21
19
  catch: (cause) => suiPluginError("chain-id-fetch", `sui local-rpc mode: SuiGrpcClient construction failed for rpcUrl=${opts.rpcUrl}: ${formatUnknownError(cause)}`, cause)
22
20
  });
23
- const chain = opts.chain ?? (yield* fetchChainId(sdkClient, {
24
- timeout: opts.readyTimeout ?? DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT,
25
- span: "devstack.plugin.sui.localRpc.fetchChainId"
26
- }));
21
+ const chainId = opts.chainId ?? (yield* fetchChainId(sdkClient, { timeout: opts.readyTimeout ?? DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT }));
27
22
  const waitForTransactionsReady = opts.faucetUrl !== void 0 ? yield* buildWaitForTransactionsReady(opts.faucetUrl) : noopWaitForTransactionsReady;
28
23
  const { client } = yield* assembleSuiClient({
29
24
  sdkClient,
30
- chain,
25
+ chainId,
31
26
  rpcUrl: opts.rpcUrl,
32
27
  ...opts.faucetUrl !== void 0 ? { faucetUrl: opts.faucetUrl } : {},
33
28
  ...opts.graphqlUrl !== void 0 ? { graphqlUrl: opts.graphqlUrl } : {},
@@ -36,7 +31,7 @@ const bootLocalRpcMode = (opts) => Effect.gen(function* () {
36
31
  return {
37
32
  resolved: makeResolvedNetwork({
38
33
  mode: "local-rpc",
39
- chain,
34
+ chainId,
40
35
  rpc: opts.rpcUrl,
41
36
  source: "config",
42
37
  ...opts.faucetUrl !== void 0 ? { faucet: opts.faucetUrl } : {},
@@ -44,10 +39,7 @@ const bootLocalRpcMode = (opts) => Effect.gen(function* () {
44
39
  }),
45
40
  client
46
41
  };
47
- }).pipe(Effect.withSpan("devstack.plugin.sui.localRpc.boot", { attributes: {
48
- [SpanAttr.plugin]: "sui",
49
- [SuiSpans.mode]: "local-rpc"
50
- } }));
42
+ });
51
43
  //#endregion
52
44
  export { bootLocalRpcMode };
53
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"external.mjs","names":[],"sources":["../../../../src/plugins/sui/mode/external.ts"],"sourcesContent":["// Sui plugin — local caller-owned RPC mode.\n//\n// Caller already has a Sui process running and supplies the RPC URL\n// (optionally faucet and GraphQL). Used in CI, custom-runtime\n// experiments, and \"wrap my own sui localnet\" scenarios.\n//\n// What's hard:\n// - The entire container + sidecar + build-container pipeline\n// must be skipped cleanly. No image build, no docker network,\n// no SuiBuildImage wired in.\n// - Downstream consumers must still get the same endpoint shape,\n// the same chain id, and a working `waitForTransactionsReady`\n// when a faucet URL is supplied.\n// - The chain-id fetch IS the only readiness sentinel; must have\n// a bounded timeout.\n//\n// Local-RPC mode contributes a `ChainProbe` and a `Codegenable` but\n// does NOT contribute a `Snapshotable`-managed container or a\n// `Routable` entrypoint (the caller's own router fronts the RPC).\n//\n// Boot sequence:\n//\n// 1. Construct an `@mysten/sui/grpc` `SuiGrpcClient` against the\n// caller-supplied `rpcUrl`. `network: 'localnet'` is the\n// semantically-correct discriminator — external IS a local-mode\n// sub-shape, not a public-net target.\n// 2. Fetch the chain identifier with a bounded timeout — the only\n// readiness sentinel for this mode.\n// 3. Build `waitForTransactionsReady`:\n// - If `faucetUrl` is supplied, wire the real HTTP probe\n// (same code path as local mode).\n// - Otherwise, the gate is a trivially-succeeding no-op\n// (callers that need funds must arrange them externally).\n// 4. Assemble the resolved `SuiClient` and return it alongside the\n// `ResolvedSuiNetwork` projection (consumed by the codegen\n// contribution at the barrel).\n\nimport { Duration, Effect, type Scope } from 'effect';\n\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\n\nimport { SpanAttr } from '../../../substrate/runtime/observability/spans.ts';\nimport { suiPluginError, type SuiConfigError, type SuiPluginError } from '../errors.ts';\nimport { formatUnknownError } from '../../../substrate/runtime/format-unknown-error.ts';\nimport type { ResolvedSuiNetwork } from '../network-resolver.ts';\nimport { SuiSpans } from '../spans.ts';\nimport type { SuiClient } from './shared.ts';\nimport {\n\tassembleSuiClient,\n\tbuildWaitForTransactionsReady,\n\tfetchChainId,\n\tmakeResolvedNetwork,\n\tnoopWaitForTransactionsReady,\n} from './shared-boot.ts';\nimport type { SuiLocalRpcOptions } from './spec.ts';\n\n/** Default chain-id fetch timeout for caller-owned local RPCs. The wire\n * latency is the dominant cost; 30s is the documented ceiling. */\nexport const DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT = Duration.seconds(30);\n\n/** Resolved local-RPC-mode boot artifacts. */\nexport interface LocalRpcModeBootResult {\n\treadonly resolved: ResolvedSuiNetwork;\n\treadonly client: SuiClient;\n}\n\n/** Build the local-RPC-mode boot Effect. No container, no sidecar,\n * no build image. Just probe chain id + wire `waitForTransactionsReady`\n * conditional on `faucetUrl`. */\nexport const bootLocalRpcMode = (\n\topts: SuiLocalRpcOptions,\n): Effect.Effect<LocalRpcModeBootResult, SuiPluginError | SuiConfigError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\t// ----- 1. Construct the grpc client ----------------------------------\n\t\t// `network: 'localnet'` is semantically correct: external is a\n\t\t// substrate-level `'local'` sub-mode (caller's own localnet); the\n\t\t// SDK uses `network` for MVR / wallet-standard hints which the\n\t\t// caller-provided RPC won't honor anyway.\n\t\tconst sdkClient = yield* Effect.try({\n\t\t\ttry: () =>\n\t\t\t\tnew SuiGrpcClient({\n\t\t\t\t\tbaseUrl: opts.rpcUrl,\n\t\t\t\t\tnetwork: 'localnet',\n\t\t\t\t}),\n\t\t\tcatch: (cause): SuiPluginError =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'chain-id-fetch',\n\t\t\t\t\t`sui local-rpc mode: SuiGrpcClient construction failed for rpcUrl=${opts.rpcUrl}: ${formatUnknownError(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t});\n\n\t\t// ----- 2. Resolve chain id -------------------------------------------\n\t\tconst chain =\n\t\t\topts.chain ??\n\t\t\t(yield* fetchChainId(sdkClient, {\n\t\t\t\ttimeout: opts.readyTimeout ?? DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT,\n\t\t\t\tspan: 'devstack.plugin.sui.localRpc.fetchChainId',\n\t\t\t}));\n\n\t\t// ----- 3. Build waitForTransactionsReady -----------------------------\n\t\t// Faucet-bearing: real HTTP probe. Faucet-less: no-op (caller\n\t\t// must arrange funding out-of-band).\n\t\tconst waitForTransactionsReady =\n\t\t\topts.faucetUrl !== undefined\n\t\t\t\t? yield* buildWaitForTransactionsReady(opts.faucetUrl)\n\t\t\t\t: noopWaitForTransactionsReady;\n\n\t\t// ----- 4. Assemble + return ------------------------------------------\n\t\tconst { client } = yield* assembleSuiClient({\n\t\t\tsdkClient,\n\t\t\tchain,\n\t\t\trpcUrl: opts.rpcUrl,\n\t\t\t...(opts.faucetUrl !== undefined ? { faucetUrl: opts.faucetUrl } : {}),\n\t\t\t...(opts.graphqlUrl !== undefined ? { graphqlUrl: opts.graphqlUrl } : {}),\n\t\t\twaitForTransactionsReady,\n\t\t});\n\t\tconst resolved = makeResolvedNetwork({\n\t\t\tmode: 'local-rpc',\n\t\t\tchain,\n\t\t\trpc: opts.rpcUrl,\n\t\t\tsource: 'config',\n\t\t\t...(opts.faucetUrl !== undefined ? { faucet: opts.faucetUrl } : {}),\n\t\t\t...(opts.graphqlUrl !== undefined ? { graphql: opts.graphqlUrl } : {}),\n\t\t});\n\n\t\treturn { resolved, client };\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.sui.localRpc.boot', {\n\t\t\tattributes: { [SpanAttr.plugin]: 'sui', [SuiSpans.mode]: 'local-rpc' },\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;AA0DA,MAAa,oCAAoC,SAAS,QAAQ,GAAG;;;;AAWrE,MAAa,oBACZ,SAEA,OAAO,IAAI,aAAa;CAMvB,MAAM,YAAY,OAAO,OAAO,IAAI;EACnC,WACC,IAAI,cAAc;GACjB,SAAS,KAAK;GACd,SAAS;GACT,CAAC;EACH,QAAQ,UACP,eACC,kBACA,oEAAoE,KAAK,OAAO,IAAI,mBAAmB,MAAM,IAC7G,MACA;EACF,CAAC;CAGF,MAAM,QACL,KAAK,UACJ,OAAO,aAAa,WAAW;EAC/B,SAAS,KAAK,gBAAgB;EAC9B,MAAM;EACN,CAAC;CAKH,MAAM,2BACL,KAAK,cAAc,KAAA,IAChB,OAAO,8BAA8B,KAAK,UAAU,GACpD;CAGJ,MAAM,EAAE,WAAW,OAAO,kBAAkB;EAC3C;EACA;EACA,QAAQ,KAAK;EACb,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,WAAW,KAAK,WAAW,GAAG,EAAE;EACrE,GAAI,KAAK,eAAe,KAAA,IAAY,EAAE,YAAY,KAAK,YAAY,GAAG,EAAE;EACxE;EACA,CAAC;AAUF,QAAO;EAAE,UATQ,oBAAoB;GACpC,MAAM;GACN;GACA,KAAK,KAAK;GACV,QAAQ;GACR,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,QAAQ,KAAK,WAAW,GAAG,EAAE;GAClE,GAAI,KAAK,eAAe,KAAA,IAAY,EAAE,SAAS,KAAK,YAAY,GAAG,EAAE;GACrE,CAEgB;EAAE;EAAQ;EAC1B,CAAC,KACF,OAAO,SAAS,qCAAqC,EACpD,YAAY;EAAG,SAAS,SAAS;EAAQ,SAAS,OAAO;CAAa,EACtE,CAAC,CACF"}
1
+ {"version":3,"file":"external.mjs","names":[],"sources":["../../../../src/plugins/sui/mode/external.ts"],"sourcesContent":["// Sui plugin — local caller-owned RPC mode.\n//\n// Caller already has a Sui process running and supplies the RPC URL\n// (optionally faucet and GraphQL). Used in CI, custom-runtime\n// experiments, and \"wrap my own sui localnet\" scenarios.\n//\n// What's hard:\n// - The entire container + sidecar + build-container pipeline\n// must be skipped cleanly. No image build, no docker network,\n// no SuiBuildImage wired in.\n// - Downstream consumers must still get the same endpoint shape,\n// the same chain id, and a working `waitForTransactionsReady`\n// when a faucet URL is supplied.\n// - The chain-id fetch IS the only readiness sentinel; must have\n// a bounded timeout.\n//\n// Local-RPC mode contributes a `ChainProbe` and a `Codegenable` but\n// does NOT contribute a `Snapshotable`-managed container or a\n// `Routable` entrypoint (the caller's own router fronts the RPC).\n//\n// Boot sequence:\n//\n// 1. Construct an `@mysten/sui/grpc` `SuiGrpcClient` against the\n// caller-supplied `rpcUrl`. `network: 'localnet'` is the\n// semantically-correct discriminator — external IS a local-mode\n// sub-shape, not a public-net target.\n// 2. Fetch the chain identifier with a bounded timeout — the only\n// readiness sentinel for this mode.\n// 3. Build `waitForTransactionsReady`:\n// - If `faucetUrl` is supplied, wire the real HTTP probe\n// (same code path as local mode).\n// - Otherwise, the gate is a trivially-succeeding no-op\n// (callers that need funds must arrange them externally).\n// 4. Assemble the resolved `SuiClient` and return it alongside the\n// `ResolvedSuiNetwork` projection (consumed by the codegen\n// contribution at the barrel).\n\nimport { Duration, Effect, type Scope } from 'effect';\n\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\n\nimport { suiPluginError, type SuiConfigError, type SuiPluginError } from '../errors.ts';\nimport { formatUnknownError } from '../../../substrate/runtime/format-unknown-error.ts';\nimport type { ResolvedSuiNetwork } from '../network-resolver.ts';\nimport type { SuiClient } from './shared.ts';\nimport {\n\tassembleSuiClient,\n\tbuildWaitForTransactionsReady,\n\tfetchChainId,\n\tmakeResolvedNetwork,\n\tnoopWaitForTransactionsReady,\n} from './shared-boot.ts';\nimport type { SuiLocalRpcOptions } from './spec.ts';\n\n/** Default chain-id fetch timeout for caller-owned local RPCs. The wire\n * latency is the dominant cost; 30s is the documented ceiling. */\nexport const DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT = Duration.seconds(30);\n\n/** Resolved local-RPC-mode boot artifacts. */\nexport interface LocalRpcModeBootResult {\n\treadonly resolved: ResolvedSuiNetwork;\n\treadonly client: SuiClient;\n}\n\n/** Build the local-RPC-mode boot Effect. No container, no sidecar,\n * no build image. Just probe chain id + wire `waitForTransactionsReady`\n * conditional on `faucetUrl`. */\nexport const bootLocalRpcMode = (\n\topts: SuiLocalRpcOptions,\n): Effect.Effect<LocalRpcModeBootResult, SuiPluginError | SuiConfigError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\t// ----- 1. Construct the grpc client ----------------------------------\n\t\t// `network: 'localnet'` is semantically correct: external is a\n\t\t// substrate-level `'local'` sub-mode (caller's own localnet); the\n\t\t// SDK uses `network` for MVR / wallet-standard hints which the\n\t\t// caller-provided RPC won't honor anyway.\n\t\tconst sdkClient = yield* Effect.try({\n\t\t\ttry: () =>\n\t\t\t\tnew SuiGrpcClient({\n\t\t\t\t\tbaseUrl: opts.rpcUrl,\n\t\t\t\t\tnetwork: 'localnet',\n\t\t\t\t}),\n\t\t\tcatch: (cause): SuiPluginError =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'chain-id-fetch',\n\t\t\t\t\t`sui local-rpc mode: SuiGrpcClient construction failed for rpcUrl=${opts.rpcUrl}: ${formatUnknownError(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t});\n\n\t\t// ----- 2. Resolve chain id -------------------------------------------\n\t\tconst chainId =\n\t\t\topts.chainId ??\n\t\t\t(yield* fetchChainId(sdkClient, {\n\t\t\t\ttimeout: opts.readyTimeout ?? DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT,\n\t\t\t}));\n\n\t\t// ----- 3. Build waitForTransactionsReady -----------------------------\n\t\t// Faucet-bearing: real HTTP probe. Faucet-less: no-op (caller\n\t\t// must arrange funding out-of-band).\n\t\tconst waitForTransactionsReady =\n\t\t\topts.faucetUrl !== undefined\n\t\t\t\t? yield* buildWaitForTransactionsReady(opts.faucetUrl)\n\t\t\t\t: noopWaitForTransactionsReady;\n\n\t\t// ----- 4. Assemble + return ------------------------------------------\n\t\tconst { client } = yield* assembleSuiClient({\n\t\t\tsdkClient,\n\t\t\tchainId,\n\t\t\trpcUrl: opts.rpcUrl,\n\t\t\t...(opts.faucetUrl !== undefined ? { faucetUrl: opts.faucetUrl } : {}),\n\t\t\t...(opts.graphqlUrl !== undefined ? { graphqlUrl: opts.graphqlUrl } : {}),\n\t\t\twaitForTransactionsReady,\n\t\t});\n\t\tconst resolved = makeResolvedNetwork({\n\t\t\tmode: 'local-rpc',\n\t\t\tchainId,\n\t\t\trpc: opts.rpcUrl,\n\t\t\tsource: 'config',\n\t\t\t...(opts.faucetUrl !== undefined ? { faucet: opts.faucetUrl } : {}),\n\t\t\t...(opts.graphqlUrl !== undefined ? { graphql: opts.graphqlUrl } : {}),\n\t\t});\n\n\t\treturn { resolved, client };\n\t});\n"],"mappings":";;;;;;;;AAwDA,MAAa,oCAAoC,SAAS,QAAQ,EAAE;;;;AAWpE,MAAa,oBACZ,SAEA,OAAO,IAAI,aAAa;CAMvB,MAAM,YAAY,OAAO,OAAO,IAAI;EACnC,WACC,IAAI,cAAc;GACjB,SAAS,KAAK;GACd,SAAS;EACV,CAAC;EACF,QAAQ,UACP,eACC,kBACA,oEAAoE,KAAK,OAAO,IAAI,mBAAmB,KAAK,KAC5G,KACD;CACF,CAAC;CAGD,MAAM,UACL,KAAK,YACJ,OAAO,aAAa,WAAW,EAC/B,SAAS,KAAK,gBAAgB,kCAC/B,CAAC;CAKF,MAAM,2BACL,KAAK,cAAc,KAAA,IAChB,OAAO,8BAA8B,KAAK,SAAS,IACnD;CAGJ,MAAM,EAAE,WAAW,OAAO,kBAAkB;EAC3C;EACA;EACA,QAAQ,KAAK;EACb,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;EACpE,GAAI,KAAK,eAAe,KAAA,IAAY,EAAE,YAAY,KAAK,WAAW,IAAI,CAAC;EACvE;CACD,CAAC;CAUD,OAAO;EAAE,UATQ,oBAAoB;GACpC,MAAM;GACN;GACA,KAAK,KAAK;GACV,QAAQ;GACR,GAAI,KAAK,cAAc,KAAA,IAAY,EAAE,QAAQ,KAAK,UAAU,IAAI,CAAC;GACjE,GAAI,KAAK,eAAe,KAAA,IAAY,EAAE,SAAS,KAAK,WAAW,IAAI,CAAC;EACrE,CAEgB;EAAG;CAAO;AAC3B,CAAC"}
@@ -1,32 +1,35 @@
1
- import { SpanAttr } from "../../../substrate/runtime/observability/spans.mjs";
2
- import { ProbeTimeoutError, waitForProbe } from "../../../substrate/runtime/probes.mjs";
3
1
  import { setCurrentPluginPhase } from "../../../substrate/runtime/current-plugin.mjs";
4
- import { DEFAULT_SUI_CLI_VERSION } from "../../../substrate/runtime/sui-move-build/index.mjs";
2
+ import { ProbeTimeoutError, waitForProbe } from "../../../substrate/runtime/probes.mjs";
3
+ import { DEFAULT_SUI_CLI_VERSION } from "../move/index.mjs";
5
4
  import { renderUrl, routedHostname } from "../../../substrate/runtime/routed-url.mjs";
6
5
  import { SUI_RPC_ENTRYPOINT_PORT } from "../routable.mjs";
7
6
  import { ensureManagedContainer } from "../../../substrate/runtime/managed-container.mjs";
8
7
  import { suiPluginError } from "../errors.mjs";
9
8
  import { formatUnknownError } from "../../../substrate/runtime/format-unknown-error.mjs";
10
- import { SuiSpans } from "../spans.mjs";
9
+ import { SuiLogAttr } from "../log-attrs.mjs";
11
10
  import { toDockerHostGatewayUrl } from "./shared.mjs";
12
11
  import { assembleSuiClient, fetchChainId, makeResolvedNetwork, noopWaitForTransactionsReady } from "./shared-boot.mjs";
13
- import { extractExecuteDigest } from "../../../substrate/runtime/sui-execute/index.mjs";
12
+ import { extractExecuteDigest } from "../exec/index.mjs";
14
13
  import { resolveAutoTickIntervalMs, runAutoTickClock } from "../auto-tick.mjs";
15
14
  import { acquireForkDataDirHolder, wrapWithForkGuard } from "../fork-orchestration.mjs";
16
15
  import { FORK_IMPERSONATION_GAS_BUDGET, verifyForkImpersonationSender } from "../fork-transaction.mjs";
17
16
  import { Duration, Effect } from "effect";
18
- import { createHash } from "node:crypto";
19
17
  import { join, resolve } from "node:path";
18
+ import { createHash } from "node:crypto";
20
19
  import { mkdir } from "node:fs/promises";
21
- import { SuiGrpcClient } from "@mysten/sui/grpc";
22
20
  import { fileURLToPath } from "node:url";
21
+ import { SuiGrpcClient } from "@mysten/sui/grpc";
23
22
  import { normalizeSuiAddress, normalizeSuiObjectId } from "@mysten/sui/utils";
24
23
  //#region src/plugins/sui/mode/fork.ts
25
24
  /** Default ready-probe timeout for fork-mode cold start. */
26
25
  const DEFAULT_FORK_READY_TIMEOUT = Duration.seconds(180);
27
26
  /** Default Sui repository revision used by the bundled `sui-fork` image build. */
28
27
  const DEFAULT_SUI_FORK_REV = "62ee6ada958cd61b3c8a4466dd33c9aba3cdff8a";
29
- /** Env var that overrides {@link DEFAULT_FORK_IMAGE_REF} for a single run. */
28
+ /** Env var that supplies a prebuilt `sui-fork` image to pull for a single
29
+ * run (e.g. `ghcr.io/mysten/sui-fork:<rev>`). When set and the runtime can
30
+ * pull, `resolveForkImage` tries it first and falls back to a source build,
31
+ * sparing users the ~10-minute cold compile. No prebuilt default ships
32
+ * today, so absent this env var the fork always builds from source. */
30
33
  const FORK_IMAGE_ENV_VAR = "DEVSTACK_SUI_FORK_IMAGE";
31
34
  const prebuiltForkImageRef = () => {
32
35
  const fromEnv = process.env[FORK_IMAGE_ENV_VAR]?.trim();
@@ -76,7 +79,7 @@ const withForkFaucetSeed = (opts) => {
76
79
  return {
77
80
  ...opts,
78
81
  seed: {
79
- ...opts.seed ?? {},
82
+ ...opts.seed,
80
83
  addresses: [...opts.seed?.addresses ?? [], resolved.whale]
81
84
  }
82
85
  };
@@ -110,12 +113,12 @@ const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(
110
113
  baseUrl: directRpcUrl,
111
114
  network: opts.upstream
112
115
  });
113
- const status = yield* waitForForkReady(sdkClient, opts.readyTimeout ?? DEFAULT_FORK_READY_TIMEOUT).pipe(Effect.annotateLogs({ [SuiSpans.container]: handle.name }));
114
- const chain = yield* fetchChainId(sdkClient, { span: "devstack.plugin.sui.fork.fetchChainId" });
116
+ const status = yield* waitForForkReady(sdkClient, opts.readyTimeout ?? DEFAULT_FORK_READY_TIMEOUT).pipe(Effect.annotateLogs({ [SuiLogAttr.container]: handle.name }));
117
+ const chainId = yield* fetchChainId(sdkClient);
115
118
  const fork = makeForkAdminSurface(sdkClient);
116
119
  const assembled = yield* assembleSuiClient({
117
120
  sdkClient,
118
- chain,
121
+ chainId,
119
122
  rpcUrl,
120
123
  waitForTransactionsReady: noopWaitForTransactionsReady,
121
124
  buildImage: image,
@@ -134,7 +137,7 @@ const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(
134
137
  return {
135
138
  resolved: makeResolvedNetwork({
136
139
  mode: "fork",
137
- chain,
140
+ chainId,
138
141
  rpc: rpcUrl,
139
142
  source: "default",
140
143
  checkpoint: status.forkedAtCheckpoint,
@@ -143,7 +146,7 @@ const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(
143
146
  client,
144
147
  autoTickIntervalMs
145
148
  };
146
- }).pipe(Effect.withSpan("devstack.plugin.sui.fork.boot", { attributes: { [SpanAttr.plugin]: "sui" } }));
149
+ });
147
150
  const suiForkImageBuildContext = (rev = DEFAULT_SUI_FORK_REV) => ({
148
151
  contextPath: fileURLToPath(new URL("../../../../images/", import.meta.url)),
149
152
  dockerfile: "sui-fork/Dockerfile",
@@ -195,7 +198,7 @@ const resolveForkImage = (runtime, identity, opts) => Effect.gen(function* () {
195
198
  ...suiForkImageBuildContext(rev),
196
199
  owner
197
200
  });
198
- }).pipe(Effect.withSpan("devstack.plugin.sui.fork.resolveImage"));
201
+ });
199
202
  const ensureForkContainer = (params) => Effect.gen(function* () {
200
203
  const reusable = params.opts.ports === void 0 ? yield* findReusableForkPort(params.runtime, params.labels, params.containerName) : void 0;
201
204
  const ports = reusable === void 0 ? [yield* allocateForkRpcPort(params.portBroker, params.opts.ports)] : [reusable];
@@ -300,7 +303,7 @@ const waitForForkReady = (sdkClient, readyTimeout) => Effect.gen(function* () {
300
303
  probe: () => readForkStatus(sdkClient).pipe(Effect.as(true))
301
304
  }).pipe(Effect.mapError((cause) => cause instanceof ProbeTimeoutError ? suiPluginError("fork-status-probe", `sui fork mode: ForkingService.GetStatus did not become ready within ${readyTimeoutMs}ms. Inspect the sui-fork container logs (\`docker logs\`); if the image is still building or the upstream checkpoint is large, raise the \`readyTimeout\` option.`, cause.lastError ?? cause.lastNotReady ?? cause) : suiPluginError("fork-status-probe", `sui fork mode: ForkingService.GetStatus probe failed: ${formatUnknownError(cause)}`, cause)));
302
305
  return yield* readForkStatus(sdkClient);
303
- }).pipe(Effect.withSpan("devstack.plugin.sui.fork.waitForReady"));
306
+ });
304
307
  const makeForkAdminSurface = (sdkClient) => ({
305
308
  status: readForkStatus(sdkClient).pipe(Effect.map(({ checkpoint, clock }) => ({
306
309
  checkpoint,
@@ -1 +1 @@
1
- {"version":3,"file":"fork.mjs","names":["sharedFetchChainId"],"sources":["../../../../src/plugins/sui/mode/fork.ts"],"sourcesContent":["// Sui plugin — fork mode.\n\nimport { createHash } from 'node:crypto';\nimport { mkdir } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { Duration, Effect, type Scope } from 'effect';\n\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\nimport { normalizeSuiAddress, normalizeSuiObjectId } from '@mysten/sui/utils';\n\nimport type {\n\tContainerHandle,\n\tContainerPortPublish,\n\tContainerRuntime,\n\tContainerRuntimeError,\n\tImageRef,\n\tPortBindingReconciliation,\n} from '../../../contracts/container-runtime.ts';\nimport type { ContainerLabelTuple } from '../../../contracts/snapshotable.ts';\nimport type { Identity } from '../../../substrate/identity.ts';\nimport { ensureManagedContainer } from '../../../substrate/runtime/managed-container.ts';\nimport { SpanAttr } from '../../../substrate/runtime/observability/spans.ts';\nimport type { StackPaths } from '../../../substrate/runtime/paths.ts';\nimport type { AllocatedPort, PortBroker } from '../../../substrate/runtime/port-broker/index.ts';\nimport { ProbeTimeoutError, waitForProbe } from '../../../substrate/runtime/probes.ts';\nimport { formatUnknownError } from '../../../substrate/runtime/format-unknown-error.ts';\nimport { setCurrentPluginPhase } from '../../../substrate/runtime/current-plugin.ts';\nimport { renderUrl, routedHostname } from '../../../substrate/runtime/routed-url.ts';\nimport { extractExecuteDigest } from '../../../substrate/runtime/sui-execute/index.ts';\nimport { resolveAutoTickIntervalMs, runAutoTickClock } from '../auto-tick.ts';\nimport { suiPluginError, type SuiConfigError, type SuiPluginError } from '../errors.ts';\nimport type { ResolvedSuiNetwork } from '../network-resolver.ts';\nimport { SUI_RPC_ENDPOINT_NAME, SUI_RPC_ENTRYPOINT_PORT } from '../routable.ts';\nimport { SuiSpans } from '../spans.ts';\nimport { acquireForkDataDirHolder, wrapWithForkGuard } from '../fork-orchestration.ts';\nimport {\n\tFORK_IMPERSONATION_GAS_BUDGET,\n\tverifyForkImpersonationSender,\n} from '../fork-transaction.ts';\nimport { DEFAULT_SUI_CLI_VERSION } from '../../../substrate/runtime/sui-move-build/index.ts';\nimport type { ForkAdminSurface, SuiClient } from './shared.ts';\nimport { toDockerHostGatewayUrl } from './shared.ts';\nimport {\n\tassembleSuiClient,\n\tfetchChainId as sharedFetchChainId,\n\tmakeResolvedNetwork,\n\tnoopWaitForTransactionsReady,\n} from './shared-boot.ts';\nimport type { SuiForkOptions } from './spec.ts';\n\n/** Default ready-probe timeout for fork-mode cold start. */\nexport const DEFAULT_FORK_READY_TIMEOUT = Duration.seconds(180);\n\n/** Default Sui repository revision used by the bundled `sui-fork` image build. */\nexport const DEFAULT_SUI_FORK_REV = '62ee6ada958cd61b3c8a4466dd33c9aba3cdff8a';\n\n/** Published prebuilt `sui-fork` image to pull instead of compiling from\n * source. `undefined` until CI publishes one (e.g. `ghcr.io/mysten/sui-fork:<rev>`);\n * overridable per-run via `DEVSTACK_SUI_FORK_IMAGE`. When set and the\n * runtime can pull, `resolveForkImage` tries it first and falls back to a\n * source build, sparing users the ~10-minute cold compile. */\nexport const DEFAULT_FORK_IMAGE_REF: string | undefined = undefined;\n\n/** Env var that overrides {@link DEFAULT_FORK_IMAGE_REF} for a single run. */\nexport const FORK_IMAGE_ENV_VAR = 'DEVSTACK_SUI_FORK_IMAGE';\n\nconst prebuiltForkImageRef = (): string | undefined => {\n\tconst fromEnv = process.env[FORK_IMAGE_ENV_VAR]?.trim();\n\treturn fromEnv !== undefined && fromEnv.length > 0 ? fromEnv : DEFAULT_FORK_IMAGE_REF;\n};\n\n/** Map upstream literal to the canonical \"live\" chain id known by wallet-standard / MVR. */\nexport const FORK_UPSTREAM_TO_KNOWN_NETWORK = {\n\tmainnet: 'sui:mainnet',\n\ttestnet: 'sui:testnet',\n\tdevnet: 'sui:devnet',\n} as const;\n\nexport const DEFAULT_FORK_HOST_RPC_PORT = 51002;\nexport const FORK_VALIDATOR_STOP_GRACE_SECONDS = 30;\n\n/** Default impersonation \"whale\" per upstream — a large-reserve address\n * known to hold a big single SUI coin in the upstream's state, used as\n * the fork faucet funding source when `faucet.whale` is omitted. `null`\n * means no default is known (the faucet then requires an explicit\n * `faucet.whale`). Validated at boot via `selectSufficientForkCoin`. */\nexport const FORK_DEFAULT_WHALE: Record<'mainnet' | 'testnet' | 'devnet', string | null> = {\n\t// Long-lived validator addresses each holding a large single SUI coin\n\t// (validated 2026-05-28). `selectSufficientForkCoin` re-queries the address\n\t// at the fork checkpoint at runtime, so a rotated coin self-heals; a\n\t// drained/retired address degrades gracefully — boot validation warns and\n\t// disables the default faucet. Override any of these with `faucet.whale`.\n\tmainnet: '0xbc7e7537564bd939b62e5b24477ac00ba8cef33ccec72d63090a080a1253b725', // ~273k SUI\n\ttestnet: '0xc397477d8b445e6295bc34e593b9a95d5d233cec1a8fe3740d0ab86012a460f6', // ~127k SUI\n\t// devnet resets periodically; this genesis validator may go stale after a\n\t// reset, at which point the default faucet disables itself until a\n\t// `faucet.whale` is supplied.\n\tdevnet: '0x4296747d0bd91c41b668702bdca0bf769a0e32db66982d986101e7975db55cbe', // ~30M SUI\n};\n\n/** The common per-account fund the fork faucet must be able to cover. Mirrors\n * the account plugin's `DEFAULT_EPHEMERAL_FUND_MIST` (1 SUI) — kept local\n * because account → sui already, so importing it here would cycle; a test\n * pins the two together. */\nexport const FORK_FAUCET_DEFAULT_FUND_MIST = 1_000_000_000n;\n\n/** Floor a single whale SUI coin must clear at boot to enable the fork faucet:\n * a default ephemeral fund (1 SUI) plus the impersonation gas budget. Set to\n * match the per-request requirement for the default fund so a whale that\n * passes boot can actually satisfy the first auto-fund. */\nexport const FORK_FAUCET_WHALE_MIN_COIN_MIST =\n\tFORK_FAUCET_DEFAULT_FUND_MIST + FORK_IMPERSONATION_GAS_BUDGET;\n\n/** Default per-request funding cap (MIST) — 1000 SUI. */\nexport const DEFAULT_FORK_FAUCET_PER_REQUEST_CAP_MIST = 1_000_000_000_000n;\n\n/** Resolved fork faucet funding source. */\nexport interface ResolvedForkWhale {\n\treadonly whale: string;\n\treadonly perRequestCapMist: bigint;\n\t/** `true` when the user set `faucet.whale` explicitly — a validation\n\t * failure then hard-fails boot; a default whale only warns + disables\n\t * the faucet so the fork still boots. */\n\treadonly explicit: boolean;\n}\n\n/** Resolve the fork faucet whale from options + per-upstream defaults,\n * or `null` when the faucet is disabled / no whale is known. */\nexport const resolveForkWhale = (opts: SuiForkOptions): ResolvedForkWhale | null => {\n\tif (opts.faucet?.enabled === false) {\n\t\treturn null;\n\t}\n\tconst perRequestCapMist =\n\t\topts.faucet?.perRequestCapMist ?? DEFAULT_FORK_FAUCET_PER_REQUEST_CAP_MIST;\n\tconst explicit = opts.faucet?.whale?.trim();\n\tif (explicit !== undefined && explicit.length > 0) {\n\t\treturn { whale: normalizeSuiAddress(explicit), perRequestCapMist, explicit: true };\n\t}\n\tconst fallback = FORK_DEFAULT_WHALE[opts.upstream];\n\treturn fallback === null\n\t\t? null\n\t\t: { whale: normalizeSuiAddress(fallback), perRequestCapMist, explicit: false };\n};\n\n/** Inject the resolved faucet whale into the fork seed so its coins exist\n * in fork state. MUST run before the data-dir key / container config\n * hash are computed (both fold the seed) so enabling the faucet doesn't\n * silently reuse a whale-less fork data dir. */\nexport const withForkFaucetSeed = (opts: SuiForkOptions): SuiForkOptions => {\n\tconst resolved = resolveForkWhale(opts);\n\tif (resolved === null) {\n\t\treturn opts;\n\t}\n\treturn {\n\t\t...opts,\n\t\tseed: {\n\t\t\t...(opts.seed ?? {}),\n\t\t\taddresses: [...(opts.seed?.addresses ?? []), resolved.whale],\n\t\t},\n\t};\n};\n\nconst DOCKER_PUBLISH_HOST = '0.0.0.0' as const;\nconst CONTAINER_RPC_PORT = SUI_RPC_ENTRYPOINT_PORT;\nconst FORK_CONTAINER_DATA_DIR = '/var/lib/sui-fork';\nconst PROBE_ATTEMPT_TIMEOUT_MS = 3_000;\n\n/** Resolved fork-mode boot artifacts. */\nexport interface ForkModeBootResult {\n\treadonly resolved: ResolvedSuiNetwork;\n\treadonly client: SuiClient;\n\treadonly autoTickIntervalMs: number | undefined;\n}\n\nexport const bootForkMode = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\tportBroker: PortBroker,\n\tpaths: StackPaths,\n\topts: SuiForkOptions,\n): Effect.Effect<ForkModeBootResult, SuiPluginError | SuiConfigError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst autoTickIntervalMs = yield* resolveAutoTickIntervalMs(opts.autoTick);\n\t\t// Fold the faucet whale into the seed BEFORE the data-dir key /\n\t\t// container config hash are derived, so enabling the faucet keys a\n\t\t// distinct fork state rather than reusing a whale-less data dir.\n\t\tconst seededOpts = withForkFaucetSeed(opts);\n\t\tconst image = yield* resolveForkImage(runtime, identity, opts);\n\t\tconst dataDir = yield* ensureForkDataDir(paths, seededOpts);\n\n\t\tconst labels: ContainerLabelTuple = {\n\t\t\tapp: identity.app,\n\t\t\tstack: identity.stack,\n\t\t\tplugin: 'sui',\n\t\t\trole: 'fork-validator',\n\t\t};\n\t\tconst containerName = `devstack-${identity.app}-${identity.stack}-sui-fork`;\n\t\tconst { handle, ports } = yield* ensureForkContainer({\n\t\t\truntime,\n\t\t\tportBroker,\n\t\t\timage,\n\t\t\tlabels,\n\t\t\tcontainerName,\n\t\t\tdataDir,\n\t\t\topts: seededOpts,\n\t\t});\n\n\t\tconst published = pickPublishedPort(ports, handle.ports);\n\t\tconst directRpcUrl = `http://127.0.0.1:${published.hostPort}`;\n\t\tconst rpcUrl = yield* routedSuiRpcUrl(identity);\n\t\tconst sdkClient = new SuiGrpcClient({ baseUrl: directRpcUrl, network: opts.upstream });\n\t\tconst readyTimeout = opts.readyTimeout ?? DEFAULT_FORK_READY_TIMEOUT;\n\n\t\tconst status = yield* waitForForkReady(sdkClient, readyTimeout).pipe(\n\t\t\tEffect.annotateLogs({ [SuiSpans.container]: handle.name }),\n\t\t);\n\t\tconst chain = yield* sharedFetchChainId(sdkClient, {\n\t\t\tspan: 'devstack.plugin.sui.fork.fetchChainId',\n\t\t});\n\n\t\tconst fork = makeForkAdminSurface(sdkClient);\n\t\tconst assembled = yield* assembleSuiClient({\n\t\t\tsdkClient,\n\t\t\tchain,\n\t\t\trpcUrl,\n\t\t\twaitForTransactionsReady: noopWaitForTransactionsReady,\n\t\t\tbuildImage: image,\n\t\t\thostGateway: {\n\t\t\t\trpcUrl: toDockerHostGatewayUrl(directRpcUrl),\n\t\t\t\tfaucetUrl: null,\n\t\t\t\tgraphqlUrl: null,\n\t\t\t},\n\t\t});\n\t\tconst client: SuiClient = {\n\t\t\t...assembled.client,\n\t\t\tsdk: wrapWithForkGuard(assembled.sdkShim),\n\t\t\tfork,\n\t\t};\n\n\t\tif (autoTickIntervalMs !== undefined) {\n\t\t\tyield* runAutoTickClock(fork, autoTickIntervalMs);\n\t\t}\n\n\t\treturn {\n\t\t\tresolved: makeResolvedNetwork({\n\t\t\t\tmode: 'fork',\n\t\t\t\tchain,\n\t\t\t\trpc: rpcUrl,\n\t\t\t\tsource: 'default',\n\t\t\t\tcheckpoint: status.forkedAtCheckpoint,\n\t\t\t\tforkUpstream: opts.upstream,\n\t\t\t}),\n\t\t\tclient,\n\t\t\tautoTickIntervalMs,\n\t\t};\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.sui.fork.boot', { attributes: { [SpanAttr.plugin]: 'sui' } }),\n\t);\n\nexport const suiForkImageBuildContext = (rev = DEFAULT_SUI_FORK_REV) => ({\n\t// `fileURLToPath` normalises the URL → host-path conversion across\n\t// platforms (Windows `file:///C:/...` → `C:\\...`). Reading\n\t// `.pathname` directly leaves the leading `/` on Windows drive paths.\n\tcontextPath: fileURLToPath(new URL('../../../../images/', import.meta.url)),\n\tdockerfile: 'sui-fork/Dockerfile',\n\tbuildArgs: { SUI_FORK_REV: rev, SUI_CLI_VERSION: DEFAULT_SUI_CLI_VERSION },\n});\n\n/** Pull a prebuilt fork image, narrating progress on the supervisor row.\n * Fails with a `SuiPluginError` if the runtime can't pull or the pull errors. */\nconst pullForkImage = (\n\truntime: ContainerRuntime,\n\tpullRef: string,\n): Effect.Effect<ImageRef, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tif (runtime.pullImage === undefined) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'image-build',\n\t\t\t\t\t`sui fork mode cannot pull image '${pullRef}' because the configured container runtime does not expose image pulls.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tyield* setCurrentPluginPhase(`pulling sui-fork image ${pullRef}…`);\n\t\treturn yield* runtime.pullImage(pullRef).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'image-build',\n\t\t\t\t\t`sui fork mode failed to pull image '${pullRef}': ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t\tEffect.ensuring(setCurrentPluginPhase(null)),\n\t\t);\n\t});\n\n/** Build the bundled `sui-fork` image from source, narrating the cold\n * compile so the row doesn't look hung for ~10 minutes on first run. */\nconst buildForkImage = (\n\truntime: ContainerRuntime,\n\tbuildCtx: Parameters<ContainerRuntime['ensureImage']>[0],\n): Effect.Effect<ImageRef, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tyield* setCurrentPluginPhase(\n\t\t\t'building sui-fork image — first run compiles sui-fork from source (~10+ min); cached after',\n\t\t);\n\t\treturn yield* runtime.ensureImage(buildCtx).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'image-build',\n\t\t\t\t\t`sui fork image build failed: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t\tEffect.ensuring(setCurrentPluginPhase(null)),\n\t\t);\n\t});\n\nexport const resolveForkImage = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\topts: SuiForkOptions,\n): Effect.Effect<ImageRef, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\t// Explicit image override always wins.\n\t\tif (opts.image && 'pull' in opts.image) {\n\t\t\treturn yield* pullForkImage(runtime, opts.image.pull);\n\t\t}\n\t\tconst rev = opts.version ?? DEFAULT_SUI_FORK_REV;\n\t\tconst owner = {\n\t\t\tapp: identity.app,\n\t\t\tstack: identity.stack,\n\t\t\tplugin: 'sui',\n\t\t\trole: 'validator',\n\t\t} as const;\n\t\tif (opts.image && 'build' in opts.image) {\n\t\t\treturn yield* buildForkImage(runtime, {\n\t\t\t\tcontextPath: opts.image.build.context,\n\t\t\t\tdockerfile: opts.image.build.dockerfile ?? 'Dockerfile',\n\t\t\t\tbuildArgs: { SUI_FORK_REV: rev, SUI_CLI_VERSION: DEFAULT_SUI_CLI_VERSION },\n\t\t\t\towner,\n\t\t\t});\n\t\t}\n\t\t// No explicit image: prefer a prebuilt ref (env / published default) to\n\t\t// skip the cold source compile, falling back to building on any miss.\n\t\tconst prebuilt = prebuiltForkImageRef();\n\t\tif (prebuilt !== undefined && runtime.pullImage !== undefined) {\n\t\t\treturn yield* pullForkImage(runtime, prebuilt).pipe(\n\t\t\t\tEffect.catchTag('SuiPluginError', (cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t\t\t`sui fork mode: prebuilt image '${prebuilt}' unavailable (${cause.message}); building from source.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn yield* buildForkImage(runtime, { ...suiForkImageBuildContext(rev), owner });\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn yield* buildForkImage(runtime, { ...suiForkImageBuildContext(rev), owner });\n\t}).pipe(Effect.withSpan('devstack.plugin.sui.fork.resolveImage'));\n\ninterface ForkContainerResult {\n\treadonly handle: ContainerHandle;\n\treadonly ports: ReadonlyArray<ContainerPortPublish>;\n}\n\nconst ensureForkContainer = (params: {\n\treadonly runtime: ContainerRuntime;\n\treadonly portBroker: PortBroker;\n\treadonly image: ImageRef;\n\treadonly labels: ContainerLabelTuple;\n\treadonly containerName: string;\n\treadonly dataDir: string;\n\treadonly opts: SuiForkOptions;\n}): Effect.Effect<ForkContainerResult, SuiPluginError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst reusable =\n\t\t\tparams.opts.ports === undefined\n\t\t\t\t? yield* findReusableForkPort(params.runtime, params.labels, params.containerName)\n\t\t\t\t: undefined;\n\t\tconst ports =\n\t\t\treusable === undefined\n\t\t\t\t? [yield* allocateForkRpcPort(params.portBroker, params.opts.ports)]\n\t\t\t\t: [reusable];\n\t\tconst reconciliation: PortBindingReconciliation =\n\t\t\treusable === undefined && params.opts.ports !== undefined ? 'exact' : 'adopt-existing';\n\t\tconst command = forkStartCommand(params.opts);\n\t\tconst handle = yield* ensureManagedContainer({\n\t\t\truntime: params.runtime,\n\t\t\tlabels: params.labels,\n\t\t\tspec: {\n\t\t\t\tname: params.containerName,\n\t\t\t\timage: params.image,\n\t\t\t\trecreate: 'on-config-change',\n\t\t\t\tconfigHash: forkContainerConfigHash(params.opts, params.dataDir, command),\n\t\t\t\tstopGraceSeconds: FORK_VALIDATOR_STOP_GRACE_SECONDS,\n\t\t\t\tports,\n\t\t\t\tportBindingReconciliation: reconciliation,\n\t\t\t\tmounts: [{ source: params.dataDir, target: FORK_CONTAINER_DATA_DIR }],\n\t\t\t\tcommand,\n\t\t\t},\n\t\t\tmapError: (cause) => cause,\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause: ContainerRuntimeError) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'container-start',\n\t\t\t\t\t`sui-fork container failed: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t\treturn { handle, ports };\n\t});\n\nexport const forkStartCommand = (opts: SuiForkOptions): ReadonlyArray<string> => {\n\tconst seed = normalizeForkSeed(opts);\n\tconst command = [\n\t\t'start',\n\t\t'--network',\n\t\topts.upstream,\n\t\t'--data-dir',\n\t\tFORK_CONTAINER_DATA_DIR,\n\t\t'--rpc-addr',\n\t\t`0.0.0.0:${CONTAINER_RPC_PORT}`,\n\t];\n\tif (opts.checkpoint !== undefined) {\n\t\tcommand.push('--checkpoint', String(opts.checkpoint));\n\t}\n\tfor (const address of seed.addresses) {\n\t\tcommand.push('--address', address);\n\t}\n\tfor (const objectId of seed.objects) {\n\t\tcommand.push('--object', objectId);\n\t}\n\treturn command;\n};\n\nconst normalizeForkSeed = (opts: SuiForkOptions) => ({\n\taddresses: [\n\t\t...new Set((opts.seed?.addresses ?? []).map((address) => normalizeSuiAddress(address))),\n\t].sort(),\n\tobjects: [\n\t\t...new Set((opts.seed?.objects ?? []).map((objectId) => normalizeSuiObjectId(objectId))),\n\t].sort(),\n});\n\nconst forkContainerConfigHash = (\n\topts: SuiForkOptions,\n\tdataDir: string,\n\tcommand: ReadonlyArray<string>,\n): string =>\n\tcreateHash('sha256')\n\t\t.update(\n\t\t\tJSON.stringify({\n\t\t\t\tdataDir,\n\t\t\t\tcommand,\n\t\t\t\tversion: opts.version ?? DEFAULT_SUI_FORK_REV,\n\t\t\t\tports: opts.ports ?? null,\n\t\t\t}),\n\t\t)\n\t\t.digest('hex');\n\nconst allocateForkRpcPort = (\n\tportBroker: PortBroker,\n\toverride: Readonly<Record<number, number>> | undefined,\n): Effect.Effect<ContainerPortPublish, SuiPluginError, Scope.Scope> => {\n\tconst overridePort = override?.[CONTAINER_RPC_PORT];\n\tif (overridePort !== undefined) {\n\t\treturn Effect.succeed(portPublish(CONTAINER_RPC_PORT, overridePort));\n\t}\n\treturn portBroker\n\t\t.allocate({\n\t\t\towner: 'sui:fork-rpc',\n\t\t\tpreferredPort: DEFAULT_FORK_HOST_RPC_PORT,\n\t\t\tprobeHost: DOCKER_PUBLISH_HOST,\n\t\t})\n\t\t.pipe(\n\t\t\tEffect.catchTag('PortBrokerError', (cause) =>\n\t\t\t\tcause.reason === 'preferred-busy'\n\t\t\t\t\t? portBroker.allocate({ owner: 'sui:fork-rpc', probeHost: DOCKER_PUBLISH_HOST })\n\t\t\t\t\t: Effect.fail(cause),\n\t\t\t),\n\t\t\tEffect.map((allocated: AllocatedPort) => portPublish(CONTAINER_RPC_PORT, allocated.port)),\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'port-allocate',\n\t\t\t\t\t`sui fork mode: failed to allocate RPC host port: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n};\n\nconst findReusableForkPort = (\n\truntime: ContainerRuntime,\n\tlabels: ContainerLabelTuple,\n\tcontainerName: string,\n): Effect.Effect<ContainerPortPublish | undefined, SuiPluginError> =>\n\truntime.inspectByLabels(labels).pipe(\n\t\tEffect.map((handles) =>\n\t\t\thandles\n\t\t\t\t.find((handle) => handle.name === containerName)\n\t\t\t\t?.ports?.find((port) => port.containerPort === CONTAINER_RPC_PORT),\n\t\t),\n\t\tEffect.mapError((cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'container-start',\n\t\t\t\t`sui fork mode: failed to inspect existing fork container: ${cause.reason}: ${cause.detail}`,\n\t\t\t\tcause,\n\t\t\t),\n\t\t),\n\t);\n\nconst pickPublishedPort = (\n\trequested: ReadonlyArray<ContainerPortPublish>,\n\tactual: ReadonlyArray<ContainerPortPublish> | undefined,\n): ContainerPortPublish =>\n\tactual?.find((port) => port.containerPort === CONTAINER_RPC_PORT) ??\n\trequested.find((port) => port.containerPort === CONTAINER_RPC_PORT) ??\n\tportPublish(CONTAINER_RPC_PORT, DEFAULT_FORK_HOST_RPC_PORT);\n\nconst portPublish = (containerPort: number, hostPort: number): ContainerPortPublish => ({\n\tcontainerPort,\n\thostPort,\n\thostIp: DOCKER_PUBLISH_HOST,\n});\n\nexport const forkDataDirKey = (opts: SuiForkOptions): string =>\n\tcreateHash('sha256')\n\t\t.update(\n\t\t\tJSON.stringify({\n\t\t\t\tupstream: opts.upstream,\n\t\t\t\tcheckpoint: opts.checkpoint ?? null,\n\t\t\t\tversion: opts.version ?? DEFAULT_SUI_FORK_REV,\n\t\t\t\tseed: normalizeForkSeed(opts),\n\t\t\t}),\n\t\t)\n\t\t.digest('hex')\n\t\t.slice(0, 16);\n\n/** Bring the data dir into being and claim it against concurrent\n * stacks via the holder protocol. The holder claim is scope-bound —\n * it heartbeats for the stack's lifetime and releases on teardown. */\nconst ensureForkDataDir = (\n\tpaths: StackPaths,\n\topts: SuiForkOptions,\n): Effect.Effect<string, SuiPluginError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst dataDir = resolve(join(paths.stackRoot, 'sui-fork', forkDataDirKey(opts)));\n\t\tyield* Effect.tryPromise({\n\t\t\ttry: () => mkdir(dataDir, { recursive: true, mode: 0o700 }),\n\t\t\tcatch: (cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'fork-data-dir',\n\t\t\t\t\t`sui fork mode: failed to create data directory ${dataDir}: ${formatUnknownError(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t});\n\t\tyield* acquireForkDataDirHolder(paths.stackLockFile, dataDir);\n\t\treturn dataDir;\n\t});\n\ninterface ForkStatus {\n\treadonly checkpoint: string;\n\treadonly clock: number;\n\treadonly forkedAtCheckpoint: string;\n}\n\nconst waitForForkReady = (\n\tsdkClient: SuiGrpcClient,\n\treadyTimeout: Duration.Duration,\n): Effect.Effect<ForkStatus, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tconst readyTimeoutMs = Duration.toMillis(readyTimeout);\n\t\tyield* waitForProbe({\n\t\t\tlabel: 'sui.fork.rpc',\n\t\t\ttimeoutMs: readyTimeoutMs,\n\t\t\tintervalMs: 1_000,\n\t\t\tattemptTimeoutMs: PROBE_ATTEMPT_TIMEOUT_MS,\n\t\t\tprobe: () => readForkStatus(sdkClient).pipe(Effect.as(true)),\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tcause instanceof ProbeTimeoutError\n\t\t\t\t\t? suiPluginError(\n\t\t\t\t\t\t\t'fork-status-probe',\n\t\t\t\t\t\t\t`sui fork mode: ForkingService.GetStatus did not become ready within ${readyTimeoutMs}ms. ` +\n\t\t\t\t\t\t\t\t`Inspect the sui-fork container logs (\\`docker logs\\`); if the image is still ` +\n\t\t\t\t\t\t\t\t`building or the upstream checkpoint is large, raise the \\`readyTimeout\\` option.`,\n\t\t\t\t\t\t\tcause.lastError ?? cause.lastNotReady ?? cause,\n\t\t\t\t\t\t)\n\t\t\t\t\t: suiPluginError(\n\t\t\t\t\t\t\t'fork-status-probe',\n\t\t\t\t\t\t\t`sui fork mode: ForkingService.GetStatus probe failed: ${formatUnknownError(cause)}`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t),\n\t\t\t),\n\t\t);\n\t\treturn yield* readForkStatus(sdkClient);\n\t}).pipe(Effect.withSpan('devstack.plugin.sui.fork.waitForReady'));\n\nconst makeForkAdminSurface = (sdkClient: SuiGrpcClient): ForkAdminSurface => ({\n\tstatus: readForkStatus(sdkClient).pipe(\n\t\tEffect.map(({ checkpoint, clock }) => ({ checkpoint, clock })),\n\t),\n\tadvanceClock: (intervalMs) =>\n\t\tEffect.tryPromise({\n\t\t\ttry: () => sdkClient.forkingService.advanceClock({ durationMs: BigInt(intervalMs) }).response,\n\t\t\tcatch: (cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'fork-advance-clock',\n\t\t\t\t\t`sui fork mode: advanceClock(${intervalMs}) failed: ${formatUnknownError(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t}).pipe(Effect.asVoid),\n\tadvanceCheckpoint: Effect.tryPromise({\n\t\ttry: () => sdkClient.forkingService.advanceCheckpoint({}).response,\n\t\tcatch: (cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'fork-advance-checkpoint',\n\t\t\t\t`sui fork mode: advanceCheckpoint failed: ${formatUnknownError(cause)}`,\n\t\t\t\tcause,\n\t\t\t),\n\t}).pipe(Effect.asVoid),\n\timpersonate: (sender, tx) =>\n\t\tEffect.gen(function* () {\n\t\t\tif (!(tx instanceof Uint8Array)) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'fork-impersonate',\n\t\t\t\t\t\t`sui fork mode: impersonate(${sender}) expected serialized transaction bytes.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tyield* verifyForkImpersonationSender(sender, tx);\n\t\t\tconst raw = yield* Effect.tryPromise({\n\t\t\t\ttry: () =>\n\t\t\t\t\tsdkClient.core.executeTransaction({\n\t\t\t\t\t\ttransaction: tx,\n\t\t\t\t\t\tsignatures: [],\n\t\t\t\t\t\tinclude: { effects: true, objectTypes: true },\n\t\t\t\t\t}),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'fork-impersonate',\n\t\t\t\t\t\t`sui fork mode: impersonate(${sender}) failed: ${formatUnknownError(cause)}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t),\n\t\t\t});\n\t\t\tconst digest = extractExecuteDigest(raw);\n\t\t\tif (digest === undefined) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'fork-impersonate',\n\t\t\t\t\t\t`sui fork mode: impersonate(${sender}) returned no transaction digest.`,\n\t\t\t\t\t\traw,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { digest, success: !isFailedTransaction(raw), raw };\n\t\t}),\n});\n\nconst readForkStatus = (sdkClient: SuiGrpcClient): Effect.Effect<ForkStatus, SuiPluginError> =>\n\tEffect.tryPromise({\n\t\ttry: async () => {\n\t\t\tconst response = await sdkClient.forkingService.getStatus({}).response;\n\t\t\treturn {\n\t\t\t\tcheckpoint: response.checkpointSequenceNumber.toString(),\n\t\t\t\tclock: Number(response.timestampMs),\n\t\t\t\tforkedAtCheckpoint: response.forkedAtCheckpoint.toString(),\n\t\t\t};\n\t\t},\n\t\tcatch: (cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'fork-status-probe',\n\t\t\t\t`sui fork mode: GetStatus failed: ${formatUnknownError(cause)}`,\n\t\t\t\tcause,\n\t\t\t),\n\t});\n\nconst routedSuiRpcUrl = (identity: Identity): Effect.Effect<string, SuiPluginError> =>\n\troutedHostname(identity, SUI_RPC_ENDPOINT_NAME).pipe(\n\t\tEffect.map((hostname) =>\n\t\t\trenderUrl({ protocol: 'http', hostname, port: SUI_RPC_ENTRYPOINT_PORT }),\n\t\t),\n\t\tEffect.mapError((cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'container-start',\n\t\t\t\t`sui fork mode: failed to construct router RPC URL: ${cause.detail}`,\n\t\t\t\tcause,\n\t\t\t),\n\t\t),\n\t);\n\nconst isFailedTransaction = (raw: unknown): boolean =>\n\t(raw as { readonly $kind?: string }).$kind === 'FailedTransaction';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAa,6BAA6B,SAAS,QAAQ,IAAI;;AAG/D,MAAa,uBAAuB;;AAUpC,MAAa,qBAAqB;AAElC,MAAM,6BAAiD;CACtD,MAAM,UAAU,QAAQ,IAAI,qBAAqB,MAAM;AACvD,QAAO,YAAY,KAAA,KAAa,QAAQ,SAAS,IAAI,UAAA,KAAA;;AAUtD,MAAa,6BAA6B;;;;;;AAQ1C,MAAa,qBAA8E;CAM1F,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C9D,SAAO;GACN,YAAY,SAAS,yBAAyB,UAAU;GACxD,OAAO,OAAO,SAAS,YAAY;GACnC,oBAAoB,SAAS,mBAAmB,UAAU;GAC1D;;CAEF,QAAQ,UACP,eACC,qBACA,oCAAoC,mBAAmB,MAAM,IAC7D,MACA;CACF,CAAC;AAEH,MAAM,mBAAmB,aACxB,eAAe,UAAA,MAAgC,CAAC,KAC/C,OAAO,KAAK,aACX,UAAU;CAAE,UAAU;CAAQ;CAAU,MAAM;CAAyB,CAAC,CACxE,EACD,OAAO,UAAU,UAChB,eACC,mBACA,sDAAsD,MAAM,UAC5D,MACA,CACD,CACD;AAEF,MAAM,uBAAuB,QAC3B,IAAoC,UAAU"}
1
+ {"version":3,"file":"fork.mjs","names":["sharedFetchChainId"],"sources":["../../../../src/plugins/sui/mode/fork.ts"],"sourcesContent":["// Sui plugin — fork mode.\n\nimport { createHash } from 'node:crypto';\nimport { mkdir } from 'node:fs/promises';\nimport { join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { Duration, Effect, type Scope } from 'effect';\n\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\nimport { normalizeSuiAddress, normalizeSuiObjectId } from '@mysten/sui/utils';\n\nimport type {\n\tContainerHandle,\n\tContainerPortPublish,\n\tContainerRuntime,\n\tContainerRuntimeError,\n\tImageRef,\n\tPortBindingReconciliation,\n} from '../../../contracts/container-runtime.ts';\nimport type { ContainerLabelTuple } from '../../../contracts/snapshotable.ts';\nimport type { Identity } from '../../../substrate/identity.ts';\nimport { ensureManagedContainer } from '../../../substrate/runtime/managed-container.ts';\nimport type { StackPaths } from '../../../substrate/runtime/paths.ts';\nimport type { AllocatedPort, PortBroker } from '../../../substrate/runtime/port-broker/index.ts';\nimport { ProbeTimeoutError, waitForProbe } from '../../../substrate/runtime/probes.ts';\nimport { formatUnknownError } from '../../../substrate/runtime/format-unknown-error.ts';\nimport { setCurrentPluginPhase } from '../../../substrate/runtime/current-plugin.ts';\nimport { renderUrl, routedHostname } from '../../../substrate/runtime/routed-url.ts';\nimport { extractExecuteDigest } from '../exec/index.ts';\nimport { resolveAutoTickIntervalMs, runAutoTickClock } from '../auto-tick.ts';\nimport { suiPluginError, type SuiConfigError, type SuiPluginError } from '../errors.ts';\nimport type { ResolvedSuiNetwork } from '../network-resolver.ts';\nimport { SUI_RPC_ENDPOINT_NAME, SUI_RPC_ENTRYPOINT_PORT } from '../routable.ts';\nimport { SuiLogAttr } from '../log-attrs.ts';\nimport { acquireForkDataDirHolder, wrapWithForkGuard } from '../fork-orchestration.ts';\nimport {\n\tFORK_IMPERSONATION_GAS_BUDGET,\n\tverifyForkImpersonationSender,\n} from '../fork-transaction.ts';\nimport { DEFAULT_SUI_CLI_VERSION } from '../move/index.ts';\nimport type { ForkAdminSurface, SuiClient } from './shared.ts';\nimport { toDockerHostGatewayUrl } from './shared.ts';\nimport {\n\tassembleSuiClient,\n\tfetchChainId as sharedFetchChainId,\n\tmakeResolvedNetwork,\n\tnoopWaitForTransactionsReady,\n} from './shared-boot.ts';\nimport type { SuiForkOptions } from './spec.ts';\n\n/** Default ready-probe timeout for fork-mode cold start. */\nexport const DEFAULT_FORK_READY_TIMEOUT = Duration.seconds(180);\n\n/** Default Sui repository revision used by the bundled `sui-fork` image build. */\nexport const DEFAULT_SUI_FORK_REV = '62ee6ada958cd61b3c8a4466dd33c9aba3cdff8a';\n\n/** Env var that supplies a prebuilt `sui-fork` image to pull for a single\n * run (e.g. `ghcr.io/mysten/sui-fork:<rev>`). When set and the runtime can\n * pull, `resolveForkImage` tries it first and falls back to a source build,\n * sparing users the ~10-minute cold compile. No prebuilt default ships\n * today, so absent this env var the fork always builds from source. */\nexport const FORK_IMAGE_ENV_VAR = 'DEVSTACK_SUI_FORK_IMAGE';\n\nconst prebuiltForkImageRef = (): string | undefined => {\n\tconst fromEnv = process.env[FORK_IMAGE_ENV_VAR]?.trim();\n\treturn fromEnv !== undefined && fromEnv.length > 0 ? fromEnv : undefined;\n};\n\nexport const DEFAULT_FORK_HOST_RPC_PORT = 51002;\nexport const FORK_VALIDATOR_STOP_GRACE_SECONDS = 30;\n\n/** Default impersonation \"whale\" per upstream — a large-reserve address\n * known to hold a big single SUI coin in the upstream's state, used as\n * the fork faucet funding source when `faucet.whale` is omitted. `null`\n * means no default is known (the faucet then requires an explicit\n * `faucet.whale`). Validated at boot via `selectSufficientForkCoin`. */\nexport const FORK_DEFAULT_WHALE: Record<'mainnet' | 'testnet' | 'devnet', string | null> = {\n\t// Long-lived validator addresses each holding a large single SUI coin\n\t// (validated 2026-05-28). `selectSufficientForkCoin` re-queries the address\n\t// at the fork checkpoint at runtime, so a rotated coin self-heals; a\n\t// drained/retired address degrades gracefully — boot validation warns and\n\t// disables the default faucet. Override any of these with `faucet.whale`.\n\tmainnet: '0xbc7e7537564bd939b62e5b24477ac00ba8cef33ccec72d63090a080a1253b725', // ~273k SUI\n\ttestnet: '0xc397477d8b445e6295bc34e593b9a95d5d233cec1a8fe3740d0ab86012a460f6', // ~127k SUI\n\t// devnet resets periodically; this genesis validator may go stale after a\n\t// reset, at which point the default faucet disables itself until a\n\t// `faucet.whale` is supplied.\n\tdevnet: '0x4296747d0bd91c41b668702bdca0bf769a0e32db66982d986101e7975db55cbe', // ~30M SUI\n};\n\n/** The common per-account fund the fork faucet must be able to cover. Mirrors\n * the account plugin's `DEFAULT_EPHEMERAL_FUND_MIST` (1 SUI) — kept local\n * because account → sui already, so importing it here would cycle; a test\n * pins the two together. */\nexport const FORK_FAUCET_DEFAULT_FUND_MIST = 1_000_000_000n;\n\n/** Floor a single whale SUI coin must clear at boot to enable the fork faucet:\n * a default ephemeral fund (1 SUI) plus the impersonation gas budget. Set to\n * match the per-request requirement for the default fund so a whale that\n * passes boot can actually satisfy the first auto-fund. */\nexport const FORK_FAUCET_WHALE_MIN_COIN_MIST =\n\tFORK_FAUCET_DEFAULT_FUND_MIST + FORK_IMPERSONATION_GAS_BUDGET;\n\n/** Default per-request funding cap (MIST) — 1000 SUI. */\nexport const DEFAULT_FORK_FAUCET_PER_REQUEST_CAP_MIST = 1_000_000_000_000n;\n\n/** Resolved fork faucet funding source. */\nexport interface ResolvedForkWhale {\n\treadonly whale: string;\n\treadonly perRequestCapMist: bigint;\n\t/** `true` when the user set `faucet.whale` explicitly — a validation\n\t * failure then hard-fails boot; a default whale only warns + disables\n\t * the faucet so the fork still boots. */\n\treadonly explicit: boolean;\n}\n\n/** Resolve the fork faucet whale from options + per-upstream defaults,\n * or `null` when the faucet is disabled / no whale is known. */\nexport const resolveForkWhale = (opts: SuiForkOptions): ResolvedForkWhale | null => {\n\tif (opts.faucet?.enabled === false) {\n\t\treturn null;\n\t}\n\tconst perRequestCapMist =\n\t\topts.faucet?.perRequestCapMist ?? DEFAULT_FORK_FAUCET_PER_REQUEST_CAP_MIST;\n\tconst explicit = opts.faucet?.whale?.trim();\n\tif (explicit !== undefined && explicit.length > 0) {\n\t\treturn { whale: normalizeSuiAddress(explicit), perRequestCapMist, explicit: true };\n\t}\n\tconst fallback = FORK_DEFAULT_WHALE[opts.upstream];\n\treturn fallback === null\n\t\t? null\n\t\t: { whale: normalizeSuiAddress(fallback), perRequestCapMist, explicit: false };\n};\n\n/** Inject the resolved faucet whale into the fork seed so its coins exist\n * in fork state. MUST run before the data-dir key / container config\n * hash are computed (both fold the seed) so enabling the faucet doesn't\n * silently reuse a whale-less fork data dir. */\nexport const withForkFaucetSeed = (opts: SuiForkOptions): SuiForkOptions => {\n\tconst resolved = resolveForkWhale(opts);\n\tif (resolved === null) {\n\t\treturn opts;\n\t}\n\treturn {\n\t\t...opts,\n\t\tseed: {\n\t\t\t...opts.seed,\n\t\t\taddresses: [...(opts.seed?.addresses ?? []), resolved.whale],\n\t\t},\n\t};\n};\n\nconst DOCKER_PUBLISH_HOST = '0.0.0.0' as const;\nconst CONTAINER_RPC_PORT = SUI_RPC_ENTRYPOINT_PORT;\nconst FORK_CONTAINER_DATA_DIR = '/var/lib/sui-fork';\nconst PROBE_ATTEMPT_TIMEOUT_MS = 3_000;\n\n/** Resolved fork-mode boot artifacts. */\nexport interface ForkModeBootResult {\n\treadonly resolved: ResolvedSuiNetwork;\n\treadonly client: SuiClient;\n\treadonly autoTickIntervalMs: number | undefined;\n}\n\nexport const bootForkMode = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\tportBroker: PortBroker,\n\tpaths: StackPaths,\n\topts: SuiForkOptions,\n): Effect.Effect<ForkModeBootResult, SuiPluginError | SuiConfigError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst autoTickIntervalMs = yield* resolveAutoTickIntervalMs(opts.autoTick);\n\t\t// Fold the faucet whale into the seed BEFORE the data-dir key /\n\t\t// container config hash are derived, so enabling the faucet keys a\n\t\t// distinct fork state rather than reusing a whale-less data dir.\n\t\tconst seededOpts = withForkFaucetSeed(opts);\n\t\tconst image = yield* resolveForkImage(runtime, identity, opts);\n\t\tconst dataDir = yield* ensureForkDataDir(paths, seededOpts);\n\n\t\tconst labels: ContainerLabelTuple = {\n\t\t\tapp: identity.app,\n\t\t\tstack: identity.stack,\n\t\t\tplugin: 'sui',\n\t\t\trole: 'fork-validator',\n\t\t};\n\t\tconst containerName = `devstack-${identity.app}-${identity.stack}-sui-fork`;\n\t\tconst { handle, ports } = yield* ensureForkContainer({\n\t\t\truntime,\n\t\t\tportBroker,\n\t\t\timage,\n\t\t\tlabels,\n\t\t\tcontainerName,\n\t\t\tdataDir,\n\t\t\topts: seededOpts,\n\t\t});\n\n\t\tconst published = pickPublishedPort(ports, handle.ports);\n\t\tconst directRpcUrl = `http://127.0.0.1:${published.hostPort}`;\n\t\tconst rpcUrl = yield* routedSuiRpcUrl(identity);\n\t\tconst sdkClient = new SuiGrpcClient({ baseUrl: directRpcUrl, network: opts.upstream });\n\t\tconst readyTimeout = opts.readyTimeout ?? DEFAULT_FORK_READY_TIMEOUT;\n\n\t\tconst status = yield* waitForForkReady(sdkClient, readyTimeout).pipe(\n\t\t\tEffect.annotateLogs({ [SuiLogAttr.container]: handle.name }),\n\t\t);\n\t\tconst chainId = yield* sharedFetchChainId(sdkClient);\n\n\t\tconst fork = makeForkAdminSurface(sdkClient);\n\t\tconst assembled = yield* assembleSuiClient({\n\t\t\tsdkClient,\n\t\t\tchainId,\n\t\t\trpcUrl,\n\t\t\twaitForTransactionsReady: noopWaitForTransactionsReady,\n\t\t\tbuildImage: image,\n\t\t\thostGateway: {\n\t\t\t\trpcUrl: toDockerHostGatewayUrl(directRpcUrl),\n\t\t\t\tfaucetUrl: null,\n\t\t\t\tgraphqlUrl: null,\n\t\t\t},\n\t\t});\n\t\tconst client: SuiClient = {\n\t\t\t...assembled.client,\n\t\t\tsdk: wrapWithForkGuard(assembled.sdkShim),\n\t\t\tfork,\n\t\t};\n\n\t\tif (autoTickIntervalMs !== undefined) {\n\t\t\tyield* runAutoTickClock(fork, autoTickIntervalMs);\n\t\t}\n\n\t\treturn {\n\t\t\tresolved: makeResolvedNetwork({\n\t\t\t\tmode: 'fork',\n\t\t\t\tchainId,\n\t\t\t\trpc: rpcUrl,\n\t\t\t\tsource: 'default',\n\t\t\t\tcheckpoint: status.forkedAtCheckpoint,\n\t\t\t\tforkUpstream: opts.upstream,\n\t\t\t}),\n\t\t\tclient,\n\t\t\tautoTickIntervalMs,\n\t\t};\n\t});\n\nexport const suiForkImageBuildContext = (rev = DEFAULT_SUI_FORK_REV) => ({\n\t// `fileURLToPath` normalises the URL → host-path conversion across\n\t// platforms (Windows `file:///C:/...` → `C:\\...`). Reading\n\t// `.pathname` directly leaves the leading `/` on Windows drive paths.\n\tcontextPath: fileURLToPath(new URL('../../../../images/', import.meta.url)),\n\tdockerfile: 'sui-fork/Dockerfile',\n\tbuildArgs: { SUI_FORK_REV: rev, SUI_CLI_VERSION: DEFAULT_SUI_CLI_VERSION },\n});\n\n/** Pull a prebuilt fork image, narrating progress on the supervisor row.\n * Fails with a `SuiPluginError` if the runtime can't pull or the pull errors. */\nconst pullForkImage = (\n\truntime: ContainerRuntime,\n\tpullRef: string,\n): Effect.Effect<ImageRef, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tif (runtime.pullImage === undefined) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'image-build',\n\t\t\t\t\t`sui fork mode cannot pull image '${pullRef}' because the configured container runtime does not expose image pulls.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tyield* setCurrentPluginPhase(`pulling sui-fork image ${pullRef}…`);\n\t\treturn yield* runtime.pullImage(pullRef).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'image-build',\n\t\t\t\t\t`sui fork mode failed to pull image '${pullRef}': ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t\tEffect.ensuring(setCurrentPluginPhase(null)),\n\t\t);\n\t});\n\n/** Build the bundled `sui-fork` image from source, narrating the cold\n * compile so the row doesn't look hung for ~10 minutes on first run. */\nconst buildForkImage = (\n\truntime: ContainerRuntime,\n\tbuildCtx: Parameters<ContainerRuntime['ensureImage']>[0],\n): Effect.Effect<ImageRef, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tyield* setCurrentPluginPhase(\n\t\t\t'building sui-fork image — first run compiles sui-fork from source (~10+ min); cached after',\n\t\t);\n\t\treturn yield* runtime.ensureImage(buildCtx).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'image-build',\n\t\t\t\t\t`sui fork image build failed: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t\tEffect.ensuring(setCurrentPluginPhase(null)),\n\t\t);\n\t});\n\nexport const resolveForkImage = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\topts: SuiForkOptions,\n): Effect.Effect<ImageRef, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\t// Explicit image override always wins.\n\t\tif (opts.image && 'pull' in opts.image) {\n\t\t\treturn yield* pullForkImage(runtime, opts.image.pull);\n\t\t}\n\t\tconst rev = opts.version ?? DEFAULT_SUI_FORK_REV;\n\t\tconst owner = {\n\t\t\tapp: identity.app,\n\t\t\tstack: identity.stack,\n\t\t\tplugin: 'sui',\n\t\t\trole: 'validator',\n\t\t} as const;\n\t\tif (opts.image && 'build' in opts.image) {\n\t\t\treturn yield* buildForkImage(runtime, {\n\t\t\t\tcontextPath: opts.image.build.context,\n\t\t\t\tdockerfile: opts.image.build.dockerfile ?? 'Dockerfile',\n\t\t\t\tbuildArgs: { SUI_FORK_REV: rev, SUI_CLI_VERSION: DEFAULT_SUI_CLI_VERSION },\n\t\t\t\towner,\n\t\t\t});\n\t\t}\n\t\t// No explicit image: prefer a prebuilt ref (env / published default) to\n\t\t// skip the cold source compile, falling back to building on any miss.\n\t\tconst prebuilt = prebuiltForkImageRef();\n\t\tif (prebuilt !== undefined && runtime.pullImage !== undefined) {\n\t\t\treturn yield* pullForkImage(runtime, prebuilt).pipe(\n\t\t\t\tEffect.catchTag('SuiPluginError', (cause) =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t\t\t`sui fork mode: prebuilt image '${prebuilt}' unavailable (${cause.message}); building from source.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn yield* buildForkImage(runtime, { ...suiForkImageBuildContext(rev), owner });\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn yield* buildForkImage(runtime, { ...suiForkImageBuildContext(rev), owner });\n\t});\n\ninterface ForkContainerResult {\n\treadonly handle: ContainerHandle;\n\treadonly ports: ReadonlyArray<ContainerPortPublish>;\n}\n\nconst ensureForkContainer = (params: {\n\treadonly runtime: ContainerRuntime;\n\treadonly portBroker: PortBroker;\n\treadonly image: ImageRef;\n\treadonly labels: ContainerLabelTuple;\n\treadonly containerName: string;\n\treadonly dataDir: string;\n\treadonly opts: SuiForkOptions;\n}): Effect.Effect<ForkContainerResult, SuiPluginError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst reusable =\n\t\t\tparams.opts.ports === undefined\n\t\t\t\t? yield* findReusableForkPort(params.runtime, params.labels, params.containerName)\n\t\t\t\t: undefined;\n\t\tconst ports =\n\t\t\treusable === undefined\n\t\t\t\t? [yield* allocateForkRpcPort(params.portBroker, params.opts.ports)]\n\t\t\t\t: [reusable];\n\t\tconst reconciliation: PortBindingReconciliation =\n\t\t\treusable === undefined && params.opts.ports !== undefined ? 'exact' : 'adopt-existing';\n\t\tconst command = forkStartCommand(params.opts);\n\t\tconst handle = yield* ensureManagedContainer({\n\t\t\truntime: params.runtime,\n\t\t\tlabels: params.labels,\n\t\t\tspec: {\n\t\t\t\tname: params.containerName,\n\t\t\t\timage: params.image,\n\t\t\t\trecreate: 'on-config-change',\n\t\t\t\tconfigHash: forkContainerConfigHash(params.opts, params.dataDir, command),\n\t\t\t\tstopGraceSeconds: FORK_VALIDATOR_STOP_GRACE_SECONDS,\n\t\t\t\tports,\n\t\t\t\tportBindingReconciliation: reconciliation,\n\t\t\t\tmounts: [{ source: params.dataDir, target: FORK_CONTAINER_DATA_DIR }],\n\t\t\t\tcommand,\n\t\t\t},\n\t\t\tmapError: (cause) => cause,\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause: ContainerRuntimeError) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'container-start',\n\t\t\t\t\t`sui-fork container failed: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t\treturn { handle, ports };\n\t});\n\nexport const forkStartCommand = (opts: SuiForkOptions): ReadonlyArray<string> => {\n\tconst seed = normalizeForkSeed(opts);\n\tconst command = [\n\t\t'start',\n\t\t'--network',\n\t\topts.upstream,\n\t\t'--data-dir',\n\t\tFORK_CONTAINER_DATA_DIR,\n\t\t'--rpc-addr',\n\t\t`0.0.0.0:${CONTAINER_RPC_PORT}`,\n\t];\n\tif (opts.checkpoint !== undefined) {\n\t\tcommand.push('--checkpoint', String(opts.checkpoint));\n\t}\n\tfor (const address of seed.addresses) {\n\t\tcommand.push('--address', address);\n\t}\n\tfor (const objectId of seed.objects) {\n\t\tcommand.push('--object', objectId);\n\t}\n\treturn command;\n};\n\nconst normalizeForkSeed = (opts: SuiForkOptions) => ({\n\taddresses: [\n\t\t...new Set((opts.seed?.addresses ?? []).map((address) => normalizeSuiAddress(address))),\n\t].sort(),\n\tobjects: [\n\t\t...new Set((opts.seed?.objects ?? []).map((objectId) => normalizeSuiObjectId(objectId))),\n\t].sort(),\n});\n\nconst forkContainerConfigHash = (\n\topts: SuiForkOptions,\n\tdataDir: string,\n\tcommand: ReadonlyArray<string>,\n): string =>\n\tcreateHash('sha256')\n\t\t.update(\n\t\t\tJSON.stringify({\n\t\t\t\tdataDir,\n\t\t\t\tcommand,\n\t\t\t\tversion: opts.version ?? DEFAULT_SUI_FORK_REV,\n\t\t\t\tports: opts.ports ?? null,\n\t\t\t}),\n\t\t)\n\t\t.digest('hex');\n\nconst allocateForkRpcPort = (\n\tportBroker: PortBroker,\n\toverride: Readonly<Record<number, number>> | undefined,\n): Effect.Effect<ContainerPortPublish, SuiPluginError, Scope.Scope> => {\n\tconst overridePort = override?.[CONTAINER_RPC_PORT];\n\tif (overridePort !== undefined) {\n\t\treturn Effect.succeed(portPublish(CONTAINER_RPC_PORT, overridePort));\n\t}\n\treturn portBroker\n\t\t.allocate({\n\t\t\towner: 'sui:fork-rpc',\n\t\t\tpreferredPort: DEFAULT_FORK_HOST_RPC_PORT,\n\t\t\tprobeHost: DOCKER_PUBLISH_HOST,\n\t\t})\n\t\t.pipe(\n\t\t\tEffect.catchTag('PortBrokerError', (cause) =>\n\t\t\t\tcause.reason === 'preferred-busy'\n\t\t\t\t\t? portBroker.allocate({ owner: 'sui:fork-rpc', probeHost: DOCKER_PUBLISH_HOST })\n\t\t\t\t\t: Effect.fail(cause),\n\t\t\t),\n\t\t\tEffect.map((allocated: AllocatedPort) => portPublish(CONTAINER_RPC_PORT, allocated.port)),\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'port-allocate',\n\t\t\t\t\t`sui fork mode: failed to allocate RPC host port: ${cause.detail}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t\t),\n\t\t);\n};\n\nconst findReusableForkPort = (\n\truntime: ContainerRuntime,\n\tlabels: ContainerLabelTuple,\n\tcontainerName: string,\n): Effect.Effect<ContainerPortPublish | undefined, SuiPluginError> =>\n\truntime.inspectByLabels(labels).pipe(\n\t\tEffect.map((handles) =>\n\t\t\thandles\n\t\t\t\t.find((handle) => handle.name === containerName)\n\t\t\t\t?.ports?.find((port) => port.containerPort === CONTAINER_RPC_PORT),\n\t\t),\n\t\tEffect.mapError((cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'container-start',\n\t\t\t\t`sui fork mode: failed to inspect existing fork container: ${cause.reason}: ${cause.detail}`,\n\t\t\t\tcause,\n\t\t\t),\n\t\t),\n\t);\n\nconst pickPublishedPort = (\n\trequested: ReadonlyArray<ContainerPortPublish>,\n\tactual: ReadonlyArray<ContainerPortPublish> | undefined,\n): ContainerPortPublish =>\n\tactual?.find((port) => port.containerPort === CONTAINER_RPC_PORT) ??\n\trequested.find((port) => port.containerPort === CONTAINER_RPC_PORT) ??\n\tportPublish(CONTAINER_RPC_PORT, DEFAULT_FORK_HOST_RPC_PORT);\n\nconst portPublish = (containerPort: number, hostPort: number): ContainerPortPublish => ({\n\tcontainerPort,\n\thostPort,\n\thostIp: DOCKER_PUBLISH_HOST,\n});\n\nexport const forkDataDirKey = (opts: SuiForkOptions): string =>\n\tcreateHash('sha256')\n\t\t.update(\n\t\t\tJSON.stringify({\n\t\t\t\tupstream: opts.upstream,\n\t\t\t\tcheckpoint: opts.checkpoint ?? null,\n\t\t\t\tversion: opts.version ?? DEFAULT_SUI_FORK_REV,\n\t\t\t\tseed: normalizeForkSeed(opts),\n\t\t\t}),\n\t\t)\n\t\t.digest('hex')\n\t\t.slice(0, 16);\n\n/** Bring the data dir into being and claim it against concurrent\n * stacks via the holder protocol. The holder claim is scope-bound —\n * it heartbeats for the stack's lifetime and releases on teardown. */\nconst ensureForkDataDir = (\n\tpaths: StackPaths,\n\topts: SuiForkOptions,\n): Effect.Effect<string, SuiPluginError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst dataDir = resolve(join(paths.stackRoot, 'sui-fork', forkDataDirKey(opts)));\n\t\tyield* Effect.tryPromise({\n\t\t\ttry: () => mkdir(dataDir, { recursive: true, mode: 0o700 }),\n\t\t\tcatch: (cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'fork-data-dir',\n\t\t\t\t\t`sui fork mode: failed to create data directory ${dataDir}: ${formatUnknownError(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t});\n\t\tyield* acquireForkDataDirHolder(paths.stackLockFile, dataDir);\n\t\treturn dataDir;\n\t});\n\ninterface ForkStatus {\n\treadonly checkpoint: string;\n\treadonly clock: number;\n\treadonly forkedAtCheckpoint: string;\n}\n\nconst waitForForkReady = (\n\tsdkClient: SuiGrpcClient,\n\treadyTimeout: Duration.Duration,\n): Effect.Effect<ForkStatus, SuiPluginError> =>\n\tEffect.gen(function* () {\n\t\tconst readyTimeoutMs = Duration.toMillis(readyTimeout);\n\t\tyield* waitForProbe({\n\t\t\tlabel: 'sui.fork.rpc',\n\t\t\ttimeoutMs: readyTimeoutMs,\n\t\t\tintervalMs: 1_000,\n\t\t\tattemptTimeoutMs: PROBE_ATTEMPT_TIMEOUT_MS,\n\t\t\tprobe: () => readForkStatus(sdkClient).pipe(Effect.as(true)),\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tcause instanceof ProbeTimeoutError\n\t\t\t\t\t? suiPluginError(\n\t\t\t\t\t\t\t'fork-status-probe',\n\t\t\t\t\t\t\t`sui fork mode: ForkingService.GetStatus did not become ready within ${readyTimeoutMs}ms. ` +\n\t\t\t\t\t\t\t\t`Inspect the sui-fork container logs (\\`docker logs\\`); if the image is still ` +\n\t\t\t\t\t\t\t\t`building or the upstream checkpoint is large, raise the \\`readyTimeout\\` option.`,\n\t\t\t\t\t\t\tcause.lastError ?? cause.lastNotReady ?? cause,\n\t\t\t\t\t\t)\n\t\t\t\t\t: suiPluginError(\n\t\t\t\t\t\t\t'fork-status-probe',\n\t\t\t\t\t\t\t`sui fork mode: ForkingService.GetStatus probe failed: ${formatUnknownError(cause)}`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t),\n\t\t\t),\n\t\t);\n\t\treturn yield* readForkStatus(sdkClient);\n\t});\n\nconst makeForkAdminSurface = (sdkClient: SuiGrpcClient): ForkAdminSurface => ({\n\tstatus: readForkStatus(sdkClient).pipe(\n\t\tEffect.map(({ checkpoint, clock }) => ({ checkpoint, clock })),\n\t),\n\tadvanceClock: (intervalMs) =>\n\t\tEffect.tryPromise({\n\t\t\ttry: () => sdkClient.forkingService.advanceClock({ durationMs: BigInt(intervalMs) }).response,\n\t\t\tcatch: (cause) =>\n\t\t\t\tsuiPluginError(\n\t\t\t\t\t'fork-advance-clock',\n\t\t\t\t\t`sui fork mode: advanceClock(${intervalMs}) failed: ${formatUnknownError(cause)}`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t}).pipe(Effect.asVoid),\n\tadvanceCheckpoint: Effect.tryPromise({\n\t\ttry: () => sdkClient.forkingService.advanceCheckpoint({}).response,\n\t\tcatch: (cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'fork-advance-checkpoint',\n\t\t\t\t`sui fork mode: advanceCheckpoint failed: ${formatUnknownError(cause)}`,\n\t\t\t\tcause,\n\t\t\t),\n\t}).pipe(Effect.asVoid),\n\timpersonate: (sender, tx) =>\n\t\tEffect.gen(function* () {\n\t\t\tif (!(tx instanceof Uint8Array)) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'fork-impersonate',\n\t\t\t\t\t\t`sui fork mode: impersonate(${sender}) expected serialized transaction bytes.`,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tyield* verifyForkImpersonationSender(sender, tx);\n\t\t\tconst raw = yield* Effect.tryPromise({\n\t\t\t\ttry: () =>\n\t\t\t\t\tsdkClient.core.executeTransaction({\n\t\t\t\t\t\ttransaction: tx,\n\t\t\t\t\t\tsignatures: [],\n\t\t\t\t\t\tinclude: { effects: true, objectTypes: true },\n\t\t\t\t\t}),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'fork-impersonate',\n\t\t\t\t\t\t`sui fork mode: impersonate(${sender}) failed: ${formatUnknownError(cause)}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t),\n\t\t\t});\n\t\t\tconst digest = extractExecuteDigest(raw);\n\t\t\tif (digest === undefined) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'fork-impersonate',\n\t\t\t\t\t\t`sui fork mode: impersonate(${sender}) returned no transaction digest.`,\n\t\t\t\t\t\traw,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn { digest, success: !isFailedTransaction(raw), raw };\n\t\t}),\n});\n\nconst readForkStatus = (sdkClient: SuiGrpcClient): Effect.Effect<ForkStatus, SuiPluginError> =>\n\tEffect.tryPromise({\n\t\ttry: async () => {\n\t\t\tconst response = await sdkClient.forkingService.getStatus({}).response;\n\t\t\treturn {\n\t\t\t\tcheckpoint: response.checkpointSequenceNumber.toString(),\n\t\t\t\tclock: Number(response.timestampMs),\n\t\t\t\tforkedAtCheckpoint: response.forkedAtCheckpoint.toString(),\n\t\t\t};\n\t\t},\n\t\tcatch: (cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'fork-status-probe',\n\t\t\t\t`sui fork mode: GetStatus failed: ${formatUnknownError(cause)}`,\n\t\t\t\tcause,\n\t\t\t),\n\t});\n\nconst routedSuiRpcUrl = (identity: Identity): Effect.Effect<string, SuiPluginError> =>\n\troutedHostname(identity, SUI_RPC_ENDPOINT_NAME).pipe(\n\t\tEffect.map((hostname) =>\n\t\t\trenderUrl({ protocol: 'http', hostname, port: SUI_RPC_ENTRYPOINT_PORT }),\n\t\t),\n\t\tEffect.mapError((cause) =>\n\t\t\tsuiPluginError(\n\t\t\t\t'container-start',\n\t\t\t\t`sui fork mode: failed to construct router RPC URL: ${cause.detail}`,\n\t\t\t\tcause,\n\t\t\t),\n\t\t),\n\t);\n\nconst isFailedTransaction = (raw: unknown): boolean =>\n\t(raw as { readonly $kind?: string }).$kind === 'FailedTransaction';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAa,6BAA6B,SAAS,QAAQ,GAAG;;AAG9D,MAAa,uBAAuB;;;;;;AAOpC,MAAa,qBAAqB;AAElC,MAAM,6BAAiD;CACtD,MAAM,UAAU,QAAQ,IAAI,mBAAmB,EAAE,KAAK;CACtD,OAAO,YAAY,KAAA,KAAa,QAAQ,SAAS,IAAI,UAAU,KAAA;AAChE;AAEA,MAAa,6BAA6B;;;;;;AAQ1C,MAAa,qBAA8E;CAM1F,SAAS;CACT,SAAS;CAIT,QAAQ;AACT;;;;;AAYA,MAAa,kCACZ,cAAgC;;;AAiBjC,MAAa,oBAAoB,SAAmD;CACnF,IAAI,KAAK,QAAQ,YAAY,OAC5B,OAAO;CAER,MAAM,oBACL,KAAK,QAAQ,qBAAA;CACd,MAAM,WAAW,KAAK,QAAQ,OAAO,KAAK;CAC1C,IAAI,aAAa,KAAA,KAAa,SAAS,SAAS,GAC/C,OAAO;EAAE,OAAO,oBAAoB,QAAQ;EAAG;EAAmB,UAAU;CAAK;CAElF,MAAM,WAAW,mBAAmB,KAAK;CACzC,OAAO,aAAa,OACjB,OACA;EAAE,OAAO,oBAAoB,QAAQ;EAAG;EAAmB,UAAU;CA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