@mysten-incubation/devstack 0.0.1 → 0.1.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 (838) hide show
  1. package/README.md +7 -3
  2. package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  3. package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  4. package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  5. package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  6. package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  7. package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  8. package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  9. package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  10. package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  11. package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  12. package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  13. package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
  14. package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
  15. package/dashboard-ui/assets/index-Deml9drg.css +1 -0
  16. package/dashboard-ui/index.html +13 -0
  17. package/dist/api/define-capabilities.d.mts +14 -3
  18. package/dist/api/define-capabilities.mjs +18 -1
  19. package/dist/api/define-capabilities.mjs.map +1 -1
  20. package/dist/api/define-devstack.d.mts +1 -1
  21. package/dist/api/define-devstack.mjs +6 -26
  22. package/dist/api/define-devstack.mjs.map +1 -1
  23. package/dist/api/define-plugin.d.mts +1 -0
  24. package/dist/api/define-plugin.mjs +2 -0
  25. package/dist/api/inference-network.d.mts +132 -0
  26. package/dist/api/inference-network.mjs +105 -16
  27. package/dist/api/inference-network.mjs.map +1 -1
  28. package/dist/api/plugin-errors.d.mts +7 -0
  29. package/dist/api/run-stack.d.mts +20 -9
  30. package/dist/api/run-stack.mjs +56 -29
  31. package/dist/api/run-stack.mjs.map +1 -1
  32. package/dist/build-integrations/playwright/config.d.mts +6 -4
  33. package/dist/build-integrations/playwright/config.mjs +5 -3
  34. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  35. package/dist/build-integrations/playwright/errors.d.mts +1 -1
  36. package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
  37. package/dist/build-integrations/playwright/global-setup.mjs +250 -13
  38. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  39. package/dist/build-integrations/playwright/index.d.mts +5 -3
  40. package/dist/build-integrations/playwright/index.mjs +4 -2
  41. package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
  42. package/dist/build-integrations/playwright/stack-context.mjs +24 -63
  43. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  44. package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
  45. package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
  46. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  47. package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
  48. package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
  49. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
  51. package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
  52. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
  53. package/dist/build-integrations/runtime/discover.d.mts +38 -30
  54. package/dist/build-integrations/runtime/discover.mjs +73 -70
  55. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
  57. package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
  58. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  59. package/dist/build-integrations/runtime/index.d.mts +7 -2
  60. package/dist/build-integrations/runtime/index.mjs +9 -2
  61. package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
  62. package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
  63. package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
  64. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
  65. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
  66. package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
  67. package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
  68. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  69. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
  70. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
  71. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
  72. package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
  73. package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
  74. package/dist/build-integrations/vite/index.d.mts +51 -0
  75. package/dist/build-integrations/vite/index.mjs +73 -0
  76. package/dist/build-integrations/vite/index.mjs.map +1 -0
  77. package/dist/build-integrations/vitest/env.d.mts +4 -3
  78. package/dist/build-integrations/vitest/env.mjs +6 -4
  79. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  80. package/dist/build-integrations/vitest/errors.d.mts +25 -4
  81. package/dist/build-integrations/vitest/errors.mjs +15 -2
  82. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  83. package/dist/build-integrations/vitest/index.d.mts +2 -2
  84. package/dist/build-integrations/vitest/index.mjs +3 -3
  85. package/dist/build-integrations/vitest/setup.d.mts +4 -2
  86. package/dist/build-integrations/vitest/setup.mjs +2 -2
  87. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  88. package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
  89. package/dist/build-integrations/vitest/stack-context.mjs +33 -13
  90. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  91. package/dist/cli/bail.mjs +23 -0
  92. package/dist/cli/bail.mjs.map +1 -0
  93. package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
  94. package/dist/cli/doctor-probes.mjs.map +1 -0
  95. package/dist/cli/main.d.mts +15 -1
  96. package/dist/cli/main.mjs +166 -482
  97. package/dist/cli/main.mjs.map +1 -1
  98. package/dist/cli/prune-direct.mjs +31 -201
  99. package/dist/cli/prune-direct.mjs.map +1 -1
  100. package/dist/cli/snapshot-reader.mjs +14 -11
  101. package/dist/cli/snapshot-reader.mjs.map +1 -1
  102. package/dist/cli/up-lifecycle.mjs +4 -1
  103. package/dist/cli/up-lifecycle.mjs.map +1 -1
  104. package/dist/cli/wirings/apply.mjs +95 -0
  105. package/dist/cli/wirings/apply.mjs.map +1 -0
  106. package/dist/cli/wirings/build-verb-layers.mjs +42 -0
  107. package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
  108. package/dist/cli/wirings/config-loader.mjs +69 -0
  109. package/dist/cli/wirings/config-loader.mjs.map +1 -0
  110. package/dist/cli/wirings/engine-command.mjs +30 -0
  111. package/dist/cli/wirings/engine-command.mjs.map +1 -0
  112. package/dist/cli/wirings/identity.mjs +72 -0
  113. package/dist/cli/wirings/identity.mjs.map +1 -0
  114. package/dist/cli/wirings/provide-file-system.mjs +7 -0
  115. package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
  116. package/dist/cli/wirings/snapshot.mjs +177 -0
  117. package/dist/cli/wirings/snapshot.mjs.map +1 -0
  118. package/dist/cli/wirings/up.mjs +287 -0
  119. package/dist/cli/wirings/up.mjs.map +1 -0
  120. package/dist/cli/wirings/wipe.mjs +40 -0
  121. package/dist/cli/wirings/wipe.mjs.map +1 -0
  122. package/dist/contracts/capability-decl.d.mts +0 -2
  123. package/dist/contracts/codegenable.d.mts +43 -0
  124. package/dist/contracts/container-runtime.d.mts +26 -1
  125. package/dist/contracts/faucet-strategy.d.mts +25 -0
  126. package/dist/contracts/funding-strategy.d.mts +42 -0
  127. package/dist/contracts/plugin-expander.mjs +60 -0
  128. package/dist/contracts/plugin-expander.mjs.map +1 -0
  129. package/dist/contracts/projection.d.mts +5 -3
  130. package/dist/contracts/renderer.d.mts +23 -0
  131. package/dist/contracts/routable.d.mts +14 -1
  132. package/dist/contracts/snapshotable.d.mts +25 -3
  133. package/dist/contracts/wallet-protocol.d.mts +52 -0
  134. package/dist/contracts/wallet-protocol.mjs +52 -0
  135. package/dist/contracts/wallet-protocol.mjs.map +1 -0
  136. package/dist/index.d.mts +26 -25
  137. package/dist/index.mjs +20 -13
  138. package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
  139. package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
  140. package/dist/orchestrators/codegen/bindings.d.mts +1 -2
  141. package/dist/orchestrators/codegen/bindings.mjs +52 -186
  142. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/emit.mjs +19 -1
  144. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  145. package/dist/orchestrators/codegen/errors.mjs +8 -3
  146. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/format.mjs +47 -39
  148. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/gitignore.mjs +3 -1
  150. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  151. package/dist/orchestrators/codegen/output-location.mjs +40 -0
  152. package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
  153. package/dist/orchestrators/codegen/paths.d.mts +1 -1
  154. package/dist/orchestrators/codegen/paths.mjs +40 -14
  155. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  156. package/dist/orchestrators/codegen/permissions.mjs +3 -1
  157. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  158. package/dist/orchestrators/codegen/service.mjs +157 -105
  159. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  160. package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
  161. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
  162. package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
  163. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
  164. package/dist/orchestrators/router/cleanup.mjs +26 -27
  165. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  166. package/dist/orchestrators/router/entrypoints.mjs +2 -2
  167. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  168. package/dist/orchestrators/router/file-provider.mjs +14 -5
  169. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  170. package/dist/orchestrators/router/hostname.mjs +19 -55
  171. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  172. package/dist/orchestrators/router/index.mjs +11 -0
  173. package/dist/orchestrators/router/profile.mjs +2 -2
  174. package/dist/orchestrators/router/sentinels.mjs +26 -0
  175. package/dist/orchestrators/router/sentinels.mjs.map +1 -0
  176. package/dist/orchestrators/router/service.mjs +40 -37
  177. package/dist/orchestrators/router/service.mjs.map +1 -1
  178. package/dist/orchestrators/router/traefik-container.mjs +27 -16
  179. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  180. package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
  181. package/dist/orchestrators/run.mjs.map +1 -0
  182. package/dist/orchestrators/runtime-composition.d.mts +1 -1
  183. package/dist/orchestrators/runtime-composition.mjs +123 -39
  184. package/dist/orchestrators/runtime-composition.mjs.map +1 -1
  185. package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
  186. package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
  187. package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
  188. package/dist/orchestrators/snapshot/capture.mjs +42 -28
  189. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  190. package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
  191. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  192. package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
  193. package/dist/orchestrators/snapshot/index.mjs +13 -0
  194. package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
  195. package/dist/orchestrators/snapshot/integrity.mjs +73 -17
  196. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  197. package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
  198. package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
  199. package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
  200. package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
  201. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
  202. package/dist/orchestrators/snapshot/prune.mjs +20 -55
  203. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  204. package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
  205. package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
  206. package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
  207. package/dist/orchestrators/snapshot/restore.mjs +118 -84
  208. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  209. package/dist/orchestrators/snapshot/service.mjs +53 -56
  210. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  211. package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
  212. package/dist/orchestrators/snapshot/state-document.mjs +47 -7
  213. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
  214. package/dist/orchestrators/snapshot/wipe.mjs +67 -10
  215. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  216. package/dist/plugins/account/codegen.mjs +9 -8
  217. package/dist/plugins/account/codegen.mjs.map +1 -1
  218. package/dist/plugins/account/errors.d.mts +33 -6
  219. package/dist/plugins/account/errors.mjs.map +1 -1
  220. package/dist/plugins/account/funding.d.mts +29 -19
  221. package/dist/plugins/account/funding.mjs +84 -66
  222. package/dist/plugins/account/funding.mjs.map +1 -1
  223. package/dist/plugins/account/index.d.mts +2 -4
  224. package/dist/plugins/account/index.mjs +64 -31
  225. package/dist/plugins/account/index.mjs.map +1 -1
  226. package/dist/plugins/account/keypair.mjs +6 -9
  227. package/dist/plugins/account/keypair.mjs.map +1 -1
  228. package/dist/plugins/account/lease.mjs +1 -0
  229. package/dist/plugins/account/lease.mjs.map +1 -1
  230. package/dist/plugins/account/registry.d.mts +14 -1
  231. package/dist/plugins/account/registry.mjs +18 -18
  232. package/dist/plugins/account/registry.mjs.map +1 -1
  233. package/dist/plugins/account/service.d.mts +23 -4
  234. package/dist/plugins/account/service.mjs +83 -45
  235. package/dist/plugins/account/service.mjs.map +1 -1
  236. package/dist/plugins/account/snapshot.mjs +2 -5
  237. package/dist/plugins/account/snapshot.mjs.map +1 -1
  238. package/dist/plugins/account/spans.mjs +16 -0
  239. package/dist/plugins/account/spans.mjs.map +1 -0
  240. package/dist/plugins/account/variants/keystore.mjs +6 -8
  241. package/dist/plugins/account/variants/keystore.mjs.map +1 -1
  242. package/dist/plugins/action/build-context.d.mts +3 -2
  243. package/dist/plugins/action/errors.d.mts +16 -12
  244. package/dist/plugins/action/errors.mjs.map +1 -1
  245. package/dist/plugins/action/execute.mjs +65 -103
  246. package/dist/plugins/action/execute.mjs.map +1 -1
  247. package/dist/plugins/action/index.d.mts +0 -2
  248. package/dist/plugins/action/index.mjs +17 -13
  249. package/dist/plugins/action/index.mjs.map +1 -1
  250. package/dist/plugins/action/service.mjs +38 -35
  251. package/dist/plugins/action/service.mjs.map +1 -1
  252. package/dist/plugins/action/spans.mjs +11 -0
  253. package/dist/plugins/action/spans.mjs.map +1 -0
  254. package/dist/plugins/coin/codegen.mjs +9 -8
  255. package/dist/plugins/coin/codegen.mjs.map +1 -1
  256. package/dist/plugins/coin/discovery.mjs +8 -4
  257. package/dist/plugins/coin/discovery.mjs.map +1 -1
  258. package/dist/plugins/coin/index.d.mts +11 -29
  259. package/dist/plugins/coin/index.mjs +56 -27
  260. package/dist/plugins/coin/index.mjs.map +1 -1
  261. package/dist/plugins/coin/metadata.mjs +8 -15
  262. package/dist/plugins/coin/metadata.mjs.map +1 -1
  263. package/dist/plugins/coin/mint.d.mts +30 -11
  264. package/dist/plugins/coin/mint.mjs +78 -74
  265. package/dist/plugins/coin/mint.mjs.map +1 -1
  266. package/dist/plugins/coin/registry.mjs +4 -7
  267. package/dist/plugins/coin/registry.mjs.map +1 -1
  268. package/dist/plugins/coin/service.d.mts +39 -1
  269. package/dist/plugins/coin/service.mjs +11 -4
  270. package/dist/plugins/coin/service.mjs.map +1 -1
  271. package/dist/plugins/coin/spans.mjs +20 -0
  272. package/dist/plugins/coin/spans.mjs.map +1 -0
  273. package/dist/plugins/dashboard/domain.mjs +402 -0
  274. package/dist/plugins/dashboard/domain.mjs.map +1 -0
  275. package/dist/plugins/dashboard/index.d.mts +29 -0
  276. package/dist/plugins/dashboard/index.mjs +91 -0
  277. package/dist/plugins/dashboard/index.mjs.map +1 -0
  278. package/dist/plugins/dashboard/origin-policy.mjs +36 -0
  279. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
  280. package/dist/plugins/dashboard/routable.mjs +27 -0
  281. package/dist/plugins/dashboard/routable.mjs.map +1 -0
  282. package/dist/plugins/dashboard/schema/builder.mjs +21 -0
  283. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
  284. package/dist/plugins/dashboard/schema/enums.mjs +72 -0
  285. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
  286. package/dist/plugins/dashboard/schema/root.mjs +351 -0
  287. package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
  288. package/dist/plugins/dashboard/schema/types.mjs +508 -0
  289. package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
  290. package/dist/plugins/dashboard/schema.mjs +11 -0
  291. package/dist/plugins/dashboard/schema.mjs.map +1 -0
  292. package/dist/plugins/dashboard/server.mjs +166 -0
  293. package/dist/plugins/dashboard/server.mjs.map +1 -0
  294. package/dist/plugins/deepbook/deploy.mjs +53 -115
  295. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  296. package/dist/plugins/deepbook/errors.mjs +1 -0
  297. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  298. package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
  299. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  300. package/dist/plugins/deepbook/hash.mjs +9 -0
  301. package/dist/plugins/deepbook/hash.mjs.map +1 -0
  302. package/dist/plugins/deepbook/index.d.mts +1 -10
  303. package/dist/plugins/deepbook/index.mjs +25 -22
  304. package/dist/plugins/deepbook/index.mjs.map +1 -1
  305. package/dist/plugins/deepbook/pyth/index.mjs +26 -55
  306. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  307. package/dist/plugins/deepbook/snapshot.mjs +17 -29
  308. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  309. package/dist/plugins/deepbook/spans.mjs +18 -0
  310. package/dist/plugins/deepbook/spans.mjs.map +1 -0
  311. package/dist/plugins/deepbook/type-strings.mjs +65 -0
  312. package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
  313. package/dist/plugins/deepbook/types.d.mts +2 -3
  314. package/dist/plugins/deepbook/types.mjs.map +1 -1
  315. package/dist/plugins/faucet/dispatcher.d.mts +21 -2
  316. package/dist/plugins/faucet/dispatcher.mjs +1 -2
  317. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  318. package/dist/plugins/faucet/errors.d.mts +11 -24
  319. package/dist/plugins/faucet/errors.mjs.map +1 -1
  320. package/dist/plugins/faucet/http.mjs +33 -14
  321. package/dist/plugins/faucet/http.mjs.map +1 -1
  322. package/dist/plugins/faucet/index.d.mts +15 -5
  323. package/dist/plugins/faucet/index.mjs +3 -0
  324. package/dist/plugins/faucet/index.mjs.map +1 -1
  325. package/dist/plugins/faucet/spans.mjs +12 -0
  326. package/dist/plugins/faucet/spans.mjs.map +1 -0
  327. package/dist/plugins/host-service/errors.d.mts +1 -1
  328. package/dist/plugins/host-service/index.mjs +34 -8
  329. package/dist/plugins/host-service/index.mjs.map +1 -1
  330. package/dist/plugins/host-service/routable.mjs +2 -1
  331. package/dist/plugins/host-service/routable.mjs.map +1 -1
  332. package/dist/plugins/host-service/service.d.mts +21 -0
  333. package/dist/plugins/host-service/service.mjs +136 -81
  334. package/dist/plugins/host-service/service.mjs.map +1 -1
  335. package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
  336. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
  337. package/dist/plugins/internal/codegen-helpers.mjs +18 -0
  338. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
  339. package/dist/plugins/internal/funding-failure-error.mjs +32 -0
  340. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
  341. package/dist/plugins/package/build.mjs +1 -1
  342. package/dist/plugins/package/build.mjs.map +1 -1
  343. package/dist/plugins/package/codegen.mjs +26 -0
  344. package/dist/plugins/package/codegen.mjs.map +1 -1
  345. package/dist/plugins/package/errors.d.mts +16 -6
  346. package/dist/plugins/package/errors.mjs.map +1 -1
  347. package/dist/plugins/package/index.d.mts +0 -4
  348. package/dist/plugins/package/index.mjs +27 -21
  349. package/dist/plugins/package/index.mjs.map +1 -1
  350. package/dist/plugins/package/mode-known.mjs +26 -12
  351. package/dist/plugins/package/mode-known.mjs.map +1 -1
  352. package/dist/plugins/package/mode-local.mjs +47 -41
  353. package/dist/plugins/package/mode-local.mjs.map +1 -1
  354. package/dist/plugins/package/publish-executor.mjs +55 -114
  355. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  356. package/dist/plugins/package/registry.mjs +2 -1
  357. package/dist/plugins/package/registry.mjs.map +1 -1
  358. package/dist/plugins/package/service.mjs.map +1 -1
  359. package/dist/plugins/package/spans.mjs +14 -0
  360. package/dist/plugins/package/spans.mjs.map +1 -0
  361. package/dist/plugins/postgres/db-ensure.mjs +19 -12
  362. package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
  363. package/dist/plugins/postgres/errors.d.mts +5 -0
  364. package/dist/plugins/postgres/errors.mjs.map +1 -1
  365. package/dist/plugins/postgres/index.mjs +10 -17
  366. package/dist/plugins/postgres/index.mjs.map +1 -1
  367. package/dist/plugins/postgres/service.mjs +58 -24
  368. package/dist/plugins/postgres/service.mjs.map +1 -1
  369. package/dist/plugins/postgres/snapshot.mjs.map +1 -1
  370. package/dist/plugins/postgres/spans.mjs +11 -0
  371. package/dist/plugins/postgres/spans.mjs.map +1 -0
  372. package/dist/plugins/router-entrypoints.mjs +4 -4
  373. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
  375. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
  377. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  378. package/dist/plugins/seal/codegen.d.mts +2 -3
  379. package/dist/plugins/seal/codegen.mjs.map +1 -1
  380. package/dist/plugins/seal/config-render.mjs +35 -8
  381. package/dist/plugins/seal/config-render.mjs.map +1 -1
  382. package/dist/plugins/seal/deploy.mjs +31 -39
  383. package/dist/plugins/seal/deploy.mjs.map +1 -1
  384. package/dist/plugins/seal/errors.d.mts +1 -3
  385. package/dist/plugins/seal/errors.mjs +7 -1
  386. package/dist/plugins/seal/errors.mjs.map +1 -1
  387. package/dist/plugins/seal/index.d.mts +1 -6
  388. package/dist/plugins/seal/index.mjs +40 -14
  389. package/dist/plugins/seal/index.mjs.map +1 -1
  390. package/dist/plugins/seal/key-manager.d.mts +1 -9
  391. package/dist/plugins/seal/key-manager.mjs +2 -18
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  393. package/dist/plugins/seal/key-server.mjs +37 -36
  394. package/dist/plugins/seal/key-server.mjs.map +1 -1
  395. package/dist/plugins/seal/keygen.mjs +16 -17
  396. package/dist/plugins/seal/keygen.mjs.map +1 -1
  397. package/dist/plugins/seal/mode/fork-known.mjs +36 -14
  398. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  399. package/dist/plugins/seal/mode/live.d.mts +6 -4
  400. package/dist/plugins/seal/mode/live.mjs +14 -21
  401. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  402. package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
  403. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  404. package/dist/plugins/seal/registry-publish.mjs +1 -0
  405. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  406. package/dist/plugins/seal/routable.mjs.map +1 -1
  407. package/dist/plugins/seal/service.mjs.map +1 -1
  408. package/dist/plugins/seal/spans.mjs +18 -0
  409. package/dist/plugins/seal/spans.mjs.map +1 -0
  410. package/dist/plugins/sui/auto-tick.mjs +17 -23
  411. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  412. package/dist/plugins/sui/chain-build-container.mjs +18 -0
  413. package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
  414. package/dist/plugins/sui/chain-probe.d.mts +5 -5
  415. package/dist/plugins/sui/chain-probe.mjs +28 -58
  416. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  417. package/dist/plugins/sui/codegen.mjs +26 -0
  418. package/dist/plugins/sui/codegen.mjs.map +1 -1
  419. package/dist/plugins/sui/errors.d.mts +2 -29
  420. package/dist/plugins/sui/errors.mjs +1 -3
  421. package/dist/plugins/sui/errors.mjs.map +1 -1
  422. package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
  423. package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
  424. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
  425. package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
  426. package/dist/plugins/sui/fork-orchestration.mjs +170 -2
  427. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  428. package/dist/plugins/sui/fork-transaction.d.mts +2 -0
  429. package/dist/plugins/sui/fork-transaction.mjs +92 -28
  430. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  431. package/dist/plugins/sui/index.d.mts +33 -70
  432. package/dist/plugins/sui/index.mjs +58 -35
  433. package/dist/plugins/sui/index.mjs.map +1 -1
  434. package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
  435. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
  436. package/dist/plugins/sui/mode/external.mjs +7 -13
  437. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  438. package/dist/plugins/sui/mode/fork.mjs +136 -59
  439. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  440. package/dist/plugins/sui/mode/live.mjs +10 -16
  441. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  442. package/dist/plugins/sui/mode/local.mjs +37 -36
  443. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  444. package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
  445. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  446. package/dist/plugins/sui/mode/shared.d.mts +1 -5
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  448. package/dist/plugins/sui/mode/spec.d.mts +18 -0
  449. package/dist/plugins/sui/move-summary-runner.mjs +207 -0
  450. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
  451. package/dist/plugins/sui/network-resolver.d.mts +4 -3
  452. package/dist/plugins/sui/service.mjs.map +1 -1
  453. package/dist/plugins/sui/snapshot.mjs +3 -0
  454. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  455. package/dist/plugins/sui/spans.mjs +17 -0
  456. package/dist/plugins/sui/spans.mjs.map +1 -0
  457. package/dist/plugins/wallet/codegen.d.mts +0 -1
  458. package/dist/plugins/wallet/codegen.mjs +8 -9
  459. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  460. package/dist/plugins/wallet/index.d.mts +6 -8
  461. package/dist/plugins/wallet/index.mjs +46 -35
  462. package/dist/plugins/wallet/index.mjs.map +1 -1
  463. package/dist/plugins/wallet/origin-policy.mjs +12 -28
  464. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  465. package/dist/plugins/wallet/pairing.mjs +6 -4
  466. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  467. package/dist/plugins/wallet/protocol.d.mts +1 -0
  468. package/dist/plugins/wallet/protocol.mjs +5 -44
  469. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  470. package/dist/plugins/wallet/routable.mjs +2 -8
  471. package/dist/plugins/wallet/routable.mjs.map +1 -1
  472. package/dist/plugins/wallet/server.mjs +36 -44
  473. package/dist/plugins/wallet/server.mjs.map +1 -1
  474. package/dist/plugins/wallet/service.d.mts +1 -5
  475. package/dist/plugins/wallet/service.mjs +22 -18
  476. package/dist/plugins/wallet/service.mjs.map +1 -1
  477. package/dist/plugins/wallet/spans.mjs +22 -0
  478. package/dist/plugins/wallet/spans.mjs.map +1 -0
  479. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
  480. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  481. package/dist/plugins/walrus/codegen.d.mts +3 -3
  482. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  483. package/dist/plugins/walrus/deploy-paths.mjs +21 -5
  484. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  485. package/dist/plugins/walrus/deploy.mjs +67 -69
  486. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  487. package/dist/plugins/walrus/errors.mjs +1 -0
  488. package/dist/plugins/walrus/errors.mjs.map +1 -1
  489. package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
  490. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  491. package/dist/plugins/walrus/index.d.mts +2 -13
  492. package/dist/plugins/walrus/index.mjs +18 -23
  493. package/dist/plugins/walrus/index.mjs.map +1 -1
  494. package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
  495. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  496. package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
  497. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  498. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  499. package/dist/plugins/walrus/routable.mjs +7 -23
  500. package/dist/plugins/walrus/routable.mjs.map +1 -1
  501. package/dist/plugins/walrus/service.mjs.map +1 -1
  502. package/dist/plugins/walrus/spans.mjs +18 -0
  503. package/dist/plugins/walrus/spans.mjs.map +1 -0
  504. package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
  505. package/dist/plugins/walrus/storage-nodes.mjs +15 -8
  506. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  507. package/dist/plugins/walrus/wal-swap.mjs +58 -15
  508. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  509. package/dist/primitives/artifact-publisher.d.mts +1 -1
  510. package/dist/primitives/artifact-publisher.mjs +15 -0
  511. package/dist/primitives/artifact-publisher.mjs.map +1 -0
  512. package/dist/runtime/docker/client.mjs +17 -4
  513. package/dist/runtime/docker/client.mjs.map +1 -1
  514. package/dist/runtime/docker/container.mjs +219 -132
  515. package/dist/runtime/docker/container.mjs.map +1 -1
  516. package/dist/runtime/docker/errors.mjs +0 -6
  517. package/dist/runtime/docker/errors.mjs.map +1 -1
  518. package/dist/runtime/docker/exec.mjs +21 -18
  519. package/dist/runtime/docker/exec.mjs.map +1 -1
  520. package/dist/runtime/docker/image.mjs +36 -13
  521. package/dist/runtime/docker/image.mjs.map +1 -1
  522. package/dist/runtime/docker/index.mjs +14 -0
  523. package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
  524. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
  525. package/dist/runtime/docker/inventory.mjs +14 -11
  526. package/dist/runtime/docker/inventory.mjs.map +1 -1
  527. package/dist/runtime/docker/labels.mjs +38 -5
  528. package/dist/runtime/docker/labels.mjs.map +1 -1
  529. package/dist/runtime/docker/logs.d.mts +1 -1
  530. package/dist/runtime/docker/logs.mjs.map +1 -1
  531. package/dist/runtime/docker/network.mjs +83 -47
  532. package/dist/runtime/docker/network.mjs.map +1 -1
  533. package/dist/runtime/docker/render-run-args.mjs +82 -0
  534. package/dist/runtime/docker/render-run-args.mjs.map +1 -0
  535. package/dist/runtime/docker/service.d.mts +1 -1
  536. package/dist/runtime/docker/service.mjs +12 -7
  537. package/dist/runtime/docker/service.mjs.map +1 -1
  538. package/dist/runtime/docker/sweep.mjs +118 -43
  539. package/dist/runtime/docker/sweep.mjs.map +1 -1
  540. package/dist/runtime/docker/volume.mjs +2 -0
  541. package/dist/runtime/docker/volume.mjs.map +1 -1
  542. package/dist/runtime/docker/wrap.mjs +30 -1
  543. package/dist/runtime/docker/wrap.mjs.map +1 -1
  544. package/dist/substrate/cross-process.mjs +14 -8
  545. package/dist/substrate/cross-process.mjs.map +1 -1
  546. package/dist/substrate/event-time.mjs +33 -0
  547. package/dist/substrate/event-time.mjs.map +1 -0
  548. package/dist/substrate/events.d.mts +28 -8
  549. package/dist/substrate/identity.d.mts +2 -1
  550. package/dist/substrate/manifest.d.mts +68 -5
  551. package/dist/substrate/manifest.mjs +34 -5
  552. package/dist/substrate/manifest.mjs.map +1 -1
  553. package/dist/substrate/network.d.mts +3 -5
  554. package/dist/substrate/options.d.mts +0 -2
  555. package/dist/substrate/plugin.d.mts +13 -0
  556. package/dist/substrate/plugin.mjs +4 -2
  557. package/dist/substrate/plugin.mjs.map +1 -1
  558. package/dist/substrate/projection.d.mts +35 -3
  559. package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
  560. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
  561. package/dist/substrate/runtime/atomic-write.mjs +97 -32
  562. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  563. package/dist/substrate/runtime/cache/index.mjs +3 -0
  564. package/dist/substrate/runtime/cache/schema.mjs +2 -2
  565. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  566. package/dist/substrate/runtime/cache/service.mjs +9 -7
  567. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  568. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
  569. package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
  570. package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
  571. package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
  572. package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
  573. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
  574. package/dist/substrate/runtime/config-validation.d.mts +1 -13
  575. package/dist/substrate/runtime/config-validation.mjs +2 -91
  576. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  577. package/dist/substrate/runtime/container-runtime.d.mts +1 -0
  578. package/dist/substrate/runtime/container-runtime.mjs +2 -0
  579. package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
  580. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
  581. package/dist/substrate/runtime/control-plane/service.mjs +7 -0
  582. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
  583. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
  584. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  585. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
  586. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  587. package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
  588. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
  589. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  590. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
  591. package/dist/substrate/runtime/cross-process/index.mjs +11 -0
  592. package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
  593. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
  594. package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
  595. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  596. package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
  597. package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
  598. package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
  599. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
  600. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
  601. package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
  602. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  603. package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
  604. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
  605. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
  606. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
  607. package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
  608. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  609. package/dist/substrate/runtime/current-plugin.mjs +2 -2
  610. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  611. package/dist/substrate/runtime/errors.mjs +12 -6
  612. package/dist/substrate/runtime/errors.mjs.map +1 -1
  613. package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
  614. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
  615. package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
  616. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
  617. package/dist/substrate/runtime/host-gateway.mjs +20 -0
  618. package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
  619. package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
  620. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  621. package/dist/substrate/runtime/http-probe.d.mts +1 -1
  622. package/dist/substrate/runtime/index.mjs +14 -0
  623. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
  624. package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
  625. package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
  626. package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
  627. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  628. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
  629. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  630. package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
  631. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
  632. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
  633. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  634. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
  635. package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
  636. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  637. package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
  638. package/dist/substrate/runtime/managed-container.d.mts +19 -1
  639. package/dist/substrate/runtime/managed-container.mjs +20 -1
  640. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  641. package/dist/substrate/runtime/manifest/index.mjs +3 -0
  642. package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
  643. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  644. package/dist/substrate/runtime/mode-errors.mjs +20 -0
  645. package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
  646. package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
  647. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  648. package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
  649. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
  650. package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
  651. package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
  652. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
  653. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  654. package/dist/substrate/runtime/observability/index.mjs +13 -0
  655. package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
  656. package/dist/substrate/runtime/observability/log-store.mjs +175 -0
  657. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
  658. package/dist/substrate/runtime/observability/logger.d.mts +2 -1
  659. package/dist/substrate/runtime/observability/logger.mjs +5 -9
  660. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  661. package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
  662. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
  663. package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
  664. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  665. package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
  666. package/dist/substrate/runtime/observability/redaction.mjs +8 -14
  667. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  668. package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
  669. package/dist/substrate/runtime/observability/span-store.mjs +110 -0
  670. package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
  671. package/dist/substrate/runtime/observability/spans.mjs +14 -14
  672. package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
  673. package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
  674. package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
  675. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
  676. package/dist/substrate/runtime/paths.d.mts +1 -1
  677. package/dist/substrate/runtime/paths.mjs +4 -3
  678. package/dist/substrate/runtime/paths.mjs.map +1 -1
  679. package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
  680. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
  681. package/dist/substrate/runtime/port-broker/index.mjs +3 -0
  682. package/dist/substrate/runtime/port-broker/service.mjs +170 -126
  683. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  684. package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
  685. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  686. package/dist/substrate/runtime/probes.d.mts +7 -5
  687. package/dist/substrate/runtime/probes.mjs +3 -1
  688. package/dist/substrate/runtime/probes.mjs.map +1 -1
  689. package/dist/substrate/runtime/projection/index.mjs +4 -0
  690. package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
  691. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  692. package/dist/substrate/runtime/projection/persisted.mjs +33 -15
  693. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
  694. package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
  695. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  696. package/dist/substrate/runtime/projection/update.mjs +88 -24
  697. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  698. package/dist/substrate/runtime/random-suffix.mjs +11 -0
  699. package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
  700. package/dist/substrate/runtime/retry-policy.d.mts +59 -1
  701. package/dist/substrate/runtime/retry-policy.mjs +66 -1
  702. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  703. package/dist/substrate/runtime/routed-url.d.mts +1 -0
  704. package/dist/substrate/runtime/routed-url.mjs +79 -0
  705. package/dist/substrate/runtime/routed-url.mjs.map +1 -0
  706. package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
  707. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  708. package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
  709. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  710. package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
  711. package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
  712. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
  713. package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
  714. package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
  715. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
  716. package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
  717. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  718. package/dist/substrate/runtime/state-store/index.d.mts +1 -0
  719. package/dist/substrate/runtime/state-store/index.mjs +3 -0
  720. package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
  721. package/dist/substrate/runtime/state-store/schema.mjs +19 -14
  722. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
  723. package/dist/substrate/runtime/state-store/service.d.mts +1 -0
  724. package/dist/substrate/runtime/state-store/service.mjs +145 -0
  725. package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
  726. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
  727. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
  728. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
  729. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
  730. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  731. package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
  732. package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
  733. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  734. package/dist/substrate/runtime/subnet-broker.mjs +60 -0
  735. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
  736. package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
  737. package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
  738. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
  739. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
  740. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
  741. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
  742. package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
  743. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
  744. package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
  745. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
  746. package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
  747. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
  748. package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
  749. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
  750. package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
  751. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
  752. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
  753. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
  754. package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
  755. package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
  756. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
  757. package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
  758. package/dist/substrate/runtime/supervisor/index.mjs +3 -0
  759. package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
  760. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
  761. package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
  762. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
  763. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
  764. package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
  765. package/dist/substrate/runtime/supervisor/state.mjs +22 -0
  766. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
  767. package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
  768. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
  769. package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
  770. package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
  771. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
  772. package/dist/substrate/runtime/typed-env.mjs +8 -0
  773. package/dist/substrate/runtime/typed-env.mjs.map +1 -0
  774. package/dist/substrate/state-store.d.mts +1 -0
  775. package/dist/substrate/versioned-doc-schema.mjs +17 -0
  776. package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
  777. package/dist/substrate/versioned-doc-sync.mjs +94 -0
  778. package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
  779. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  780. package/dist/surfaces/cli/commands/index.mjs +9 -0
  781. package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
  782. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
  783. package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
  784. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  785. package/dist/surfaces/cli/commands/prune.mjs +34 -17
  786. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  787. package/dist/surfaces/cli/commands/status.mjs +2 -2
  788. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  789. package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
  790. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  791. package/dist/surfaces/cli/commands/wipe.mjs +38 -4
  792. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  793. package/dist/surfaces/cli/errors.mjs +1 -1
  794. package/dist/surfaces/cli/errors.mjs.map +1 -1
  795. package/dist/surfaces/cli/flags.mjs +0 -1
  796. package/dist/surfaces/cli/flags.mjs.map +1 -1
  797. package/dist/surfaces/cli/index.mjs +98 -18
  798. package/dist/surfaces/cli/index.mjs.map +1 -1
  799. package/dist/surfaces/cli/output.mjs +1 -0
  800. package/dist/surfaces/cli/output.mjs.map +1 -1
  801. package/dist/surfaces/cli/sysexits.mjs +2 -1
  802. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  803. package/dist/surfaces/tui/app.mjs +25 -3
  804. package/dist/surfaces/tui/app.mjs.map +1 -1
  805. package/dist/surfaces/tui/display-derivation.mjs +23 -74
  806. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  807. package/dist/surfaces/tui/event-log.mjs +35 -23
  808. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  809. package/dist/surfaces/tui/input.mjs +5 -1
  810. package/dist/surfaces/tui/input.mjs.map +1 -1
  811. package/dist/surfaces/tui/plain-renderer.mjs +70 -34
  812. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  813. package/package.json +24 -4
  814. package/dist/contracts/liveness-classifier.d.mts +0 -19
  815. package/dist/contracts/network-resolver.d.mts +0 -15
  816. package/dist/contracts/network-resolver.mjs +0 -7
  817. package/dist/contracts/network-resolver.mjs.map +0 -1
  818. package/dist/orchestrators/codegen/extras.mjs +0 -16
  819. package/dist/orchestrators/codegen/extras.mjs.map +0 -1
  820. package/dist/plugins/deepbook/routable.mjs +0 -21
  821. package/dist/plugins/deepbook/routable.mjs.map +0 -1
  822. package/dist/plugins/faucet/service.d.mts +0 -20
  823. package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
  824. package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
  825. package/dist/plugins/sui/seed-objects.d.mts +0 -18
  826. package/dist/plugins/sui/seed-objects.mjs +0 -25
  827. package/dist/plugins/sui/seed-objects.mjs.map +0 -1
  828. package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
  829. package/dist/substrate/runtime/context-helpers.mjs +0 -32
  830. package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
  831. package/dist/substrate/runtime/run.mjs.map +0 -1
  832. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
  833. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
  834. package/dist/substrate/runtime/supervisor.d.mts +0 -1
  835. package/dist/substrate/runtime/supervisor.mjs +0 -831
  836. package/dist/substrate/runtime/supervisor.mjs.map +0 -1
  837. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
  838. /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.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 FIVE capability decls:\n//\n// 1. `chain-probe:<chainId>` strategy contributor — the\n// schema-validated read surface (`makeSuiChainProbe`).\n// 2. `gate:funds-ready` strategy contributor — the funds-\n// transferable gate. No-op on faucet-less networks.\n// 3. `sui:seed-objects` strategy contributor — the per-instance\n// seed-objects accumulator (fork mode only; emits an empty\n// accumulator on other modes for shape uniformity).\n// 4. Snapshotable — mode-aware container + bind-mount capture.\n// 5. Codegenable — `sui-network` bindings (chain id, rpc, etc.).\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 { FUNDS_READY_GATE_KEY } from '../../contracts/network-resolver.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 {\n\tLeaseBrokerService,\n\ttype LeaseBroker,\n} 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 {\n\tmakeSeedObjectsAccumulator,\n\tSEED_OBJECTS_CAPABILITY_KEY,\n\ttype SeedObjectsAccumulator,\n} from './seed-objects.ts';\nimport { bootSuiService } from './service.ts';\nimport { SUI_ERROR_TAGS, type SuiPluginError } from './errors.ts';\nimport { makeSuiForkRoutables, makeSuiLocalRoutables } from './routable.ts';\nimport { faucetCapabilityKey } from '../faucet/dispatcher.ts';\nimport { suiLocalStrategy } from '../faucet/strategies/sui-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\treadonly seedObjects: SeedObjectsAccumulator;\n};\n\nconst fundingFaucetLeaseBrokerSymbol: unique symbol = Symbol(\n\t'@mysten-incubation/devstack/sui/fundingFaucetLeaseBroker',\n);\n\ntype SuiResolvedRuntime = SuiResolved & {\n\treadonly [fundingFaucetLeaseBrokerSymbol]: LeaseBroker;\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\nconst buildPlugin = (opts: SuiOptions) => {\n\treturn definePlugin({\n\t\tid: suiResource.id,\n\t\trole: '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 seedObjects = yield* makeSeedObjectsAccumulator();\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\tseedObjects,\n\t\t\t\t\t[fundingFaucetLeaseBrokerSymbol]: fundingFaucetLeaseBroker,\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 fundsReadyContribution: StrategyContributorDecl<\n\t\ttypeof FUNDS_READY_GATE_KEY,\n\t\t{\n\t\t\treadonly waitFundsReady: Effect.Effect<void, SuiPluginError>;\n\t\t}\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: FUNDS_READY_GATE_KEY,\n\t\tstrategy: { waitFundsReady: resolved.waitForTransactionsReady.wait },\n\t\tautoMounted: true,\n\t};\n\n\tconst seedObjectsContribution: StrategyContributorDecl<\n\t\ttypeof SEED_OBJECTS_CAPABILITY_KEY,\n\t\tSeedObjectsAccumulator\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: SEED_OBJECTS_CAPABILITY_KEY,\n\t\tstrategy: resolved.seedObjects,\n\t\tautoMounted: true,\n\t};\n\n\tconst faucetContribution =\n\t\tresolved.fundingFaucetUrl === 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: suiLocalStrategy({\n\t\t\t\t\t\t\tfaucetUrl: resolved.fundingFaucetUrl,\n\t\t\t\t\t\t\tserialization: {\n\t\t\t\t\t\t\t\tbroker: resolvedRuntime[fundingFaucetLeaseBrokerSymbol],\n\t\t\t\t\t\t\t\tkey: `sui-faucet:${realChain}`,\n\t\t\t\t\t\t\t\towner: `sui-faucet:${realChain}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}),\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\tfundsReadyContribution,\n\t\tseedObjectsContribution,\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\tSeedManifestMismatchError,\n\tSuiFundsReadyError,\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\tFUNDS_READY_GATE_KEY,\n\ttype FundsReadyStrategy,\n\ttype FundsReadyError,\n} from '../../contracts/network-resolver.ts';\nexport { SEED_OBJECTS_CAPABILITY_KEY, type SeedObjectsAccumulator } from './seed-objects.ts';\nexport {\n\tFORK_UNSUPPORTED_SURFACES,\n\twrapWithForkGuard,\n\ttype ForkMeta,\n\ttype ForkLockHolder,\n} from './fork-orchestration.ts';\nexport type { SuiProbeKey } from './chain-probe.ts';\n"],"mappings":"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"}
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":"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"}
@@ -1,15 +1,18 @@
1
- import { leaseKey } from "../../../substrate/runtime/lease-broker/service.mjs";
2
- import { requestFundsWithRetry } from "../http.mjs";
1
+ import { leaseKey } from "../../substrate/runtime/lease-broker/service.mjs";
2
+ import "../../substrate/runtime/lease-broker/index.mjs";
3
+ import { SuiSpans } from "./spans.mjs";
4
+ import { requestFundsWithRetry } from "../faucet/http.mjs";
5
+ import "../faucet/index.mjs";
3
6
  import { Effect } from "effect";
4
- //#region src/plugins/faucet/strategies/sui-local.ts
7
+ //#region src/plugins/sui/local-faucet-strategy.ts
5
8
  const withSerialization = (serialization, effect) => {
6
9
  if (serialization === void 0) return effect;
7
10
  return Effect.scoped(Effect.gen(function* () {
8
11
  yield* serialization.broker.acquire(leaseKey(serialization.key), serialization.owner);
9
12
  yield* effect;
10
- })).pipe(Effect.withSpan("faucet.suiLocal.serializedRequest", { attributes: {
11
- "faucet.lease.key": serialization.key,
12
- "faucet.lease.owner": serialization.owner
13
+ })).pipe(Effect.withSpan("devstack.plugin.sui.localFaucet.serializedRequest", { attributes: {
14
+ [SuiSpans.localFaucetLeaseKey]: serialization.key,
15
+ [SuiSpans.localFaucetLeaseOwner]: serialization.owner
13
16
  } }));
14
17
  };
15
18
  /** Build a SUI local-faucet HTTP strategy. */
@@ -26,4 +29,4 @@ const suiLocalStrategy = (opts) => ({ request: ({ address, amount }) => {
26
29
  //#endregion
27
30
  export { suiLocalStrategy };
28
31
 
29
- //# sourceMappingURL=sui-local.mjs.map
32
+ //# sourceMappingURL=local-faucet-strategy.mjs.map
@@ -0,0 +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,4 +1,7 @@
1
+ import { SpanAttr } from "../../../substrate/runtime/observability/spans.mjs";
1
2
  import { suiPluginError } from "../errors.mjs";
3
+ import { formatUnknownError } from "../../../substrate/runtime/format-unknown-error.mjs";
4
+ import { SuiSpans } from "../spans.mjs";
2
5
  import { assembleSuiClient, buildWaitForTransactionsReady, fetchChainId, makeResolvedNetwork, noopWaitForTransactionsReady } from "./shared-boot.mjs";
3
6
  import { Duration, Effect } from "effect";
4
7
  import { SuiGrpcClient } from "@mysten/sui/grpc";
@@ -15,14 +18,14 @@ const bootLocalRpcMode = (opts) => Effect.gen(function* () {
15
18
  baseUrl: opts.rpcUrl,
16
19
  network: "localnet"
17
20
  }),
18
- catch: (cause) => suiPluginError("chain-id-fetch", `sui local-rpc mode: SuiGrpcClient construction failed for rpcUrl=${opts.rpcUrl}: ${stringifyCause(cause)}`, cause)
21
+ catch: (cause) => suiPluginError("chain-id-fetch", `sui local-rpc mode: SuiGrpcClient construction failed for rpcUrl=${opts.rpcUrl}: ${formatUnknownError(cause)}`, cause)
19
22
  });
20
23
  const chain = opts.chain ?? (yield* fetchChainId(sdkClient, {
21
24
  timeout: opts.readyTimeout ?? DEFAULT_EXTERNAL_CHAIN_ID_TIMEOUT,
22
25
  span: "devstack.plugin.sui.localRpc.fetchChainId"
23
26
  }));
24
27
  const waitForTransactionsReady = opts.faucetUrl !== void 0 ? yield* buildWaitForTransactionsReady(opts.faucetUrl) : noopWaitForTransactionsReady;
25
- const { client } = assembleSuiClient({
28
+ const { client } = yield* assembleSuiClient({
26
29
  sdkClient,
27
30
  chain,
28
31
  rpcUrl: opts.rpcUrl,
@@ -42,18 +45,9 @@ const bootLocalRpcMode = (opts) => Effect.gen(function* () {
42
45
  client
43
46
  };
44
47
  }).pipe(Effect.withSpan("devstack.plugin.sui.localRpc.boot", { attributes: {
45
- "devstack.plugin": "sui",
46
- "sui.mode": "local-rpc"
48
+ [SpanAttr.plugin]: "sui",
49
+ [SuiSpans.mode]: "local-rpc"
47
50
  } }));
48
- const stringifyCause = (cause) => {
49
- if (cause instanceof Error) return cause.message;
50
- if (typeof cause === "string") return cause;
51
- try {
52
- return JSON.stringify(cause);
53
- } catch {
54
- return String(cause);
55
- }
56
- };
57
51
  //#endregion
58
52
  export { bootLocalRpcMode };
59
53
 
@@ -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 `NetworkResolver` and a `ChainProbe`\n// but 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// network-resolver contributions at the barrel).\n\nimport { Duration, Effect, type Scope } from 'effect';\n\nimport { SuiGrpcClient } from '@mysten/sui/grpc';\n\nimport { suiPluginError, type SuiPluginError } from '../errors.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, 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}: ${stringifyCause(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 } = 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: { 'devstack.plugin': 'sui', 'sui.mode': 'local-rpc' },\n\t\t}),\n\t);\n\nconst stringifyCause = (cause: unknown): string => {\n\tif (cause instanceof Error) return cause.message;\n\tif (typeof cause === 'string') return cause;\n\ttry {\n\t\treturn JSON.stringify(cause);\n\t} catch {\n\t\treturn String(cause);\n\t}\n};\n"],"mappings":";;;;;;;AAuDA,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,eAAe,MAAM,IACzG,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,kBAAkB;EACpC;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;CAAE,mBAAmB;CAAO,YAAY;CAAa,EACjE,CAAC,CACF;AAEF,MAAM,kBAAkB,UAA2B;AAClD,KAAI,iBAAiB,MAAO,QAAO,MAAM;AACzC,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,KAAI;AACH,SAAO,KAAK,UAAU,MAAM;SACrB;AACP,SAAO,OAAO,MAAM"}
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,34 +1,95 @@
1
- import { renderUrl, routerHostname } from "../../../orchestrators/router/hostname.mjs";
1
+ import { SpanAttr } from "../../../substrate/runtime/observability/spans.mjs";
2
2
  import { ProbeTimeoutError, waitForProbe } from "../../../substrate/runtime/probes.mjs";
3
+ import { setCurrentPluginPhase } from "../../../substrate/runtime/current-plugin.mjs";
4
+ import { DEFAULT_SUI_CLI_VERSION } from "../../../substrate/runtime/sui-move-build/index.mjs";
5
+ import { renderUrl, routedHostname } from "../../../substrate/runtime/routed-url.mjs";
6
+ import { SUI_RPC_ENTRYPOINT_PORT } from "../routable.mjs";
7
+ import { ensureManagedContainer } from "../../../substrate/runtime/managed-container.mjs";
3
8
  import { suiPluginError } from "../errors.mjs";
9
+ import { formatUnknownError } from "../../../substrate/runtime/format-unknown-error.mjs";
10
+ import { SuiSpans } from "../spans.mjs";
4
11
  import { toDockerHostGatewayUrl } from "./shared.mjs";
5
12
  import { assembleSuiClient, fetchChainId, makeResolvedNetwork, noopWaitForTransactionsReady } from "./shared-boot.mjs";
6
- import { ensureManagedContainer } from "../../../substrate/runtime/managed-container.mjs";
13
+ import { extractExecuteDigest } from "../../../substrate/runtime/sui-execute/index.mjs";
7
14
  import { resolveAutoTickIntervalMs, runAutoTickClock } from "../auto-tick.mjs";
8
- import { SUI_RPC_ENTRYPOINT_PORT } from "../routable.mjs";
9
- import { wrapWithForkGuard } from "../fork-orchestration.mjs";
10
- import { verifyForkImpersonationSender } from "../fork-transaction.mjs";
11
- import { DEFAULT_SUI_CLI_VERSION } from "../../../substrate/runtime/sui-move-build/index.mjs";
15
+ import { acquireForkDataDirHolder, wrapWithForkGuard } from "../fork-orchestration.mjs";
16
+ import { FORK_IMPERSONATION_GAS_BUDGET, verifyForkImpersonationSender } from "../fork-transaction.mjs";
12
17
  import { Duration, Effect } from "effect";
13
18
  import { createHash } from "node:crypto";
14
19
  import { join, resolve } from "node:path";
15
- import { SuiGrpcClient } from "@mysten/sui/grpc";
16
20
  import { mkdir } from "node:fs/promises";
21
+ import { SuiGrpcClient } from "@mysten/sui/grpc";
22
+ import { fileURLToPath } from "node:url";
17
23
  import { normalizeSuiAddress, normalizeSuiObjectId } from "@mysten/sui/utils";
18
24
  //#region src/plugins/sui/mode/fork.ts
19
25
  /** Default ready-probe timeout for fork-mode cold start. */
20
26
  const DEFAULT_FORK_READY_TIMEOUT = Duration.seconds(180);
21
27
  /** Default Sui repository revision used by the bundled `sui-fork` image build. */
22
28
  const DEFAULT_SUI_FORK_REV = "62ee6ada958cd61b3c8a4466dd33c9aba3cdff8a";
29
+ /** Env var that overrides {@link DEFAULT_FORK_IMAGE_REF} for a single run. */
30
+ const FORK_IMAGE_ENV_VAR = "DEVSTACK_SUI_FORK_IMAGE";
31
+ const prebuiltForkImageRef = () => {
32
+ const fromEnv = process.env[FORK_IMAGE_ENV_VAR]?.trim();
33
+ return fromEnv !== void 0 && fromEnv.length > 0 ? fromEnv : void 0;
34
+ };
23
35
  const DEFAULT_FORK_HOST_RPC_PORT = 51002;
36
+ /** Default impersonation "whale" per upstream — a large-reserve address
37
+ * known to hold a big single SUI coin in the upstream's state, used as
38
+ * the fork faucet funding source when `faucet.whale` is omitted. `null`
39
+ * means no default is known (the faucet then requires an explicit
40
+ * `faucet.whale`). Validated at boot via `selectSufficientForkCoin`. */
41
+ const FORK_DEFAULT_WHALE = {
42
+ mainnet: "0xbc7e7537564bd939b62e5b24477ac00ba8cef33ccec72d63090a080a1253b725",
43
+ testnet: "0xc397477d8b445e6295bc34e593b9a95d5d233cec1a8fe3740d0ab86012a460f6",
44
+ devnet: "0x4296747d0bd91c41b668702bdca0bf769a0e32db66982d986101e7975db55cbe"
45
+ };
46
+ /** Floor a single whale SUI coin must clear at boot to enable the fork faucet:
47
+ * a default ephemeral fund (1 SUI) plus the impersonation gas budget. Set to
48
+ * match the per-request requirement for the default fund so a whale that
49
+ * passes boot can actually satisfy the first auto-fund. */
50
+ const FORK_FAUCET_WHALE_MIN_COIN_MIST = 1000000000n + FORK_IMPERSONATION_GAS_BUDGET;
51
+ /** Resolve the fork faucet whale from options + per-upstream defaults,
52
+ * or `null` when the faucet is disabled / no whale is known. */
53
+ const resolveForkWhale = (opts) => {
54
+ if (opts.faucet?.enabled === false) return null;
55
+ const perRequestCapMist = opts.faucet?.perRequestCapMist ?? 1000000000000n;
56
+ const explicit = opts.faucet?.whale?.trim();
57
+ if (explicit !== void 0 && explicit.length > 0) return {
58
+ whale: normalizeSuiAddress(explicit),
59
+ perRequestCapMist,
60
+ explicit: true
61
+ };
62
+ const fallback = FORK_DEFAULT_WHALE[opts.upstream];
63
+ return fallback === null ? null : {
64
+ whale: normalizeSuiAddress(fallback),
65
+ perRequestCapMist,
66
+ explicit: false
67
+ };
68
+ };
69
+ /** Inject the resolved faucet whale into the fork seed so its coins exist
70
+ * in fork state. MUST run before the data-dir key / container config
71
+ * hash are computed (both fold the seed) so enabling the faucet doesn't
72
+ * silently reuse a whale-less fork data dir. */
73
+ const withForkFaucetSeed = (opts) => {
74
+ const resolved = resolveForkWhale(opts);
75
+ if (resolved === null) return opts;
76
+ return {
77
+ ...opts,
78
+ seed: {
79
+ ...opts.seed ?? {},
80
+ addresses: [...opts.seed?.addresses ?? [], resolved.whale]
81
+ }
82
+ };
83
+ };
24
84
  const DOCKER_PUBLISH_HOST = "0.0.0.0";
25
85
  const CONTAINER_RPC_PORT = SUI_RPC_ENTRYPOINT_PORT;
26
86
  const FORK_CONTAINER_DATA_DIR = "/var/lib/sui-fork";
27
87
  const PROBE_ATTEMPT_TIMEOUT_MS = 3e3;
28
88
  const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(function* () {
29
- const autoTickIntervalMs = resolveAutoTickIntervalMs(opts.autoTick);
30
- const image = yield* resolveForkImage(runtime, opts);
31
- const dataDir = yield* ensureForkDataDir(paths, opts);
89
+ const autoTickIntervalMs = yield* resolveAutoTickIntervalMs(opts.autoTick);
90
+ const seededOpts = withForkFaucetSeed(opts);
91
+ const image = yield* resolveForkImage(runtime, identity, opts);
92
+ const dataDir = yield* ensureForkDataDir(paths, seededOpts);
32
93
  const { handle, ports } = yield* ensureForkContainer({
33
94
  runtime,
34
95
  portBroker,
@@ -41,7 +102,7 @@ const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(
41
102
  },
42
103
  containerName: `devstack-${identity.app}-${identity.stack}-sui-fork`,
43
104
  dataDir,
44
- opts
105
+ opts: seededOpts
45
106
  });
46
107
  const directRpcUrl = `http://127.0.0.1:${pickPublishedPort(ports, handle.ports).hostPort}`;
47
108
  const rpcUrl = yield* routedSuiRpcUrl(identity);
@@ -49,10 +110,10 @@ const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(
49
110
  baseUrl: directRpcUrl,
50
111
  network: opts.upstream
51
112
  });
52
- const status = yield* waitForForkReady(sdkClient, opts.readyTimeout ?? DEFAULT_FORK_READY_TIMEOUT).pipe(Effect.annotateLogs({ "sui.container": handle.name }));
113
+ const status = yield* waitForForkReady(sdkClient, opts.readyTimeout ?? DEFAULT_FORK_READY_TIMEOUT).pipe(Effect.annotateLogs({ [SuiSpans.container]: handle.name }));
53
114
  const chain = yield* fetchChainId(sdkClient, { span: "devstack.plugin.sui.fork.fetchChainId" });
54
115
  const fork = makeForkAdminSurface(sdkClient);
55
- const assembled = assembleSuiClient({
116
+ const assembled = yield* assembleSuiClient({
56
117
  sdkClient,
57
118
  chain,
58
119
  rpcUrl,
@@ -82,31 +143,58 @@ const bootForkMode = (runtime, identity, portBroker, paths, opts) => Effect.gen(
82
143
  client,
83
144
  autoTickIntervalMs
84
145
  };
85
- }).pipe(Effect.withSpan("devstack.plugin.sui.fork.boot", { attributes: { "devstack.plugin": "sui" } }));
146
+ }).pipe(Effect.withSpan("devstack.plugin.sui.fork.boot", { attributes: { [SpanAttr.plugin]: "sui" } }));
86
147
  const suiForkImageBuildContext = (rev = DEFAULT_SUI_FORK_REV) => ({
87
- contextPath: new URL("../../../../images/", import.meta.url).pathname,
148
+ contextPath: fileURLToPath(new URL("../../../../images/", import.meta.url)),
88
149
  dockerfile: "sui-fork/Dockerfile",
89
150
  buildArgs: {
90
151
  SUI_FORK_REV: rev,
91
152
  SUI_CLI_VERSION: DEFAULT_SUI_CLI_VERSION
92
153
  }
93
154
  });
94
- const resolveForkImage = (runtime, opts) => Effect.gen(function* () {
95
- if (opts.image && "pull" in opts.image) {
96
- const pullRef = opts.image.pull;
97
- if (runtime.pullImage === void 0) return yield* Effect.fail(suiPluginError("image-build", `sui fork mode cannot pull image '${pullRef}' because the configured container runtime does not expose image pulls.`));
98
- return yield* runtime.pullImage(pullRef).pipe(Effect.mapError((cause) => suiPluginError("image-build", `sui fork mode failed to pull image '${pullRef}': ${cause.reason}: ${cause.detail}`, cause)));
99
- }
155
+ /** Pull a prebuilt fork image, narrating progress on the supervisor row.
156
+ * Fails with a `SuiPluginError` if the runtime can't pull or the pull errors. */
157
+ const pullForkImage = (runtime, pullRef) => Effect.gen(function* () {
158
+ if (runtime.pullImage === void 0) return yield* Effect.fail(suiPluginError("image-build", `sui fork mode cannot pull image '${pullRef}' because the configured container runtime does not expose image pulls.`));
159
+ yield* setCurrentPluginPhase(`pulling sui-fork image ${pullRef}…`);
160
+ return yield* runtime.pullImage(pullRef).pipe(Effect.mapError((cause) => suiPluginError("image-build", `sui fork mode failed to pull image '${pullRef}': ${cause.reason}: ${cause.detail}`, cause)), Effect.ensuring(setCurrentPluginPhase(null)));
161
+ });
162
+ /** Build the bundled `sui-fork` image from source, narrating the cold
163
+ * compile so the row doesn't look hung for ~10 minutes on first run. */
164
+ const buildForkImage = (runtime, buildCtx) => Effect.gen(function* () {
165
+ yield* setCurrentPluginPhase("building sui-fork image — first run compiles sui-fork from source (~10+ min); cached after");
166
+ return yield* runtime.ensureImage(buildCtx).pipe(Effect.mapError((cause) => suiPluginError("image-build", `sui fork image build failed: ${cause.reason}: ${cause.detail}`, cause)), Effect.ensuring(setCurrentPluginPhase(null)));
167
+ });
168
+ const resolveForkImage = (runtime, identity, opts) => Effect.gen(function* () {
169
+ if (opts.image && "pull" in opts.image) return yield* pullForkImage(runtime, opts.image.pull);
100
170
  const rev = opts.version ?? "62ee6ada958cd61b3c8a4466dd33c9aba3cdff8a";
101
- const buildCtx = opts.image && "build" in opts.image ? {
171
+ const owner = {
172
+ app: identity.app,
173
+ stack: identity.stack,
174
+ plugin: "sui",
175
+ role: "validator"
176
+ };
177
+ if (opts.image && "build" in opts.image) return yield* buildForkImage(runtime, {
102
178
  contextPath: opts.image.build.context,
103
179
  dockerfile: opts.image.build.dockerfile ?? "Dockerfile",
104
180
  buildArgs: {
105
181
  SUI_FORK_REV: rev,
106
182
  SUI_CLI_VERSION: DEFAULT_SUI_CLI_VERSION
107
- }
108
- } : suiForkImageBuildContext(rev);
109
- return yield* runtime.ensureImage(buildCtx).pipe(Effect.mapError((cause) => suiPluginError("image-build", `sui fork image build failed: ${cause.reason}: ${cause.detail}`, cause)));
183
+ },
184
+ owner
185
+ });
186
+ const prebuilt = prebuiltForkImageRef();
187
+ if (prebuilt !== void 0 && runtime.pullImage !== void 0) return yield* pullForkImage(runtime, prebuilt).pipe(Effect.catchTag("SuiPluginError", (cause) => Effect.gen(function* () {
188
+ yield* Effect.logWarning(`sui fork mode: prebuilt image '${prebuilt}' unavailable (${cause.message}); building from source.`);
189
+ return yield* buildForkImage(runtime, {
190
+ ...suiForkImageBuildContext(rev),
191
+ owner
192
+ });
193
+ })));
194
+ return yield* buildForkImage(runtime, {
195
+ ...suiForkImageBuildContext(rev),
196
+ owner
197
+ });
110
198
  }).pipe(Effect.withSpan("devstack.plugin.sui.fork.resolveImage"));
111
199
  const ensureForkContainer = (params) => Effect.gen(function* () {
112
200
  const reusable = params.opts.ports === void 0 ? yield* findReusableForkPort(params.runtime, params.labels, params.containerName) : void 0;
@@ -166,11 +254,11 @@ const allocateForkRpcPort = (portBroker, override) => {
166
254
  const overridePort = override?.[CONTAINER_RPC_PORT];
167
255
  if (overridePort !== void 0) return Effect.succeed(portPublish(CONTAINER_RPC_PORT, overridePort));
168
256
  return portBroker.allocate({
169
- kind: "rpc",
257
+ owner: "sui:fork-rpc",
170
258
  preferredPort: DEFAULT_FORK_HOST_RPC_PORT,
171
259
  probeHost: DOCKER_PUBLISH_HOST
172
260
  }).pipe(Effect.catchTag("PortBrokerError", (cause) => cause.reason === "preferred-busy" ? portBroker.allocate({
173
- kind: "rpc",
261
+ owner: "sui:fork-rpc",
174
262
  probeHost: DOCKER_PUBLISH_HOST
175
263
  }) : Effect.fail(cause)), Effect.map((allocated) => portPublish(CONTAINER_RPC_PORT, allocated.port)), Effect.mapError((cause) => suiPluginError("port-allocate", `sui fork mode: failed to allocate RPC host port: ${cause.detail}`, cause)));
176
264
  };
@@ -187,19 +275,21 @@ const forkDataDirKey = (opts) => createHash("sha256").update(JSON.stringify({
187
275
  version: opts.version ?? "62ee6ada958cd61b3c8a4466dd33c9aba3cdff8a",
188
276
  seed: normalizeForkSeed(opts)
189
277
  })).digest("hex").slice(0, 16);
190
- const ensureForkDataDir = (paths, opts) => {
278
+ /** Bring the data dir into being and claim it against concurrent
279
+ * stacks via the holder protocol. The holder claim is scope-bound —
280
+ * it heartbeats for the stack's lifetime and releases on teardown. */
281
+ const ensureForkDataDir = (paths, opts) => Effect.gen(function* () {
191
282
  const dataDir = resolve(join(paths.stackRoot, "sui-fork", forkDataDirKey(opts)));
192
- return Effect.tryPromise({
193
- try: async () => {
194
- await mkdir(dataDir, {
195
- recursive: true,
196
- mode: 448
197
- });
198
- return dataDir;
199
- },
200
- catch: (cause) => suiPluginError("fork-data-dir", `sui fork mode: failed to create data directory ${dataDir}: ${stringifyCause(cause)}`, cause)
283
+ yield* Effect.tryPromise({
284
+ try: () => mkdir(dataDir, {
285
+ recursive: true,
286
+ mode: 448
287
+ }),
288
+ catch: (cause) => suiPluginError("fork-data-dir", `sui fork mode: failed to create data directory ${dataDir}: ${formatUnknownError(cause)}`, cause)
201
289
  });
202
- };
290
+ yield* acquireForkDataDirHolder(paths.stackLockFile, dataDir);
291
+ return dataDir;
292
+ });
203
293
  const waitForForkReady = (sdkClient, readyTimeout) => Effect.gen(function* () {
204
294
  const readyTimeoutMs = Duration.toMillis(readyTimeout);
205
295
  yield* waitForProbe({
@@ -208,7 +298,7 @@ const waitForForkReady = (sdkClient, readyTimeout) => Effect.gen(function* () {
208
298
  intervalMs: 1e3,
209
299
  attemptTimeoutMs: PROBE_ATTEMPT_TIMEOUT_MS,
210
300
  probe: () => readForkStatus(sdkClient).pipe(Effect.as(true))
211
- }).pipe(Effect.mapError((cause) => cause instanceof ProbeTimeoutError ? suiPluginError("fork-status-probe", `sui fork mode: ForkingService.GetStatus did not become ready within ${readyTimeoutMs}ms.`, cause.lastError ?? cause.lastNotReady ?? cause) : suiPluginError("fork-status-probe", `sui fork mode: ForkingService.GetStatus probe failed: ${stringifyCause(cause)}`, cause)));
301
+ }).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)));
212
302
  return yield* readForkStatus(sdkClient);
213
303
  }).pipe(Effect.withSpan("devstack.plugin.sui.fork.waitForReady"));
214
304
  const makeForkAdminSurface = (sdkClient) => ({
@@ -218,17 +308,17 @@ const makeForkAdminSurface = (sdkClient) => ({
218
308
  }))),
219
309
  advanceClock: (intervalMs) => Effect.tryPromise({
220
310
  try: () => sdkClient.forkingService.advanceClock({ durationMs: BigInt(intervalMs) }).response,
221
- catch: (cause) => suiPluginError("fork-advance-clock", `sui fork mode: advanceClock(${intervalMs}) failed: ${stringifyCause(cause)}`, cause)
311
+ catch: (cause) => suiPluginError("fork-advance-clock", `sui fork mode: advanceClock(${intervalMs}) failed: ${formatUnknownError(cause)}`, cause)
222
312
  }).pipe(Effect.asVoid),
223
313
  advanceCheckpoint: Effect.tryPromise({
224
314
  try: () => sdkClient.forkingService.advanceCheckpoint({}).response,
225
- catch: (cause) => suiPluginError("fork-advance-checkpoint", `sui fork mode: advanceCheckpoint failed: ${stringifyCause(cause)}`, cause)
315
+ catch: (cause) => suiPluginError("fork-advance-checkpoint", `sui fork mode: advanceCheckpoint failed: ${formatUnknownError(cause)}`, cause)
226
316
  }).pipe(Effect.asVoid),
227
317
  impersonate: (sender, tx) => Effect.gen(function* () {
228
318
  if (!(tx instanceof Uint8Array)) return yield* Effect.fail(suiPluginError("fork-impersonate", `sui fork mode: impersonate(${sender}) expected serialized transaction bytes.`));
229
319
  yield* verifyForkImpersonationSender(sender, tx);
230
320
  const raw = yield* Effect.tryPromise({
231
- try: () => sdkClient.executeTransaction({
321
+ try: () => sdkClient.core.executeTransaction({
232
322
  transaction: tx,
233
323
  signatures: [],
234
324
  include: {
@@ -236,7 +326,7 @@ const makeForkAdminSurface = (sdkClient) => ({
236
326
  objectTypes: true
237
327
  }
238
328
  }),
239
- catch: (cause) => suiPluginError("fork-impersonate", `sui fork mode: impersonate(${sender}) failed: ${stringifyCause(cause)}`, cause)
329
+ catch: (cause) => suiPluginError("fork-impersonate", `sui fork mode: impersonate(${sender}) failed: ${formatUnknownError(cause)}`, cause)
240
330
  });
241
331
  const digest = extractExecuteDigest(raw);
242
332
  if (digest === void 0) return yield* Effect.fail(suiPluginError("fork-impersonate", `sui fork mode: impersonate(${sender}) returned no transaction digest.`, raw));
@@ -256,28 +346,15 @@ const readForkStatus = (sdkClient) => Effect.tryPromise({
256
346
  forkedAtCheckpoint: response.forkedAtCheckpoint.toString()
257
347
  };
258
348
  },
259
- catch: (cause) => suiPluginError("fork-status-probe", `sui fork mode: GetStatus failed: ${stringifyCause(cause)}`, cause)
349
+ catch: (cause) => suiPluginError("fork-status-probe", `sui fork mode: GetStatus failed: ${formatUnknownError(cause)}`, cause)
260
350
  });
261
- const routedSuiRpcUrl = (identity) => routerHostname(identity, "rpc").pipe(Effect.map((hostname) => renderUrl({
351
+ const routedSuiRpcUrl = (identity) => routedHostname(identity, "rpc").pipe(Effect.map((hostname) => renderUrl({
262
352
  protocol: "http",
263
353
  hostname,
264
354
  port: SUI_RPC_ENTRYPOINT_PORT
265
355
  })), Effect.mapError((cause) => suiPluginError("container-start", `sui fork mode: failed to construct router RPC URL: ${cause.detail}`, cause)));
266
- const extractExecuteDigest = (raw) => {
267
- const env = raw;
268
- return env.$kind === "FailedTransaction" ? env.FailedTransaction?.digest : env.Transaction?.digest;
269
- };
270
356
  const isFailedTransaction = (raw) => raw.$kind === "FailedTransaction";
271
- const stringifyCause = (cause) => {
272
- if (cause instanceof Error) return cause.message;
273
- if (typeof cause === "string") return cause;
274
- try {
275
- return JSON.stringify(cause);
276
- } catch {
277
- return String(cause);
278
- }
279
- };
280
357
  //#endregion
281
- export { bootForkMode };
358
+ export { FORK_FAUCET_WHALE_MIN_COIN_MIST, bootForkMode, resolveForkWhale };
282
359
 
283
360
  //# sourceMappingURL=fork.mjs.map