@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":"service.mjs","names":[],"sources":["../../../src/plugins/coin/service.ts"],"sourcesContent":["// Coin plugin — main acquire body.\n//\n// One-shot value resolution: the three address forms unify behind a\n// single `acquireCoin` Effect. The barrel (`index.ts`) constructs ONE\n// `CoinAcquireInputs` per declared coin instance and routes here.\n//\n// What this file does:\n//\n// 1. Dispatch on the address-form discriminator to the right\n// resolver under `address-resolution.ts`.\n// 2. Project the resolved value into the user-facing `ResolvedCoin`\n// shape that the Tag publishes.\n// 3. Project a `mint(...)` closure (lazy mint — captures the\n// resolved fullCoinType + the cap id; defers the substrate-\n// primitive call to mint time so the cache key is keyed on\n// mint-time inputs, not factory-time ones).\n//\n// What it does NOT do:\n//\n// - Consume the LocalPackagePublishOutput — that's the discovery-fold path\n// handled at compose-time in the barrel (the barrel calls into\n// `discovery.ts` + `metadata.ts` to populate the registry as\n// packages publish; this file just READS the registry).\n// - Wire capabilities — the barrel's job.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type { ChainId } from '../../substrate/brand.ts';\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport {\n\tBUILTIN_COINS,\n\tresolveBuiltin,\n\tresolveByBareType,\n\tresolveByWitness,\n\ttype ResolvedCoin,\n} from './address-resolution.ts';\nimport { coinError, type CoinError } from './errors.ts';\nimport type { MetadataSdkShim } from './metadata.ts';\nimport {\n\tperformMint,\n\ttype MintInputs,\n\ttype MintResult,\n\ttype MintSdkShim,\n\ttype MintSigner,\n} from './mint.ts';\nimport type { CoinRegistry } from './registry.ts';\n\n/** Per-instance options threaded into the acquire body. One-of the\n * three address forms. */\nexport type CoinAddressForm =\n\t| {\n\t\t\treadonly kind: 'witness';\n\t\t\treadonly publishingPackageName: string;\n\t\t\treadonly witness: string;\n\t\t\treadonly fundingSigner?: MintSigner;\n\t }\n\t| { readonly kind: 'known'; readonly fullCoinType: string }\n\t| { readonly kind: 'builtin'; readonly name: keyof typeof BUILTIN_COINS };\n\n/** Per-acquire context supplied by the barrel from the BuildContext.\n * Carries the resolved per-stack registry, the Sui-side SDK shim\n * (verify probe + tx build), the chain id, and the\n * `ArtifactPublisher` substrate primitive used by `performMint`. */\nexport interface CoinAcquireContext {\n\treadonly registry: CoinRegistry;\n\treadonly sdk: MetadataSdkShim & MintSdkShim;\n\treadonly chain: ChainId;\n\treadonly publisher: ArtifactPublisher;\n}\n\n/** The tag's resolved value — the three address forms unified PLUS a\n * closure for the generic mint surface. */\nexport interface CoinValue extends ResolvedCoin {\n\t/** Generic mint. Requires the cap id (either resolved from the\n\t * registry record's `treasuryCapId`, or supplied explicitly for\n\t * bare-type coins). Each call yields a fresh artifact publisher round (cache\n\t * hit means short-circuit per the substrate primitive). */\n\treadonly mint: (\n\t\tsigner: MintSigner,\n\t\topts: { readonly to: string; readonly amount: bigint; readonly treasuryCapId?: string },\n\t) => Effect.Effect<MintResult, CoinError | ArtifactPublishError, Scope.Scope>;\n\t/** Centralized funding strategy, present for local package coins\n\t * whose publisher still owns the TreasuryCap. The coin barrel\n\t * publishes it under `coinType:<fullCoinType>` so Account funding\n\t * can mint arbitrary local coins without bespoke example actions. */\n\treadonly fundingStrategy?: {\n\t\treadonly request: (req: {\n\t\t\treadonly address: string;\n\t\t\treadonly amount: bigint;\n\t\t}) => Effect.Effect<void, CoinError | ArtifactPublishError>;\n\t};\n}\n\n/** Resolve a coin instance to the tag's resolved value. */\nexport const acquireCoin = (\n\tform: CoinAddressForm,\n\tctx: CoinAcquireContext,\n): Effect.Effect<CoinValue, CoinError> =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'coin.form': form.kind,\n\t\t});\n\n\t\tconst resolved: ResolvedCoin = yield* (() => {\n\t\t\tswitch (form.kind) {\n\t\t\t\tcase 'witness':\n\t\t\t\t\treturn resolveByWitness(ctx.registry, form.publishingPackageName, form.witness);\n\t\t\t\tcase 'known':\n\t\t\t\t\treturn resolveByBareType(ctx.sdk, form.fullCoinType);\n\t\t\t\tcase 'builtin':\n\t\t\t\t\treturn Effect.succeed(resolveBuiltin(form.name));\n\t\t\t}\n\t\t})();\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'coin.fullCoinType': resolved.fullCoinType,\n\t\t\t'coin.decimals': resolved.decimals,\n\t\t\t'coin.source': resolved.source,\n\t\t});\n\n\t\tconst mint: CoinValue['mint'] = (signer, opts) => {\n\t\t\tconst capId = opts.treasuryCapId ?? resolved.treasuryCapId;\n\t\t\tif (capId === undefined) {\n\t\t\t\treturn Effect.fail(\n\t\t\t\t\tcoinError('cap-missing', {\n\t\t\t\t\t\tidentifier: resolved.fullCoinType,\n\t\t\t\t\t\tmessage: `coin('${resolved.fullCoinType}').mint(): no treasury cap available — pass opts.treasuryCapId or use a coin discovered with publisherOwnsCap=true.`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst inputs: MintInputs = {\n\t\t\t\tfullCoinType: resolved.fullCoinType,\n\t\t\t\ttreasuryCapId: capId,\n\t\t\t\trecipient: opts.to,\n\t\t\t\tamount: opts.amount,\n\t\t\t};\n\t\t\treturn performMint(ctx.publisher, ctx.chain, signer, ctx.sdk, inputs);\n\t\t};\n\t\tconst fundingSigner = form.kind === 'witness' ? form.fundingSigner : undefined;\n\t\tconst fundingTreasuryCapId = resolved.treasuryCapId;\n\t\tconst fundingStrategy =\n\t\t\tfundingSigner !== undefined && fundingTreasuryCapId !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\trequest: (req: { readonly address: string; readonly amount: bigint }) =>\n\t\t\t\t\t\t\tEffect.scoped(\n\t\t\t\t\t\t\t\tmint(fundingSigner, {\n\t\t\t\t\t\t\t\t\tto: req.address,\n\t\t\t\t\t\t\t\t\tamount: req.amount,\n\t\t\t\t\t\t\t\t\ttreasuryCapId: fundingTreasuryCapId,\n\t\t\t\t\t\t\t\t}).pipe(Effect.asVoid),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tconst value: CoinValue = {\n\t\t\t...resolved,\n\t\t\tmint,\n\t\t\t...(fundingStrategy === undefined ? {} : { fundingStrategy }),\n\t\t};\n\t\treturn value;\n\t});\n"],"mappings":";;;;;;AAiGA,MAAa,eACZ,MACA,QAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB,EACjC,aAAa,KAAK,MAClB,CAAC;CAEF,MAAM,WAAyB,cAAc;AAC5C,UAAQ,KAAK,MAAb;GACC,KAAK,UACJ,QAAO,iBAAiB,IAAI,UAAU,KAAK,uBAAuB,KAAK,QAAQ;GAChF,KAAK,QACJ,QAAO,kBAAkB,IAAI,KAAK,KAAK,aAAa;GACrD,KAAK,UACJ,QAAO,OAAO,QAAQ,eAAe,KAAK,KAAK,CAAC;;KAE/C;AAEJ,QAAO,OAAO,oBAAoB;EACjC,qBAAqB,SAAS;EAC9B,iBAAiB,SAAS;EAC1B,eAAe,SAAS;EACxB,CAAC;CAEF,MAAM,QAA2B,QAAQ,SAAS;EACjD,MAAM,QAAQ,KAAK,iBAAiB,SAAS;AAC7C,MAAI,UAAU,KAAA,EACb,QAAO,OAAO,KACb,UAAU,eAAe;GACxB,YAAY,SAAS;GACrB,SAAS,SAAS,SAAS,aAAa;GACxC,CAAC,CACF;EAEF,MAAM,SAAqB;GAC1B,cAAc,SAAS;GACvB,eAAe;GACf,WAAW,KAAK;GAChB,QAAQ,KAAK;GACb;AACD,SAAO,YAAY,IAAI,WAAW,IAAI,OAAO,QAAQ,IAAI,KAAK,OAAO;;CAEtE,MAAM,gBAAgB,KAAK,SAAS,YAAY,KAAK,gBAAgB,KAAA;CACrE,MAAM,uBAAuB,SAAS;CACtC,MAAM,kBACL,kBAAkB,KAAA,KAAa,yBAAyB,KAAA,IACrD,EACA,UAAU,QACT,OAAO,OACN,KAAK,eAAe;EACnB,IAAI,IAAI;EACR,QAAQ,IAAI;EACZ,eAAe;EACf,CAAC,CAAC,KAAK,OAAO,OAAO,CACtB,EACF,GACA,KAAA;AAMJ,QAAO;EAJN,GAAG;EACH;EACA,GAAI,oBAAoB,KAAA,IAAY,EAAE,GAAG,EAAE,iBAAiB;EAEjD;EACX"}
1
+ {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/coin/service.ts"],"sourcesContent":["// Coin plugin — main acquire body.\n//\n// One-shot value resolution: the three address forms unify behind a\n// single `acquireCoin` Effect. The barrel (`index.ts`) constructs ONE\n// `CoinAcquireInputs` per declared coin instance and routes here.\n//\n// What this file does:\n//\n// 1. Dispatch on the address-form discriminator to the right\n// resolver under `address-resolution.ts`.\n// 2. Project the resolved value into the user-facing `ResolvedCoin`\n// shape that the Tag publishes.\n// 3. Project a `mint(...)` closure (lazy mint — captures the\n// resolved fullCoinType + the cap id; defers the substrate-\n// primitive call to mint time so the cache key is keyed on\n// mint-time inputs, not factory-time ones).\n//\n// What it does NOT do:\n//\n// - Consume the LocalPackagePublishOutput — that's the discovery-fold path\n// handled at compose-time in the barrel (the barrel calls into\n// `discovery.ts` + `metadata.ts` to populate the registry as\n// packages publish; this file just READS the registry).\n// - Wire capabilities — the barrel's job.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type { ChainId } from '../../substrate/brand.ts';\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport {\n\tBUILTIN_COINS,\n\tresolveBuiltin,\n\tresolveByBareType,\n\tresolveByWitness,\n\ttype ResolvedCoin,\n} from './address-resolution.ts';\nimport { coinError, type CoinError } from './errors.ts';\nimport type { MetadataSdkShim } from './metadata.ts';\nimport { CoinSpans } from './spans.ts';\nimport {\n\tperformMint,\n\ttype MintInputs,\n\ttype MintResult,\n\ttype MintSdkShim,\n\ttype MintSigner,\n} from './mint.ts';\nimport type { CoinRegistry } from './registry.ts';\n\n/** Per-instance options threaded into the acquire body. One-of the\n * three address forms. */\nexport type CoinAddressForm =\n\t| {\n\t\t\treadonly kind: 'witness';\n\t\t\treadonly publishingPackageName: string;\n\t\t\treadonly witness: string;\n\t\t\treadonly fundingSigner?: MintSigner;\n\t }\n\t| { readonly kind: 'known'; readonly fullCoinType: string }\n\t| { readonly kind: 'builtin'; readonly name: keyof typeof BUILTIN_COINS };\n\n/** Per-acquire context supplied by the barrel from the BuildContext.\n * Carries the resolved per-stack registry, the Sui-side SDK shim\n * (verify probe + tx build), the chain id, and the\n * `ArtifactPublisher` substrate primitive used by `performMint`. */\nexport interface CoinAcquireContext {\n\treadonly registry: CoinRegistry;\n\treadonly sdk: MetadataSdkShim & MintSdkShim;\n\treadonly chain: ChainId;\n\treadonly publisher: ArtifactPublisher;\n}\n\n/** The tag's resolved value — the three address forms unified PLUS a\n * closure for the generic mint surface. */\nexport interface CoinValue extends ResolvedCoin {\n\t/** Generic mint. Requires the cap id (either resolved from the\n\t * registry record's `treasuryCapId`, or supplied explicitly for\n\t * bare-type coins). Each call yields a fresh artifact publisher round (cache\n\t * hit means short-circuit per the substrate primitive). */\n\treadonly mint: (\n\t\tsigner: MintSigner,\n\t\topts: { readonly to: string; readonly amount: bigint; readonly treasuryCapId?: string },\n\t) => Effect.Effect<MintResult, CoinError | ArtifactPublishError, Scope.Scope>;\n\t/** Self-contained mint that needs NO external signer — present\n\t * exactly when `fundingStrategy` is (witness-form coins whose\n\t * publisher still owns the TreasuryCap). Captures the publisher\n\t * `MintSigner` + the resolved `treasuryCapId` internally and returns\n\t * the full `MintResult` (digest + minted-coin id), unlike\n\t * `fundingStrategy.request` which discards the result.\n\t *\n\t * This is the seam the control-plane dashboard mint ACTION drives:\n\t * the supervisor reads the resolved `CoinValue` and calls this with\n\t * `{to, amount}` — no signer threading needed, because the\n\t * treasury-cap-owning publisher signer is already in-process here\n\t * (the same lease-owning path `fundingStrategy` uses). The Effect is\n\t * self-scoping (wraps `Effect.scoped` over the artifact-publisher\n\t * round), so callers run it directly without a surrounding Scope. */\n\treadonly mintFromCap?: (opts: {\n\t\treadonly to: string;\n\t\treadonly amount: bigint;\n\t}) => Effect.Effect<MintResult, CoinError | ArtifactPublishError>;\n\t/** Centralized funding strategy, present for local package coins\n\t * whose publisher still owns the TreasuryCap. The coin barrel\n\t * publishes it under `coinType:<fullCoinType>` so Account funding\n\t * can mint arbitrary local coins without bespoke example actions.\n\t *\n\t * The request shape is a NARROWED projection of\n\t * `AccountFundingRequest` (`{address, amount}` only — the coin\n\t * strategy doesn't need the resolved account handle since the\n\t * TreasuryCap-owning publisher signs the mint via its own lease\n\t * inside `mint → signAndDispatch`). Direct consumers (deepbook\n\t * seed funding) call `.request({address, amount})` against this\n\t * narrowed shape; the coin barrel projects the value to the wider\n\t * `AccountFundingStrategy` cross-plugin contract at the\n\t * `strategy-contributor` capability boundary (see\n\t * `coin/index.ts → buildCapabilities`), wrapping the narrow\n\t * request fn so the account bus's `{address, amount, account}`\n\t * shape is satisfied honestly at the boundary.\n\t *\n\t * The E channel preserves the tagged vocabulary\n\t * (`CoinError | ArtifactPublishError`) rather than collapsing to\n\t * `unknown`, so direct consumers can catchTag on the typed\n\t * errors. The account-side dispatcher's registry lookup narrows\n\t * the channel to `unknown` at the registry boundary and reads\n\t * `_tag` defensively. */\n\treadonly fundingStrategy?: {\n\t\treadonly request: (req: {\n\t\t\treadonly address: string;\n\t\t\treadonly amount: bigint;\n\t\t}) => Effect.Effect<void, CoinError | ArtifactPublishError>;\n\t};\n}\n\n/** Resolve a coin instance to the tag's resolved value. */\nexport const acquireCoin = (\n\tform: CoinAddressForm,\n\tctx: CoinAcquireContext,\n): Effect.Effect<CoinValue, CoinError> =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t[CoinSpans.form]: form.kind,\n\t\t});\n\n\t\tconst resolved: ResolvedCoin = yield* (() => {\n\t\t\tswitch (form.kind) {\n\t\t\t\tcase 'witness':\n\t\t\t\t\treturn resolveByWitness(ctx.registry, form.publishingPackageName, form.witness);\n\t\t\t\tcase 'known':\n\t\t\t\t\treturn resolveByBareType(ctx.sdk, form.fullCoinType);\n\t\t\t\tcase 'builtin':\n\t\t\t\t\treturn Effect.succeed(resolveBuiltin(form.name));\n\t\t\t}\n\t\t})();\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t[CoinSpans.fullCoinType]: resolved.fullCoinType,\n\t\t\t[CoinSpans.decimals]: resolved.decimals,\n\t\t\t[CoinSpans.source]: resolved.source,\n\t\t});\n\n\t\tconst mint: CoinValue['mint'] = (signer, opts) => {\n\t\t\tconst capId = opts.treasuryCapId ?? resolved.treasuryCapId;\n\t\t\tif (capId === undefined) {\n\t\t\t\treturn Effect.fail(\n\t\t\t\t\tcoinError('cap-missing', {\n\t\t\t\t\t\tidentifier: resolved.fullCoinType,\n\t\t\t\t\t\tmessage: `coin('${resolved.fullCoinType}').mint(): no treasury cap available — pass opts.treasuryCapId or use a coin discovered with publisherOwnsCap=true.`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst inputs: MintInputs = {\n\t\t\t\tfullCoinType: resolved.fullCoinType,\n\t\t\t\ttreasuryCapId: capId,\n\t\t\t\trecipient: opts.to,\n\t\t\t\tamount: opts.amount,\n\t\t\t};\n\t\t\treturn performMint(ctx.publisher, ctx.chain, signer, ctx.sdk, inputs);\n\t\t};\n\t\tconst fundingSigner = form.kind === 'witness' ? form.fundingSigner : undefined;\n\t\tconst fundingTreasuryCapId = resolved.treasuryCapId;\n\t\t// Self-contained mint closure — same capture as `fundingStrategy`\n\t\t// (publisher signer + resolved cap) but returns the full\n\t\t// `MintResult` and self-scopes. Drives the dashboard mint action.\n\t\tconst mintFromCap: CoinValue['mintFromCap'] =\n\t\t\tfundingSigner !== undefined && fundingTreasuryCapId !== undefined\n\t\t\t\t? (opts) =>\n\t\t\t\t\t\tEffect.scoped(\n\t\t\t\t\t\t\tmint(fundingSigner, {\n\t\t\t\t\t\t\t\tto: opts.to,\n\t\t\t\t\t\t\t\tamount: opts.amount,\n\t\t\t\t\t\t\t\ttreasuryCapId: fundingTreasuryCapId,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t)\n\t\t\t\t: undefined;\n\t\tconst fundingStrategy: CoinValue['fundingStrategy'] =\n\t\t\tfundingSigner !== undefined && fundingTreasuryCapId !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\trequest: (req) =>\n\t\t\t\t\t\t\tEffect.scoped(\n\t\t\t\t\t\t\t\tmint(fundingSigner, {\n\t\t\t\t\t\t\t\t\tto: req.address,\n\t\t\t\t\t\t\t\t\tamount: req.amount,\n\t\t\t\t\t\t\t\t\ttreasuryCapId: fundingTreasuryCapId,\n\t\t\t\t\t\t\t\t}).pipe(Effect.asVoid),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\tconst value: CoinValue = {\n\t\t\t...resolved,\n\t\t\tmint,\n\t\t\t...(mintFromCap === undefined ? {} : { mintFromCap }),\n\t\t\t...(fundingStrategy === undefined ? {} : { fundingStrategy }),\n\t\t};\n\t\treturn value;\n\t});\n"],"mappings":";;;;;;;AAwIA,MAAa,eACZ,MACA,QAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB,GAChC,UAAU,OAAO,KAAK,MACvB,CAAC;CAEF,MAAM,WAAyB,cAAc;AAC5C,UAAQ,KAAK,MAAb;GACC,KAAK,UACJ,QAAO,iBAAiB,IAAI,UAAU,KAAK,uBAAuB,KAAK,QAAQ;GAChF,KAAK,QACJ,QAAO,kBAAkB,IAAI,KAAK,KAAK,aAAa;GACrD,KAAK,UACJ,QAAO,OAAO,QAAQ,eAAe,KAAK,KAAK,CAAC;;KAE/C;AAEJ,QAAO,OAAO,oBAAoB;GAChC,UAAU,eAAe,SAAS;GAClC,UAAU,WAAW,SAAS;GAC9B,UAAU,SAAS,SAAS;EAC7B,CAAC;CAEF,MAAM,QAA2B,QAAQ,SAAS;EACjD,MAAM,QAAQ,KAAK,iBAAiB,SAAS;AAC7C,MAAI,UAAU,KAAA,EACb,QAAO,OAAO,KACb,UAAU,eAAe;GACxB,YAAY,SAAS;GACrB,SAAS,SAAS,SAAS,aAAa;GACxC,CAAC,CACF;EAEF,MAAM,SAAqB;GAC1B,cAAc,SAAS;GACvB,eAAe;GACf,WAAW,KAAK;GAChB,QAAQ,KAAK;GACb;AACD,SAAO,YAAY,IAAI,WAAW,IAAI,OAAO,QAAQ,IAAI,KAAK,OAAO;;CAEtE,MAAM,gBAAgB,KAAK,SAAS,YAAY,KAAK,gBAAgB,KAAA;CACrE,MAAM,uBAAuB,SAAS;CAItC,MAAM,cACL,kBAAkB,KAAA,KAAa,yBAAyB,KAAA,KACpD,SACD,OAAO,OACN,KAAK,eAAe;EACnB,IAAI,KAAK;EACT,QAAQ,KAAK;EACb,eAAe;EACf,CAAC,CACF,GACD,KAAA;CACJ,MAAM,kBACL,kBAAkB,KAAA,KAAa,yBAAyB,KAAA,IACrD,EACA,UAAU,QACT,OAAO,OACN,KAAK,eAAe;EACnB,IAAI,IAAI;EACR,QAAQ,IAAI;EACZ,eAAe;EACf,CAAC,CAAC,KAAK,OAAO,OAAO,CACtB,EACF,GACA,KAAA;AAOJ,QAAO;EALN,GAAG;EACH;EACA,GAAI,gBAAgB,KAAA,IAAY,EAAE,GAAG,EAAE,aAAa;EACpD,GAAI,oBAAoB,KAAA,IAAY,EAAE,GAAG,EAAE,iBAAiB;EAEjD;EACX"}
@@ -0,0 +1,20 @@
1
+ //#region src/plugins/coin/spans.ts
2
+ const CoinSpans = {
3
+ type: "coin.type",
4
+ form: "coin.form",
5
+ fullCoinType: "coin.fullCoinType",
6
+ decimals: "coin.decimals",
7
+ source: "coin.source",
8
+ mint: {
9
+ recipient: "coin.mint.recipient",
10
+ fullCoinType: "coin.mint.fullCoinType",
11
+ amount: "coin.mint.amount",
12
+ digest: "coin.mint.digest",
13
+ mintedCoinId: "coin.mint.mintedCoinId"
14
+ },
15
+ metadata: { fullCoinType: "coin.metadata.fullCoinType" }
16
+ };
17
+ //#endregion
18
+ export { CoinSpans };
19
+
20
+ //# sourceMappingURL=spans.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/coin/spans.ts"],"sourcesContent":["// Coin 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({ [CoinSpans.type]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const CoinSpans = {\n\ttype: 'coin.type',\n\tform: 'coin.form',\n\tfullCoinType: 'coin.fullCoinType',\n\tdecimals: 'coin.decimals',\n\tsource: 'coin.source',\n\tmint: {\n\t\trecipient: 'coin.mint.recipient',\n\t\tfullCoinType: 'coin.mint.fullCoinType',\n\t\tamount: 'coin.mint.amount',\n\t\tdigest: 'coin.mint.digest',\n\t\tmintedCoinId: 'coin.mint.mintedCoinId',\n\t},\n\tmetadata: {\n\t\tfullCoinType: 'coin.metadata.fullCoinType',\n\t},\n} as const;\n"],"mappings":";AAOA,MAAa,YAAY;CACxB,MAAM;CACN,MAAM;CACN,cAAc;CACd,UAAU;CACV,QAAQ;CACR,MAAM;EACL,WAAW;EACX,cAAc;EACd,QAAQ;EACR,QAAQ;EACR,cAAc;EACd;CACD,UAAU,EACT,cAAc,8BACd;CACD"}
@@ -0,0 +1,402 @@
1
+ import { FAUCET_CAPABILITY_KEY_PREFIX } from "../faucet/dispatcher.mjs";
2
+ import "../faucet/index.mjs";
3
+ import { Effect } from "effect";
4
+ //#region src/plugins/dashboard/domain.ts
5
+ /** A 0x-prefixed Sui address: `0x` + 1..64 hex digits. Mirrors the
6
+ * address validation the mint PTB's `tx.pure.address` ultimately
7
+ * enforces, surfaced up front so the dashboard gets a clean rejection
8
+ * rather than an opaque build failure. */
9
+ const SUI_ADDRESS_RE = /^0x[0-9a-fA-F]{1,64}$/;
10
+ /** The canonical builtin SUI coin type — selects the SUI faucet funding
11
+ * path. Mirrors `SUI_FULL_COIN_TYPE` in `plugins/account/funding.ts`
12
+ * (inlined here so the dashboard plugin does not cross-import the account
13
+ * funding module just for the string). */
14
+ const SUI_FULL_COIN_TYPE = "0x2::sui::SUI";
15
+ /** A positive integer base-unit amount string (no sign, no decimal
16
+ * point, no leading zeros beyond a bare `0` — which is itself rejected
17
+ * as non-positive). */
18
+ const isPositiveIntegerString = (s) => {
19
+ if (!/^\d+$/.test(s)) return false;
20
+ try {
21
+ return BigInt(s) > 0n;
22
+ } catch {
23
+ return false;
24
+ }
25
+ };
26
+ /** Compose the chain faucet capability key (`faucet:request:<chainId>`)
27
+ * the SUI funding path resolves. Uses the faucet plugin's prefix constant
28
+ * (single source of truth) — same key the boot-time funding pass builds. */
29
+ const faucetCapabilityKeyFor = (chain) => `${FAUCET_CAPABILITY_KEY_PREFIX}:${chain}`;
30
+ /** Parse a base-unit amount string into a positive bigint, or `null` when
31
+ * absent / non-positive / non-integer. */
32
+ const parseAmount = (s) => {
33
+ if (s == null) return null;
34
+ const trimmed = s.trim();
35
+ if (!isPositiveIntegerString(trimmed)) return null;
36
+ return BigInt(trimmed);
37
+ };
38
+ /** Derive a display symbol from a full coin type's module path
39
+ * (`0x…::wal::WAL` → `WAL`, `0x…::deep::DEEP` → `DEEP`). Falls back to the
40
+ * struct name, then the raw type. Keeps the dashboard name-blind on the
41
+ * resolved coin VALUE while still labeling the faucet pill. */
42
+ const coinSymbolFromType = (coinType) => {
43
+ const parts = coinType.split("::");
44
+ const struct = parts[parts.length - 1];
45
+ return struct !== void 0 && struct.length > 0 ? struct : coinType;
46
+ };
47
+ /** Extract a human detail from a faucet/funding strategy failure. The
48
+ * strategy error channels are tagged structs carrying `message`/`reason`;
49
+ * read them structurally without importing each plugin's error type. */
50
+ const causeDetail = (cause) => {
51
+ if (cause !== null && typeof cause === "object") {
52
+ const c = cause;
53
+ if (typeof c.message === "string" && c.message.length > 0) return c.message;
54
+ if (typeof c.reason === "string" && c.reason.length > 0) return c.reason;
55
+ if (typeof c._tag === "string" && c._tag.length > 0) return c._tag;
56
+ }
57
+ return String(cause);
58
+ };
59
+ const faucetCauseDetail = causeDetail;
60
+ const fundingCauseDetail = causeDetail;
61
+ const str = (v) => typeof v === "string" ? v : null;
62
+ const strReq = (v) => typeof v === "string" ? v : "";
63
+ const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
64
+ const bool = (v) => v === true;
65
+ /** Filter the generic resolved values down to those whose resource id
66
+ * matches a predicate, in graph order. Returns the `{ pluginKey, value }`
67
+ * the shaping functions consume. */
68
+ const matching = (values, matches) => values.filter((v) => matches(v.id));
69
+ /** SQL that emits a single line of JSON the dashboard can parse without a
70
+ * PG client. Keeps the round trip to one exec. */
71
+ const PG_STATS_SQL = `SELECT json_build_object(
72
+ 'db_bytes', pg_database_size(current_database()),
73
+ 'connections', (SELECT count(*) FROM pg_stat_activity WHERE datname = current_database()),
74
+ 'tables', COALESCE((
75
+ SELECT json_agg(t) FROM (
76
+ SELECT schemaname AS schema, relname AS name,
77
+ n_live_tup AS row_estimate,
78
+ pg_total_relation_size(relid) AS total_bytes
79
+ FROM pg_stat_user_tables
80
+ ORDER BY pg_total_relation_size(relid) DESC
81
+ LIMIT 200
82
+ ) t
83
+ ), '[]'::json)
84
+ )`;
85
+ const parsePgStats = (pluginKey, pg, stdout) => {
86
+ const base = {
87
+ pluginKey,
88
+ database: strReq((pg.databases ?? [])[0]) || "postgres",
89
+ plainUrl: `postgres://${str(pg.networkAlias) ?? "postgres"}:${num(pg.port) ?? 5432}`
90
+ };
91
+ try {
92
+ const trimmed = stdout.trim();
93
+ const parsed = JSON.parse(trimmed);
94
+ const tables = (parsed.tables ?? []).map((t) => ({
95
+ schema: t.schema ?? "public",
96
+ name: t.name ?? "",
97
+ rowEstimate: num(t.row_estimate) ?? 0,
98
+ totalBytes: num(t.total_bytes) ?? 0
99
+ }));
100
+ return {
101
+ ...base,
102
+ databaseBytes: num(parsed.db_bytes) ?? 0,
103
+ connectionCount: num(parsed.connections) ?? 0,
104
+ tables,
105
+ available: true,
106
+ detail: null
107
+ };
108
+ } catch (cause) {
109
+ return {
110
+ ...base,
111
+ databaseBytes: 0,
112
+ connectionCount: 0,
113
+ tables: [],
114
+ available: false,
115
+ detail: `failed to parse psql output: ${String(cause)}`
116
+ };
117
+ }
118
+ };
119
+ const unavailablePgStats = (pluginKey, pg, detail) => {
120
+ return {
121
+ pluginKey,
122
+ database: strReq((pg.databases ?? [])[0]) || "postgres",
123
+ plainUrl: `postgres://${str(pg.networkAlias) ?? "postgres"}:${num(pg.port) ?? 5432}`,
124
+ databaseBytes: 0,
125
+ connectionCount: 0,
126
+ tables: [],
127
+ available: false,
128
+ detail
129
+ };
130
+ };
131
+ const buildDashboardDomain = (deps) => {
132
+ const { control, identity, containerRuntime, strategyRegistry } = deps;
133
+ const mode = control.resolvedValues.pipe(Effect.map((values) => {
134
+ const sui = matching(values, (id) => id === "sui")[0];
135
+ if (sui === void 0) return null;
136
+ switch (sui.value.mode) {
137
+ case "fork": return "fork";
138
+ case "live": return "live";
139
+ case "local":
140
+ case "local-rpc": return "local";
141
+ default: return null;
142
+ }
143
+ }));
144
+ const deepbook = control.resolvedValues.pipe(Effect.map((values) => matching(values, (id) => id.startsWith("deepbook/")).map(({ pluginKey, value }) => {
145
+ const v = value;
146
+ const modeRaw = v.mode;
147
+ const dbMode = modeRaw === "override" ? "override" : modeRaw === "known" ? "known" : "local";
148
+ return {
149
+ pluginKey,
150
+ name: pluginKey.replace(/^deepbook:/, ""),
151
+ mode: dbMode,
152
+ chain: strReq(v.chain),
153
+ packageId: strReq(v.packageId),
154
+ registryId: strReq(v.registryId),
155
+ adminCapId: str(v.adminCapId),
156
+ deepTreasuryId: str(v.deepTreasuryId),
157
+ pools: (v.pools ?? []).map((p) => ({
158
+ name: strReq(p.name),
159
+ poolId: strReq(p.poolId),
160
+ baseCoinType: strReq(p.baseCoinType),
161
+ quoteCoinType: strReq(p.quoteCoinType)
162
+ })),
163
+ marketMakerRunning: bool(v.marketMakerRunning),
164
+ serverUrl: str(v.serverUrl),
165
+ indexerUrl: str(v.indexerUrl)
166
+ };
167
+ })));
168
+ const seal = control.resolvedValues.pipe(Effect.map((values) => matching(values, (id) => id.startsWith("seal:")).map(({ pluginKey, value }) => {
169
+ const v = value;
170
+ const sealMode = v.mode === "live" ? "live" : v.mode === "fork-known" ? "fork-known" : "local-keygen";
171
+ const keyServers = (v.serverConfigs ?? []).map((c) => ({
172
+ objectId: strReq(c.objectId),
173
+ weight: num(c.weight) ?? 1
174
+ }));
175
+ return {
176
+ pluginKey,
177
+ mode: sealMode,
178
+ objectId: strReq(v.objectId),
179
+ keyServerUrl: strReq(v.keyServerUrl),
180
+ keyServers,
181
+ threshold: keyServers.length
182
+ };
183
+ })));
184
+ const coinCaps = control.resolvedValues.pipe(Effect.map((values) => matching(values, (id) => id.startsWith("coin:")).map(({ pluginKey, value }) => {
185
+ const v = value;
186
+ const source = v.source === "registry" ? "registry" : v.source === "builtin" ? "builtin" : "on-chain";
187
+ return {
188
+ pluginKey,
189
+ symbol: str(v.symbol),
190
+ fullCoinType: strReq(v.fullCoinType),
191
+ decimals: num(v.decimals) ?? 0,
192
+ source,
193
+ treasuryCapId: str(v.treasuryCapId),
194
+ packageId: str(v.packageId)
195
+ };
196
+ })));
197
+ const mintCoin = (input) => Effect.gen(function* () {
198
+ const recipient = input.recipient.trim();
199
+ if (!SUI_ADDRESS_RE.test(recipient)) return {
200
+ ok: false,
201
+ detail: `invalid recipient '${input.recipient}': expected a 0x-prefixed Sui address`,
202
+ digest: null
203
+ };
204
+ if (!isPositiveIntegerString(input.amountBaseUnits)) return {
205
+ ok: false,
206
+ detail: `invalid amountBaseUnits '${input.amountBaseUnits}': expected a positive integer string`,
207
+ digest: null
208
+ };
209
+ const match = matching(yield* control.resolvedValues, (id) => id.startsWith("coin:")).map(({ value }) => value).find((v) => strReq(v.fullCoinType) === input.coinType);
210
+ if (match === void 0) return {
211
+ ok: false,
212
+ detail: `no resolved coin found for type '${input.coinType}'`,
213
+ digest: null
214
+ };
215
+ if (typeof match.mintFromCap !== "function") return {
216
+ ok: false,
217
+ detail: `coin '${input.coinType}' has no in-process treasury cap signer — mint is only available for local-package coins whose publisher still owns the TreasuryCap`,
218
+ digest: null
219
+ };
220
+ return yield* match.mintFromCap({
221
+ to: recipient,
222
+ amount: BigInt(input.amountBaseUnits)
223
+ }).pipe(Effect.map((r) => ({
224
+ ok: true,
225
+ detail: `minted ${input.amountBaseUnits} of ${input.coinType} to ${recipient}`,
226
+ digest: r.digest
227
+ })), Effect.catch((cause) => Effect.succeed({
228
+ ok: false,
229
+ detail: typeof cause?.message === "string" ? cause.message : `mint failed: ${String(cause)}`,
230
+ digest: null
231
+ })), Effect.catchCause((cause) => Effect.succeed({
232
+ ok: false,
233
+ detail: `mint crashed: ${String(cause)}`,
234
+ digest: null
235
+ })));
236
+ });
237
+ /** The chain id the SUI funding path keys on, read from the resolved sui
238
+ * value (same `chain` field the sui codegen/snapshot decls stamp). */
239
+ const readChainId = control.resolvedValues.pipe(Effect.map((values) => {
240
+ const sui = matching(values, (id) => id === "sui")[0];
241
+ return sui === void 0 ? null : str(sui.value.chain);
242
+ }));
243
+ const fundableCoins = Effect.gen(function* () {
244
+ const out = [];
245
+ if (strategyRegistry === null) return out;
246
+ const chain = yield* readChainId;
247
+ const keys = yield* strategyRegistry.list();
248
+ if (chain !== null && keys.includes(faucetCapabilityKeyFor(chain))) out.push({
249
+ symbol: "SUI",
250
+ coinType: SUI_FULL_COIN_TYPE,
251
+ honorsAmount: false,
252
+ requiresAccountSigner: false
253
+ });
254
+ for (const key of keys) {
255
+ if (!key.startsWith("coinType:")) continue;
256
+ const coinType = key.slice(9);
257
+ if (coinType === SUI_FULL_COIN_TYPE) continue;
258
+ const strategy = yield* strategyRegistry.get(key).pipe(Effect.catchTag("StrategyNotFoundError", () => Effect.succeed(null)));
259
+ out.push({
260
+ symbol: coinSymbolFromType(coinType),
261
+ coinType,
262
+ honorsAmount: true,
263
+ requiresAccountSigner: strategy?.requiresRecipientAccount ?? false
264
+ });
265
+ }
266
+ return out;
267
+ });
268
+ const fundAccount = (input) => Effect.gen(function* () {
269
+ const recipient = input.recipient.trim();
270
+ if (!SUI_ADDRESS_RE.test(recipient)) return {
271
+ ok: false,
272
+ detail: `invalid recipient '${input.recipient}': expected a 0x-prefixed Sui address`,
273
+ digest: null
274
+ };
275
+ if (strategyRegistry === null) return {
276
+ ok: false,
277
+ detail: "funding unavailable: no strategy registry wired",
278
+ digest: null
279
+ };
280
+ const coinType = input.coinType?.trim() ?? "";
281
+ if (coinType === "" || coinType === SUI_FULL_COIN_TYPE) {
282
+ const chain = yield* readChainId;
283
+ if (chain === null) return {
284
+ ok: false,
285
+ detail: "cannot fund SUI: no resolved sui plugin / chain id in this stack",
286
+ digest: null
287
+ };
288
+ const key = faucetCapabilityKeyFor(chain);
289
+ const strategy = yield* strategyRegistry.get(key).pipe(Effect.catchTag("StrategyNotFoundError", () => Effect.succeed(null)));
290
+ if (strategy === null) return {
291
+ ok: false,
292
+ detail: `no SUI faucet strategy registered for chain '${chain}'`,
293
+ digest: null
294
+ };
295
+ const amount = parseAmount(input.amountBaseUnits) ?? 1000000000n;
296
+ return yield* strategy.request({
297
+ address: recipient,
298
+ amount
299
+ }).pipe(Effect.map(() => ({
300
+ ok: true,
301
+ detail: `requested SUI for ${recipient} (fixed-amount faucet grant)`,
302
+ digest: null
303
+ })), Effect.catch((cause) => Effect.succeed({
304
+ ok: false,
305
+ detail: `SUI faucet request failed: ${faucetCauseDetail(cause)}`,
306
+ digest: null
307
+ })), Effect.catchCause((cause) => Effect.succeed({
308
+ ok: false,
309
+ detail: `SUI faucet request crashed: ${String(cause)}`,
310
+ digest: null
311
+ })));
312
+ }
313
+ const amount = parseAmount(input.amountBaseUnits);
314
+ if (amount === null) return {
315
+ ok: false,
316
+ detail: `invalid amountBaseUnits '${input.amountBaseUnits ?? ""}': expected a positive integer string`,
317
+ digest: null
318
+ };
319
+ const key = `coinType:${coinType}`;
320
+ const strategy = yield* strategyRegistry.get(key).pipe(Effect.catchTag("StrategyNotFoundError", () => Effect.succeed(null)));
321
+ if (strategy === null) return {
322
+ ok: false,
323
+ detail: `no funding strategy registered for coin '${coinType}' — WAL needs the walrus plugin (with an exchange) and DEEP needs the deepbook plugin`,
324
+ digest: null
325
+ };
326
+ const account = matching(yield* control.resolvedValues, (id) => id.startsWith("account/")).map(({ value }) => value).find((v) => str(v.address) === recipient);
327
+ if (strategy.requiresRecipientAccount === true && account === void 0) return {
328
+ ok: false,
329
+ detail: `coin '${coinType}' is funded by an account-signed swap, but '${recipient}' is not a resolved account in this stack — fund a configured account (the swap spends its SUI)`,
330
+ digest: null
331
+ };
332
+ return yield* strategy.request({
333
+ address: recipient,
334
+ amount,
335
+ ...account === void 0 ? {} : { account }
336
+ }).pipe(Effect.map(() => ({
337
+ ok: true,
338
+ detail: `funded ${amount} base units of ${coinType} to ${recipient}`,
339
+ digest: null
340
+ })), Effect.catch((cause) => Effect.succeed({
341
+ ok: false,
342
+ detail: `${coinSymbolFromType(coinType)} funding failed: ${fundingCauseDetail(cause)}`,
343
+ digest: null
344
+ })), Effect.catchCause((cause) => Effect.succeed({
345
+ ok: false,
346
+ detail: `${coinSymbolFromType(coinType)} funding crashed: ${String(cause)}`,
347
+ digest: null
348
+ })));
349
+ });
350
+ return {
351
+ mode,
352
+ deepbook,
353
+ seal,
354
+ coinCaps,
355
+ postgresStats: Effect.gen(function* () {
356
+ const instances = matching(yield* control.resolvedValues, (id) => id === "postgres");
357
+ if (instances.length === 0) return [];
358
+ const out = [];
359
+ for (const { pluginKey, value } of instances) {
360
+ const pg = value;
361
+ if (containerRuntime === null) {
362
+ out.push(unavailablePgStats(pluginKey, pg, "container runtime unavailable"));
363
+ continue;
364
+ }
365
+ const database = strReq((pg.databases ?? [])[0]) || "postgres";
366
+ const pgUser = str(pg.user) ?? "postgres";
367
+ const role = str(pg.name) ?? "postgres";
368
+ const stats = yield* Effect.gen(function* () {
369
+ const handles = yield* containerRuntime.inspectByLabels({
370
+ app: String(identity.app),
371
+ stack: String(identity.stack),
372
+ plugin: "postgres",
373
+ role
374
+ });
375
+ const running = handles.find((h) => h.status === "running") ?? handles[0];
376
+ if (running === void 0) return unavailablePgStats(pluginKey, pg, "no running postgres container found");
377
+ const result = yield* containerRuntime.exec(running, [
378
+ "psql",
379
+ "-U",
380
+ pgUser,
381
+ "-d",
382
+ database,
383
+ "-tAc",
384
+ PG_STATS_SQL
385
+ ]);
386
+ if (result.exitCode !== 0) return unavailablePgStats(pluginKey, pg, `psql exited ${result.exitCode}: ${result.stderr.trim().slice(0, 200)}`);
387
+ return parsePgStats(pluginKey, pg, result.stdout);
388
+ }).pipe(Effect.catchCause((cause) => Effect.succeed(unavailablePgStats(pluginKey, pg, String(cause)))));
389
+ out.push(stats);
390
+ }
391
+ return out;
392
+ }),
393
+ mintCoin,
394
+ fundableCoins,
395
+ fundAccount
396
+ };
397
+ };
398
+ Effect.succeed(null), Effect.succeed([]), Effect.succeed([]), Effect.succeed([]), Effect.succeed([]), Effect.succeed([]);
399
+ //#endregion
400
+ export { buildDashboardDomain };
401
+
402
+ //# sourceMappingURL=domain.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.mjs","names":[],"sources":["../../../src/plugins/dashboard/domain.ts"],"sourcesContent":["// Dashboard plugin-domain shaping.\n//\n// The substrate control-plane is GENERIC + name-blind: it hands out the\n// snapshot catalog, the observability rings, and a single uninterpreted\n// `resolvedValues` accessor (see `substrate/runtime/control-plane/`). This\n// module — which lives in the PLUGIN layer and is allowed to name plugins —\n// owns ALL plugin-name-aware shaping: it matches resolved plugin values by\n// resource id (`deepbook/`-prefix, `seal:`-prefix, `coin:`-prefix,\n// `id === 'sui'`, `id === 'postgres'`) and projects them into the\n// app-agnostic shapes the\n// GraphQL schema renders. It also owns the `mode` derivation, the coin\n// `mint` action, and the Postgres `psql`-exec wire-protocol stats.\n//\n// Design discipline (mirrors the old substrate seam, one layer up):\n// - We import NO plugin types — we narrow the opaque `unknown` resolved\n// value through shallow structural shapes that mirror the relevant\n// fields. A field missing on the live value collapses to the\n// null/empty default.\n// - Every accessor degrades to empty/`null` rather than failing, so a\n// single missing/uninitialised plugin can't take down a dashboard\n// query (`E = never` on the public surface).\n// - We match plugins by RESOURCE ID — a prefix for the multi-instance\n// kinds (`deepbook/`, `seal:`, `coin:`) and an exact id for the\n// singletons (`id === 'postgres'`, `id === 'sui'`) — rather than\n// plugin-key substrings: the resource id is the stable identity the\n// plugin factories mint.\n\nimport { Effect } from 'effect';\n\nimport type { ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport type { Identity } from '../../substrate/identity.ts';\nimport type {\n\tControlPlaneDomain,\n\tControlPlaneResolvedValue,\n} from '../../substrate/runtime/control-plane/service.ts';\nimport type { StrategyRegistry } from '../../contracts/strategy-contributor.ts';\nimport type { FaucetStrategy } from '../../contracts/faucet-strategy.ts';\nimport type { AccountFundingStrategy } from '../../contracts/funding-strategy.ts';\nimport type { AccountValue } from '../account/index.ts';\n// The faucet capability-key prefix is owned by the faucet plugin (single\n// source of truth). The dashboard plugin layer is allowed to name plugins,\n// so importing the key constructor is the same cross-plugin reference the\n// account funding pass (`plugins/account/funding.ts`) uses — NOT a resolved\n// plugin-VALUE import (those stay structurally narrowed below). Imported via\n// the sibling's barrel to satisfy the plugin-boundary invariant.\nimport { FAUCET_CAPABILITY_KEY_PREFIX } from '../faucet/index.ts';\n\n// -----------------------------------------------------------------------------\n// App-agnostic domain shapes the GraphQL schema renders.\n// -----------------------------------------------------------------------------\n\n/** One DeepBook pool object id + coin types (prices are chain-direct). */\nexport interface DashboardDeepbookPool {\n\treadonly name: string;\n\treadonly poolId: string;\n\treadonly baseCoinType: string;\n\treadonly quoteCoinType: string;\n}\n\nexport interface DashboardDeepbookInfo {\n\treadonly pluginKey: string;\n\treadonly name: string;\n\treadonly mode: 'local' | 'override' | 'known';\n\treadonly chain: string;\n\treadonly packageId: string;\n\treadonly registryId: string;\n\treadonly adminCapId: string | null;\n\treadonly deepTreasuryId: string | null;\n\treadonly pools: ReadonlyArray<DashboardDeepbookPool>;\n\treadonly marketMakerRunning: boolean;\n\treadonly serverUrl: string | null;\n\treadonly indexerUrl: string | null;\n}\n\nexport interface DashboardSealKeyServer {\n\treadonly objectId: string;\n\treadonly weight: number;\n}\n\nexport interface DashboardSealInfo {\n\treadonly pluginKey: string;\n\treadonly mode: 'local-keygen' | 'live' | 'fork-known';\n\treadonly objectId: string;\n\treadonly keyServerUrl: string;\n\treadonly keyServers: ReadonlyArray<DashboardSealKeyServer>;\n\t/** Threshold = number of registered key-server configs. */\n\treadonly threshold: number;\n}\n\n/** A coin's treasury-cap id (drives the Mint action) + addressing facts. */\nexport interface DashboardCoinCap {\n\treadonly pluginKey: string;\n\treadonly symbol: string | null;\n\treadonly fullCoinType: string;\n\treadonly decimals: number;\n\treadonly source: 'registry' | 'on-chain' | 'builtin';\n\treadonly treasuryCapId: string | null;\n\treadonly packageId: string | null;\n}\n\n/** Input for the dashboard mint ACTION. `amountBaseUnits` is the raw\n * integer amount in the coin's smallest unit (decimals already applied\n * by the caller / form) — a string so large u64 values survive the wire\n * without precision loss. */\nexport interface DashboardMintInput {\n\treadonly coinType: string;\n\treadonly recipient: string;\n\treadonly amountBaseUnits: string;\n}\n\n/** Outcome of a dashboard mint ACTION. Mirrors the snapshot\n * restore/delete result shape plus the on-chain tx `digest` on success. */\nexport interface DashboardMintResult {\n\treadonly ok: boolean;\n\treadonly detail: string;\n\treadonly digest: string | null;\n}\n\n/** Input for the dashboard fund ACTION.\n *\n * `coinType` selects the funding strategy: absent or the canonical SUI\n * type routes through the chain's faucet strategy (`faucet:request:<chainId>`,\n * fixed-amount); any other full coin type routes through the coin-specific\n * `coinType:<fullCoinType>` strategy (WAL exchange swap / DEEP pool swap).\n *\n * `amountBaseUnits` is the raw integer amount in the coin's smallest unit\n * (a string so large u64 values survive the wire without precision loss).\n * The SUI faucet is fixed-amount and IGNORES it; WAL/DEEP honor it. */\nexport interface DashboardFundInput {\n\treadonly recipient: string;\n\treadonly coinType?: string | null;\n\treadonly amountBaseUnits?: string | null;\n}\n\n/** Outcome of a dashboard fund ACTION. The in-process funding strategies\n * return `void` (not a digest), so `digest` is always `null` here — kept\n * for shape-parity with `DashboardMintResult`. `ok:true` means the\n * strategy's `request(...)` completed (the faucet POST landed / the swap\n * executed on-chain); `detail` carries the reason on failure. */\nexport interface DashboardFundResult {\n\treadonly ok: boolean;\n\treadonly detail: string;\n\treadonly digest: string | null;\n}\n\n/** One coin the dashboard faucet can actually fund, with whether the\n * underlying strategy honors a caller-supplied amount.\n *\n * SUI is always present (fixed-amount faucet, `honorsAmount: false`).\n * WAL/DEEP appear only when their plugin registered a `coinType:<X>`\n * funding strategy AND (for WAL) carries a swap that spends the\n * recipient account's SUI — so `honorsAmount: true`. */\nexport interface DashboardFundableCoin {\n\treadonly symbol: string;\n\treadonly coinType: string;\n\treadonly honorsAmount: boolean;\n\t/** True when funding requires the recipient to BE a resolved account in\n\t * the stack (the swap spends that account's own SUI via its in-process\n\t * signer). SUI is `false` (any 0x address); WAL/DEEP are `true`. */\n\treadonly requiresAccountSigner: boolean;\n}\n\nexport interface DashboardPostgresTable {\n\treadonly schema: string;\n\treadonly name: string;\n\treadonly rowEstimate: number;\n\treadonly totalBytes: number;\n}\n\nexport interface DashboardPostgresStats {\n\treadonly pluginKey: string;\n\treadonly database: string;\n\t/** Plain (password-less) DSN — the credentialed form NEVER leaves the\n\t * backend. */\n\treadonly plainUrl: string;\n\treadonly databaseBytes: number;\n\treadonly connectionCount: number;\n\treadonly tables: ReadonlyArray<DashboardPostgresTable>;\n\t/** `false` when stats could not be gathered (container down, exec\n\t * failure). The dashboard renders a degraded state rather than\n\t * failing the whole query. */\n\treadonly available: boolean;\n\treadonly detail: string | null;\n}\n\n/** The dashboard plugin-domain accessor surface. Each member is a\n * self-contained Effect that never fails (`E = never`); they degrade to\n * empty/`null` so a single missing plugin can't take down the dashboard\n * query. */\nexport interface DashboardDomain {\n\t/** Fork-vs-local mode, derived from the resolved sui plugin's chain\n\t * identity. Used for advance-clock gating. `null` when no sui plugin\n\t * is present. */\n\treadonly mode: Effect.Effect<'fork' | 'local' | 'live' | null>;\n\t/** DeepBook deployments (registry/admin/pool ids + MM state). */\n\treadonly deepbook: Effect.Effect<ReadonlyArray<DashboardDeepbookInfo>>;\n\t/** Seal key-server deployments (objectId/threshold/mode). */\n\treadonly seal: Effect.Effect<ReadonlyArray<DashboardSealInfo>>;\n\t/** Coin treasury caps (drives Mint). */\n\treadonly coinCaps: Effect.Effect<ReadonlyArray<DashboardCoinCap>>;\n\t/** Postgres wire-protocol stats per postgres plugin instance. */\n\treadonly postgresStats: Effect.Effect<ReadonlyArray<DashboardPostgresStats>>;\n\t/** Mint ACTION — mints `amountBaseUnits` of `coinType` to `recipient`,\n\t * signed in-process by the treasury-cap-owning publisher signer the\n\t * resolved coin value's self-contained `mintFromCap` closure holds. */\n\treadonly mintCoin: (input: DashboardMintInput) => Effect.Effect<DashboardMintResult>;\n\t/** Coins the faucet can actually fund right now (SUI always; WAL/DEEP\n\t * only when their plugin registered a funding strategy). Drives the\n\t * faucet panel's coin pills + amount-field gating. */\n\treadonly fundableCoins: Effect.Effect<ReadonlyArray<DashboardFundableCoin>>;\n\t/** Fund ACTION — reuses devstack's in-process funding strategies. SUI\n\t * (absent/canonical type) routes through the chain faucet strategy\n\t * (fixed-amount); WAL/DEEP route through the coin-specific funding\n\t * strategy (account-signed exchange/pool swap). Real result — `ok`\n\t * reflects whether the strategy's `request(...)` completed. */\n\treadonly fundAccount: (input: DashboardFundInput) => Effect.Effect<DashboardFundResult>;\n}\n\n// -----------------------------------------------------------------------------\n// Structural projections of plugin-resolved values\n//\n// We narrow the opaque `unknown` resolved value through shallow structural\n// shapes that mirror the relevant fields. A field missing on the live value\n// collapses to the null/empty default.\n// -----------------------------------------------------------------------------\n\ninterface DeepbookShape {\n\treadonly mode?: unknown;\n\treadonly chain?: unknown;\n\treadonly packageId?: unknown;\n\treadonly registryId?: unknown;\n\treadonly adminCapId?: unknown;\n\treadonly deepTreasuryId?: unknown;\n\treadonly pools?: ReadonlyArray<{\n\t\treadonly name?: unknown;\n\t\treadonly poolId?: unknown;\n\t\treadonly baseCoinType?: unknown;\n\t\treadonly quoteCoinType?: unknown;\n\t}>;\n\treadonly marketMakerRunning?: unknown;\n\treadonly serverUrl?: unknown;\n\treadonly indexerUrl?: unknown;\n}\n\ninterface SealShape {\n\treadonly mode?: unknown;\n\treadonly objectId?: unknown;\n\treadonly keyServerUrl?: unknown;\n\treadonly serverConfigs?: ReadonlyArray<{\n\t\treadonly objectId?: unknown;\n\t\treadonly weight?: unknown;\n\t}>;\n}\n\ninterface CoinShape {\n\treadonly symbol?: unknown;\n\treadonly fullCoinType?: unknown;\n\treadonly decimals?: unknown;\n\treadonly source?: unknown;\n\treadonly treasuryCapId?: unknown;\n\treadonly packageId?: unknown;\n\t/** Self-contained mint closure on the resolved coin value (present\n\t * for witness-form coins whose publisher still owns the cap). Read\n\t * structurally — we import no coin types. Returns an Effect that\n\t * resolves a `{ digest }`-bearing result or fails with a\n\t * coin/artifact-publisher tagged error. */\n\treadonly mintFromCap?: (opts: {\n\t\treadonly to: string;\n\t\treadonly amount: bigint;\n\t}) => Effect.Effect<{ readonly digest: string }, { readonly message?: unknown }>;\n}\n\ninterface PostgresShape {\n\treadonly name?: unknown;\n\treadonly user?: unknown;\n\treadonly databases?: ReadonlyArray<unknown>;\n\treadonly plainEndpoint?: unknown;\n\treadonly networkAlias?: unknown;\n\treadonly port?: unknown;\n}\n\ninterface SuiShape {\n\treadonly mode?: unknown;\n\t/** Substrate-level chain id (`'sui:localnet'`, `'sui:testnet'`,\n\t * `'sui:mainnet-fork@123'`). Composes the faucet capability key\n\t * (`faucet:request:<chainId>`) the SUI funding path resolves. */\n\treadonly chain?: unknown;\n}\n\n/** Structural shape of the resolved account value (`account/<name>`). The\n * WAL/DEEP funding strategies need this handle as `req.account` — the swap\n * spends the recipient account's own SUI through its in-process signer.\n * Narrowed to the fields the strategy dispatch reads; the full\n * `AccountValue` is assignable to it, so we cast the matched value across\n * the seam without importing the account VALUE shape structurally\n * elsewhere. */\ninterface AccountShape {\n\treadonly address?: unknown;\n\treadonly name?: unknown;\n}\n\n/** A 0x-prefixed Sui address: `0x` + 1..64 hex digits. Mirrors the\n * address validation the mint PTB's `tx.pure.address` ultimately\n * enforces, surfaced up front so the dashboard gets a clean rejection\n * rather than an opaque build failure. */\nconst SUI_ADDRESS_RE = /^0x[0-9a-fA-F]{1,64}$/;\n\n/** The canonical builtin SUI coin type — selects the SUI faucet funding\n * path. Mirrors `SUI_FULL_COIN_TYPE` in `plugins/account/funding.ts`\n * (inlined here so the dashboard plugin does not cross-import the account\n * funding module just for the string). */\nconst SUI_FULL_COIN_TYPE = '0x2::sui::SUI' as const;\n\n/** A positive integer base-unit amount string (no sign, no decimal\n * point, no leading zeros beyond a bare `0` — which is itself rejected\n * as non-positive). */\nconst isPositiveIntegerString = (s: string): boolean => {\n\tif (!/^\\d+$/.test(s)) return false;\n\ttry {\n\t\treturn BigInt(s) > 0n;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n/** Compose the chain faucet capability key (`faucet:request:<chainId>`)\n * the SUI funding path resolves. Uses the faucet plugin's prefix constant\n * (single source of truth) — same key the boot-time funding pass builds. */\nconst faucetCapabilityKeyFor = (\n\tchain: string,\n): `${typeof FAUCET_CAPABILITY_KEY_PREFIX}:${string}` => `${FAUCET_CAPABILITY_KEY_PREFIX}:${chain}`;\n\n/** Parse a base-unit amount string into a positive bigint, or `null` when\n * absent / non-positive / non-integer. */\nconst parseAmount = (s: string | null | undefined): bigint | null => {\n\tif (s == null) return null;\n\tconst trimmed = s.trim();\n\tif (!isPositiveIntegerString(trimmed)) return null;\n\treturn BigInt(trimmed);\n};\n\n/** Derive a display symbol from a full coin type's module path\n * (`0x…::wal::WAL` → `WAL`, `0x…::deep::DEEP` → `DEEP`). Falls back to the\n * struct name, then the raw type. Keeps the dashboard name-blind on the\n * resolved coin VALUE while still labeling the faucet pill. */\nconst coinSymbolFromType = (coinType: string): string => {\n\tconst parts = coinType.split('::');\n\tconst struct = parts[parts.length - 1];\n\treturn struct !== undefined && struct.length > 0 ? struct : coinType;\n};\n\n/** Extract a human detail from a faucet/funding strategy failure. The\n * strategy error channels are tagged structs carrying `message`/`reason`;\n * read them structurally without importing each plugin's error type. */\nconst causeDetail = (cause: unknown): string => {\n\tif (cause !== null && typeof cause === 'object') {\n\t\tconst c = cause as {\n\t\t\treadonly message?: unknown;\n\t\t\treadonly reason?: unknown;\n\t\t\treadonly _tag?: unknown;\n\t\t};\n\t\tif (typeof c.message === 'string' && c.message.length > 0) return c.message;\n\t\tif (typeof c.reason === 'string' && c.reason.length > 0) return c.reason;\n\t\tif (typeof c._tag === 'string' && c._tag.length > 0) return c._tag;\n\t}\n\treturn String(cause);\n};\nconst faucetCauseDetail = causeDetail;\nconst fundingCauseDetail = causeDetail;\n\nconst str = (v: unknown): string | null => (typeof v === 'string' ? v : null);\nconst strReq = (v: unknown): string => (typeof v === 'string' ? v : '');\nconst num = (v: unknown): number | null => (typeof v === 'number' && Number.isFinite(v) ? v : null);\nconst bool = (v: unknown): boolean => v === true;\n\n/** Filter the generic resolved values down to those whose resource id\n * matches a predicate, in graph order. Returns the `{ pluginKey, value }`\n * the shaping functions consume. */\nconst matching = (\n\tvalues: ReadonlyArray<ControlPlaneResolvedValue>,\n\tmatches: (resourceId: string) => boolean,\n): ReadonlyArray<ControlPlaneResolvedValue> => values.filter((v) => matches(v.id));\n\n// -----------------------------------------------------------------------------\n// Postgres wire-protocol stats via `psql` exec inside the container\n// -----------------------------------------------------------------------------\n\n/** SQL that emits a single line of JSON the dashboard can parse without a\n * PG client. Keeps the round trip to one exec. */\nconst PG_STATS_SQL = `SELECT json_build_object(\n 'db_bytes', pg_database_size(current_database()),\n 'connections', (SELECT count(*) FROM pg_stat_activity WHERE datname = current_database()),\n 'tables', COALESCE((\n SELECT json_agg(t) FROM (\n SELECT schemaname AS schema, relname AS name,\n n_live_tup AS row_estimate,\n pg_total_relation_size(relid) AS total_bytes\n FROM pg_stat_user_tables\n ORDER BY pg_total_relation_size(relid) DESC\n LIMIT 200\n ) t\n ), '[]'::json)\n)`;\n\nconst parsePgStats = (\n\tpluginKey: string,\n\tpg: PostgresShape,\n\tstdout: string,\n): DashboardPostgresStats => {\n\tconst database = strReq((pg.databases ?? [])[0]) || 'postgres';\n\tconst host = str(pg.networkAlias) ?? 'postgres';\n\tconst port = num(pg.port) ?? 5432;\n\tconst plainUrl = `postgres://${host}:${port}`;\n\tconst base = {\n\t\tpluginKey,\n\t\tdatabase,\n\t\tplainUrl,\n\t} as const;\n\ttry {\n\t\tconst trimmed = stdout.trim();\n\t\tconst parsed = JSON.parse(trimmed) as {\n\t\t\tdb_bytes?: number;\n\t\t\tconnections?: number;\n\t\t\ttables?: ReadonlyArray<{\n\t\t\t\tschema?: string;\n\t\t\t\tname?: string;\n\t\t\t\trow_estimate?: number;\n\t\t\t\ttotal_bytes?: number;\n\t\t\t}>;\n\t\t};\n\t\tconst tables: DashboardPostgresTable[] = (parsed.tables ?? []).map((t) => ({\n\t\t\tschema: t.schema ?? 'public',\n\t\t\tname: t.name ?? '',\n\t\t\trowEstimate: num(t.row_estimate) ?? 0,\n\t\t\ttotalBytes: num(t.total_bytes) ?? 0,\n\t\t}));\n\t\treturn {\n\t\t\t...base,\n\t\t\tdatabaseBytes: num(parsed.db_bytes) ?? 0,\n\t\t\tconnectionCount: num(parsed.connections) ?? 0,\n\t\t\ttables,\n\t\t\tavailable: true,\n\t\t\tdetail: null,\n\t\t};\n\t} catch (cause) {\n\t\treturn {\n\t\t\t...base,\n\t\t\tdatabaseBytes: 0,\n\t\t\tconnectionCount: 0,\n\t\t\ttables: [],\n\t\t\tavailable: false,\n\t\t\tdetail: `failed to parse psql output: ${String(cause)}`,\n\t\t};\n\t}\n};\n\nconst unavailablePgStats = (\n\tpluginKey: string,\n\tpg: PostgresShape,\n\tdetail: string,\n): DashboardPostgresStats => {\n\tconst database = strReq((pg.databases ?? [])[0]) || 'postgres';\n\tconst host = str(pg.networkAlias) ?? 'postgres';\n\tconst port = num(pg.port) ?? 5432;\n\treturn {\n\t\tpluginKey,\n\t\tdatabase,\n\t\tplainUrl: `postgres://${host}:${port}`,\n\t\tdatabaseBytes: 0,\n\t\tconnectionCount: 0,\n\t\ttables: [],\n\t\tavailable: false,\n\t\tdetail,\n\t};\n};\n\n// -----------------------------------------------------------------------------\n// Builder\n// -----------------------------------------------------------------------------\n\nexport interface DashboardDomainDeps {\n\t/** The generic, name-blind control-plane domain (resolved values). */\n\treadonly control: ControlPlaneDomain;\n\t/** Stack identity, used for the postgres container label probe. */\n\treadonly identity: Identity;\n\t/** Container runtime for the Postgres `psql` exec-probe. `null` in bare\n\t * test paths; `postgresStats` degrades to an unavailable entry then. */\n\treadonly containerRuntime: ContainerRuntime | null;\n\t/** The scope-local strategy registry — the SAME registry the boot-time\n\t * account funding pass dispatches through (`plugins/account/funding.ts`).\n\t * Drives `fundableCoins` + `fundAccount`: SUI via `faucet:request:<chainId>`,\n\t * WAL/DEEP via `coinType:<fullCoinType>`. `null` in bare test paths; the\n\t * fund accessors degrade to unavailable then. */\n\treadonly strategyRegistry: StrategyRegistry | null;\n}\n\nexport const buildDashboardDomain = (deps: DashboardDomainDeps): DashboardDomain => {\n\tconst { control, identity, containerRuntime, strategyRegistry } = deps;\n\n\tconst mode: DashboardDomain['mode'] = control.resolvedValues.pipe(\n\t\tEffect.map((values) => {\n\t\t\tconst sui = matching(values, (id) => id === 'sui')[0];\n\t\t\tif (sui === undefined) return null;\n\t\t\tconst m = (sui.value as SuiShape).mode;\n\t\t\tswitch (m) {\n\t\t\t\tcase 'fork':\n\t\t\t\t\treturn 'fork';\n\t\t\t\tcase 'live':\n\t\t\t\t\treturn 'live';\n\t\t\t\tcase 'local':\n\t\t\t\tcase 'local-rpc':\n\t\t\t\t\treturn 'local';\n\t\t\t\tdefault:\n\t\t\t\t\treturn null;\n\t\t\t}\n\t\t}),\n\t);\n\n\tconst deepbook: DashboardDomain['deepbook'] = control.resolvedValues.pipe(\n\t\tEffect.map((values) =>\n\t\t\tmatching(values, (id) => id.startsWith('deepbook/')).map(\n\t\t\t\t({ pluginKey, value }): DashboardDeepbookInfo => {\n\t\t\t\t\tconst v = value as DeepbookShape;\n\t\t\t\t\tconst modeRaw = v.mode;\n\t\t\t\t\tconst dbMode =\n\t\t\t\t\t\tmodeRaw === 'override' ? 'override' : modeRaw === 'known' ? 'known' : 'local';\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpluginKey,\n\t\t\t\t\t\tname: pluginKey.replace(/^deepbook:/, ''),\n\t\t\t\t\t\tmode: dbMode,\n\t\t\t\t\t\tchain: strReq(v.chain),\n\t\t\t\t\t\tpackageId: strReq(v.packageId),\n\t\t\t\t\t\tregistryId: strReq(v.registryId),\n\t\t\t\t\t\tadminCapId: str(v.adminCapId),\n\t\t\t\t\t\tdeepTreasuryId: str(v.deepTreasuryId),\n\t\t\t\t\t\tpools: (v.pools ?? []).map((p) => ({\n\t\t\t\t\t\t\tname: strReq(p.name),\n\t\t\t\t\t\t\tpoolId: strReq(p.poolId),\n\t\t\t\t\t\t\tbaseCoinType: strReq(p.baseCoinType),\n\t\t\t\t\t\t\tquoteCoinType: strReq(p.quoteCoinType),\n\t\t\t\t\t\t})),\n\t\t\t\t\t\tmarketMakerRunning: bool(v.marketMakerRunning),\n\t\t\t\t\t\tserverUrl: str(v.serverUrl),\n\t\t\t\t\t\tindexerUrl: str(v.indexerUrl),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t);\n\n\tconst seal: DashboardDomain['seal'] = control.resolvedValues.pipe(\n\t\tEffect.map((values) =>\n\t\t\tmatching(values, (id) => id.startsWith('seal:')).map(\n\t\t\t\t({ pluginKey, value }): DashboardSealInfo => {\n\t\t\t\t\tconst v = value as SealShape;\n\t\t\t\t\tconst sealMode =\n\t\t\t\t\t\tv.mode === 'live' ? 'live' : v.mode === 'fork-known' ? 'fork-known' : 'local-keygen';\n\t\t\t\t\tconst keyServers = (v.serverConfigs ?? []).map((c) => ({\n\t\t\t\t\t\tobjectId: strReq(c.objectId),\n\t\t\t\t\t\tweight: num(c.weight) ?? 1,\n\t\t\t\t\t}));\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpluginKey,\n\t\t\t\t\t\tmode: sealMode,\n\t\t\t\t\t\tobjectId: strReq(v.objectId),\n\t\t\t\t\t\tkeyServerUrl: strReq(v.keyServerUrl),\n\t\t\t\t\t\tkeyServers,\n\t\t\t\t\t\tthreshold: keyServers.length,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t);\n\n\tconst coinCaps: DashboardDomain['coinCaps'] = control.resolvedValues.pipe(\n\t\tEffect.map((values) =>\n\t\t\tmatching(values, (id) => id.startsWith('coin:')).map(\n\t\t\t\t({ pluginKey, value }): DashboardCoinCap => {\n\t\t\t\t\tconst v = value as CoinShape;\n\t\t\t\t\tconst source =\n\t\t\t\t\t\tv.source === 'registry' ? 'registry' : v.source === 'builtin' ? 'builtin' : 'on-chain';\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpluginKey,\n\t\t\t\t\t\tsymbol: str(v.symbol),\n\t\t\t\t\t\tfullCoinType: strReq(v.fullCoinType),\n\t\t\t\t\t\tdecimals: num(v.decimals) ?? 0,\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\ttreasuryCapId: str(v.treasuryCapId),\n\t\t\t\t\t\tpackageId: str(v.packageId),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t);\n\n\t// Mint ACTION — drives the dashboard Coins panel's Mint button.\n\t//\n\t// Signer source: the resolved coin VALUE carries a self-contained\n\t// `mintFromCap` closure (present only for witness-form coins whose\n\t// publisher still owns the TreasuryCap). That closure already captures\n\t// the treasury-cap-owning publisher `MintSigner` + the resolved cap id\n\t// in-process — the same lease-owning path `coin/service.ts`'s\n\t// `fundingStrategy` uses — so we mint WITHOUT threading a signer through\n\t// this seam (we read the resolved value, never plugin internals).\n\t//\n\t// Never fails (`E = never`): every reject path (bad address, non-\n\t// positive amount, no matching coin, cap-not-owned, on-chain failure)\n\t// degrades to `{ ok: false, detail, digest: null }` so the dashboard\n\t// query can't be taken down by a single bad mint.\n\tconst mintCoin: DashboardDomain['mintCoin'] = (input) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst recipient = input.recipient.trim();\n\t\t\tif (!SUI_ADDRESS_RE.test(recipient)) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail: `invalid recipient '${input.recipient}': expected a 0x-prefixed Sui address`,\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardMintResult;\n\t\t\t}\n\t\t\tif (!isPositiveIntegerString(input.amountBaseUnits)) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail: `invalid amountBaseUnits '${input.amountBaseUnits}': expected a positive integer string`,\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardMintResult;\n\t\t\t}\n\n\t\t\t// Locate the resolved coin whose fullCoinType matches. Match on the\n\t\t\t// resolved value's `fullCoinType` (the stable on-chain type), not the\n\t\t\t// resource-id prefix, so callers pass the same `coinType` the\n\t\t\t// `coinCaps` query surfaced.\n\t\t\tconst values = yield* control.resolvedValues;\n\t\t\tconst match = matching(values, (id) => id.startsWith('coin:'))\n\t\t\t\t.map(({ value }) => value as CoinShape)\n\t\t\t\t.find((v) => strReq(v.fullCoinType) === input.coinType);\n\n\t\t\tif (match === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail: `no resolved coin found for type '${input.coinType}'`,\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardMintResult;\n\t\t\t}\n\t\t\tif (typeof match.mintFromCap !== 'function') {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t`coin '${input.coinType}' has no in-process treasury cap signer — ` +\n\t\t\t\t\t\t'mint is only available for local-package coins whose publisher still owns the TreasuryCap',\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardMintResult;\n\t\t\t}\n\n\t\t\treturn yield* match\n\t\t\t\t.mintFromCap({ to: recipient, amount: BigInt(input.amountBaseUnits) })\n\t\t\t\t.pipe(\n\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t(r): DashboardMintResult => ({\n\t\t\t\t\t\t\tok: true,\n\t\t\t\t\t\t\tdetail: `minted ${input.amountBaseUnits} of ${input.coinType} to ${recipient}`,\n\t\t\t\t\t\t\tdigest: r.digest,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\t// Typed coin/artifact-publisher failures carry `.message`.\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.succeed<DashboardMintResult>({\n\t\t\t\t\t\t\tok: false,\n\t\t\t\t\t\t\tdetail:\n\t\t\t\t\t\t\t\ttypeof cause?.message === 'string'\n\t\t\t\t\t\t\t\t\t? cause.message\n\t\t\t\t\t\t\t\t\t: `mint failed: ${String(cause)}`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\t// Residual defects (interrupts, unexpected throws) — degrade\n\t\t\t\t\t// rather than crash the dashboard query.\n\t\t\t\t\tEffect.catchCause((cause) =>\n\t\t\t\t\t\tEffect.succeed<DashboardMintResult>({\n\t\t\t\t\t\t\tok: false,\n\t\t\t\t\t\t\tdetail: `mint crashed: ${String(cause)}`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t});\n\n\t// --- Fund ACTION + fundable-coin derivation ------------------------\n\t//\n\t// Reuses devstack's IN-PROCESS funding strategies — the same strategy\n\t// registry the boot-time account funding pass dispatches through\n\t// (`plugins/account/funding.ts`). We never re-implement signing or the\n\t// exchange/pool swaps:\n\t//\n\t// - SUI (absent / canonical type) → `faucet:request:<chainId>`. The SUI\n\t// faucet strategy takes `{ address, amount }` only (no account handle)\n\t// and is FIXED-AMOUNT (the standard faucet ignores `amount`). Recipient\n\t// may be ANY 0x address.\n\t// - WAL/DEEP → `coinType:<fullCoinType>`. The strategy takes\n\t// `{ address, amount, account }` and runs an account-signed swap, so\n\t// the recipient MUST be a resolved account in the stack (we match the\n\t// recipient address against the resolved `account/<name>` values and\n\t// pass the live `AccountValue` as `req.account`).\n\t//\n\t// Never fails (`E = never`): every reject path degrades to\n\t// `{ ok:false, detail }` so a single bad fund can't take down the query.\n\n\t/** The chain id the SUI funding path keys on, read from the resolved sui\n\t * value (same `chain` field the sui codegen/snapshot decls stamp). */\n\tconst readChainId = control.resolvedValues.pipe(\n\t\tEffect.map((values) => {\n\t\t\tconst sui = matching(values, (id) => id === 'sui')[0];\n\t\t\treturn sui === undefined ? null : str((sui.value as SuiShape).chain);\n\t\t}),\n\t);\n\n\tconst fundableCoins: DashboardDomain['fundableCoins'] = Effect.gen(function* () {\n\t\t// SUI is always fundable when a faucet strategy is registered for the\n\t\t// active chain; the fixed-amount faucet ignores the requested amount.\n\t\tconst out: DashboardFundableCoin[] = [];\n\t\tif (strategyRegistry === null) return out;\n\n\t\tconst chain = yield* readChainId;\n\t\tconst keys = yield* strategyRegistry.list();\n\t\tif (chain !== null && keys.includes(faucetCapabilityKeyFor(chain))) {\n\t\t\tout.push({\n\t\t\t\tsymbol: 'SUI',\n\t\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t\t\thonorsAmount: false,\n\t\t\t\trequiresAccountSigner: false,\n\t\t\t});\n\t\t}\n\n\t\t// A coin is fundable iff a `coinType:<fullCoinType>` strategy is actually\n\t\t// registered (the walrus/deepbook/coin plugin contributed one). Derive the\n\t\t// display symbol from the coin type's module path (`::wal::WAL` → WAL,\n\t\t// `::deep::DEEP` → DEEP) so we stay name-blind on the coin VALUE while\n\t\t// still labeling the pill. `requiresAccountSigner` is read from the\n\t\t// strategy's own `requiresRecipientAccount` flag — NOT assumed true for\n\t\t// every coin: WAL/DEEP swaps spend the recipient's SUI (true), but a\n\t\t// managed-coin MINT strategy transfers to a passive recipient (false), so\n\t\t// it can fund any 0x address.\n\t\tfor (const key of keys) {\n\t\t\tif (!key.startsWith('coinType:')) continue;\n\t\t\tconst coinType = key.slice('coinType:'.length);\n\t\t\tif (coinType === SUI_FULL_COIN_TYPE) continue;\n\t\t\tconst strategy = yield* strategyRegistry\n\t\t\t\t.get<typeof key, AccountFundingStrategy<unknown, AccountValue>>(key)\n\t\t\t\t.pipe(Effect.catchTag('StrategyNotFoundError', () => Effect.succeed(null)));\n\t\t\tout.push({\n\t\t\t\tsymbol: coinSymbolFromType(coinType),\n\t\t\t\tcoinType,\n\t\t\t\thonorsAmount: true,\n\t\t\t\trequiresAccountSigner: strategy?.requiresRecipientAccount ?? false,\n\t\t\t});\n\t\t}\n\t\treturn out;\n\t});\n\n\tconst fundAccount: DashboardDomain['fundAccount'] = (input) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst recipient = input.recipient.trim();\n\t\t\tif (!SUI_ADDRESS_RE.test(recipient)) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail: `invalid recipient '${input.recipient}': expected a 0x-prefixed Sui address`,\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t}\n\t\t\tif (strategyRegistry === null) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail: 'funding unavailable: no strategy registry wired',\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t}\n\n\t\t\tconst coinType = input.coinType?.trim() ?? '';\n\t\t\tconst isSui = coinType === '' || coinType === SUI_FULL_COIN_TYPE;\n\n\t\t\t// SUI path — chain faucet strategy. Fixed-amount: we pass a nominal\n\t\t\t// amount but the standard faucet ignores it. Recipient may be any\n\t\t\t// 0x address (no account handle required).\n\t\t\tif (isSui) {\n\t\t\t\tconst chain = yield* readChainId;\n\t\t\t\tif (chain === null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tok: false,\n\t\t\t\t\t\tdetail: 'cannot fund SUI: no resolved sui plugin / chain id in this stack',\n\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t\t}\n\t\t\t\tconst key = faucetCapabilityKeyFor(chain);\n\t\t\t\tconst strategy = yield* strategyRegistry\n\t\t\t\t\t.get<typeof key, FaucetStrategy>(key)\n\t\t\t\t\t.pipe(Effect.catchTag('StrategyNotFoundError', () => Effect.succeed(null)));\n\t\t\t\tif (strategy === null) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tok: false,\n\t\t\t\t\t\tdetail: `no SUI faucet strategy registered for chain '${chain}'`,\n\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t\t}\n\t\t\t\t// `amount` is nominal — the standard faucet grant is fixed and\n\t\t\t\t// ignores it. Default to 1 SUI in MIST so a strategy that DID\n\t\t\t\t// honor it lands a sane value.\n\t\t\t\tconst amount = parseAmount(input.amountBaseUnits) ?? 1_000_000_000n;\n\t\t\t\treturn yield* strategy.request({ address: recipient, amount }).pipe(\n\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t(): DashboardFundResult => ({\n\t\t\t\t\t\t\tok: true,\n\t\t\t\t\t\t\tdetail: `requested SUI for ${recipient} (fixed-amount faucet grant)`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.succeed<DashboardFundResult>({\n\t\t\t\t\t\t\tok: false,\n\t\t\t\t\t\t\tdetail: `SUI faucet request failed: ${faucetCauseDetail(cause)}`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.catchCause((cause) =>\n\t\t\t\t\t\tEffect.succeed<DashboardFundResult>({\n\t\t\t\t\t\t\tok: false,\n\t\t\t\t\t\t\tdetail: `SUI faucet request crashed: ${String(cause)}`,\n\t\t\t\t\t\t\tdigest: null,\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\t// WAL/DEEP path — coin-specific account-signed funding strategy.\n\t\t\tconst amount = parseAmount(input.amountBaseUnits);\n\t\t\tif (amount === null) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail: `invalid amountBaseUnits '${input.amountBaseUnits ?? ''}': expected a positive integer string`,\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t}\n\n\t\t\tconst key = `coinType:${coinType}` as const;\n\t\t\tconst strategy = yield* strategyRegistry\n\t\t\t\t.get<typeof key, AccountFundingStrategy<unknown, AccountValue>>(key)\n\t\t\t\t.pipe(Effect.catchTag('StrategyNotFoundError', () => Effect.succeed(null)));\n\t\t\tif (strategy === null) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t`no funding strategy registered for coin '${coinType}' — ` +\n\t\t\t\t\t\t'WAL needs the walrus plugin (with an exchange) and DEEP needs the deepbook plugin',\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t}\n\n\t\t\t// Match the recipient to a resolved account, if one holds this address.\n\t\t\tconst values = yield* control.resolvedValues;\n\t\t\tconst account = matching(values, (id) => id.startsWith('account/'))\n\t\t\t\t.map(({ value }) => value as AccountShape)\n\t\t\t\t.find((v) => str(v.address) === recipient);\n\n\t\t\t// Account-spending strategies (WAL/DEEP) swap the recipient's OWN SUI,\n\t\t\t// so the recipient must BE a resolved account with a signer. Mint-style\n\t\t\t// strategies (managed coins) transfer to a passive recipient, so any 0x\n\t\t\t// address is fine — gate the rejection on the strategy's flag, not on\n\t\t\t// the coin being non-SUI.\n\t\t\tif (strategy.requiresRecipientAccount === true && account === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdetail:\n\t\t\t\t\t\t`coin '${coinType}' is funded by an account-signed swap, but '${recipient}' ` +\n\t\t\t\t\t\t'is not a resolved account in this stack — fund a configured account (the swap spends its SUI)',\n\t\t\t\t\tdigest: null,\n\t\t\t\t} satisfies DashboardFundResult;\n\t\t\t}\n\n\t\t\treturn yield* strategy\n\t\t\t\t.request({\n\t\t\t\t\taddress: recipient,\n\t\t\t\t\tamount,\n\t\t\t\t\t...(account === undefined ? {} : { account: account as unknown as AccountValue }),\n\t\t\t\t})\n\t\t\t\t.pipe(\n\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t(): DashboardFundResult => ({\n\t\t\t\t\t\t\tok: true,\n\t\t\t\t\t\t\tdetail: `funded ${amount} base units of ${coinType} to ${recipient}`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\t\tEffect.succeed<DashboardFundResult>({\n\t\t\t\t\t\t\tok: false,\n\t\t\t\t\t\t\tdetail: `${coinSymbolFromType(coinType)} funding failed: ${fundingCauseDetail(cause)}`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.catchCause((cause) =>\n\t\t\t\t\t\tEffect.succeed<DashboardFundResult>({\n\t\t\t\t\t\t\tok: false,\n\t\t\t\t\t\t\tdetail: `${coinSymbolFromType(coinType)} funding crashed: ${String(cause)}`,\n\t\t\t\t\t\t\tdigest: null,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t});\n\n\tconst postgresStats: DashboardDomain['postgresStats'] = Effect.gen(function* () {\n\t\tconst values = yield* control.resolvedValues;\n\t\tconst instances = matching(values, (id) => id === 'postgres');\n\t\tif (instances.length === 0) return [];\n\t\tconst out: DashboardPostgresStats[] = [];\n\t\tfor (const { pluginKey, value } of instances) {\n\t\t\tconst pg = value as PostgresShape;\n\t\t\tif (containerRuntime === null) {\n\t\t\t\tout.push(unavailablePgStats(pluginKey, pg, 'container runtime unavailable'));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst database = strReq((pg.databases ?? [])[0]) || 'postgres';\n\t\t\tconst pgUser = str(pg.user) ?? 'postgres';\n\t\t\tconst role = str(pg.name) ?? 'postgres';\n\t\t\tconst probe = Effect.gen(function* () {\n\t\t\t\tconst handles = yield* containerRuntime.inspectByLabels({\n\t\t\t\t\tapp: String(identity.app),\n\t\t\t\t\tstack: String(identity.stack),\n\t\t\t\t\tplugin: 'postgres',\n\t\t\t\t\trole,\n\t\t\t\t});\n\t\t\t\tconst running = handles.find((h) => h.status === 'running') ?? handles[0];\n\t\t\t\tif (running === undefined) {\n\t\t\t\t\treturn unavailablePgStats(pluginKey, pg, 'no running postgres container found');\n\t\t\t\t}\n\t\t\t\tconst result = yield* containerRuntime.exec(running, [\n\t\t\t\t\t'psql',\n\t\t\t\t\t'-U',\n\t\t\t\t\tpgUser,\n\t\t\t\t\t'-d',\n\t\t\t\t\tdatabase,\n\t\t\t\t\t'-tAc',\n\t\t\t\t\tPG_STATS_SQL,\n\t\t\t\t]);\n\t\t\t\tif (result.exitCode !== 0) {\n\t\t\t\t\treturn unavailablePgStats(\n\t\t\t\t\t\tpluginKey,\n\t\t\t\t\t\tpg,\n\t\t\t\t\t\t`psql exited ${result.exitCode}: ${result.stderr.trim().slice(0, 200)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn parsePgStats(pluginKey, pg, result.stdout);\n\t\t\t});\n\t\t\tconst stats = yield* probe.pipe(\n\t\t\t\tEffect.catchCause((cause) =>\n\t\t\t\t\tEffect.succeed(unavailablePgStats(pluginKey, pg, String(cause))),\n\t\t\t\t),\n\t\t\t);\n\t\t\tout.push(stats);\n\t\t}\n\t\treturn out;\n\t});\n\n\treturn {\n\t\tmode,\n\t\tdeepbook,\n\t\tseal,\n\t\tcoinCaps,\n\t\tpostgresStats,\n\t\tmintCoin,\n\t\tfundableCoins,\n\t\tfundAccount,\n\t};\n};\n\n/** An all-empty dashboard domain. Used by tests that exercise the\n * schema/server without a live registry. Every accessor resolves to\n * empty/`null`. */\nexport const emptyDashboardDomain: DashboardDomain = {\n\tmode: Effect.succeed(null),\n\tdeepbook: Effect.succeed([]),\n\tseal: Effect.succeed([]),\n\tcoinCaps: Effect.succeed([]),\n\tpostgresStats: Effect.succeed([]),\n\tmintCoin: () => Effect.succeed({ ok: false, detail: 'unavailable', digest: null }),\n\tfundableCoins: Effect.succeed([]),\n\tfundAccount: () => Effect.succeed({ ok: false, detail: 'unavailable', digest: null }),\n};\n"],"mappings":"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"}
@@ -0,0 +1,29 @@
1
+ import { AnyPlugin } from "../../substrate/plugin.mjs";
2
+ //#region src/plugins/dashboard/index.d.ts
3
+ interface DashboardOptions {
4
+ /** Preferred loopback port; the broker forward-scans if it's busy. */
5
+ readonly port?: number;
6
+ /** NIC the HTTP server binds. Defaults to `'0.0.0.0'` because the router
7
+ * runs in Docker and must reach this host process through the host-gateway
8
+ * address on native Linux (a `127.0.0.1`-only listener is unreachable from
9
+ * the host-gateway IP). The public dashboard URL stays router-fronted and
10
+ * stack-scoped. */
11
+ readonly bindAddress?: string;
12
+ /** Extra origins merged on top of the dashboard's own router-fronted origin
13
+ * for this stack (and the direct loopback origins). Useful for headless
14
+ * test runners and custom dev hosts. The dashboard does NOT auto-allowlist
15
+ * a bare `*.localhost` form — that is not stack-scoped, so a sibling stack
16
+ * could drive the destructive control-plane mutations cross-origin. */
17
+ readonly allowedOrigins?: ReadonlyArray<string>;
18
+ }
19
+ interface DashboardValue {
20
+ /** Loopback URL of the dashboard server. */
21
+ readonly url: string;
22
+ /** The allocated loopback port. */
23
+ readonly localPort: number;
24
+ }
25
+ /** Construct the devstack dashboard plugin. */
26
+ declare function dashboard(opts?: DashboardOptions): AnyPlugin;
27
+ //#endregion
28
+ export { DashboardOptions, DashboardValue, dashboard };
29
+ //# sourceMappingURL=index.d.mts.map