@mysten-incubation/devstack 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (838) hide show
  1. package/README.md +7 -3
  2. package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  3. package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  4. package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  5. package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  6. package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  7. package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  8. package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  9. package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  10. package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  11. package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  12. package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  13. package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
  14. package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
  15. package/dashboard-ui/assets/index-Deml9drg.css +1 -0
  16. package/dashboard-ui/index.html +13 -0
  17. package/dist/api/define-capabilities.d.mts +14 -3
  18. package/dist/api/define-capabilities.mjs +18 -1
  19. package/dist/api/define-capabilities.mjs.map +1 -1
  20. package/dist/api/define-devstack.d.mts +1 -1
  21. package/dist/api/define-devstack.mjs +6 -26
  22. package/dist/api/define-devstack.mjs.map +1 -1
  23. package/dist/api/define-plugin.d.mts +1 -0
  24. package/dist/api/define-plugin.mjs +2 -0
  25. package/dist/api/inference-network.d.mts +132 -0
  26. package/dist/api/inference-network.mjs +105 -16
  27. package/dist/api/inference-network.mjs.map +1 -1
  28. package/dist/api/plugin-errors.d.mts +7 -0
  29. package/dist/api/run-stack.d.mts +20 -9
  30. package/dist/api/run-stack.mjs +56 -29
  31. package/dist/api/run-stack.mjs.map +1 -1
  32. package/dist/build-integrations/playwright/config.d.mts +6 -4
  33. package/dist/build-integrations/playwright/config.mjs +5 -3
  34. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  35. package/dist/build-integrations/playwright/errors.d.mts +1 -1
  36. package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
  37. package/dist/build-integrations/playwright/global-setup.mjs +250 -13
  38. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  39. package/dist/build-integrations/playwright/index.d.mts +5 -3
  40. package/dist/build-integrations/playwright/index.mjs +4 -2
  41. package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
  42. package/dist/build-integrations/playwright/stack-context.mjs +24 -63
  43. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  44. package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
  45. package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
  46. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  47. package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
  48. package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
  49. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
  51. package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
  52. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
  53. package/dist/build-integrations/runtime/discover.d.mts +38 -30
  54. package/dist/build-integrations/runtime/discover.mjs +73 -70
  55. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
  57. package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
  58. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  59. package/dist/build-integrations/runtime/index.d.mts +7 -2
  60. package/dist/build-integrations/runtime/index.mjs +9 -2
  61. package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
  62. package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
  63. package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
  64. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
  65. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
  66. package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
  67. package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
  68. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  69. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
  70. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
  71. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
  72. package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
  73. package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
  74. package/dist/build-integrations/vite/index.d.mts +51 -0
  75. package/dist/build-integrations/vite/index.mjs +73 -0
  76. package/dist/build-integrations/vite/index.mjs.map +1 -0
  77. package/dist/build-integrations/vitest/env.d.mts +4 -3
  78. package/dist/build-integrations/vitest/env.mjs +6 -4
  79. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  80. package/dist/build-integrations/vitest/errors.d.mts +25 -4
  81. package/dist/build-integrations/vitest/errors.mjs +15 -2
  82. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  83. package/dist/build-integrations/vitest/index.d.mts +2 -2
  84. package/dist/build-integrations/vitest/index.mjs +3 -3
  85. package/dist/build-integrations/vitest/setup.d.mts +4 -2
  86. package/dist/build-integrations/vitest/setup.mjs +2 -2
  87. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  88. package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
  89. package/dist/build-integrations/vitest/stack-context.mjs +33 -13
  90. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  91. package/dist/cli/bail.mjs +23 -0
  92. package/dist/cli/bail.mjs.map +1 -0
  93. package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
  94. package/dist/cli/doctor-probes.mjs.map +1 -0
  95. package/dist/cli/main.d.mts +15 -1
  96. package/dist/cli/main.mjs +166 -482
  97. package/dist/cli/main.mjs.map +1 -1
  98. package/dist/cli/prune-direct.mjs +31 -201
  99. package/dist/cli/prune-direct.mjs.map +1 -1
  100. package/dist/cli/snapshot-reader.mjs +14 -11
  101. package/dist/cli/snapshot-reader.mjs.map +1 -1
  102. package/dist/cli/up-lifecycle.mjs +4 -1
  103. package/dist/cli/up-lifecycle.mjs.map +1 -1
  104. package/dist/cli/wirings/apply.mjs +95 -0
  105. package/dist/cli/wirings/apply.mjs.map +1 -0
  106. package/dist/cli/wirings/build-verb-layers.mjs +42 -0
  107. package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
  108. package/dist/cli/wirings/config-loader.mjs +69 -0
  109. package/dist/cli/wirings/config-loader.mjs.map +1 -0
  110. package/dist/cli/wirings/engine-command.mjs +30 -0
  111. package/dist/cli/wirings/engine-command.mjs.map +1 -0
  112. package/dist/cli/wirings/identity.mjs +72 -0
  113. package/dist/cli/wirings/identity.mjs.map +1 -0
  114. package/dist/cli/wirings/provide-file-system.mjs +7 -0
  115. package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
  116. package/dist/cli/wirings/snapshot.mjs +177 -0
  117. package/dist/cli/wirings/snapshot.mjs.map +1 -0
  118. package/dist/cli/wirings/up.mjs +287 -0
  119. package/dist/cli/wirings/up.mjs.map +1 -0
  120. package/dist/cli/wirings/wipe.mjs +40 -0
  121. package/dist/cli/wirings/wipe.mjs.map +1 -0
  122. package/dist/contracts/capability-decl.d.mts +0 -2
  123. package/dist/contracts/codegenable.d.mts +43 -0
  124. package/dist/contracts/container-runtime.d.mts +26 -1
  125. package/dist/contracts/faucet-strategy.d.mts +25 -0
  126. package/dist/contracts/funding-strategy.d.mts +42 -0
  127. package/dist/contracts/plugin-expander.mjs +60 -0
  128. package/dist/contracts/plugin-expander.mjs.map +1 -0
  129. package/dist/contracts/projection.d.mts +5 -3
  130. package/dist/contracts/renderer.d.mts +23 -0
  131. package/dist/contracts/routable.d.mts +14 -1
  132. package/dist/contracts/snapshotable.d.mts +25 -3
  133. package/dist/contracts/wallet-protocol.d.mts +52 -0
  134. package/dist/contracts/wallet-protocol.mjs +52 -0
  135. package/dist/contracts/wallet-protocol.mjs.map +1 -0
  136. package/dist/index.d.mts +26 -25
  137. package/dist/index.mjs +20 -13
  138. package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
  139. package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
  140. package/dist/orchestrators/codegen/bindings.d.mts +1 -2
  141. package/dist/orchestrators/codegen/bindings.mjs +52 -186
  142. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/emit.mjs +19 -1
  144. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  145. package/dist/orchestrators/codegen/errors.mjs +8 -3
  146. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/format.mjs +47 -39
  148. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/gitignore.mjs +3 -1
  150. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  151. package/dist/orchestrators/codegen/output-location.mjs +40 -0
  152. package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
  153. package/dist/orchestrators/codegen/paths.d.mts +1 -1
  154. package/dist/orchestrators/codegen/paths.mjs +40 -14
  155. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  156. package/dist/orchestrators/codegen/permissions.mjs +3 -1
  157. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  158. package/dist/orchestrators/codegen/service.mjs +157 -105
  159. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  160. package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
  161. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
  162. package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
  163. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
  164. package/dist/orchestrators/router/cleanup.mjs +26 -27
  165. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  166. package/dist/orchestrators/router/entrypoints.mjs +2 -2
  167. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  168. package/dist/orchestrators/router/file-provider.mjs +14 -5
  169. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  170. package/dist/orchestrators/router/hostname.mjs +19 -55
  171. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  172. package/dist/orchestrators/router/index.mjs +11 -0
  173. package/dist/orchestrators/router/profile.mjs +2 -2
  174. package/dist/orchestrators/router/sentinels.mjs +26 -0
  175. package/dist/orchestrators/router/sentinels.mjs.map +1 -0
  176. package/dist/orchestrators/router/service.mjs +40 -37
  177. package/dist/orchestrators/router/service.mjs.map +1 -1
  178. package/dist/orchestrators/router/traefik-container.mjs +27 -16
  179. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  180. package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
  181. package/dist/orchestrators/run.mjs.map +1 -0
  182. package/dist/orchestrators/runtime-composition.d.mts +1 -1
  183. package/dist/orchestrators/runtime-composition.mjs +123 -39
  184. package/dist/orchestrators/runtime-composition.mjs.map +1 -1
  185. package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
  186. package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
  187. package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
  188. package/dist/orchestrators/snapshot/capture.mjs +42 -28
  189. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  190. package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
  191. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  192. package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
  193. package/dist/orchestrators/snapshot/index.mjs +13 -0
  194. package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
  195. package/dist/orchestrators/snapshot/integrity.mjs +73 -17
  196. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  197. package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
  198. package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
  199. package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
  200. package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
  201. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
  202. package/dist/orchestrators/snapshot/prune.mjs +20 -55
  203. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  204. package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
  205. package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
  206. package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
  207. package/dist/orchestrators/snapshot/restore.mjs +118 -84
  208. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  209. package/dist/orchestrators/snapshot/service.mjs +53 -56
  210. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  211. package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
  212. package/dist/orchestrators/snapshot/state-document.mjs +47 -7
  213. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
  214. package/dist/orchestrators/snapshot/wipe.mjs +67 -10
  215. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  216. package/dist/plugins/account/codegen.mjs +9 -8
  217. package/dist/plugins/account/codegen.mjs.map +1 -1
  218. package/dist/plugins/account/errors.d.mts +33 -6
  219. package/dist/plugins/account/errors.mjs.map +1 -1
  220. package/dist/plugins/account/funding.d.mts +29 -19
  221. package/dist/plugins/account/funding.mjs +84 -66
  222. package/dist/plugins/account/funding.mjs.map +1 -1
  223. package/dist/plugins/account/index.d.mts +2 -4
  224. package/dist/plugins/account/index.mjs +64 -31
  225. package/dist/plugins/account/index.mjs.map +1 -1
  226. package/dist/plugins/account/keypair.mjs +6 -9
  227. package/dist/plugins/account/keypair.mjs.map +1 -1
  228. package/dist/plugins/account/lease.mjs +1 -0
  229. package/dist/plugins/account/lease.mjs.map +1 -1
  230. package/dist/plugins/account/registry.d.mts +14 -1
  231. package/dist/plugins/account/registry.mjs +18 -18
  232. package/dist/plugins/account/registry.mjs.map +1 -1
  233. package/dist/plugins/account/service.d.mts +23 -4
  234. package/dist/plugins/account/service.mjs +83 -45
  235. package/dist/plugins/account/service.mjs.map +1 -1
  236. package/dist/plugins/account/snapshot.mjs +2 -5
  237. package/dist/plugins/account/snapshot.mjs.map +1 -1
  238. package/dist/plugins/account/spans.mjs +16 -0
  239. package/dist/plugins/account/spans.mjs.map +1 -0
  240. package/dist/plugins/account/variants/keystore.mjs +6 -8
  241. package/dist/plugins/account/variants/keystore.mjs.map +1 -1
  242. package/dist/plugins/action/build-context.d.mts +3 -2
  243. package/dist/plugins/action/errors.d.mts +16 -12
  244. package/dist/plugins/action/errors.mjs.map +1 -1
  245. package/dist/plugins/action/execute.mjs +65 -103
  246. package/dist/plugins/action/execute.mjs.map +1 -1
  247. package/dist/plugins/action/index.d.mts +0 -2
  248. package/dist/plugins/action/index.mjs +17 -13
  249. package/dist/plugins/action/index.mjs.map +1 -1
  250. package/dist/plugins/action/service.mjs +38 -35
  251. package/dist/plugins/action/service.mjs.map +1 -1
  252. package/dist/plugins/action/spans.mjs +11 -0
  253. package/dist/plugins/action/spans.mjs.map +1 -0
  254. package/dist/plugins/coin/codegen.mjs +9 -8
  255. package/dist/plugins/coin/codegen.mjs.map +1 -1
  256. package/dist/plugins/coin/discovery.mjs +8 -4
  257. package/dist/plugins/coin/discovery.mjs.map +1 -1
  258. package/dist/plugins/coin/index.d.mts +11 -29
  259. package/dist/plugins/coin/index.mjs +56 -27
  260. package/dist/plugins/coin/index.mjs.map +1 -1
  261. package/dist/plugins/coin/metadata.mjs +8 -15
  262. package/dist/plugins/coin/metadata.mjs.map +1 -1
  263. package/dist/plugins/coin/mint.d.mts +30 -11
  264. package/dist/plugins/coin/mint.mjs +78 -74
  265. package/dist/plugins/coin/mint.mjs.map +1 -1
  266. package/dist/plugins/coin/registry.mjs +4 -7
  267. package/dist/plugins/coin/registry.mjs.map +1 -1
  268. package/dist/plugins/coin/service.d.mts +39 -1
  269. package/dist/plugins/coin/service.mjs +11 -4
  270. package/dist/plugins/coin/service.mjs.map +1 -1
  271. package/dist/plugins/coin/spans.mjs +20 -0
  272. package/dist/plugins/coin/spans.mjs.map +1 -0
  273. package/dist/plugins/dashboard/domain.mjs +402 -0
  274. package/dist/plugins/dashboard/domain.mjs.map +1 -0
  275. package/dist/plugins/dashboard/index.d.mts +29 -0
  276. package/dist/plugins/dashboard/index.mjs +91 -0
  277. package/dist/plugins/dashboard/index.mjs.map +1 -0
  278. package/dist/plugins/dashboard/origin-policy.mjs +36 -0
  279. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
  280. package/dist/plugins/dashboard/routable.mjs +27 -0
  281. package/dist/plugins/dashboard/routable.mjs.map +1 -0
  282. package/dist/plugins/dashboard/schema/builder.mjs +21 -0
  283. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
  284. package/dist/plugins/dashboard/schema/enums.mjs +72 -0
  285. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
  286. package/dist/plugins/dashboard/schema/root.mjs +351 -0
  287. package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
  288. package/dist/plugins/dashboard/schema/types.mjs +508 -0
  289. package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
  290. package/dist/plugins/dashboard/schema.mjs +11 -0
  291. package/dist/plugins/dashboard/schema.mjs.map +1 -0
  292. package/dist/plugins/dashboard/server.mjs +166 -0
  293. package/dist/plugins/dashboard/server.mjs.map +1 -0
  294. package/dist/plugins/deepbook/deploy.mjs +53 -115
  295. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  296. package/dist/plugins/deepbook/errors.mjs +1 -0
  297. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  298. package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
  299. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  300. package/dist/plugins/deepbook/hash.mjs +9 -0
  301. package/dist/plugins/deepbook/hash.mjs.map +1 -0
  302. package/dist/plugins/deepbook/index.d.mts +1 -10
  303. package/dist/plugins/deepbook/index.mjs +25 -22
  304. package/dist/plugins/deepbook/index.mjs.map +1 -1
  305. package/dist/plugins/deepbook/pyth/index.mjs +26 -55
  306. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  307. package/dist/plugins/deepbook/snapshot.mjs +17 -29
  308. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  309. package/dist/plugins/deepbook/spans.mjs +18 -0
  310. package/dist/plugins/deepbook/spans.mjs.map +1 -0
  311. package/dist/plugins/deepbook/type-strings.mjs +65 -0
  312. package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
  313. package/dist/plugins/deepbook/types.d.mts +2 -3
  314. package/dist/plugins/deepbook/types.mjs.map +1 -1
  315. package/dist/plugins/faucet/dispatcher.d.mts +21 -2
  316. package/dist/plugins/faucet/dispatcher.mjs +1 -2
  317. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  318. package/dist/plugins/faucet/errors.d.mts +11 -24
  319. package/dist/plugins/faucet/errors.mjs.map +1 -1
  320. package/dist/plugins/faucet/http.mjs +33 -14
  321. package/dist/plugins/faucet/http.mjs.map +1 -1
  322. package/dist/plugins/faucet/index.d.mts +15 -5
  323. package/dist/plugins/faucet/index.mjs +3 -0
  324. package/dist/plugins/faucet/index.mjs.map +1 -1
  325. package/dist/plugins/faucet/spans.mjs +12 -0
  326. package/dist/plugins/faucet/spans.mjs.map +1 -0
  327. package/dist/plugins/host-service/errors.d.mts +1 -1
  328. package/dist/plugins/host-service/index.mjs +34 -8
  329. package/dist/plugins/host-service/index.mjs.map +1 -1
  330. package/dist/plugins/host-service/routable.mjs +2 -1
  331. package/dist/plugins/host-service/routable.mjs.map +1 -1
  332. package/dist/plugins/host-service/service.d.mts +21 -0
  333. package/dist/plugins/host-service/service.mjs +136 -81
  334. package/dist/plugins/host-service/service.mjs.map +1 -1
  335. package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
  336. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
  337. package/dist/plugins/internal/codegen-helpers.mjs +18 -0
  338. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
  339. package/dist/plugins/internal/funding-failure-error.mjs +32 -0
  340. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
  341. package/dist/plugins/package/build.mjs +1 -1
  342. package/dist/plugins/package/build.mjs.map +1 -1
  343. package/dist/plugins/package/codegen.mjs +26 -0
  344. package/dist/plugins/package/codegen.mjs.map +1 -1
  345. package/dist/plugins/package/errors.d.mts +16 -6
  346. package/dist/plugins/package/errors.mjs.map +1 -1
  347. package/dist/plugins/package/index.d.mts +0 -4
  348. package/dist/plugins/package/index.mjs +27 -21
  349. package/dist/plugins/package/index.mjs.map +1 -1
  350. package/dist/plugins/package/mode-known.mjs +26 -12
  351. package/dist/plugins/package/mode-known.mjs.map +1 -1
  352. package/dist/plugins/package/mode-local.mjs +47 -41
  353. package/dist/plugins/package/mode-local.mjs.map +1 -1
  354. package/dist/plugins/package/publish-executor.mjs +55 -114
  355. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  356. package/dist/plugins/package/registry.mjs +2 -1
  357. package/dist/plugins/package/registry.mjs.map +1 -1
  358. package/dist/plugins/package/service.mjs.map +1 -1
  359. package/dist/plugins/package/spans.mjs +14 -0
  360. package/dist/plugins/package/spans.mjs.map +1 -0
  361. package/dist/plugins/postgres/db-ensure.mjs +19 -12
  362. package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
  363. package/dist/plugins/postgres/errors.d.mts +5 -0
  364. package/dist/plugins/postgres/errors.mjs.map +1 -1
  365. package/dist/plugins/postgres/index.mjs +10 -17
  366. package/dist/plugins/postgres/index.mjs.map +1 -1
  367. package/dist/plugins/postgres/service.mjs +58 -24
  368. package/dist/plugins/postgres/service.mjs.map +1 -1
  369. package/dist/plugins/postgres/snapshot.mjs.map +1 -1
  370. package/dist/plugins/postgres/spans.mjs +11 -0
  371. package/dist/plugins/postgres/spans.mjs.map +1 -0
  372. package/dist/plugins/router-entrypoints.mjs +4 -4
  373. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
  375. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
  377. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  378. package/dist/plugins/seal/codegen.d.mts +2 -3
  379. package/dist/plugins/seal/codegen.mjs.map +1 -1
  380. package/dist/plugins/seal/config-render.mjs +35 -8
  381. package/dist/plugins/seal/config-render.mjs.map +1 -1
  382. package/dist/plugins/seal/deploy.mjs +31 -39
  383. package/dist/plugins/seal/deploy.mjs.map +1 -1
  384. package/dist/plugins/seal/errors.d.mts +1 -3
  385. package/dist/plugins/seal/errors.mjs +7 -1
  386. package/dist/plugins/seal/errors.mjs.map +1 -1
  387. package/dist/plugins/seal/index.d.mts +1 -6
  388. package/dist/plugins/seal/index.mjs +40 -14
  389. package/dist/plugins/seal/index.mjs.map +1 -1
  390. package/dist/plugins/seal/key-manager.d.mts +1 -9
  391. package/dist/plugins/seal/key-manager.mjs +2 -18
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  393. package/dist/plugins/seal/key-server.mjs +37 -36
  394. package/dist/plugins/seal/key-server.mjs.map +1 -1
  395. package/dist/plugins/seal/keygen.mjs +16 -17
  396. package/dist/plugins/seal/keygen.mjs.map +1 -1
  397. package/dist/plugins/seal/mode/fork-known.mjs +36 -14
  398. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  399. package/dist/plugins/seal/mode/live.d.mts +6 -4
  400. package/dist/plugins/seal/mode/live.mjs +14 -21
  401. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  402. package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
  403. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  404. package/dist/plugins/seal/registry-publish.mjs +1 -0
  405. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  406. package/dist/plugins/seal/routable.mjs.map +1 -1
  407. package/dist/plugins/seal/service.mjs.map +1 -1
  408. package/dist/plugins/seal/spans.mjs +18 -0
  409. package/dist/plugins/seal/spans.mjs.map +1 -0
  410. package/dist/plugins/sui/auto-tick.mjs +17 -23
  411. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  412. package/dist/plugins/sui/chain-build-container.mjs +18 -0
  413. package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
  414. package/dist/plugins/sui/chain-probe.d.mts +5 -5
  415. package/dist/plugins/sui/chain-probe.mjs +28 -58
  416. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  417. package/dist/plugins/sui/codegen.mjs +26 -0
  418. package/dist/plugins/sui/codegen.mjs.map +1 -1
  419. package/dist/plugins/sui/errors.d.mts +2 -29
  420. package/dist/plugins/sui/errors.mjs +1 -3
  421. package/dist/plugins/sui/errors.mjs.map +1 -1
  422. package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
  423. package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
  424. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
  425. package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
  426. package/dist/plugins/sui/fork-orchestration.mjs +170 -2
  427. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  428. package/dist/plugins/sui/fork-transaction.d.mts +2 -0
  429. package/dist/plugins/sui/fork-transaction.mjs +92 -28
  430. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  431. package/dist/plugins/sui/index.d.mts +33 -70
  432. package/dist/plugins/sui/index.mjs +58 -35
  433. package/dist/plugins/sui/index.mjs.map +1 -1
  434. package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
  435. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
  436. package/dist/plugins/sui/mode/external.mjs +7 -13
  437. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  438. package/dist/plugins/sui/mode/fork.mjs +136 -59
  439. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  440. package/dist/plugins/sui/mode/live.mjs +10 -16
  441. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  442. package/dist/plugins/sui/mode/local.mjs +37 -36
  443. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  444. package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
  445. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  446. package/dist/plugins/sui/mode/shared.d.mts +1 -5
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  448. package/dist/plugins/sui/mode/spec.d.mts +18 -0
  449. package/dist/plugins/sui/move-summary-runner.mjs +207 -0
  450. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
  451. package/dist/plugins/sui/network-resolver.d.mts +4 -3
  452. package/dist/plugins/sui/service.mjs.map +1 -1
  453. package/dist/plugins/sui/snapshot.mjs +3 -0
  454. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  455. package/dist/plugins/sui/spans.mjs +17 -0
  456. package/dist/plugins/sui/spans.mjs.map +1 -0
  457. package/dist/plugins/wallet/codegen.d.mts +0 -1
  458. package/dist/plugins/wallet/codegen.mjs +8 -9
  459. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  460. package/dist/plugins/wallet/index.d.mts +6 -8
  461. package/dist/plugins/wallet/index.mjs +46 -35
  462. package/dist/plugins/wallet/index.mjs.map +1 -1
  463. package/dist/plugins/wallet/origin-policy.mjs +12 -28
  464. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  465. package/dist/plugins/wallet/pairing.mjs +6 -4
  466. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  467. package/dist/plugins/wallet/protocol.d.mts +1 -0
  468. package/dist/plugins/wallet/protocol.mjs +5 -44
  469. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  470. package/dist/plugins/wallet/routable.mjs +2 -8
  471. package/dist/plugins/wallet/routable.mjs.map +1 -1
  472. package/dist/plugins/wallet/server.mjs +36 -44
  473. package/dist/plugins/wallet/server.mjs.map +1 -1
  474. package/dist/plugins/wallet/service.d.mts +1 -5
  475. package/dist/plugins/wallet/service.mjs +22 -18
  476. package/dist/plugins/wallet/service.mjs.map +1 -1
  477. package/dist/plugins/wallet/spans.mjs +22 -0
  478. package/dist/plugins/wallet/spans.mjs.map +1 -0
  479. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
  480. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  481. package/dist/plugins/walrus/codegen.d.mts +3 -3
  482. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  483. package/dist/plugins/walrus/deploy-paths.mjs +21 -5
  484. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  485. package/dist/plugins/walrus/deploy.mjs +67 -69
  486. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  487. package/dist/plugins/walrus/errors.mjs +1 -0
  488. package/dist/plugins/walrus/errors.mjs.map +1 -1
  489. package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
  490. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  491. package/dist/plugins/walrus/index.d.mts +2 -13
  492. package/dist/plugins/walrus/index.mjs +18 -23
  493. package/dist/plugins/walrus/index.mjs.map +1 -1
  494. package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
  495. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  496. package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
  497. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  498. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  499. package/dist/plugins/walrus/routable.mjs +7 -23
  500. package/dist/plugins/walrus/routable.mjs.map +1 -1
  501. package/dist/plugins/walrus/service.mjs.map +1 -1
  502. package/dist/plugins/walrus/spans.mjs +18 -0
  503. package/dist/plugins/walrus/spans.mjs.map +1 -0
  504. package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
  505. package/dist/plugins/walrus/storage-nodes.mjs +15 -8
  506. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  507. package/dist/plugins/walrus/wal-swap.mjs +58 -15
  508. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  509. package/dist/primitives/artifact-publisher.d.mts +1 -1
  510. package/dist/primitives/artifact-publisher.mjs +15 -0
  511. package/dist/primitives/artifact-publisher.mjs.map +1 -0
  512. package/dist/runtime/docker/client.mjs +17 -4
  513. package/dist/runtime/docker/client.mjs.map +1 -1
  514. package/dist/runtime/docker/container.mjs +219 -132
  515. package/dist/runtime/docker/container.mjs.map +1 -1
  516. package/dist/runtime/docker/errors.mjs +0 -6
  517. package/dist/runtime/docker/errors.mjs.map +1 -1
  518. package/dist/runtime/docker/exec.mjs +21 -18
  519. package/dist/runtime/docker/exec.mjs.map +1 -1
  520. package/dist/runtime/docker/image.mjs +36 -13
  521. package/dist/runtime/docker/image.mjs.map +1 -1
  522. package/dist/runtime/docker/index.mjs +14 -0
  523. package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
  524. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
  525. package/dist/runtime/docker/inventory.mjs +14 -11
  526. package/dist/runtime/docker/inventory.mjs.map +1 -1
  527. package/dist/runtime/docker/labels.mjs +38 -5
  528. package/dist/runtime/docker/labels.mjs.map +1 -1
  529. package/dist/runtime/docker/logs.d.mts +1 -1
  530. package/dist/runtime/docker/logs.mjs.map +1 -1
  531. package/dist/runtime/docker/network.mjs +83 -47
  532. package/dist/runtime/docker/network.mjs.map +1 -1
  533. package/dist/runtime/docker/render-run-args.mjs +82 -0
  534. package/dist/runtime/docker/render-run-args.mjs.map +1 -0
  535. package/dist/runtime/docker/service.d.mts +1 -1
  536. package/dist/runtime/docker/service.mjs +12 -7
  537. package/dist/runtime/docker/service.mjs.map +1 -1
  538. package/dist/runtime/docker/sweep.mjs +118 -43
  539. package/dist/runtime/docker/sweep.mjs.map +1 -1
  540. package/dist/runtime/docker/volume.mjs +2 -0
  541. package/dist/runtime/docker/volume.mjs.map +1 -1
  542. package/dist/runtime/docker/wrap.mjs +30 -1
  543. package/dist/runtime/docker/wrap.mjs.map +1 -1
  544. package/dist/substrate/cross-process.mjs +14 -8
  545. package/dist/substrate/cross-process.mjs.map +1 -1
  546. package/dist/substrate/event-time.mjs +33 -0
  547. package/dist/substrate/event-time.mjs.map +1 -0
  548. package/dist/substrate/events.d.mts +28 -8
  549. package/dist/substrate/identity.d.mts +2 -1
  550. package/dist/substrate/manifest.d.mts +68 -5
  551. package/dist/substrate/manifest.mjs +34 -5
  552. package/dist/substrate/manifest.mjs.map +1 -1
  553. package/dist/substrate/network.d.mts +3 -5
  554. package/dist/substrate/options.d.mts +0 -2
  555. package/dist/substrate/plugin.d.mts +13 -0
  556. package/dist/substrate/plugin.mjs +4 -2
  557. package/dist/substrate/plugin.mjs.map +1 -1
  558. package/dist/substrate/projection.d.mts +35 -3
  559. package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
  560. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
  561. package/dist/substrate/runtime/atomic-write.mjs +97 -32
  562. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  563. package/dist/substrate/runtime/cache/index.mjs +3 -0
  564. package/dist/substrate/runtime/cache/schema.mjs +2 -2
  565. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  566. package/dist/substrate/runtime/cache/service.mjs +9 -7
  567. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  568. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
  569. package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
  570. package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
  571. package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
  572. package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
  573. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
  574. package/dist/substrate/runtime/config-validation.d.mts +1 -13
  575. package/dist/substrate/runtime/config-validation.mjs +2 -91
  576. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  577. package/dist/substrate/runtime/container-runtime.d.mts +1 -0
  578. package/dist/substrate/runtime/container-runtime.mjs +2 -0
  579. package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
  580. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
  581. package/dist/substrate/runtime/control-plane/service.mjs +7 -0
  582. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
  583. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
  584. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  585. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
  586. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  587. package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
  588. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
  589. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  590. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
  591. package/dist/substrate/runtime/cross-process/index.mjs +11 -0
  592. package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
  593. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
  594. package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
  595. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  596. package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
  597. package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
  598. package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
  599. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
  600. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
  601. package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
  602. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  603. package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
  604. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
  605. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
  606. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
  607. package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
  608. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  609. package/dist/substrate/runtime/current-plugin.mjs +2 -2
  610. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  611. package/dist/substrate/runtime/errors.mjs +12 -6
  612. package/dist/substrate/runtime/errors.mjs.map +1 -1
  613. package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
  614. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
  615. package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
  616. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
  617. package/dist/substrate/runtime/host-gateway.mjs +20 -0
  618. package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
  619. package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
  620. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  621. package/dist/substrate/runtime/http-probe.d.mts +1 -1
  622. package/dist/substrate/runtime/index.mjs +14 -0
  623. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
  624. package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
  625. package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
  626. package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
  627. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  628. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
  629. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  630. package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
  631. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
  632. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
  633. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  634. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
  635. package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
  636. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  637. package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
  638. package/dist/substrate/runtime/managed-container.d.mts +19 -1
  639. package/dist/substrate/runtime/managed-container.mjs +20 -1
  640. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  641. package/dist/substrate/runtime/manifest/index.mjs +3 -0
  642. package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
  643. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  644. package/dist/substrate/runtime/mode-errors.mjs +20 -0
  645. package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
  646. package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
  647. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  648. package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
  649. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
  650. package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
  651. package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
  652. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
  653. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  654. package/dist/substrate/runtime/observability/index.mjs +13 -0
  655. package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
  656. package/dist/substrate/runtime/observability/log-store.mjs +175 -0
  657. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
  658. package/dist/substrate/runtime/observability/logger.d.mts +2 -1
  659. package/dist/substrate/runtime/observability/logger.mjs +5 -9
  660. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  661. package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
  662. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
  663. package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
  664. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  665. package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
  666. package/dist/substrate/runtime/observability/redaction.mjs +8 -14
  667. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  668. package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
  669. package/dist/substrate/runtime/observability/span-store.mjs +110 -0
  670. package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
  671. package/dist/substrate/runtime/observability/spans.mjs +14 -14
  672. package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
  673. package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
  674. package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
  675. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
  676. package/dist/substrate/runtime/paths.d.mts +1 -1
  677. package/dist/substrate/runtime/paths.mjs +4 -3
  678. package/dist/substrate/runtime/paths.mjs.map +1 -1
  679. package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
  680. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
  681. package/dist/substrate/runtime/port-broker/index.mjs +3 -0
  682. package/dist/substrate/runtime/port-broker/service.mjs +170 -126
  683. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  684. package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
  685. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  686. package/dist/substrate/runtime/probes.d.mts +7 -5
  687. package/dist/substrate/runtime/probes.mjs +3 -1
  688. package/dist/substrate/runtime/probes.mjs.map +1 -1
  689. package/dist/substrate/runtime/projection/index.mjs +4 -0
  690. package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
  691. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  692. package/dist/substrate/runtime/projection/persisted.mjs +33 -15
  693. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
  694. package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
  695. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  696. package/dist/substrate/runtime/projection/update.mjs +88 -24
  697. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  698. package/dist/substrate/runtime/random-suffix.mjs +11 -0
  699. package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
  700. package/dist/substrate/runtime/retry-policy.d.mts +59 -1
  701. package/dist/substrate/runtime/retry-policy.mjs +66 -1
  702. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  703. package/dist/substrate/runtime/routed-url.d.mts +1 -0
  704. package/dist/substrate/runtime/routed-url.mjs +79 -0
  705. package/dist/substrate/runtime/routed-url.mjs.map +1 -0
  706. package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
  707. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  708. package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
  709. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  710. package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
  711. package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
  712. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
  713. package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
  714. package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
  715. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
  716. package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
  717. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  718. package/dist/substrate/runtime/state-store/index.d.mts +1 -0
  719. package/dist/substrate/runtime/state-store/index.mjs +3 -0
  720. package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
  721. package/dist/substrate/runtime/state-store/schema.mjs +19 -14
  722. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
  723. package/dist/substrate/runtime/state-store/service.d.mts +1 -0
  724. package/dist/substrate/runtime/state-store/service.mjs +145 -0
  725. package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
  726. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
  727. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
  728. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
  729. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
  730. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  731. package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
  732. package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
  733. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  734. package/dist/substrate/runtime/subnet-broker.mjs +60 -0
  735. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
  736. package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
  737. package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
  738. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
  739. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
  740. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
  741. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
  742. package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
  743. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
  744. package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
  745. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
  746. package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
  747. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
  748. package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
  749. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
  750. package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
  751. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
  752. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
  753. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
  754. package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
  755. package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
  756. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
  757. package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
  758. package/dist/substrate/runtime/supervisor/index.mjs +3 -0
  759. package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
  760. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
  761. package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
  762. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
  763. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
  764. package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
  765. package/dist/substrate/runtime/supervisor/state.mjs +22 -0
  766. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
  767. package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
  768. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
  769. package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
  770. package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
  771. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
  772. package/dist/substrate/runtime/typed-env.mjs +8 -0
  773. package/dist/substrate/runtime/typed-env.mjs.map +1 -0
  774. package/dist/substrate/state-store.d.mts +1 -0
  775. package/dist/substrate/versioned-doc-schema.mjs +17 -0
  776. package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
  777. package/dist/substrate/versioned-doc-sync.mjs +94 -0
  778. package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
  779. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  780. package/dist/surfaces/cli/commands/index.mjs +9 -0
  781. package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
  782. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
  783. package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
  784. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  785. package/dist/surfaces/cli/commands/prune.mjs +34 -17
  786. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  787. package/dist/surfaces/cli/commands/status.mjs +2 -2
  788. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  789. package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
  790. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  791. package/dist/surfaces/cli/commands/wipe.mjs +38 -4
  792. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  793. package/dist/surfaces/cli/errors.mjs +1 -1
  794. package/dist/surfaces/cli/errors.mjs.map +1 -1
  795. package/dist/surfaces/cli/flags.mjs +0 -1
  796. package/dist/surfaces/cli/flags.mjs.map +1 -1
  797. package/dist/surfaces/cli/index.mjs +98 -18
  798. package/dist/surfaces/cli/index.mjs.map +1 -1
  799. package/dist/surfaces/cli/output.mjs +1 -0
  800. package/dist/surfaces/cli/output.mjs.map +1 -1
  801. package/dist/surfaces/cli/sysexits.mjs +2 -1
  802. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  803. package/dist/surfaces/tui/app.mjs +25 -3
  804. package/dist/surfaces/tui/app.mjs.map +1 -1
  805. package/dist/surfaces/tui/display-derivation.mjs +23 -74
  806. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  807. package/dist/surfaces/tui/event-log.mjs +35 -23
  808. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  809. package/dist/surfaces/tui/input.mjs +5 -1
  810. package/dist/surfaces/tui/input.mjs.map +1 -1
  811. package/dist/surfaces/tui/plain-renderer.mjs +70 -34
  812. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  813. package/package.json +24 -4
  814. package/dist/contracts/liveness-classifier.d.mts +0 -19
  815. package/dist/contracts/network-resolver.d.mts +0 -15
  816. package/dist/contracts/network-resolver.mjs +0 -7
  817. package/dist/contracts/network-resolver.mjs.map +0 -1
  818. package/dist/orchestrators/codegen/extras.mjs +0 -16
  819. package/dist/orchestrators/codegen/extras.mjs.map +0 -1
  820. package/dist/plugins/deepbook/routable.mjs +0 -21
  821. package/dist/plugins/deepbook/routable.mjs.map +0 -1
  822. package/dist/plugins/faucet/service.d.mts +0 -20
  823. package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
  824. package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
  825. package/dist/plugins/sui/seed-objects.d.mts +0 -18
  826. package/dist/plugins/sui/seed-objects.mjs +0 -25
  827. package/dist/plugins/sui/seed-objects.mjs.map +0 -1
  828. package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
  829. package/dist/substrate/runtime/context-helpers.mjs +0 -32
  830. package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
  831. package/dist/substrate/runtime/run.mjs.map +0 -1
  832. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
  833. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
  834. package/dist/substrate/runtime/supervisor.d.mts +0 -1
  835. package/dist/substrate/runtime/supervisor.mjs +0 -831
  836. package/dist/substrate/runtime/supervisor.mjs.map +0 -1
  837. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
  838. /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/walrus/index.ts"],"sourcesContent":["// Walrus plugin — barrel + factories.\n//\n// Architecture: Walrus is a service plugin that owns a local cluster\n// or describes a known deployment. The factory at this file folds the\n// four modes behind:\n//\n// - `walrus(opts?)` — local-cluster shorthand. No env\n// defaulting; use `walrusFor(...)`\n// for known deployments.\n// - `walrusFor(network)` — mode-narrowed factory namespace\n// (architecture Tension 11). Returns\n// `{ local: …, known: … }` narrowed\n// to the network's mode. Crucially,\n// the fork branch exposes ONLY\n// `.known` — `.local` is a compile\n// error on a fork-mode network.\n//\n// The plugin emits FOUR capability decls (per mode):\n//\n// Local mode (full local cluster):\n// 1. `snapshotable` — runtime/walrus/<name>/deploy/ subtree\n// + storage-node managed containers.\n// 2. `codegenable` — `walrus-network` bindings.\n// 3. `routable` × (N + 2) — per-node + aggregator + publisher.\n// 4. `strategy-contributor:walrus-state-registry` — local entry.\n// 5. `strategy-contributor:endpoint-registry` — N+2 entries.\n// 6. `strategy-contributor:package-registry` — `walrus.<name>`.\n// 7. `strategy-contributor:coinType:<WAL fullCoinType>`\n// — WAL faucet\n// strategy\n// (when exchange exists).\n//\n// Known mode (read-only deployment):\n// 1. `snapshotable` — identity-guard only; no subtrees.\n// 2. `codegenable` — `walrus-network` bindings (mode='known').\n// 3. `strategy-contributor:walrus-state-registry` — known entry.\n//\n// Resource id: `'walrus'` (singular). The plugin's substrate-level\n// plugin key is the same string.\n\nimport { Effect, Path } from 'effect';\n\nimport { defineModeNamespace } from '../../api/mode-narrowed-factory.ts';\nimport { definePlugin, resource, type ResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { ContainerRuntime, EnsureNetworkSpec } from '../../contracts/container-runtime.ts';\nimport type { RoutableDecl } from '../../contracts/routable.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { ArtifactPublisherService } from '../../substrate/runtime/artifact-publisher/index.ts';\nimport type { AcquireContext } from '../../substrate/plugin.ts';\nimport type { AccountFundingCoinValue } from '../account/index.ts';\nimport { coinResourceId, type CoinResourceId } from '../coin/index.ts';\nimport type { SuiProbeKey } from '../sui/chain-probe.ts';\nimport { suiResource } from '../sui/index.ts';\n\nimport { chainProbeFor } from '../../substrate/runtime/strategy-registry/index.ts';\n\nimport { makeCodegenable } from './codegen.ts';\nimport { walrusPluginKey } from './plugin-key.ts';\nimport { WALRUS_ERROR_TAGS, walrusPluginError, type WalrusPluginError } from './errors.ts';\nimport { walFaucetStrategyKey, type WalFaucetStrategy } from './faucet-strategy.ts';\nimport { bootWalrusService, type WalrusMode } from './service.ts';\nimport {\n\tresolveLocalClusterOptions,\n\ttype WalrusLocalClusterOptions,\n} from './mode/local-cluster.ts';\nimport {\n\tresolveKnownDeploymentOptions,\n\ttype WalrusKnownDeploymentOptions,\n} from './mode/known-deploy.ts';\nimport { makeSnapshotable, type WalrusSnapshotMode } from './snapshot.ts';\nimport { makeLocalRoutables } from './routable.ts';\nimport { WALRUS_STATE_REGISTRY_KEY, type WalrusStateEntry } from './registry-publish.ts';\nimport { buildWalrusNetworkName, type WalrusStorageNode } from './storage-nodes.ts';\n\n// ---------------------------------------------------------------------------\n// Resource — the resolved value all consumers read\n// ---------------------------------------------------------------------------\n\n/** The Walrus resolved value carried by the resource. */\nexport interface WalrusResolved {\n\treadonly mode: 'local' | 'known';\n\treadonly chain: string;\n\treadonly walrusPackageId: string | null;\n\treadonly walPackageId: string | null;\n\t/** SDK-ready `packageConfig` — structurally compatible with\n\t * `@mysten/walrus`'s `WalrusPackageConfig`. */\n\treadonly packageConfig: {\n\t\treadonly systemObjectId: string;\n\t\treadonly stakingPoolId: string;\n\t\treadonly exchangeIds?: ReadonlyArray<string>;\n\t};\n\treadonly nodes: ReadonlyArray<WalrusStorageNode>;\n\treadonly proxyUrl: string | null;\n\treadonly aggregatorUrl: string | null;\n\treadonly publisherUrl: string | null;\n\treadonly walFaucetStrategy: WalFaucetStrategy | null;\n\treadonly walCoinType: string | null;\n}\n\n/** Walrus plugin resource. */\nexport const walrusResource = resource<'walrus', WalrusResolved>('walrus');\nconst walrusErrorContributions = pluginErrorContributions(WALRUS_ERROR_TAGS);\n\nexport interface WalrusNetworkIdentity {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly walrusName: string;\n}\n\n/** Walrus deploy records storage-node listening IPs under this /24.\n * Docker network create requests the matching subnet explicitly, with\n * the prefix derived from the Walrus network identity so parallel\n * stacks don't all claim the same Docker IPAM range. */\nexport const deriveWalrusSubnetPrefix = (identity: WalrusNetworkIdentity): string => {\n\tconst key = `${identity.app}\\0${identity.stack}\\0${identity.walrusName}`;\n\tlet hash = 0x811c9dc5;\n\tfor (let i = 0; i < key.length; i += 1) {\n\t\thash ^= key.charCodeAt(i);\n\t\thash = Math.imul(hash, 0x01000193) >>> 0;\n\t}\n\tconst bucket = hash % (64 * 256);\n\tconst secondOctet = 64 + Math.floor(bucket / 256);\n\tconst thirdOctet = bucket % 256;\n\treturn `10.${secondOctet}.${thirdOctet}`;\n};\n\nexport const walrusNetworkCreateSpec = <Spec extends EnsureNetworkSpec>(\n\tspec: Spec,\n\tsubnetPrefix: string,\n): Spec & Required<Pick<EnsureNetworkSpec, 'subnet' | 'gateway'>> => ({\n\t...spec,\n\tsubnet: `${subnetPrefix}.0/24`,\n\tgateway: `${subnetPrefix}.1`,\n});\n\nconst withWalrusNetworkAddressing = (\n\truntime: ContainerRuntime,\n\twalrusNetworkName: string,\n\tsubnetPrefix: string,\n): ContainerRuntime => ({\n\t...runtime,\n\tensureNetwork: (spec) =>\n\t\truntime.ensureNetwork(\n\t\t\tspec.name === walrusNetworkName ? walrusNetworkCreateSpec(spec, subnetPrefix) : spec,\n\t\t),\n});\n\n// ---------------------------------------------------------------------------\n// Plugin construction (internal — used by walrus() + walrusFor())\n// ---------------------------------------------------------------------------\n\nconst buildLocalPlugin = (opts: WalrusLocalClusterOptions) => {\n\t// Synchronous factory-time validation (distilled-doc invariants\n\t// 11 — `nodeCount >= 1` + `shards >= nodeCount`).\n\tconst resolved = resolveLocalClusterOptions(opts);\n\n\tconst walrusKey = walrusPluginKey(resolved.name);\n\n\treturn definePlugin({\n\t\tid: walrusResource.id,\n\t\tdependsOn: [suiResource] as const,\n\t\trole: 'service',\n\t\tpluginKey: walrusKey,\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui] = deps;\n\n\t\t\t\t// Substrate-context primitives:\n\t\t\t\t// - `ContainerRuntimeService` + `IdentityContext` arrive\n\t\t\t\t// via the supervisor's plugin runtime context.\n\t\t\t\t// - `ArtifactPublisher` is the substrate-level\n\t\t\t\t// publisher (cache → verify → produce → register cycle).\n\t\t\t\t// - `ChainProbe<SuiProbeKey>` is looked up via the\n\t\t\t\t// StrategyRegistry under `chain-probe:<chainId>`;\n\t\t\t\t// Sui registered itself there at its own acquire.\n\t\t\t\t// - `StackPathsService` resolves the per-stack on-disk\n\t\t\t\t// root so the deploy-output bind-mount source is a\n\t\t\t\t// real path (not the `<runtime>/...` template).\n\t\t\t\tconst runtime = yield* ContainerRuntimeService;\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst stackPaths = yield* StackPathsService;\n\t\t\t\tconst path = yield* Path.Path;\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\n\t\t\t\t// Resolve the deploy-output bind-mount source from the\n\t\t\t\t// per-stack paths bundle. The deploy one-shot owns preparing\n\t\t\t\t// the directory immediately before its Docker bind mount.\n\t\t\t\tconst deployHostMountPath = path.join(\n\t\t\t\t\tstackPaths.stackRoot,\n\t\t\t\t\t'walrus',\n\t\t\t\t\tresolved.name,\n\t\t\t\t\t'deploy',\n\t\t\t\t);\n\n\t\t\t\t// Cross-container DNS: walrus containers (deploy one-shot\n\t\t\t\t// + N storage nodes) dial sui RPC + faucet via\n\t\t\t\t// `host.docker.internal`. The sui plugin binds brokered\n\t\t\t\t// host ports — no shared docker network needed.\n\t\t\t\t//\n\t\t\t\t// Architectural decision (B5): walrus owns its OWN docker\n\t\t\t\t// network for storage-node ↔ deploy connectivity; sui-side\n\t\t\t\t// hops go through the host gateway.\n\t\t\t\t// On Linux this requires Docker Desktop or the\n\t\t\t\t// `host.docker.internal:host-gateway` runtime hint (the\n\t\t\t\t// established devstack convention — see plugins/deepbook\n\t\t\t\t// which uses the same pattern).\n\t\t\t\tconst walrusNetworkName = buildWalrusNetworkName(\n\t\t\t\t\tidentity.app,\n\t\t\t\t\tidentity.stack,\n\t\t\t\t\tresolved.name,\n\t\t\t\t);\n\t\t\t\tconst walrusSubnetPrefix = deriveWalrusSubnetPrefix({\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\twalrusName: resolved.name,\n\t\t\t\t});\n\t\t\t\tconst walrusRuntime = withWalrusNetworkAddressing(\n\t\t\t\t\truntime,\n\t\t\t\t\twalrusNetworkName,\n\t\t\t\t\twalrusSubnetPrefix,\n\t\t\t\t);\n\t\t\t\tconst suiRpcUrlInNetwork = sui.hostGateway.rpcUrl;\n\t\t\t\t// sui-faucet v2 endpoint — `/v2/gas` is the supported path\n\t\t\t\t// on devnet-v1.71.0+ (the binary still answers `/v1/gas`\n\t\t\t\t// for backwards-compat but new code targets v2).\n\t\t\t\tconst suiFaucetUrlInNetwork = sui.hostGateway.faucetUrl;\n\t\t\t\tif (suiFaucetUrlInNetwork === null) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t'deploy',\n\t\t\t\t\t\t\t'walrus local-cluster requires a Sui faucet URL for deploy funding.',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst walrusFaucetUrlInNetwork = `${suiFaucetUrlInNetwork}/v2/gas`;\n\n\t\t\t\tconst mode: WalrusMode = { mode: 'local', opts: resolved };\n\t\t\t\tconst boot = yield* bootWalrusService(\n\t\t\t\t\t{\n\t\t\t\t\t\truntime: walrusRuntime,\n\t\t\t\t\t\tpublisher,\n\t\t\t\t\t\tprobe,\n\t\t\t\t\t\tsuiSdk: sui.sdk,\n\t\t\t\t\t\tsuiChainId: sui.chain,\n\t\t\t\t\t\tsuiRpcUrlInNetwork,\n\t\t\t\t\t\twalrusFaucetUrlInNetwork,\n\t\t\t\t\t\twaitForFundsReady: sui.waitForTransactionsReady.wait,\n\t\t\t\t\t\tapp: identity.app,\n\t\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\t\tsubnetPrefix: walrusSubnetPrefix,\n\t\t\t\t\t\twalrusNetworkName,\n\t\t\t\t\t\t// Walrus has no `sui-net` to attach to (sui binds\n\t\t\t\t\t\t// host ports). Reuse the walrus network so the\n\t\t\t\t\t\t// deploy one-shot + storage nodes land on a single\n\t\t\t\t\t\t// network and reach sui via `host.docker.internal`.\n\t\t\t\t\t\tsuiNetworkName: walrusNetworkName,\n\t\t\t\t\t\tdeployHostMountPath,\n\t\t\t\t\t},\n\t\t\t\t\tmode,\n\t\t\t\t);\n\n\t\t\t\tif (boot.mode !== 'local') {\n\t\t\t\t\t// Should be unreachable — dispatch is by mode. Defense.\n\t\t\t\t\treturn yield* Effect.die('walrus: mode mismatch in local plugin');\n\t\t\t\t}\n\n\t\t\t\tconst resolvedValue: WalrusResolved = {\n\t\t\t\t\tmode: 'local',\n\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\twalrusPackageId: boot.walrusPackageId,\n\t\t\t\t\twalPackageId: boot.walPackageId,\n\t\t\t\t\tpackageConfig: {\n\t\t\t\t\t\tsystemObjectId: boot.deploy.systemObject,\n\t\t\t\t\t\tstakingPoolId: boot.deploy.stakingObject,\n\t\t\t\t\t\texchangeIds: boot.exchangeObjectId ? [boot.exchangeObjectId] : undefined,\n\t\t\t\t\t},\n\t\t\t\t\tnodes: boot.nodes,\n\t\t\t\t\tproxyUrl: boot.proxyUrl,\n\t\t\t\t\taggregatorUrl: boot.aggregatorUrl,\n\t\t\t\t\tpublisherUrl: boot.publisherUrl,\n\t\t\t\t\twalFaucetStrategy: boot.walFaucetStrategy,\n\t\t\t\t\twalCoinType: boot.walCoinType,\n\t\t\t\t};\n\t\t\t\treturn resolvedValue;\n\t\t\t}),\n\t\tcapabilities: ({ value: resolvedValue, runtime: acquireCtx }) =>\n\t\t\tmakeLocalCapabilities({\n\t\t\t\tname: resolved.name,\n\t\t\t\tnodeCount: resolved.nodeCount,\n\t\t\t\tcontainerApiPort: resolved.containerApiPort,\n\t\t\t\tserviceKey: String(walrusKey),\n\t\t\t\tresolved: resolvedValue,\n\t\t\t\tacquireCtx,\n\t\t\t}),\n\t\terrorContributions: walrusErrorContributions,\n\t});\n};\n\nconst buildKnownPlugin = (opts: WalrusKnownDeploymentOptions) => {\n\t// Synchronous factory-time validation for required deployment ids.\n\tconst resolved = resolveKnownDeploymentOptions(opts);\n\n\treturn definePlugin({\n\t\tid: walrusResource.id,\n\t\tdependsOn: [suiResource] as const,\n\t\t// Known deployment is a pure value-producer — no containers,\n\t\t// no long-running children.\n\t\trole: 'task',\n\t\tstart: () =>\n\t\t\tEffect.succeed({\n\t\t\t\tmode: 'known',\n\t\t\t\tchain: resolved.chain,\n\t\t\t\twalrusPackageId: null,\n\t\t\t\twalPackageId: null,\n\t\t\t\tpackageConfig: {\n\t\t\t\t\tsystemObjectId: resolved.systemObjectId,\n\t\t\t\t\tstakingPoolId: resolved.stakingPoolId,\n\t\t\t\t\texchangeIds: resolved.exchangeIds.length > 0 ? resolved.exchangeIds : undefined,\n\t\t\t\t},\n\t\t\t\tnodes: resolved.nodes,\n\t\t\t\tproxyUrl: resolved.proxyUrl,\n\t\t\t\taggregatorUrl: resolved.aggregatorUrl,\n\t\t\t\tpublisherUrl: resolved.publisherUrl,\n\t\t\t\twalFaucetStrategy: null,\n\t\t\t\twalCoinType: null,\n\t\t\t} satisfies WalrusResolved),\n\t\tcapabilities: ({ value: resolvedValue, runtime: acquireCtx }) =>\n\t\t\tmakeKnownCapabilities({\n\t\t\t\tresolved: resolvedValue,\n\t\t\t\tacquireCtx,\n\t\t\t}),\n\t\terrorContributions: walrusErrorContributions,\n\t});\n};\n\nconst makeLocalCapabilities = (parts: {\n\treadonly name: string;\n\treadonly nodeCount: number;\n\treadonly containerApiPort: number;\n\treadonly serviceKey: string;\n\treadonly resolved: WalrusResolved;\n\treadonly acquireCtx: AcquireContext;\n}) => {\n\tconst { name, nodeCount, containerApiPort, serviceKey, resolved, acquireCtx } = parts;\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\t'local' satisfies WalrusSnapshotMode,\n\t\tacquireCtx.identity.app,\n\t\tacquireCtx.identity.stack,\n\t\tname,\n\t\tresolved.chain,\n\t\tnodeCount,\n\t);\n\tconst codegen: CodegenableDecl<'walrus-network'> = makeCodegenable({\n\t\tmode: 'local',\n\t\tchain: resolved.chain,\n\t\twalrusPackageId: resolved.walrusPackageId,\n\t\twalPackageId: resolved.walPackageId,\n\t\twalCoinType: resolved.walCoinType,\n\t\tsystemObjectId: resolved.packageConfig.systemObjectId,\n\t\tstakingPoolId: resolved.packageConfig.stakingPoolId,\n\t\texchangeIds: resolved.packageConfig.exchangeIds ? [...resolved.packageConfig.exchangeIds] : [],\n\t\tproxyUrl: resolved.proxyUrl,\n\t\taggregatorUrl: resolved.aggregatorUrl,\n\t\tpublisherUrl: resolved.publisherUrl,\n\t\tnodes: resolved.nodes,\n\t});\n\tconst stateRegistry: StrategyContributorDecl<\n\t\ttypeof WALRUS_STATE_REGISTRY_KEY,\n\t\t{ readonly noteName: string }\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: WALRUS_STATE_REGISTRY_KEY,\n\t\tstrategy: { noteName: name },\n\t\tautoMounted: true,\n\t};\n\tconst walFaucetContribution =\n\t\tresolved.walFaucetStrategy === null || resolved.walCoinType === null\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tkind: 'strategy-contributor',\n\t\t\t\t\t\tcapabilityKey: walFaucetStrategyKey(resolved.walCoinType),\n\t\t\t\t\t\tstrategy: resolved.walFaucetStrategy,\n\t\t\t\t\t\tautoMounted: true,\n\t\t\t\t\t} satisfies StrategyContributorDecl<\n\t\t\t\t\t\tReturnType<typeof walFaucetStrategyKey>,\n\t\t\t\t\t\tWalFaucetStrategy\n\t\t\t\t\t>,\n\t\t\t\t];\n\tconst routables = makeLocalRoutables({\n\t\tapp: acquireCtx.identity.app,\n\t\tstack: acquireCtx.identity.stack,\n\t\twalrusName: name,\n\t\tserviceKey,\n\t\tnodeCount,\n\t\tcontainerApiPort,\n\t});\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tstateRegistry,\n\t\t...walFaucetContribution,\n\t\t...(routables as readonly RoutableDecl[]),\n\t] as const;\n};\n\nconst makeKnownCapabilities = (parts: {\n\treadonly resolved: WalrusResolved;\n\treadonly acquireCtx: AcquireContext;\n}) => {\n\tconst { resolved, acquireCtx } = parts;\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\t'known' satisfies WalrusSnapshotMode,\n\t\tacquireCtx.identity.app,\n\t\tacquireCtx.identity.stack,\n\t\t'walrusKnownDeployment',\n\t\tresolved.chain,\n\t);\n\tconst codegen: CodegenableDecl<'walrus-network'> = makeCodegenable({\n\t\tmode: 'known',\n\t\tchain: resolved.chain,\n\t\twalrusPackageId: resolved.walrusPackageId,\n\t\twalPackageId: resolved.walPackageId,\n\t\twalCoinType: resolved.walCoinType,\n\t\tsystemObjectId: resolved.packageConfig.systemObjectId,\n\t\tstakingPoolId: resolved.packageConfig.stakingPoolId,\n\t\texchangeIds: resolved.packageConfig.exchangeIds ? [...resolved.packageConfig.exchangeIds] : [],\n\t\tproxyUrl: resolved.proxyUrl,\n\t\taggregatorUrl: resolved.aggregatorUrl,\n\t\tpublisherUrl: resolved.publisherUrl,\n\t\tnodes: resolved.nodes,\n\t});\n\tconst stateRegistry: StrategyContributorDecl<typeof WALRUS_STATE_REGISTRY_KEY, WalrusStateEntry> =\n\t\t{\n\t\t\tkind: 'strategy-contributor',\n\t\t\tcapabilityKey: WALRUS_STATE_REGISTRY_KEY,\n\t\t\tstrategy: {\n\t\t\t\tname: 'walrusKnownDeployment',\n\t\t\t\tsystemObjectId: resolved.packageConfig.systemObjectId,\n\t\t\t\tstakingObjectId: resolved.packageConfig.stakingPoolId,\n\t\t\t\tchain: resolved.chain,\n\t\t\t},\n\t\t\tautoMounted: true,\n\t\t};\n\treturn [snap, codegen, stateRegistry] as const;\n};\n\nexport interface WalCoinValue extends AccountFundingCoinValue {\n\treadonly symbol: 'WAL';\n\treadonly fullCoinType: `${string}::wal::WAL`;\n\treadonly decimals: 9;\n\treadonly source: 'walrus';\n}\n\n/** Resolve the local Walrus deployment's WAL coin as an account-funding\n * coin ref. Accounts that need WAL should use:\n *\n * funding: [{ coin: walCoin(localWalrus), amount }]\n *\n * The funding strategy itself is contributed by the Walrus service\n * once its local exchange exists. */\nexport const walCoin = (walrusMember: ResourceRef<'walrus', WalrusResolved>) => {\n\tconst coinRef = resource<CoinResourceId<'wal'>, WalCoinValue>(coinResourceId('wal'));\n\n\treturn definePlugin({\n\t\tid: coinRef.id,\n\t\tdependsOn: walrusMember,\n\t\trole: 'task',\n\t\tstart: (resolved): Effect.Effect<WalCoinValue, WalrusPluginError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tif (resolved.walCoinType === null) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t'exchange',\n\t\t\t\t\t\t\t'walCoin(...) requires a local Walrus deployment with a WAL package.',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tsymbol: 'WAL',\n\t\t\t\t\tfullCoinType: resolved.walCoinType as `${string}::wal::WAL`,\n\t\t\t\t\tdecimals: 9,\n\t\t\t\t\tsource: 'walrus',\n\t\t\t\t} satisfies WalCoinValue;\n\t\t\t}),\n\t\terrorContributions: walrusErrorContributions,\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// User-facing factories\n// ---------------------------------------------------------------------------\n\n/** Local-cluster shorthand. Known deployments are selected through\n * `walrusFor(network).known(...)` so network choice stays explicit. */\nexport const walrus = (opts?: { readonly local?: WalrusLocalClusterOptions }) => {\n\treturn buildLocalPlugin(opts?.local ?? {});\n};\n\n/** Mode-narrowed factory namespace.\n *\n * Usage:\n * const network = { mode: 'local', chain: 'sui:localnet' } as const;\n * walrusFor(network).local({...}) // OK\n * walrusFor(network).known({...}) // type error: 'known' not in 'local' branch\n *\n * Critically, the fork branch exposes ONLY `.known` — calling\n * `.local` on a fork-mode network is a **compile error** at the\n * call site (distilled-doc invariant 12 — type-level refusal).\n * Runtime defense-in-depth: see `mode/fork-refusal.ts`. */\nexport const walrusFor = defineModeNamespace({\n\tlocal: {\n\t\tlocal: (opts: WalrusLocalClusterOptions = {}) => buildLocalPlugin(opts),\n\t\tknown: (opts: WalrusKnownDeploymentOptions) => buildKnownPlugin(opts),\n\t},\n\tlive: {\n\t\tknown: (opts: WalrusKnownDeploymentOptions) => buildKnownPlugin(opts),\n\t},\n\tfork: {\n\t\t// `.local` is intentionally absent — calling\n\t\t// `walrusFor(forkNetwork).local(...)` is a compile error.\n\t\tknown: (opts: WalrusKnownDeploymentOptions) => buildKnownPlugin(opts),\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// Re-exports for advanced callers\n// ---------------------------------------------------------------------------\n\nexport type { WalrusLocalClusterOptions } from './mode/local-cluster.ts';\nexport type { WalrusKnownDeploymentOptions, WalrusKnownNetwork } from './mode/known-deploy.ts';\nexport type { WalrusStorageNode } from './storage-nodes.ts';\nexport type { WalrusBindings, WalrusNodeBinding } from './codegen.ts';\nexport type { WalrusError, WalrusPluginError, WalrusConfigError, WalrusPhase } from './errors.ts';\n// `ForkIncompatibleError` is the cross-cutting mode-refusal shape owned\n// by `substrate/runtime/mode-errors.ts`; seal re-exports it\n// under its canonical name from its barrel, so walrus exposes the\n// SAME class under a walrus-namespaced alias to avoid a collision\n// when a downstream consumer imports both plugin barrels in the same\n// scope (STYLE_GUIDE §2 — one `_tag` literal per logical error type).\nexport type { ForkIncompatibleError as WalrusForkIncompatible } from './errors.ts';\nexport { WALRUS_ERROR_TAGS } from './errors.ts';\nexport {\n\twalCoinType,\n\twalFaucetStrategyKey,\n\ttype WalFaucetStrategy,\n\ttype WalFaucetRequest,\n} from './faucet-strategy.ts';\nexport {\n\tWALRUS_STATE_REGISTRY_KEY,\n\ttype WalrusStateEntry,\n\ttype WalrusLocalStateEntry,\n\ttype WalrusKnownStateEntry,\n} from './registry-publish.ts';\nexport { WALRUS_ROUTER_PORT } from './storage-nodes.ts';\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/walrus/index.ts"],"sourcesContent":["// Walrus plugin — barrel + factories.\n//\n// Architecture: Walrus is a service plugin that owns a local cluster\n// or describes a known deployment. The factory at this file folds the\n// four modes behind:\n//\n// - `walrus(opts?)` — local-cluster shorthand. No env\n// defaulting; use `walrusFor(...)`\n// for known deployments.\n// - `walrusFor(network)` — mode-narrowed factory namespace\n// (architecture Tension 11). Returns\n// `{ local: …, known: … }` narrowed\n// to the network's mode. Crucially,\n// the fork branch exposes ONLY\n// `.known` — `.local` is a compile\n// error on a fork-mode network.\n//\n// The plugin emits FOUR capability decls (per mode):\n//\n// Local mode (full local cluster):\n// 1. `snapshotable` — runtime/walrus/<name>/deploy/ subtree\n// + storage-node managed containers.\n// 2. `codegenable` — `walrus-network` bindings.\n// 3. `routable` × (N + 2) — per-node + aggregator + publisher.\n// 4. `strategy-contributor:walrus-state-registry` — local entry.\n// 5. `strategy-contributor:endpoint-registry` — N+2 entries.\n// 6. `strategy-contributor:package-registry` — `walrus.<name>`.\n// 7. `strategy-contributor:coinType:<WAL fullCoinType>`\n// — WAL faucet\n// strategy\n// (when exchange exists).\n//\n// Known mode (read-only deployment):\n// 1. `snapshotable` — identity-guard only; no subtrees.\n// 2. `codegenable` — `walrus-network` bindings (mode='known').\n// 3. `strategy-contributor:walrus-state-registry` — known entry.\n//\n// Resource id: `'walrus'` (singular). The plugin's substrate-level\n// plugin key is the same string.\n\nimport { Effect, Path } from 'effect';\n\nimport { defineModeNamespace } from '../../api/mode-narrowed-factory.ts';\nimport { definePlugin, resource, type ResourceRef } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport type { RoutableDecl } from '../../contracts/routable.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { StrategyContributorDecl } from '../../contracts/strategy-contributor.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { ArtifactPublisherService } from '../../substrate/runtime/artifact-publisher/index.ts';\nimport {\n\tderiveSubnetPrefix,\n\twithSubnetAddressing,\n} from '../../substrate/runtime/subnet-broker.ts';\nimport type { AcquireContext } from '../../substrate/plugin.ts';\nimport type { AccountFundingCoinValue } from '../account/index.ts';\nimport { coinResourceId, type CoinResourceId } from '../coin/index.ts';\nimport { suiResource, type SuiProbeKey } from '../sui/index.ts';\n\nimport { chainProbeFor } from '../../substrate/runtime/strategy-registry/index.ts';\n\nimport { makeCodegenable } from './codegen.ts';\nimport { walrusPluginKey } from './plugin-key.ts';\nimport { WALRUS_ERROR_TAGS, walrusPluginError, type WalrusPluginError } from './errors.ts';\nimport { walFaucetStrategyKey, type WalFaucetStrategy } from './faucet-strategy.ts';\nimport { bootWalrusService, type WalrusMode } from './service.ts';\nimport {\n\tresolveLocalClusterOptions,\n\ttype WalrusLocalClusterOptions,\n} from './mode/local-cluster.ts';\nimport {\n\tresolveKnownDeploymentOptions,\n\ttype WalrusKnownDeploymentOptions,\n} from './mode/known-deploy.ts';\nimport { makeSnapshotable, type WalrusSnapshotMode } from './snapshot.ts';\nimport { makeLocalRoutables } from './routable.ts';\nimport { WALRUS_STATE_REGISTRY_KEY, type WalrusStateEntry } from './registry-publish.ts';\nimport { buildWalrusNetworkName, type WalrusStorageNode } from './storage-nodes.ts';\n\n// ---------------------------------------------------------------------------\n// Resource — the resolved value all consumers read\n// ---------------------------------------------------------------------------\n\n/** The Walrus resolved value carried by the resource. */\nexport interface WalrusResolved {\n\treadonly mode: 'local' | 'known';\n\treadonly chain: string;\n\treadonly walrusPackageId: string | null;\n\treadonly walPackageId: string | null;\n\t/** SDK-ready `packageConfig` — structurally compatible with\n\t * `@mysten/walrus`'s `WalrusPackageConfig`. */\n\treadonly packageConfig: {\n\t\treadonly systemObjectId: string;\n\t\treadonly stakingPoolId: string;\n\t\treadonly exchangeIds?: ReadonlyArray<string>;\n\t};\n\treadonly nodes: ReadonlyArray<WalrusStorageNode>;\n\treadonly proxyUrl: string | null;\n\treadonly aggregatorUrl: string | null;\n\treadonly publisherUrl: string | null;\n\treadonly walFaucetStrategy: WalFaucetStrategy | null;\n\treadonly walCoinType: string | null;\n}\n\n/** Walrus plugin resource. */\nexport const walrusResource = resource<'walrus', WalrusResolved>('walrus');\nconst walrusErrorContributions = pluginErrorContributions(WALRUS_ERROR_TAGS);\n\nexport interface WalrusNetworkIdentity {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly walrusName: string;\n}\n\n/** Walrus deploy records storage-node listening IPs under this /24.\n * Docker network create requests the matching subnet explicitly, with\n * the prefix derived from the Walrus network identity so parallel\n * stacks don't all claim the same Docker IPAM range. Walrus claims\n * the `10.64.*` – `10.127.*` band; see substrate/runtime/subnet-broker.ts\n * for the algorithm and band coordination with seal. */\nexport const deriveWalrusSubnetPrefix = (identity: WalrusNetworkIdentity): string =>\n\tderiveSubnetPrefix(`${identity.app}\\0${identity.stack}\\0${identity.walrusName}`, 64);\n\nconst withWalrusNetworkAddressing = (\n\truntime: ContainerRuntime,\n\twalrusNetworkName: string,\n\tsubnetPrefix: string,\n): ContainerRuntime => ({\n\t...runtime,\n\tensureNetwork: (spec) =>\n\t\truntime.ensureNetwork(\n\t\t\tspec.name === walrusNetworkName ? withSubnetAddressing(spec, subnetPrefix) : spec,\n\t\t),\n});\n\n// ---------------------------------------------------------------------------\n// Plugin construction (internal — used by walrus() + walrusFor())\n// ---------------------------------------------------------------------------\n\nconst buildLocalPlugin = (opts: WalrusLocalClusterOptions) => {\n\t// Synchronous factory-time validation (distilled-doc invariants\n\t// 11 — `nodeCount >= 1` + `shards >= nodeCount`).\n\tconst resolved = resolveLocalClusterOptions(opts);\n\n\tconst walrusKey = walrusPluginKey(resolved.name);\n\n\treturn definePlugin({\n\t\tid: walrusResource.id,\n\t\tdependsOn: [suiResource] as const,\n\t\trole: 'service',\n\t\tsection: 'service',\n\t\tpluginKey: walrusKey,\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui] = deps;\n\n\t\t\t\t// Substrate-context primitives:\n\t\t\t\t// - `ContainerRuntimeService` + `IdentityContext` arrive\n\t\t\t\t// via the supervisor's plugin runtime context.\n\t\t\t\t// - `ArtifactPublisher` is the substrate-level\n\t\t\t\t// publisher (cache → verify → produce → register cycle).\n\t\t\t\t// - `ChainProbe<SuiProbeKey>` is looked up via the\n\t\t\t\t// StrategyRegistry under `chain-probe:<chainId>`;\n\t\t\t\t// Sui registered itself there at its own acquire.\n\t\t\t\t// - `StackPathsService` resolves the per-stack on-disk\n\t\t\t\t// root so the deploy-output bind-mount source is a\n\t\t\t\t// real path (not the `<runtime>/...` template).\n\t\t\t\tconst runtime = yield* ContainerRuntimeService;\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst stackPaths = yield* StackPathsService;\n\t\t\t\tconst path = yield* Path.Path;\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\n\t\t\t\t// Resolve the deploy-output bind-mount source from the\n\t\t\t\t// per-stack paths bundle. The deploy one-shot owns preparing\n\t\t\t\t// the directory immediately before its Docker bind mount.\n\t\t\t\tconst deployHostMountPath = path.join(\n\t\t\t\t\tstackPaths.stackRoot,\n\t\t\t\t\t'walrus',\n\t\t\t\t\tresolved.name,\n\t\t\t\t\t'deploy',\n\t\t\t\t);\n\n\t\t\t\t// Cross-container DNS: walrus containers (deploy one-shot\n\t\t\t\t// + N storage nodes) dial sui RPC + faucet via\n\t\t\t\t// `host.docker.internal`. The sui plugin binds brokered\n\t\t\t\t// host ports — no shared docker network needed.\n\t\t\t\t//\n\t\t\t\t// Architectural decision (B5): walrus owns its OWN docker\n\t\t\t\t// network for storage-node ↔ deploy connectivity; sui-side\n\t\t\t\t// hops go through the host gateway.\n\t\t\t\t// On Linux this requires Docker Desktop or the\n\t\t\t\t// `host.docker.internal:host-gateway` runtime hint (the\n\t\t\t\t// established devstack convention — see plugins/deepbook\n\t\t\t\t// which uses the same pattern).\n\t\t\t\tconst walrusNetworkName = buildWalrusNetworkName(\n\t\t\t\t\tidentity.app,\n\t\t\t\t\tidentity.stack,\n\t\t\t\t\tresolved.name,\n\t\t\t\t);\n\t\t\t\tconst walrusSubnetPrefix = deriveWalrusSubnetPrefix({\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\twalrusName: resolved.name,\n\t\t\t\t});\n\t\t\t\tconst walrusRuntime = withWalrusNetworkAddressing(\n\t\t\t\t\truntime,\n\t\t\t\t\twalrusNetworkName,\n\t\t\t\t\twalrusSubnetPrefix,\n\t\t\t\t);\n\t\t\t\tconst suiRpcUrlInNetwork = sui.hostGateway.rpcUrl;\n\t\t\t\t// sui-faucet v2 endpoint — `/v2/gas` is the supported path\n\t\t\t\t// on devnet-v1.71.0+ (the binary still answers `/v1/gas`\n\t\t\t\t// for backwards-compat but new code targets v2).\n\t\t\t\tconst suiFaucetUrlInNetwork = sui.hostGateway.faucetUrl;\n\t\t\t\tif (suiFaucetUrlInNetwork === null) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t'deploy',\n\t\t\t\t\t\t\t'walrus local-cluster requires a Sui faucet URL for deploy funding.',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst walrusFaucetUrlInNetwork = `${suiFaucetUrlInNetwork}/v2/gas`;\n\n\t\t\t\tconst mode: WalrusMode = { mode: 'local', opts: resolved };\n\t\t\t\tconst boot = yield* bootWalrusService(\n\t\t\t\t\t{\n\t\t\t\t\t\truntime: walrusRuntime,\n\t\t\t\t\t\tpublisher,\n\t\t\t\t\t\tprobe,\n\t\t\t\t\t\tsuiSdk: sui.sdk,\n\t\t\t\t\t\tsuiChainId: sui.chain,\n\t\t\t\t\t\tsuiRpcUrlInNetwork,\n\t\t\t\t\t\twalrusFaucetUrlInNetwork,\n\t\t\t\t\t\twaitForFundsReady: sui.waitForTransactionsReady.wait,\n\t\t\t\t\t\tapp: identity.app,\n\t\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\t\tsubnetPrefix: walrusSubnetPrefix,\n\t\t\t\t\t\twalrusNetworkName,\n\t\t\t\t\t\t// Walrus has no `sui-net` to attach to (sui binds\n\t\t\t\t\t\t// host ports). Reuse the walrus network so the\n\t\t\t\t\t\t// deploy one-shot + storage nodes land on a single\n\t\t\t\t\t\t// network and reach sui via `host.docker.internal`.\n\t\t\t\t\t\tsuiNetworkName: walrusNetworkName,\n\t\t\t\t\t\tdeployHostMountPath,\n\t\t\t\t\t\tstackRoot: stackPaths.stackRoot,\n\t\t\t\t\t},\n\t\t\t\t\tmode,\n\t\t\t\t);\n\n\t\t\t\tif (boot.mode !== 'local') {\n\t\t\t\t\t// Should be unreachable — dispatch is by mode. Defense.\n\t\t\t\t\treturn yield* Effect.die('walrus: mode mismatch in local plugin');\n\t\t\t\t}\n\n\t\t\t\tconst resolvedValue: WalrusResolved = {\n\t\t\t\t\tmode: 'local',\n\t\t\t\t\tchain: sui.chain,\n\t\t\t\t\twalrusPackageId: boot.walrusPackageId,\n\t\t\t\t\twalPackageId: boot.walPackageId,\n\t\t\t\t\tpackageConfig: {\n\t\t\t\t\t\tsystemObjectId: boot.deploy.systemObject,\n\t\t\t\t\t\tstakingPoolId: boot.deploy.stakingObject,\n\t\t\t\t\t\texchangeIds: boot.exchangeObjectId ? [boot.exchangeObjectId] : undefined,\n\t\t\t\t\t},\n\t\t\t\t\tnodes: boot.nodes,\n\t\t\t\t\tproxyUrl: boot.proxyUrl,\n\t\t\t\t\taggregatorUrl: boot.aggregatorUrl,\n\t\t\t\t\tpublisherUrl: boot.publisherUrl,\n\t\t\t\t\twalFaucetStrategy: boot.walFaucetStrategy,\n\t\t\t\t\twalCoinType: boot.walCoinType,\n\t\t\t\t};\n\t\t\t\treturn resolvedValue;\n\t\t\t}),\n\t\tcapabilities: ({ value: resolvedValue, runtime: acquireCtx }) =>\n\t\t\tmakeLocalCapabilities({\n\t\t\t\tname: resolved.name,\n\t\t\t\tnodeCount: resolved.nodeCount,\n\t\t\t\tcontainerApiPort: resolved.containerApiPort,\n\t\t\t\tserviceKey: String(walrusKey),\n\t\t\t\tresolved: resolvedValue,\n\t\t\t\tacquireCtx,\n\t\t\t}),\n\t\terrorContributions: walrusErrorContributions,\n\t});\n};\n\nconst buildKnownPlugin = (opts: WalrusKnownDeploymentOptions) => {\n\t// Synchronous factory-time validation for required deployment ids.\n\tconst resolved = resolveKnownDeploymentOptions(opts);\n\n\treturn definePlugin({\n\t\tid: walrusResource.id,\n\t\tdependsOn: [suiResource] as const,\n\t\t// Known deployment is a pure value-producer — no containers,\n\t\t// no long-running children.\n\t\trole: 'task',\n\t\tsection: 'service',\n\t\tstart: () =>\n\t\t\tEffect.succeed({\n\t\t\t\tmode: 'known',\n\t\t\t\tchain: resolved.chain,\n\t\t\t\twalrusPackageId: null,\n\t\t\t\twalPackageId: null,\n\t\t\t\tpackageConfig: {\n\t\t\t\t\tsystemObjectId: resolved.systemObjectId,\n\t\t\t\t\tstakingPoolId: resolved.stakingPoolId,\n\t\t\t\t\texchangeIds: resolved.exchangeIds.length > 0 ? resolved.exchangeIds : undefined,\n\t\t\t\t},\n\t\t\t\tnodes: resolved.nodes,\n\t\t\t\tproxyUrl: resolved.proxyUrl,\n\t\t\t\taggregatorUrl: resolved.aggregatorUrl,\n\t\t\t\tpublisherUrl: resolved.publisherUrl,\n\t\t\t\twalFaucetStrategy: null,\n\t\t\t\twalCoinType: null,\n\t\t\t} satisfies WalrusResolved),\n\t\tcapabilities: ({ value: resolvedValue, runtime: acquireCtx }) =>\n\t\t\tmakeKnownCapabilities({\n\t\t\t\tresolved: resolvedValue,\n\t\t\t\tacquireCtx,\n\t\t\t}),\n\t\terrorContributions: walrusErrorContributions,\n\t});\n};\n\nconst makeLocalCapabilities = (parts: {\n\treadonly name: string;\n\treadonly nodeCount: number;\n\treadonly containerApiPort: number;\n\treadonly serviceKey: string;\n\treadonly resolved: WalrusResolved;\n\treadonly acquireCtx: AcquireContext;\n}) => {\n\tconst { name, nodeCount, containerApiPort, serviceKey, resolved, acquireCtx } = parts;\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\t'local' satisfies WalrusSnapshotMode,\n\t\tacquireCtx.identity.app,\n\t\tacquireCtx.identity.stack,\n\t\tname,\n\t\tresolved.chain,\n\t\tnodeCount,\n\t);\n\tconst codegen: CodegenableDecl<'walrus-network'> = makeCodegenable({\n\t\tmode: 'local',\n\t\tchain: resolved.chain,\n\t\twalrusPackageId: resolved.walrusPackageId,\n\t\twalPackageId: resolved.walPackageId,\n\t\twalCoinType: resolved.walCoinType,\n\t\tsystemObjectId: resolved.packageConfig.systemObjectId,\n\t\tstakingPoolId: resolved.packageConfig.stakingPoolId,\n\t\texchangeIds: resolved.packageConfig.exchangeIds ? [...resolved.packageConfig.exchangeIds] : [],\n\t\tproxyUrl: resolved.proxyUrl,\n\t\taggregatorUrl: resolved.aggregatorUrl,\n\t\tpublisherUrl: resolved.publisherUrl,\n\t\tnodes: resolved.nodes,\n\t});\n\tconst stateRegistry: StrategyContributorDecl<\n\t\ttypeof WALRUS_STATE_REGISTRY_KEY,\n\t\t{ readonly noteName: string }\n\t> = {\n\t\tkind: 'strategy-contributor',\n\t\tcapabilityKey: WALRUS_STATE_REGISTRY_KEY,\n\t\tstrategy: { noteName: name },\n\t\tautoMounted: true,\n\t};\n\tconst walFaucetContribution =\n\t\tresolved.walFaucetStrategy === null || resolved.walCoinType === null\n\t\t\t? []\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tkind: 'strategy-contributor',\n\t\t\t\t\t\tcapabilityKey: walFaucetStrategyKey(resolved.walCoinType),\n\t\t\t\t\t\tstrategy: resolved.walFaucetStrategy,\n\t\t\t\t\t\tautoMounted: true,\n\t\t\t\t\t} satisfies StrategyContributorDecl<\n\t\t\t\t\t\tReturnType<typeof walFaucetStrategyKey>,\n\t\t\t\t\t\tWalFaucetStrategy\n\t\t\t\t\t>,\n\t\t\t\t];\n\tconst routables = makeLocalRoutables({\n\t\tapp: acquireCtx.identity.app,\n\t\tstack: acquireCtx.identity.stack,\n\t\twalrusName: name,\n\t\tserviceKey,\n\t\tnodeCount,\n\t\tcontainerApiPort,\n\t});\n\treturn [\n\t\tsnap,\n\t\tcodegen,\n\t\tstateRegistry,\n\t\t...walFaucetContribution,\n\t\t...(routables as readonly RoutableDecl[]),\n\t] as const;\n};\n\nconst makeKnownCapabilities = (parts: {\n\treadonly resolved: WalrusResolved;\n\treadonly acquireCtx: AcquireContext;\n}) => {\n\tconst { resolved, acquireCtx } = parts;\n\tconst snap: SnapshotableDecl = makeSnapshotable(\n\t\t'known' satisfies WalrusSnapshotMode,\n\t\tacquireCtx.identity.app,\n\t\tacquireCtx.identity.stack,\n\t\t'walrusKnownDeployment',\n\t\tresolved.chain,\n\t);\n\tconst codegen: CodegenableDecl<'walrus-network'> = makeCodegenable({\n\t\tmode: 'known',\n\t\tchain: resolved.chain,\n\t\twalrusPackageId: resolved.walrusPackageId,\n\t\twalPackageId: resolved.walPackageId,\n\t\twalCoinType: resolved.walCoinType,\n\t\tsystemObjectId: resolved.packageConfig.systemObjectId,\n\t\tstakingPoolId: resolved.packageConfig.stakingPoolId,\n\t\texchangeIds: resolved.packageConfig.exchangeIds ? [...resolved.packageConfig.exchangeIds] : [],\n\t\tproxyUrl: resolved.proxyUrl,\n\t\taggregatorUrl: resolved.aggregatorUrl,\n\t\tpublisherUrl: resolved.publisherUrl,\n\t\tnodes: resolved.nodes,\n\t});\n\tconst stateRegistry: StrategyContributorDecl<typeof WALRUS_STATE_REGISTRY_KEY, WalrusStateEntry> =\n\t\t{\n\t\t\tkind: 'strategy-contributor',\n\t\t\tcapabilityKey: WALRUS_STATE_REGISTRY_KEY,\n\t\t\tstrategy: {\n\t\t\t\tname: 'walrusKnownDeployment',\n\t\t\t\tsystemObjectId: resolved.packageConfig.systemObjectId,\n\t\t\t\tstakingObjectId: resolved.packageConfig.stakingPoolId,\n\t\t\t\tchain: resolved.chain,\n\t\t\t},\n\t\t\tautoMounted: true,\n\t\t};\n\treturn [snap, codegen, stateRegistry] as const;\n};\n\nexport interface WalCoinValue extends AccountFundingCoinValue {\n\treadonly symbol: 'WAL';\n\treadonly fullCoinType: `${string}::wal::WAL`;\n\treadonly decimals: 9;\n\treadonly source: 'walrus';\n}\n\n/** Resolve the local Walrus deployment's WAL coin as an account-funding\n * coin ref. Accounts that need WAL should use:\n *\n * funding: [{ coin: walCoin(localWalrus), amount }]\n *\n * The funding strategy itself is contributed by the Walrus service\n * once its local exchange exists. */\nexport const walCoin = (walrusMember: ResourceRef<'walrus', WalrusResolved>) => {\n\tconst coinRef = resource<CoinResourceId<'wal'>, WalCoinValue>(coinResourceId('wal'));\n\n\treturn definePlugin({\n\t\tid: coinRef.id,\n\t\tdependsOn: walrusMember,\n\t\trole: 'task',\n\t\tsection: 'action',\n\t\tstart: (resolved): Effect.Effect<WalCoinValue, WalrusPluginError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tif (resolved.walCoinType === null) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t'exchange',\n\t\t\t\t\t\t\t'walCoin(...) requires a local Walrus deployment with a WAL package.',\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tsymbol: 'WAL',\n\t\t\t\t\tfullCoinType: resolved.walCoinType as `${string}::wal::WAL`,\n\t\t\t\t\tdecimals: 9,\n\t\t\t\t\tsource: 'walrus',\n\t\t\t\t} satisfies WalCoinValue;\n\t\t\t}),\n\t\terrorContributions: walrusErrorContributions,\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// User-facing factories\n// ---------------------------------------------------------------------------\n\n/** Local-cluster shorthand. Known deployments are selected through\n * `walrusFor(network).known(...)` so network choice stays explicit. */\nexport const walrus = (opts?: { readonly local?: WalrusLocalClusterOptions }) => {\n\treturn buildLocalPlugin(opts?.local ?? {});\n};\n\n/** Mode-narrowed factory namespace.\n *\n * Usage:\n * const network = { mode: 'local', chain: 'sui:localnet' } as const;\n * walrusFor(network).local({...}) // OK\n * walrusFor(network).known({...}) // type error: 'known' not in 'local' branch\n *\n * Critically, the fork branch exposes ONLY `.known` — calling\n * `.local` on a fork-mode network is a **compile error** at the\n * call site (distilled-doc invariant 12 — type-level refusal). */\nexport const walrusFor = defineModeNamespace({\n\tlocal: {\n\t\tlocal: (opts: WalrusLocalClusterOptions = {}) => buildLocalPlugin(opts),\n\t\tknown: (opts: WalrusKnownDeploymentOptions) => buildKnownPlugin(opts),\n\t},\n\tlive: {\n\t\tknown: (opts: WalrusKnownDeploymentOptions) => buildKnownPlugin(opts),\n\t},\n\tfork: {\n\t\t// `.local` is intentionally absent — calling\n\t\t// `walrusFor(forkNetwork).local(...)` is a compile error.\n\t\tknown: (opts: WalrusKnownDeploymentOptions) => buildKnownPlugin(opts),\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// Re-exports for advanced callers\n// ---------------------------------------------------------------------------\n\nexport type { WalrusLocalClusterOptions } from './mode/local-cluster.ts';\nexport type { WalrusKnownDeploymentOptions, WalrusKnownNetwork } from './mode/known-deploy.ts';\nexport type { WalrusStorageNode } from './storage-nodes.ts';\nexport type { WalrusBindings, WalrusNodeBinding } from './codegen.ts';\nexport type { WalrusError, WalrusPluginError, WalrusConfigError, WalrusPhase } from './errors.ts';\nexport { WALRUS_ERROR_TAGS } from './errors.ts';\nexport {\n\twalCoinType,\n\twalFaucetStrategyKey,\n\ttype WalFaucetStrategy,\n\ttype WalFaucetRequest,\n} from './faucet-strategy.ts';\nexport {\n\tWALRUS_STATE_REGISTRY_KEY,\n\ttype WalrusStateEntry,\n\ttype WalrusLocalStateEntry,\n\ttype WalrusKnownStateEntry,\n} from './registry-publish.ts';\nexport { WALRUS_ROUTER_PORT } from './storage-nodes.ts';\nexport { WalrusSpans } from './spans.ts';\n"],"mappings":"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"}
@@ -45,7 +45,6 @@ const resolveKnownDeploymentOptions = (opts) => {
45
45
  const aggregatorUrl = opts.aggregatorUrl ?? reg?.aggregatorUrl ?? null;
46
46
  const publisherUrl = opts.publisherUrl ?? reg?.publisherUrl ?? null;
47
47
  const proxyUrl = opts.proxyUrl ?? reg?.proxyUrl ?? aggregatorUrl ?? publisherUrl ?? null;
48
- const allUrlsPresent = aggregatorUrl !== null && publisherUrl !== null && proxyUrl !== null;
49
48
  return {
50
49
  mode: "known",
51
50
  chain: reg?.chain ?? "sui:custom",
@@ -53,9 +52,9 @@ const resolveKnownDeploymentOptions = (opts) => {
53
52
  stakingPoolId,
54
53
  exchangeIds: opts.exchangeIds ?? reg?.exchangeIds ?? [],
55
54
  nodes,
56
- proxyUrl: allUrlsPresent ? proxyUrl : null,
57
- aggregatorUrl: allUrlsPresent ? aggregatorUrl : null,
58
- publisherUrl: allUrlsPresent ? publisherUrl : null
55
+ proxyUrl,
56
+ aggregatorUrl,
57
+ publisherUrl
59
58
  };
60
59
  };
61
60
  /** "Boot" the known deployment. Purely synchronous projection inside
@@ -63,7 +62,10 @@ const resolveKnownDeploymentOptions = (opts) => {
63
62
  * uniformity with the local-cluster boot signature. */
64
63
  const bootKnownDeployment = (opts) => Effect.try({
65
64
  try: () => resolveKnownDeploymentOptions(opts),
66
- catch: (err) => err
65
+ catch: (err) => {
66
+ if (typeof err === "object" && err !== null && "_tag" in err && err._tag === "WalrusConfigError") return err;
67
+ return walrusConfigError("unknown", `walrusKnownDeployment: unexpected non-typed throw inside resolveKnownDeploymentOptions: ${err instanceof Error ? err.message : String(err)}`, void 0, err);
68
+ }
67
69
  });
68
70
  //#endregion
69
71
  export { bootKnownDeployment, resolveKnownDeploymentOptions };
@@ -1 +1 @@
1
- {"version":3,"file":"known-deploy.mjs","names":[],"sources":["../../../../src/plugins/walrus/mode/known-deploy.ts"],"sourcesContent":["// Walrus mode — known deployment (testnet / mainnet / *-fork via\n// upstream translation).\n//\n// Distilled-doc reference (06-walrus.md §\"Lifecycle: Startup —\n// known deployment\"). Purely synchronous body — no ordered phases.\n// The factory validates required deployment fields and returns a\n// resolved value whose tags are eager `Layer.succeed(...)` constants.\n//\n// Distilled-doc invariants honored:\n// - 15: `WalrusProxyTag` only when ALL three URLs (proxy,\n// aggregator, publisher) are present. Encoded as\n// `proxyUrl / aggregatorUrl / publisherUrl: string | null`\n// in the resolved shape; the plugin's projection step\n// hides the proxy tag when any is missing.\n// - 16: throw synchronously when `nodes` is missing for a\n// registered network. Testnet has 100+ nodes that the\n// `@mysten/walrus` SDK fetches dynamically; pinning them\n// statically would be misleading.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { expectNonEmptyString } from '../../../substrate/runtime/config-validation.ts';\nimport { walrusConfigError, type WalrusConfigError } from '../errors.ts';\nimport type { WalrusStorageNode } from '../storage-nodes.ts';\n\n/** Known networks supported by the registry lookup. */\nexport type WalrusKnownNetwork = 'testnet' | 'mainnet' | 'devnet';\n\n/** Options for the known-deployment mode. */\nexport interface WalrusKnownDeploymentOptions {\n\t/** Network shortcut — looks up per-field defaults from a registry\n\t * baked into this package. */\n\treadonly network?: WalrusKnownNetwork;\n\t/** Per-field overrides. Required when `network` is omitted. */\n\treadonly systemObjectId?: string;\n\treadonly stakingPoolId?: string;\n\treadonly exchangeIds?: ReadonlyArray<string>;\n\t/** Explicit storage-node committee. Required (throws if missing\n\t * even when `network` is set — distilled-doc invariant 16). */\n\treadonly nodes?: ReadonlyArray<WalrusStorageNode>;\n\treadonly aggregatorUrl?: string;\n\treadonly publisherUrl?: string;\n\treadonly proxyUrl?: string;\n}\n\n/** Resolved known-deployment boot artifacts. */\nexport interface KnownDeploymentBootResult {\n\treadonly mode: 'known';\n\treadonly chain: string;\n\treadonly systemObjectId: string;\n\treadonly stakingPoolId: string;\n\treadonly exchangeIds: ReadonlyArray<string>;\n\treadonly nodes: ReadonlyArray<WalrusStorageNode>;\n\t/** Null when any of the three URLs are missing distilled-doc\n\t * invariant 15. */\n\treadonly proxyUrl: string | null;\n\treadonly aggregatorUrl: string | null;\n\treadonly publisherUrl: string | null;\n}\n\n/** Known-deployment registry — baked-in record per network. The\n * values here mirror v3's `knownDeployments.walrus.{testnet,\n * mainnet}` entries. Devnet has no canonical record today. */\nconst KNOWN_DEPLOYMENT_REGISTRY: Readonly<\n\tRecord<\n\t\tWalrusKnownNetwork,\n\t\t{\n\t\t\treadonly chain: string;\n\t\t\treadonly systemObjectId?: string;\n\t\t\treadonly stakingPoolId?: string;\n\t\t\treadonly exchangeIds?: ReadonlyArray<string>;\n\t\t\treadonly aggregatorUrl?: string;\n\t\t\treadonly publisherUrl?: string;\n\t\t\treadonly proxyUrl?: string;\n\t\t}\n\t>\n> = {\n\ttestnet: {\n\t\tchain: 'sui:testnet',\n\t\t// Real ids must be supplied via the explicit options form\n\t\t// (`walrusFor(testnet).known({ systemObjectId, stakingPoolId, ... })`).\n\t\t// The known-deployment lookup table only canonicalises the URLs;\n\t\t// the on-chain ids are network-specific and live outside this\n\t\t// package.\n\t\tsystemObjectId: undefined,\n\t\tstakingPoolId: undefined,\n\t\texchangeIds: [],\n\t\taggregatorUrl: 'https://aggregator.walrus-testnet.walrus.space',\n\t\tpublisherUrl: 'https://publisher.walrus-testnet.walrus.space',\n\t\tproxyUrl: 'https://aggregator.walrus-testnet.walrus.space',\n\t},\n\tmainnet: {\n\t\tchain: 'sui:mainnet',\n\t\tsystemObjectId: undefined,\n\t\tstakingPoolId: undefined,\n\t\texchangeIds: [],\n\t\taggregatorUrl: 'https://aggregator.walrus.space',\n\t\tpublisherUrl: 'https://publisher.walrus.space',\n\t\tproxyUrl: 'https://aggregator.walrus.space',\n\t},\n\tdevnet: {\n\t\tchain: 'sui:devnet',\n\t},\n};\n\n/** Synchronous factory-time validation + projection. Throws (NOT\n * Effect-fail) on missing required fields so misconfiguration trips\n * at the `defineDevstack` call site rather than at deferred\n * Layer.build time. Distilled-doc invariants 14 + 16. */\nexport const resolveKnownDeploymentOptions = (\n\topts: WalrusKnownDeploymentOptions,\n): KnownDeploymentBootResult => {\n\tconst reg = opts.network ? KNOWN_DEPLOYMENT_REGISTRY[opts.network] : undefined;\n\n\tconst systemObjectId = expectNonEmptyString(opts.systemObjectId ?? reg?.systemObjectId, {\n\t\tfield: 'systemObjectId',\n\t\tmkError: ({ field }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusKnownDeployment: 'systemObjectId' is required (pass it explicitly, or pass network with a registered entry)`,\n\t\t\t),\n\t});\n\n\tconst stakingPoolId = expectNonEmptyString(opts.stakingPoolId ?? reg?.stakingPoolId, {\n\t\tfield: 'stakingPoolId',\n\t\tmkError: ({ field }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusKnownDeployment: 'stakingPoolId' is required (pass it explicitly, or pass network with a registered entry)`,\n\t\t\t),\n\t});\n\n\tconst nodes = opts.nodes;\n\tif (!nodes) {\n\t\t// Distilled-doc invariant 16: even when `network` is set, the\n\t\t// nodes must be explicit. Testnet has 100+ nodes the SDK\n\t\t// fetches dynamically; pinning would be misleading.\n\t\tthrow walrusConfigError(\n\t\t\t'nodes',\n\t\t\t`walrusKnownDeployment: explicit 'nodes' committee is required — ` +\n\t\t\t\t`Walrus ${opts.network ?? 'custom'} has nodes fetched dynamically by the SDK`,\n\t\t\t`pass an empty array if you accept the SDK-driven committee lookup, ` +\n\t\t\t\t`or use walrus()/walrusFor(network).local({...}) for a local self-hosted cluster`,\n\t\t);\n\t}\n\n\tconst aggregatorUrl = opts.aggregatorUrl ?? reg?.aggregatorUrl ?? null;\n\tconst publisherUrl = opts.publisherUrl ?? reg?.publisherUrl ?? null;\n\tconst proxyUrl = opts.proxyUrl ?? reg?.proxyUrl ?? aggregatorUrl ?? publisherUrl ?? null;\n\n\t// Invariant 15: surface null when any URL is missing so the\n\t// plugin's projection can conditionally publish the proxy tag.\n\tconst allUrlsPresent = aggregatorUrl !== null && publisherUrl !== null && proxyUrl !== null;\n\n\treturn {\n\t\tmode: 'known' as const,\n\t\tchain: reg?.chain ?? 'sui:custom',\n\t\tsystemObjectId,\n\t\tstakingPoolId,\n\t\texchangeIds: opts.exchangeIds ?? reg?.exchangeIds ?? [],\n\t\tnodes,\n\t\tproxyUrl: allUrlsPresent ? proxyUrl : null,\n\t\taggregatorUrl: allUrlsPresent ? aggregatorUrl : null,\n\t\tpublisherUrl: allUrlsPresent ? publisherUrl : null,\n\t};\n};\n\n/** \"Boot\" the known deployment. Purely synchronous projection inside\n * Effect.gen — no I/O, no Scope work. Surfaces as Effect for\n * uniformity with the local-cluster boot signature. */\nexport const bootKnownDeployment = (\n\topts: WalrusKnownDeploymentOptions,\n): Effect.Effect<KnownDeploymentBootResult, WalrusConfigError, Scope.Scope> =>\n\tEffect.try({\n\t\ttry: () => resolveKnownDeploymentOptions(opts),\n\t\t// `resolveKnownDeploymentOptions` throws our typed config error\n\t\t// shape; map straight back into the typed channel.\n\t\tcatch: (err) => err as WalrusConfigError,\n\t});\n"],"mappings":";;;;;;;AA+DA,MAAM,4BAaF;CACH,SAAS;EACR,OAAO;EAMP,gBAAgB,KAAA;EAChB,eAAe,KAAA;EACf,aAAa,EAAE;EACf,eAAe;EACf,cAAc;EACd,UAAU;EACV;CACD,SAAS;EACR,OAAO;EACP,gBAAgB,KAAA;EAChB,eAAe,KAAA;EACf,aAAa,EAAE;EACf,eAAe;EACf,cAAc;EACd,UAAU;EACV;CACD,QAAQ,EACP,OAAO,cACP;CACD;;;;;AAMD,MAAa,iCACZ,SAC+B;CAC/B,MAAM,MAAM,KAAK,UAAU,0BAA0B,KAAK,WAAW,KAAA;CAErE,MAAM,iBAAiB,qBAAqB,KAAK,kBAAkB,KAAK,gBAAgB;EACvF,OAAO;EACP,UAAU,EAAE,YACX,kBACC,OACA,oHACA;EACF,CAAC;CAEF,MAAM,gBAAgB,qBAAqB,KAAK,iBAAiB,KAAK,eAAe;EACpF,OAAO;EACP,UAAU,EAAE,YACX,kBACC,OACA,mHACA;EACF,CAAC;CAEF,MAAM,QAAQ,KAAK;AACnB,KAAI,CAAC,MAIJ,OAAM,kBACL,SACA,0EACW,KAAK,WAAW,SAAS,4CACpC,qJAEA;CAGF,MAAM,gBAAgB,KAAK,iBAAiB,KAAK,iBAAiB;CAClE,MAAM,eAAe,KAAK,gBAAgB,KAAK,gBAAgB;CAC/D,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,iBAAiB,gBAAgB;CAIpF,MAAM,iBAAiB,kBAAkB,QAAQ,iBAAiB,QAAQ,aAAa;AAEvF,QAAO;EACN,MAAM;EACN,OAAO,KAAK,SAAS;EACrB;EACA;EACA,aAAa,KAAK,eAAe,KAAK,eAAe,EAAE;EACvD;EACA,UAAU,iBAAiB,WAAW;EACtC,eAAe,iBAAiB,gBAAgB;EAChD,cAAc,iBAAiB,eAAe;EAC9C;;;;;AAMF,MAAa,uBACZ,SAEA,OAAO,IAAI;CACV,WAAW,8BAA8B,KAAK;CAG9C,QAAQ,QAAQ;CAChB,CAAC"}
1
+ {"version":3,"file":"known-deploy.mjs","names":[],"sources":["../../../../src/plugins/walrus/mode/known-deploy.ts"],"sourcesContent":["// Walrus mode — known deployment (testnet / mainnet / *-fork via\n// upstream translation).\n//\n// Distilled-doc reference (06-walrus.md §\"Lifecycle: Startup —\n// known deployment\"). Purely synchronous body — no ordered phases.\n// The factory validates required deployment fields and returns a\n// resolved value whose tags are eager `Layer.succeed(...)` constants.\n//\n// Distilled-doc invariants honored:\n// - 15: each of `proxyUrl / aggregatorUrl / publisherUrl` surfaces\n// INDEPENDENTLY. Encoded as `string | null` in the resolved\n// shape a given field is null only when THAT specific URL\n// is unresolved (registry default + explicit override both\n// absent). The plugin's projection step publishes each tag\n// when its own URL is present; a missing publisher URL no\n// longer suppresses an available proxy/aggregator URL. (The\n// earlier all-or-nothing gate that nullified all three when\n// any single URL was missing was removed.)\n// - 16: throw synchronously when `nodes` is missing for a\n// registered network. Testnet has 100+ nodes that the\n// `@mysten/walrus` SDK fetches dynamically; pinning them\n// statically would be misleading.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { expectNonEmptyString } from '../../../substrate/runtime/config-validation.ts';\nimport { walrusConfigError, type WalrusConfigError } from '../errors.ts';\nimport type { WalrusStorageNode } from '../storage-nodes.ts';\n\n/** Known networks supported by the registry lookup. */\nexport type WalrusKnownNetwork = 'testnet' | 'mainnet' | 'devnet';\n\n/** Options for the known-deployment mode. */\nexport interface WalrusKnownDeploymentOptions {\n\t/** Network shortcut — looks up per-field defaults from a registry\n\t * baked into this package. */\n\treadonly network?: WalrusKnownNetwork;\n\t/** Per-field overrides. Required when `network` is omitted. */\n\treadonly systemObjectId?: string;\n\treadonly stakingPoolId?: string;\n\treadonly exchangeIds?: ReadonlyArray<string>;\n\t/** Explicit storage-node committee. Required (throws if missing\n\t * even when `network` is set — distilled-doc invariant 16). */\n\treadonly nodes?: ReadonlyArray<WalrusStorageNode>;\n\treadonly aggregatorUrl?: string;\n\treadonly publisherUrl?: string;\n\treadonly proxyUrl?: string;\n}\n\n/** Resolved known-deployment boot artifacts. */\nexport interface KnownDeploymentBootResult {\n\treadonly mode: 'known';\n\treadonly chain: string;\n\treadonly systemObjectId: string;\n\treadonly stakingPoolId: string;\n\treadonly exchangeIds: ReadonlyArray<string>;\n\treadonly nodes: ReadonlyArray<WalrusStorageNode>;\n\t/** Null only when the proxy URL itself is unresolved (no explicit\n\t * `proxyUrl` override and no registry/aggregator/publisher\n\t * fallback). Surfaces independently of `aggregatorUrl` /\n\t * `publisherUrl` — distilled-doc invariant 15. */\n\treadonly proxyUrl: string | null;\n\treadonly aggregatorUrl: string | null;\n\treadonly publisherUrl: string | null;\n}\n\n/** Known-deployment registry — baked-in record per network. The\n * values here mirror v3's `knownDeployments.walrus.{testnet,\n * mainnet}` entries. Devnet has no canonical record today. */\nconst KNOWN_DEPLOYMENT_REGISTRY: Readonly<\n\tRecord<\n\t\tWalrusKnownNetwork,\n\t\t{\n\t\t\treadonly chain: string;\n\t\t\treadonly systemObjectId?: string;\n\t\t\treadonly stakingPoolId?: string;\n\t\t\treadonly exchangeIds?: ReadonlyArray<string>;\n\t\t\treadonly aggregatorUrl?: string;\n\t\t\treadonly publisherUrl?: string;\n\t\t\treadonly proxyUrl?: string;\n\t\t}\n\t>\n> = {\n\ttestnet: {\n\t\tchain: 'sui:testnet',\n\t\t// Real ids must be supplied via the explicit options form\n\t\t// (`walrusFor(testnet).known({ systemObjectId, stakingPoolId, ... })`).\n\t\t// The known-deployment lookup table only canonicalises the URLs;\n\t\t// the on-chain ids are network-specific and live outside this\n\t\t// package.\n\t\tsystemObjectId: undefined,\n\t\tstakingPoolId: undefined,\n\t\texchangeIds: [],\n\t\taggregatorUrl: 'https://aggregator.walrus-testnet.walrus.space',\n\t\tpublisherUrl: 'https://publisher.walrus-testnet.walrus.space',\n\t\tproxyUrl: 'https://aggregator.walrus-testnet.walrus.space',\n\t},\n\tmainnet: {\n\t\tchain: 'sui:mainnet',\n\t\tsystemObjectId: undefined,\n\t\tstakingPoolId: undefined,\n\t\texchangeIds: [],\n\t\taggregatorUrl: 'https://aggregator.walrus.space',\n\t\tpublisherUrl: 'https://publisher.walrus.space',\n\t\tproxyUrl: 'https://aggregator.walrus.space',\n\t},\n\tdevnet: {\n\t\tchain: 'sui:devnet',\n\t},\n};\n\n/** Synchronous factory-time validation + projection. Throws (NOT\n * Effect-fail) on missing required fields so misconfiguration trips\n * at the `defineDevstack` call site rather than at deferred\n * Layer.build time. Distilled-doc invariants 14 + 16. */\nexport const resolveKnownDeploymentOptions = (\n\topts: WalrusKnownDeploymentOptions,\n): KnownDeploymentBootResult => {\n\tconst reg = opts.network ? KNOWN_DEPLOYMENT_REGISTRY[opts.network] : undefined;\n\n\tconst systemObjectId = expectNonEmptyString(opts.systemObjectId ?? reg?.systemObjectId, {\n\t\tfield: 'systemObjectId',\n\t\tmkError: ({ field }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusKnownDeployment: 'systemObjectId' is required (pass it explicitly, or pass network with a registered entry)`,\n\t\t\t),\n\t});\n\n\tconst stakingPoolId = expectNonEmptyString(opts.stakingPoolId ?? reg?.stakingPoolId, {\n\t\tfield: 'stakingPoolId',\n\t\tmkError: ({ field }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusKnownDeployment: 'stakingPoolId' is required (pass it explicitly, or pass network with a registered entry)`,\n\t\t\t),\n\t});\n\n\tconst nodes = opts.nodes;\n\tif (!nodes) {\n\t\t// Distilled-doc invariant 16: even when `network` is set, the\n\t\t// nodes must be explicit. Testnet has 100+ nodes the SDK\n\t\t// fetches dynamically; pinning would be misleading.\n\t\tthrow walrusConfigError(\n\t\t\t'nodes',\n\t\t\t`walrusKnownDeployment: explicit 'nodes' committee is required — ` +\n\t\t\t\t`Walrus ${opts.network ?? 'custom'} has nodes fetched dynamically by the SDK`,\n\t\t\t`pass an empty array if you accept the SDK-driven committee lookup, ` +\n\t\t\t\t`or use walrus()/walrusFor(network).local({...}) for a local self-hosted cluster`,\n\t\t);\n\t}\n\n\tconst aggregatorUrl = opts.aggregatorUrl ?? reg?.aggregatorUrl ?? null;\n\tconst publisherUrl = opts.publisherUrl ?? reg?.publisherUrl ?? null;\n\tconst proxyUrl = opts.proxyUrl ?? reg?.proxyUrl ?? aggregatorUrl ?? publisherUrl ?? null;\n\n\t// Invariant 15: surface null per individual URL when missing so the\n\t// plugin's projection can conditionally publish each tag. Previously\n\t// any single missing URL nullified all three, dropping user-supplied\n\t// values for the URLs they did provide.\n\treturn {\n\t\tmode: 'known' as const,\n\t\tchain: reg?.chain ?? 'sui:custom',\n\t\tsystemObjectId,\n\t\tstakingPoolId,\n\t\texchangeIds: opts.exchangeIds ?? reg?.exchangeIds ?? [],\n\t\tnodes,\n\t\tproxyUrl,\n\t\taggregatorUrl,\n\t\tpublisherUrl,\n\t};\n};\n\n/** \"Boot\" the known deployment. Purely synchronous projection inside\n * Effect.gen — no I/O, no Scope work. Surfaces as Effect for\n * uniformity with the local-cluster boot signature. */\nexport const bootKnownDeployment = (\n\topts: WalrusKnownDeploymentOptions,\n): Effect.Effect<KnownDeploymentBootResult, WalrusConfigError, Scope.Scope> =>\n\tEffect.try({\n\t\ttry: () => resolveKnownDeploymentOptions(opts),\n\t\t// `resolveKnownDeploymentOptions` throws our typed config error\n\t\t// shape. STYLE_GUIDE §2 forbids bare error casts; runtime-guard\n\t\t// the `_tag` so an unexpected synchronous throw (e.g. a future\n\t\t// helper that throws a stock `TypeError`) is wrapped instead of\n\t\t// silently mis-tagged as `WalrusConfigError`.\n\t\tcatch: (err): WalrusConfigError => {\n\t\t\tif (\n\t\t\t\ttypeof err === 'object' &&\n\t\t\t\terr !== null &&\n\t\t\t\t'_tag' in err &&\n\t\t\t\t(err as { readonly _tag?: unknown })._tag === 'WalrusConfigError'\n\t\t\t) {\n\t\t\t\treturn err as WalrusConfigError;\n\t\t\t}\n\t\t\treturn walrusConfigError(\n\t\t\t\t'unknown',\n\t\t\t\t`walrusKnownDeployment: unexpected non-typed throw inside resolveKnownDeploymentOptions: ${\n\t\t\t\t\terr instanceof Error ? err.message : String(err)\n\t\t\t\t}`,\n\t\t\t\tundefined,\n\t\t\t\terr,\n\t\t\t);\n\t\t},\n\t});\n"],"mappings":";;;;;;;AAqEA,MAAM,4BAaF;CACH,SAAS;EACR,OAAO;EAMP,gBAAgB,KAAA;EAChB,eAAe,KAAA;EACf,aAAa,EAAE;EACf,eAAe;EACf,cAAc;EACd,UAAU;EACV;CACD,SAAS;EACR,OAAO;EACP,gBAAgB,KAAA;EAChB,eAAe,KAAA;EACf,aAAa,EAAE;EACf,eAAe;EACf,cAAc;EACd,UAAU;EACV;CACD,QAAQ,EACP,OAAO,cACP;CACD;;;;;AAMD,MAAa,iCACZ,SAC+B;CAC/B,MAAM,MAAM,KAAK,UAAU,0BAA0B,KAAK,WAAW,KAAA;CAErE,MAAM,iBAAiB,qBAAqB,KAAK,kBAAkB,KAAK,gBAAgB;EACvF,OAAO;EACP,UAAU,EAAE,YACX,kBACC,OACA,oHACA;EACF,CAAC;CAEF,MAAM,gBAAgB,qBAAqB,KAAK,iBAAiB,KAAK,eAAe;EACpF,OAAO;EACP,UAAU,EAAE,YACX,kBACC,OACA,mHACA;EACF,CAAC;CAEF,MAAM,QAAQ,KAAK;AACnB,KAAI,CAAC,MAIJ,OAAM,kBACL,SACA,0EACW,KAAK,WAAW,SAAS,4CACpC,qJAEA;CAGF,MAAM,gBAAgB,KAAK,iBAAiB,KAAK,iBAAiB;CAClE,MAAM,eAAe,KAAK,gBAAgB,KAAK,gBAAgB;CAC/D,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,iBAAiB,gBAAgB;AAMpF,QAAO;EACN,MAAM;EACN,OAAO,KAAK,SAAS;EACrB;EACA;EACA,aAAa,KAAK,eAAe,KAAK,eAAe,EAAE;EACvD;EACA;EACA;EACA;EACA;;;;;AAMF,MAAa,uBACZ,SAEA,OAAO,IAAI;CACV,WAAW,8BAA8B,KAAK;CAM9C,QAAQ,QAA2B;AAClC,MACC,OAAO,QAAQ,YACf,QAAQ,QACR,UAAU,OACT,IAAoC,SAAS,oBAE9C,QAAO;AAER,SAAO,kBACN,WACA,2FACC,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI,IAEjD,KAAA,GACA,IACA;;CAEF,CAAC"}
@@ -1,8 +1,11 @@
1
1
  import { contentHash } from "../../../substrate/brand.mjs";
2
- import { expectPositiveInteger } from "../../../substrate/runtime/config-validation.mjs";
2
+ import { SpanAttr } from "../../../substrate/runtime/observability/spans.mjs";
3
3
  import { setCurrentPluginPhase } from "../../../substrate/runtime/current-plugin.mjs";
4
+ import { expectPositiveInteger } from "../../../substrate/runtime/config-validation.mjs";
4
5
  import { walrusConfigError, walrusPluginError } from "../errors.mjs";
6
+ import { WalrusSpans } from "../spans.mjs";
5
7
  import { computePublicHostname, startStorageNodes } from "../storage-nodes.mjs";
8
+ import "../routable.mjs";
6
9
  import { resolveWalExchange } from "../wal-swap.mjs";
7
10
  import { makeWalFaucetStrategy, resolveWalCoinType, walPackageIdFromCoinType } from "../faucet-strategy.mjs";
8
11
  import { deployWalrusContracts } from "../deploy.mjs";
@@ -19,6 +22,7 @@ const resolveLocalClusterOptions = (opts) => {
19
22
  mkError: ({ field, message, hint }) => walrusConfigError(field, `walrusLocalCluster: nodeCount must be >= 1 (got ${String(opts.nodeCount ?? 1)})`, hint ?? message),
20
23
  hint: "set nodeCount to a positive integer (default 1)"
21
24
  });
25
+ if (nodeCount > 8) throw walrusConfigError("nodeCount", `walrusLocalCluster: nodeCount (${nodeCount}) exceeds the maximum 8 pre-declared Traefik entrypoints (walrus-node-0..7).`, `reduce nodeCount or raise WALRUS_MAX_NODE_COUNT in plugins/walrus/routable.ts`);
22
26
  const shards = expectPositiveInteger(opts.shards ?? 100, {
23
27
  field: "shards",
24
28
  mkError: ({ field, message, hint }) => walrusConfigError(field, `walrusLocalCluster: shards must be a positive integer (got ${String(opts.shards ?? 100)})`, hint ?? message),
@@ -63,7 +67,11 @@ const bootLocalCluster = (deps, opts) => Effect.gen(function* () {
63
67
  yield* setCurrentPluginPhase(`resolving Walrus image ${opts.version}`);
64
68
  const walrusImage = yield* resolveCargoImage(deps.runtime, {
65
69
  walrusRef: opts.version,
66
- suiVersion: opts.suiVersion
70
+ suiVersion: opts.suiVersion,
71
+ owner: {
72
+ app: deps.app,
73
+ stack: deps.stack
74
+ }
67
75
  });
68
76
  yield* setCurrentPluginPhase(`ensuring Walrus network ${deps.walrusNetworkName}`);
69
77
  yield* deps.runtime.ensureNetwork({
@@ -79,6 +87,7 @@ const bootLocalCluster = (deps, opts) => Effect.gen(function* () {
79
87
  chainId: deps.suiChainId,
80
88
  contentHash: contentHash(`walrus|${opts.version}|${opts.suiVersion}|${opts.nodeCount}|${opts.shards}|${opts.epochDuration}`),
81
89
  outputDirHostPath: deps.deployHostMountPath,
90
+ stackRoot: deps.stackRoot,
82
91
  suiRpcUrlInNetwork: deps.suiRpcUrlInNetwork,
83
92
  walrusFaucetUrlInNetwork: deps.walrusFaucetUrlInNetwork,
84
93
  waitForFundsReady: deps.waitForFundsReady,
@@ -97,18 +106,28 @@ const bootLocalCluster = (deps, opts) => Effect.gen(function* () {
97
106
  state.stakingObject,
98
107
  state.exchangeObject ?? "no-exchange"
99
108
  ].join("|");
109
+ const nodeImageScope = state.walrusPackageId.replace(/^0x/, "").slice(0, 12);
110
+ const nodeImages = yield* Effect.forEach(Array.from({ length: opts.nodeCount }, (_, i) => i), (i) => resolveCargoImage(deps.runtime, {
111
+ walrusRef: opts.version,
112
+ suiVersion: opts.suiVersion,
113
+ owner: {
114
+ app: deps.app,
115
+ stack: deps.stack
116
+ }
117
+ }, `${walrusImage.tag}-${nodeImageScope}-node-${i}`));
100
118
  yield* setCurrentPluginPhase(`starting ${opts.nodeCount} Walrus storage node${opts.nodeCount === 1 ? "" : "s"}`);
101
119
  const { nodes } = yield* startStorageNodes(deps.runtime, {
102
120
  app: deps.app,
103
121
  stack: deps.stack,
104
122
  walrusName: opts.name,
105
- image: walrusImage,
123
+ images: nodeImages,
106
124
  nodeCount: opts.nodeCount,
107
125
  subnetPrefix: deps.subnetPrefix,
108
126
  containerApiPort: opts.containerApiPort,
109
127
  walrusNetworkName: deps.walrusNetworkName,
110
128
  suiNetworkName: deps.suiNetworkName,
111
129
  deployHostMountPath: deps.deployHostMountPath,
130
+ stackRoot: deps.stackRoot,
112
131
  deployConfigHash,
113
132
  readyTimeoutMs: opts.readyTimeoutMs
114
133
  });
@@ -142,10 +161,10 @@ const bootLocalCluster = (deps, opts) => Effect.gen(function* () {
142
161
  walCoinType: resolvedWalCoinType
143
162
  };
144
163
  }).pipe(Effect.withSpan("devstack.plugin.walrus.localCluster.boot", { attributes: {
145
- "devstack.plugin": "walrus",
146
- "walrus.name": opts.name,
147
- "walrus.nodeCount": opts.nodeCount,
148
- "walrus.shards": opts.shards
164
+ [SpanAttr.plugin]: "walrus",
165
+ [WalrusSpans.name]: opts.name,
166
+ [WalrusSpans.nodeCount]: opts.nodeCount,
167
+ [WalrusSpans.shards]: opts.shards
149
168
  } }));
150
169
  //#endregion
151
170
  export { bootLocalCluster, resolveLocalClusterOptions };
@@ -1 +1 @@
1
- {"version":3,"file":"local-cluster.mjs","names":["brandContentHash"],"sources":["../../../../src/plugins/walrus/mode/local-cluster.ts"],"sourcesContent":["// Walrus mode — local cluster.\n//\n// Distilled-doc reference (06-walrus.md §\"Lifecycle: Startup —\n// local cluster\"). Eight ordered phases:\n//\n// 0. Yield deps (Sui, Identity, ChainProbe, faucet strategy opt).\n// 1. Image build — upstream cargo image (bootstrap asset) +\n// wrapper image (inline; content-addressed on\n// the upstream tag + suiVersion).\n// 1b. Docker network create — per-stack `/24` via\n// `Docker.networkCreate(networkName, {subnet})`.\n// 2. Deploy contracts — via `ArtifactPublisher`. The\n// publisher folds chainId into the cache\n// key; verify probes BOTH the on-disk\n// `deploy` file AND on-chain object\n// existence; produce runs the deploy\n// one-shot.\n// 3. Register committee — currently a typed no-op (distilled-doc\n// opportunity #3: drop the cargo-culted\n// placeholder). We omit it entirely in\n// v3 rewrite.\n// 4. Storage nodes — parallel boot of N storage-node containers.\n// 5. Exchange resolution — on-chain getObject + parse type.\n// Degrades to undefined on\n// OBJECT_NOT_FOUND.\n// 6. Proxy URL pick — nodes[0].rpcUrl is the representative\n// aggregator/publisher.\n// 7a. WAL faucet strategy register — opt-in when an exchange exists.\n// 8. Registries — package + endpoint + walrus-state.\n//\n// What this file owns: the dispatch shape + the typed options\n// surface + the synchronous factory-time validation.\n//\n// What this file delegates: container/Move heavy paths live in\n// `storage-nodes.ts`, `deploy.ts`, and the `ArtifactPublisher`\n// primitive.\n\nimport { Effect, FileSystem, Path, type Scope } from 'effect';\n\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n} from '../../../primitives/artifact-publisher.ts';\nimport type { ChainProbe } from '../../../contracts/chain-probe.ts';\nimport type { ContainerRuntime } from '../../../contracts/container-runtime.ts';\nimport type { SuiProbeKey } from '../../sui/chain-probe.ts';\nimport { contentHash as brandContentHash } from '../../../substrate/brand.ts';\nimport type { ChainId } from '../../../substrate/brand.ts';\nimport { expectPositiveInteger } from '../../../substrate/runtime/config-validation.ts';\nimport { setCurrentPluginPhase } from '../../../substrate/runtime/current-plugin.ts';\nimport { walrusConfigError, walrusPluginError, type WalrusError } from '../errors.ts';\nimport type { WalrusStorageNode } from '../storage-nodes.ts';\nimport {\n\tDEFAULT_NODE_READY_TIMEOUT_MS,\n\tDEFAULT_CONTAINER_API_PORT,\n\tWALRUS_NODE_IP_BASE,\n\tcomputePublicHostname,\n\tstartStorageNodes,\n} from '../storage-nodes.ts';\nimport { deployWalrusContracts, type CachedDeployState } from '../deploy.ts';\nimport {\n\tDEFAULT_SUI_VERSION,\n\tDEFAULT_WALRUS_REF,\n\tresolveCargoImage,\n} from '../bootstrap-assets/cargo-image.ts';\nimport {\n\tmakeWalFaucetStrategy,\n\twalPackageIdFromCoinType,\n\tresolveWalCoinType,\n\ttype WalFaucetStrategy,\n} from '../faucet-strategy.ts';\nimport { resolveWalExchange, type WalExchangeHandle, type WalSwapSdk } from '../wal-swap.ts';\n\n/** Options for the local-cluster mode. Mirrors v3\n * `WalrusLocalClusterOptions<Name>` (06-walrus.md §\"Configuration\"). */\nexport interface WalrusLocalClusterOptions {\n\t/** Engine row name + on-disk dir suffix + registry key.\n\t * Default `'walrus'`. */\n\treadonly name?: string;\n\t/** Number of storage-node containers. Must be `>= 1` (synchronous\n\t * factory-time guard). Default `1`. */\n\treadonly nodeCount?: number;\n\t/** Total shards distributed across the committee. Must be\n\t * `>= nodeCount`. Default `100` (distilled-doc default block). */\n\treadonly shards?: number;\n\t/** Pinned walrus release — drives the wrapper image build.\n\t * Default `'testnet-v1.49.1'`. */\n\treadonly version?: string;\n\t/** Sui release whose binary the wrapper image bakes (distilled-\n\t * doc invariant 24). Default `'devnet-v1.71.0'`. */\n\treadonly suiVersion?: string;\n\t/** Port each storage node binds inside the container. Default\n\t * 9185 (same as the router entrypoint — invariant 9). */\n\treadonly containerApiPort?: number;\n\t/** Walrus epoch length passed to `walrus-deploy --epoch-duration`.\n\t * Default `'24h'`. */\n\treadonly epochDuration?: string;\n\t/** Per-node TCP ready-probe timeout (ms). Defaults to\n\t * `DEFAULT_NODE_READY_TIMEOUT_MS`. */\n\treadonly readyTimeoutMs?: number;\n}\n\n/** Resolved local-cluster boot artifacts. */\nexport interface LocalClusterBootResult {\n\treadonly mode: 'local';\n\treadonly deploy: CachedDeployState;\n\treadonly walrusPackageId: string;\n\treadonly walPackageId: string;\n\treadonly nodes: ReadonlyArray<WalrusStorageNode>;\n\treadonly aggregatorUrl: string;\n\treadonly publisherUrl: string;\n\treadonly proxyUrl: string;\n\treadonly exchangeObjectId: string | undefined;\n\treadonly exchange: WalExchangeHandle | null;\n\t/** WAL faucet strategy — present only when the local cluster has a\n\t * non-empty exchange object. The barrel registers this onto the\n\t * `coinType:<fullCoinType>` strategy contributor decl. `null`\n\t * otherwise. */\n\treadonly walFaucetStrategy: WalFaucetStrategy | null;\n\treadonly walCoinType: string;\n}\n\n/** Defaults applied to options. */\nexport interface ResolvedLocalClusterOptions {\n\treadonly name: string;\n\treadonly nodeCount: number;\n\treadonly shards: number;\n\treadonly version: string;\n\treadonly suiVersion: string;\n\treadonly containerApiPort: number;\n\treadonly epochDuration: string;\n\treadonly readyTimeoutMs: number;\n}\n\n/** Synchronous factory-time validation. Mirrors v3's\n * `local-cluster.ts:101-121` guards. Throws (NOT Effect-fail) so\n * misconfiguration trips at the `defineDevstack` call site rather\n * than at deferred Layer.build time. Distilled-doc invariant 11. */\nexport const resolveLocalClusterOptions = (\n\topts: WalrusLocalClusterOptions,\n): ResolvedLocalClusterOptions => {\n\tconst nodeCount = expectPositiveInteger(opts.nodeCount ?? 1, {\n\t\tfield: 'nodeCount',\n\t\tmkError: ({ field, message, hint }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusLocalCluster: nodeCount must be >= 1 (got ${String(opts.nodeCount ?? 1)})`,\n\t\t\t\thint ?? message,\n\t\t\t),\n\t\thint: 'set nodeCount to a positive integer (default 1)',\n\t});\n\tconst shards = expectPositiveInteger(opts.shards ?? 100, {\n\t\tfield: 'shards',\n\t\tmkError: ({ field, message, hint }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusLocalCluster: shards must be a positive integer (got ${String(opts.shards ?? 100)})`,\n\t\t\t\thint ?? message,\n\t\t\t),\n\t\thint: 'set shards to a positive integer (default 100)',\n\t});\n\tif (shards < nodeCount) {\n\t\tthrow walrusConfigError(\n\t\t\t'shards',\n\t\t\t`walrusLocalCluster: shards (${shards}) must be >= nodeCount (${nodeCount})`,\n\t\t\t`set shards >= ${nodeCount} (default 100)`,\n\t\t);\n\t}\n\treturn {\n\t\tname: opts.name ?? 'walrus',\n\t\tnodeCount,\n\t\tshards,\n\t\tversion: opts.version ?? DEFAULT_WALRUS_REF,\n\t\tsuiVersion: opts.suiVersion ?? DEFAULT_SUI_VERSION,\n\t\tcontainerApiPort: opts.containerApiPort ?? DEFAULT_CONTAINER_API_PORT,\n\t\tepochDuration: opts.epochDuration ?? '24h',\n\t\treadyTimeoutMs: opts.readyTimeoutMs ?? DEFAULT_NODE_READY_TIMEOUT_MS,\n\t};\n};\n\n/** Dependencies the local service consumes at acquire-time. */\nexport interface LocalClusterDeps {\n\treadonly runtime: ContainerRuntime;\n\treadonly publisher: ArtifactPublisher;\n\treadonly probe: ChainProbe<SuiProbeKey>;\n\treadonly suiSdk: WalSwapSdk;\n\treadonly suiChainId: ChainId;\n\treadonly suiRpcUrlInNetwork: string;\n\treadonly walrusFaucetUrlInNetwork: string;\n\treadonly waitForFundsReady: Effect.Effect<void, unknown>;\n\treadonly app: string;\n\treadonly stack: string;\n\t/** Pre-allocated /24 prefix from `subnetForStack`. */\n\treadonly subnetPrefix: string;\n\treadonly walrusNetworkName: string;\n\treadonly suiNetworkName: string;\n\treadonly deployHostMountPath: string;\n}\n\n/** Boot the local cluster. Returns the resolved value the plugin\n * projects onto its tags.\n *\n * Steps:\n * - Image build — `resolveCargoImage` (bootstrap asset).\n * Honors `WALRUS_CARGO_IMAGE_OVERRIDE` for the pre-baked path.\n * - Docker network ensure — `runtime.ensureNetwork(walrusNet)`.\n * The sui network is owned by the sui plugin; we attach to it\n * as a secondary network on each storage node.\n * - Deploy contracts — `deployWalrusContracts` dispatches through\n * the artifact publisher primitive; the produce body runs the walrus deploy\n * one-shot.\n * - Storage nodes — parallel boot via `startStorageNodes`.\n * - Proxy URL pick — `nodes[0].rpcUrl`.\n * - WAL faucet strategy — constructed if `state.exchangeObject`\n * exists. Surfaced on the boot result; the barrel registers\n * the contributor decl.\n *\n * Per-step failures surface as `WalrusPluginError` with the phase\n * vocabulary from `errors.ts`; artifact publisher failures pass through as\n * `ArtifactPublishError`. The plugin narration vocabulary anchors\n * on these phase tags.\n */\nexport const bootLocalCluster = (\n\tdeps: LocalClusterDeps,\n\topts: ResolvedLocalClusterOptions,\n): Effect.Effect<\n\tLocalClusterBootResult,\n\tWalrusError | ArtifactPublishError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> =>\n\tEffect.gen(function* () {\n\t\t// ---- cargo image (bootstrap asset) -----------------------\n\t\t// The cargo image is content-addressed; the resolver owns the\n\t\t// cache check + the registry-tag override fast path.\n\t\tyield* setCurrentPluginPhase(`resolving Walrus image ${opts.version}`);\n\t\tconst walrusImage = yield* resolveCargoImage(deps.runtime, {\n\t\t\twalrusRef: opts.version,\n\t\t\tsuiVersion: opts.suiVersion,\n\t\t});\n\n\t\t// ---- docker network ensure ------------------------------\n\t\tyield* setCurrentPluginPhase(`ensuring Walrus network ${deps.walrusNetworkName}`);\n\t\tyield* deps.runtime\n\t\t\t.ensureNetwork({\n\t\t\t\tname: deps.walrusNetworkName,\n\t\t\t\tapp: deps.app,\n\t\t\t\tstack: deps.stack,\n\t\t\t})\n\t\t\t.pipe(\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t'cluster-network',\n\t\t\t\t\t\t\t`walrus: ensureNetwork('${deps.walrusNetworkName}') failed: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\t\t\t{ cause },\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t// ---- deploy via ArtifactPublisher ----------------\n\t\t// The deploy one-shot needs the walrus image + sui network so it\n\t\t// can dial the per-stack sui RPC + faucet over docker DNS.\n\t\t//\n\t\t// Per-node IP CSV is derived from the subnet prefix; per-node\n\t\t// hostnames likewise. Both must be in lockstep with the\n\t\t// storage-node boot below — the deploy step writes per-node\n\t\t// committee records on chain using these.\n\t\tconst publicHosts = Array.from({ length: opts.nodeCount }, (_, i) =>\n\t\t\tcomputePublicHostname(deps.app, deps.stack, i),\n\t\t).join(',');\n\t\tconst listeningIps = Array.from(\n\t\t\t{ length: opts.nodeCount },\n\t\t\t(_, i) => `${deps.subnetPrefix}.${WALRUS_NODE_IP_BASE + i}`,\n\t\t).join(',');\n\n\t\tyield* setCurrentPluginPhase(\n\t\t\t`deploying Walrus contracts (${opts.nodeCount} node${opts.nodeCount === 1 ? '' : 's'}, ${opts.shards} shards)`,\n\t\t);\n\t\tconst { state } = yield* deployWalrusContracts(deps.publisher, deps.probe, deps.runtime, {\n\t\t\twalrusName: opts.name,\n\t\t\tchainId: deps.suiChainId,\n\t\t\tcontentHash: brandContentHash(\n\t\t\t\t`walrus|${opts.version}|${opts.suiVersion}|${opts.nodeCount}|${opts.shards}|${opts.epochDuration}`,\n\t\t\t),\n\t\t\toutputDirHostPath: deps.deployHostMountPath,\n\t\t\tsuiRpcUrlInNetwork: deps.suiRpcUrlInNetwork,\n\t\t\twalrusFaucetUrlInNetwork: deps.walrusFaucetUrlInNetwork,\n\t\t\twaitForFundsReady: deps.waitForFundsReady,\n\t\t\tcommitteeSize: opts.nodeCount,\n\t\t\tshards: opts.shards,\n\t\t\tepochDuration: opts.epochDuration,\n\t\t\tpublicHostsCsv: publicHosts,\n\t\t\tlisteningIpsCsv: listeningIps,\n\t\t\twalrusImage,\n\t\t\tsuiNetworkName: deps.suiNetworkName,\n\t\t});\n\t\tconst deployConfigHash = [\n\t\t\t'walrus-deploy',\n\t\t\tstate.walrusPackageId,\n\t\t\tstate.systemObject,\n\t\t\tstate.stakingObject,\n\t\t\tstate.exchangeObject ?? 'no-exchange',\n\t\t].join('|');\n\n\t\t// ---- storage nodes — parallel boot ----------------------\n\t\tyield* setCurrentPluginPhase(\n\t\t\t`starting ${opts.nodeCount} Walrus storage node${opts.nodeCount === 1 ? '' : 's'}`,\n\t\t);\n\t\tconst { nodes } = yield* startStorageNodes(deps.runtime, {\n\t\t\tapp: deps.app,\n\t\t\tstack: deps.stack,\n\t\t\twalrusName: opts.name,\n\t\t\timage: walrusImage,\n\t\t\tnodeCount: opts.nodeCount,\n\t\t\tsubnetPrefix: deps.subnetPrefix,\n\t\t\tcontainerApiPort: opts.containerApiPort,\n\t\t\twalrusNetworkName: deps.walrusNetworkName,\n\t\t\tsuiNetworkName: deps.suiNetworkName,\n\t\t\tdeployHostMountPath: deps.deployHostMountPath,\n\t\t\tdeployConfigHash,\n\t\t\treadyTimeoutMs: opts.readyTimeoutMs,\n\t\t});\n\n\t\t// ---- proxy URL pick — nodes[0].rpcUrl -------------------\n\t\t// `nodeCount >= 1` is enforced synchronously already; this is\n\t\t// defense-in-depth.\n\t\tif (nodes.length === 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\twalrusPluginError('proxy', 'walrus: at least one storage node is required'),\n\t\t\t);\n\t\t}\n\t\tconst proxyUrl = nodes[0]!.rpcUrl;\n\n\t\t// ---- exchange resolution + WAL funding strategy ------\n\t\t// Register a `coinType:<fullCoinType>` strategy that swaps the\n\t\t// requesting account's SUI into WAL on demand. Accounts opt in via\n\t\t// their normal `funding` list.\n\t\tyield* setCurrentPluginPhase('resolving WAL exchange');\n\t\tconst exchange = yield* resolveWalExchange(deps.probe, state.exchangeObject);\n\t\tconst walFaucetStrategy: WalFaucetStrategy | null = exchange\n\t\t\t? makeWalFaucetStrategy({\n\t\t\t\t\texchange,\n\t\t\t\t\tsdk: deps.suiSdk,\n\t\t\t\t})\n\t\t\t: null;\n\t\tconst resolvedWalCoinType = yield* resolveWalCoinType({\n\t\t\tprobe: deps.probe,\n\t\t\ttreasuryObjectId: state.treasuryObject,\n\t\t\tdeployPackageId: state.walrusPackageId,\n\t\t\trequireTreasuryObject: exchange !== null,\n\t\t});\n\t\tconst resolvedWalPackageId = walPackageIdFromCoinType(resolvedWalCoinType);\n\n\t\treturn {\n\t\t\tmode: 'local' as const,\n\t\t\tdeploy: state,\n\t\t\twalrusPackageId: state.walrusPackageId,\n\t\t\twalPackageId: resolvedWalPackageId,\n\t\t\tnodes,\n\t\t\taggregatorUrl: proxyUrl,\n\t\t\tpublisherUrl: proxyUrl,\n\t\t\tproxyUrl,\n\t\t\texchangeObjectId: state.exchangeObject,\n\t\t\texchange,\n\t\t\twalFaucetStrategy,\n\t\t\twalCoinType: resolvedWalCoinType,\n\t\t};\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.walrus.localCluster.boot', {\n\t\t\tattributes: {\n\t\t\t\t'devstack.plugin': 'walrus',\n\t\t\t\t'walrus.name': opts.name,\n\t\t\t\t'walrus.nodeCount': opts.nodeCount,\n\t\t\t\t'walrus.shards': opts.shards,\n\t\t\t},\n\t\t}),\n\t);\n"],"mappings":"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"}
1
+ {"version":3,"file":"local-cluster.mjs","names":["brandContentHash"],"sources":["../../../../src/plugins/walrus/mode/local-cluster.ts"],"sourcesContent":["// Walrus mode — local cluster.\n//\n// Distilled-doc reference (06-walrus.md §\"Lifecycle: Startup —\n// local cluster\"). Eight ordered phases:\n//\n// 0. Yield deps (Sui, Identity, ChainProbe, faucet strategy opt).\n// 1. Image build — upstream cargo image (bootstrap asset) +\n// wrapper image (inline; content-addressed on\n// the upstream tag + suiVersion).\n// 1b. Docker network create — per-stack `/24` via\n// `Docker.networkCreate(networkName, {subnet})`.\n// 2. Deploy contracts — via `ArtifactPublisher`. The\n// publisher folds chainId into the cache\n// key; verify probes BOTH the on-disk\n// `deploy` file AND on-chain object\n// existence; produce runs the deploy\n// one-shot.\n// 3. Register committee — currently a typed no-op (distilled-doc\n// opportunity #3: drop the cargo-culted\n// placeholder). We omit it entirely in\n// v3 rewrite.\n// 4. Storage nodes — parallel boot of N storage-node containers.\n// 5. Exchange resolution — on-chain getObject + parse type.\n// Degrades to undefined on\n// OBJECT_NOT_FOUND.\n// 6. Proxy URL pick — nodes[0].rpcUrl is the representative\n// aggregator/publisher.\n// 7a. WAL faucet strategy register — opt-in when an exchange exists.\n// 8. Registries — package + endpoint + walrus-state.\n//\n// What this file owns: the dispatch shape + the typed options\n// surface + the synchronous factory-time validation.\n//\n// What this file delegates: container/Move heavy paths live in\n// `storage-nodes.ts`, `deploy.ts`, and the `ArtifactPublisher`\n// primitive.\n\nimport { Effect, FileSystem, Path, type Scope } from 'effect';\n\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n} from '../../../primitives/artifact-publisher.ts';\nimport type { ChainProbe } from '../../../contracts/chain-probe.ts';\nimport type { ContainerRuntime } from '../../../contracts/container-runtime.ts';\nimport type { SuiProbeKey } from '../../sui/index.ts';\nimport { contentHash as brandContentHash } from '../../../substrate/brand.ts';\nimport type { ChainId } from '../../../substrate/brand.ts';\nimport { expectPositiveInteger } from '../../../substrate/runtime/config-validation.ts';\nimport { setCurrentPluginPhase } from '../../../substrate/runtime/current-plugin.ts';\nimport { SpanAttr } from '../../../substrate/runtime/observability/spans.ts';\nimport { walrusConfigError, walrusPluginError, type WalrusError } from '../errors.ts';\nimport { WALRUS_MAX_NODE_COUNT } from '../routable.ts';\nimport { WalrusSpans } from '../spans.ts';\nimport type { WalrusStorageNode } from '../storage-nodes.ts';\nimport {\n\tDEFAULT_NODE_READY_TIMEOUT_MS,\n\tDEFAULT_CONTAINER_API_PORT,\n\tWALRUS_NODE_IP_BASE,\n\tcomputePublicHostname,\n\tstartStorageNodes,\n} from '../storage-nodes.ts';\nimport { deployWalrusContracts, type CachedDeployState } from '../deploy.ts';\nimport {\n\tDEFAULT_SUI_VERSION,\n\tDEFAULT_WALRUS_REF,\n\tresolveCargoImage,\n} from '../bootstrap-assets/cargo-image.ts';\nimport {\n\tmakeWalFaucetStrategy,\n\twalPackageIdFromCoinType,\n\tresolveWalCoinType,\n\ttype WalFaucetStrategy,\n} from '../faucet-strategy.ts';\nimport { resolveWalExchange, type WalExchangeHandle, type WalSwapSdk } from '../wal-swap.ts';\n\n/** Options for the local-cluster mode. Mirrors v3\n * `WalrusLocalClusterOptions<Name>` (06-walrus.md §\"Configuration\"). */\nexport interface WalrusLocalClusterOptions {\n\t/** Engine row name + on-disk dir suffix + registry key.\n\t * Default `'walrus'`. */\n\treadonly name?: string;\n\t/** Number of storage-node containers. Must be `>= 1` (synchronous\n\t * factory-time guard). Default `1`. */\n\treadonly nodeCount?: number;\n\t/** Total shards distributed across the committee. Must be\n\t * `>= nodeCount`. Default `100` (distilled-doc default block). */\n\treadonly shards?: number;\n\t/** Pinned walrus release — drives the wrapper image build.\n\t * Default `'testnet-v1.49.1'`. */\n\treadonly version?: string;\n\t/** Sui release whose binary the wrapper image bakes (distilled-\n\t * doc invariant 24). Default `'devnet-v1.71.0'`. */\n\treadonly suiVersion?: string;\n\t/** Port each storage node binds inside the container. Default\n\t * 9185 (same as the router entrypoint — invariant 9). */\n\treadonly containerApiPort?: number;\n\t/** Walrus epoch length passed to `walrus-deploy --epoch-duration`.\n\t * Default `'24h'`. */\n\treadonly epochDuration?: string;\n\t/** Per-node TCP ready-probe timeout (ms). Defaults to\n\t * `DEFAULT_NODE_READY_TIMEOUT_MS`. */\n\treadonly readyTimeoutMs?: number;\n}\n\n/** Resolved local-cluster boot artifacts. */\nexport interface LocalClusterBootResult {\n\treadonly mode: 'local';\n\treadonly deploy: CachedDeployState;\n\treadonly walrusPackageId: string;\n\treadonly walPackageId: string;\n\treadonly nodes: ReadonlyArray<WalrusStorageNode>;\n\treadonly aggregatorUrl: string;\n\treadonly publisherUrl: string;\n\treadonly proxyUrl: string;\n\treadonly exchangeObjectId: string | undefined;\n\treadonly exchange: WalExchangeHandle | null;\n\t/** WAL faucet strategy — present only when the local cluster has a\n\t * non-empty exchange object. The barrel registers this onto the\n\t * `coinType:<fullCoinType>` strategy contributor decl. `null`\n\t * otherwise. */\n\treadonly walFaucetStrategy: WalFaucetStrategy | null;\n\treadonly walCoinType: string;\n}\n\n/** Defaults applied to options. */\nexport interface ResolvedLocalClusterOptions {\n\treadonly name: string;\n\treadonly nodeCount: number;\n\treadonly shards: number;\n\treadonly version: string;\n\treadonly suiVersion: string;\n\treadonly containerApiPort: number;\n\treadonly epochDuration: string;\n\treadonly readyTimeoutMs: number;\n}\n\n/** Synchronous factory-time validation. Mirrors v3's\n * `local-cluster.ts:101-121` guards. Throws (NOT Effect-fail) so\n * misconfiguration trips at the `defineDevstack` call site rather\n * than at deferred Layer.build time. Distilled-doc invariant 11. */\nexport const resolveLocalClusterOptions = (\n\topts: WalrusLocalClusterOptions,\n): ResolvedLocalClusterOptions => {\n\tconst nodeCount = expectPositiveInteger(opts.nodeCount ?? 1, {\n\t\tfield: 'nodeCount',\n\t\tmkError: ({ field, message, hint }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusLocalCluster: nodeCount must be >= 1 (got ${String(opts.nodeCount ?? 1)})`,\n\t\t\t\thint ?? message,\n\t\t\t),\n\t\thint: 'set nodeCount to a positive integer (default 1)',\n\t});\n\tif (nodeCount > WALRUS_MAX_NODE_COUNT) {\n\t\tthrow walrusConfigError(\n\t\t\t'nodeCount',\n\t\t\t`walrusLocalCluster: nodeCount (${nodeCount}) exceeds the maximum ${WALRUS_MAX_NODE_COUNT} ` +\n\t\t\t\t`pre-declared Traefik entrypoints (walrus-node-0..${WALRUS_MAX_NODE_COUNT - 1}).`,\n\t\t\t`reduce nodeCount or raise WALRUS_MAX_NODE_COUNT in plugins/walrus/routable.ts`,\n\t\t);\n\t}\n\tconst shards = expectPositiveInteger(opts.shards ?? 100, {\n\t\tfield: 'shards',\n\t\tmkError: ({ field, message, hint }) =>\n\t\t\twalrusConfigError(\n\t\t\t\tfield,\n\t\t\t\t`walrusLocalCluster: shards must be a positive integer (got ${String(opts.shards ?? 100)})`,\n\t\t\t\thint ?? message,\n\t\t\t),\n\t\thint: 'set shards to a positive integer (default 100)',\n\t});\n\tif (shards < nodeCount) {\n\t\tthrow walrusConfigError(\n\t\t\t'shards',\n\t\t\t`walrusLocalCluster: shards (${shards}) must be >= nodeCount (${nodeCount})`,\n\t\t\t`set shards >= ${nodeCount} (default 100)`,\n\t\t);\n\t}\n\treturn {\n\t\tname: opts.name ?? 'walrus',\n\t\tnodeCount,\n\t\tshards,\n\t\tversion: opts.version ?? DEFAULT_WALRUS_REF,\n\t\tsuiVersion: opts.suiVersion ?? DEFAULT_SUI_VERSION,\n\t\tcontainerApiPort: opts.containerApiPort ?? DEFAULT_CONTAINER_API_PORT,\n\t\tepochDuration: opts.epochDuration ?? '24h',\n\t\treadyTimeoutMs: opts.readyTimeoutMs ?? DEFAULT_NODE_READY_TIMEOUT_MS,\n\t};\n};\n\n/** Dependencies the local service consumes at acquire-time. */\nexport interface LocalClusterDeps {\n\treadonly runtime: ContainerRuntime;\n\treadonly publisher: ArtifactPublisher;\n\treadonly probe: ChainProbe<SuiProbeKey>;\n\treadonly suiSdk: WalSwapSdk;\n\treadonly suiChainId: ChainId;\n\treadonly suiRpcUrlInNetwork: string;\n\treadonly walrusFaucetUrlInNetwork: string;\n\treadonly waitForFundsReady: Effect.Effect<void, unknown>;\n\treadonly app: string;\n\treadonly stack: string;\n\t/** Pre-allocated /24 prefix from `subnetForStack`. */\n\treadonly subnetPrefix: string;\n\treadonly walrusNetworkName: string;\n\treadonly suiNetworkName: string;\n\treadonly deployHostMountPath: string;\n\t/** On-disk per-stack root from `StackPathsService.stackRoot`. The\n\t * walrus bind-mount is computed off this; `deployHostMountPath`\n\t * MUST live under it. */\n\treadonly stackRoot: string;\n}\n\n/** Boot the local cluster. Returns the resolved value the plugin\n * projects onto its tags.\n *\n * Steps:\n * - Image build — `resolveCargoImage` (bootstrap asset).\n * Honors `WALRUS_CARGO_IMAGE_OVERRIDE` for the pre-baked path.\n * - Docker network ensure — `runtime.ensureNetwork(walrusNet)`.\n * The sui network is owned by the sui plugin; we attach to it\n * as a secondary network on each storage node.\n * - Deploy contracts — `deployWalrusContracts` dispatches through\n * the artifact publisher primitive; the produce body runs the walrus deploy\n * one-shot.\n * - Storage nodes — parallel boot via `startStorageNodes`.\n * - Proxy URL pick — `nodes[0].rpcUrl`.\n * - WAL faucet strategy — constructed if `state.exchangeObject`\n * exists. Surfaced on the boot result; the barrel registers\n * the contributor decl.\n *\n * Per-step failures surface as `WalrusPluginError` with the phase\n * vocabulary from `errors.ts`; artifact publisher failures pass through as\n * `ArtifactPublishError`. The plugin narration vocabulary anchors\n * on these phase tags.\n */\nexport const bootLocalCluster = (\n\tdeps: LocalClusterDeps,\n\topts: ResolvedLocalClusterOptions,\n): Effect.Effect<\n\tLocalClusterBootResult,\n\tWalrusError | ArtifactPublishError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> =>\n\tEffect.gen(function* () {\n\t\t// ---- cargo image (bootstrap asset) -----------------------\n\t\t// The cargo image is content-addressed; the resolver owns the\n\t\t// cache check + the registry-tag override fast path.\n\t\tyield* setCurrentPluginPhase(`resolving Walrus image ${opts.version}`);\n\t\tconst walrusImage = yield* resolveCargoImage(deps.runtime, {\n\t\t\twalrusRef: opts.version,\n\t\t\tsuiVersion: opts.suiVersion,\n\t\t\towner: { app: deps.app, stack: deps.stack },\n\t\t});\n\n\t\t// ---- docker network ensure ------------------------------\n\t\tyield* setCurrentPluginPhase(`ensuring Walrus network ${deps.walrusNetworkName}`);\n\t\tyield* deps.runtime\n\t\t\t.ensureNetwork({\n\t\t\t\tname: deps.walrusNetworkName,\n\t\t\t\tapp: deps.app,\n\t\t\t\tstack: deps.stack,\n\t\t\t})\n\t\t\t.pipe(\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\twalrusPluginError(\n\t\t\t\t\t\t\t'cluster-network',\n\t\t\t\t\t\t\t`walrus: ensureNetwork('${deps.walrusNetworkName}') failed: ${cause.reason}: ${cause.detail}`,\n\t\t\t\t\t\t\t{ cause },\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t// ---- deploy via ArtifactPublisher ----------------\n\t\t// The deploy one-shot needs the walrus image + sui network so it\n\t\t// can dial the per-stack sui RPC + faucet over docker DNS.\n\t\t//\n\t\t// Per-node IP CSV is derived from the subnet prefix; per-node\n\t\t// hostnames likewise. Both must be in lockstep with the\n\t\t// storage-node boot below — the deploy step writes per-node\n\t\t// committee records on chain using these.\n\t\tconst publicHosts = Array.from({ length: opts.nodeCount }, (_, i) =>\n\t\t\tcomputePublicHostname(deps.app, deps.stack, i),\n\t\t).join(',');\n\t\tconst listeningIps = Array.from(\n\t\t\t{ length: opts.nodeCount },\n\t\t\t(_, i) => `${deps.subnetPrefix}.${WALRUS_NODE_IP_BASE + i}`,\n\t\t).join(',');\n\n\t\tyield* setCurrentPluginPhase(\n\t\t\t`deploying Walrus contracts (${opts.nodeCount} node${opts.nodeCount === 1 ? '' : 's'}, ${opts.shards} shards)`,\n\t\t);\n\t\tconst { state } = yield* deployWalrusContracts(deps.publisher, deps.probe, deps.runtime, {\n\t\t\twalrusName: opts.name,\n\t\t\tchainId: deps.suiChainId,\n\t\t\tcontentHash: brandContentHash(\n\t\t\t\t`walrus|${opts.version}|${opts.suiVersion}|${opts.nodeCount}|${opts.shards}|${opts.epochDuration}`,\n\t\t\t),\n\t\t\toutputDirHostPath: deps.deployHostMountPath,\n\t\t\tstackRoot: deps.stackRoot,\n\t\t\tsuiRpcUrlInNetwork: deps.suiRpcUrlInNetwork,\n\t\t\twalrusFaucetUrlInNetwork: deps.walrusFaucetUrlInNetwork,\n\t\t\twaitForFundsReady: deps.waitForFundsReady,\n\t\t\tcommitteeSize: opts.nodeCount,\n\t\t\tshards: opts.shards,\n\t\t\tepochDuration: opts.epochDuration,\n\t\t\tpublicHostsCsv: publicHosts,\n\t\t\tlisteningIpsCsv: listeningIps,\n\t\t\twalrusImage,\n\t\t\tsuiNetworkName: deps.suiNetworkName,\n\t\t});\n\t\tconst deployConfigHash = [\n\t\t\t'walrus-deploy',\n\t\t\tstate.walrusPackageId,\n\t\t\tstate.systemObject,\n\t\t\tstate.stakingObject,\n\t\t\tstate.exchangeObject ?? 'no-exchange',\n\t\t].join('|');\n\n\t\t// Per-node image tags. Each storage node runs under its OWN tag (a cheap\n\t\t// re-tag of the one content-cached cargo build) so its committed writable\n\t\t// layer — the RocksDB holding that node's slivers — promotes to a DISTINCT\n\t\t// image on snapshot restore. A single shared tag would make the restore\n\t\t// image-promote collapse all N committed layers onto one tag\n\t\t// (last-write-wins): N-1 nodes boot on the wrong layer and every\n\t\t// pre-snapshot blob is orphaned. The tag is scoped by the deployed\n\t\t// `walrusPackageId` — stable across boot1 -> restore -> boot2 (the deploy\n\t\t// cache reuses the same id, so the restore's promote target matches what\n\t\t// boot2 requests), but DISTINCT per fresh deployment, so a later cold boot\n\t\t// on a new chain never inherits a prior run's committed node layers (which\n\t\t// carry a stale committee and would reject writes). The base `walrusImage`\n\t\t// (shared) still backs the transient deploy one-shot (`--rm`, unsnapshotted).\n\t\tconst nodeImageScope = state.walrusPackageId.replace(/^0x/, '').slice(0, 12);\n\t\tconst nodeImages = yield* Effect.forEach(\n\t\t\tArray.from({ length: opts.nodeCount }, (_, i) => i),\n\t\t\t(i) =>\n\t\t\t\tresolveCargoImage(\n\t\t\t\t\tdeps.runtime,\n\t\t\t\t\t{\n\t\t\t\t\t\twalrusRef: opts.version,\n\t\t\t\t\t\tsuiVersion: opts.suiVersion,\n\t\t\t\t\t\towner: { app: deps.app, stack: deps.stack },\n\t\t\t\t\t},\n\t\t\t\t\t`${walrusImage.tag}-${nodeImageScope}-node-${i}`,\n\t\t\t\t),\n\t\t);\n\n\t\t// ---- storage nodes — parallel boot ----------------------\n\t\tyield* setCurrentPluginPhase(\n\t\t\t`starting ${opts.nodeCount} Walrus storage node${opts.nodeCount === 1 ? '' : 's'}`,\n\t\t);\n\t\tconst { nodes } = yield* startStorageNodes(deps.runtime, {\n\t\t\tapp: deps.app,\n\t\t\tstack: deps.stack,\n\t\t\twalrusName: opts.name,\n\t\t\timages: nodeImages,\n\t\t\tnodeCount: opts.nodeCount,\n\t\t\tsubnetPrefix: deps.subnetPrefix,\n\t\t\tcontainerApiPort: opts.containerApiPort,\n\t\t\twalrusNetworkName: deps.walrusNetworkName,\n\t\t\tsuiNetworkName: deps.suiNetworkName,\n\t\t\tdeployHostMountPath: deps.deployHostMountPath,\n\t\t\tstackRoot: deps.stackRoot,\n\t\t\tdeployConfigHash,\n\t\t\treadyTimeoutMs: opts.readyTimeoutMs,\n\t\t});\n\n\t\t// ---- proxy URL pick — nodes[0].rpcUrl -------------------\n\t\t// `nodeCount >= 1` is enforced synchronously already; this is\n\t\t// defense-in-depth.\n\t\tif (nodes.length === 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\twalrusPluginError('proxy', 'walrus: at least one storage node is required'),\n\t\t\t);\n\t\t}\n\t\tconst proxyUrl = nodes[0]!.rpcUrl;\n\n\t\t// ---- exchange resolution + WAL funding strategy ------\n\t\t// Register a `coinType:<fullCoinType>` strategy that swaps the\n\t\t// requesting account's SUI into WAL on demand. Accounts opt in via\n\t\t// their normal `funding` list.\n\t\tyield* setCurrentPluginPhase('resolving WAL exchange');\n\t\tconst exchange = yield* resolveWalExchange(deps.probe, state.exchangeObject);\n\t\tconst walFaucetStrategy: WalFaucetStrategy | null = exchange\n\t\t\t? makeWalFaucetStrategy({\n\t\t\t\t\texchange,\n\t\t\t\t\tsdk: deps.suiSdk,\n\t\t\t\t})\n\t\t\t: null;\n\t\tconst resolvedWalCoinType = yield* resolveWalCoinType({\n\t\t\tprobe: deps.probe,\n\t\t\ttreasuryObjectId: state.treasuryObject,\n\t\t\tdeployPackageId: state.walrusPackageId,\n\t\t\trequireTreasuryObject: exchange !== null,\n\t\t});\n\t\tconst resolvedWalPackageId = walPackageIdFromCoinType(resolvedWalCoinType);\n\n\t\treturn {\n\t\t\tmode: 'local' as const,\n\t\t\tdeploy: state,\n\t\t\twalrusPackageId: state.walrusPackageId,\n\t\t\twalPackageId: resolvedWalPackageId,\n\t\t\tnodes,\n\t\t\taggregatorUrl: proxyUrl,\n\t\t\tpublisherUrl: proxyUrl,\n\t\t\tproxyUrl,\n\t\t\texchangeObjectId: state.exchangeObject,\n\t\t\texchange,\n\t\t\twalFaucetStrategy,\n\t\t\twalCoinType: resolvedWalCoinType,\n\t\t};\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.walrus.localCluster.boot', {\n\t\t\tattributes: {\n\t\t\t\t[SpanAttr.plugin]: 'walrus',\n\t\t\t\t[WalrusSpans.name]: opts.name,\n\t\t\t\t[WalrusSpans.nodeCount]: opts.nodeCount,\n\t\t\t\t[WalrusSpans.shards]: opts.shards,\n\t\t\t},\n\t\t}),\n\t);\n"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"registry-publish.mjs","names":[],"sources":["../../../src/plugins/walrus/registry-publish.ts"],"sourcesContent":["// Walrus registry publish — mode-based registry contribution shapes.\n//\n// This file is the runtime publishing layer for the downstream registries:\n//\n// - WalrusStateRegistry — `{name, systemObjectId}` entry. Local\n// uses `opts.name`; known uses the fixed\n// `'walrusKnownDeployment'`.\n// - EndpointRegistry — local publishes `walrus-aggregator` +\n// `walrus-publisher` + N × `walrus-node-<i>`.\n// Known publishes nothing (the URLs ride\n// on the WalrusResolved value).\n// - PackageRegistry — local only: `walrus.<name>` entry.\n//\n// Following the package plugin's pattern, contributions land via\n// `StrategyContributor` capability keys; the orchestrator dispatches\n// by key. This file declares the *contribution shapes*; the actual\n// `Register` closures live with the local-cluster acquire path where the resolved\n// values are bound.\n\n/** Capability-key constant for the per-stack Walrus state registry. */\nexport const WALRUS_STATE_REGISTRY_KEY = 'walrus-state-registry' as const;\n\n/** Capability-key constant for the per-stack endpoint registry —\n * shared across plugins (matches faucet/coin/etc.). */\nexport const ENDPOINT_REGISTRY_KEY = 'endpoint-registry' as const;\n\n/** Capability-key constant for the per-stack package registry —\n * mirrors `plugins/package/registry.ts`'s\n * `PACKAGE_REGISTRY_CAPABILITY_KEY` but typed independently here so\n * Walrus doesn't take a direct dep on the package plugin's internals.\n * Same string value — substrate dispatches by string equality. */\nexport const PACKAGE_REGISTRY_KEY = 'package-registry' as const;\n\n/** Local-cluster's state registry entry. The `name` field is the\n * factory's `name` option (default: `'walrus'`); two walrus\n * instances in one stack publish under disjoint names. */\nexport interface WalrusLocalStateEntry {\n\treadonly name: string;\n\treadonly systemObjectId: string;\n\treadonly stakingObjectId: string;\n\treadonly walrusPackageId: string;\n\treadonly exchangeObjectId?: string;\n}\n\n/** Known-deployment's state registry entry. The `name` is always\n * `'walrusKnownDeployment'` (distilled-doc invariant: this factory\n * does not vary by user-supplied name). */\nexport interface WalrusKnownStateEntry {\n\treadonly name: 'walrusKnownDeployment';\n\treadonly systemObjectId: string;\n\treadonly stakingObjectId: string;\n\treadonly chain: string;\n}\n\nexport type WalrusStateEntry = WalrusLocalStateEntry | WalrusKnownStateEntry;\n\n/** Endpoint contribution shape — what the local-cluster publishes\n * to the endpoint registry. Mirrors the v3 surface:\n * `walrus-aggregator` + `walrus-publisher` (1 each) +\n * `walrus-node-<i>` (N). */\nexport interface WalrusEndpointEntry {\n\treadonly name: string;\n\treadonly url: string;\n\treadonly kind: 'http' | 'walrus-node';\n}\n\n/** Package contribution — local-cluster publishes one entry under\n * `walrus.<name>` with `mvrPlaceholder: '@local/walrus'`.\n * (Distilled-doc §\"Registry writes\" + Invariant 6: registers fire\n * on EVERY cycle.) */\nexport interface WalrusPackageEntry {\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly mvrPlaceholder: string;\n\treadonly captured: Readonly<{\n\t\treadonly systemObject: string;\n\t\treadonly stakingObject: string;\n\t\treadonly exchangeObject?: string;\n\t}>;\n}\n"],"mappings":";;AAoBA,MAAa,4BAA4B"}
1
+ {"version":3,"file":"registry-publish.mjs","names":[],"sources":["../../../src/plugins/walrus/registry-publish.ts"],"sourcesContent":["// Walrus registry publish — mode-based registry contribution shapes.\n//\n// This file is the runtime publishing layer for the downstream registries:\n//\n// - WalrusStateRegistry — `{name, systemObjectId}` entry. Local\n// uses `opts.name`; known uses the fixed\n// `'walrusKnownDeployment'`.\n// - EndpointRegistry — local publishes `walrus-aggregator` +\n// `walrus-publisher` + N × `walrus-node-<i>`.\n// Known publishes nothing (the URLs ride\n// on the WalrusResolved value).\n// - PackageRegistry — local only: `walrus.<name>` entry.\n//\n// Following the package plugin's pattern, contributions land via\n// `StrategyContributor` capability keys; the orchestrator dispatches\n// by key. This file declares the *contribution shapes*; the actual\n// `Register` closures live with the local-cluster acquire path where the resolved\n// values are bound.\n\n/** Capability-key constant for the per-stack Walrus state registry. */\nexport const WALRUS_STATE_REGISTRY_KEY = 'walrus-state-registry' as const;\n\n/** Capability-key constant for the per-stack endpoint registry —\n * shared across plugins (matches faucet/coin/etc.). */\nexport const ENDPOINT_REGISTRY_KEY = 'endpoint-registry' as const;\n\n/** Capability-key constant for the per-stack package registry —\n * mirrors `plugins/package/registry.ts`'s\n * `PACKAGE_REGISTRY_CAPABILITY_KEY` but typed independently here so\n * Walrus doesn't take a direct dep on the package plugin's internals.\n * Same string value — substrate dispatches by string equality. */\nexport const PACKAGE_REGISTRY_KEY = 'package-registry' as const;\n\n/** Local-cluster's state registry entry. The `name` field is the\n * factory's `name` option (default: `'walrus'`); two walrus\n * instances in one stack publish under disjoint names. */\nexport interface WalrusLocalStateEntry {\n\treadonly name: string;\n\treadonly systemObjectId: string;\n\treadonly stakingObjectId: string;\n\treadonly walrusPackageId: string;\n\treadonly exchangeObjectId?: string;\n}\n\n/** Known-deployment's state registry entry. The `name` is always\n * `'walrusKnownDeployment'` (distilled-doc invariant: this factory\n * does not vary by user-supplied name). */\nexport interface WalrusKnownStateEntry {\n\treadonly name: 'walrusKnownDeployment';\n\treadonly systemObjectId: string;\n\treadonly stakingObjectId: string;\n\treadonly chain: string;\n}\n\nexport type WalrusStateEntry = WalrusLocalStateEntry | WalrusKnownStateEntry;\n"],"mappings":";;AAoBA,MAAa,4BAA4B"}
@@ -1,38 +1,22 @@
1
- import "./storage-nodes.mjs";
1
+ import { WALRUS_ROUTER_PORT } from "./storage-nodes.mjs";
2
2
  //#region src/plugins/walrus/routable.ts
3
- const WALRUS_ENTRYPOINT_PORT = 9185;
4
3
  const WALRUS_NODE_ENDPOINT_PREFIX = "walrus-node-";
5
4
  const WALRUS_AGGREGATOR_ENDPOINT_NAME = "walrus-aggregator";
6
5
  const WALRUS_PUBLISHER_ENDPOINT_NAME = "walrus-publisher";
7
6
  const WALRUS_ENTRYPOINTS = [
8
- {
9
- name: "walrus-node-0",
10
- port: WALRUS_ENTRYPOINT_PORT,
11
- protocol: "http"
12
- },
13
- {
14
- name: "walrus-node-1",
15
- port: WALRUS_ENTRYPOINT_PORT,
7
+ ...Array.from({ length: 8 }, (_, i) => ({
8
+ name: `${WALRUS_NODE_ENDPOINT_PREFIX}${i}`,
9
+ port: WALRUS_ROUTER_PORT,
16
10
  protocol: "http"
17
- },
18
- {
19
- name: "walrus-node-2",
20
- port: WALRUS_ENTRYPOINT_PORT,
21
- protocol: "http"
22
- },
23
- {
24
- name: "walrus-node-3",
25
- port: WALRUS_ENTRYPOINT_PORT,
26
- protocol: "http"
27
- },
11
+ })),
28
12
  {
29
13
  name: WALRUS_AGGREGATOR_ENDPOINT_NAME,
30
- port: WALRUS_ENTRYPOINT_PORT,
14
+ port: WALRUS_ROUTER_PORT,
31
15
  protocol: "http"
32
16
  },
33
17
  {
34
18
  name: WALRUS_PUBLISHER_ENDPOINT_NAME,
35
- port: WALRUS_ENTRYPOINT_PORT,
19
+ port: WALRUS_ROUTER_PORT,
36
20
  protocol: "http"
37
21
  }
38
22
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"routable.mjs","names":[],"sources":["../../../src/plugins/walrus/routable.ts"],"sourcesContent":["// Walrus plugin — Routable contributions.\n//\n// Distilled-doc reference (06-walrus.md §\"Routes registered\"):\n// each storage node carries one Traefik route. The router binds host\n// port 9185 once globally and dispatches by `Host:` header to the\n// per-stack backend — `routerHostname(identity, 'walrus-node-<i>')`.\n//\n// For the local cluster:\n// - N × `walrus-node-<i>` routes — one per storage node, with\n// `cors: true` (walrus storage REST API lacks CORS headers).\n// - 1 × `walrus-aggregator` alias — same backend as `walrus-node-0`,\n// surfaces the conventional alias for SDK consumers.\n// - 1 × `walrus-publisher` alias — collapsed onto the same backend\n// (distilled-doc §\"Endpoints\" — \"collapsed onto a single Traefik\n// vhost\").\n//\n// Known-deployment publishes no routes — the aggregator/publisher\n// URLs land on the codegen-emitted `WalrusBindings.{aggregator,\n// publisher}Url` instead.\n\nimport type { EntrypointDecl, RoutableDecl } from '../../contracts/routable.ts';\nimport { WALRUS_ROUTER_PORT } from './storage-nodes.ts';\n\nexport const WALRUS_ENTRYPOINT_PORT = 9185;\nexport const WALRUS_NODE_ENDPOINT_PREFIX = 'walrus-node-' as const;\nexport const WALRUS_AGGREGATOR_ENDPOINT_NAME = 'walrus-aggregator' as const;\nexport const WALRUS_PUBLISHER_ENDPOINT_NAME = 'walrus-publisher' as const;\n\nexport const WALRUS_ENTRYPOINTS: ReadonlyArray<EntrypointDecl> = [\n\t{ name: 'walrus-node-0', port: WALRUS_ENTRYPOINT_PORT, protocol: 'http' },\n\t{ name: 'walrus-node-1', port: WALRUS_ENTRYPOINT_PORT, protocol: 'http' },\n\t{ name: 'walrus-node-2', port: WALRUS_ENTRYPOINT_PORT, protocol: 'http' },\n\t{ name: 'walrus-node-3', port: WALRUS_ENTRYPOINT_PORT, protocol: 'http' },\n\t{ name: WALRUS_AGGREGATOR_ENDPOINT_NAME, port: WALRUS_ENTRYPOINT_PORT, protocol: 'http' },\n\t{ name: WALRUS_PUBLISHER_ENDPOINT_NAME, port: WALRUS_ENTRYPOINT_PORT, protocol: 'http' },\n];\n\n/** Build the Routable contributions for the local cluster. `nodeCount`\n * drives the per-node fan-out; the plugin's service key + route role\n * identify the dispatch target. */\nexport const makeLocalRoutables = (args: {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly walrusName: string;\n\treadonly serviceKey: string;\n\treadonly nodeCount: number;\n\treadonly containerApiPort?: number;\n}): ReadonlyArray<RoutableDecl> => {\n\tconst containerPort = args.containerApiPort ?? WALRUS_ROUTER_PORT;\n\tconst containerNameFor = (i: number): string =>\n\t\t`devstack-${args.app}-${args.stack}-walrus-${args.walrusName}-node-${i}`;\n\tconst perNodeRoutes: ReadonlyArray<RoutableDecl> = Array.from(\n\t\t{ length: args.nodeCount },\n\t\t(_, i): RoutableDecl => ({\n\t\t\tkind: 'routable',\n\t\t\tendpointName: `${WALRUS_NODE_ENDPOINT_PREFIX}${i}`,\n\t\t\tdispatchId: {\n\t\t\t\tserviceKey: args.serviceKey,\n\t\t\t\trole: `${WALRUS_NODE_ENDPOINT_PREFIX}${i}`,\n\t\t\t},\n\t\t\tupstream: {\n\t\t\t\ttype: 'container',\n\t\t\t\tcontainerName: containerNameFor(i),\n\t\t\t\tcontainerPort,\n\t\t\t},\n\t\t\t// Distilled-doc §\"Routes registered\": cors: true (walrus\n\t\t\t// storage REST API lacks CORS headers).\n\t\t\tcors: true,\n\t\t\twireProtocol: 'http',\n\t\t}),\n\t);\n\n\t// Aggregator + publisher aliases — collapsed onto node-0 per the\n\t// distilled doc. The aggregator and publisher are conventional\n\t// endpoint names that downstream HTTP consumers look up via the\n\t// substrate's endpoint registry.\n\tconst aggregator: RoutableDecl = {\n\t\tkind: 'routable',\n\t\tendpointName: WALRUS_AGGREGATOR_ENDPOINT_NAME,\n\t\tdispatchId: {\n\t\t\tserviceKey: args.serviceKey,\n\t\t\trole: WALRUS_AGGREGATOR_ENDPOINT_NAME,\n\t\t},\n\t\tupstream: { type: 'container', containerName: containerNameFor(0), containerPort },\n\t\tcors: true,\n\t\twireProtocol: 'http',\n\t};\n\tconst publisher: RoutableDecl = {\n\t\tkind: 'routable',\n\t\tendpointName: WALRUS_PUBLISHER_ENDPOINT_NAME,\n\t\tdispatchId: {\n\t\t\tserviceKey: args.serviceKey,\n\t\t\trole: WALRUS_PUBLISHER_ENDPOINT_NAME,\n\t\t},\n\t\tupstream: { type: 'container', containerName: containerNameFor(0), containerPort },\n\t\tcors: true,\n\t\twireProtocol: 'http',\n\t};\n\n\treturn [...perNodeRoutes, aggregator, publisher];\n};\n"],"mappings":";;AAuBA,MAAa,yBAAyB;AACtC,MAAa,8BAA8B;AAC3C,MAAa,kCAAkC;AAC/C,MAAa,iCAAiC;AAE9C,MAAa,qBAAoD;CAChE;EAAE,MAAM;EAAiB,MAAM;EAAwB,UAAU;EAAQ;CACzE;EAAE,MAAM;EAAiB,MAAM;EAAwB,UAAU;EAAQ;CACzE;EAAE,MAAM;EAAiB,MAAM;EAAwB,UAAU;EAAQ;CACzE;EAAE,MAAM;EAAiB,MAAM;EAAwB,UAAU;EAAQ;CACzE;EAAE,MAAM;EAAiC,MAAM;EAAwB,UAAU;EAAQ;CACzF;EAAE,MAAM;EAAgC,MAAM;EAAwB,UAAU;EAAQ;CACxF;;;;AAKD,MAAa,sBAAsB,SAOA;CAClC,MAAM,gBAAgB,KAAK,oBAAA;CAC3B,MAAM,oBAAoB,MACzB,YAAY,KAAK,IAAI,GAAG,KAAK,MAAM,UAAU,KAAK,WAAW,QAAQ;CACtE,MAAM,gBAA6C,MAAM,KACxD,EAAE,QAAQ,KAAK,WAAW,GACzB,GAAG,OAAqB;EACxB,MAAM;EACN,cAAc,GAAG,8BAA8B;EAC/C,YAAY;GACX,YAAY,KAAK;GACjB,MAAM,GAAG,8BAA8B;GACvC;EACD,UAAU;GACT,MAAM;GACN,eAAe,iBAAiB,EAAE;GAClC;GACA;EAGD,MAAM;EACN,cAAc;EACd,EACD;CAMD,MAAM,aAA2B;EAChC,MAAM;EACN,cAAc;EACd,YAAY;GACX,YAAY,KAAK;GACjB,MAAM;GACN;EACD,UAAU;GAAE,MAAM;GAAa,eAAe,iBAAiB,EAAE;GAAE;GAAe;EAClF,MAAM;EACN,cAAc;EACd;CACD,MAAM,YAA0B;EAC/B,MAAM;EACN,cAAc;EACd,YAAY;GACX,YAAY,KAAK;GACjB,MAAM;GACN;EACD,UAAU;GAAE,MAAM;GAAa,eAAe,iBAAiB,EAAE;GAAE;GAAe;EAClF,MAAM;EACN,cAAc;EACd;AAED,QAAO;EAAC,GAAG;EAAe;EAAY;EAAU"}
1
+ {"version":3,"file":"routable.mjs","names":[],"sources":["../../../src/plugins/walrus/routable.ts"],"sourcesContent":["// Walrus plugin — Routable contributions.\n//\n// Distilled-doc reference (06-walrus.md §\"Routes registered\"):\n// each storage node carries one Traefik route. The router binds host\n// port 9185 once globally and dispatches by `Host:` header to the\n// per-stack backend — `routerHostname(identity, 'walrus-node-<i>')`.\n//\n// For the local cluster:\n// - N × `walrus-node-<i>` routes — one per storage node, with\n// `cors: true` (walrus storage REST API lacks CORS headers).\n// - 1 × `walrus-aggregator` alias — same backend as `walrus-node-0`,\n// surfaces the conventional alias for SDK consumers.\n// - 1 × `walrus-publisher` alias — collapsed onto the same backend\n// (distilled-doc §\"Endpoints\" — \"collapsed onto a single Traefik\n// vhost\").\n//\n// Known-deployment publishes no routes — the aggregator/publisher\n// URLs land on the codegen-emitted `WalrusBindings.{aggregator,\n// publisher}Url` instead.\n\nimport type { EntrypointDecl, RoutableDecl } from '../../contracts/routable.ts';\nimport { WALRUS_ROUTER_PORT } from './storage-nodes.ts';\n\nexport const WALRUS_NODE_ENDPOINT_PREFIX = 'walrus-node-' as const;\nexport const WALRUS_AGGREGATOR_ENDPOINT_NAME = 'walrus-aggregator' as const;\nexport const WALRUS_PUBLISHER_ENDPOINT_NAME = 'walrus-publisher' as const;\n\n/** Upper bound on `nodeCount` Traefik entrypoints are bound at boot,\n * so the cluster's per-node routes need pre-declared entrypoint names.\n * Validated at factory time in `mode/local-cluster.ts:resolveOptions`. */\nexport const WALRUS_MAX_NODE_COUNT = 8;\n\nexport const WALRUS_ENTRYPOINTS: ReadonlyArray<EntrypointDecl> = [\n\t...Array.from(\n\t\t{ length: WALRUS_MAX_NODE_COUNT },\n\t\t(_, i): EntrypointDecl => ({\n\t\t\tname: `${WALRUS_NODE_ENDPOINT_PREFIX}${i}`,\n\t\t\tport: WALRUS_ROUTER_PORT,\n\t\t\tprotocol: 'http',\n\t\t}),\n\t),\n\t{ name: WALRUS_AGGREGATOR_ENDPOINT_NAME, port: WALRUS_ROUTER_PORT, protocol: 'http' },\n\t{ name: WALRUS_PUBLISHER_ENDPOINT_NAME, port: WALRUS_ROUTER_PORT, protocol: 'http' },\n];\n\n/** Build the Routable contributions for the local cluster. `nodeCount`\n * drives the per-node fan-out; the plugin's service key + route role\n * identify the dispatch target. */\nexport const makeLocalRoutables = (args: {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly walrusName: string;\n\treadonly serviceKey: string;\n\treadonly nodeCount: number;\n\treadonly containerApiPort?: number;\n}): ReadonlyArray<RoutableDecl> => {\n\tconst containerPort = args.containerApiPort ?? WALRUS_ROUTER_PORT;\n\tconst containerNameFor = (i: number): string =>\n\t\t`devstack-${args.app}-${args.stack}-walrus-${args.walrusName}-node-${i}`;\n\tconst perNodeRoutes: ReadonlyArray<RoutableDecl> = Array.from(\n\t\t{ length: args.nodeCount },\n\t\t(_, i): RoutableDecl => ({\n\t\t\tkind: 'routable',\n\t\t\tendpointName: `${WALRUS_NODE_ENDPOINT_PREFIX}${i}`,\n\t\t\tdispatchId: {\n\t\t\t\tserviceKey: args.serviceKey,\n\t\t\t\trole: `${WALRUS_NODE_ENDPOINT_PREFIX}${i}`,\n\t\t\t},\n\t\t\tupstream: {\n\t\t\t\ttype: 'container',\n\t\t\t\tcontainerName: containerNameFor(i),\n\t\t\t\tcontainerPort,\n\t\t\t},\n\t\t\t// Distilled-doc §\"Routes registered\": cors: true (walrus\n\t\t\t// storage REST API lacks CORS headers).\n\t\t\tcors: true,\n\t\t\twireProtocol: 'http',\n\t\t}),\n\t);\n\n\t// Aggregator + publisher aliases — collapsed onto node-0 per the\n\t// distilled doc. The aggregator and publisher are conventional\n\t// endpoint names that downstream HTTP consumers look up via the\n\t// substrate's endpoint registry.\n\tconst aggregator: RoutableDecl = {\n\t\tkind: 'routable',\n\t\tendpointName: WALRUS_AGGREGATOR_ENDPOINT_NAME,\n\t\tdispatchId: {\n\t\t\tserviceKey: args.serviceKey,\n\t\t\trole: WALRUS_AGGREGATOR_ENDPOINT_NAME,\n\t\t},\n\t\tupstream: { type: 'container', containerName: containerNameFor(0), containerPort },\n\t\tcors: true,\n\t\twireProtocol: 'http',\n\t};\n\tconst publisher: RoutableDecl = {\n\t\tkind: 'routable',\n\t\tendpointName: WALRUS_PUBLISHER_ENDPOINT_NAME,\n\t\tdispatchId: {\n\t\t\tserviceKey: args.serviceKey,\n\t\t\trole: WALRUS_PUBLISHER_ENDPOINT_NAME,\n\t\t},\n\t\tupstream: { type: 'container', containerName: containerNameFor(0), containerPort },\n\t\tcors: true,\n\t\twireProtocol: 'http',\n\t};\n\n\treturn [...perNodeRoutes, aggregator, publisher];\n};\n"],"mappings":";;AAuBA,MAAa,8BAA8B;AAC3C,MAAa,kCAAkC;AAC/C,MAAa,iCAAiC;AAO9C,MAAa,qBAAoD;CAChE,GAAG,MAAM,KACR,EAAE,QAAA,GAA+B,GAChC,GAAG,OAAuB;EAC1B,MAAM,GAAG,8BAA8B;EACvC,MAAM;EACN,UAAU;EACV,EACD;CACD;EAAE,MAAM;EAAiC,MAAM;EAAoB,UAAU;EAAQ;CACrF;EAAE,MAAM;EAAgC,MAAM;EAAoB,UAAU;EAAQ;CACpF;;;;AAKD,MAAa,sBAAsB,SAOA;CAClC,MAAM,gBAAgB,KAAK,oBAAA;CAC3B,MAAM,oBAAoB,MACzB,YAAY,KAAK,IAAI,GAAG,KAAK,MAAM,UAAU,KAAK,WAAW,QAAQ;CACtE,MAAM,gBAA6C,MAAM,KACxD,EAAE,QAAQ,KAAK,WAAW,GACzB,GAAG,OAAqB;EACxB,MAAM;EACN,cAAc,GAAG,8BAA8B;EAC/C,YAAY;GACX,YAAY,KAAK;GACjB,MAAM,GAAG,8BAA8B;GACvC;EACD,UAAU;GACT,MAAM;GACN,eAAe,iBAAiB,EAAE;GAClC;GACA;EAGD,MAAM;EACN,cAAc;EACd,EACD;CAMD,MAAM,aAA2B;EAChC,MAAM;EACN,cAAc;EACd,YAAY;GACX,YAAY,KAAK;GACjB,MAAM;GACN;EACD,UAAU;GAAE,MAAM;GAAa,eAAe,iBAAiB,EAAE;GAAE;GAAe;EAClF,MAAM;EACN,cAAc;EACd;CACD,MAAM,YAA0B;EAC/B,MAAM;EACN,cAAc;EACd,YAAY;GACX,YAAY,KAAK;GACjB,MAAM;GACN;EACD,UAAU;GAAE,MAAM;GAAa,eAAe,iBAAiB,EAAE;GAAE;GAAe;EAClF,MAAM;EACN,cAAc;EACd;AAED,QAAO;EAAC,GAAG;EAAe;EAAY;EAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/walrus/service.ts"],"sourcesContent":["// Walrus plugin — main acquire body. Mode dispatch.\n//\n// Distilled-doc reference (06-walrus.md §\"Modes & variants\" — four\n// distinct operating modes):\n//\n// - local — `walrusLocalCluster(...)`\n// - live (testnet/mainnet) — `walrusKnownDeployment(...)`\n// - fork-known (`*-fork`) — known-deployment wrapper for the\n// wrapped upstream\n// - fork-localcluster-refused — synchronous refusal at factory\n// time\n//\n// Architecture: Walrus is ONE plugin with internal mode dispatch.\n// The factory at the barrel (`index.ts`) constructs the discriminator\n// from typed options; this file dispatches on the discriminator and\n// assembles mode-appropriate\n// subsystems.\n//\n// What this file does:\n//\n// 1. Receive a resolved mode discriminator.\n// 2. Dispatch to the right `boot*` builder.\n// 3. Return the mode's boot artifacts (the barrel projects them\n// onto the plugin's resolved value).\n//\n// What it does NOT do:\n//\n// - Provision the container runtime — that arrives via the\n// `BuildContext` passed by the barrel.\n// - Resolve bootstrap assets — local-cluster mode owns those\n// resolvers; this file just dispatches.\n\nimport { Effect, FileSystem, Path, type Scope } from 'effect';\n\nimport type { ArtifactPublishError } from '../../primitives/artifact-publisher.ts';\nimport type { WalrusError } from './errors.ts';\nimport {\n\tbootKnownDeployment,\n\ttype KnownDeploymentBootResult,\n\ttype WalrusKnownDeploymentOptions,\n} from './mode/known-deploy.ts';\nimport {\n\tbootLocalCluster,\n\ttype LocalClusterBootResult,\n\ttype LocalClusterDeps,\n\ttype ResolvedLocalClusterOptions,\n} from './mode/local-cluster.ts';\nimport { refuseLocalClusterOnFork } from './mode/fork-refusal.ts';\n\n/** Mode discriminator. Internal — the barrel constructs ONE of these\n * per composed walrus instance and dispatches here. */\nexport type WalrusMode =\n\t| { readonly mode: 'local'; readonly opts: ResolvedLocalClusterOptions }\n\t| { readonly mode: 'known'; readonly opts: WalrusKnownDeploymentOptions };\n\n/** Result of one acquire — discriminated by mode so the barrel can\n * project mode-asymmetrically onto the tag set. */\nexport type WalrusBootResult = LocalClusterBootResult | KnownDeploymentBootResult;\n\n/** Dispatch on the mode and return the boot artifacts.\n *\n * `deps` is the local-cluster's full dependency bundle. The known\n * branch ignores all of it (no I/O at acquire time — purely\n * synchronous projection from options); the type lets the barrel\n * pass one record for both paths. */\nexport const bootWalrusService = (\n\tdeps: LocalClusterDeps,\n\tmode: WalrusMode,\n): Effect.Effect<\n\tWalrusBootResult,\n\tWalrusError | ArtifactPublishError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> => {\n\tswitch (mode.mode) {\n\t\tcase 'local':\n\t\t\treturn bootLocalCluster(deps, mode.opts);\n\t\tcase 'known':\n\t\t\treturn bootKnownDeployment(mode.opts);\n\t}\n};\n\n// Re-export so callers (the barrel's `walrus()` factory's fork\n// branch) can invoke the refusal directly without an extra import.\nexport { refuseLocalClusterOnFork };\n"],"mappings":";;;;;;;;;;AAiEA,MAAa,qBACZ,MACA,SAKI;AACJ,SAAQ,KAAK,MAAb;EACC,KAAK,QACJ,QAAO,iBAAiB,MAAM,KAAK,KAAK;EACzC,KAAK,QACJ,QAAO,oBAAoB,KAAK,KAAK"}
1
+ {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/walrus/service.ts"],"sourcesContent":["// Walrus plugin — main acquire body. Mode dispatch.\n//\n// Distilled-doc reference (06-walrus.md §\"Modes & variants\" — four\n// distinct operating modes):\n//\n// - local — `walrusLocalCluster(...)`\n// - live (testnet/mainnet) — `walrusKnownDeployment(...)`\n// - fork-known (`*-fork`) — known-deployment wrapper for the\n// wrapped upstream\n// - fork-localcluster-refused — synchronous refusal at factory\n// time\n//\n// Architecture: Walrus is ONE plugin with internal mode dispatch.\n// The factory at the barrel (`index.ts`) constructs the discriminator\n// from typed options; this file dispatches on the discriminator and\n// assembles mode-appropriate\n// subsystems.\n//\n// What this file does:\n//\n// 1. Receive a resolved mode discriminator.\n// 2. Dispatch to the right `boot*` builder.\n// 3. Return the mode's boot artifacts (the barrel projects them\n// onto the plugin's resolved value).\n//\n// What it does NOT do:\n//\n// - Provision the container runtime — that arrives via the\n// `BuildContext` passed by the barrel.\n// - Resolve bootstrap assets — local-cluster mode owns those\n// resolvers; this file just dispatches.\n\nimport { Effect, FileSystem, Path, type Scope } from 'effect';\n\nimport type { ArtifactPublishError } from '../../primitives/artifact-publisher.ts';\nimport type { WalrusError } from './errors.ts';\nimport {\n\tbootKnownDeployment,\n\ttype KnownDeploymentBootResult,\n\ttype WalrusKnownDeploymentOptions,\n} from './mode/known-deploy.ts';\nimport {\n\tbootLocalCluster,\n\ttype LocalClusterBootResult,\n\ttype LocalClusterDeps,\n\ttype ResolvedLocalClusterOptions,\n} from './mode/local-cluster.ts';\n\n/** Mode discriminator. Internal — the barrel constructs ONE of these\n * per composed walrus instance and dispatches here. */\nexport type WalrusMode =\n\t| { readonly mode: 'local'; readonly opts: ResolvedLocalClusterOptions }\n\t| { readonly mode: 'known'; readonly opts: WalrusKnownDeploymentOptions };\n\n/** Result of one acquire — discriminated by mode so the barrel can\n * project mode-asymmetrically onto the tag set. */\nexport type WalrusBootResult = LocalClusterBootResult | KnownDeploymentBootResult;\n\n/** Dispatch on the mode and return the boot artifacts.\n *\n * `deps` is the local-cluster's full dependency bundle. The known\n * branch ignores all of it (no I/O at acquire time — purely\n * synchronous projection from options); the type lets the barrel\n * pass one record for both paths. */\nexport const bootWalrusService = (\n\tdeps: LocalClusterDeps,\n\tmode: WalrusMode,\n): Effect.Effect<\n\tWalrusBootResult,\n\tWalrusError | ArtifactPublishError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> => {\n\tswitch (mode.mode) {\n\t\tcase 'local':\n\t\t\treturn bootLocalCluster(deps, mode.opts);\n\t\tcase 'known':\n\t\t\treturn bootKnownDeployment(mode.opts);\n\t}\n};\n"],"mappings":";;;;;;;;;;AAgEA,MAAa,qBACZ,MACA,SAKI;AACJ,SAAQ,KAAK,MAAb;EACC,KAAK,QACJ,QAAO,iBAAiB,MAAM,KAAK,KAAK;EACzC,KAAK,QACJ,QAAO,oBAAoB,KAAK,KAAK"}
@@ -0,0 +1,18 @@
1
+ //#region src/plugins/walrus/spans.ts
2
+ const WalrusSpans = {
3
+ chain: "walrus.chain",
4
+ committeeSize: "walrus.committeeSize",
5
+ fundAccount: "walrus.fund.account",
6
+ fundAddress: "walrus.fund.address",
7
+ fundExchange: "walrus.fund.exchange",
8
+ name: "walrus.name",
9
+ node: "walrus.node",
10
+ nodeCount: "walrus.nodeCount",
11
+ ref: "walrus.ref",
12
+ shards: "walrus.shards",
13
+ suiVersion: "walrus.suiVersion"
14
+ };
15
+ //#endregion
16
+ export { WalrusSpans };
17
+
18
+ //# sourceMappingURL=spans.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/walrus/spans.ts"],"sourcesContent":["// Walrus plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [WalrusSpans.name]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const WalrusSpans = {\n\tchain: 'walrus.chain',\n\tcommitteeSize: 'walrus.committeeSize',\n\tfundAccount: 'walrus.fund.account',\n\tfundAddress: 'walrus.fund.address',\n\tfundExchange: 'walrus.fund.exchange',\n\tname: 'walrus.name',\n\tnode: 'walrus.node',\n\tnodeCount: 'walrus.nodeCount',\n\tref: 'walrus.ref',\n\tshards: 'walrus.shards',\n\tsuiVersion: 'walrus.suiVersion',\n} as const;\n"],"mappings":";AAOA,MAAa,cAAc;CAC1B,OAAO;CACP,eAAe;CACf,aAAa;CACb,aAAa;CACb,cAAc;CACd,MAAM;CACN,MAAM;CACN,WAAW;CACX,KAAK;CACL,QAAQ;CACR,YAAY;CACZ"}
@@ -2,11 +2,15 @@ import { Effect, Scope } from "effect";
2
2
 
3
3
  //#region src/plugins/walrus/storage-nodes.d.ts
4
4
  /** Per-node descriptor — what the plugin resolved value surfaces
5
- * for downstream consumers (the `@mysten/walrus` SDK reads this). */
5
+ * for downstream consumers (the `@mysten/walrus` SDK reads this).
6
+ *
7
+ * Note: no `publicKey` field. The per-node BLS12-381 keypair lives
8
+ * inside the per-node keystore the deploy one-shot emitted; the SDK
9
+ * consumer reads the public key off `packageConfig` rather than this
10
+ * routing-handle descriptor. */
6
11
  interface WalrusStorageNode {
7
12
  readonly nodeIndex: number;
8
13
  readonly nodeId: string;
9
- readonly publicKey: string;
10
14
  readonly publicHostname: string;
11
15
  readonly rpcUrl: string;
12
16
  }