@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":"codegen.mjs","names":[],"sources":["../../../src/plugins/account/codegen.ts"],"sourcesContent":["// Account plugin — Codegenable contribution.\n//\n// Architecture §6 + 12-account.md \"Cross-component references\":\n// Codegen emits a constant address map keyed by account name so\n// downstream code can `import { accounts } from '<staged>/accounts'`\n// and read `accounts.alice.address` at the type level.\n//\n// Distilled-doc tension (12-account.md \"publicKey caveat\"):\n// impersonation accounts have a zero-buffer publicKey — emitting it\n// into the codegen bindings would be a type-level lie. The emitted\n// shape below carries the `source` discriminator INSTEAD of\n// publicKey; consumers branch on `source: 'impersonate'` rather than\n// publicKey-truthiness.\n//\n// SAFETY: the codegen output never emits secret material. Only the\n// `name`, `address`, `scheme`, and `source` fields land on disk.\n// `sensitive: false` is correct because none of these are secret.\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\n/** The typed shape the emitted file exports. Per-account record keyed\n * by name. */\nexport interface AccountBindings {\n\treadonly name: string;\n\treadonly address: string;\n\treadonly scheme: 'ed25519' | 'secp256k1' | 'secp256r1';\n\treadonly source: 'real' | 'impersonate';\n}\n\n/** Construct the Codegenable contribution. One emit per account.\n *\n * The emitter name is `account/${name}` (literal) so multiple\n * accounts in a single stack get co-located but typed-distinct\n * emissions; the codegen orchestrator can fold them into a single\n * `accounts` namespace at staging time. */\nexport const makeAccountCodegen = <Name extends string>(parts: {\n\treadonly name: Name;\n\treadonly resolved: AccountBindings;\n}): CodegenableDecl<`account/${Name}`> => ({\n\tkind: 'codegenable',\n\temitterName: `account/${parts.name}` as `account/${Name}`,\n\toutputPath: `accounts/${parts.name}.ts`,\n\tsensitive: false,\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\tctx.exportConst(parts.name, parts.resolved);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;;;;;;;AAqCA,MAAa,sBAA2C,WAGb;CAC1C,MAAM;CACN,aAAa,WAAW,MAAM;CAC9B,YAAY,YAAY,MAAM,KAAK;CACnC,WAAW;CACX,OAAO,QACN,OAAO,WAAW;AACjB,MAAI,YAAY,MAAM,MAAM,MAAM,SAAS;AAC3C,SAAO,IAAI,MAAM;GAChB;CACH"}
1
+ {"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/account/codegen.ts"],"sourcesContent":["// Account plugin — Codegenable contribution.\n//\n// Architecture §6 + 12-account.md \"Cross-component references\":\n// Codegen emits a constant address map keyed by account name so\n// downstream code can `import { accounts } from '<staged>/accounts'`\n// and read `accounts.alice.address` at the type level.\n//\n// Distilled-doc tension (12-account.md \"publicKey caveat\"):\n// impersonation accounts have a zero-buffer publicKey — emitting it\n// into the codegen bindings would be a type-level lie. The emitted\n// shape below carries the `source` discriminator INSTEAD of\n// publicKey; consumers branch on `source: 'impersonate'` rather than\n// publicKey-truthiness.\n//\n// SAFETY: the codegen output never emits secret material. Only the\n// `name`, `address`, `scheme`, and `source` fields land on disk.\n// `sensitive: false` is correct because none of these are secret.\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nimport { defineSimpleConstExport } from '../internal/codegen-helpers.ts';\n\n/** The typed shape the emitted file exports. Per-account record keyed\n * by name. */\nexport interface AccountBindings {\n\treadonly name: string;\n\treadonly address: string;\n\treadonly scheme: 'ed25519' | 'secp256k1' | 'secp256r1';\n\treadonly source: 'real' | 'impersonate';\n}\n\n/** Construct the Codegenable contribution. One emit per account.\n *\n * The emitter name is `account/${name}` (literal) so multiple\n * accounts in a single stack get co-located but typed-distinct\n * emissions; the codegen orchestrator can fold them into a single\n * `accounts` namespace at staging time. */\nexport const makeAccountCodegen = <Name extends string>(parts: {\n\treadonly name: Name;\n\treadonly resolved: AccountBindings;\n}): CodegenableDecl<`account/${Name}`> =>\n\tdefineSimpleConstExport({\n\t\temitterName: `account/${parts.name}` as `account/${Name}`,\n\t\toutputPath: `accounts/${parts.name}.ts`,\n\t\texportName: parts.name,\n\t\tvalue: parts.resolved,\n\t\taggregate: {\n\t\t\tkind: 'account',\n\t\t\tbucket: 'accounts.ts',\n\t\t\t// Pass-through: this decl's exported map already keys by\n\t\t\t// account name, which is the aggregate's merge key.\n\t\t\tproject: (exported) => exported,\n\t\t},\n\t});\n"],"mappings":";;;;;;;;AAqCA,MAAa,sBAA2C,UAIvD,wBAAwB;CACvB,aAAa,WAAW,MAAM;CAC9B,YAAY,YAAY,MAAM,KAAK;CACnC,YAAY,MAAM;CAClB,OAAO,MAAM;CACb,WAAW;EACV,MAAM;EACN,QAAQ;EAGR,UAAU,aAAa;EACvB;CACD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  //#region src/plugins/account/errors.d.ts
2
2
  /** Phases for `AccountAcquireError`. Closed sum — adding a phase
3
3
  * requires editing this list AND the cause-walker's display table. */
4
- type AccountAcquirePhase = 'validate-name' | 'load-keystore' | 'read-env' | 'decode-inline' | 'bind-signer' | 'bind-impersonation-slot' | 'generate-keypair' | 'persist-keypair' | 'read-persisted-keypair' | 'restrict-permissions' | 'derive-address' | 'unsupported-scheme' | 'await-chain-ready' | 'fund-default' | 'fund-cross-cutting' | 'register';
4
+ type AccountAcquirePhase = 'validate-name' | 'validate-funding' | 'load-keystore' | 'read-env' | 'decode-inline' | 'bind-signer' | 'bind-impersonation-slot' | 'generate-keypair' | 'persist-keypair' | 'read-persisted-keypair' | 'restrict-permissions' | 'derive-address' | 'unsupported-scheme' | 'await-chain-ready' | 'fund-default' | 'fund-cross-cutting' | 'register';
5
5
  /** Account acquisition error — raised by the variant resolvers and
6
6
  * the funding pass. Carries the per-variant + per-phase column. */
7
7
  interface AccountAcquireError {
@@ -13,11 +13,38 @@ interface AccountAcquireError {
13
13
  readonly hint?: string;
14
14
  readonly cause?: unknown;
15
15
  }
16
- /** Phases for `AccountSignError`. The "sign-and-execute" surface is
17
- * the canonical entry point; the impersonation refusal lives here
18
- * so a synchronous throw maps cleanly onto an async catch boundary
19
- * when callers wrap the resolved-account signer in `Effect.try`. */
20
- type AccountSignPhase = 'build-tx' | 'sign' | 'submit' | 'await-finality' | 'dependent-package-not-found' | 'lease-acquire' | 'impersonation-bypass-attempt';
16
+ /** Phases for `AccountSignError`. Strictly transport / lifecycle
17
+ * failures along the sign-and-execute pipeline `signAndExecute`
18
+ * itself returns a `SignAndExecuteResult` discriminated union for
19
+ * the on-chain outcome (success vs `FailedTransaction`), so
20
+ * on-chain failures are NOT in this phase set. The impersonation
21
+ * refusal lives here so a synchronous throw maps cleanly onto an
22
+ * async catch boundary when callers wrap the resolved-account
23
+ * signer in `Effect.try`.
24
+ *
25
+ * - `build-tx` — transaction serialisation threw before
26
+ * signing.
27
+ * - `sign` — the signer rejected / threw.
28
+ * - `submit` — `executeTransaction` transport failure
29
+ * (RPC unreachable, network error). The
30
+ * response never arrived.
31
+ * - `no-digest` — `executeTransaction` returned a response
32
+ * that violates the SDK envelope contract
33
+ * (`$kind` missing OR `Transaction.digest`
34
+ * missing OR `FailedTransaction.digest`
35
+ * missing). Protocol violation, not a
36
+ * transport failure — kept distinct so
37
+ * `'submit'` keeps a single failure-kind
38
+ * (per §2 "phases describe steps, not
39
+ * failure kinds").
40
+ * - `await-finality` — `waitForTransaction` failed AFTER a
41
+ * submit-success; the digest exists but the
42
+ * finality wait broke.
43
+ * - `dependent-package-not-found`
44
+ * - `lease-acquire`
45
+ * - `impersonation-bypass-attempt`
46
+ */
47
+ type AccountSignPhase = 'build-tx' | 'sign' | 'submit' | 'no-digest' | 'await-finality' | 'dependent-package-not-found' | 'lease-acquire' | 'impersonation-bypass-attempt';
21
48
  /** Account sign/execute error — raised by the per-account signer's
22
49
  * `signAndExecute` / `signTransaction` / `signPersonalMessage`
23
50
  * surfaces.
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/account/errors.ts"],"sourcesContent":["// Account plugin — typed errors.\n//\n// Distilled-doc finding (12-account.md \"Acquisition vs signing error\n// split\" invariant): two error families must not be mixed. Acquisition\n// errors (keystore unreadable, faucet exhausted, scheme unsupported)\n// surface as `AccountAcquireError`; signing errors (gRPC failure,\n// finality wait, locked-shared-object) surface as `AccountSignError`.\n// Mixing them breaks downstream `catchTag` boundaries — the engine's\n// pretty-cause walker also dispatches on `_tag`, so any merger here\n// would force a renderer-side branch on `phase` instead.\n//\n// Effect v4: plain interface + `_tag` literal discriminator (no\n// subclassing). The architecture's per-plugin tagged-error convention\n// (12-account.md \"Promote the sign/execute error to the same\n// tagged-error class shape\") is honored here — both errors are\n// uniform-shape, the cause walker handles them by `_tag`.\n\n/** Phases for `AccountAcquireError`. Closed sum — adding a phase\n * requires editing this list AND the cause-walker's display table. */\nexport type AccountAcquirePhase =\n\t| 'validate-name'\n\t| 'load-keystore'\n\t| 'read-env'\n\t| 'decode-inline'\n\t| 'bind-signer'\n\t| 'bind-impersonation-slot'\n\t| 'generate-keypair'\n\t| 'persist-keypair'\n\t| 'read-persisted-keypair'\n\t| 'restrict-permissions'\n\t| 'derive-address'\n\t| 'unsupported-scheme'\n\t| 'await-chain-ready'\n\t| 'fund-default'\n\t| 'fund-cross-cutting'\n\t| 'register';\n\n/** Account acquisition error — raised by the variant resolvers and\n * the funding pass. Carries the per-variant + per-phase column. */\nexport interface AccountAcquireError {\n\treadonly _tag: 'AccountAcquireError';\n\treadonly phase: AccountAcquirePhase;\n\treadonly accountName: string;\n\treadonly variant: AccountVariantKind;\n\treadonly message: string;\n\treadonly hint?: string;\n\treadonly cause?: unknown;\n}\n\nexport const accountAcquireError = (\n\tparts: Omit<AccountAcquireError, '_tag'>,\n): AccountAcquireError => ({ _tag: 'AccountAcquireError', ...parts });\n\n/** Phases for `AccountSignError`. The \"sign-and-execute\" surface is\n * the canonical entry point; the impersonation refusal lives here\n * so a synchronous throw maps cleanly onto an async catch boundary\n * when callers wrap the resolved-account signer in `Effect.try`. */\nexport type AccountSignPhase =\n\t| 'build-tx'\n\t| 'sign'\n\t| 'submit'\n\t| 'await-finality'\n\t| 'dependent-package-not-found'\n\t| 'lease-acquire'\n\t| 'impersonation-bypass-attempt';\n\n/** Account sign/execute error — raised by the per-account signer's\n * `signAndExecute` / `signTransaction` / `signPersonalMessage`\n * surfaces.\n *\n * Distilled-doc opportunity: today's implementation projects this to\n * JSON specially. Promoting to the uniform-shape interface here lets\n * the cause walker treat it like every other plugin's tagged error;\n * the special JSON-projection case can go away. */\nexport interface AccountSignError {\n\treadonly _tag: 'AccountSignError';\n\treadonly phase: AccountSignPhase;\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const accountSignError = (parts: Omit<AccountSignError, '_tag'>): AccountSignError => ({\n\t_tag: 'AccountSignError',\n\t...parts,\n});\n\n/** Account variant discriminator. Mirrors the user-facing\n * `AccountOptions` shape's `kind:` field. */\nexport type AccountVariantKind =\n\t| 'ephemeral'\n\t| 'keystore'\n\t| 'env'\n\t| 'inline'\n\t| 'signer'\n\t| 'impersonate';\n\n/** Union of every error an Account-plugin caller may encounter. */\nexport type AccountError = AccountAcquireError | AccountSignError;\n\n/** Error tags this plugin contributes — surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const ACCOUNT_ERROR_TAGS: ReadonlyArray<AccountError['_tag']> = [\n\t'AccountAcquireError',\n\t'AccountSignError',\n] as const;\n"],"mappings":";AAiDA,MAAa,uBACZ,WAC0B;CAAE,MAAM;CAAuB,GAAG;CAAO;AAgCpE,MAAa,oBAAoB,WAA6D;CAC7F,MAAM;CACN,GAAG;CACH;;;AAiBD,MAAa,qBAA0D,CACtE,uBACA,mBACA"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/account/errors.ts"],"sourcesContent":["// Account plugin — typed errors.\n//\n// Distilled-doc finding (12-account.md \"Acquisition vs signing error\n// split\" invariant): two error families must not be mixed. Acquisition\n// errors (keystore unreadable, faucet exhausted, scheme unsupported)\n// surface as `AccountAcquireError`; signing errors (gRPC failure,\n// finality wait, locked-shared-object) surface as `AccountSignError`.\n// Mixing them breaks downstream `catchTag` boundaries — the engine's\n// pretty-cause walker also dispatches on `_tag`, so any merger here\n// would force a renderer-side branch on `phase` instead.\n//\n// Effect v4: plain interface + `_tag` literal discriminator (no\n// subclassing). The architecture's per-plugin tagged-error convention\n// (12-account.md \"Promote the sign/execute error to the same\n// tagged-error class shape\") is honored here — both errors are\n// uniform-shape, the cause walker handles them by `_tag`.\n\n/** Phases for `AccountAcquireError`. Closed sum — adding a phase\n * requires editing this list AND the cause-walker's display table. */\nexport type AccountAcquirePhase =\n\t| 'validate-name'\n\t| 'validate-funding'\n\t| 'load-keystore'\n\t| 'read-env'\n\t| 'decode-inline'\n\t| 'bind-signer'\n\t| 'bind-impersonation-slot'\n\t| 'generate-keypair'\n\t| 'persist-keypair'\n\t| 'read-persisted-keypair'\n\t| 'restrict-permissions'\n\t| 'derive-address'\n\t| 'unsupported-scheme'\n\t| 'await-chain-ready'\n\t| 'fund-default'\n\t| 'fund-cross-cutting'\n\t| 'register';\n\n/** Account acquisition error — raised by the variant resolvers and\n * the funding pass. Carries the per-variant + per-phase column. */\nexport interface AccountAcquireError {\n\treadonly _tag: 'AccountAcquireError';\n\treadonly phase: AccountAcquirePhase;\n\treadonly accountName: string;\n\treadonly variant: AccountVariantKind;\n\treadonly message: string;\n\treadonly hint?: string;\n\treadonly cause?: unknown;\n}\n\nexport const accountAcquireError = (\n\tparts: Omit<AccountAcquireError, '_tag'>,\n): AccountAcquireError => ({ _tag: 'AccountAcquireError', ...parts });\n\n/** Phases for `AccountSignError`. Strictly transport / lifecycle\n * failures along the sign-and-execute pipeline — `signAndExecute`\n * itself returns a `SignAndExecuteResult` discriminated union for\n * the on-chain outcome (success vs `FailedTransaction`), so\n * on-chain failures are NOT in this phase set. The impersonation\n * refusal lives here so a synchronous throw maps cleanly onto an\n * async catch boundary when callers wrap the resolved-account\n * signer in `Effect.try`.\n *\n * - `build-tx` — transaction serialisation threw before\n * signing.\n * - `sign` — the signer rejected / threw.\n * - `submit` — `executeTransaction` transport failure\n * (RPC unreachable, network error). The\n * response never arrived.\n * - `no-digest` — `executeTransaction` returned a response\n * that violates the SDK envelope contract\n * (`$kind` missing OR `Transaction.digest`\n * missing OR `FailedTransaction.digest`\n * missing). Protocol violation, not a\n * transport failure — kept distinct so\n * `'submit'` keeps a single failure-kind\n * (per §2 \"phases describe steps, not\n * failure kinds\").\n * - `await-finality` — `waitForTransaction` failed AFTER a\n * submit-success; the digest exists but the\n * finality wait broke.\n * - `dependent-package-not-found`\n * - `lease-acquire`\n * - `impersonation-bypass-attempt`\n */\nexport type AccountSignPhase =\n\t| 'build-tx'\n\t| 'sign'\n\t| 'submit'\n\t| 'no-digest'\n\t| 'await-finality'\n\t| 'dependent-package-not-found'\n\t| 'lease-acquire'\n\t| 'impersonation-bypass-attempt';\n\n/** Account sign/execute error — raised by the per-account signer's\n * `signAndExecute` / `signTransaction` / `signPersonalMessage`\n * surfaces.\n *\n * Distilled-doc opportunity: today's implementation projects this to\n * JSON specially. Promoting to the uniform-shape interface here lets\n * the cause walker treat it like every other plugin's tagged error;\n * the special JSON-projection case can go away. */\nexport interface AccountSignError {\n\treadonly _tag: 'AccountSignError';\n\treadonly phase: AccountSignPhase;\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const accountSignError = (parts: Omit<AccountSignError, '_tag'>): AccountSignError => ({\n\t_tag: 'AccountSignError',\n\t...parts,\n});\n\n/** Account variant discriminator. Mirrors the user-facing\n * `AccountOptions` shape's `kind:` field. */\nexport type AccountVariantKind =\n\t| 'ephemeral'\n\t| 'keystore'\n\t| 'env'\n\t| 'inline'\n\t| 'signer'\n\t| 'impersonate';\n\n/** Union of every error an Account-plugin caller may encounter. */\nexport type AccountError = AccountAcquireError | AccountSignError;\n\n/** Error tags this plugin contributes — surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const ACCOUNT_ERROR_TAGS: ReadonlyArray<AccountError['_tag']> = [\n\t'AccountAcquireError',\n\t'AccountSignError',\n] as const;\n"],"mappings":";AAkDA,MAAa,uBACZ,WAC0B;CAAE,MAAM;CAAuB,GAAG;CAAO;AA4DpE,MAAa,oBAAoB,WAA6D;CAC7F,MAAM;CACN,GAAG;CACH;;;AAiBD,MAAa,qBAA0D,CACtE,uBACA,mBACA"}
@@ -1,9 +1,10 @@
1
1
  import { AnyResourceRef, ResourceRef } from "../../substrate/plugin.mjs";
2
- import { CoinResourceId } from "../coin/index.mjs";
2
+ import { AccountFundingRequest as AccountFundingRequest$1, AccountFundingStrategy as AccountFundingStrategy$1 } from "../../contracts/funding-strategy.mjs";
3
3
  import { AccountValue } from "./service.mjs";
4
4
  import { Effect } from "effect";
5
5
 
6
6
  //#region src/plugins/account/funding.d.ts
7
+ type CoinResourceId<Sym extends string> = `coin:${Sym}`;
7
8
  /** Direct resource ref shape for a coin upstream. The user passes the
8
9
  * result of `coin.fromPackage(...)` / `coin.known(...)` /
9
10
  * `coin.builtin(...)` — NOT a bare string or discriminator. Generic
@@ -59,26 +60,35 @@ interface ProjectedFundingEntry {
59
60
  readonly amount: bigint;
60
61
  }
61
62
  type ProjectedFunding = ReadonlyArray<ProjectedFundingEntry>;
63
+ /** Outcome marker carried on each `applied` entry — distinguishes a
64
+ * faucet/strategy call that actually moved funds (`'funded'`) from
65
+ * the short-circuit case where the existing balance already covered
66
+ * the request (`'already-satisfied'`). Downstream projection turns
67
+ * this into the `AccountRegistryFundingEntry.status` column so a
68
+ * no-faucet-call entry is not mislabeled as "funded".
69
+ *
70
+ * Distilled-doc invariant: the `applied` projection must reflect
71
+ * what actually happened — not the user's request shape. */
72
+ type AppliedFundingOutcome = 'funded' | 'already-satisfied';
73
+ interface AppliedFundingEntry extends ProjectedFundingEntry {
74
+ readonly outcome: AppliedFundingOutcome;
75
+ }
76
+ type AppliedFunding = ReadonlyArray<AppliedFundingEntry>;
62
77
  interface AccountFundingResult {
63
78
  readonly requested: ProjectedFunding;
64
- readonly applied: ProjectedFunding;
65
- }
66
- /** Request passed to account funding strategies. `amount` uses the
67
- * funded coin's smallest unit. The resolved account handle is present
68
- * so strategies without an admin signer can perform account-owned
69
- * swaps while still sharing the central funding dispatcher. */
70
- interface AccountFundingRequest {
71
- readonly address: string;
72
- readonly amount: bigint;
73
- readonly account: AccountValue;
74
- }
75
- interface AccountFundingStrategy<E = unknown> {
76
- readonly request: (req: AccountFundingRequest) => Effect.Effect<void, E>;
77
- /** True when the strategy calls `account.withTransactionSigner`.
78
- * The dispatcher must not acquire the same non-reentrant
79
- * per-address lease outside the strategy. */
80
- readonly usesAccountSigner?: boolean;
79
+ readonly applied: AppliedFunding;
81
80
  }
81
+ /** Account-bus projection of the substrate funding-request contract
82
+ * (`contracts/funding-strategy.ts`). Narrows the contract's generic
83
+ * account-handle slot to the concrete `AccountValue` this plugin
84
+ * publishes; strategies inside account or in sibling plugins
85
+ * (coin/walrus/deepbook) see the real handle type without re-stating
86
+ * the substrate shape. */
87
+ type AccountFundingRequest = AccountFundingRequest$1<AccountValue>;
88
+ /** Account-bus projection of the substrate strategy contract. The
89
+ * generic account-handle slot is fixed to `AccountValue` so
90
+ * contributing plugins receive a typed account handle. */
91
+ type AccountFundingStrategy<E = unknown> = AccountFundingStrategy$1<E, AccountValue>;
82
92
  /** The canonical builtin SUI coin type. Used by the funding dispatch
83
93
  * to route SUI entries to the faucet strategy (same key as the
84
94
  * default-funding pass), and by everything that needs to detect
@@ -90,5 +100,5 @@ declare const SUI_FULL_COIN_TYPE: "0x2::sui::SUI";
90
100
  * is predictable. */
91
101
  declare const DEFAULT_EPHEMERAL_FUND_MIST = 1000000000n;
92
102
  //#endregion
93
- export { AccountFunding, AccountFundingCoinValue, AccountFundingEntry, AccountFundingRequest, AccountFundingResult, AccountFundingStrategy, CoinMember, CrossCuttingFundingEntry, CrossCuttingFundingProvider, DEFAULT_EPHEMERAL_FUND_MIST, ProjectedFunding, ProjectedFundingEntry, SUI_FULL_COIN_TYPE, SuiFundingEntry };
103
+ export { AccountFunding, AccountFundingCoinValue, AccountFundingEntry, AccountFundingRequest, AccountFundingResult, AccountFundingStrategy, AppliedFunding, AppliedFundingEntry, AppliedFundingOutcome, CoinMember, CrossCuttingFundingEntry, CrossCuttingFundingProvider, DEFAULT_EPHEMERAL_FUND_MIST, ProjectedFunding, ProjectedFundingEntry, SUI_FULL_COIN_TYPE, SuiFundingEntry };
94
104
  //# sourceMappingURL=funding.d.mts.map
@@ -1,10 +1,19 @@
1
+ import { BALANCE_POLL_PROFILE, makeBoundedSpacedSchedule } from "../../substrate/runtime/retry-policy.mjs";
1
2
  import { setCurrentPluginPhase } from "../../substrate/runtime/current-plugin.mjs";
2
3
  import { StrategyRegistryService } from "../../substrate/runtime/strategy-registry/service.mjs";
3
- import { faucetCapabilityFor } from "../../substrate/runtime/strategy-registry/faucet-capability-for.mjs";
4
+ import { chainKeyedStrategyFor } from "../../substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs";
5
+ import "../../substrate/runtime/strategy-registry/index.mjs";
6
+ import { SuiSpans } from "../sui/spans.mjs";
7
+ import { FAUCET_CAPABILITY_KEY_PREFIX } from "../faucet/dispatcher.mjs";
8
+ import "../faucet/index.mjs";
9
+ import "../sui/index.mjs";
10
+ import { AccountSpans } from "./spans.mjs";
4
11
  import { accountAcquireError } from "./errors.mjs";
5
12
  import { withAddressLease } from "./lease.mjs";
6
- import { Duration, Effect } from "effect";
13
+ import { fundingFailureError } from "../internal/funding-failure-error.mjs";
14
+ import { Effect } from "effect";
7
15
  //#region src/plugins/account/funding.ts
16
+ const skipsFinalityWait = (reader) => reader.skipFinalityWait === true;
8
17
  /** The canonical builtin SUI coin type. Used by the funding dispatch
9
18
  * to route SUI entries to the faucet strategy (same key as the
10
19
  * default-funding pass), and by everything that needs to detect
@@ -15,8 +24,6 @@ const SUI_FULL_COIN_TYPE = "0x2::sui::SUI";
15
24
  * Documented at the user-facing factory so a bare `account('alice')`
16
25
  * is predictable. */
17
26
  const DEFAULT_EPHEMERAL_FUND_MIST = 1000000000n;
18
- const FUNDING_SETTLEMENT_INTERVAL_MS = 250;
19
- const FUNDING_SETTLEMENT_TIMEOUT_MS = 3e4;
20
27
  /** Apply the default-funding pass for an ephemeral account.
21
28
  *
22
29
  * Wiring: yields `StrategyRegistryService` (the R-channel from
@@ -26,27 +33,26 @@ const FUNDING_SETTLEMENT_TIMEOUT_MS = 3e4;
26
33
  * the address lock around the wire call. */
27
34
  const fundEphemeralDefault = (parts) => Effect.gen(function* () {
28
35
  if (parts.suiMode === "fork") yield* parts.emitAutoPromotionEvent();
29
- if (parts.amountMist <= 0n) return;
36
+ if (parts.amountMist <= 0n) return "skipped";
30
37
  yield* setCurrentPluginPhase("checking SUI funding");
31
38
  const existingBalance = yield* readExistingBalance(parts.balanceReader, {
32
39
  owner: parts.address,
33
40
  coinType: SUI_FULL_COIN_TYPE
34
41
  });
35
- if (existingBalance !== null && existingBalance >= parts.amountMist) return;
36
- const strategy = yield* faucetCapabilityFor(parts.chainId).pipe(Effect.catchTag("StrategyNotFoundError", (err) => Effect.fail(accountAcquireError({
42
+ if (existingBalance !== null && existingBalance >= parts.amountMist) return "already-satisfied";
43
+ const strategy = yield* chainKeyedStrategyFor(FAUCET_CAPABILITY_KEY_PREFIX, parts.chainId).pipe(Effect.catchTag("StrategyNotFoundError", (err) => Effect.fail(accountAcquireError({
37
44
  phase: "fund-default",
38
45
  accountName: parts.accountName,
39
46
  variant: "ephemeral",
40
47
  message: `Account '${parts.accountName}': no faucet strategy registered for chain '${parts.chainId}' (sui mode=${parts.suiMode}). Registered keys: [${err.registeredKeys.join(", ")}].`,
41
48
  hint: parts.suiMode === "fork" ? "Fork networks have no HTTP faucet — compose a plugin that contributes defineFaucetStrategy(...) for this chain id." : "Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack."
42
49
  }))));
43
- const wrapFaucetFailure = (cause) => Effect.fail(accountAcquireError({
50
+ const wrapFaucetFailure = (cause) => Effect.fail(fundingFailureError({
44
51
  phase: "fund-default",
45
52
  accountName: parts.accountName,
46
53
  variant: "ephemeral",
47
- message: `Account '${parts.accountName}': faucet strategy request failed for chain '${parts.chainId}' (tag=${cause._tag}).`,
48
- cause,
49
- hint: "See the cause chain — typical roots are the faucet container not yet ready (FaucetUnreachable), the wall-clock budget elapsed (FaucetExhausted), or the body returned Failure (FaucetBodyError)."
54
+ chainId: parts.chainId,
55
+ cause
50
56
  }));
51
57
  yield* setCurrentPluginPhase("funding SUI");
52
58
  yield* withAddressLease(parts.broker, parts.accountName, parts.address, strategy.request({
@@ -69,16 +75,17 @@ const fundEphemeralDefault = (parts) => Effect.gen(function* () {
69
75
  amount: parts.amountMist
70
76
  });
71
77
  yield* Effect.annotateCurrentSpan({
72
- "account.name": parts.accountName,
73
- "account.address": parts.address,
74
- "fund.amount.mist": parts.amountMist.toString(),
75
- "sui.chain": parts.chainId,
76
- "sui.mode": parts.suiMode
78
+ [AccountSpans.name]: parts.accountName,
79
+ [AccountSpans.address]: parts.address,
80
+ [AccountSpans.fundAmountMist]: parts.amountMist.toString(),
81
+ [SuiSpans.chain]: parts.chainId,
82
+ [SuiSpans.mode]: parts.suiMode
77
83
  });
84
+ return "funded";
78
85
  }).pipe(Effect.withSpan("devstack.plugin.account.fundEphemeralDefault", { attributes: {
79
- "account.name": parts.accountName,
80
- "account.address": parts.address,
81
- "sui.mode": parts.suiMode
86
+ [AccountSpans.name]: parts.accountName,
87
+ [AccountSpans.address]: parts.address,
88
+ [SuiSpans.mode]: parts.suiMode
82
89
  } }));
83
90
  /** Apply the cross-cutting funding pass. Variant-agnostic — runs for
84
91
  * every variant once the keypair / impersonation slot is bound and
@@ -112,39 +119,48 @@ const applyCrossCuttingFunding = (parts) => Effect.gen(function* () {
112
119
  coinType: entry.fullCoinType
113
120
  });
114
121
  if (existingBalance !== null && existingBalance >= entry.amount) {
115
- applied.push(entry);
122
+ applied.push({
123
+ ...entry,
124
+ outcome: "already-satisfied"
125
+ });
116
126
  continue;
117
127
  }
118
128
  const isSui = entry.fullCoinType === SUI_FULL_COIN_TYPE;
119
129
  const coinKey = `coinType:${entry.fullCoinType}`;
120
- const strategy = yield* (isSui ? faucetCapabilityFor(parts.chainId) : registry.get(coinKey)).pipe(Effect.catchTag("StrategyNotFoundError", (err) => isSui ? Effect.fail(accountAcquireError({
130
+ const key = isSui ? `faucet:request:${parts.chainId}` : coinKey;
131
+ const wrapCrossCuttingFailure = (cause) => fundingFailureError({
132
+ phase: "fund-cross-cutting",
133
+ accountName: parts.accountName,
134
+ variant: parts.variant,
135
+ key,
136
+ amount: entry.amount,
137
+ cause
138
+ });
139
+ let request;
140
+ let usesAccountSigner = false;
141
+ if (isSui) request = (yield* chainKeyedStrategyFor(FAUCET_CAPABILITY_KEY_PREFIX, parts.chainId).pipe(Effect.catchTag("StrategyNotFoundError", (err) => Effect.fail(accountAcquireError({
121
142
  phase: "fund-cross-cutting",
122
143
  accountName: parts.accountName,
123
144
  variant: parts.variant,
124
145
  message: `Account '${parts.accountName}': no SUI funding strategy registered for chain '${parts.chainId}'. Registered keys: [${err.registeredKeys.join(", ")}].`,
125
146
  cause: err,
126
147
  hint: "Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack."
127
- })) : Effect.succeed(null)));
128
- if (strategy === null) continue;
129
- const key = isSui ? `faucet:request:${parts.chainId}` : coinKey;
130
- const wrapCrossCuttingFailure = (cause) => {
131
- const tag = typeof cause === "object" && cause !== null && "_tag" in cause ? String(cause._tag) : "unknown";
132
- return accountAcquireError({
133
- phase: "fund-cross-cutting",
134
- accountName: parts.accountName,
135
- variant: parts.variant,
136
- message: `Account '${parts.accountName}': cross-cutting funding failed for coin (key='${key}') amount=${entry.amount} (tag=${tag}).`,
137
- cause,
138
- hint: "Cross-cutting funding requires the matching strategy to be registered at the time of acquire — check the plugin that contributes this coin and any `via` dependency."
139
- });
140
- };
141
- const request = strategy.request({
148
+ }))))).request({
142
149
  address: parts.address,
143
- amount: entry.amount,
144
- account: parts.account
150
+ amount: entry.amount
145
151
  }).pipe(Effect.mapError(wrapCrossCuttingFailure));
152
+ else {
153
+ const strategy = yield* registry.get(coinKey).pipe(Effect.catchTag("StrategyNotFoundError", () => Effect.succeed(null)));
154
+ if (strategy === null) continue;
155
+ usesAccountSigner = strategy.usesAccountSigner === true;
156
+ request = strategy.request({
157
+ address: parts.address,
158
+ amount: entry.amount,
159
+ account: parts.account
160
+ }).pipe(Effect.mapError(wrapCrossCuttingFailure));
161
+ }
146
162
  yield* setCurrentPluginPhase(`funding ${entry.coin}`);
147
- yield* strategy.usesAccountSigner === true ? request : withAddressLease(parts.broker, parts.accountName, parts.address, request);
163
+ yield* usesAccountSigner ? request : withAddressLease(parts.broker, parts.accountName, parts.address, request);
148
164
  yield* setCurrentPluginPhase(`waiting for ${entry.coin} funding settlement`);
149
165
  yield* waitForBalanceAtLeast({
150
166
  balanceReader: parts.balanceReader,
@@ -156,41 +172,43 @@ const applyCrossCuttingFunding = (parts) => Effect.gen(function* () {
156
172
  coinLabel: entry.coin,
157
173
  amount: entry.amount
158
174
  });
159
- applied.push(entry);
175
+ applied.push({
176
+ ...entry,
177
+ outcome: "funded"
178
+ });
160
179
  }
161
180
  yield* Effect.annotateCurrentSpan({
162
- "account.name": parts.accountName,
163
- "account.address": parts.address,
164
- "fund.cross-cutting.count": parts.funding.length,
165
- "sui.chain": parts.chainId
181
+ [AccountSpans.name]: parts.accountName,
182
+ [AccountSpans.address]: parts.address,
183
+ [AccountSpans.fundCrossCuttingCount]: parts.funding.length,
184
+ [SuiSpans.chain]: parts.chainId
166
185
  });
167
186
  return applied;
168
187
  }).pipe(Effect.withSpan("devstack.plugin.account.applyCrossCuttingFunding", { attributes: {
169
- "account.name": parts.accountName,
170
- "account.address": parts.address,
171
- "fund.cross-cutting.entries": parts.funding.length
188
+ [AccountSpans.name]: parts.accountName,
189
+ [AccountSpans.address]: parts.address,
190
+ [AccountSpans.fundCrossCuttingEntries]: parts.funding.length
172
191
  } }));
173
- const readExistingBalance = (balanceReader, args) => balanceReader === void 0 ? Effect.succeed(null) : balanceReader.readBalance(args);
192
+ const readExistingBalance = (balanceReader, args) => balanceReader.readBalance(args);
174
193
  const waitForBalanceAtLeast = (parts) => {
175
- if (parts.balanceReader === void 0) return Effect.void;
194
+ const reader = parts.balanceReader;
195
+ if (skipsFinalityWait(reader)) return Effect.void;
176
196
  return Effect.gen(function* () {
177
- const startedAt = Date.now();
178
- let lastBalance = null;
179
- for (;;) {
180
- lastBalance = yield* readExistingBalance(parts.balanceReader, {
181
- owner: parts.owner,
182
- coinType: parts.coinType
183
- });
184
- if (lastBalance !== null && lastBalance >= parts.amount) return;
185
- if (Date.now() - startedAt >= FUNDING_SETTLEMENT_TIMEOUT_MS) return yield* Effect.fail(accountAcquireError({
186
- phase: parts.phase,
187
- accountName: parts.accountName,
188
- variant: parts.variant,
189
- message: `Account '${parts.accountName}': funding for ${parts.coinLabel} was accepted but balance did not reach ${parts.amount} before the settlement timeout (last=${lastBalance === null ? "<unavailable>" : lastBalance}).`,
190
- hint: "The faucet or funding strategy returned before the funded coin became spendable. Check the funding strategy finality gate and Sui RPC health."
191
- }));
192
- yield* Effect.sleep(Duration.millis(FUNDING_SETTLEMENT_INTERVAL_MS));
193
- }
197
+ const lastBalance = yield* readExistingBalance(reader, {
198
+ owner: parts.owner,
199
+ coinType: parts.coinType
200
+ }).pipe(Effect.repeat({
201
+ schedule: makeBoundedSpacedSchedule(BALANCE_POLL_PROFILE.intervalMs, BALANCE_POLL_PROFILE.timeoutMs),
202
+ until: (balance) => balance !== null && balance >= parts.amount
203
+ }));
204
+ if (lastBalance !== null && lastBalance >= parts.amount) return;
205
+ return yield* Effect.fail(accountAcquireError({
206
+ phase: parts.phase,
207
+ accountName: parts.accountName,
208
+ variant: parts.variant,
209
+ message: `Account '${parts.accountName}': funding for ${parts.coinLabel} was accepted but balance did not reach ${parts.amount} before the settlement timeout (last=${lastBalance === null ? "<unavailable>" : lastBalance}).`,
210
+ hint: "The faucet or funding strategy returned before the funded coin became spendable. Check the funding strategy finality gate and Sui RPC health."
211
+ }));
194
212
  });
195
213
  };
196
214
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"funding.mjs","names":[],"sources":["../../../src/plugins/account/funding.ts"],"sourcesContent":["// Account plugin — funding logic.\n//\n// Two funding paths converge here:\n//\n// 1. **Default funding** — applies to the `ephemeral` variant only.\n// On non-fork networks: faucet POST via the SUI HTTP strategy\n// auto-registered by Faucet (see 11-faucet.md). On fork networks:\n// \"pay from a seed via impersonation\" because forks have no\n// faucet. The auto-promotion is LOUD by default per the\n// architecture's \"no silent surprises\" principle — we emit a\n// `log.appended` event the first time a stack hits this path.\n//\n// 2. **Cross-cutting funding** — declared per-account via\n// `AccountOptions.funding`. Applies to every variant.\n// Dispatched through the ambient strategy registry. Missing\n// strategy for non-SUI coins ⇒ silent noop (architecture-\n// mandated test-ergonomics contract, distilled-doc invariant:\n// \"Optional Faucet is a noop, not an error\"). Explicit SUI\n// entries use the SUI faucet strategy and fail loudly when no\n// faucet-bearing strategy exists.\n//\n// Distilled-doc invariant: per-address serialization — concurrent\n// funding requests for the same address MUST serialize. We share the\n// substrate `LeaseBroker` handle from `service.ts` and open a fresh\n// scope per wire call so the lease releases the moment that call\n// returns. Each cross-cutting iteration is its own scope: the broker\n// is non-reentrant by design, so a hypothetical loop holding a single\n// lease across iterations would deadlock the second one.\n\nimport { Duration, Effect } from 'effect';\n\nimport type { FaucetStrategy } from '../faucet/strategies/sui-local.ts';\nimport {\n\tfaucetCapabilityFor,\n\tStrategyRegistryService,\n} from '../../substrate/runtime/strategy-registry/index.ts';\nimport type { AnyResourceRef, ResourceRef } from '../../api/define-plugin.ts';\nimport type { LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\nimport type { ChainId } from '../../substrate/brand.ts';\nimport type { CoinResourceId } from '../coin/index.ts';\nimport { setCurrentPluginPhase } from '../../substrate/runtime/current-plugin.ts';\n\nimport {\n\taccountAcquireError,\n\ttype AccountAcquireError,\n\ttype AccountVariantKind,\n} from './errors.ts';\nimport { withAddressLease } from './lease.ts';\nimport type { AccountValue } from './service.ts';\n\n/** Direct resource ref shape for a coin upstream. The user passes the\n * result of `coin.fromPackage(...)` / `coin.known(...)` /\n * `coin.builtin(...)` — NOT a bare string or discriminator. Generic\n * over the literal symbol so the account's dependency tuple preserves\n * each per-coin resource id (`coin:managed_coin/managed_coin`,\n * `coin:wal`, ...).\n *\n * Architecture (Direct Member Refs): cross-plugin references at the\n * user-facing surface are plugin/resource refs directly — no opaque\n * tag or string discriminator vocabulary. */\nexport interface AccountFundingCoinValue {\n\treadonly fullCoinType: string;\n\treadonly symbol?: string;\n}\n\nexport type CoinMember<Sym extends string = string> = ResourceRef<\n\tCoinResourceId<Sym>,\n\tAccountFundingCoinValue\n>;\n\n/** Optional dependency edge for the plugin that contributes the\n * funding strategy. Coin refs force the coin metadata edge; `via`\n * forces the strategy-provider edge (e.g. a known DeepBook\n * deployment that contributes `coinType:<DEEP>`). */\nexport type CrossCuttingFundingProvider = AnyResourceRef | readonly AnyResourceRef[];\n\n/** Built-in SUI funding entry. This uses the same account funding\n * list as arbitrary coins but avoids requiring `coin.builtin('sui')`\n * for the normal SUI faucet path. */\nexport interface SuiFundingEntry {\n\treadonly coin: 'sui';\n\treadonly amount: number | bigint;\n}\n\n/** A single cross-cutting funding entry. `coin` is a direct member ref\n * (the value returned by `coin.fromPackage(...)` etc.) — the account plugin\n * threads it through `dependsOn` so the substrate's dep graph forces\n * the publishing / discovery edge to land before funding.\n *\n * Distilled-doc invariant (\"Strict upstream declaration\"): coin\n * references cited by Account must force a dep edge. `via` is the\n * same contract for the strategy contributor that can satisfy the\n * funding request. */\nexport interface CrossCuttingFundingEntry<M extends CoinMember = CoinMember> {\n\treadonly coin: M;\n\treadonly amount: bigint;\n\treadonly via?: CrossCuttingFundingProvider;\n}\n\nexport type AccountFundingEntry<M extends CoinMember = CoinMember> =\n\t| SuiFundingEntry\n\t| CrossCuttingFundingEntry<M>;\n\nexport type AccountFunding = ReadonlyArray<AccountFundingEntry>;\n\n/** Internal projected shape — the acquire body in `account/index.ts`\n * receives each funding entry's resolved `CoinValue`, reads\n * `fullCoinType`, and passes the projected entries to\n * `applyCrossCuttingFunding`. The funding pass never sees the raw\n * member refs — keeps the strategy dispatch logic\n * substrate-name-blind. */\nexport interface ProjectedFundingEntry {\n\treadonly coin: string;\n\treadonly fullCoinType: string;\n\treadonly amount: bigint;\n}\n\nexport type ProjectedFunding = ReadonlyArray<ProjectedFundingEntry>;\n\nexport interface AccountFundingResult {\n\treadonly requested: ProjectedFunding;\n\treadonly applied: ProjectedFunding;\n}\n\n/** Request passed to account funding strategies. `amount` uses the\n * funded coin's smallest unit. The resolved account handle is present\n * so strategies without an admin signer can perform account-owned\n * swaps while still sharing the central funding dispatcher. */\nexport interface AccountFundingRequest {\n\treadonly address: string;\n\treadonly amount: bigint;\n\treadonly account: AccountValue;\n}\n\nexport interface AccountFundingStrategy<E = unknown> {\n\treadonly request: (req: AccountFundingRequest) => Effect.Effect<void, E>;\n\t/** True when the strategy calls `account.withTransactionSigner`.\n\t * The dispatcher must not acquire the same non-reentrant\n\t * per-address lease outside the strategy. */\n\treadonly usesAccountSigner?: boolean;\n}\n\nexport interface FundingBalanceReader {\n\treadonly readBalance: (args: {\n\t\treadonly owner: string;\n\t\treadonly coinType: string;\n\t}) => Effect.Effect<bigint | null>;\n}\n\n/** The canonical builtin SUI coin type. Used by the funding dispatch\n * to route SUI entries to the faucet strategy (same key as the\n * default-funding pass), and by everything that needs to detect\n * \"this is the protocol-defined SUI\". Mirrors `BUILTIN_COINS.sui`\n * in the coin plugin. */\nexport const SUI_FULL_COIN_TYPE = '0x2::sui::SUI' as const;\n\n/** Default funding amount for ephemeral accounts — 1 SUI in MIST.\n * Documented at the user-facing factory so a bare `account('alice')`\n * is predictable. */\nexport const DEFAULT_EPHEMERAL_FUND_MIST = 1_000_000_000n;\n\nconst FUNDING_SETTLEMENT_INTERVAL_MS = 250;\nconst FUNDING_SETTLEMENT_TIMEOUT_MS = 30_000;\n\n/** Inputs the default-funding pass needs from the per-acquire ctx. */\nexport interface FundEphemeralDefaultArgs {\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly amountMist: bigint;\n\treadonly suiMode: 'local' | 'local-rpc' | 'live' | 'fork';\n\t/** Resolved sui chain id — the substrate-level chain identity used\n\t * to compose the faucet strategy's capability key\n\t * (`faucet:request:<chainId>`). */\n\treadonly chainId: ChainId;\n\t/** Loud-by-default auto-promotion event (called on fork before the\n\t * strategy is invoked, per the architecture's \"no silent surprises\"\n\t * principle). */\n\treadonly emitAutoPromotionEvent: () => Effect.Effect<void>;\n\t/** Substrate lease-broker handle — funding opens a fresh scope per\n\t * wire call and acquires the per-address lease so concurrent wire\n\t * calls for the same address serialize at the chain boundary. */\n\treadonly broker: LeaseBroker;\n\treadonly balanceReader?: FundingBalanceReader;\n}\n\n/** Apply the default-funding pass for an ephemeral account.\n *\n * Wiring: yields `StrategyRegistryService` (the R-channel from\n * Round 7), looks up the faucet strategy registered by the Sui\n * plugin under `faucet:request:<chainId>`, and dispatches a request\n * through it. Per-address serialization is enforced by acquiring\n * the address lock around the wire call. */\nexport const fundEphemeralDefault = (\n\tparts: FundEphemeralDefaultArgs,\n): Effect.Effect<void, AccountAcquireError, StrategyRegistryService> =>\n\tEffect.gen(function* () {\n\t\t// LOUD AUTO-PROMOTION — distilled-doc invariant: \"no silent\n\t\t// surprises\". Emit BEFORE attempting the dispatch so the user\n\t\t// sees the path change even if the wire call subsequently\n\t\t// fails. On fork we surface the path-change event; on non-fork\n\t\t// the strategy registered by Sui IS the canonical default and\n\t\t// no auto-promotion is needed.\n\t\tif (parts.suiMode === 'fork') {\n\t\t\tyield* parts.emitAutoPromotionEvent();\n\t\t}\n\n\t\t// Zero-amount short-circuit — both real strategies treat zero\n\t\t// as a no-op; doing the same here avoids a registry lookup +\n\t\t// span emission for the legitimately-no-funding case.\n\t\tif (parts.amountMist <= 0n) {\n\t\t\treturn;\n\t\t}\n\n\t\tyield* setCurrentPluginPhase('checking SUI funding');\n\t\tconst existingBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\towner: parts.address,\n\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t});\n\t\tif (existingBalance !== null && existingBalance >= parts.amountMist) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Look up the strategy. Sui auto-registers a faucet strategy\n\t\t// on non-fork modes; fork-mode strategies have to be supplied\n\t\t// by the faucet plugin (with the fork admin closed over). If\n\t\t// nothing is registered we surface a typed, actionable error\n\t\t// pointing at the architecture's contract: ephemeral-on-non-\n\t\t// fork without a Faucet MUST fail at acquire time.\n\t\tconst strategy = yield* faucetCapabilityFor<FaucetStrategy>(parts.chainId).pipe(\n\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\tphase: 'fund-default',\n\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Account '${parts.accountName}': no faucet strategy registered for ` +\n\t\t\t\t\t\t\t`chain '${parts.chainId}' (sui mode=${parts.suiMode}). ` +\n\t\t\t\t\t\t\t`Registered keys: [${err.registeredKeys.join(', ')}].`,\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\tparts.suiMode === 'fork'\n\t\t\t\t\t\t\t\t? 'Fork networks have no HTTP faucet — compose a plugin that contributes defineFaucetStrategy(...) for this chain id.'\n\t\t\t\t\t\t\t\t: 'Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack.',\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\t// Per-address serialization around the wire call. The lease is\n\t\t// scope-bound and releases as soon as `request(...)` returns;\n\t\t// two concurrent funding requests for the same address — e.g.\n\t\t// ephemeral default + cross-cutting SUI top-up — interleave\n\t\t// deterministically via the broker's FIFO queue.\n\t\tconst wrapFaucetFailure = (cause: {\n\t\t\treadonly _tag: 'FaucetUnreachable' | 'FaucetExhausted' | 'FaucetBodyError';\n\t\t}) =>\n\t\t\tEffect.fail(\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'fund-default',\n\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Account '${parts.accountName}': faucet strategy request failed ` +\n\t\t\t\t\t\t`for chain '${parts.chainId}' (tag=${cause._tag}).`,\n\t\t\t\t\tcause,\n\t\t\t\t\thint:\n\t\t\t\t\t\t'See the cause chain — typical roots are the faucet container ' +\n\t\t\t\t\t\t'not yet ready (FaucetUnreachable), the wall-clock budget elapsed ' +\n\t\t\t\t\t\t'(FaucetExhausted), or the body returned Failure (FaucetBodyError).',\n\t\t\t\t}),\n\t\t\t);\n\t\tyield* setCurrentPluginPhase('funding SUI');\n\t\tyield* withAddressLease(\n\t\t\tparts.broker,\n\t\t\tparts.accountName,\n\t\t\tparts.address,\n\t\t\tstrategy.request({ address: parts.address, amount: parts.amountMist }).pipe(\n\t\t\t\tEffect.catchTags({\n\t\t\t\t\tFaucetUnreachable: wrapFaucetFailure,\n\t\t\t\t\tFaucetExhausted: wrapFaucetFailure,\n\t\t\t\t\tFaucetBodyError: wrapFaucetFailure,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\tyield* setCurrentPluginPhase('waiting for SUI funding settlement');\n\t\tyield* waitForBalanceAtLeast({\n\t\t\tbalanceReader: parts.balanceReader,\n\t\t\taccountName: parts.accountName,\n\t\t\tvariant: 'ephemeral',\n\t\t\tphase: 'fund-default',\n\t\t\towner: parts.address,\n\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t\tcoinLabel: 'SUI',\n\t\t\tamount: parts.amountMist,\n\t\t});\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'account.name': parts.accountName,\n\t\t\t'account.address': parts.address,\n\t\t\t'fund.amount.mist': parts.amountMist.toString(),\n\t\t\t'sui.chain': parts.chainId,\n\t\t\t'sui.mode': parts.suiMode,\n\t\t});\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.account.fundEphemeralDefault', {\n\t\t\tattributes: {\n\t\t\t\t'account.name': parts.accountName,\n\t\t\t\t'account.address': parts.address,\n\t\t\t\t'sui.mode': parts.suiMode,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Inputs the cross-cutting funding pass needs from the per-acquire ctx.\n *\n * `funding` is the PROJECTED shape — the acquire body in\n * `account/index.ts` receives each user-supplied `CoinMember` as a\n * resolved dependency and projects to `{fullCoinType, amount}` BEFORE\n * invoking this pass. Keeps the dispatch logic substrate-name-blind. */\nexport interface ApplyCrossCuttingFundingArgs {\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly variant: AccountVariantKind;\n\treadonly account: AccountValue;\n\treadonly funding: ProjectedFunding;\n\treadonly chainId: ChainId;\n\treadonly broker: LeaseBroker;\n\treadonly balanceReader?: FundingBalanceReader;\n}\n\n/** Apply the cross-cutting funding pass. Variant-agnostic — runs for\n * every variant once the keypair / impersonation slot is bound and\n * the address is known.\n *\n * Distilled-doc invariant: \"Optional Faucet is a noop, not an\n * error\". Absence of a registered strategy for a non-SUI coin's\n * capability key short-circuits silently (the entry is dropped).\n * Explicit SUI entries are stricter: they route through the active\n * chain's faucet strategy and fail loudly when none is registered.\n * This lets a test author opt INTO arbitrary-coin funding without\n * forcing every surrounding network to satisfy every custom coin.\n *\n * Wiring: SUI entries (`fullCoinType === '0x2::sui::SUI'`) dispatch\n * through `faucet:request:<chainId>` (same key as the default pass);\n * other entries dispatch through `coinType:<fullCoinType>` keys\n * contributed by the respective Coin/Walrus/Seal plugins.\n *\n * Entries are processed serially. Strategies that use the resolved\n * account signer acquire the per-address lease internally; strategies\n * that do not are wrapped by this dispatcher. */\nexport const applyCrossCuttingFunding = (\n\tparts: ApplyCrossCuttingFundingArgs,\n): Effect.Effect<ProjectedFunding, AccountAcquireError, StrategyRegistryService> =>\n\tEffect.gen(function* () {\n\t\tif (parts.funding.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst registry = yield* StrategyRegistryService;\n\t\tconst applied: ProjectedFundingEntry[] = [];\n\n\t\tfor (const entry of parts.funding) {\n\t\t\tif (entry.amount <= 0n) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tyield* setCurrentPluginPhase(`checking ${entry.coin} funding`);\n\t\t\tconst existingBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\t\towner: parts.address,\n\t\t\t\tcoinType: entry.fullCoinType,\n\t\t\t});\n\t\t\tif (existingBalance !== null && existingBalance >= entry.amount) {\n\t\t\t\tapplied.push(entry);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Resolve the capability key from the projected coin type.\n\t\t\t//\n\t\t\t// SUI (`0x2::sui::SUI`) → reuse the faucet-request key so the\n\t\t\t// SUI auto-registered strategy fields the request (this\n\t\t\t// matches the default-funding pass and keeps the registry\n\t\t\t// surface uniform).\n\t\t\t//\n\t\t\t// Everything else → `coinType:<fullCoinType>` so user-defined\n\t\t\t// Coin plugins (and Walrus's exchange strategy keyed by\n\t\t\t// `coinType:<WAL fullCoinType>`) can contribute strategies\n\t\t\t// declaratively.\n\t\t\tconst isSui = entry.fullCoinType === SUI_FULL_COIN_TYPE;\n\t\t\tconst coinKey = `coinType:${entry.fullCoinType}` as const;\n\t\t\tconst lookup = isSui\n\t\t\t\t? faucetCapabilityFor<AccountFundingStrategy>(parts.chainId)\n\t\t\t\t: registry.get<typeof coinKey, AccountFundingStrategy>(coinKey);\n\n\t\t\t// Architecture-distilled: optional-faucet-is-noop for\n\t\t\t// arbitrary coins. Explicit SUI entries are the normal gas\n\t\t\t// faucet path, so missing strategy is actionable and loud.\n\t\t\tconst strategy = yield* lookup.pipe(\n\t\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\t\tisSui\n\t\t\t\t\t\t? Effect.fail(\n\t\t\t\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t`Account '${parts.accountName}': no SUI funding strategy registered ` +\n\t\t\t\t\t\t\t\t\t\t`for chain '${parts.chainId}'. Registered keys: [${err.registeredKeys.join(', ')}].`,\n\t\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t\t\thint: 'Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack.',\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: Effect.succeed(null as AccountFundingStrategy | null),\n\t\t\t\t),\n\t\t\t);\n\t\t\tif (strategy === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst key = isSui ? (`faucet:request:${parts.chainId}` as const) : coinKey;\n\t\t\tconst wrapCrossCuttingFailure = (cause: unknown): AccountAcquireError => {\n\t\t\t\tconst tag =\n\t\t\t\t\ttypeof cause === 'object' && cause !== null && '_tag' in cause\n\t\t\t\t\t\t? String((cause as { readonly _tag?: unknown })._tag)\n\t\t\t\t\t\t: 'unknown';\n\t\t\t\treturn accountAcquireError({\n\t\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Account '${parts.accountName}': cross-cutting funding ` +\n\t\t\t\t\t\t`failed for coin (key='${key}') amount=${entry.amount} ` +\n\t\t\t\t\t\t`(tag=${tag}).`,\n\t\t\t\t\tcause,\n\t\t\t\t\thint:\n\t\t\t\t\t\t'Cross-cutting funding requires the matching strategy ' +\n\t\t\t\t\t\t'to be registered at the time of acquire — check the ' +\n\t\t\t\t\t\t'plugin that contributes this coin and any `via` dependency.',\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst request = strategy\n\t\t\t\t.request({ address: parts.address, amount: entry.amount, account: parts.account })\n\t\t\t\t.pipe(Effect.mapError(wrapCrossCuttingFailure));\n\t\t\tyield* setCurrentPluginPhase(`funding ${entry.coin}`);\n\t\t\tyield* strategy.usesAccountSigner === true\n\t\t\t\t? request\n\t\t\t\t: withAddressLease(parts.broker, parts.accountName, parts.address, request);\n\t\t\tyield* setCurrentPluginPhase(`waiting for ${entry.coin} funding settlement`);\n\t\t\tyield* waitForBalanceAtLeast({\n\t\t\t\tbalanceReader: parts.balanceReader,\n\t\t\t\taccountName: parts.accountName,\n\t\t\t\tvariant: parts.variant,\n\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\towner: parts.address,\n\t\t\t\tcoinType: entry.fullCoinType,\n\t\t\t\tcoinLabel: entry.coin,\n\t\t\t\tamount: entry.amount,\n\t\t\t});\n\t\t\tapplied.push(entry);\n\t\t}\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'account.name': parts.accountName,\n\t\t\t'account.address': parts.address,\n\t\t\t'fund.cross-cutting.count': parts.funding.length,\n\t\t\t'sui.chain': parts.chainId,\n\t\t});\n\t\treturn applied;\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.account.applyCrossCuttingFunding', {\n\t\t\tattributes: {\n\t\t\t\t'account.name': parts.accountName,\n\t\t\t\t'account.address': parts.address,\n\t\t\t\t'fund.cross-cutting.entries': parts.funding.length,\n\t\t\t},\n\t\t}),\n\t);\n\nconst readExistingBalance = (\n\tbalanceReader: FundingBalanceReader | undefined,\n\targs: {\n\t\treadonly owner: string;\n\t\treadonly coinType: string;\n\t},\n): Effect.Effect<bigint | null> =>\n\tbalanceReader === undefined ? Effect.succeed(null) : balanceReader.readBalance(args);\n\nconst waitForBalanceAtLeast = (parts: {\n\treadonly balanceReader: FundingBalanceReader | undefined;\n\treadonly accountName: string;\n\treadonly variant: AccountVariantKind;\n\treadonly phase: 'fund-default' | 'fund-cross-cutting';\n\treadonly owner: string;\n\treadonly coinType: string;\n\treadonly coinLabel: string;\n\treadonly amount: bigint;\n}): Effect.Effect<void, AccountAcquireError> => {\n\tif (parts.balanceReader === undefined) {\n\t\treturn Effect.void;\n\t}\n\treturn Effect.gen(function* () {\n\t\tconst startedAt = Date.now();\n\t\tlet lastBalance: bigint | null = null;\n\t\tfor (;;) {\n\t\t\tlastBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\t\towner: parts.owner,\n\t\t\t\tcoinType: parts.coinType,\n\t\t\t});\n\t\t\tif (lastBalance !== null && lastBalance >= parts.amount) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (Date.now() - startedAt >= FUNDING_SETTLEMENT_TIMEOUT_MS) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\tphase: parts.phase,\n\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Account '${parts.accountName}': funding for ${parts.coinLabel} was accepted ` +\n\t\t\t\t\t\t\t`but balance did not reach ${parts.amount} before the settlement timeout ` +\n\t\t\t\t\t\t\t`(last=${lastBalance === null ? '<unavailable>' : lastBalance}).`,\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t'The faucet or funding strategy returned before the funded coin became spendable. ' +\n\t\t\t\t\t\t\t'Check the funding strategy finality gate and Sui RPC health.',\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tyield* Effect.sleep(Duration.millis(FUNDING_SETTLEMENT_INTERVAL_MS));\n\t\t}\n\t});\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"funding.mjs","names":[],"sources":["../../../src/plugins/account/funding.ts"],"sourcesContent":["// Account plugin — funding logic.\n//\n// Two funding paths converge here:\n//\n// 1. **Default funding** — applies to the `ephemeral` variant only.\n// On non-fork networks: faucet POST via the SUI HTTP strategy\n// auto-registered by Faucet (see 11-faucet.md). On fork networks:\n// \"pay from a seed via impersonation\" because forks have no\n// faucet. The auto-promotion is LOUD by default per the\n// architecture's \"no silent surprises\" principle — we emit a\n// `log.appended` event the first time a stack hits this path.\n//\n// 2. **Cross-cutting funding** — declared per-account via\n// `AccountOptions.funding`. Applies to every variant.\n// Dispatched through the ambient strategy registry. Missing\n// strategy for non-SUI coins ⇒ silent noop (architecture-\n// mandated test-ergonomics contract, distilled-doc invariant:\n// \"Optional Faucet is a noop, not an error\"). Explicit SUI\n// entries use the SUI faucet strategy and fail loudly when no\n// faucet-bearing strategy exists.\n//\n// Distilled-doc invariant: per-address serialization — concurrent\n// funding requests for the same address MUST serialize. We share the\n// substrate `LeaseBroker` handle from `service.ts` and open a fresh\n// scope per wire call so the lease releases the moment that call\n// returns. Each cross-cutting iteration is its own scope: the broker\n// is non-reentrant by design, so a hypothetical loop holding a single\n// lease across iterations would deadlock the second one.\n\nimport { Effect } from 'effect';\n\nimport { FAUCET_CAPABILITY_KEY_PREFIX, type FaucetStrategy } from '../faucet/index.ts';\nimport {\n\tchainKeyedStrategyFor,\n\tStrategyRegistryService,\n} from '../../substrate/runtime/strategy-registry/index.ts';\nimport type { AnyResourceRef, ResourceRef } from '../../api/define-plugin.ts';\nimport type { LeaseBroker } from '../../substrate/runtime/lease-broker/index.ts';\nimport type { ChainId } from '../../substrate/brand.ts';\nimport type {\n\tAccountFundingRequest as ContractAccountFundingRequest,\n\tAccountFundingStrategy as ContractAccountFundingStrategy,\n} from '../../contracts/funding-strategy.ts';\nimport { setCurrentPluginPhase } from '../../substrate/runtime/current-plugin.ts';\nimport {\n\tBALANCE_POLL_PROFILE,\n\tmakeBoundedSpacedSchedule,\n} from '../../substrate/runtime/retry-policy.ts';\n\nimport {\n\taccountAcquireError,\n\ttype AccountAcquireError,\n\ttype AccountVariantKind,\n} from './errors.ts';\nimport { withAddressLease } from './lease.ts';\nimport { fundingFailureError } from '../internal/funding-failure-error.ts';\nimport type { AccountValue } from './service.ts';\nimport { AccountSpans } from './spans.ts';\nimport { SuiSpans } from '../sui/index.ts';\n\n// `CoinResourceId` is the literal-typed resource id the coin plugin\n// publishes. Inlined here as `coin:${Sym}` so this file does NOT\n// cross-import the coin plugin — the substrate's compose-time dedup\n// works by string equality on the resource id, and the coin plugin's\n// `coinResourceId` constructor produces the same shape. This is the\n// per-Task-A \"inline the literal type alias\" decision (the literal\n// pattern is the contract; promoting it to a substrate type would\n// be more ceremony than the single string template warrants).\ntype CoinResourceId<Sym extends string> = `coin:${Sym}`;\n\n/** Direct resource ref shape for a coin upstream. The user passes the\n * result of `coin.fromPackage(...)` / `coin.known(...)` /\n * `coin.builtin(...)` — NOT a bare string or discriminator. Generic\n * over the literal symbol so the account's dependency tuple preserves\n * each per-coin resource id (`coin:managed_coin/managed_coin`,\n * `coin:wal`, ...).\n *\n * Architecture (Direct Member Refs): cross-plugin references at the\n * user-facing surface are plugin/resource refs directly — no opaque\n * tag or string discriminator vocabulary. */\nexport interface AccountFundingCoinValue {\n\treadonly fullCoinType: string;\n\treadonly symbol?: string;\n}\n\nexport type CoinMember<Sym extends string = string> = ResourceRef<\n\tCoinResourceId<Sym>,\n\tAccountFundingCoinValue\n>;\n\n/** Optional dependency edge for the plugin that contributes the\n * funding strategy. Coin refs force the coin metadata edge; `via`\n * forces the strategy-provider edge (e.g. a known DeepBook\n * deployment that contributes `coinType:<DEEP>`). */\nexport type CrossCuttingFundingProvider = AnyResourceRef | readonly AnyResourceRef[];\n\n/** Built-in SUI funding entry. This uses the same account funding\n * list as arbitrary coins but avoids requiring `coin.builtin('sui')`\n * for the normal SUI faucet path. */\nexport interface SuiFundingEntry {\n\treadonly coin: 'sui';\n\treadonly amount: number | bigint;\n}\n\n/** A single cross-cutting funding entry. `coin` is a direct member ref\n * (the value returned by `coin.fromPackage(...)` etc.) — the account plugin\n * threads it through `dependsOn` so the substrate's dep graph forces\n * the publishing / discovery edge to land before funding.\n *\n * Distilled-doc invariant (\"Strict upstream declaration\"): coin\n * references cited by Account must force a dep edge. `via` is the\n * same contract for the strategy contributor that can satisfy the\n * funding request. */\nexport interface CrossCuttingFundingEntry<M extends CoinMember = CoinMember> {\n\treadonly coin: M;\n\treadonly amount: bigint;\n\treadonly via?: CrossCuttingFundingProvider;\n}\n\nexport type AccountFundingEntry<M extends CoinMember = CoinMember> =\n\t| SuiFundingEntry\n\t| CrossCuttingFundingEntry<M>;\n\nexport type AccountFunding = ReadonlyArray<AccountFundingEntry>;\n\n/** Internal projected shape — the acquire body in `account/index.ts`\n * receives each funding entry's resolved `CoinValue`, reads\n * `fullCoinType`, and passes the projected entries to\n * `applyCrossCuttingFunding`. The funding pass never sees the raw\n * member refs — keeps the strategy dispatch logic\n * substrate-name-blind. */\nexport interface ProjectedFundingEntry {\n\treadonly coin: string;\n\treadonly fullCoinType: string;\n\treadonly amount: bigint;\n}\n\nexport type ProjectedFunding = ReadonlyArray<ProjectedFundingEntry>;\n\n/** Outcome marker carried on each `applied` entry — distinguishes a\n * faucet/strategy call that actually moved funds (`'funded'`) from\n * the short-circuit case where the existing balance already covered\n * the request (`'already-satisfied'`). Downstream projection turns\n * this into the `AccountRegistryFundingEntry.status` column so a\n * no-faucet-call entry is not mislabeled as \"funded\".\n *\n * Distilled-doc invariant: the `applied` projection must reflect\n * what actually happened — not the user's request shape. */\nexport type AppliedFundingOutcome = 'funded' | 'already-satisfied';\n\nexport interface AppliedFundingEntry extends ProjectedFundingEntry {\n\treadonly outcome: AppliedFundingOutcome;\n}\n\nexport type AppliedFunding = ReadonlyArray<AppliedFundingEntry>;\n\nexport interface AccountFundingResult {\n\treadonly requested: ProjectedFunding;\n\treadonly applied: AppliedFunding;\n}\n\n/** Account-bus projection of the substrate funding-request contract\n * (`contracts/funding-strategy.ts`). Narrows the contract's generic\n * account-handle slot to the concrete `AccountValue` this plugin\n * publishes; strategies inside account or in sibling plugins\n * (coin/walrus/deepbook) see the real handle type without re-stating\n * the substrate shape. */\nexport type AccountFundingRequest = ContractAccountFundingRequest<AccountValue>;\n\n/** Account-bus projection of the substrate strategy contract. The\n * generic account-handle slot is fixed to `AccountValue` so\n * contributing plugins receive a typed account handle. */\nexport type AccountFundingStrategy<E = unknown> = ContractAccountFundingStrategy<E, AccountValue>;\n\nexport interface FundingBalanceReader {\n\treadonly readBalance: (args: {\n\t\treadonly owner: string;\n\t\treadonly coinType: string;\n\t}) => Effect.Effect<bigint | null>;\n}\n\n/** Sentinel brand identifying the test-only no-op reader. Surfaced as\n * a separate `readonly skipFinalityWait?: true` discriminator on\n * `NULL_BALANCE_READER` so the funding pass can short-circuit the\n * finality wait deterministically WITHOUT exhausting the bounded\n * poll schedule. Production readers MUST NOT set this. */\ninterface NullBalanceReader extends FundingBalanceReader {\n\treadonly skipFinalityWait: true;\n}\n\n/** Test-only no-op balance reader.\n *\n * Production callers (`account/service.ts`) build a real reader from\n * the live SDK via `makeFundingBalanceReader`; the funding pass\n * REQUIRES a reader so the post-faucet finality wait is load-bearing\n * on real wire calls. Tests that don't model the read/poll loop pass\n * this sentinel to explicitly opt OUT of the wait — the absence of\n * this opt-out previously hid as a silent `Effect.void` short-circuit\n * on any production caller that forgot to wire the reader. */\nexport const NULL_BALANCE_READER: FundingBalanceReader = {\n\treadBalance: () => Effect.succeed(null),\n\tskipFinalityWait: true,\n} as NullBalanceReader;\n\nconst skipsFinalityWait = (reader: FundingBalanceReader): boolean =>\n\t(reader as NullBalanceReader).skipFinalityWait === true;\n\n/** The canonical builtin SUI coin type. Used by the funding dispatch\n * to route SUI entries to the faucet strategy (same key as the\n * default-funding pass), and by everything that needs to detect\n * \"this is the protocol-defined SUI\". Mirrors `BUILTIN_COINS.sui`\n * in the coin plugin. */\nexport const SUI_FULL_COIN_TYPE = '0x2::sui::SUI' as const;\n\n/** Default funding amount for ephemeral accounts — 1 SUI in MIST.\n * Documented at the user-facing factory so a bare `account('alice')`\n * is predictable. */\nexport const DEFAULT_EPHEMERAL_FUND_MIST = 1_000_000_000n;\n\n/** Inputs the default-funding pass needs from the per-acquire ctx. */\nexport interface FundEphemeralDefaultArgs {\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly amountMist: bigint;\n\treadonly suiMode: 'local' | 'local-rpc' | 'live' | 'fork';\n\t/** Resolved sui chain id — the substrate-level chain identity used\n\t * to compose the faucet strategy's capability key\n\t * (`faucet:request:<chainId>`). */\n\treadonly chainId: ChainId;\n\t/** Loud-by-default auto-promotion event (called on fork before the\n\t * strategy is invoked, per the architecture's \"no silent surprises\"\n\t * principle). */\n\treadonly emitAutoPromotionEvent: () => Effect.Effect<void>;\n\t/** Substrate lease-broker handle — funding opens a fresh scope per\n\t * wire call and acquires the per-address lease so concurrent wire\n\t * calls for the same address serialize at the chain boundary. */\n\treadonly broker: LeaseBroker;\n\t/** Required. Production callers build this from the SDK via\n\t * `makeFundingBalanceReader`; tests that don't model the read/poll\n\t * loop opt out explicitly with `NULL_BALANCE_READER`. The previous\n\t * optional shape allowed a silent `Effect.void` short-circuit on\n\t * the finality wait when callers forgot to wire it. */\n\treadonly balanceReader: FundingBalanceReader;\n}\n\n/** Outcome of `fundEphemeralDefault`. `'skipped'` covers the\n * zero-amount no-op; `'already-satisfied'` covers the pre-existing-\n * balance short-circuit (no faucet call); `'funded'` covers the\n * successful wire path. Callers project this into the `applied`\n * shape so the `funded`-vs-`already-satisfied` distinction survives\n * to the registry projection. */\nexport type FundEphemeralDefaultOutcome = 'funded' | 'already-satisfied' | 'skipped';\n\n/** Apply the default-funding pass for an ephemeral account.\n *\n * Wiring: yields `StrategyRegistryService` (the R-channel from\n * Round 7), looks up the faucet strategy registered by the Sui\n * plugin under `faucet:request:<chainId>`, and dispatches a request\n * through it. Per-address serialization is enforced by acquiring\n * the address lock around the wire call. */\nexport const fundEphemeralDefault = (\n\tparts: FundEphemeralDefaultArgs,\n): Effect.Effect<FundEphemeralDefaultOutcome, AccountAcquireError, StrategyRegistryService> =>\n\tEffect.gen(function* () {\n\t\t// LOUD AUTO-PROMOTION — distilled-doc invariant: \"no silent\n\t\t// surprises\". Emit BEFORE attempting the dispatch so the user\n\t\t// sees the path change even if the wire call subsequently\n\t\t// fails. On fork we surface the path-change event; on non-fork\n\t\t// the strategy registered by Sui IS the canonical default and\n\t\t// no auto-promotion is needed.\n\t\tif (parts.suiMode === 'fork') {\n\t\t\tyield* parts.emitAutoPromotionEvent();\n\t\t}\n\n\t\t// Zero-amount short-circuit — both real strategies treat zero\n\t\t// as a no-op; doing the same here avoids a registry lookup +\n\t\t// span emission for the legitimately-no-funding case.\n\t\tif (parts.amountMist <= 0n) {\n\t\t\treturn 'skipped' as const;\n\t\t}\n\n\t\tyield* setCurrentPluginPhase('checking SUI funding');\n\t\tconst existingBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\towner: parts.address,\n\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t});\n\t\tif (existingBalance !== null && existingBalance >= parts.amountMist) {\n\t\t\treturn 'already-satisfied' as const;\n\t\t}\n\n\t\t// Look up the strategy. Sui auto-registers a faucet strategy\n\t\t// on non-fork modes; fork-mode strategies have to be supplied\n\t\t// by the faucet plugin (with the fork admin closed over). If\n\t\t// nothing is registered we surface a typed, actionable error\n\t\t// pointing at the architecture's contract: ephemeral-on-non-\n\t\t// fork without a Faucet MUST fail at acquire time.\n\t\tconst strategy = yield* chainKeyedStrategyFor<FaucetStrategy>(\n\t\t\tFAUCET_CAPABILITY_KEY_PREFIX,\n\t\t\tparts.chainId,\n\t\t).pipe(\n\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\tphase: 'fund-default',\n\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Account '${parts.accountName}': no faucet strategy registered for ` +\n\t\t\t\t\t\t\t`chain '${parts.chainId}' (sui mode=${parts.suiMode}). ` +\n\t\t\t\t\t\t\t`Registered keys: [${err.registeredKeys.join(', ')}].`,\n\t\t\t\t\t\thint:\n\t\t\t\t\t\t\tparts.suiMode === 'fork'\n\t\t\t\t\t\t\t\t? 'Fork networks have no HTTP faucet — compose a plugin that contributes defineFaucetStrategy(...) for this chain id.'\n\t\t\t\t\t\t\t\t: 'Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack.',\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\t// Per-address serialization around the wire call. The lease is\n\t\t// scope-bound and releases as soon as `request(...)` returns;\n\t\t// two concurrent funding requests for the same address — e.g.\n\t\t// ephemeral default + cross-cutting SUI top-up — interleave\n\t\t// deterministically via the broker's FIFO queue.\n\t\tconst wrapFaucetFailure = (cause: {\n\t\t\treadonly _tag: 'FaucetUnreachable' | 'FaucetExhausted' | 'FaucetBodyError';\n\t\t}) =>\n\t\t\tEffect.fail(\n\t\t\t\tfundingFailureError({\n\t\t\t\t\tphase: 'fund-default',\n\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\tvariant: 'ephemeral',\n\t\t\t\t\tchainId: parts.chainId,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t\t);\n\t\tyield* setCurrentPluginPhase('funding SUI');\n\t\tyield* withAddressLease(\n\t\t\tparts.broker,\n\t\t\tparts.accountName,\n\t\t\tparts.address,\n\t\t\tstrategy.request({ address: parts.address, amount: parts.amountMist }).pipe(\n\t\t\t\tEffect.catchTags({\n\t\t\t\t\tFaucetUnreachable: wrapFaucetFailure,\n\t\t\t\t\tFaucetExhausted: wrapFaucetFailure,\n\t\t\t\t\tFaucetBodyError: wrapFaucetFailure,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t\tyield* setCurrentPluginPhase('waiting for SUI funding settlement');\n\t\tyield* waitForBalanceAtLeast({\n\t\t\tbalanceReader: parts.balanceReader,\n\t\t\taccountName: parts.accountName,\n\t\t\tvariant: 'ephemeral',\n\t\t\tphase: 'fund-default',\n\t\t\towner: parts.address,\n\t\t\tcoinType: SUI_FULL_COIN_TYPE,\n\t\t\tcoinLabel: 'SUI',\n\t\t\tamount: parts.amountMist,\n\t\t});\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t[AccountSpans.name]: parts.accountName,\n\t\t\t[AccountSpans.address]: parts.address,\n\t\t\t[AccountSpans.fundAmountMist]: parts.amountMist.toString(),\n\t\t\t[SuiSpans.chain]: parts.chainId,\n\t\t\t[SuiSpans.mode]: parts.suiMode,\n\t\t});\n\t\treturn 'funded' as const;\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.account.fundEphemeralDefault', {\n\t\t\tattributes: {\n\t\t\t\t[AccountSpans.name]: parts.accountName,\n\t\t\t\t[AccountSpans.address]: parts.address,\n\t\t\t\t[SuiSpans.mode]: parts.suiMode,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Inputs the cross-cutting funding pass needs from the per-acquire ctx.\n *\n * `funding` is the PROJECTED shape — the acquire body in\n * `account/index.ts` receives each user-supplied `CoinMember` as a\n * resolved dependency and projects to `{fullCoinType, amount}` BEFORE\n * invoking this pass. Keeps the dispatch logic substrate-name-blind. */\nexport interface ApplyCrossCuttingFundingArgs {\n\treadonly accountName: string;\n\treadonly address: string;\n\treadonly variant: AccountVariantKind;\n\treadonly account: AccountValue;\n\treadonly funding: ProjectedFunding;\n\treadonly chainId: ChainId;\n\treadonly broker: LeaseBroker;\n\t/** Required. See `FundEphemeralDefaultArgs.balanceReader`. */\n\treadonly balanceReader: FundingBalanceReader;\n}\n\n/** Apply the cross-cutting funding pass. Variant-agnostic — runs for\n * every variant once the keypair / impersonation slot is bound and\n * the address is known.\n *\n * Distilled-doc invariant: \"Optional Faucet is a noop, not an\n * error\". Absence of a registered strategy for a non-SUI coin's\n * capability key short-circuits silently (the entry is dropped).\n * Explicit SUI entries are stricter: they route through the active\n * chain's faucet strategy and fail loudly when none is registered.\n * This lets a test author opt INTO arbitrary-coin funding without\n * forcing every surrounding network to satisfy every custom coin.\n *\n * Wiring: SUI entries (`fullCoinType === '0x2::sui::SUI'`) dispatch\n * through `faucet:request:<chainId>` (same key as the default pass);\n * other entries dispatch through `coinType:<fullCoinType>` keys\n * contributed by the respective Coin/Walrus/Seal plugins.\n *\n * Entries are processed serially. Strategies that use the resolved\n * account signer acquire the per-address lease internally; strategies\n * that do not are wrapped by this dispatcher. */\nexport const applyCrossCuttingFunding = (\n\tparts: ApplyCrossCuttingFundingArgs,\n): Effect.Effect<AppliedFunding, AccountAcquireError, StrategyRegistryService> =>\n\tEffect.gen(function* () {\n\t\tif (parts.funding.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tconst registry = yield* StrategyRegistryService;\n\t\tconst applied: AppliedFundingEntry[] = [];\n\n\t\tfor (const entry of parts.funding) {\n\t\t\tif (entry.amount <= 0n) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tyield* setCurrentPluginPhase(`checking ${entry.coin} funding`);\n\t\t\tconst existingBalance = yield* readExistingBalance(parts.balanceReader, {\n\t\t\t\towner: parts.address,\n\t\t\t\tcoinType: entry.fullCoinType,\n\t\t\t});\n\t\t\tif (existingBalance !== null && existingBalance >= entry.amount) {\n\t\t\t\tapplied.push({ ...entry, outcome: 'already-satisfied' });\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Resolve the capability key from the projected coin type.\n\t\t\t//\n\t\t\t// SUI (`0x2::sui::SUI`) → reuse the faucet-request key so the\n\t\t\t// SUI auto-registered strategy fields the request (this\n\t\t\t// matches the default-funding pass and keeps the registry\n\t\t\t// surface uniform). The faucet contract takes\n\t\t\t// `{address, amount}` only (it never sees the resolved\n\t\t\t// account handle) — kept as its own helper so the typing is\n\t\t\t// honest at the dispatch site.\n\t\t\t//\n\t\t\t// Everything else → `coinType:<fullCoinType>` so user-defined\n\t\t\t// Coin plugins (and Walrus's exchange strategy keyed by\n\t\t\t// `coinType:<WAL fullCoinType>`) can contribute strategies\n\t\t\t// declaratively. These satisfy `AccountFundingStrategy` and\n\t\t\t// receive the resolved account handle in the request.\n\t\t\tconst isSui = entry.fullCoinType === SUI_FULL_COIN_TYPE;\n\t\t\tconst coinKey = `coinType:${entry.fullCoinType}` as const;\n\t\t\tconst key = isSui ? (`faucet:request:${parts.chainId}` as const) : coinKey;\n\n\t\t\tconst wrapCrossCuttingFailure = (cause: unknown): AccountAcquireError =>\n\t\t\t\tfundingFailureError({\n\t\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\tkey,\n\t\t\t\t\tamount: entry.amount,\n\t\t\t\t\tcause,\n\t\t\t\t});\n\n\t\t\tlet request: Effect.Effect<void, AccountAcquireError>;\n\t\t\tlet usesAccountSigner = false;\n\t\t\tif (isSui) {\n\t\t\t\t// FaucetStrategy lookup — request shape is `{address, amount}`.\n\t\t\t\t// Architecture-distilled: explicit SUI entries are the\n\t\t\t\t// normal gas faucet path, so missing strategy is\n\t\t\t\t// actionable and loud (no silent drop).\n\t\t\t\tconst strategy = yield* chainKeyedStrategyFor<FaucetStrategy>(\n\t\t\t\t\tFAUCET_CAPABILITY_KEY_PREFIX,\n\t\t\t\t\tparts.chainId,\n\t\t\t\t).pipe(\n\t\t\t\t\tEffect.catchTag('StrategyNotFoundError', (err) =>\n\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\taccountAcquireError({\n\t\t\t\t\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\t\t\t\t\taccountName: parts.accountName,\n\t\t\t\t\t\t\t\tvariant: parts.variant,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`Account '${parts.accountName}': no SUI funding strategy registered ` +\n\t\t\t\t\t\t\t\t\t`for chain '${parts.chainId}'. Registered keys: [${err.registeredKeys.join(', ')}].`,\n\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t\thint: 'Ensure a sui() plugin with a faucet-bearing mode (local/live-testnet/live-devnet) is in the stack.',\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\trequest = strategy\n\t\t\t\t\t.request({ address: parts.address, amount: entry.amount })\n\t\t\t\t\t.pipe(Effect.mapError(wrapCrossCuttingFailure));\n\t\t\t} else {\n\t\t\t\t// AccountFundingStrategy lookup — request shape is\n\t\t\t\t// `{address, amount, account}`. Architecture-distilled:\n\t\t\t\t// optional-faucet-is-noop for arbitrary coins — missing\n\t\t\t\t// registration short-circuits silently rather than\n\t\t\t\t// failing the acquire.\n\t\t\t\tconst strategy = yield* registry\n\t\t\t\t\t.get<typeof coinKey, AccountFundingStrategy>(coinKey)\n\t\t\t\t\t.pipe(\n\t\t\t\t\t\tEffect.catchTag('StrategyNotFoundError', () =>\n\t\t\t\t\t\t\tEffect.succeed(null as AccountFundingStrategy | null),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\tif (strategy === null) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tusesAccountSigner = strategy.usesAccountSigner === true;\n\t\t\t\trequest = strategy\n\t\t\t\t\t.request({ address: parts.address, amount: entry.amount, account: parts.account })\n\t\t\t\t\t.pipe(Effect.mapError(wrapCrossCuttingFailure));\n\t\t\t}\n\n\t\t\tyield* setCurrentPluginPhase(`funding ${entry.coin}`);\n\t\t\tyield* usesAccountSigner\n\t\t\t\t? request\n\t\t\t\t: withAddressLease(parts.broker, parts.accountName, parts.address, request);\n\t\t\tyield* setCurrentPluginPhase(`waiting for ${entry.coin} funding settlement`);\n\t\t\tyield* waitForBalanceAtLeast({\n\t\t\t\tbalanceReader: parts.balanceReader,\n\t\t\t\taccountName: parts.accountName,\n\t\t\t\tvariant: parts.variant,\n\t\t\t\tphase: 'fund-cross-cutting',\n\t\t\t\towner: parts.address,\n\t\t\t\tcoinType: entry.fullCoinType,\n\t\t\t\tcoinLabel: entry.coin,\n\t\t\t\tamount: entry.amount,\n\t\t\t});\n\t\t\tapplied.push({ ...entry, outcome: 'funded' });\n\t\t}\n\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t[AccountSpans.name]: parts.accountName,\n\t\t\t[AccountSpans.address]: parts.address,\n\t\t\t[AccountSpans.fundCrossCuttingCount]: parts.funding.length,\n\t\t\t[SuiSpans.chain]: parts.chainId,\n\t\t});\n\t\treturn applied;\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.account.applyCrossCuttingFunding', {\n\t\t\tattributes: {\n\t\t\t\t[AccountSpans.name]: parts.accountName,\n\t\t\t\t[AccountSpans.address]: parts.address,\n\t\t\t\t[AccountSpans.fundCrossCuttingEntries]: parts.funding.length,\n\t\t\t},\n\t\t}),\n\t);\n\nconst readExistingBalance = (\n\tbalanceReader: FundingBalanceReader,\n\targs: {\n\t\treadonly owner: string;\n\t\treadonly coinType: string;\n\t},\n): Effect.Effect<bigint | null> => balanceReader.readBalance(args);\n\nconst waitForBalanceAtLeast = (parts: {\n\treadonly balanceReader: FundingBalanceReader;\n\treadonly accountName: string;\n\treadonly variant: AccountVariantKind;\n\treadonly phase: 'fund-default' | 'fund-cross-cutting';\n\treadonly owner: string;\n\treadonly coinType: string;\n\treadonly coinLabel: string;\n\treadonly amount: bigint;\n}): Effect.Effect<void, AccountAcquireError> => {\n\tconst reader = parts.balanceReader;\n\t// Test-only opt-out — the `NULL_BALANCE_READER` sentinel explicitly\n\t// declares \"this caller doesn't model the read/poll loop\". Production\n\t// readers never set `skipFinalityWait`, so the wait stays load-bearing\n\t// on real wire calls.\n\tif (skipsFinalityWait(reader)) {\n\t\treturn Effect.void;\n\t}\n\treturn Effect.gen(function* () {\n\t\tconst read = readExistingBalance(reader, {\n\t\t\towner: parts.owner,\n\t\t\tcoinType: parts.coinType,\n\t\t});\n\t\tconst lastBalance = yield* read.pipe(\n\t\t\tEffect.repeat({\n\t\t\t\tschedule: makeBoundedSpacedSchedule(\n\t\t\t\t\tBALANCE_POLL_PROFILE.intervalMs,\n\t\t\t\t\tBALANCE_POLL_PROFILE.timeoutMs,\n\t\t\t\t),\n\t\t\t\tuntil: (balance) => balance !== null && balance >= parts.amount,\n\t\t\t}),\n\t\t);\n\t\tif (lastBalance !== null && lastBalance >= parts.amount) {\n\t\t\treturn;\n\t\t}\n\t\treturn yield* Effect.fail(\n\t\t\taccountAcquireError({\n\t\t\t\tphase: parts.phase,\n\t\t\t\taccountName: parts.accountName,\n\t\t\t\tvariant: parts.variant,\n\t\t\t\tmessage:\n\t\t\t\t\t`Account '${parts.accountName}': funding for ${parts.coinLabel} was accepted ` +\n\t\t\t\t\t`but balance did not reach ${parts.amount} before the settlement timeout ` +\n\t\t\t\t\t`(last=${lastBalance === null ? '<unavailable>' : lastBalance}).`,\n\t\t\t\thint:\n\t\t\t\t\t'The faucet or funding strategy returned before the funded coin became spendable. ' +\n\t\t\t\t\t'Check the funding strategy finality gate and Sui RPC health.',\n\t\t\t}),\n\t\t);\n\t});\n};\n"],"mappings":"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"}
@@ -3,12 +3,11 @@ import { ProjectionDecl } from "../../contracts/projection.mjs";
3
3
  import { SnapshotableDecl } from "../../contracts/snapshotable.mjs";
4
4
  import { StrategyContributorDecl } from "../../contracts/strategy-contributor.mjs";
5
5
  import { AnyResourceRef, Plugin, ResourceRef } from "../../substrate/plugin.mjs";
6
- import { SeedObjectsAccumulator } from "../sui/seed-objects.mjs";
7
6
  import { SuiClient } from "../sui/mode/shared.mjs";
8
7
  import { SuiOptions } from "../sui/mode/spec.mjs";
9
8
  import { AccountAcquireError, AccountAcquirePhase, AccountError, AccountSignError, AccountSignPhase, AccountVariantKind } from "./errors.mjs";
10
- import { AccountOptions, AccountValue, TxResult } from "./service.mjs";
11
- import { AccountFunding, AccountFundingCoinValue, AccountFundingEntry, AccountFundingRequest, AccountFundingResult, AccountFundingStrategy, CoinMember, CrossCuttingFundingEntry, CrossCuttingFundingProvider, DEFAULT_EPHEMERAL_FUND_MIST, ProjectedFunding, ProjectedFundingEntry, SUI_FULL_COIN_TYPE, SuiFundingEntry } from "./funding.mjs";
9
+ import { AccountOptions, AccountValue, SignAndExecuteResult, TxResult } from "./service.mjs";
10
+ import { AccountFunding, AccountFundingCoinValue, AccountFundingEntry, AccountFundingRequest, AccountFundingResult, AccountFundingStrategy, AppliedFunding, AppliedFundingEntry, AppliedFundingOutcome, CoinMember, CrossCuttingFundingEntry, CrossCuttingFundingProvider, DEFAULT_EPHEMERAL_FUND_MIST, ProjectedFunding, ProjectedFundingEntry, SUI_FULL_COIN_TYPE, SuiFundingEntry } from "./funding.mjs";
12
11
  import { AccountRegistryEntry, AccountRegistryFunding } from "./registry.mjs";
13
12
  import { AccountBindings } from "./codegen.mjs";
14
13
  import { ResolvedKeypair, SignatureScheme } from "./keypair.mjs";
@@ -47,7 +46,6 @@ type FundingEntryProviderDependencies<Entry> = Entry extends {
47
46
  type FundingProviderDependencies<Entries extends readonly unknown[]> = Entries extends readonly [infer Head, ...infer Tail] ? readonly [...FundingEntryProviderDependencies<Head>, ...FundingProviderDependencies<Tail>] : readonly [];
48
47
  declare const account: <const N extends string, const Funding extends AccountFunding = readonly []>(name: N, opts?: AccountOptions<Funding>) => Plugin<`account/${N}`, AccountValue, readonly [ResourceRef<"sui", SuiClient & {
49
48
  readonly mode: SuiOptions["mode"];
50
- readonly seedObjects: SeedObjectsAccumulator;
51
49
  }>, ...FundingCoinDependencies<Funding>, ...FundingProviderDependencies<Funding>], readonly [SnapshotableDecl, CodegenableDecl<`account/${N}`>, StrategyContributorDecl<`account:${N}`, AccountRegistryEntry>, ProjectionDecl]>;
52
50
  //#endregion
53
51
  export { AccountResourceId, account };