@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,9 +1,11 @@
1
1
  import { chainId } from "../../../substrate/brand.mjs";
2
- import { suiPluginError } from "../errors.mjs";
3
2
  import { waitForHttpEndpoint } from "../../../substrate/runtime/http-probe.mjs";
3
+ import { suiConfigError, suiPluginError } from "../errors.mjs";
4
+ import { formatUnknownError } from "../../../substrate/runtime/format-unknown-error.mjs";
5
+ import { SuiSpans } from "../spans.mjs";
4
6
  import { makeSuiChainProbe } from "../chain-probe.mjs";
5
7
  import { toDockerHostGatewayUrl } from "./shared.mjs";
6
- import { Duration, Effect, Ref } from "effect";
8
+ import { Duration, Effect, SynchronizedRef } from "effect";
7
9
  //#region src/plugins/sui/mode/shared-boot.ts
8
10
  /** Default chain-id fetch timeout. The wire latency is the dominant
9
11
  * cost on real RPCs; 30 s is the documented ceiling. */
@@ -22,11 +24,11 @@ const fetchChainId = (sdkClient, opts) => {
22
24
  if (!response.chainId) throw new Error("Chain identifier not found in service info");
23
25
  return response.chainId;
24
26
  }),
25
- catch: (cause) => suiPluginError("chain-id-fetch", `sui chain-id fetch failed: ${stringifyCause(cause)}`, cause)
27
+ catch: (cause) => suiPluginError("chain-id-fetch", `sui chain-id fetch failed: ${formatUnknownError(cause)}`, cause)
26
28
  }).pipe(Effect.timeoutOrElse({
27
29
  duration: timeout,
28
30
  orElse: () => Effect.fail(suiPluginError("chain-id-fetch", `sui chain-id fetch did not respond within ${timeoutMs}ms`))
29
- }), Effect.tap((id) => Effect.annotateCurrentSpan({ "sui.chain": id })), Effect.withSpan(opts?.span ?? "devstack.plugin.sui.fetchChainId"));
31
+ }), Effect.tap((id) => Effect.annotateCurrentSpan({ [SuiSpans.chain]: id })), Effect.withSpan(opts?.span ?? "devstack.plugin.sui.fetchChainId"));
30
32
  };
31
33
  /** Per-attempt and total budget for the `waitForTransactionsReady`
32
34
  * retry loop. The 2 s spacing matches the upstream sui-faucet's
@@ -50,7 +52,7 @@ const FAUCET_PROBE_RECIPIENT = "0x0000000000000000000000000000000000000000000000
50
52
  const buildWaitForTransactionsReady = (faucetUrl, opts) => Effect.gen(function* () {
51
53
  const retrySpacing = opts?.retrySpacing ?? FUNDS_READY_RETRY_SPACING;
52
54
  const timeout = opts?.timeout ?? FUNDS_READY_TIMEOUT;
53
- const ref = yield* Ref.make(null);
55
+ const ref = yield* SynchronizedRef.make(null);
54
56
  const makeProbe = () => waitForHttpEndpoint({
55
57
  endpoint: `${faucetUrl}/v2/gas`,
56
58
  timeoutMs: Duration.toMillis(timeout),
@@ -70,16 +72,10 @@ const buildWaitForTransactionsReady = (faucetUrl, opts) => Effect.gen(function*
70
72
  }
71
73
  return true;
72
74
  }
73
- }).pipe(Effect.mapError((cause) => suiPluginError("wait-funds-ready", `sui faucet at ${faucetUrl} did not become funds-transferable within ${Duration.toMillis(timeout)}ms (still returning body-level Failure or 5xx): ` + stringifyCause(cause), cause)));
75
+ }).pipe(Effect.mapError((cause) => suiPluginError("wait-funds-ready", `sui faucet at ${faucetUrl} did not become funds-transferable within ${Duration.toMillis(timeout)}ms (still returning body-level Failure or 5xx): ` + formatUnknownError(cause), cause)));
74
76
  return {
75
- wait: Effect.gen(function* () {
76
- const existing = yield* Ref.get(ref);
77
- if (existing !== null) return existing;
78
- const cached = yield* Effect.cached(makeProbe());
79
- yield* Ref.set(ref, cached);
80
- return cached;
81
- }).pipe(Effect.flatMap((eff) => eff)),
82
- invalidate: Ref.set(ref, null)
77
+ wait: SynchronizedRef.modifyEffect(ref, (existing) => existing !== null ? Effect.succeed([existing, existing]) : Effect.cached(makeProbe()).pipe(Effect.map((cached) => [cached, cached]))).pipe(Effect.flatMap((eff) => eff)),
78
+ invalidate: SynchronizedRef.set(ref, null)
83
79
  };
84
80
  });
85
81
  /** Trivially-succeeding gate. Used by faucet-less networks (live
@@ -88,103 +84,26 @@ const noopWaitForTransactionsReady = {
88
84
  wait: Effect.void,
89
85
  invalidate: Effect.void
90
86
  };
91
- const SUI_RPC_READ_TIMEOUT_MS = 1e4;
92
- const postJsonRpc = async (rpcUrl, method, params) => {
93
- const controller = new AbortController();
94
- const timeout = setTimeout(() => controller.abort(), SUI_RPC_READ_TIMEOUT_MS);
95
- timeout.unref?.();
96
- try {
97
- const response = await fetch(rpcUrl, {
98
- method: "POST",
99
- headers: { "content-type": "application/json" },
100
- body: JSON.stringify({
101
- jsonrpc: "2.0",
102
- id: 1,
103
- method,
104
- params
105
- }),
106
- signal: controller.signal
107
- });
108
- if (!response.ok) throw new Error(`Sui RPC HTTP ${response.status}`);
109
- const payload = await response.json();
110
- if (payload.error !== void 0) throw new Error(payload.error.message ?? JSON.stringify(payload.error));
111
- if (payload.result === void 0) throw new Error(`Sui RPC ${method} returned no result`);
112
- return payload.result;
113
- } finally {
114
- clearTimeout(timeout);
115
- }
116
- };
117
- const normalizeJsonOwner = (owner) => {
118
- if (owner === "Immutable") return {
119
- $kind: "Immutable",
120
- Immutable: true
121
- };
122
- if (typeof owner !== "object" || owner === null) return {
123
- $kind: "Unknown",
124
- Unknown: owner
125
- };
126
- const record = owner;
127
- if (typeof record.AddressOwner === "string") return {
128
- $kind: "AddressOwner",
129
- AddressOwner: record.AddressOwner
130
- };
131
- if (record.ObjectOwner !== void 0) return {
132
- $kind: "Parent",
133
- Parent: record.ObjectOwner
134
- };
135
- if (record.Shared !== void 0) {
136
- const initialSharedVersion = record.Shared.initialSharedVersion ?? record.Shared.initial_shared_version;
137
- return {
138
- $kind: "Shared",
139
- Shared: { initialSharedVersion: String(initialSharedVersion) }
140
- };
141
- }
142
- if (record.ConsensusAddressOwner !== void 0) return {
143
- $kind: "ConsensusAddressOwner",
144
- ConsensusAddressOwner: record.ConsensusAddressOwner
145
- };
146
- return {
147
- $kind: "Unknown",
148
- Unknown: owner
149
- };
150
- };
151
- const getObjectViaJsonRpc = async (rpcUrl, args) => {
152
- const showContent = args.include?.content === true || args.include?.json === true;
153
- const data = (await postJsonRpc("" + rpcUrl, "sui_getObject", [args.objectId, {
154
- showType: true,
155
- showOwner: true,
156
- showContent
157
- }])).data;
158
- if (data?.objectId === void 0) throw new Error(`object ${args.objectId} not found`);
159
- const object = {
160
- objectId: data.objectId,
161
- version: String(data.version ?? ""),
162
- type: data.type ?? "unknown",
163
- owner: normalizeJsonOwner(data.owner),
164
- ...args.include?.json === true ? { json: data.content?.fields } : {},
165
- ...args.include?.content === true ? { content: data.content } : {}
166
- };
167
- return {
168
- ...object,
169
- object
170
- };
171
- };
172
87
  /** Build the `SuiSdkShim` over a constructed grpc client.
173
88
  * Account/Coin/Wallet read through this seam, so we expose
174
89
  * `executeTransaction` + `waitForTransaction` in addition to the
175
- * read methods needed by the chain probe. */
176
- const makeSdkShim = (sdkClient, rpcUrl) => ({
90
+ * read methods needed by the chain probe.
91
+ *
92
+ * Every read/write goes through `sdkClient.core.*` — the gRPC
93
+ * TransportMethods surface from `@mysten/sui`. JSON-RPC is
94
+ * deprecated; do not reintroduce it. */
95
+ const makeSdkShim = (sdkClient) => ({
177
96
  core: {
178
- getObject: (args) => getObjectViaJsonRpc(rpcUrl, args),
97
+ getObject: (args) => sdkClient.core.getObject(args),
179
98
  getTransaction: (args) => sdkClient.core.getTransaction(args),
180
99
  getBalance: (args) => sdkClient.core.getBalance(args),
181
100
  listCoins: (args) => sdkClient.core.listCoins(args),
182
- executeTransaction: (args) => sdkClient.executeTransaction({
101
+ executeTransaction: (args) => sdkClient.core.executeTransaction({
183
102
  transaction: args.transaction,
184
103
  signatures: [...args.signatures],
185
104
  ...args.include !== void 0 ? { include: args.include } : {}
186
105
  }),
187
- waitForTransaction: (args) => sdkClient.waitForTransaction({
106
+ waitForTransaction: (args) => sdkClient.core.waitForTransaction({
188
107
  digest: args.digest,
189
108
  ...args.timeout !== void 0 ? { timeout: args.timeout } : {}
190
109
  })
@@ -198,10 +117,23 @@ const makeSdkShim = (sdkClient, rpcUrl) => ({
198
117
  * `chain` is accepted as a bare string and branded to `ChainId` at
199
118
  * this single boundary — every consumer downstream reads the
200
119
  * branded shape so capability-key constructors (`chainProbe…`,
201
- * `faucet…`) accept it without a cast. */
202
- const assembleSuiClient = (parts) => {
203
- const sdkShim = makeSdkShim(parts.sdkClient, parts.sdkRpcUrl ?? parts.rpcUrl);
204
- const chainProbe = makeSuiChainProbe(sdkShim, parts.chain);
120
+ * `faucet…`) accept it without a cast.
121
+ *
122
+ * Returns an `Effect` on the `SuiConfigError` channel: the empty-chain
123
+ * guard must surface as a typed, `catchTag`-able failure. Calling it
124
+ * un-yielded as a sync function (as it once was) turned a thrown
125
+ * `SuiConfigError` into a DEFECT inside the mode-boot `Effect.gen`
126
+ * bodies — a hidden crash the channel could never recover (mirrors the
127
+ * fix already applied to `auto-tick.ts`; STYLE_GUIDE §2). */
128
+ const assembleSuiClient = (parts) => Effect.gen(function* () {
129
+ if (typeof parts.chain !== "string" || parts.chain.length === 0) return yield* Effect.fail(suiConfigError({
130
+ field: "chain",
131
+ message: "sui.assembleSuiClient: chain id must be a non-empty string",
132
+ hint: "check fetchChainId / network resolver returned a real chain id"
133
+ }));
134
+ const chain = parts.chain;
135
+ const sdkShim = makeSdkShim(parts.sdkClient);
136
+ const chainProbe = makeSuiChainProbe(sdkShim, chain);
205
137
  return {
206
138
  client: {
207
139
  sdk: sdkShim,
@@ -214,7 +146,7 @@ const assembleSuiClient = (parts) => {
214
146
  faucetUrl: parts.faucetUrl === void 0 ? null : toDockerHostGatewayUrl(parts.faucetUrl),
215
147
  graphqlUrl: parts.graphqlUrl === void 0 ? null : toDockerHostGatewayUrl(parts.graphqlUrl)
216
148
  },
217
- chain: chainId(parts.chain),
149
+ chain: chainId(chain),
218
150
  waitForTransactionsReady: parts.waitForTransactionsReady,
219
151
  chainProbe,
220
152
  fork: null,
@@ -223,7 +155,7 @@ const assembleSuiClient = (parts) => {
223
155
  sdkShim,
224
156
  chainProbe
225
157
  };
226
- };
158
+ });
227
159
  /** Shape the resolved network record the boot builders all hand
228
160
  * back. The substrate-network mapping is uniform per mode. Brands
229
161
  * the raw chain string at this boundary so consumers downstream
@@ -239,15 +171,6 @@ const makeResolvedNetwork = (parts) => ({
239
171
  ...parts.checkpoint !== void 0 ? { checkpoint: parts.checkpoint } : {},
240
172
  ...parts.forkUpstream !== void 0 ? { forkUpstream: parts.forkUpstream } : {}
241
173
  });
242
- const stringifyCause = (cause) => {
243
- if (cause instanceof Error) return cause.message;
244
- if (typeof cause === "string") return cause;
245
- try {
246
- return JSON.stringify(cause);
247
- } catch {
248
- return String(cause);
249
- }
250
- };
251
174
  //#endregion
252
175
  export { assembleSuiClient, buildWaitForTransactionsReady, fetchChainId, makeResolvedNetwork, noopWaitForTransactionsReady };
253
176
 
@@ -1 +1 @@
1
- {"version":3,"file":"shared-boot.mjs","names":["brandChainId"],"sources":["../../../../src/plugins/sui/mode/shared-boot.ts"],"sourcesContent":["// Sui plugin — boot helpers shared across local / external / live modes.\n//\n// What lives here (and why):\n//\n// - `fetchChainId(client, opts?)` — bounded chain-id probe. The\n// only readiness sentinel for external + live; local treats it\n// as the chain-id capture step after the multi-probe gate has\n// succeeded.\n// - `buildWaitForTransactionsReady(faucetUrl, opts?)` — memoised\n// funds-ready gate for faucet-bearing networks. `Effect.cached`\n// with a manual-invalidation surface (the distilled-doc\n// opportunity called out in `mode/shared.ts`).\n// - `noopWaitForTransactionsReady` — trivially-succeeding gate for\n// faucet-less networks (live mainnet, fork).\n// - `assembleSuiClient(...)` — collapses the boilerplate that\n// local/local-rpc/live all repeat (sdk shim + chainProbe + the\n// `fork: null` discriminator).\n//\n// Why not jam this into `mode/local.ts`: external + live can't\n// import from `local.ts` without dragging the container-runtime\n// import path along; the helpers below are wire-only and have NO\n// substrate-context dependencies.\n\nimport { Duration, Effect, Ref, type Scope } from 'effect';\n\nimport type { SuiGrpcClient } from '@mysten/sui/grpc';\n\nimport type { ChainProbe } from '../../../contracts/chain-probe.ts';\nimport { chainId as brandChainId } from '../../../substrate/brand.ts';\nimport { waitForHttpEndpoint } from '../../../substrate/runtime/http-probe.ts';\nimport { makeSuiChainProbe, type SuiSdkShim, type SuiProbeKey } from '../chain-probe.ts';\nimport { suiPluginError, type SuiPluginError } from '../errors.ts';\nimport type { ResolvedSuiNetwork } from '../network-resolver.ts';\nimport { toDockerHostGatewayUrl, type SuiClient, type WaitForTransactionsReady } from './shared.ts';\n\n// ---------------------------------------------------------------------------\n// Chain-id fetch — bounded, typed-error\n// ---------------------------------------------------------------------------\n\n/** Default chain-id fetch timeout. The wire latency is the dominant\n * cost on real RPCs; 30 s is the documented ceiling. */\nexport const DEFAULT_CHAIN_ID_TIMEOUT = Duration.seconds(30);\n\n/** Fetch the chain identifier off a constructed grpc client. The\n * result is the bare string that downstream cache layers fold into\n * their state-store keys. */\nexport const fetchChainId = (\n\tsdkClient: SuiGrpcClient,\n\topts?: { readonly timeout?: Duration.Duration; readonly span?: string },\n): Effect.Effect<string, SuiPluginError> => {\n\tconst timeout = opts?.timeout ?? DEFAULT_CHAIN_ID_TIMEOUT;\n\tconst timeoutMs = Duration.toMillis(timeout);\n\treturn Effect.tryPromise({\n\t\ttry: (signal) =>\n\t\t\tsdkClient.ledgerService\n\t\t\t\t.getServiceInfo({}, { abort: signal, timeout: timeoutMs })\n\t\t\t\t.response.then((response) => {\n\t\t\t\t\tif (!response.chainId) {\n\t\t\t\t\t\tthrow new Error('Chain identifier not found in service info');\n\t\t\t\t\t}\n\t\t\t\t\treturn response.chainId;\n\t\t\t\t}),\n\t\tcatch: (cause): SuiPluginError =>\n\t\t\tsuiPluginError(\n\t\t\t\t'chain-id-fetch',\n\t\t\t\t`sui chain-id fetch failed: ${stringifyCause(cause)}`,\n\t\t\t\tcause,\n\t\t\t),\n\t}).pipe(\n\t\tEffect.timeoutOrElse({\n\t\t\tduration: timeout,\n\t\t\torElse: (): Effect.Effect<string, SuiPluginError> =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'chain-id-fetch',\n\t\t\t\t\t\t`sui chain-id fetch did not respond within ${timeoutMs}ms`,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t}),\n\t\tEffect.tap((id: string) => Effect.annotateCurrentSpan({ 'sui.chain': id })),\n\t\tEffect.withSpan(opts?.span ?? 'devstack.plugin.sui.fetchChainId'),\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// waitForTransactionsReady — memoised, with manual invalidation\n// ---------------------------------------------------------------------------\n\n/** Per-attempt and total budget for the `waitForTransactionsReady`\n * retry loop. The 2 s spacing matches the upstream sui-faucet's\n * internal cadence; the 90 s ceiling matches the v3 service's\n * documented wall-clock. */\nconst FUNDS_READY_RETRY_SPACING = Duration.seconds(2);\nconst FUNDS_READY_TIMEOUT = Duration.seconds(90);\n\n/** Per-fetch deadline for the faucet probe POST. Bounded short so\n * the outer retry loop hammers quickly. */\nconst PROBE_FETCH_TIMEOUT_MS = 3000;\n\n/** Probe recipient for the faucet funds-ready check. A literal\n * zero-balance address so the real call doesn't pollute caller wallets;\n * any well-formed address works. */\nconst FAUCET_PROBE_RECIPIENT = '0x0000000000000000000000000000000000000000000000000000000000000001';\n\n/**\n * Build the funds-transferable gate against a real HTTP faucet.\n * Memoised — first successful resolution sticks for the scope; the\n * manual `invalidate` surface clears the memo so long-running\n * supervisors can re-probe without a full restart.\n */\nexport const buildWaitForTransactionsReady = (\n\tfaucetUrl: string,\n\topts?: {\n\t\treadonly retrySpacing?: Duration.Duration;\n\t\treadonly timeout?: Duration.Duration;\n\t},\n): Effect.Effect<WaitForTransactionsReady, never, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst retrySpacing = opts?.retrySpacing ?? FUNDS_READY_RETRY_SPACING;\n\t\tconst timeout = opts?.timeout ?? FUNDS_READY_TIMEOUT;\n\t\tconst ref = yield* Ref.make<Effect.Effect<void, SuiPluginError> | null>(null);\n\n\t\tconst makeProbe = (): Effect.Effect<void, SuiPluginError> =>\n\t\t\twaitForHttpEndpoint({\n\t\t\t\tendpoint: `${faucetUrl}/v2/gas`,\n\t\t\t\ttimeoutMs: Duration.toMillis(timeout),\n\t\t\t\tintervalMs: Duration.toMillis(retrySpacing),\n\t\t\t\trequestTimeoutMs: PROBE_FETCH_TIMEOUT_MS,\n\t\t\t\trequestInit: {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tFixedAmountRequest: { recipient: FAUCET_PROBE_RECIPIENT },\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t\tvalidate: async (response) => {\n\t\t\t\t\tif (!response.ok) throw new Error(`faucet HTTP ${response.status}`);\n\t\t\t\t\tconst body = (await response.json()) as { status?: unknown };\n\t\t\t\t\tconst status = body.status;\n\t\t\t\t\tif (typeof status === 'object' && status !== null && 'Failure' in status) {\n\t\t\t\t\t\tconst failure = (status as { Failure: unknown }).Failure;\n\t\t\t\t\t\tthrow new Error(`faucet body: Failure ${JSON.stringify(failure)}`);\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t}).pipe(\n\t\t\t\tEffect.mapError(\n\t\t\t\t\t(cause): SuiPluginError =>\n\t\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t\t'wait-funds-ready',\n\t\t\t\t\t\t\t`sui faucet at ${faucetUrl} did not become funds-transferable within ` +\n\t\t\t\t\t\t\t\t`${Duration.toMillis(timeout)}ms (still returning body-level Failure or 5xx): ` +\n\t\t\t\t\t\t\t\tstringifyCause(cause),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\tconst getOrInit: Effect.Effect<Effect.Effect<void, SuiPluginError>> = Effect.gen(function* () {\n\t\t\tconst existing = yield* Ref.get(ref);\n\t\t\tif (existing !== null) return existing;\n\t\t\tconst cached = yield* Effect.cached(makeProbe());\n\t\t\tyield* Ref.set(ref, cached);\n\t\t\treturn cached;\n\t\t});\n\n\t\treturn {\n\t\t\twait: getOrInit.pipe(Effect.flatMap((eff) => eff)),\n\t\t\tinvalidate: Ref.set(ref, null),\n\t\t};\n\t});\n\n/** Trivially-succeeding gate. Used by faucet-less networks (live\n * mainnet, fork — fork funds via impersonation, not HTTP). */\nexport const noopWaitForTransactionsReady: WaitForTransactionsReady = {\n\twait: Effect.void,\n\tinvalidate: Effect.void,\n};\n\nconst SUI_RPC_READ_TIMEOUT_MS = 10_000;\n\nconst postJsonRpc = async <A>(\n\trpcUrl: string,\n\tmethod: string,\n\tparams: ReadonlyArray<unknown>,\n): Promise<A> => {\n\tconst controller = new AbortController();\n\tconst timeout = setTimeout(() => controller.abort(), SUI_RPC_READ_TIMEOUT_MS);\n\ttimeout.unref?.();\n\ttry {\n\t\tconst response = await fetch(rpcUrl, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\tbody: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\tif (!response.ok) throw new Error(`Sui RPC HTTP ${response.status}`);\n\t\tconst payload = (await response.json()) as {\n\t\t\treadonly result?: A;\n\t\t\treadonly error?: { readonly message?: string };\n\t\t};\n\t\tif (payload.error !== undefined) {\n\t\t\tthrow new Error(payload.error.message ?? JSON.stringify(payload.error));\n\t\t}\n\t\tif (payload.result === undefined) throw new Error(`Sui RPC ${method} returned no result`);\n\t\treturn payload.result;\n\t} finally {\n\t\tclearTimeout(timeout);\n\t}\n};\n\nconst normalizeJsonOwner = (owner: unknown): unknown => {\n\tif (owner === 'Immutable') return { $kind: 'Immutable', Immutable: true };\n\tif (typeof owner !== 'object' || owner === null) return { $kind: 'Unknown', Unknown: owner };\n\tconst record = owner as {\n\t\treadonly AddressOwner?: unknown;\n\t\treadonly ObjectOwner?: unknown;\n\t\treadonly Shared?: {\n\t\t\treadonly initial_shared_version?: unknown;\n\t\t\treadonly initialSharedVersion?: unknown;\n\t\t};\n\t\treadonly ConsensusAddressOwner?: unknown;\n\t};\n\tif (typeof record.AddressOwner === 'string') {\n\t\treturn { $kind: 'AddressOwner', AddressOwner: record.AddressOwner };\n\t}\n\tif (record.ObjectOwner !== undefined) {\n\t\treturn { $kind: 'Parent', Parent: record.ObjectOwner };\n\t}\n\tif (record.Shared !== undefined) {\n\t\tconst initialSharedVersion =\n\t\t\trecord.Shared.initialSharedVersion ?? record.Shared.initial_shared_version;\n\t\treturn {\n\t\t\t$kind: 'Shared',\n\t\t\tShared: { initialSharedVersion: String(initialSharedVersion) },\n\t\t};\n\t}\n\tif (record.ConsensusAddressOwner !== undefined) {\n\t\treturn { $kind: 'ConsensusAddressOwner', ConsensusAddressOwner: record.ConsensusAddressOwner };\n\t}\n\treturn { $kind: 'Unknown', Unknown: owner };\n};\n\nconst getObjectViaJsonRpc = async (\n\trpcUrl: string,\n\targs: {\n\t\treadonly objectId: string;\n\t\treadonly include?: {\n\t\t\treadonly content?: boolean;\n\t\t\treadonly json?: boolean;\n\t\t};\n\t},\n): Promise<unknown> => {\n\tconst showContent = args.include?.content === true || args.include?.json === true;\n\tconst result = await postJsonRpc<{\n\t\treadonly data?: {\n\t\t\treadonly objectId?: string;\n\t\t\treadonly version?: string | number;\n\t\t\treadonly type?: string;\n\t\t\treadonly owner?: unknown;\n\t\t\treadonly content?: {\n\t\t\t\treadonly fields?: unknown;\n\t\t\t};\n\t\t};\n\t}>('' + rpcUrl, 'sui_getObject', [\n\t\targs.objectId,\n\t\t{ showType: true, showOwner: true, showContent },\n\t]);\n\tconst data = result.data;\n\tif (data?.objectId === undefined) throw new Error(`object ${args.objectId} not found`);\n\tconst object = {\n\t\tobjectId: data.objectId,\n\t\tversion: String(data.version ?? ''),\n\t\ttype: data.type ?? 'unknown',\n\t\towner: normalizeJsonOwner(data.owner),\n\t\t...(args.include?.json === true ? { json: data.content?.fields } : {}),\n\t\t...(args.include?.content === true ? { content: data.content } : {}),\n\t};\n\treturn { ...object, object };\n};\n\n// ---------------------------------------------------------------------------\n// SuiClient assembly — collapses the per-mode boilerplate\n// ---------------------------------------------------------------------------\n\n/** Build the `SuiSdkShim` over a constructed grpc client.\n * Account/Coin/Wallet read through this seam, so we expose\n * `executeTransaction` + `waitForTransaction` in addition to the\n * read methods needed by the chain probe. */\nexport const makeSdkShim = (sdkClient: SuiGrpcClient, rpcUrl: string): SuiSdkShim => ({\n\tcore: {\n\t\tgetObject: (args) => getObjectViaJsonRpc(rpcUrl, args),\n\t\tgetTransaction: (args) => sdkClient.core.getTransaction(args),\n\t\tgetBalance: (args) => sdkClient.core.getBalance(args),\n\t\tlistCoins: (args) => sdkClient.core.listCoins(args),\n\t\t// Extended surfaces — used by the account plugin's sign + execute\n\t\t// closure. Local mode keeps the `sdkClient.executeTransaction` /\n\t\t// `sdkClient.waitForTransaction` instance methods reachable on\n\t\t// the shim so consumers don't have to know about the grpc client\n\t\t// constructor. The SDK accepts a mutable `signatures: string[]`\n\t\t// shape; the shim's readonly signature is widened with a copy at\n\t\t// the boundary.\n\t\texecuteTransaction: (args) =>\n\t\t\tsdkClient.executeTransaction({\n\t\t\t\ttransaction: args.transaction,\n\t\t\t\tsignatures: [...args.signatures],\n\t\t\t\t...(args.include !== undefined ? { include: args.include } : {}),\n\t\t\t}),\n\t\twaitForTransaction: (args) =>\n\t\t\tsdkClient.waitForTransaction({\n\t\t\t\tdigest: args.digest,\n\t\t\t\t...(args.timeout !== undefined ? { timeout: args.timeout } : {}),\n\t\t\t}),\n\t},\n\t// Opaque client passthrough — the Package plugin's publish-tx\n\t// builder hands this to `Transaction.build({ client })`. The shim\n\t// layer doesn't type-narrow it; downstream consumers cast at the\n\t// `tx.build` call site (mirrors coin/mint.ts).\n\tclient: sdkClient,\n});\n\n/** Assemble a `SuiClient` from the per-mode building blocks. The\n * `fork: null` discriminator is invariant for non-fork modes; the\n * fork builder constructs its own client with the admin surface.\n *\n * `chain` is accepted as a bare string and branded to `ChainId` at\n * this single boundary — every consumer downstream reads the\n * branded shape so capability-key constructors (`chainProbe…`,\n * `faucet…`) accept it without a cast. */\nexport const assembleSuiClient = (parts: {\n\treadonly sdkClient: SuiGrpcClient;\n\treadonly chain: string;\n\treadonly rpcUrl: string;\n\treadonly sdkRpcUrl?: string;\n\treadonly faucetUrl?: string;\n\treadonly fundingFaucetUrl?: string;\n\treadonly graphqlUrl?: string;\n\treadonly waitForTransactionsReady: WaitForTransactionsReady;\n\t/** Image ref consumed by package's path (b) (`docker run --rm`)\n\t * build path. `null` for modes that have no in-stack image\n\t * (external + live). */\n\treadonly buildImage?: import('../../../contracts/container-runtime.ts').ImageRef | null;\n\t/** Container-reachable mirrors. Local mode resolves public URLs\n\t * through the router but sibling containers still need direct\n\t * host-gateway URLs during boot. */\n\treadonly hostGateway?: SuiClient['hostGateway'];\n}): {\n\treadonly client: SuiClient;\n\treadonly sdkShim: SuiSdkShim;\n\treadonly chainProbe: ChainProbe<SuiProbeKey>;\n} => {\n\tconst sdkShim = makeSdkShim(parts.sdkClient, parts.sdkRpcUrl ?? parts.rpcUrl);\n\tconst chainProbe = makeSuiChainProbe(sdkShim, parts.chain);\n\tconst client: SuiClient = {\n\t\tsdk: sdkShim,\n\t\trpcUrl: parts.rpcUrl,\n\t\tfaucetUrl: parts.faucetUrl ?? null,\n\t\tfundingFaucetUrl: parts.fundingFaucetUrl ?? parts.faucetUrl ?? null,\n\t\tgraphqlUrl: parts.graphqlUrl ?? null,\n\t\thostGateway: parts.hostGateway ?? {\n\t\t\trpcUrl: toDockerHostGatewayUrl(parts.rpcUrl),\n\t\t\tfaucetUrl: parts.faucetUrl === undefined ? null : toDockerHostGatewayUrl(parts.faucetUrl),\n\t\t\tgraphqlUrl: parts.graphqlUrl === undefined ? null : toDockerHostGatewayUrl(parts.graphqlUrl),\n\t\t},\n\t\tchain: brandChainId(parts.chain),\n\t\twaitForTransactionsReady: parts.waitForTransactionsReady,\n\t\tchainProbe,\n\t\tfork: null,\n\t\tbuildImage: parts.buildImage ?? null,\n\t};\n\treturn { client, sdkShim, chainProbe };\n};\n\n/** Shape the resolved network record the boot builders all hand\n * back. The substrate-network mapping is uniform per mode. Brands\n * the raw chain string at this boundary so consumers downstream\n * (codegen, capabilities, walrus/seal deps) read a `ChainId` and\n * don't re-wrap. */\nexport const makeResolvedNetwork = (parts: {\n\treadonly mode: ResolvedSuiNetwork['mode'];\n\treadonly chain: string;\n\treadonly rpc: string;\n\treadonly faucet?: string;\n\treadonly graphql?: string;\n\treadonly source: ResolvedSuiNetwork['source'];\n\treadonly checkpoint?: string;\n\treadonly forkUpstream?: ResolvedSuiNetwork['forkUpstream'];\n}): ResolvedSuiNetwork => ({\n\tmode: parts.mode,\n\tchain: brandChainId(parts.chain),\n\trpc: parts.rpc,\n\tsource: parts.source,\n\t...(parts.faucet !== undefined ? { faucet: parts.faucet } : {}),\n\t...(parts.graphql !== undefined ? { graphql: parts.graphql } : {}),\n\t...(parts.checkpoint !== undefined ? { checkpoint: parts.checkpoint } : {}),\n\t...(parts.forkUpstream !== undefined ? { forkUpstream: parts.forkUpstream } : {}),\n});\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\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":"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"}
1
+ {"version":3,"file":"shared-boot.mjs","names":["brandChainId"],"sources":["../../../../src/plugins/sui/mode/shared-boot.ts"],"sourcesContent":["// Sui plugin — boot helpers shared across local / external / live modes.\n//\n// What lives here (and why):\n//\n// - `fetchChainId(client, opts?)` — bounded chain-id probe. The\n// only readiness sentinel for external + live; local treats it\n// as the chain-id capture step after the multi-probe gate has\n// succeeded.\n// - `buildWaitForTransactionsReady(faucetUrl, opts?)` — memoised\n// funds-ready gate for faucet-bearing networks. `Effect.cached`\n// with a manual-invalidation surface (the distilled-doc\n// opportunity called out in `mode/shared.ts`).\n// - `noopWaitForTransactionsReady` — trivially-succeeding gate for\n// faucet-less networks (live mainnet, fork).\n// - `assembleSuiClient(...)` — collapses the boilerplate that\n// local/local-rpc/live all repeat (sdk shim + chainProbe + the\n// `fork: null` discriminator).\n//\n// Why not jam this into `mode/local.ts`: external + live can't\n// import from `local.ts` without dragging the container-runtime\n// import path along; the helpers below are wire-only and have NO\n// substrate-context dependencies.\n\nimport { Duration, Effect, SynchronizedRef, type Scope } from 'effect';\n\nimport type { SuiGrpcClient } from '@mysten/sui/grpc';\n\nimport type { ChainProbe } from '../../../contracts/chain-probe.ts';\nimport { chainId as brandChainId } from '../../../substrate/brand.ts';\nimport { waitForHttpEndpoint } from '../../../substrate/runtime/http-probe.ts';\nimport { makeSuiChainProbe, type SuiSdkShim, type SuiProbeKey } from '../chain-probe.ts';\nimport {\n\tsuiConfigError,\n\tsuiPluginError,\n\ttype SuiConfigError,\n\ttype SuiPluginError,\n} 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 { toDockerHostGatewayUrl, type SuiClient, type WaitForTransactionsReady } from './shared.ts';\n\n// ---------------------------------------------------------------------------\n// Chain-id fetch — bounded, typed-error\n// ---------------------------------------------------------------------------\n\n/** Default chain-id fetch timeout. The wire latency is the dominant\n * cost on real RPCs; 30 s is the documented ceiling. */\nexport const DEFAULT_CHAIN_ID_TIMEOUT = Duration.seconds(30);\n\n/** Fetch the chain identifier off a constructed grpc client. The\n * result is the bare string that downstream cache layers fold into\n * their state-store keys. */\nexport const fetchChainId = (\n\tsdkClient: SuiGrpcClient,\n\topts?: { readonly timeout?: Duration.Duration; readonly span?: string },\n): Effect.Effect<string, SuiPluginError> => {\n\tconst timeout = opts?.timeout ?? DEFAULT_CHAIN_ID_TIMEOUT;\n\tconst timeoutMs = Duration.toMillis(timeout);\n\treturn Effect.tryPromise({\n\t\ttry: (signal) =>\n\t\t\tsdkClient.ledgerService\n\t\t\t\t.getServiceInfo({}, { abort: signal, timeout: timeoutMs })\n\t\t\t\t.response.then((response) => {\n\t\t\t\t\tif (!response.chainId) {\n\t\t\t\t\t\tthrow new Error('Chain identifier not found in service info');\n\t\t\t\t\t}\n\t\t\t\t\treturn response.chainId;\n\t\t\t\t}),\n\t\tcatch: (cause): SuiPluginError =>\n\t\t\tsuiPluginError(\n\t\t\t\t'chain-id-fetch',\n\t\t\t\t`sui chain-id fetch failed: ${formatUnknownError(cause)}`,\n\t\t\t\tcause,\n\t\t\t),\n\t}).pipe(\n\t\tEffect.timeoutOrElse({\n\t\t\tduration: timeout,\n\t\t\torElse: (): Effect.Effect<string, SuiPluginError> =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t'chain-id-fetch',\n\t\t\t\t\t\t`sui chain-id fetch did not respond within ${timeoutMs}ms`,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t}),\n\t\tEffect.tap((id: string) => Effect.annotateCurrentSpan({ [SuiSpans.chain]: id })),\n\t\tEffect.withSpan(opts?.span ?? 'devstack.plugin.sui.fetchChainId'),\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// waitForTransactionsReady — memoised, with manual invalidation\n// ---------------------------------------------------------------------------\n\n/** Per-attempt and total budget for the `waitForTransactionsReady`\n * retry loop. The 2 s spacing matches the upstream sui-faucet's\n * internal cadence; the 90 s ceiling matches the v3 service's\n * documented wall-clock. */\nconst FUNDS_READY_RETRY_SPACING = Duration.seconds(2);\nconst FUNDS_READY_TIMEOUT = Duration.seconds(90);\n\n/** Per-fetch deadline for the faucet probe POST. Bounded short so\n * the outer retry loop hammers quickly. */\nconst PROBE_FETCH_TIMEOUT_MS = 3000;\n\n/** Probe recipient for the faucet funds-ready check. A literal\n * zero-balance address so the real call doesn't pollute caller wallets;\n * any well-formed address works. */\nconst FAUCET_PROBE_RECIPIENT = '0x0000000000000000000000000000000000000000000000000000000000000001';\n\n/**\n * Build the funds-transferable gate against a real HTTP faucet.\n * Memoised — first successful resolution sticks for the scope; the\n * manual `invalidate` surface clears the memo so long-running\n * supervisors can re-probe without a full restart.\n */\nexport const buildWaitForTransactionsReady = (\n\tfaucetUrl: string,\n\topts?: {\n\t\treadonly retrySpacing?: Duration.Duration;\n\t\treadonly timeout?: Duration.Duration;\n\t},\n): Effect.Effect<WaitForTransactionsReady, never, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst retrySpacing = opts?.retrySpacing ?? FUNDS_READY_RETRY_SPACING;\n\t\tconst timeout = opts?.timeout ?? FUNDS_READY_TIMEOUT;\n\t\t// SynchronizedRef serialises the get-or-init transition so two\n\t\t// concurrent callers can't both observe `null` and both build\n\t\t// their own `Effect.cached` instance (CAS-style guard against\n\t\t// the build-once race).\n\t\tconst ref = yield* SynchronizedRef.make<Effect.Effect<void, SuiPluginError> | null>(null);\n\n\t\tconst makeProbe = (): Effect.Effect<void, SuiPluginError> =>\n\t\t\twaitForHttpEndpoint({\n\t\t\t\tendpoint: `${faucetUrl}/v2/gas`,\n\t\t\t\ttimeoutMs: Duration.toMillis(timeout),\n\t\t\t\tintervalMs: Duration.toMillis(retrySpacing),\n\t\t\t\trequestTimeoutMs: PROBE_FETCH_TIMEOUT_MS,\n\t\t\t\trequestInit: {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\theaders: { 'content-type': 'application/json' },\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tFixedAmountRequest: { recipient: FAUCET_PROBE_RECIPIENT },\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t\tvalidate: async (response) => {\n\t\t\t\t\tif (!response.ok) throw new Error(`faucet HTTP ${response.status}`);\n\t\t\t\t\tconst body = (await response.json()) as { status?: unknown };\n\t\t\t\t\tconst status = body.status;\n\t\t\t\t\tif (typeof status === 'object' && status !== null && 'Failure' in status) {\n\t\t\t\t\t\tconst failure = (status as { Failure: unknown }).Failure;\n\t\t\t\t\t\tthrow new Error(`faucet body: Failure ${JSON.stringify(failure)}`);\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t}).pipe(\n\t\t\t\tEffect.mapError(\n\t\t\t\t\t(cause): SuiPluginError =>\n\t\t\t\t\t\tsuiPluginError(\n\t\t\t\t\t\t\t'wait-funds-ready',\n\t\t\t\t\t\t\t`sui faucet at ${faucetUrl} did not become funds-transferable within ` +\n\t\t\t\t\t\t\t\t`${Duration.toMillis(timeout)}ms (still returning body-level Failure or 5xx): ` +\n\t\t\t\t\t\t\t\tformatUnknownError(cause),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t// `modifyEffect` atomically observes-then-updates inside a\n\t\t// serialised critical section: at most one fiber builds the\n\t\t// memoised probe, every other caller reads it back. This\n\t\t// closes the read-build-write race the plain Ref had.\n\t\tconst getOrInit: Effect.Effect<Effect.Effect<void, SuiPluginError>> =\n\t\t\tSynchronizedRef.modifyEffect(ref, (existing) =>\n\t\t\t\texisting !== null\n\t\t\t\t\t? Effect.succeed([existing, existing] as const)\n\t\t\t\t\t: Effect.cached(makeProbe()).pipe(Effect.map((cached) => [cached, cached] as const)),\n\t\t\t);\n\n\t\treturn {\n\t\t\twait: getOrInit.pipe(Effect.flatMap((eff) => eff)),\n\t\t\tinvalidate: SynchronizedRef.set(ref, null),\n\t\t};\n\t});\n\n/** Trivially-succeeding gate. Used by faucet-less networks (live\n * mainnet, fork — fork funds via impersonation, not HTTP). */\nexport const noopWaitForTransactionsReady: WaitForTransactionsReady = {\n\twait: Effect.void,\n\tinvalidate: Effect.void,\n};\n\n// ---------------------------------------------------------------------------\n// SuiClient assembly — collapses the per-mode boilerplate\n// ---------------------------------------------------------------------------\n\n/** Build the `SuiSdkShim` over a constructed grpc client.\n * Account/Coin/Wallet read through this seam, so we expose\n * `executeTransaction` + `waitForTransaction` in addition to the\n * read methods needed by the chain probe.\n *\n * Every read/write goes through `sdkClient.core.*` — the gRPC\n * TransportMethods surface from `@mysten/sui`. JSON-RPC is\n * deprecated; do not reintroduce it. */\nexport const makeSdkShim = (sdkClient: SuiGrpcClient): SuiSdkShim => ({\n\tcore: {\n\t\tgetObject: (args) => sdkClient.core.getObject(args),\n\t\tgetTransaction: (args) => sdkClient.core.getTransaction(args),\n\t\tgetBalance: (args) => sdkClient.core.getBalance(args),\n\t\tlistCoins: (args) => sdkClient.core.listCoins(args),\n\t\t// Extended surfaces — used by the account plugin's sign + execute\n\t\t// closure. Routes through `client.core.*` (the cross-transport\n\t\t// canonical surface per STYLE_GUIDE §16). The SDK accepts a\n\t\t// mutable `signatures: string[]`; the shim's readonly signature\n\t\t// is widened with a copy at the boundary.\n\t\texecuteTransaction: (args) =>\n\t\t\tsdkClient.core.executeTransaction({\n\t\t\t\ttransaction: args.transaction,\n\t\t\t\tsignatures: [...args.signatures],\n\t\t\t\t...(args.include !== undefined ? { include: args.include } : {}),\n\t\t\t}),\n\t\twaitForTransaction: (args) =>\n\t\t\tsdkClient.core.waitForTransaction({\n\t\t\t\tdigest: args.digest,\n\t\t\t\t...(args.timeout !== undefined ? { timeout: args.timeout } : {}),\n\t\t\t}),\n\t},\n\t// Client passthrough — Package's publish-tx builder hands this to\n\t// `Transaction.build({ client })`; sibling plugins reach\n\t// `client.core.*` directly through this slot. Typed as\n\t// ClientWithCoreApi via SuiSdkShim.client.\n\tclient: sdkClient,\n});\n\n/** Assemble a `SuiClient` from the per-mode building blocks. The\n * `fork: null` discriminator is invariant for non-fork modes; the\n * fork builder constructs its own client with the admin surface.\n *\n * `chain` is accepted as a bare string and branded to `ChainId` at\n * this single boundary — every consumer downstream reads the\n * branded shape so capability-key constructors (`chainProbe…`,\n * `faucet…`) accept it without a cast.\n *\n * Returns an `Effect` on the `SuiConfigError` channel: the empty-chain\n * guard must surface as a typed, `catchTag`-able failure. Calling it\n * un-yielded as a sync function (as it once was) turned a thrown\n * `SuiConfigError` into a DEFECT inside the mode-boot `Effect.gen`\n * bodies — a hidden crash the channel could never recover (mirrors the\n * fix already applied to `auto-tick.ts`; STYLE_GUIDE §2). */\nexport const assembleSuiClient = (parts: {\n\treadonly sdkClient: SuiGrpcClient;\n\treadonly chain: string;\n\treadonly rpcUrl: string;\n\treadonly faucetUrl?: string;\n\treadonly fundingFaucetUrl?: string;\n\treadonly graphqlUrl?: string;\n\treadonly waitForTransactionsReady: WaitForTransactionsReady;\n\t/** Image ref consumed by package's path (b) (`docker run --rm`)\n\t * build path. `null` for modes that have no in-stack image\n\t * (external + live). */\n\treadonly buildImage?: import('../../../contracts/container-runtime.ts').ImageRef | null;\n\t/** Container-reachable mirrors. Local mode resolves public URLs\n\t * through the router but sibling containers still need direct\n\t * host-gateway URLs during boot. */\n\treadonly hostGateway?: SuiClient['hostGateway'];\n}): Effect.Effect<\n\t{\n\t\treadonly client: SuiClient;\n\t\treadonly sdkShim: SuiSdkShim;\n\t\treadonly chainProbe: ChainProbe<SuiProbeKey>;\n\t},\n\tSuiConfigError\n> =>\n\tEffect.gen(function* () {\n\t\t// Defense-in-depth — `fetchChainId` should never resolve to an\n\t\t// empty string (RPC rejects that earlier), but a branded empty\n\t\t// string would silently fold into every downstream cache key. A\n\t\t// caller-pinned `chain: ''` (e.g. `.live.custom({ chain: '' })`)\n\t\t// reaches here, so fail on the typed channel rather than throw.\n\t\tif (typeof parts.chain !== 'string' || parts.chain.length === 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tsuiConfigError({\n\t\t\t\t\tfield: 'chain',\n\t\t\t\t\tmessage: 'sui.assembleSuiClient: chain id must be a non-empty string',\n\t\t\t\t\thint: 'check fetchChainId / network resolver returned a real chain id',\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tconst chain = parts.chain;\n\t\tconst sdkShim = makeSdkShim(parts.sdkClient);\n\t\tconst chainProbe = makeSuiChainProbe(sdkShim, chain);\n\t\tconst client: SuiClient = {\n\t\t\tsdk: sdkShim,\n\t\t\trpcUrl: parts.rpcUrl,\n\t\t\tfaucetUrl: parts.faucetUrl ?? null,\n\t\t\tfundingFaucetUrl: parts.fundingFaucetUrl ?? parts.faucetUrl ?? null,\n\t\t\tgraphqlUrl: parts.graphqlUrl ?? null,\n\t\t\thostGateway: parts.hostGateway ?? {\n\t\t\t\trpcUrl: toDockerHostGatewayUrl(parts.rpcUrl),\n\t\t\t\tfaucetUrl: parts.faucetUrl === undefined ? null : toDockerHostGatewayUrl(parts.faucetUrl),\n\t\t\t\tgraphqlUrl:\n\t\t\t\t\tparts.graphqlUrl === undefined ? null : toDockerHostGatewayUrl(parts.graphqlUrl),\n\t\t\t},\n\t\t\tchain: brandChainId(chain),\n\t\t\twaitForTransactionsReady: parts.waitForTransactionsReady,\n\t\t\tchainProbe,\n\t\t\tfork: null,\n\t\t\tbuildImage: parts.buildImage ?? null,\n\t\t};\n\t\treturn { client, sdkShim, chainProbe };\n\t});\n\n/** Shape the resolved network record the boot builders all hand\n * back. The substrate-network mapping is uniform per mode. Brands\n * the raw chain string at this boundary so consumers downstream\n * (codegen, capabilities, walrus/seal deps) read a `ChainId` and\n * don't re-wrap. */\nexport const makeResolvedNetwork = (parts: {\n\treadonly mode: ResolvedSuiNetwork['mode'];\n\treadonly chain: string;\n\treadonly rpc: string;\n\treadonly faucet?: string;\n\treadonly graphql?: string;\n\treadonly source: ResolvedSuiNetwork['source'];\n\treadonly checkpoint?: string;\n\treadonly forkUpstream?: ResolvedSuiNetwork['forkUpstream'];\n}): ResolvedSuiNetwork => ({\n\tmode: parts.mode,\n\tchain: brandChainId(parts.chain),\n\trpc: parts.rpc,\n\tsource: parts.source,\n\t...(parts.faucet !== undefined ? { faucet: parts.faucet } : {}),\n\t...(parts.graphql !== undefined ? { graphql: parts.graphql } : {}),\n\t...(parts.checkpoint !== undefined ? { checkpoint: parts.checkpoint } : {}),\n\t...(parts.forkUpstream !== undefined ? { forkUpstream: parts.forkUpstream } : {}),\n});\n"],"mappings":"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"}
@@ -33,11 +33,7 @@ interface WaitForTransactionsReady {
33
33
  }
34
34
  /** Fork admin surface — mode-narrowed. Only the fork-mode factory's
35
35
  * resolved value carries this; local/local-rpc/live values have a
36
- * type-level `null`.
37
- *
38
- * Distilled-doc opportunity: today's `Fiber` handle is discarded
39
- * at the auto-tick call site; the `autoTickHandle` field below
40
- * preserves it for a future cadence-change surface. */
36
+ * type-level `null`. */
41
37
  interface ForkAdminSurface {
42
38
  readonly status: Effect.Effect<{
43
39
  readonly checkpoint: string;
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../src/plugins/sui/mode/shared.ts"],"sourcesContent":["// Shared shapes across mode builders.\n//\n// `SuiClient` is the resolved-value the plugin's `provides` tag\n// publishes — every consumer (Account, Coin, Wallet, Faucet,\n// Package, Codegen, Walrus/Seal/Deepbook fork variants) reads\n// THIS shape.\n//\n// Why one shape: distilled-doc finding — Sui's factory + builder\n// file is ~2000 LOC because the four per-network builders share\n// boilerplate (publish endpoints + fetch chain id + publish state)\n// but their bodies diverge in mode-specific ways. The redesign\n// bakes the seam in: the resolved value is uniform, the boot path\n// is mode-specific, and the admin surfaces narrow at the type\n// level (fork has `Sui.fork.advanceClock`; live does not).\n\nimport { Effect } from 'effect';\n\nimport type { SuiPluginError } from '../errors.ts';\nimport type { SuiSdkShim } from '../chain-probe.ts';\nimport type { ChainProbe } from '../../../contracts/chain-probe.ts';\nimport type { ImageRef } from '../../../contracts/container-runtime.ts';\nimport type { SuiProbeKey } from '../chain-probe.ts';\nimport type { ChainId } from '../../../substrate/brand.ts';\n\n/** Funds-ready strategy contributed by Sui. Mode-aware:\n *\n * - local container — first call POSTs a real funding tx against\n * the faucet, retrying on body-level {Failure} during the\n * post-RPC / pre-fund window. Memoised after first success.\n * - external w/ faucet — same as local container.\n * - live testnet — same, but no retry needed (the public faucet\n * is rate-limited differently).\n * - live mainnet / faucet-less — trivially-succeeding no-op.\n * (Architecture: \"no-faucet network has a trivially-succeeding\n * funds-ready gate\" is a first-class property of the mode.)\n * - fork — trivially-succeeding (impersonation funds, not\n * faucet).\n *\n * Distilled-doc opportunity: `Effect.cached` caches the first-call\n * failure for the whole scope; add a manual-invalidation surface\n * so a fork restart can re-probe. The shape below leaves room for\n * that knob. */\nexport interface WaitForTransactionsReady {\n\treadonly wait: Effect.Effect<void, SuiPluginError>;\n\t/** Manual invalidation — clears the memoised result. The default\n\t * built-in invalidates on plugin restart; this surface lets\n\t * long-running supervisors invalidate without a full restart. */\n\treadonly invalidate: Effect.Effect<void>;\n}\n\n/** Fork admin surface — mode-narrowed. Only the fork-mode factory's\n * resolved value carries this; local/local-rpc/live values have a\n * type-level `null`.\n *\n * Distilled-doc opportunity: today's `Fiber` handle is discarded\n * at the auto-tick call site; the `autoTickHandle` field below\n * preserves it for a future cadence-change surface. */\nexport interface ForkAdminSurface {\n\treadonly status: Effect.Effect<\n\t\t{ readonly checkpoint: string; readonly clock: number },\n\t\tSuiPluginError\n\t>;\n\treadonly advanceClock: (intervalMs: number) => Effect.Effect<void, SuiPluginError>;\n\treadonly advanceCheckpoint: Effect.Effect<void, SuiPluginError>;\n\treadonly impersonate: (\n\t\tsender: string,\n\t\ttx: unknown,\n\t) => Effect.Effect<\n\t\t{ readonly digest: string; readonly success: boolean; readonly raw: unknown },\n\t\tSuiPluginError\n\t>;\n}\n\n/** The resolved value Sui publishes via its resource id. */\nexport interface SuiClient {\n\t/** The SDK shim. Fork mode wraps this with the property-access\n\t * blocklist (`fork-orchestration.wrapWithForkGuard`). */\n\treadonly sdk: SuiSdkShim;\n\t/** Host-reachable RPC URL for this resolved network. Local mode\n\t * surfaces the router-fronted URL; direct boot/probe ports are\n\t * available through `hostGateway` for sibling containers. */\n\treadonly rpcUrl: string;\n\t/** Host-reachable faucet base URL when this network has a faucet. */\n\treadonly faucetUrl: string | null;\n\t/** Faucet URL used by account funding strategies. Local mode keeps\n\t * this on the direct validator port used by the funds-ready gate. */\n\treadonly fundingFaucetUrl: string | null;\n\t/** Host-reachable GraphQL URL when the mode exposes one. */\n\treadonly graphqlUrl: string | null;\n\t/** Container-reachable mirrors of the host URLs. Loopback hosts are\n\t * rewritten to `host.docker.internal`; public URLs pass through. */\n\treadonly hostGateway: {\n\t\treadonly rpcUrl: string;\n\t\treadonly faucetUrl: string | null;\n\t\treadonly graphqlUrl: string | null;\n\t};\n\t/** Chain identity — downstream cache primitives fold this into\n\t * their state-store keys so on-chain artifacts re-derive when\n\t * the chain is wiped. Branded so consumers can hand it directly\n\t * to `chainProbeCapabilityKey(chain)` / `faucetCapabilityKey(chain)`\n\t * without a cast. */\n\treadonly chain: ChainId;\n\t/** Mode-aware funds-transferable gate; trivially-succeeding on\n\t * faucet-less networks. */\n\treadonly waitForTransactionsReady: WaitForTransactionsReady;\n\t/** Schema-validated read surface. Folded into every consumer's\n\t * context via `chain-probe:<chainId>` strategy lookup. */\n\treadonly chainProbe: ChainProbe<SuiProbeKey>;\n\t/** Fork-mode-only admin sub-surface. `null` for non-fork\n\t * modes; the mode-narrowed factory namespace narrows this at\n\t * the type level so consumers don't have to nullcheck. */\n\treadonly fork: ForkAdminSurface | null;\n\t/** Container image ref the Sui plugin built/pulled for its\n\t * validator. Surfaced so cross-service consumers (Package's\n\t * Move build, codegen's `summary` invocation) can spawn a\n\t * one-shot container running the SAME sui binary without\n\t * re-resolving the image. `null` for modes that have no\n\t * in-stack container (external + live). */\n\treadonly buildImage: ImageRef | null;\n}\n\nexport const toDockerHostGatewayUrl = (url: string): string => {\n\tconst parsed = new URL(url);\n\tif (\n\t\tparsed.hostname === '127.0.0.1' ||\n\t\tparsed.hostname === 'localhost' ||\n\t\tparsed.hostname === '0.0.0.0' ||\n\t\tparsed.hostname === '::1' ||\n\t\tparsed.hostname === '[::1]'\n\t) {\n\t\tparsed.hostname = 'host.docker.internal';\n\t}\n\tconst rendered = parsed.toString();\n\treturn parsed.pathname === '/' && parsed.search === '' && parsed.hash === ''\n\t\t? rendered.slice(0, -1)\n\t\t: rendered;\n};\n"],"mappings":";;AAyHA,MAAa,0BAA0B,QAAwB;CAC9D,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,KACC,OAAO,aAAa,eACpB,OAAO,aAAa,eACpB,OAAO,aAAa,aACpB,OAAO,aAAa,SACpB,OAAO,aAAa,QAEpB,QAAO,WAAW;CAEnB,MAAM,WAAW,OAAO,UAAU;AAClC,QAAO,OAAO,aAAa,OAAO,OAAO,WAAW,MAAM,OAAO,SAAS,KACvE,SAAS,MAAM,GAAG,GAAG,GACrB"}
1
+ {"version":3,"file":"shared.mjs","names":[],"sources":["../../../../src/plugins/sui/mode/shared.ts"],"sourcesContent":["// Shared shapes across mode builders.\n//\n// `SuiClient` is the resolved-value the plugin's `provides` tag\n// publishes — every consumer (Account, Coin, Wallet, Faucet,\n// Package, Codegen, Walrus/Seal/Deepbook fork variants) reads\n// THIS shape.\n//\n// Why one shape: distilled-doc finding — Sui's factory + builder\n// file is ~2000 LOC because the four per-network builders share\n// boilerplate (publish endpoints + fetch chain id + publish state)\n// but their bodies diverge in mode-specific ways. The redesign\n// bakes the seam in: the resolved value is uniform, the boot path\n// is mode-specific, and the admin surfaces narrow at the type\n// level (fork has `Sui.fork.advanceClock`; live does not).\n\nimport { Effect } from 'effect';\n\nimport type { SuiPluginError } from '../errors.ts';\nimport type { SuiSdkShim } from '../chain-probe.ts';\nimport type { ChainProbe } from '../../../contracts/chain-probe.ts';\nimport type { ImageRef } from '../../../contracts/container-runtime.ts';\nimport type { SuiProbeKey } from '../chain-probe.ts';\nimport type { ChainId } from '../../../substrate/brand.ts';\n\n/** Funds-ready strategy contributed by Sui. Mode-aware:\n *\n * - local container — first call POSTs a real funding tx against\n * the faucet, retrying on body-level {Failure} during the\n * post-RPC / pre-fund window. Memoised after first success.\n * - external w/ faucet — same as local container.\n * - live testnet — same, but no retry needed (the public faucet\n * is rate-limited differently).\n * - live mainnet / faucet-less — trivially-succeeding no-op.\n * (Architecture: \"no-faucet network has a trivially-succeeding\n * funds-ready gate\" is a first-class property of the mode.)\n * - fork — trivially-succeeding (impersonation funds, not\n * faucet).\n *\n * Distilled-doc opportunity: `Effect.cached` caches the first-call\n * failure for the whole scope; add a manual-invalidation surface\n * so a fork restart can re-probe. The shape below leaves room for\n * that knob. */\nexport interface WaitForTransactionsReady {\n\treadonly wait: Effect.Effect<void, SuiPluginError>;\n\t/** Manual invalidation — clears the memoised result. The default\n\t * built-in invalidates on plugin restart; this surface lets\n\t * long-running supervisors invalidate without a full restart. */\n\treadonly invalidate: Effect.Effect<void>;\n}\n\n/** Fork admin surface — mode-narrowed. Only the fork-mode factory's\n * resolved value carries this; local/local-rpc/live values have a\n * type-level `null`. */\nexport interface ForkAdminSurface {\n\treadonly status: Effect.Effect<\n\t\t{ readonly checkpoint: string; readonly clock: number },\n\t\tSuiPluginError\n\t>;\n\treadonly advanceClock: (intervalMs: number) => Effect.Effect<void, SuiPluginError>;\n\treadonly advanceCheckpoint: Effect.Effect<void, SuiPluginError>;\n\treadonly impersonate: (\n\t\tsender: string,\n\t\ttx: unknown,\n\t) => Effect.Effect<\n\t\t{ readonly digest: string; readonly success: boolean; readonly raw: unknown },\n\t\tSuiPluginError\n\t>;\n}\n\n/** The resolved value Sui publishes via its resource id. */\nexport interface SuiClient {\n\t/** The SDK shim. Fork mode wraps this with the property-access\n\t * blocklist (`fork-orchestration.wrapWithForkGuard`). */\n\treadonly sdk: SuiSdkShim;\n\t/** Host-reachable RPC URL for this resolved network. Local mode\n\t * surfaces the router-fronted URL; direct boot/probe ports are\n\t * available through `hostGateway` for sibling containers. */\n\treadonly rpcUrl: string;\n\t/** Host-reachable faucet base URL when this network has a faucet. */\n\treadonly faucetUrl: string | null;\n\t/** Faucet URL used by account funding strategies. Local mode keeps\n\t * this on the direct validator port used by the funds-ready gate. */\n\treadonly fundingFaucetUrl: string | null;\n\t/** Host-reachable GraphQL URL when the mode exposes one. */\n\treadonly graphqlUrl: string | null;\n\t/** Container-reachable mirrors of the host URLs. Loopback hosts are\n\t * rewritten to `host.docker.internal`; public URLs pass through. */\n\treadonly hostGateway: {\n\t\treadonly rpcUrl: string;\n\t\treadonly faucetUrl: string | null;\n\t\treadonly graphqlUrl: string | null;\n\t};\n\t/** Chain identity — downstream cache primitives fold this into\n\t * their state-store keys so on-chain artifacts re-derive when\n\t * the chain is wiped. Branded so consumers can hand it directly\n\t * to `chainProbeCapabilityKey(chain)` / `faucetCapabilityKey(chain)`\n\t * without a cast. */\n\treadonly chain: ChainId;\n\t/** Mode-aware funds-transferable gate; trivially-succeeding on\n\t * faucet-less networks. */\n\treadonly waitForTransactionsReady: WaitForTransactionsReady;\n\t/** Schema-validated read surface. Folded into every consumer's\n\t * context via `chain-probe:<chainId>` strategy lookup. */\n\treadonly chainProbe: ChainProbe<SuiProbeKey>;\n\t/** Fork-mode-only admin sub-surface. `null` for non-fork\n\t * modes; the mode-narrowed factory namespace narrows this at\n\t * the type level so consumers don't have to nullcheck. */\n\treadonly fork: ForkAdminSurface | null;\n\t/** Container image ref the Sui plugin built/pulled for its\n\t * validator. Surfaced so cross-service consumers (Package's\n\t * Move build, codegen's `summary` invocation) can spawn a\n\t * one-shot container running the SAME sui binary without\n\t * re-resolving the image. `null` for modes that have no\n\t * in-stack container (external + live). */\n\treadonly buildImage: ImageRef | null;\n}\n\nexport const toDockerHostGatewayUrl = (url: string): string => {\n\tconst parsed = new URL(url);\n\tif (\n\t\tparsed.hostname === '127.0.0.1' ||\n\t\tparsed.hostname === 'localhost' ||\n\t\tparsed.hostname === '0.0.0.0' ||\n\t\tparsed.hostname === '::1' ||\n\t\tparsed.hostname === '[::1]'\n\t) {\n\t\tparsed.hostname = 'host.docker.internal';\n\t}\n\tconst rendered = parsed.toString();\n\treturn parsed.pathname === '/' && parsed.search === '' && parsed.hash === ''\n\t\t? rendered.slice(0, -1)\n\t\t: rendered;\n};\n"],"mappings":";;AAqHA,MAAa,0BAA0B,QAAwB;CAC9D,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,KACC,OAAO,aAAa,eACpB,OAAO,aAAa,eACpB,OAAO,aAAa,aACpB,OAAO,aAAa,SACpB,OAAO,aAAa,QAEpB,QAAO,WAAW;CAEnB,MAAM,WAAW,OAAO,UAAU;AAClC,QAAO,OAAO,aAAa,OAAO,OAAO,WAAW,MAAM,OAAO,SAAS,KACvE,SAAS,MAAM,GAAG,GAAG,GACrB"}
@@ -60,6 +60,22 @@ interface SuiLiveOptions extends SuiCommonOptions {
60
60
  * Omit to probe the RPC endpoint. */
61
61
  readonly chain?: string;
62
62
  }
63
+ /** Fork-mode faucet config. Funds test accounts by impersonating a
64
+ * large-reserve "whale" address on the forked upstream and transferring
65
+ * SUI from it — there is no real faucet on a fork. Enabled by default
66
+ * with a per-upstream default whale; the whale is auto-added to the
67
+ * fork seed and validated at boot. */
68
+ interface SuiForkFaucetOptions {
69
+ /** Address to impersonate as the funding source. Defaults to a known
70
+ * large-reserve address for the upstream (see `FORK_DEFAULT_WHALE`).
71
+ * Must hold a large single SUI coin in the fork. */
72
+ readonly whale?: string;
73
+ /** Upper bound on a single funding request (MIST). Guards against a
74
+ * typo draining the whale. Default `1_000_000_000_000n` (1000 SUI). */
75
+ readonly perRequestCapMist?: bigint;
76
+ /** Disable the fork faucet entirely (default: enabled). */
77
+ readonly enabled?: boolean;
78
+ }
63
79
  /** Fork mode — sui-fork binary mirroring a real chain at a
64
80
  * checkpoint. */
65
81
  interface SuiForkOptions extends SuiCommonOptions {
@@ -86,6 +102,8 @@ interface SuiForkOptions extends SuiCommonOptions {
86
102
  readonly autoTick?: boolean | {
87
103
  readonly intervalMs: number;
88
104
  };
105
+ /** Impersonation-based faucet for funding test accounts. */
106
+ readonly faucet?: SuiForkFaucetOptions;
89
107
  }
90
108
  /** The discriminated union of all four mode option records. */
91
109
  type SuiOptions = SuiLocalOptions | SuiLocalRpcOptions | SuiLiveOptions | SuiForkOptions;
@@ -0,0 +1,207 @@
1
+ import { capture } from "../../substrate/runtime/observability/subprocess-capture.mjs";
2
+ import { ContainerRuntimeService } from "../../runtime/docker/service.mjs";
3
+ import { CodegenBindingsFailed } from "../../orchestrators/codegen/errors.mjs";
4
+ import { MoveSummaryRunnerService } from "../../orchestrators/codegen/bindings.mjs";
5
+ import { copyLocalMoveDeps, shellQuote, suiCliImageBuildContext } from "../../substrate/runtime/sui-move-build/index.mjs";
6
+ import { Effect, Layer } from "effect";
7
+ import { basename, dirname, join } from "node:path";
8
+ import { homedir, tmpdir } from "node:os";
9
+ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
10
+ import { cp, mkdir, mkdtemp, rm } from "node:fs/promises";
11
+ //#region src/plugins/sui/move-summary-runner.ts
12
+ const layerSuiMoveSummaryRunnerDocker = Layer.effect(MoveSummaryRunnerService, Effect.gen(function* () {
13
+ const runtime = yield* ContainerRuntimeService;
14
+ return MoveSummaryRunnerService.of({ runSummary: (input) => runSummaryViaDocker(runtime, input) });
15
+ }));
16
+ Layer.effect(MoveSummaryRunnerService, Effect.gen(function* () {
17
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
18
+ return MoveSummaryRunnerService.of({ runSummary: ({ packageName, sourcePath }) => Effect.gen(function* () {
19
+ const scratchDir = yield* Effect.tryPromise({
20
+ try: () => mkdtemp(join(tmpdir(), "devstack-move-summary-")),
21
+ catch: (cause) => new CodegenBindingsFailed({
22
+ package: packageName,
23
+ sourcePath,
24
+ reason: "summary-failed",
25
+ hint: "Unable to create a temporary directory for Move summary output.",
26
+ cause
27
+ })
28
+ });
29
+ const summaryPath = join(scratchDir, "package");
30
+ const stagedPkg = join(scratchDir, "src");
31
+ const cleanupScratch = Effect.promise(() => rm(scratchDir, {
32
+ recursive: true,
33
+ force: true
34
+ })).pipe(Effect.ignore);
35
+ return {
36
+ packageName,
37
+ sourcePath,
38
+ summaryPath,
39
+ cleanupPath: scratchDir,
40
+ summaryJson: parseSummaryStdout((yield* Effect.gen(function* () {
41
+ yield* Effect.tryPromise({
42
+ try: async () => {
43
+ await mkdir(summaryPath, { recursive: true });
44
+ await cp(sourcePath, stagedPkg, { recursive: true });
45
+ await copyLocalMoveDeps(sourcePath, stagedPkg, dirname(stagedPkg));
46
+ },
47
+ catch: (cause) => new CodegenBindingsFailed({
48
+ package: packageName,
49
+ sourcePath,
50
+ reason: "summary-failed",
51
+ hint: "Unable to stage a disposable copy of the Move package for summary.",
52
+ cause
53
+ })
54
+ });
55
+ return yield* capture(spawner, ChildProcess.make("sui", [
56
+ "move",
57
+ "summary",
58
+ "--path",
59
+ ".",
60
+ "--install-dir",
61
+ join(scratchDir, "install"),
62
+ "--output-directory",
63
+ join(summaryPath, "package_summaries")
64
+ ], { cwd: stagedPkg }), {
65
+ op: `sui move summary (${sourcePath})`,
66
+ nonZeroIsFailure: true,
67
+ stdoutTruncate: Infinity,
68
+ stderrTruncate: 4e3
69
+ }).pipe(Effect.mapError((cause) => new CodegenBindingsFailed({
70
+ package: packageName,
71
+ sourcePath,
72
+ reason: "summary-failed",
73
+ hint: "Install the Sui CLI and ensure this Move package can run `sui move summary`.",
74
+ cause
75
+ })));
76
+ }).pipe(Effect.tapError(() => cleanupScratch))).stdout)
77
+ };
78
+ }) });
79
+ }));
80
+ const runSummaryViaDocker = (runtime, input) => Effect.scoped(Effect.gen(function* () {
81
+ const scratchDir = yield* makeSummaryScratch(input);
82
+ const summaryPath = join(scratchDir, "package");
83
+ const cleanupScratch = Effect.promise(() => rm(scratchDir, {
84
+ recursive: true,
85
+ force: true
86
+ })).pipe(Effect.ignore);
87
+ const result = yield* Effect.gen(function* () {
88
+ yield* prepareSummaryPackage(summaryPath, input);
89
+ const image = input.buildImage ?? (yield* resolveDefaultSummaryImage(runtime, input));
90
+ const moveHome = join(homedir(), ".move");
91
+ yield* ensureMoveHome(moveHome, input);
92
+ const packageDir = basename(input.sourcePath);
93
+ const stagedRoot = join(scratchDir, "src");
94
+ yield* stageSummarySource(input, join(stagedRoot, packageDir));
95
+ const command = [
96
+ "set -e",
97
+ `cleanup_summary() { status=\$?; chmod -R a+rwX /summary /workspace 2>/dev/null || true; chown -R ${typeof process.getuid === "function" ? process.getuid() : 0}:${typeof process.getgid === "function" ? process.getgid() : 0} /summary /workspace 2>/dev/null || true; exit "\$status"; }`,
98
+ "trap cleanup_summary EXIT",
99
+ "mkdir -p /summary/package_summaries",
100
+ `sui move summary --path /workspace/${shellQuote(packageDir)} --install-dir /tmp/devstack-move-summary-install --output-directory /summary/package_summaries`
101
+ ].join("; ");
102
+ const run = yield* runtime.runOneShot({
103
+ image,
104
+ entrypoint: "sh",
105
+ argv: ["-c", command],
106
+ mounts: [
107
+ {
108
+ source: stagedRoot,
109
+ target: "/workspace"
110
+ },
111
+ {
112
+ source: summaryPath,
113
+ target: "/summary"
114
+ },
115
+ {
116
+ source: moveHome,
117
+ target: "/root/.move"
118
+ }
119
+ ],
120
+ timeoutMillis: 5 * 6e4
121
+ }).pipe(Effect.mapError((cause) => new CodegenBindingsFailed({
122
+ package: input.packageName,
123
+ sourcePath: input.sourcePath,
124
+ reason: "summary-failed",
125
+ hint: "Docker runtime failed while running `sui move summary` for bindings codegen.",
126
+ cause
127
+ })));
128
+ if (run.exitCode !== 0) return yield* Effect.fail(new CodegenBindingsFailed({
129
+ package: input.packageName,
130
+ sourcePath: input.sourcePath,
131
+ reason: "summary-failed",
132
+ hint: `sui move summary exited ${run.exitCode}. stderr: ${run.stderr || "(empty)"}; stdout tail: ${run.stdout.slice(-400) || "(empty)"}`
133
+ }));
134
+ return run;
135
+ }).pipe(Effect.tapError(() => cleanupScratch));
136
+ return {
137
+ packageName: input.packageName,
138
+ sourcePath: input.sourcePath,
139
+ summaryPath,
140
+ cleanupPath: scratchDir,
141
+ summaryJson: parseSummaryStdout(result.stdout)
142
+ };
143
+ }));
144
+ const makeSummaryScratch = (input) => Effect.tryPromise({
145
+ try: () => mkdtemp(join(tmpdir(), "devstack-move-summary-")),
146
+ catch: (cause) => new CodegenBindingsFailed({
147
+ package: input.packageName,
148
+ sourcePath: input.sourcePath,
149
+ reason: "summary-failed",
150
+ hint: "Unable to create a temporary directory for Move summary output.",
151
+ cause
152
+ })
153
+ });
154
+ const prepareSummaryPackage = (summaryPath, input) => Effect.tryPromise({
155
+ try: () => mkdir(summaryPath, { recursive: true }).then(() => void 0),
156
+ catch: (cause) => new CodegenBindingsFailed({
157
+ package: input.packageName,
158
+ sourcePath: input.sourcePath,
159
+ reason: "summary-failed",
160
+ hint: "Unable to prepare a temporary Move summary output directory.",
161
+ cause
162
+ })
163
+ });
164
+ const stageSummarySource = (input, stagedPkg) => Effect.tryPromise({
165
+ try: async () => {
166
+ await mkdir(dirname(stagedPkg), { recursive: true });
167
+ await cp(input.sourcePath, stagedPkg, { recursive: true });
168
+ await copyLocalMoveDeps(input.sourcePath, stagedPkg, dirname(stagedPkg));
169
+ },
170
+ catch: (cause) => new CodegenBindingsFailed({
171
+ package: input.packageName,
172
+ sourcePath: input.sourcePath,
173
+ reason: "summary-failed",
174
+ hint: "Unable to stage a disposable copy of the Move package for summary.",
175
+ cause
176
+ })
177
+ });
178
+ const resolveDefaultSummaryImage = (runtime, input) => runtime.ensureImage(suiCliImageBuildContext()).pipe(Effect.mapError((cause) => new CodegenBindingsFailed({
179
+ package: input.packageName,
180
+ sourcePath: input.sourcePath,
181
+ reason: "summary-failed",
182
+ hint: "Unable to resolve the Sui CLI container image for Move bindings codegen.",
183
+ cause
184
+ })));
185
+ const ensureMoveHome = (moveHome, input) => Effect.tryPromise({
186
+ try: () => mkdir(moveHome, { recursive: true }),
187
+ catch: (cause) => new CodegenBindingsFailed({
188
+ package: input.packageName,
189
+ sourcePath: input.sourcePath,
190
+ reason: "summary-failed",
191
+ hint: `Unable to create Move cache mount source "${moveHome}".`,
192
+ cause
193
+ })
194
+ }).pipe(Effect.asVoid);
195
+ const parseSummaryStdout = (stdout) => {
196
+ const trimmed = stdout.trim();
197
+ if (trimmed.length === 0) return null;
198
+ try {
199
+ return JSON.parse(trimmed);
200
+ } catch {
201
+ return trimmed;
202
+ }
203
+ };
204
+ //#endregion
205
+ export { layerSuiMoveSummaryRunnerDocker };
206
+
207
+ //# sourceMappingURL=move-summary-runner.mjs.map