@mysten-incubation/devstack 0.0.1 → 0.1.1

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 +8 -4
  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 +41 -0
  152. package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
  153. package/dist/orchestrators/codegen/paths.d.mts +1 -1
  154. package/dist/orchestrators/codegen/paths.mjs +40 -14
  155. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  156. package/dist/orchestrators/codegen/permissions.mjs +3 -1
  157. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  158. package/dist/orchestrators/codegen/service.mjs +157 -105
  159. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  160. package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
  161. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
  162. package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
  163. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
  164. package/dist/orchestrators/router/cleanup.mjs +26 -27
  165. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  166. package/dist/orchestrators/router/entrypoints.mjs +2 -2
  167. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  168. package/dist/orchestrators/router/file-provider.mjs +14 -5
  169. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  170. package/dist/orchestrators/router/hostname.mjs +19 -55
  171. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  172. package/dist/orchestrators/router/index.mjs +11 -0
  173. package/dist/orchestrators/router/profile.mjs +2 -2
  174. package/dist/orchestrators/router/sentinels.mjs +26 -0
  175. package/dist/orchestrators/router/sentinels.mjs.map +1 -0
  176. package/dist/orchestrators/router/service.mjs +40 -37
  177. package/dist/orchestrators/router/service.mjs.map +1 -1
  178. package/dist/orchestrators/router/traefik-container.mjs +27 -16
  179. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  180. package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
  181. package/dist/orchestrators/run.mjs.map +1 -0
  182. package/dist/orchestrators/runtime-composition.d.mts +1 -1
  183. package/dist/orchestrators/runtime-composition.mjs +123 -39
  184. package/dist/orchestrators/runtime-composition.mjs.map +1 -1
  185. package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
  186. package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
  187. package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
  188. package/dist/orchestrators/snapshot/capture.mjs +42 -28
  189. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  190. package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
  191. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  192. package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
  193. package/dist/orchestrators/snapshot/index.mjs +13 -0
  194. package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
  195. package/dist/orchestrators/snapshot/integrity.mjs +73 -17
  196. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  197. package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
  198. package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
  199. package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
  200. package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
  201. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
  202. package/dist/orchestrators/snapshot/prune.mjs +20 -55
  203. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  204. package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
  205. package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
  206. package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
  207. package/dist/orchestrators/snapshot/restore.mjs +118 -84
  208. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  209. package/dist/orchestrators/snapshot/service.mjs +53 -56
  210. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  211. package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
  212. package/dist/orchestrators/snapshot/state-document.mjs +47 -7
  213. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
  214. package/dist/orchestrators/snapshot/wipe.mjs +67 -10
  215. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  216. package/dist/plugins/account/codegen.mjs +9 -8
  217. package/dist/plugins/account/codegen.mjs.map +1 -1
  218. package/dist/plugins/account/errors.d.mts +33 -6
  219. package/dist/plugins/account/errors.mjs.map +1 -1
  220. package/dist/plugins/account/funding.d.mts +29 -19
  221. package/dist/plugins/account/funding.mjs +84 -66
  222. package/dist/plugins/account/funding.mjs.map +1 -1
  223. package/dist/plugins/account/index.d.mts +2 -4
  224. package/dist/plugins/account/index.mjs +64 -31
  225. package/dist/plugins/account/index.mjs.map +1 -1
  226. package/dist/plugins/account/keypair.mjs +6 -9
  227. package/dist/plugins/account/keypair.mjs.map +1 -1
  228. package/dist/plugins/account/lease.mjs +1 -0
  229. package/dist/plugins/account/lease.mjs.map +1 -1
  230. package/dist/plugins/account/registry.d.mts +14 -1
  231. package/dist/plugins/account/registry.mjs +18 -18
  232. package/dist/plugins/account/registry.mjs.map +1 -1
  233. package/dist/plugins/account/service.d.mts +23 -4
  234. package/dist/plugins/account/service.mjs +83 -45
  235. package/dist/plugins/account/service.mjs.map +1 -1
  236. package/dist/plugins/account/snapshot.mjs +2 -5
  237. package/dist/plugins/account/snapshot.mjs.map +1 -1
  238. package/dist/plugins/account/spans.mjs +16 -0
  239. package/dist/plugins/account/spans.mjs.map +1 -0
  240. package/dist/plugins/account/variants/keystore.mjs +6 -8
  241. package/dist/plugins/account/variants/keystore.mjs.map +1 -1
  242. package/dist/plugins/action/build-context.d.mts +3 -2
  243. package/dist/plugins/action/errors.d.mts +16 -12
  244. package/dist/plugins/action/errors.mjs.map +1 -1
  245. package/dist/plugins/action/execute.mjs +65 -103
  246. package/dist/plugins/action/execute.mjs.map +1 -1
  247. package/dist/plugins/action/index.d.mts +0 -2
  248. package/dist/plugins/action/index.mjs +17 -13
  249. package/dist/plugins/action/index.mjs.map +1 -1
  250. package/dist/plugins/action/service.mjs +38 -35
  251. package/dist/plugins/action/service.mjs.map +1 -1
  252. package/dist/plugins/action/spans.mjs +11 -0
  253. package/dist/plugins/action/spans.mjs.map +1 -0
  254. package/dist/plugins/coin/codegen.mjs +9 -8
  255. package/dist/plugins/coin/codegen.mjs.map +1 -1
  256. package/dist/plugins/coin/discovery.mjs +8 -4
  257. package/dist/plugins/coin/discovery.mjs.map +1 -1
  258. package/dist/plugins/coin/index.d.mts +11 -29
  259. package/dist/plugins/coin/index.mjs +56 -27
  260. package/dist/plugins/coin/index.mjs.map +1 -1
  261. package/dist/plugins/coin/metadata.mjs +8 -15
  262. package/dist/plugins/coin/metadata.mjs.map +1 -1
  263. package/dist/plugins/coin/mint.d.mts +30 -11
  264. package/dist/plugins/coin/mint.mjs +78 -74
  265. package/dist/plugins/coin/mint.mjs.map +1 -1
  266. package/dist/plugins/coin/registry.mjs +4 -7
  267. package/dist/plugins/coin/registry.mjs.map +1 -1
  268. package/dist/plugins/coin/service.d.mts +39 -1
  269. package/dist/plugins/coin/service.mjs +11 -4
  270. package/dist/plugins/coin/service.mjs.map +1 -1
  271. package/dist/plugins/coin/spans.mjs +20 -0
  272. package/dist/plugins/coin/spans.mjs.map +1 -0
  273. package/dist/plugins/dashboard/domain.mjs +402 -0
  274. package/dist/plugins/dashboard/domain.mjs.map +1 -0
  275. package/dist/plugins/dashboard/index.d.mts +29 -0
  276. package/dist/plugins/dashboard/index.mjs +91 -0
  277. package/dist/plugins/dashboard/index.mjs.map +1 -0
  278. package/dist/plugins/dashboard/origin-policy.mjs +36 -0
  279. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
  280. package/dist/plugins/dashboard/routable.mjs +27 -0
  281. package/dist/plugins/dashboard/routable.mjs.map +1 -0
  282. package/dist/plugins/dashboard/schema/builder.mjs +21 -0
  283. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
  284. package/dist/plugins/dashboard/schema/enums.mjs +72 -0
  285. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
  286. package/dist/plugins/dashboard/schema/root.mjs +351 -0
  287. package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
  288. package/dist/plugins/dashboard/schema/types.mjs +508 -0
  289. package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
  290. package/dist/plugins/dashboard/schema.mjs +11 -0
  291. package/dist/plugins/dashboard/schema.mjs.map +1 -0
  292. package/dist/plugins/dashboard/server.mjs +166 -0
  293. package/dist/plugins/dashboard/server.mjs.map +1 -0
  294. package/dist/plugins/deepbook/deploy.mjs +53 -115
  295. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  296. package/dist/plugins/deepbook/errors.mjs +1 -0
  297. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  298. package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
  299. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  300. package/dist/plugins/deepbook/hash.mjs +9 -0
  301. package/dist/plugins/deepbook/hash.mjs.map +1 -0
  302. package/dist/plugins/deepbook/index.d.mts +1 -10
  303. package/dist/plugins/deepbook/index.mjs +25 -22
  304. package/dist/plugins/deepbook/index.mjs.map +1 -1
  305. package/dist/plugins/deepbook/pyth/index.mjs +26 -55
  306. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  307. package/dist/plugins/deepbook/snapshot.mjs +17 -29
  308. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  309. package/dist/plugins/deepbook/spans.mjs +18 -0
  310. package/dist/plugins/deepbook/spans.mjs.map +1 -0
  311. package/dist/plugins/deepbook/type-strings.mjs +65 -0
  312. package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
  313. package/dist/plugins/deepbook/types.d.mts +2 -3
  314. package/dist/plugins/deepbook/types.mjs.map +1 -1
  315. package/dist/plugins/faucet/dispatcher.d.mts +21 -2
  316. package/dist/plugins/faucet/dispatcher.mjs +1 -2
  317. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  318. package/dist/plugins/faucet/errors.d.mts +11 -24
  319. package/dist/plugins/faucet/errors.mjs.map +1 -1
  320. package/dist/plugins/faucet/http.mjs +33 -14
  321. package/dist/plugins/faucet/http.mjs.map +1 -1
  322. package/dist/plugins/faucet/index.d.mts +15 -5
  323. package/dist/plugins/faucet/index.mjs +3 -0
  324. package/dist/plugins/faucet/index.mjs.map +1 -1
  325. package/dist/plugins/faucet/spans.mjs +12 -0
  326. package/dist/plugins/faucet/spans.mjs.map +1 -0
  327. package/dist/plugins/host-service/errors.d.mts +1 -1
  328. package/dist/plugins/host-service/index.mjs +34 -8
  329. package/dist/plugins/host-service/index.mjs.map +1 -1
  330. package/dist/plugins/host-service/routable.mjs +2 -1
  331. package/dist/plugins/host-service/routable.mjs.map +1 -1
  332. package/dist/plugins/host-service/service.d.mts +21 -0
  333. package/dist/plugins/host-service/service.mjs +136 -81
  334. package/dist/plugins/host-service/service.mjs.map +1 -1
  335. package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
  336. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
  337. package/dist/plugins/internal/codegen-helpers.mjs +18 -0
  338. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
  339. package/dist/plugins/internal/funding-failure-error.mjs +32 -0
  340. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
  341. package/dist/plugins/package/build.mjs +1 -1
  342. package/dist/plugins/package/build.mjs.map +1 -1
  343. package/dist/plugins/package/codegen.mjs +26 -0
  344. package/dist/plugins/package/codegen.mjs.map +1 -1
  345. package/dist/plugins/package/errors.d.mts +16 -6
  346. package/dist/plugins/package/errors.mjs.map +1 -1
  347. package/dist/plugins/package/index.d.mts +0 -4
  348. package/dist/plugins/package/index.mjs +27 -21
  349. package/dist/plugins/package/index.mjs.map +1 -1
  350. package/dist/plugins/package/mode-known.mjs +26 -12
  351. package/dist/plugins/package/mode-known.mjs.map +1 -1
  352. package/dist/plugins/package/mode-local.mjs +47 -41
  353. package/dist/plugins/package/mode-local.mjs.map +1 -1
  354. package/dist/plugins/package/publish-executor.mjs +55 -114
  355. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  356. package/dist/plugins/package/registry.mjs +2 -1
  357. package/dist/plugins/package/registry.mjs.map +1 -1
  358. package/dist/plugins/package/service.mjs.map +1 -1
  359. package/dist/plugins/package/spans.mjs +14 -0
  360. package/dist/plugins/package/spans.mjs.map +1 -0
  361. package/dist/plugins/postgres/db-ensure.mjs +19 -12
  362. package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
  363. package/dist/plugins/postgres/errors.d.mts +5 -0
  364. package/dist/plugins/postgres/errors.mjs.map +1 -1
  365. package/dist/plugins/postgres/index.mjs +10 -17
  366. package/dist/plugins/postgres/index.mjs.map +1 -1
  367. package/dist/plugins/postgres/service.mjs +58 -24
  368. package/dist/plugins/postgres/service.mjs.map +1 -1
  369. package/dist/plugins/postgres/snapshot.mjs.map +1 -1
  370. package/dist/plugins/postgres/spans.mjs +11 -0
  371. package/dist/plugins/postgres/spans.mjs.map +1 -0
  372. package/dist/plugins/router-entrypoints.mjs +4 -4
  373. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
  375. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
  377. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  378. package/dist/plugins/seal/codegen.d.mts +2 -3
  379. package/dist/plugins/seal/codegen.mjs.map +1 -1
  380. package/dist/plugins/seal/config-render.mjs +35 -8
  381. package/dist/plugins/seal/config-render.mjs.map +1 -1
  382. package/dist/plugins/seal/deploy.mjs +31 -39
  383. package/dist/plugins/seal/deploy.mjs.map +1 -1
  384. package/dist/plugins/seal/errors.d.mts +1 -3
  385. package/dist/plugins/seal/errors.mjs +7 -1
  386. package/dist/plugins/seal/errors.mjs.map +1 -1
  387. package/dist/plugins/seal/index.d.mts +1 -6
  388. package/dist/plugins/seal/index.mjs +40 -14
  389. package/dist/plugins/seal/index.mjs.map +1 -1
  390. package/dist/plugins/seal/key-manager.d.mts +1 -9
  391. package/dist/plugins/seal/key-manager.mjs +2 -18
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  393. package/dist/plugins/seal/key-server.mjs +37 -36
  394. package/dist/plugins/seal/key-server.mjs.map +1 -1
  395. package/dist/plugins/seal/keygen.mjs +16 -17
  396. package/dist/plugins/seal/keygen.mjs.map +1 -1
  397. package/dist/plugins/seal/mode/fork-known.mjs +36 -14
  398. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  399. package/dist/plugins/seal/mode/live.d.mts +6 -4
  400. package/dist/plugins/seal/mode/live.mjs +14 -21
  401. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  402. package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
  403. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  404. package/dist/plugins/seal/registry-publish.mjs +1 -0
  405. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  406. package/dist/plugins/seal/routable.mjs.map +1 -1
  407. package/dist/plugins/seal/service.mjs.map +1 -1
  408. package/dist/plugins/seal/spans.mjs +18 -0
  409. package/dist/plugins/seal/spans.mjs.map +1 -0
  410. package/dist/plugins/sui/auto-tick.mjs +17 -23
  411. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  412. package/dist/plugins/sui/chain-build-container.mjs +18 -0
  413. package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
  414. package/dist/plugins/sui/chain-probe.d.mts +5 -5
  415. package/dist/plugins/sui/chain-probe.mjs +28 -58
  416. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  417. package/dist/plugins/sui/codegen.mjs +26 -0
  418. package/dist/plugins/sui/codegen.mjs.map +1 -1
  419. package/dist/plugins/sui/errors.d.mts +2 -29
  420. package/dist/plugins/sui/errors.mjs +1 -3
  421. package/dist/plugins/sui/errors.mjs.map +1 -1
  422. package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
  423. package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
  424. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
  425. package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
  426. package/dist/plugins/sui/fork-orchestration.mjs +170 -2
  427. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  428. package/dist/plugins/sui/fork-transaction.d.mts +2 -0
  429. package/dist/plugins/sui/fork-transaction.mjs +92 -28
  430. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  431. package/dist/plugins/sui/index.d.mts +33 -70
  432. package/dist/plugins/sui/index.mjs +58 -35
  433. package/dist/plugins/sui/index.mjs.map +1 -1
  434. package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
  435. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
  436. package/dist/plugins/sui/mode/external.mjs +7 -13
  437. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  438. package/dist/plugins/sui/mode/fork.mjs +136 -59
  439. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  440. package/dist/plugins/sui/mode/live.mjs +10 -16
  441. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  442. package/dist/plugins/sui/mode/local.mjs +37 -36
  443. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  444. package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
  445. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  446. package/dist/plugins/sui/mode/shared.d.mts +1 -5
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  448. package/dist/plugins/sui/mode/spec.d.mts +18 -0
  449. package/dist/plugins/sui/move-summary-runner.mjs +207 -0
  450. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
  451. package/dist/plugins/sui/network-resolver.d.mts +4 -3
  452. package/dist/plugins/sui/service.mjs.map +1 -1
  453. package/dist/plugins/sui/snapshot.mjs +3 -0
  454. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  455. package/dist/plugins/sui/spans.mjs +17 -0
  456. package/dist/plugins/sui/spans.mjs.map +1 -0
  457. package/dist/plugins/wallet/codegen.d.mts +0 -1
  458. package/dist/plugins/wallet/codegen.mjs +8 -9
  459. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  460. package/dist/plugins/wallet/index.d.mts +6 -8
  461. package/dist/plugins/wallet/index.mjs +46 -35
  462. package/dist/plugins/wallet/index.mjs.map +1 -1
  463. package/dist/plugins/wallet/origin-policy.mjs +12 -28
  464. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  465. package/dist/plugins/wallet/pairing.mjs +6 -4
  466. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  467. package/dist/plugins/wallet/protocol.d.mts +1 -0
  468. package/dist/plugins/wallet/protocol.mjs +5 -44
  469. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  470. package/dist/plugins/wallet/routable.mjs +2 -8
  471. package/dist/plugins/wallet/routable.mjs.map +1 -1
  472. package/dist/plugins/wallet/server.mjs +36 -44
  473. package/dist/plugins/wallet/server.mjs.map +1 -1
  474. package/dist/plugins/wallet/service.d.mts +1 -5
  475. package/dist/plugins/wallet/service.mjs +22 -18
  476. package/dist/plugins/wallet/service.mjs.map +1 -1
  477. package/dist/plugins/wallet/spans.mjs +22 -0
  478. package/dist/plugins/wallet/spans.mjs.map +1 -0
  479. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
  480. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  481. package/dist/plugins/walrus/codegen.d.mts +3 -3
  482. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  483. package/dist/plugins/walrus/deploy-paths.mjs +21 -5
  484. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  485. package/dist/plugins/walrus/deploy.mjs +67 -69
  486. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  487. package/dist/plugins/walrus/errors.mjs +1 -0
  488. package/dist/plugins/walrus/errors.mjs.map +1 -1
  489. package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
  490. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  491. package/dist/plugins/walrus/index.d.mts +2 -13
  492. package/dist/plugins/walrus/index.mjs +18 -23
  493. package/dist/plugins/walrus/index.mjs.map +1 -1
  494. package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
  495. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  496. package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
  497. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  498. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  499. package/dist/plugins/walrus/routable.mjs +7 -23
  500. package/dist/plugins/walrus/routable.mjs.map +1 -1
  501. package/dist/plugins/walrus/service.mjs.map +1 -1
  502. package/dist/plugins/walrus/spans.mjs +18 -0
  503. package/dist/plugins/walrus/spans.mjs.map +1 -0
  504. package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
  505. package/dist/plugins/walrus/storage-nodes.mjs +15 -8
  506. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  507. package/dist/plugins/walrus/wal-swap.mjs +58 -15
  508. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  509. package/dist/primitives/artifact-publisher.d.mts +1 -1
  510. package/dist/primitives/artifact-publisher.mjs +15 -0
  511. package/dist/primitives/artifact-publisher.mjs.map +1 -0
  512. package/dist/runtime/docker/client.mjs +17 -4
  513. package/dist/runtime/docker/client.mjs.map +1 -1
  514. package/dist/runtime/docker/container.mjs +219 -132
  515. package/dist/runtime/docker/container.mjs.map +1 -1
  516. package/dist/runtime/docker/errors.mjs +0 -6
  517. package/dist/runtime/docker/errors.mjs.map +1 -1
  518. package/dist/runtime/docker/exec.mjs +21 -18
  519. package/dist/runtime/docker/exec.mjs.map +1 -1
  520. package/dist/runtime/docker/image.mjs +36 -13
  521. package/dist/runtime/docker/image.mjs.map +1 -1
  522. package/dist/runtime/docker/index.mjs +14 -0
  523. package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
  524. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
  525. package/dist/runtime/docker/inventory.mjs +14 -11
  526. package/dist/runtime/docker/inventory.mjs.map +1 -1
  527. package/dist/runtime/docker/labels.mjs +38 -5
  528. package/dist/runtime/docker/labels.mjs.map +1 -1
  529. package/dist/runtime/docker/logs.d.mts +1 -1
  530. package/dist/runtime/docker/logs.mjs.map +1 -1
  531. package/dist/runtime/docker/network.mjs +83 -47
  532. package/dist/runtime/docker/network.mjs.map +1 -1
  533. package/dist/runtime/docker/render-run-args.mjs +82 -0
  534. package/dist/runtime/docker/render-run-args.mjs.map +1 -0
  535. package/dist/runtime/docker/service.d.mts +1 -1
  536. package/dist/runtime/docker/service.mjs +12 -7
  537. package/dist/runtime/docker/service.mjs.map +1 -1
  538. package/dist/runtime/docker/sweep.mjs +118 -43
  539. package/dist/runtime/docker/sweep.mjs.map +1 -1
  540. package/dist/runtime/docker/volume.mjs +2 -0
  541. package/dist/runtime/docker/volume.mjs.map +1 -1
  542. package/dist/runtime/docker/wrap.mjs +30 -1
  543. package/dist/runtime/docker/wrap.mjs.map +1 -1
  544. package/dist/substrate/cross-process.mjs +14 -8
  545. package/dist/substrate/cross-process.mjs.map +1 -1
  546. package/dist/substrate/event-time.mjs +33 -0
  547. package/dist/substrate/event-time.mjs.map +1 -0
  548. package/dist/substrate/events.d.mts +28 -8
  549. package/dist/substrate/identity.d.mts +2 -1
  550. package/dist/substrate/manifest.d.mts +68 -5
  551. package/dist/substrate/manifest.mjs +34 -5
  552. package/dist/substrate/manifest.mjs.map +1 -1
  553. package/dist/substrate/network.d.mts +3 -5
  554. package/dist/substrate/options.d.mts +0 -2
  555. package/dist/substrate/plugin.d.mts +13 -0
  556. package/dist/substrate/plugin.mjs +4 -2
  557. package/dist/substrate/plugin.mjs.map +1 -1
  558. package/dist/substrate/projection.d.mts +35 -3
  559. package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
  560. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
  561. package/dist/substrate/runtime/atomic-write.mjs +97 -32
  562. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  563. package/dist/substrate/runtime/cache/index.mjs +3 -0
  564. package/dist/substrate/runtime/cache/schema.mjs +2 -2
  565. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  566. package/dist/substrate/runtime/cache/service.mjs +9 -7
  567. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  568. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
  569. package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
  570. package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
  571. package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
  572. package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
  573. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
  574. package/dist/substrate/runtime/config-validation.d.mts +1 -13
  575. package/dist/substrate/runtime/config-validation.mjs +2 -91
  576. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  577. package/dist/substrate/runtime/container-runtime.d.mts +1 -0
  578. package/dist/substrate/runtime/container-runtime.mjs +2 -0
  579. package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
  580. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
  581. package/dist/substrate/runtime/control-plane/service.mjs +7 -0
  582. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
  583. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
  584. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  585. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
  586. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  587. package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
  588. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
  589. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  590. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
  591. package/dist/substrate/runtime/cross-process/index.mjs +11 -0
  592. package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
  593. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
  594. package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
  595. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  596. package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
  597. package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
  598. package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
  599. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
  600. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
  601. package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
  602. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  603. package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
  604. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
  605. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
  606. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
  607. package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
  608. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  609. package/dist/substrate/runtime/current-plugin.mjs +2 -2
  610. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  611. package/dist/substrate/runtime/errors.mjs +12 -6
  612. package/dist/substrate/runtime/errors.mjs.map +1 -1
  613. package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
  614. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
  615. package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
  616. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
  617. package/dist/substrate/runtime/host-gateway.mjs +20 -0
  618. package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
  619. package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
  620. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  621. package/dist/substrate/runtime/http-probe.d.mts +1 -1
  622. package/dist/substrate/runtime/index.mjs +14 -0
  623. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
  624. package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
  625. package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
  626. package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
  627. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  628. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
  629. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  630. package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
  631. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
  632. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
  633. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  634. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
  635. package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
  636. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  637. package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
  638. package/dist/substrate/runtime/managed-container.d.mts +19 -1
  639. package/dist/substrate/runtime/managed-container.mjs +20 -1
  640. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  641. package/dist/substrate/runtime/manifest/index.mjs +3 -0
  642. package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
  643. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  644. package/dist/substrate/runtime/mode-errors.mjs +20 -0
  645. package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
  646. package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
  647. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  648. package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
  649. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
  650. package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
  651. package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
  652. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
  653. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  654. package/dist/substrate/runtime/observability/index.mjs +13 -0
  655. package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
  656. package/dist/substrate/runtime/observability/log-store.mjs +175 -0
  657. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
  658. package/dist/substrate/runtime/observability/logger.d.mts +2 -1
  659. package/dist/substrate/runtime/observability/logger.mjs +5 -9
  660. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  661. package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
  662. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
  663. package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
  664. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  665. package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
  666. package/dist/substrate/runtime/observability/redaction.mjs +8 -14
  667. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  668. package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
  669. package/dist/substrate/runtime/observability/span-store.mjs +110 -0
  670. package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
  671. package/dist/substrate/runtime/observability/spans.mjs +14 -14
  672. package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
  673. package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
  674. package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
  675. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
  676. package/dist/substrate/runtime/paths.d.mts +1 -1
  677. package/dist/substrate/runtime/paths.mjs +4 -3
  678. package/dist/substrate/runtime/paths.mjs.map +1 -1
  679. package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
  680. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
  681. package/dist/substrate/runtime/port-broker/index.mjs +3 -0
  682. package/dist/substrate/runtime/port-broker/service.mjs +170 -126
  683. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  684. package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
  685. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  686. package/dist/substrate/runtime/probes.d.mts +7 -5
  687. package/dist/substrate/runtime/probes.mjs +3 -1
  688. package/dist/substrate/runtime/probes.mjs.map +1 -1
  689. package/dist/substrate/runtime/projection/index.mjs +4 -0
  690. package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
  691. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  692. package/dist/substrate/runtime/projection/persisted.mjs +33 -15
  693. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
  694. package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
  695. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  696. package/dist/substrate/runtime/projection/update.mjs +88 -24
  697. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  698. package/dist/substrate/runtime/random-suffix.mjs +11 -0
  699. package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
  700. package/dist/substrate/runtime/retry-policy.d.mts +59 -1
  701. package/dist/substrate/runtime/retry-policy.mjs +66 -1
  702. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  703. package/dist/substrate/runtime/routed-url.d.mts +1 -0
  704. package/dist/substrate/runtime/routed-url.mjs +79 -0
  705. package/dist/substrate/runtime/routed-url.mjs.map +1 -0
  706. package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
  707. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  708. package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
  709. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  710. package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
  711. package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
  712. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
  713. package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
  714. package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
  715. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
  716. package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
  717. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  718. package/dist/substrate/runtime/state-store/index.d.mts +1 -0
  719. package/dist/substrate/runtime/state-store/index.mjs +3 -0
  720. package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
  721. package/dist/substrate/runtime/state-store/schema.mjs +19 -14
  722. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
  723. package/dist/substrate/runtime/state-store/service.d.mts +1 -0
  724. package/dist/substrate/runtime/state-store/service.mjs +145 -0
  725. package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
  726. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
  727. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
  728. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
  729. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
  730. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  731. package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
  732. package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
  733. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  734. package/dist/substrate/runtime/subnet-broker.mjs +60 -0
  735. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
  736. package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
  737. package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
  738. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
  739. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
  740. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
  741. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
  742. package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
  743. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
  744. package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
  745. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
  746. package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
  747. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
  748. package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
  749. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
  750. package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
  751. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
  752. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
  753. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
  754. package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
  755. package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
  756. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
  757. package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
  758. package/dist/substrate/runtime/supervisor/index.mjs +3 -0
  759. package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
  760. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
  761. package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
  762. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
  763. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
  764. package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
  765. package/dist/substrate/runtime/supervisor/state.mjs +22 -0
  766. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
  767. package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
  768. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
  769. package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
  770. package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
  771. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
  772. package/dist/substrate/runtime/typed-env.mjs +8 -0
  773. package/dist/substrate/runtime/typed-env.mjs.map +1 -0
  774. package/dist/substrate/state-store.d.mts +1 -0
  775. package/dist/substrate/versioned-doc-schema.mjs +17 -0
  776. package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
  777. package/dist/substrate/versioned-doc-sync.mjs +94 -0
  778. package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
  779. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  780. package/dist/surfaces/cli/commands/index.mjs +9 -0
  781. package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
  782. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
  783. package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
  784. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  785. package/dist/surfaces/cli/commands/prune.mjs +34 -17
  786. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  787. package/dist/surfaces/cli/commands/status.mjs +2 -2
  788. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  789. package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
  790. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  791. package/dist/surfaces/cli/commands/wipe.mjs +38 -4
  792. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  793. package/dist/surfaces/cli/errors.mjs +1 -1
  794. package/dist/surfaces/cli/errors.mjs.map +1 -1
  795. package/dist/surfaces/cli/flags.mjs +0 -1
  796. package/dist/surfaces/cli/flags.mjs.map +1 -1
  797. package/dist/surfaces/cli/index.mjs +98 -18
  798. package/dist/surfaces/cli/index.mjs.map +1 -1
  799. package/dist/surfaces/cli/output.mjs +1 -0
  800. package/dist/surfaces/cli/output.mjs.map +1 -1
  801. package/dist/surfaces/cli/sysexits.mjs +2 -1
  802. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  803. package/dist/surfaces/tui/app.mjs +25 -3
  804. package/dist/surfaces/tui/app.mjs.map +1 -1
  805. package/dist/surfaces/tui/display-derivation.mjs +23 -74
  806. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  807. package/dist/surfaces/tui/event-log.mjs +35 -23
  808. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  809. package/dist/surfaces/tui/input.mjs +5 -1
  810. package/dist/surfaces/tui/input.mjs.map +1 -1
  811. package/dist/surfaces/tui/plain-renderer.mjs +70 -34
  812. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  813. package/package.json +24 -4
  814. package/dist/contracts/liveness-classifier.d.mts +0 -19
  815. package/dist/contracts/network-resolver.d.mts +0 -15
  816. package/dist/contracts/network-resolver.mjs +0 -7
  817. package/dist/contracts/network-resolver.mjs.map +0 -1
  818. package/dist/orchestrators/codegen/extras.mjs +0 -16
  819. package/dist/orchestrators/codegen/extras.mjs.map +0 -1
  820. package/dist/plugins/deepbook/routable.mjs +0 -21
  821. package/dist/plugins/deepbook/routable.mjs.map +0 -1
  822. package/dist/plugins/faucet/service.d.mts +0 -20
  823. package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
  824. package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
  825. package/dist/plugins/sui/seed-objects.d.mts +0 -18
  826. package/dist/plugins/sui/seed-objects.mjs +0 -25
  827. package/dist/plugins/sui/seed-objects.mjs.map +0 -1
  828. package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
  829. package/dist/substrate/runtime/context-helpers.mjs +0 -32
  830. package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
  831. package/dist/substrate/runtime/run.mjs.map +0 -1
  832. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
  833. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
  834. package/dist/substrate/runtime/supervisor.d.mts +0 -1
  835. package/dist/substrate/runtime/supervisor.mjs +0 -831
  836. package/dist/substrate/runtime/supervisor.mjs.map +0 -1
  837. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
  838. /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"service.mjs","names":[],"sources":["../../../../src/substrate/runtime/strategy-registry/service.ts"],"sourcesContent":["// Strategy registry implementation.\n//\n// Architecture § StrategyContributor — generic capability-keyed\n// pub/sub for plugin-contributed strategies (faucet strategies,\n// network resolvers, account selection, etc.).\n//\n// Per-capability-key LIST of contributing plugins (a registry can\n// hold multiple contributions for the same key). Resolution is\n// ordered by registration time; the selector chooses among them.\n//\n// Scope-local. The registry is created per-stack-scope so parallel\n// stacks isolate. When the stack scope closes, the registry's\n// entries die with it (the architecture's \"scope-local, never\n// module-level\" rule).\n\nimport { Context, Effect, Layer, Ref, Scope } from 'effect';\n\nimport type { StrategyRegistry } from '../../../contracts/strategy-contributor.ts';\nimport { StrategyNotFoundError } from '../errors.ts';\n\n/** One registered strategy under a capability key. */\ninterface Entry {\n\treadonly strategy: unknown;\n\treadonly autoMounted: boolean;\n\treadonly priority: number;\n\t/** Sequence number for stable ordering by registration time. */\n\treadonly seq: number;\n}\n\n/** Per-capability-key contributions. We keep the LIST (not the\n * single winner) because:\n * 1. Renderers want to enumerate \"N contributors registered\".\n * 2. The selector is per-strategy and may inspect all of them.\n * 3. Auto-mounted vs user-supplied is a visibility distinction\n * consumers need to surface separately. */\ntype State = ReadonlyMap<string, ReadonlyArray<Entry>>;\n\nexport class StrategyRegistryService extends Context.Service<\n\tStrategyRegistryService,\n\tStrategyRegistry\n>()('@devstack-rewrite/substrate/StrategyRegistry') {}\n\n/**\n * Layer. Constructed per-scope; the orchestrator hands the registry\n * to each plugin's acquire so contributions land on the right\n * stack's registry, not a global one.\n */\nexport const layerStrategyRegistry: Layer.Layer<StrategyRegistryService> = Layer.effect(\n\tStrategyRegistryService,\n\tEffect.gen(function* () {\n\t\tconst state = yield* Ref.make<State>(new Map());\n\t\tconst seqRef = yield* Ref.make(0);\n\n\t\tconst register: StrategyRegistry['register'] = <Key extends string, S>(\n\t\t\tkey: Key,\n\t\t\tstrategy: S,\n\t\t\toptions?: { readonly autoMounted?: boolean; readonly priority?: number },\n\t\t) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst seq = yield* Ref.updateAndGet(seqRef, (n) => n + 1);\n\t\t\t\tconst entry: Entry = {\n\t\t\t\t\tstrategy,\n\t\t\t\t\tautoMounted: options?.autoMounted ?? false,\n\t\t\t\t\tpriority: options?.priority ?? 0,\n\t\t\t\t\tseq,\n\t\t\t\t};\n\t\t\t\tyield* Ref.update(state, (current) => {\n\t\t\t\t\tconst existing = current.get(key) ?? [];\n\t\t\t\t\tconst next = new Map(current);\n\t\t\t\t\tnext.set(key, [...existing, entry]);\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t\t// Scope finalizer: drop this entry on scope close.\n\t\t\t\t// Sequence-number match makes parallel registrations\n\t\t\t\t// safe — we only drop the entry we added.\n\t\t\t\tyield* Effect.addFinalizer((_exit) =>\n\t\t\t\t\tRef.update(state, (current) => {\n\t\t\t\t\t\tconst existing = current.get(key);\n\t\t\t\t\t\tif (!existing) return current;\n\t\t\t\t\t\tconst filtered = existing.filter((e) => e.seq !== seq);\n\t\t\t\t\t\tconst next = new Map(current);\n\t\t\t\t\t\tif (filtered.length === 0) next.delete(key);\n\t\t\t\t\t\telse next.set(key, filtered);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t'strategy.key': key,\n\t\t\t\t\t'strategy.autoMounted': entry.autoMounted,\n\t\t\t\t});\n\t\t\t}).pipe(Effect.withSpan('substrate.strategyRegistry.register')) as Effect.Effect<\n\t\t\t\tvoid,\n\t\t\t\tnever,\n\t\t\t\tScope.Scope\n\t\t\t>;\n\n\t\tconst get: StrategyRegistry['get'] = <Key extends string, S>(key: Key) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst current = yield* Ref.get(state);\n\t\t\t\tconst entries = current.get(key);\n\t\t\t\tif (!entries || entries.length === 0) {\n\t\t\t\t\treturn yield* new StrategyNotFoundError({\n\t\t\t\t\t\tcapabilityKey: key,\n\t\t\t\t\t\tregisteredKeys: [...current.keys()],\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// Resolution policy:\n\t\t\t\t// 1. Higher priority wins.\n\t\t\t\t// 2. Tie on priority → later registration wins\n\t\t\t\t// (last-write-wins for user overrides of\n\t\t\t\t// built-ins — matches architecture § failure\n\t\t\t\t// modes \"two strategies with the same key and\n\t\t\t\t// same priority → last write wins\").\n\t\t\t\tlet best = entries[0]!;\n\t\t\t\tfor (let i = 1; i < entries.length; i++) {\n\t\t\t\t\tconst e = entries[i]!;\n\t\t\t\t\tif (e.priority > best.priority || (e.priority === best.priority && e.seq > best.seq)) {\n\t\t\t\t\t\tbest = e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn best.strategy as S;\n\t\t\t}).pipe(Effect.withSpan('substrate.strategyRegistry.get', { attributes: { key } }));\n\n\t\tconst list: StrategyRegistry['list'] = () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst current = yield* Ref.get(state);\n\t\t\t\treturn [...current.keys()];\n\t\t\t});\n\n\t\treturn StrategyRegistryService.of({\n\t\t\tget: get as StrategyRegistry['get'],\n\t\t\tregister: register as StrategyRegistry['register'],\n\t\t\tlist,\n\t\t});\n\t}),\n);\n"],"mappings":";;;AAqCA,IAAa,0BAAb,cAA6C,QAAQ,SAGlD,CAAC,+CAA+C,CAAC;;;;;;AAOpD,MAAa,wBAA8D,MAAM,OAChF,yBACA,OAAO,IAAI,aAAa;CACvB,MAAM,QAAQ,OAAO,IAAI,qBAAY,IAAI,KAAK,CAAC;CAC/C,MAAM,SAAS,OAAO,IAAI,KAAK,EAAE;CAEjC,MAAM,YACL,KACA,UACA,YAEA,OAAO,IAAI,aAAa;EACvB,MAAM,MAAM,OAAO,IAAI,aAAa,SAAS,MAAM,IAAI,EAAE;EACzD,MAAM,QAAe;GACpB;GACA,aAAa,SAAS,eAAe;GACrC,UAAU,SAAS,YAAY;GAC/B;GACA;AACD,SAAO,IAAI,OAAO,QAAQ,YAAY;GACrC,MAAM,WAAW,QAAQ,IAAI,IAAI,IAAI,EAAE;GACvC,MAAM,OAAO,IAAI,IAAI,QAAQ;AAC7B,QAAK,IAAI,KAAK,CAAC,GAAG,UAAU,MAAM,CAAC;AACnC,UAAO;IACN;AAIF,SAAO,OAAO,cAAc,UAC3B,IAAI,OAAO,QAAQ,YAAY;GAC9B,MAAM,WAAW,QAAQ,IAAI,IAAI;AACjC,OAAI,CAAC,SAAU,QAAO;GACtB,MAAM,WAAW,SAAS,QAAQ,MAAM,EAAE,QAAQ,IAAI;GACtD,MAAM,OAAO,IAAI,IAAI,QAAQ;AAC7B,OAAI,SAAS,WAAW,EAAG,MAAK,OAAO,IAAI;OACtC,MAAK,IAAI,KAAK,SAAS;AAC5B,UAAO;IACN,CACF;AACD,SAAO,OAAO,oBAAoB;GACjC,gBAAgB;GAChB,wBAAwB,MAAM;GAC9B,CAAC;GACD,CAAC,KAAK,OAAO,SAAS,sCAAsC,CAAC;CAMhE,MAAM,OAAuD,QAC5D,OAAO,IAAI,aAAa;EACvB,MAAM,UAAU,OAAO,IAAI,IAAI,MAAM;EACrC,MAAM,UAAU,QAAQ,IAAI,IAAI;AAChC,MAAI,CAAC,WAAW,QAAQ,WAAW,EAClC,QAAO,OAAO,IAAI,sBAAsB;GACvC,eAAe;GACf,gBAAgB,CAAC,GAAG,QAAQ,MAAM,CAAC;GACnC,CAAC;EASH,IAAI,OAAO,QAAQ;AACnB,OAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACxC,MAAM,IAAI,QAAQ;AAClB,OAAI,EAAE,WAAW,KAAK,YAAa,EAAE,aAAa,KAAK,YAAY,EAAE,MAAM,KAAK,IAC/E,QAAO;;AAGT,SAAO,KAAK;GACX,CAAC,KAAK,OAAO,SAAS,kCAAkC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;CAEpF,MAAM,aACL,OAAO,IAAI,aAAa;AAEvB,SAAO,CAAC,IAAG,OADY,IAAI,IAAI,MAAM,EAClB,MAAM,CAAC;GACzB;AAEH,QAAO,wBAAwB,GAAG;EAC5B;EACK;EACV;EACA,CAAC;EACD,CACF"}
1
+ {"version":3,"file":"service.mjs","names":[],"sources":["../../../../src/substrate/runtime/strategy-registry/service.ts"],"sourcesContent":["// Strategy registry implementation.\n//\n// Architecture § StrategyContributor — generic capability-keyed\n// pub/sub for plugin-contributed strategies (faucet strategies,\n// network resolvers, account selection, etc.).\n//\n// Per-capability-key LIST of contributing plugins (a registry can\n// hold multiple contributions for the same key). Resolution is\n// ordered by registration time; the selector chooses among them.\n//\n// Scope-local. The registry is created per-stack-scope so parallel\n// stacks isolate. When the stack scope closes, the registry's\n// entries die with it (the architecture's \"scope-local, never\n// module-level\" rule).\n\nimport { Context, Effect, Layer, Scope } from 'effect';\n\nimport type { StrategyRegistry } from '../../../contracts/strategy-contributor.ts';\nimport { StrategyNotFoundError } from '../errors.ts';\nimport { SpanAttr } from '../observability/spans.ts';\nimport { makeScopedMultimap } from '../scoped-multimap/index.ts';\n\n/** One registered strategy under a capability key. The multimap stamps\n * the registration `seq`; the payload carries the strategy + its\n * visibility/priority. We keep the LIST (not the single winner)\n * because:\n * 1. Renderers want to enumerate \"N contributors registered\".\n * 2. The selector is per-strategy and may inspect all of them.\n * 3. Auto-mounted vs user-supplied is a visibility distinction\n * consumers need to surface separately. */\ninterface Entry {\n\treadonly strategy: unknown;\n\treadonly autoMounted: boolean;\n\treadonly priority: number;\n}\n\nexport class StrategyRegistryService extends Context.Service<\n\tStrategyRegistryService,\n\tStrategyRegistry\n>()('@devstack/substrate/StrategyRegistry') {}\n\n/**\n * Layer. Constructed per-scope; the orchestrator hands the registry\n * to each plugin's acquire so contributions land on the right\n * stack's registry, not a global one.\n */\nexport const layerStrategyRegistry: Layer.Layer<StrategyRegistryService> = Layer.effect(\n\tStrategyRegistryService,\n\tEffect.gen(function* () {\n\t\tconst store = yield* makeScopedMultimap<string, Entry>();\n\n\t\tconst register: StrategyRegistry['register'] = <Key extends string, S>(\n\t\t\tkey: Key,\n\t\t\tstrategy: S,\n\t\t\toptions?: { readonly autoMounted?: boolean; readonly priority?: number },\n\t\t) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry: Entry = {\n\t\t\t\t\tstrategy,\n\t\t\t\t\tautoMounted: options?.autoMounted ?? false,\n\t\t\t\t\tpriority: options?.priority ?? 0,\n\t\t\t\t};\n\t\t\t\t// The multimap stamps the seq and wires the drop-by-seq\n\t\t\t\t// finalizer parallel registrations stay isolated.\n\t\t\t\tyield* store.register([{ key, value: entry }]);\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t[SpanAttr.strategyKey]: key,\n\t\t\t\t\t[SpanAttr.strategyAutoMounted]: entry.autoMounted,\n\t\t\t\t});\n\t\t\t}).pipe(Effect.withSpan('substrate.strategyRegistry.register')) as Effect.Effect<\n\t\t\t\tvoid,\n\t\t\t\tnever,\n\t\t\t\tScope.Scope\n\t\t\t>;\n\n\t\tconst get: StrategyRegistry['get'] = <Key extends string, S>(key: Key) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entries = yield* store.entriesFor(key);\n\t\t\t\tif (entries.length === 0) {\n\t\t\t\t\tconst keys = yield* store.keys;\n\t\t\t\t\treturn yield* new StrategyNotFoundError({\n\t\t\t\t\t\tcapabilityKey: key,\n\t\t\t\t\t\tregisteredKeys: keys,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// Resolution policy:\n\t\t\t\t// 1. Higher priority wins.\n\t\t\t\t// 2. Tie on priority → later registration wins\n\t\t\t\t// (last-write-wins for user overrides of\n\t\t\t\t// built-ins — matches architecture § failure\n\t\t\t\t// modes \"two strategies with the same key and\n\t\t\t\t// same priority → last write wins\").\n\t\t\t\tlet best = entries[0]!;\n\t\t\t\tfor (let i = 1; i < entries.length; i++) {\n\t\t\t\t\tconst e = entries[i]!;\n\t\t\t\t\tif (\n\t\t\t\t\t\te.value.priority > best.value.priority ||\n\t\t\t\t\t\t(e.value.priority === best.value.priority && e.seq > best.seq)\n\t\t\t\t\t) {\n\t\t\t\t\t\tbest = e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn best.value.strategy as S;\n\t\t\t}).pipe(Effect.withSpan('substrate.strategyRegistry.get', { attributes: { key } }));\n\n\t\tconst list: StrategyRegistry['list'] = () => store.keys;\n\n\t\treturn StrategyRegistryService.of({\n\t\t\tget: get as StrategyRegistry['get'],\n\t\t\tregister: register as StrategyRegistry['register'],\n\t\t\tlist,\n\t\t});\n\t}),\n);\n"],"mappings":";;;;;;AAoCA,IAAa,0BAAb,cAA6C,QAAQ,SAGlD,CAAC,uCAAuC,CAAC;;;;;;AAO5C,MAAa,wBAA8D,MAAM,OAChF,yBACA,OAAO,IAAI,aAAa;CACvB,MAAM,QAAQ,OAAO,oBAAmC;CAExD,MAAM,YACL,KACA,UACA,YAEA,OAAO,IAAI,aAAa;EACvB,MAAM,QAAe;GACpB;GACA,aAAa,SAAS,eAAe;GACrC,UAAU,SAAS,YAAY;GAC/B;AAGD,SAAO,MAAM,SAAS,CAAC;GAAE;GAAK,OAAO;GAAO,CAAC,CAAC;AAC9C,SAAO,OAAO,oBAAoB;IAChC,SAAS,cAAc;IACvB,SAAS,sBAAsB,MAAM;GACtC,CAAC;GACD,CAAC,KAAK,OAAO,SAAS,sCAAsC,CAAC;CAMhE,MAAM,OAAuD,QAC5D,OAAO,IAAI,aAAa;EACvB,MAAM,UAAU,OAAO,MAAM,WAAW,IAAI;AAC5C,MAAI,QAAQ,WAAW,EAEtB,QAAO,OAAO,IAAI,sBAAsB;GACvC,eAAe;GACf,gBAAgB,OAHG,MAAM;GAIzB,CAAC;EASH,IAAI,OAAO,QAAQ;AACnB,OAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACxC,MAAM,IAAI,QAAQ;AAClB,OACC,EAAE,MAAM,WAAW,KAAK,MAAM,YAC7B,EAAE,MAAM,aAAa,KAAK,MAAM,YAAY,EAAE,MAAM,KAAK,IAE1D,QAAO;;AAGT,SAAO,KAAK,MAAM;GACjB,CAAC,KAAK,OAAO,SAAS,kCAAkC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;CAEpF,MAAM,aAAuC,MAAM;AAEnD,QAAO,wBAAwB,GAAG;EAC5B;EACK;EACV;EACA,CAAC;EACD,CACF"}
@@ -0,0 +1,60 @@
1
+ //#region src/substrate/runtime/subnet-broker.ts
2
+ /**
3
+ * Derive a deterministic `/24` IPv4 subnet prefix from an identity
4
+ * string, suitable for `EnsureNetworkSpec.subnet` requests.
5
+ *
6
+ * Uses FNV-1a/32 to bucket the input into one of 16384 slots inside
7
+ * a 64-wide band of `10.0.0.0/8`. `secondOctetOffset` selects the
8
+ * band — pick a value disjoint from every other caller (current
9
+ * users: walrus `64`, seal `128`).
10
+ *
11
+ * @param input - opaque identity string. Callers should pack their
12
+ * stack-identifying fields with a separator that cannot appear in
13
+ * any field (`\0` is the convention).
14
+ * @param secondOctetOffset - lower-bound of the second IPv4 octet.
15
+ * The derived second octet falls in `[offset, offset + 63]`.
16
+ * @returns prefix string `'10.b.c'`. Append `.0/24` for the subnet
17
+ * and `.1` for the gateway.
18
+ */
19
+ const deriveSubnetPrefix = (input, secondOctetOffset) => {
20
+ let hash = 2166136261;
21
+ for (let i = 0; i < input.length; i += 1) {
22
+ hash ^= input.charCodeAt(i);
23
+ hash = Math.imul(hash, 16777619) >>> 0;
24
+ }
25
+ const bucket = hash % (64 * 256);
26
+ return `10.${secondOctetOffset + Math.floor(bucket / 256)}.${bucket % 256}`;
27
+ };
28
+ /**
29
+ * Expand a `/24` prefix into the `{ subnet, gateway }` shape the
30
+ * container-runtime `EnsureNetworkSpec` consumes.
31
+ *
32
+ * Convention: `<prefix>.0/24` for the subnet, `<prefix>.1` for the
33
+ * gateway — the same pair walrus and seal both stamp on their
34
+ * `ensureNetwork` requests. Folded here so the `/24` + `.1` literals
35
+ * live in ONE place.
36
+ */
37
+ const subnetSpec = (prefix) => ({
38
+ subnet: `${prefix}.0/24`,
39
+ gateway: `${prefix}.1`
40
+ });
41
+ /**
42
+ * Stamp the `{subnet, gateway}` pair derived from `subnetPrefix` onto
43
+ * any `EnsureNetworkSpec`-shaped value. Both walrus and seal need the
44
+ * same fold:
45
+ *
46
+ * {...spec, ...subnetSpec(prefix)}
47
+ *
48
+ * to widen a substrate-blind network spec into one that carries the
49
+ * plugin's deterministic `/24` addressing — folded here so the literal
50
+ * `Required<Pick<…, 'subnet' | 'gateway'>>` widening type lives in
51
+ * ONE place.
52
+ */
53
+ const withSubnetAddressing = (spec, subnetPrefix) => ({
54
+ ...spec,
55
+ ...subnetSpec(subnetPrefix)
56
+ });
57
+ //#endregion
58
+ export { deriveSubnetPrefix, withSubnetAddressing };
59
+
60
+ //# sourceMappingURL=subnet-broker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subnet-broker.mjs","names":[],"sources":["../../../src/substrate/runtime/subnet-broker.ts"],"sourcesContent":["// Subnet-prefix derivation + EnsureNetworkSpec stamping — ONE canonical\n// implementation.\n//\n// Architecture § \"What's collapsed\" — multiple plugins (walrus, seal)\n// need a deterministic Docker `/24` subnet keyed off their stack\n// identity so parallel local stacks don't all collide on Docker's\n// default IPAM pool. Each plugin previously inlined the same FNV-1a\n// hash → IPv4 third-octet derivation; the only thing that varied was\n// the second-octet base offset (walrus uses `64`, seal uses `128`)\n// so they live in disjoint 64-wide bands inside `10.0.0.0/8`.\n//\n// Algorithm (DO NOT CHANGE without re-coordinating with every caller —\n// changing it shifts every parallel stack's assigned subnet, which\n// silently invalidates running containers and on-disk snapshots that\n// reference IPs by literal):\n//\n// 1. FNV-1a/32 over the UTF-16 code-unit sequence of `input`,\n// seeded `0x811c9dc5`, prime `0x01000193`, kept in unsigned\n// 32-bit space via `>>> 0`.\n// 2. Take the low `64 * 256 = 16384` buckets of the hash.\n// 3. Split the bucket into a second-octet add (`bucket / 256`,\n// 0..63) and a third-octet (`bucket % 256`, 0..255).\n// 4. Emit `'10.<secondOctetOffset + add>.<third>'`.\n//\n// The returned prefix is the `a.b.c` of an IPv4 `/24` — callers\n// append `.0/24` for the subnet and `.1` for the gateway.\n\nimport type { EnsureNetworkSpec } from '../../contracts/container-runtime.ts';\n\n/**\n * Derive a deterministic `/24` IPv4 subnet prefix from an identity\n * string, suitable for `EnsureNetworkSpec.subnet` requests.\n *\n * Uses FNV-1a/32 to bucket the input into one of 16384 slots inside\n * a 64-wide band of `10.0.0.0/8`. `secondOctetOffset` selects the\n * band — pick a value disjoint from every other caller (current\n * users: walrus `64`, seal `128`).\n *\n * @param input - opaque identity string. Callers should pack their\n * stack-identifying fields with a separator that cannot appear in\n * any field (`\\0` is the convention).\n * @param secondOctetOffset - lower-bound of the second IPv4 octet.\n * The derived second octet falls in `[offset, offset + 63]`.\n * @returns prefix string `'10.b.c'`. Append `.0/24` for the subnet\n * and `.1` for the gateway.\n */\nexport const deriveSubnetPrefix = (input: string, secondOctetOffset: number): string => {\n\tlet hash = 0x811c9dc5;\n\tfor (let i = 0; i < input.length; i += 1) {\n\t\thash ^= input.charCodeAt(i);\n\t\thash = Math.imul(hash, 0x01000193) >>> 0;\n\t}\n\tconst bucket = hash % (64 * 256);\n\tconst secondOctet = secondOctetOffset + Math.floor(bucket / 256);\n\tconst thirdOctet = bucket % 256;\n\treturn `10.${secondOctet}.${thirdOctet}`;\n};\n\n/**\n * Expand a `/24` prefix into the `{ subnet, gateway }` shape the\n * container-runtime `EnsureNetworkSpec` consumes.\n *\n * Convention: `<prefix>.0/24` for the subnet, `<prefix>.1` for the\n * gateway — the same pair walrus and seal both stamp on their\n * `ensureNetwork` requests. Folded here so the `/24` + `.1` literals\n * live in ONE place.\n */\nexport const subnetSpec = (\n\tprefix: string,\n): { readonly subnet: string; readonly gateway: string } => ({\n\tsubnet: `${prefix}.0/24`,\n\tgateway: `${prefix}.1`,\n});\n\n/**\n * Stamp the `{subnet, gateway}` pair derived from `subnetPrefix` onto\n * any `EnsureNetworkSpec`-shaped value. Both walrus and seal need the\n * same fold:\n *\n * {...spec, ...subnetSpec(prefix)}\n *\n * to widen a substrate-blind network spec into one that carries the\n * plugin's deterministic `/24` addressing — folded here so the literal\n * `Required<Pick<…, 'subnet' | 'gateway'>>` widening type lives in\n * ONE place.\n */\nexport const withSubnetAddressing = <Spec extends EnsureNetworkSpec>(\n\tspec: Spec,\n\tsubnetPrefix: string,\n): Spec & Required<Pick<EnsureNetworkSpec, 'subnet' | 'gateway'>> => ({\n\t...spec,\n\t...subnetSpec(subnetPrefix),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA,MAAa,sBAAsB,OAAe,sBAAsC;CACvF,IAAI,OAAO;AACX,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;AACzC,UAAQ,MAAM,WAAW,EAAE;AAC3B,SAAO,KAAK,KAAK,MAAM,SAAW,KAAK;;CAExC,MAAM,SAAS,QAAQ,KAAK;AAG5B,QAAO,MAFa,oBAAoB,KAAK,MAAM,SAAS,IAAI,CAEvC,GADN,SAAS;;;;;;;;;;;AAa7B,MAAa,cACZ,YAC4D;CAC5D,QAAQ,GAAG,OAAO;CAClB,SAAS,GAAG,OAAO;CACnB;;;;;;;;;;;;;AAcD,MAAa,wBACZ,MACA,kBACqE;CACrE,GAAG;CACH,GAAG,WAAW,aAAa;CAC3B"}
@@ -1,4 +1,6 @@
1
1
  import { Effect, Schema, Scope } from "effect";
2
+ import { ClientWithCoreApi } from "@mysten/sui/client";
3
+
2
4
  //#region src/substrate/runtime/sui-execute/index.d.ts
3
5
  interface TransactionSignerScope<SignError = unknown> {
4
6
  readonly signTransaction: (tx: Uint8Array) => Effect.Effect<{
@@ -6,6 +8,24 @@ interface TransactionSignerScope<SignError = unknown> {
6
8
  readonly signature: string;
7
9
  }, SignError>;
8
10
  }
11
+ /** On-chain failure projection. The transaction was delivered +
12
+ * executed by the validator but the on-chain execution failed.
13
+ * Carries the digest (for log correlation) plus the validator's
14
+ * stringified error when one was attached. `executionError` is
15
+ * omitted when the SDK returns no message (STYLE_GUIDE §5: no
16
+ * sentinel placeholders at resolved-value surfaces). An envelope
17
+ * without a digest fails at projection with
18
+ * `SuiExecuteError(phase: 'no-digest')`.
19
+ *
20
+ * This is the single source of truth for the on-chain-failure shape
21
+ * across the devstack: `account.SignAndExecuteResult`'s
22
+ * `FailedTransaction` variant carries it directly; every plugin that
23
+ * renders one of these failures into a user-facing error message goes
24
+ * through `formatExecutedFailure` (below). */
25
+ interface ExecutedFailure {
26
+ readonly digest: string;
27
+ readonly executionError?: string;
28
+ }
9
29
  //#endregion
10
- export { TransactionSignerScope };
30
+ export { ExecutedFailure, TransactionSignerScope };
11
31
  //# sourceMappingURL=index.d.mts.map
@@ -1,15 +1,21 @@
1
+ import { formatUnknownError } from "../format-unknown-error.mjs";
2
+ import "./sign-and-dispatch.mjs";
1
3
  import { Effect, Schema } from "effect";
2
4
  //#region src/substrate/runtime/sui-execute/index.ts
3
5
  /** Tagged failure during one step of the Sui-tx roundtrip. `phase`
4
6
  * discriminates which step failed so callers can map to their
5
7
  * plugin's phase taxonomy (publish-tx, sign, parse, …) without
6
- * losing the original cause. */
8
+ * losing the original cause.
9
+ *
10
+ * On-chain `FailedTransaction` is NOT a phase here — it surfaces as
11
+ * the `$kind: 'FailedTransaction'` variant of `SuiExecuteResult`
12
+ * (return channel). Only transport / protocol failures live in this
13
+ * taxonomy. See STYLE_GUIDE §2. */
7
14
  var SuiExecuteError = class extends Schema.TaggedErrorClass()("SuiExecuteError", {
8
15
  phase: Schema.Literals([
9
16
  "serialize",
10
17
  "sign",
11
18
  "execute",
12
- "failed-transaction",
13
19
  "no-digest",
14
20
  "wait-for-finality"
15
21
  ]),
@@ -21,6 +27,28 @@ var SuiExecuteError = class extends Schema.TaggedErrorClass()("SuiExecuteError",
21
27
  digest: Schema.optional(Schema.String),
22
28
  cause: Schema.optional(Schema.Defect)
23
29
  }) {};
30
+ /** Render the canonical "digest + executionError-or-noted-absent" tail
31
+ * used by every plugin's `FailedTransaction` surface. Pure projection;
32
+ * does not throw.
33
+ *
34
+ * Used at the call site as e.g.
35
+ * `\`seal publish ... ${formatExecutedFailure(result.FailedTransaction)}\``.
36
+ * Centralising the wording means future tweaks propagate uniformly
37
+ * across the seal / coin / walrus / deepbook / action / package
38
+ * surfaces. */
39
+ const formatExecutedFailure = (failure) => failure.executionError !== void 0 ? `at ${failure.digest}: ${failure.executionError}` : `at ${failure.digest} (no validator error attached)`;
40
+ /** Pull the digest out of a raw `executeTransaction` envelope without
41
+ * committing to success vs on-chain failure. `FailedTransaction`
42
+ * carries its digest under a sibling key, so callers that only need
43
+ * the digest (impersonate / one-shot dispatch paths that don't run
44
+ * the full `executeSuiTx` projection) read it through this projector
45
+ * rather than re-deriving the `$kind`-branching shape inline.
46
+ * Returns `undefined` for a malformed envelope; callers decide
47
+ * whether a missing digest is a failure. */
48
+ const extractExecuteDigest = (raw) => {
49
+ const env = raw;
50
+ return env.$kind === "FailedTransaction" ? env.FailedTransaction?.digest : env.Transaction?.digest;
51
+ };
24
52
  /** Drive the serialize → sign → execute → wait → project pipeline.
25
53
  *
26
54
  * The caller passes:
@@ -39,8 +67,12 @@ var SuiExecuteError = class extends Schema.TaggedErrorClass()("SuiExecuteError",
39
67
  * others (mode-local publish ready probe path) wait separately
40
68
  * via `getObject` polling and can pass `false`.
41
69
  *
42
- * All failures surface as `SuiExecuteError` with a `phase`
43
- * discriminator the caller maps to its plugin's phase taxonomy.
70
+ * Returns a `SuiExecuteResult` discriminated union — callers dispatch
71
+ * on `$kind` to distinguish on-chain success (`'Transaction'`) from
72
+ * on-chain rejection (`'FailedTransaction'`). Transport / protocol
73
+ * failures (serialize, sign, execute, no-digest, wait-for-finality)
74
+ * surface as `SuiExecuteError` with a `phase` discriminator the
75
+ * caller maps to its plugin's phase taxonomy.
44
76
  */
45
77
  const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSigner) => Effect.gen(function* () {
46
78
  const { client, signer, build } = params;
@@ -51,7 +83,7 @@ const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSign
51
83
  phase: "serialize",
52
84
  signerName: signer.name,
53
85
  signerAddress: signer.address,
54
- message: `Transaction.build failed for signer '${signer.name}' (address=${signer.address}): ` + (cause instanceof Error ? cause.message : String(cause)),
86
+ message: `Transaction.build failed for signer '${signer.name}' (address=${signer.address}): ` + formatUnknownError(cause),
55
87
  cause
56
88
  })
57
89
  });
@@ -63,7 +95,7 @@ const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSign
63
95
  cause
64
96
  })));
65
97
  const raw = yield* Effect.tryPromise({
66
- try: () => client.executeTransaction({
98
+ try: () => client.core.executeTransaction({
67
99
  transaction: txBytes,
68
100
  signatures: [signed.signature],
69
101
  include: {
@@ -75,15 +107,21 @@ const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSign
75
107
  phase: "execute",
76
108
  signerName: signer.name,
77
109
  signerAddress: signer.address,
78
- message: `executeTransaction rejected for signer '${signer.name}': ` + (cause instanceof Error ? cause.message : String(cause)),
110
+ message: `executeTransaction rejected for signer '${signer.name}': ` + formatUnknownError(cause),
79
111
  cause
80
112
  })
81
113
  });
82
114
  const env = raw;
83
115
  if (env.$kind === "FailedTransaction") {
84
116
  const failedDigest = env.FailedTransaction?.digest;
85
- if (awaitFinality && failedDigest !== void 0) yield* Effect.tryPromise({
86
- try: () => client.waitForTransaction({ digest: failedDigest }),
117
+ if (failedDigest === void 0) return yield* Effect.fail(new SuiExecuteError({
118
+ phase: "no-digest",
119
+ signerName: signer.name,
120
+ signerAddress: signer.address,
121
+ message: `executeTransaction returned FailedTransaction with no digest. Raw=${JSON.stringify(raw).slice(0, 300)}`
122
+ }));
123
+ if (awaitFinality) yield* Effect.tryPromise({
124
+ try: () => client.core.waitForTransaction({ digest: failedDigest }),
87
125
  catch: (cause) => new SuiExecuteError({
88
126
  phase: "wait-for-finality",
89
127
  signerName: signer.name,
@@ -93,13 +131,14 @@ const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSign
93
131
  cause
94
132
  })
95
133
  });
96
- return yield* Effect.fail(new SuiExecuteError({
97
- phase: "failed-transaction",
98
- signerName: signer.name,
99
- signerAddress: signer.address,
100
- digest: env.FailedTransaction?.digest,
101
- message: `executeTransaction returned FailedTransaction (digest=${env.FailedTransaction?.digest ?? "<unknown>"}): ` + (env.FailedTransaction?.status?.error ?? "<no error>")
102
- }));
134
+ const executionError = env.FailedTransaction?.status?.error;
135
+ return {
136
+ $kind: "FailedTransaction",
137
+ FailedTransaction: {
138
+ digest: failedDigest,
139
+ ...executionError !== void 0 ? { executionError } : {}
140
+ }
141
+ };
103
142
  }
104
143
  const txOk = env.Transaction;
105
144
  if (txOk?.digest === void 0) return yield* Effect.fail(new SuiExecuteError({
@@ -109,7 +148,7 @@ const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSign
109
148
  message: `executeTransaction returned no digest. Raw=${JSON.stringify(raw).slice(0, 300)}`
110
149
  }));
111
150
  if (awaitFinality) yield* Effect.tryPromise({
112
- try: () => client.waitForTransaction({ digest: txOk.digest }),
151
+ try: () => client.core.waitForTransaction({ digest: txOk.digest }),
113
152
  catch: (cause) => new SuiExecuteError({
114
153
  phase: "wait-for-finality",
115
154
  signerName: signer.name,
@@ -131,14 +170,39 @@ const executeSuiTx = (params) => params.signer.withTransactionSigner((lockedSign
131
170
  objectChanges.push(entry);
132
171
  }
133
172
  return {
134
- digest: txOk.digest,
135
- objectChanges
173
+ $kind: "Transaction",
174
+ Transaction: {
175
+ digest: txOk.digest,
176
+ objectChanges
177
+ }
136
178
  };
137
179
  })).pipe(Effect.withSpan("substrate.sui-execute", { attributes: {
138
180
  "sui-execute.signer": params.signer.name,
139
181
  "sui-execute.address": params.signer.address
140
182
  } }));
183
+ /** Decode a possibly URI-encoded SDK error message. The Sui SDK
184
+ * emits `decodeURIComponent`-able strings for some error paths
185
+ * (notably stale-object-version reports). Falls back to the raw
186
+ * message on decode failure. */
187
+ const decodeMessage = (message) => {
188
+ try {
189
+ return decodeURIComponent(message);
190
+ } catch {
191
+ return message;
192
+ }
193
+ };
194
+ /** Typed predicate for the SDK's "stale object version" transient
195
+ * failure — the Move VM refuses a transaction that references an
196
+ * object reference older than the current chain version. Consumers
197
+ * retry with fresh refs; pair with `STALE_OBJECT_VERSION_RETRY_PROFILE`
198
+ * from `retry-policy.ts`. Detection sniffs the SDK message because the
199
+ * underlying gRPC error class doesn't expose a structured discriminator
200
+ * for this case. */
201
+ const isSuiStaleObjectVersionError = (err) => {
202
+ const message = decodeMessage(err.message);
203
+ return message.includes("needs to be rebuilt because object") && message.includes("current version");
204
+ };
141
205
  //#endregion
142
- export { executeSuiTx };
206
+ export { executeSuiTx, extractExecuteDigest, formatExecutedFailure, isSuiStaleObjectVersionError };
143
207
 
144
208
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/substrate/runtime/sui-execute/index.ts"],"sourcesContent":["// sui-execute — substrate helper for the Sui-SDK transaction\n// roundtrip.\n//\n// ARCHITECTURE NOTE — substrate-name-awareness escape hatch:\n//\n// This module is the ONE blessed substrate-side Sui-aware module.\n// The substrate is otherwise strictly name-blind (see ARCHITECTURE.md\n// §\"Substrate name-blindness\"), but the \"build → sign → execute →\n// wait → project\" roundtrip is duplicated verbatim across\n// `plugins/package/publish-executor.ts` and `plugins/action/execute.ts`\n// — ~80% identical line-for-line — and the same shape is needed for\n// `seal` (deploy + key-server registration), `coin.mint`, `action`,\n// and `deepbook` (publish + pool creation).\n//\n// Lifting the dispatch here gives every Sui-tx plugin one well-tested\n// surface and surfaces the SDK-envelope shape decisions (`include:\n// { effects, objectTypes }`, `$kind` projection, `FailedTransaction`\n// detection) ONCE.\n//\n// Boundary discipline:\n//\n// - This module is L1-adjacent: it lives under `substrate/runtime/`\n// but consumes opaque shapes (`unknown` SDK client; opaque\n// signer closure). It does NOT import from `plugins/sui/*` or\n// `@mysten/sui/*` — the caller passes in the resolved SDK ref\n// and the signer; the substrate just orchestrates the roundtrip.\n// - The return shape (`ExecutedReceipt`) is name-blind: a flat\n// digest + a uniform `objectChanges` array. Callers map to their\n// domain shape (PublishReceipt, ActionReceipt, MintReceipt, …).\n// - Failures route through `SuiExecuteError` whose `phase`\n// discriminates the failing step. Callers map to their plugin's\n// phase taxonomy in the executor closure passed to\n// `compileChainOperation` (see `artifact-publisher/chain-operation.ts`).\n\nimport { Effect, Schema, Scope } from 'effect';\n\n// ---------------------------------------------------------------------------\n// Errors — substrate-style Schema.TaggedErrorClass\n// ---------------------------------------------------------------------------\n\n/** Tagged failure during one step of the Sui-tx roundtrip. `phase`\n * discriminates which step failed so callers can map to their\n * plugin's phase taxonomy (publish-tx, sign, parse, …) without\n * losing the original cause. */\nexport class SuiExecuteError extends Schema.TaggedErrorClass<SuiExecuteError>()('SuiExecuteError', {\n\tphase: Schema.Literals([\n\t\t'serialize',\n\t\t'sign',\n\t\t'execute',\n\t\t'failed-transaction',\n\t\t'no-digest',\n\t\t'wait-for-finality',\n\t]),\n\tsignerName: Schema.String,\n\tsignerAddress: Schema.String,\n\tmessage: Schema.String,\n\t/** Echoed digest when the SDK returned one but a later step\n\t * failed — surfaces in cause-walker output. */\n\tdigest: Schema.optional(Schema.String),\n\tcause: Schema.optional(Schema.Defect),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Inputs / outputs — opaque at the substrate boundary\n// ---------------------------------------------------------------------------\n\n/** The narrow slice of the SDK client this helper drives. Mirrors the\n * shape cast verbatim in `plugins/package/publish-executor.ts` and\n * `plugins/action/execute.ts`. */\nexport interface SuiExecuteClient {\n\treadonly executeTransaction: (args: {\n\t\treadonly transaction: Uint8Array;\n\t\treadonly signatures: ReadonlyArray<string>;\n\t\treadonly include?: {\n\t\t\treadonly effects?: boolean;\n\t\t\treadonly objectTypes?: boolean;\n\t\t};\n\t}) => Promise<unknown>;\n\treadonly waitForTransaction: (args: {\n\t\treadonly digest: string;\n\t\treadonly include?: { readonly effects?: boolean };\n\t\treadonly timeout?: number;\n\t}) => Promise<unknown>;\n}\n\n/** Serialised transaction-build callback. Returns the BCS bytes ready\n * for signing. The caller owns the `Transaction` construction — the\n * substrate does not import `@mysten/sui/transactions` — and resolves\n * it via `Transaction.build({ client })`. */\nexport type SerializedTxBuilder = () => Promise<Uint8Array>;\n\nexport interface TransactionSignerScope<SignError = unknown> {\n\treadonly signTransaction: (\n\t\ttx: Uint8Array,\n\t) => Effect.Effect<{ readonly bytes: string; readonly signature: string }, SignError>;\n}\n\n/** Resolved signer — narrow slice of `AccountValue` (see\n * `artifact-publisher/chain-operation.ts::ResolvedSigner`). */\nexport interface ResolvedSigner {\n\treadonly name: string;\n\treadonly address: string;\n\treadonly signTransaction: (\n\t\ttx: Uint8Array,\n\t) => Effect.Effect<{ readonly bytes: string; readonly signature: string }, unknown>;\n\treadonly withTransactionSigner: <A, E, R>(\n\t\tbody: (signer: TransactionSignerScope) => Effect.Effect<A, E, R>,\n\t) => Effect.Effect<A, E, R>;\n}\n\n/** Flat per-object change record. Mirrors the union of fields that\n * `PublishObjectChange` (package) and `ActionObjectChange` (action)\n * expose so callers can pick whichever subset they surface. */\nexport interface ExecutedObjectChange {\n\treadonly objectId: string;\n\treadonly objectType?: string;\n\treadonly outputState?: string;\n\treadonly idOperation?: string;\n}\n\n/** Result of one successful execute round. Callers map this to their\n * domain shape (PublishReceipt, ActionReceipt, MintReceipt, …). */\nexport interface ExecutedReceipt {\n\treadonly digest: string;\n\treadonly objectChanges: ReadonlyArray<ExecutedObjectChange>;\n}\n\n// ---------------------------------------------------------------------------\n// SDK envelope projection (matches publish-executor + action.execute)\n// ---------------------------------------------------------------------------\n\ninterface RawExecuteEnvelope {\n\treadonly $kind?: 'Transaction' | 'FailedTransaction';\n\treadonly Transaction?: {\n\t\treadonly digest?: string;\n\t\treadonly effects?: {\n\t\t\treadonly changedObjects?: ReadonlyArray<{\n\t\t\t\treadonly objectId?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t}>;\n\t\t};\n\t\treadonly objectTypes?: Readonly<Record<string, string>>;\n\t};\n\treadonly FailedTransaction?: {\n\t\treadonly digest?: string;\n\t\treadonly status?: { readonly error?: string };\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// The helper\n// ---------------------------------------------------------------------------\n\n/** Drive the serialize → sign → execute → wait → project pipeline.\n *\n * The caller passes:\n * - `client`: an opaque SDK client exposing `executeTransaction` +\n * `waitForTransaction` (matches the cast in both existing\n * duplicates).\n * - `signer`: a `ResolvedSigner` slice with an account-owned\n * transaction scope. The build/sign/execute/wait pipeline runs\n * inside that scope so gas/object-version resolution cannot race\n * another transaction from the same address.\n * - `build`: a closure returning the serialised tx bytes (the\n * caller constructed the `Transaction` and resolved gas via\n * `tx.build({ client })`).\n * - `awaitFinality`: opt-out for the `waitForTransaction` step.\n * Defaults to `true`. Some callers (action ready-probe) need it;\n * others (mode-local publish ready probe path) wait separately\n * via `getObject` polling and can pass `false`.\n *\n * All failures surface as `SuiExecuteError` with a `phase`\n * discriminator the caller maps to its plugin's phase taxonomy.\n */\nexport const executeSuiTx = (params: {\n\treadonly client: SuiExecuteClient;\n\treadonly signer: ResolvedSigner;\n\treadonly build: SerializedTxBuilder;\n\treadonly awaitFinality?: boolean;\n}): Effect.Effect<ExecutedReceipt, SuiExecuteError, Scope.Scope> =>\n\tparams.signer\n\t\t.withTransactionSigner((lockedSigner) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst { client, signer, build } = params;\n\t\t\t\tconst awaitFinality = params.awaitFinality ?? true;\n\n\t\t\t\t// 1. Serialise the transaction. Failures inside the build\n\t\t\t\t// closure (e.g. `Transaction.build({ client })` rejection)\n\t\t\t\t// surface as `phase: 'serialize'` so callers can attribute\n\t\t\t\t// them at the call site.\n\t\t\t\tconst txBytes = yield* Effect.tryPromise({\n\t\t\t\t\ttry: () => build(),\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'serialize',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Transaction.build failed for signer '${signer.name}' ` +\n\t\t\t\t\t\t\t\t`(address=${signer.address}): ` +\n\t\t\t\t\t\t\t\t(cause instanceof Error ? cause.message : String(cause)),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// 2. Sign with the resolved signer. The signer's own typed\n\t\t\t\t// error surfaces in `cause`; we collapse to `phase: 'sign'`\n\t\t\t\t// so the cascade-formatter can walk the cause chain.\n\t\t\t\tconst signed = yield* lockedSigner.signTransaction(txBytes).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\tphase: 'sign',\n\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`signer.signTransaction failed for '${signer.name}' ` +\n\t\t\t\t\t\t\t\t\t`(address=${signer.address}).`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\t// 3. Execute via the SDK. We always request `effects: true` and\n\t\t\t\t// `objectTypes: true` because every existing caller needs\n\t\t\t\t// `changedObjects` + types to project to its domain shape.\n\t\t\t\tconst raw = yield* Effect.tryPromise({\n\t\t\t\t\ttry: () =>\n\t\t\t\t\t\tclient.executeTransaction({\n\t\t\t\t\t\t\ttransaction: txBytes,\n\t\t\t\t\t\t\tsignatures: [signed.signature],\n\t\t\t\t\t\t\tinclude: { effects: true, objectTypes: true },\n\t\t\t\t\t\t}),\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'execute',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`executeTransaction rejected for signer '${signer.name}': ` +\n\t\t\t\t\t\t\t\t(cause instanceof Error ? cause.message : String(cause)),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// 4. Project the envelope. `$kind === 'FailedTransaction'`\n\t\t\t\t// surfaces as a discrete phase so callers can distinguish\n\t\t\t\t// transport failures from on-chain rejection.\n\t\t\t\tconst env = raw as RawExecuteEnvelope;\n\t\t\t\tif (env.$kind === 'FailedTransaction') {\n\t\t\t\t\tconst failedDigest = env.FailedTransaction?.digest;\n\t\t\t\t\tif (awaitFinality && failedDigest !== undefined) {\n\t\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () => client.waitForTransaction({ digest: failedDigest }),\n\t\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\t\tphase: 'wait-for-finality',\n\t\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\t\tdigest: failedDigest,\n\t\t\t\t\t\t\t\t\tmessage: `waitForTransaction(${failedDigest}) failed.`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\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\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'failed-transaction',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tdigest: env.FailedTransaction?.digest,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`executeTransaction returned FailedTransaction ` +\n\t\t\t\t\t\t\t\t`(digest=${env.FailedTransaction?.digest ?? '<unknown>'}): ` +\n\t\t\t\t\t\t\t\t(env.FailedTransaction?.status?.error ?? '<no error>'),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst txOk = env.Transaction;\n\t\t\t\tif (txOk?.digest === undefined) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'no-digest',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tmessage: `executeTransaction returned no digest. Raw=${JSON.stringify(raw).slice(0, 300)}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// 5. Wait for finality (opt-out — some callers wait separately).\n\t\t\t\tif (awaitFinality) {\n\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\ttry: () => client.waitForTransaction({ digest: txOk.digest! }),\n\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\tphase: 'wait-for-finality',\n\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\tdigest: txOk.digest,\n\t\t\t\t\t\t\t\tmessage: `waitForTransaction(${txOk.digest}) failed.`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// 6. Project changedObjects flat. Callers pick which entries\n\t\t\t\t// they care about (published / created / mutated / by-type\n\t\t\t\t// substring).\n\t\t\t\tconst objectTypes = txOk.objectTypes ?? {};\n\t\t\t\tconst objectChanges: Array<ExecutedObjectChange> = [];\n\t\t\t\tfor (const ch of txOk.effects?.changedObjects ?? []) {\n\t\t\t\t\tif (typeof ch.objectId !== 'string') continue;\n\t\t\t\t\tconst objectType = objectTypes[ch.objectId];\n\t\t\t\t\tconst entry: { -readonly [K in keyof ExecutedObjectChange]: ExecutedObjectChange[K] } = {\n\t\t\t\t\t\tobjectId: ch.objectId,\n\t\t\t\t\t};\n\t\t\t\t\tif (objectType !== undefined) entry.objectType = objectType;\n\t\t\t\t\tif (ch.outputState !== undefined) entry.outputState = ch.outputState;\n\t\t\t\t\tif (ch.idOperation !== undefined) entry.idOperation = ch.idOperation;\n\t\t\t\t\tobjectChanges.push(entry);\n\t\t\t\t}\n\n\t\t\t\treturn { digest: txOk.digest, objectChanges };\n\t\t\t}),\n\t\t)\n\t\t.pipe(\n\t\t\tEffect.withSpan('substrate.sui-execute', {\n\t\t\t\tattributes: {\n\t\t\t\t\t'sui-execute.signer': params.signer.name,\n\t\t\t\t\t'sui-execute.address': params.signer.address,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/substrate/runtime/sui-execute/index.ts"],"sourcesContent":["// sui-execute — substrate helper for the Sui-SDK transaction\n// roundtrip.\n//\n// ARCHITECTURE NOTE — substrate-name-awareness escape hatch:\n//\n// This module is the ONE blessed substrate-side Sui-aware module.\n// The substrate is otherwise strictly name-blind (see ARCHITECTURE.md\n// §\"Substrate name-blindness\"), but the \"build → sign → execute →\n// wait → project\" roundtrip is duplicated verbatim across\n// `plugins/package/publish-executor.ts` and `plugins/action/execute.ts`\n// — ~80% identical line-for-line — and the same shape is needed for\n// `seal` (deploy + key-server registration), `coin.mint`, `action`,\n// and `deepbook` (publish + pool creation).\n//\n// Lifting the dispatch here gives every Sui-tx plugin one well-tested\n// surface and surfaces the SDK-envelope shape decisions (`include:\n// { effects, objectTypes }`, `$kind` projection, `FailedTransaction`\n// detection) ONCE.\n//\n// Boundary discipline:\n//\n// - This module is L1-adjacent: it lives under `substrate/runtime/`\n// but consumes opaque shapes (`unknown` SDK client; opaque\n// signer closure). It does NOT import from `plugins/sui/*` or\n// `@mysten/sui/*` — the caller passes in the resolved SDK ref\n// and the signer; the substrate just orchestrates the roundtrip.\n// - The return shape (`ExecutedReceipt`) is name-blind: a flat\n// digest + a uniform `objectChanges` array. Callers map to their\n// domain shape (PublishReceipt, ActionReceipt, MintReceipt, …).\n// - Transport / protocol failures (serialize, sign, execute, no-digest,\n// wait-for-finality) route through `SuiExecuteError` whose `phase`\n// discriminates the failing step. Callers map to their plugin's\n// phase taxonomy in their produce body's `mapError` closure.\n// - On-chain `FailedTransaction` is a RETURN-CHANNEL variant of\n// `SuiExecuteResult`, NOT an error — mirrors `account.signAndExecute`\n// and STYLE_GUIDE §2's return-channel discriminated-union rule.\n// Callers dispatch on `$kind` after the call.\n\nimport { Effect, Schema, Scope } from 'effect';\nimport type { ClientWithCoreApi } from '@mysten/sui/client';\n\nimport { formatUnknownError } from '../format-unknown-error.ts';\n\n// ---------------------------------------------------------------------------\n// Errors — substrate-style Schema.TaggedErrorClass\n// ---------------------------------------------------------------------------\n\n/** Tagged failure during one step of the Sui-tx roundtrip. `phase`\n * discriminates which step failed so callers can map to their\n * plugin's phase taxonomy (publish-tx, sign, parse, …) without\n * losing the original cause.\n *\n * On-chain `FailedTransaction` is NOT a phase here — it surfaces as\n * the `$kind: 'FailedTransaction'` variant of `SuiExecuteResult`\n * (return channel). Only transport / protocol failures live in this\n * taxonomy. See STYLE_GUIDE §2. */\nexport class SuiExecuteError extends Schema.TaggedErrorClass<SuiExecuteError>()('SuiExecuteError', {\n\tphase: Schema.Literals(['serialize', 'sign', 'execute', 'no-digest', 'wait-for-finality']),\n\tsignerName: Schema.String,\n\tsignerAddress: Schema.String,\n\tmessage: Schema.String,\n\t/** Echoed digest when the SDK returned one but a later step\n\t * failed — surfaces in cause-walker output. */\n\tdigest: Schema.optional(Schema.String),\n\tcause: Schema.optional(Schema.Defect),\n}) {}\n\n// ---------------------------------------------------------------------------\n// Inputs / outputs — opaque at the substrate boundary\n// ---------------------------------------------------------------------------\n\n/** The SDK client this helper drives. Accepts any `ClientWithCoreApi`\n * (the published cross-transport surface from `@mysten/sui/client`).\n * `executeSuiTx` calls `client.core.executeTransaction` /\n * `client.core.waitForTransaction` per STYLE_GUIDE §16. */\nexport type SuiExecuteClient = ClientWithCoreApi;\n\n/** Serialised transaction-build callback. Returns the BCS bytes ready\n * for signing. The caller owns the `Transaction` construction — the\n * substrate does not import `@mysten/sui/transactions` — and resolves\n * it via `Transaction.build({ client })`. */\nexport type SerializedTxBuilder = () => Promise<Uint8Array>;\n\nexport interface TransactionSignerScope<SignError = unknown> {\n\treadonly signTransaction: (\n\t\ttx: Uint8Array,\n\t) => Effect.Effect<{ readonly bytes: string; readonly signature: string }, SignError>;\n}\n\n/** Resolved signer — narrow slice of `AccountValue`. */\nexport interface ResolvedSigner {\n\treadonly name: string;\n\treadonly address: string;\n\treadonly signTransaction: (\n\t\ttx: Uint8Array,\n\t) => Effect.Effect<{ readonly bytes: string; readonly signature: string }, unknown>;\n\treadonly withTransactionSigner: <A, E, R>(\n\t\tbody: (signer: TransactionSignerScope) => Effect.Effect<A, E, R>,\n\t) => Effect.Effect<A, E, R>;\n}\n\n/** Flat per-object change record. Mirrors the union of fields that\n * `PublishObjectChange` (package) and `ActionObjectChange` (action)\n * expose so callers can pick whichever subset they surface. */\nexport interface ExecutedObjectChange {\n\treadonly objectId: string;\n\treadonly objectType?: string;\n\treadonly outputState?: string;\n\treadonly idOperation?: string;\n}\n\n/** Result of one successful execute round. Callers map this to their\n * domain shape (PublishReceipt, ActionReceipt, MintReceipt, …). */\nexport interface ExecutedReceipt {\n\treadonly digest: string;\n\treadonly objectChanges: ReadonlyArray<ExecutedObjectChange>;\n}\n\n/** On-chain failure projection. The transaction was delivered +\n * executed by the validator but the on-chain execution failed.\n * Carries the digest (for log correlation) plus the validator's\n * stringified error when one was attached. `executionError` is\n * omitted when the SDK returns no message (STYLE_GUIDE §5: no\n * sentinel placeholders at resolved-value surfaces). An envelope\n * without a digest fails at projection with\n * `SuiExecuteError(phase: 'no-digest')`.\n *\n * This is the single source of truth for the on-chain-failure shape\n * across the devstack: `account.SignAndExecuteResult`'s\n * `FailedTransaction` variant carries it directly; every plugin that\n * renders one of these failures into a user-facing error message goes\n * through `formatExecutedFailure` (below). */\nexport interface ExecutedFailure {\n\treadonly digest: string;\n\treadonly executionError?: string;\n}\n\n/** Render the canonical \"digest + executionError-or-noted-absent\" tail\n * used by every plugin's `FailedTransaction` surface. Pure projection;\n * does not throw.\n *\n * Used at the call site as e.g.\n * `\\`seal publish ... ${formatExecutedFailure(result.FailedTransaction)}\\``.\n * Centralising the wording means future tweaks propagate uniformly\n * across the seal / coin / walrus / deepbook / action / package\n * surfaces. */\nexport const formatExecutedFailure = (failure: ExecutedFailure): string =>\n\tfailure.executionError !== undefined\n\t\t? `at ${failure.digest}: ${failure.executionError}`\n\t\t: `at ${failure.digest} (no validator error attached)`;\n\n/** Outcome of `executeSuiTx`. Mirrors the SDK's discriminated\n * `SuiClientTypes.TransactionResult` shape — on-chain failures are a\n * RETURN VALUE (callers dispatch on `$kind`), NOT an error. Only\n * transport / protocol failures (sign refused, RPC unreachable,\n * finality wait broke, no digest) surface through `SuiExecuteError`.\n * See STYLE_GUIDE §2 for the return-channel discipline this matches. */\nexport type SuiExecuteResult =\n\t| { readonly $kind: 'Transaction'; readonly Transaction: ExecutedReceipt }\n\t| { readonly $kind: 'FailedTransaction'; readonly FailedTransaction: ExecutedFailure };\n\n// ---------------------------------------------------------------------------\n// SDK envelope projection (matches publish-executor + action.execute)\n// ---------------------------------------------------------------------------\n\ninterface RawExecuteEnvelope {\n\treadonly $kind?: 'Transaction' | 'FailedTransaction';\n\treadonly Transaction?: {\n\t\treadonly digest?: string;\n\t\treadonly effects?: {\n\t\t\treadonly changedObjects?: ReadonlyArray<{\n\t\t\t\treadonly objectId?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t}>;\n\t\t};\n\t\treadonly objectTypes?: Readonly<Record<string, string>>;\n\t};\n\treadonly FailedTransaction?: {\n\t\treadonly digest?: string;\n\t\treadonly status?: { readonly error?: string };\n\t};\n}\n\n/** Pull the digest out of a raw `executeTransaction` envelope without\n * committing to success vs on-chain failure. `FailedTransaction`\n * carries its digest under a sibling key, so callers that only need\n * the digest (impersonate / one-shot dispatch paths that don't run\n * the full `executeSuiTx` projection) read it through this projector\n * rather than re-deriving the `$kind`-branching shape inline.\n * Returns `undefined` for a malformed envelope; callers decide\n * whether a missing digest is a failure. */\nexport const extractExecuteDigest = (raw: unknown): string | undefined => {\n\tconst env = raw as RawExecuteEnvelope;\n\treturn env.$kind === 'FailedTransaction'\n\t\t? env.FailedTransaction?.digest\n\t\t: env.Transaction?.digest;\n};\n\n// ---------------------------------------------------------------------------\n// The helper\n// ---------------------------------------------------------------------------\n\n/** Drive the serialize → sign → execute → wait → project pipeline.\n *\n * The caller passes:\n * - `client`: an opaque SDK client exposing `executeTransaction` +\n * `waitForTransaction` (matches the cast in both existing\n * duplicates).\n * - `signer`: a `ResolvedSigner` slice with an account-owned\n * transaction scope. The build/sign/execute/wait pipeline runs\n * inside that scope so gas/object-version resolution cannot race\n * another transaction from the same address.\n * - `build`: a closure returning the serialised tx bytes (the\n * caller constructed the `Transaction` and resolved gas via\n * `tx.build({ client })`).\n * - `awaitFinality`: opt-out for the `waitForTransaction` step.\n * Defaults to `true`. Some callers (action ready-probe) need it;\n * others (mode-local publish ready probe path) wait separately\n * via `getObject` polling and can pass `false`.\n *\n * Returns a `SuiExecuteResult` discriminated union — callers dispatch\n * on `$kind` to distinguish on-chain success (`'Transaction'`) from\n * on-chain rejection (`'FailedTransaction'`). Transport / protocol\n * failures (serialize, sign, execute, no-digest, wait-for-finality)\n * surface as `SuiExecuteError` with a `phase` discriminator the\n * caller maps to its plugin's phase taxonomy.\n */\nexport const executeSuiTx = (params: {\n\treadonly client: SuiExecuteClient;\n\treadonly signer: ResolvedSigner;\n\treadonly build: SerializedTxBuilder;\n\treadonly awaitFinality?: boolean;\n}): Effect.Effect<SuiExecuteResult, SuiExecuteError, Scope.Scope> =>\n\tparams.signer\n\t\t.withTransactionSigner((lockedSigner) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst { client, signer, build } = params;\n\t\t\t\tconst awaitFinality = params.awaitFinality ?? true;\n\n\t\t\t\t// 1. Serialise the transaction. Failures inside the build\n\t\t\t\t// closure (e.g. `Transaction.build({ client })` rejection)\n\t\t\t\t// surface as `phase: 'serialize'` so callers can attribute\n\t\t\t\t// them at the call site.\n\t\t\t\tconst txBytes = yield* Effect.tryPromise({\n\t\t\t\t\ttry: () => build(),\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'serialize',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Transaction.build failed for signer '${signer.name}' ` +\n\t\t\t\t\t\t\t\t`(address=${signer.address}): ` +\n\t\t\t\t\t\t\t\tformatUnknownError(cause),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// 2. Sign with the resolved signer. The signer's own typed\n\t\t\t\t// error surfaces in `cause`; we collapse to `phase: 'sign'`\n\t\t\t\t// so the cascade-formatter can walk the cause chain.\n\t\t\t\tconst signed = yield* lockedSigner.signTransaction(txBytes).pipe(\n\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\tphase: 'sign',\n\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`signer.signTransaction failed for '${signer.name}' ` +\n\t\t\t\t\t\t\t\t\t`(address=${signer.address}).`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\t// 3. Execute via the SDK. We always request `effects: true` and\n\t\t\t\t// `objectTypes: true` because every existing caller needs\n\t\t\t\t// `changedObjects` + types to project to its domain shape.\n\t\t\t\tconst raw = yield* Effect.tryPromise({\n\t\t\t\t\ttry: () =>\n\t\t\t\t\t\tclient.core.executeTransaction({\n\t\t\t\t\t\t\ttransaction: txBytes,\n\t\t\t\t\t\t\tsignatures: [signed.signature],\n\t\t\t\t\t\t\tinclude: { effects: true, objectTypes: true },\n\t\t\t\t\t\t}),\n\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'execute',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`executeTransaction rejected for signer '${signer.name}': ` +\n\t\t\t\t\t\t\t\tformatUnknownError(cause),\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\t// 4. Project the envelope. `$kind === 'FailedTransaction'`\n\t\t\t\t// surfaces as a return-channel variant — on-chain\n\t\t\t\t// rejection is a normal outcome, NOT a transport failure\n\t\t\t\t// (STYLE_GUIDE §2). Callers dispatch on `$kind` and map\n\t\t\t\t// to their plugin's on-chain-failure shape.\n\t\t\t\tconst env = raw as RawExecuteEnvelope;\n\t\t\t\tif (env.$kind === 'FailedTransaction') {\n\t\t\t\t\tconst failedDigest = env.FailedTransaction?.digest;\n\t\t\t\t\tif (failedDigest === undefined) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\tphase: 'no-digest',\n\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`executeTransaction returned FailedTransaction with no digest. ` +\n\t\t\t\t\t\t\t\t\t`Raw=${JSON.stringify(raw).slice(0, 300)}`,\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\tif (awaitFinality) {\n\t\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () => client.core.waitForTransaction({ digest: failedDigest }),\n\t\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\t\tphase: 'wait-for-finality',\n\t\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\t\tdigest: failedDigest,\n\t\t\t\t\t\t\t\t\tmessage: `waitForTransaction(${failedDigest}) failed.`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\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\tconst executionError = env.FailedTransaction?.status?.error;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t$kind: 'FailedTransaction',\n\t\t\t\t\t\tFailedTransaction: {\n\t\t\t\t\t\t\tdigest: failedDigest,\n\t\t\t\t\t\t\t...(executionError !== undefined ? { executionError } : {}),\n\t\t\t\t\t\t},\n\t\t\t\t\t} satisfies SuiExecuteResult;\n\t\t\t\t}\n\t\t\t\tconst txOk = env.Transaction;\n\t\t\t\tif (txOk?.digest === undefined) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\tphase: 'no-digest',\n\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\tmessage: `executeTransaction returned no digest. Raw=${JSON.stringify(raw).slice(0, 300)}`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// 5. Wait for finality (opt-out — some callers wait separately).\n\t\t\t\tif (awaitFinality) {\n\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\ttry: () => client.core.waitForTransaction({ digest: txOk.digest! }),\n\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\tnew SuiExecuteError({\n\t\t\t\t\t\t\t\tphase: 'wait-for-finality',\n\t\t\t\t\t\t\t\tsignerName: signer.name,\n\t\t\t\t\t\t\t\tsignerAddress: signer.address,\n\t\t\t\t\t\t\t\tdigest: txOk.digest,\n\t\t\t\t\t\t\t\tmessage: `waitForTransaction(${txOk.digest}) failed.`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// 6. Project changedObjects flat. Callers pick which entries\n\t\t\t\t// they care about (published / created / mutated / by-type\n\t\t\t\t// substring).\n\t\t\t\tconst objectTypes = txOk.objectTypes ?? {};\n\t\t\t\tconst objectChanges: Array<ExecutedObjectChange> = [];\n\t\t\t\tfor (const ch of txOk.effects?.changedObjects ?? []) {\n\t\t\t\t\tif (typeof ch.objectId !== 'string') continue;\n\t\t\t\t\tconst objectType = objectTypes[ch.objectId];\n\t\t\t\t\tconst entry: { -readonly [K in keyof ExecutedObjectChange]: ExecutedObjectChange[K] } = {\n\t\t\t\t\t\tobjectId: ch.objectId,\n\t\t\t\t\t};\n\t\t\t\t\tif (objectType !== undefined) entry.objectType = objectType;\n\t\t\t\t\tif (ch.outputState !== undefined) entry.outputState = ch.outputState;\n\t\t\t\t\tif (ch.idOperation !== undefined) entry.idOperation = ch.idOperation;\n\t\t\t\t\tobjectChanges.push(entry);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t$kind: 'Transaction',\n\t\t\t\t\tTransaction: { digest: txOk.digest, objectChanges },\n\t\t\t\t} satisfies SuiExecuteResult;\n\t\t\t}),\n\t\t)\n\t\t.pipe(\n\t\t\tEffect.withSpan('substrate.sui-execute', {\n\t\t\t\tattributes: {\n\t\t\t\t\t'sui-execute.signer': params.signer.name,\n\t\t\t\t\t'sui-execute.address': params.signer.address,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n/** Decode a possibly URI-encoded SDK error message. The Sui SDK\n * emits `decodeURIComponent`-able strings for some error paths\n * (notably stale-object-version reports). Falls back to the raw\n * message on decode failure. */\nconst decodeMessage = (message: string): string => {\n\ttry {\n\t\treturn decodeURIComponent(message);\n\t} catch {\n\t\treturn message;\n\t}\n};\n\n/** Typed predicate for the SDK's \"stale object version\" transient\n * failure — the Move VM refuses a transaction that references an\n * object reference older than the current chain version. Consumers\n * retry with fresh refs; pair with `STALE_OBJECT_VERSION_RETRY_PROFILE`\n * from `retry-policy.ts`. Detection sniffs the SDK message because the\n * underlying gRPC error class doesn't expose a structured discriminator\n * for this case. */\nexport const isSuiStaleObjectVersionError = (err: SuiExecuteError): boolean => {\n\tconst message = decodeMessage(err.message);\n\treturn (\n\t\tmessage.includes('needs to be rebuilt because object') && message.includes('current version')\n\t);\n};\n\n// ---------------------------------------------------------------------------\n// Sibling helpers\n// ---------------------------------------------------------------------------\n\nexport {\n\tsignAndDispatch,\n\ttype SignAndDispatchResult,\n\ttype SignAndDispatchSigner,\n\ttype TransactionSignerSource,\n} from './sign-and-dispatch.ts';\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ import { Effect } from "effect";
@@ -0,0 +1,32 @@
1
+ import { Effect } from "effect";
2
+ //#region src/substrate/runtime/sui-execute/sign-and-dispatch.ts
3
+ /** Run `withTransactionSigner( buildTxBytes → signAndExecute → mapSignError →
4
+ * dispatch on $kind )`. The caller owns:
5
+ *
6
+ * - `buildTxBytes`: an Effect returning the serialised `Uint8Array`,
7
+ * run INSIDE the signer scope. Failures inside this effect
8
+ * propagate verbatim — the caller maps `Transaction.build` /
9
+ * impersonation-build errors to its plugin domain there.
10
+ * - `mapSignError`: projects the signer's typed sign error
11
+ * (`AccountSignError` for the Account bus) into the caller's
12
+ * domain error before dispatch. Without this projection
13
+ * `mapSignError` and the dispatch callbacks would need to share
14
+ * the same error channel, which forces every caller into a tagged
15
+ * domain error anyway.
16
+ * - `onFailed`: dispatch for the `FailedTransaction` variant.
17
+ * Typically `Effect.fail(domainError(formatExecutedFailure(...)))`.
18
+ * - `onSuccess`: dispatch for the `Transaction` variant — projects
19
+ * the SDK-shaped tx result to the caller's receipt shape.
20
+ *
21
+ * Returns the union of the dispatch callbacks' types so callers do
22
+ * not have to wrap the call in a redundant `Effect.gen`. */
23
+ const signAndDispatch = (args) => args.signerSource.withTransactionSigner((lockedSigner) => Effect.gen(function* () {
24
+ const txBytes = yield* args.buildTxBytes(lockedSigner);
25
+ const result = yield* lockedSigner.signAndExecute(txBytes).pipe(Effect.mapError(args.mapSignError));
26
+ if (result.$kind === "FailedTransaction") return yield* args.onFailed(result.FailedTransaction);
27
+ return yield* args.onSuccess(result.Transaction);
28
+ }));
29
+ //#endregion
30
+ export { signAndDispatch };
31
+
32
+ //# sourceMappingURL=sign-and-dispatch.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign-and-dispatch.mjs","names":[],"sources":["../../../../src/substrate/runtime/sui-execute/sign-and-dispatch.ts"],"sourcesContent":["// signAndDispatch — boilerplate compactor for the\n// `withTransactionSigner → buildTxBytes → signAndExecute → $kind\n// dispatch` pattern that recurs across every Sui-tx plugin\n// (`package.publish`, `action.execute`, `coin.mint`, `walrus.fundWal`,\n// `deepbook.fundDeep`, and any future user-authored signer plugin).\n//\n// Distinct from `executeSuiTx` (sibling in this directory):\n// - `executeSuiTx` drives `core.executeTransaction` directly via the\n// raw SDK client + an opaque resolved signer. It splits sign and\n// execute and projects the SDK envelope itself.\n// - `signAndDispatch` consumes the Account plugin's higher-level\n// `signAndExecute` surface (which fuses sign + execute + finality\n// wait + projection into one Effect) and just compacts the\n// surrounding boilerplate.\n//\n// Both helpers coexist: plugins that publish through the Account bus\n// (the majority) use `signAndDispatch`; lower-level callers that drive\n// the SDK client directly use `executeSuiTx`.\n//\n// Boundary discipline (matches the sui-execute escape-hatch in this\n// directory): this module is L1-adjacent — it consumes opaque shapes\n// (an `AccountValue`-like contract surface and the `SignAndExecuteResult`\n// union) but does NOT import from `plugins/*` or `@mysten/sui/*`. The\n// caller owns the transaction build, the error mapping, and the\n// dispatch bodies.\n//\n// On-chain `FailedTransaction` is a RETURN-CHANNEL outcome (caller\n// dispatches on `$kind` via the `onFailed` callback), NOT an error —\n// matches STYLE_GUIDE §2 and the upstream `SignAndExecuteResult` shape.\n\nimport { Effect } from 'effect';\n\nimport type { ExecutedFailure, ExecutedReceipt } from './index.ts';\n\n// ---------------------------------------------------------------------------\n// Resolved-signer shape — narrow slice of `AccountValue`\n// ---------------------------------------------------------------------------\n\n/** The SDK-shaped result of `lockedSigner.signAndExecute`. Mirrors the\n * Account plugin's `SignAndExecuteResult` union; redeclared here so\n * the substrate helper does not import from `plugins/account/*`. The\n * Account plugin's projection uses the substrate `ExecutedFailure`\n * shape already (single source of truth in `sui-execute/index.ts`).\n * Generic over the success transaction shape because the Account\n * plugin's `TxResult` widens `ExecutedReceipt` with `effects` /\n * `balanceChanges` fields that not every caller needs to surface. */\nexport type SignAndDispatchResult<TxOk extends { readonly digest: string } = ExecutedReceipt> =\n\t| { readonly $kind: 'Transaction'; readonly Transaction: TxOk }\n\t| { readonly $kind: 'FailedTransaction'; readonly FailedTransaction: ExecutedFailure };\n\n/** Locked-signer slice handed to the caller's tx-build closure. Narrow\n * view of `AccountTransactionSigner` — the substrate-side contract\n * doesn't reach into the Account plugin's surface. Generic over the\n * signer's sign-side error (typically `AccountSignError`) and the\n * success transaction shape. */\nexport interface SignAndDispatchSigner<SignError, TxOk extends { readonly digest: string }> {\n\treadonly signAndExecute: (\n\t\ttx: Uint8Array,\n\t) => Effect.Effect<SignAndDispatchResult<TxOk>, SignError>;\n}\n\n/** Outer signer-source surface required by `signAndDispatch` — anything\n * that exposes a `withTransactionSigner` scope. The substrate helper\n * only reaches `withTransactionSigner`, so plugins composing custom\n * signing surfaces can satisfy the slice without dragging in any\n * particular publisher's full contract. */\nexport interface TransactionSignerSource<SignError, TxOk extends { readonly digest: string }> {\n\treadonly withTransactionSigner: <A, E, R>(\n\t\tbody: (signer: SignAndDispatchSigner<SignError, TxOk>) => Effect.Effect<A, E, R>,\n\t) => Effect.Effect<A, E, R>;\n}\n\n// ---------------------------------------------------------------------------\n// The helper\n// ---------------------------------------------------------------------------\n\n/** Run `withTransactionSigner( buildTxBytes → signAndExecute → mapSignError →\n * dispatch on $kind )`. The caller owns:\n *\n * - `buildTxBytes`: an Effect returning the serialised `Uint8Array`,\n * run INSIDE the signer scope. Failures inside this effect\n * propagate verbatim — the caller maps `Transaction.build` /\n * impersonation-build errors to its plugin domain there.\n * - `mapSignError`: projects the signer's typed sign error\n * (`AccountSignError` for the Account bus) into the caller's\n * domain error before dispatch. Without this projection\n * `mapSignError` and the dispatch callbacks would need to share\n * the same error channel, which forces every caller into a tagged\n * domain error anyway.\n * - `onFailed`: dispatch for the `FailedTransaction` variant.\n * Typically `Effect.fail(domainError(formatExecutedFailure(...)))`.\n * - `onSuccess`: dispatch for the `Transaction` variant — projects\n * the SDK-shaped tx result to the caller's receipt shape.\n *\n * Returns the union of the dispatch callbacks' types so callers do\n * not have to wrap the call in a redundant `Effect.gen`. */\nexport const signAndDispatch = <\n\tA,\n\tBuildError,\n\tBuildEnv,\n\tSignError,\n\tDomainError,\n\tOnFailedError,\n\tOnFailedEnv,\n\tOnSuccessError,\n\tOnSuccessEnv,\n\tTxOk extends { readonly digest: string } = ExecutedReceipt,\n>(args: {\n\treadonly signerSource: TransactionSignerSource<SignError, TxOk>;\n\treadonly buildTxBytes: (\n\t\tsigner: SignAndDispatchSigner<SignError, TxOk>,\n\t) => Effect.Effect<Uint8Array, BuildError, BuildEnv>;\n\treadonly mapSignError: (cause: SignError) => DomainError;\n\treadonly onFailed: (failure: ExecutedFailure) => Effect.Effect<A, OnFailedError, OnFailedEnv>;\n\treadonly onSuccess: (ok: TxOk) => Effect.Effect<A, OnSuccessError, OnSuccessEnv>;\n}): Effect.Effect<\n\tA,\n\tBuildError | DomainError | OnFailedError | OnSuccessError,\n\tBuildEnv | OnFailedEnv | OnSuccessEnv\n> =>\n\targs.signerSource.withTransactionSigner((lockedSigner) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst txBytes = yield* args.buildTxBytes(lockedSigner);\n\t\t\tconst result = yield* lockedSigner\n\t\t\t\t.signAndExecute(txBytes)\n\t\t\t\t.pipe(Effect.mapError(args.mapSignError));\n\t\t\tif (result.$kind === 'FailedTransaction') {\n\t\t\t\treturn yield* args.onFailed(result.FailedTransaction);\n\t\t\t}\n\t\t\treturn yield* args.onSuccess(result.Transaction);\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgGA,MAAa,mBAWX,SAaD,KAAK,aAAa,uBAAuB,iBACxC,OAAO,IAAI,aAAa;CACvB,MAAM,UAAU,OAAO,KAAK,aAAa,aAAa;CACtD,MAAM,SAAS,OAAO,aACpB,eAAe,QAAQ,CACvB,KAAK,OAAO,SAAS,KAAK,aAAa,CAAC;AAC1C,KAAI,OAAO,UAAU,oBACpB,QAAO,OAAO,KAAK,SAAS,OAAO,kBAAkB;AAEtD,QAAO,OAAO,KAAK,UAAU,OAAO,YAAY;EAC/C,CACF"}
@@ -0,0 +1,32 @@
1
+ //#region src/substrate/runtime/sui-ledger/object-ref.ts
2
+ /** Re-cast a `SuiSdkShim` as the gRPC ledger-service client. The
3
+ * `unknown` hop is required because `ClientWithCoreApi` doesn't
4
+ * structurally overlap with `{ledgerService: …}`. */
5
+ const ledgerObjectClient = (sdk) => sdk.client;
6
+ /** Up-to-date `{objectId, version, digest}` ObjectRef for `objectId`,
7
+ * fetched through the gRPC ledger service.
8
+ *
9
+ * Throws if the response envelope is missing any of `objectId` /
10
+ * `version` / `digest` — e.g. when the object was deleted or never
11
+ * existed. The error message includes the requested object id so
12
+ * call-site context surfaces in plugin error traces. */
13
+ const currentLedgerObjectRef = async (sdk, objectId) => {
14
+ const object = (await ledgerObjectClient(sdk).ledgerService.getObject({
15
+ objectId,
16
+ readMask: { paths: [
17
+ "object_id",
18
+ "version",
19
+ "digest"
20
+ ] }
21
+ })).response?.object;
22
+ if (object === void 0 || object.objectId === void 0 || object.version === void 0 || object.digest === void 0) throw new Error(`currentLedgerObjectRef: object '${objectId}' was not found (response missing one of objectId/version/digest).`);
23
+ return {
24
+ objectId: object.objectId,
25
+ version: object.version.toString(),
26
+ digest: object.digest
27
+ };
28
+ };
29
+ //#endregion
30
+ export { currentLedgerObjectRef };
31
+
32
+ //# sourceMappingURL=object-ref.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-ref.mjs","names":[],"sources":["../../../../src/substrate/runtime/sui-ledger/object-ref.ts"],"sourcesContent":["// substrate/runtime/sui-ledger — `ledgerService.getObject` workaround.\n//\n// `SuiSdkShim.core.getObject` returns the simplified `core`-surface\n// projection (no version/digest) per `@mysten/sui`'s `ClientWithCoreApi`\n// shape. The gRPC ledger service provides the BCS-encoded object\n// envelope WITH version + digest under a `readMask` projection — see\n// `@mysten/sui/docs/clients/grpc.md` § Ledger service.\n//\n// The cast `sdk.client as unknown as {ledgerService: {…}}` is the\n// sanctioned escape hatch — `ClientWithCoreApi` doesn't structurally\n// overlap with the gRPC `{ledgerService}` shape, so a direct cast fails.\n// Folded into one substrate-side helper so every plugin that needs an\n// up-to-date `{objectId, version, digest}` ObjectRef goes through the\n// same projection (and the same `unknown`-cast escape hatch) rather\n// than re-deriving it.\n//\n// NOTE: not exported from the public barrel — this is an internal\n// substrate primitive used by plugins, not a published API.\n//\n// Sibling of `substrate/runtime/sui-execute/` — same opacity discipline\n// (no `@mysten/sui/client` type import; the opaque `SuiSdkShim` carries\n// the client through).\n\nimport type { SuiSdkShim } from '../../../plugins/sui/index.ts';\n\n/** Shape of the gRPC ledger-service projection we need. Hand-written\n * because the public `ClientWithCoreApi` surface doesn't include the\n * ledger service. */\ninterface LedgerObjectClient {\n\treadonly ledgerService: {\n\t\treadonly getObject: (args: {\n\t\t\treadonly objectId: string;\n\t\t\treadonly readMask?: { readonly paths: ReadonlyArray<string> };\n\t\t}) => Promise<{\n\t\t\treadonly response?: {\n\t\t\t\treadonly object?: {\n\t\t\t\t\treadonly objectId?: string;\n\t\t\t\t\treadonly version?: string | number | bigint;\n\t\t\t\t\treadonly digest?: string;\n\t\t\t\t};\n\t\t\t};\n\t\t}>;\n\t};\n}\n\n/** Re-cast a `SuiSdkShim` as the gRPC ledger-service client. The\n * `unknown` hop is required because `ClientWithCoreApi` doesn't\n * structurally overlap with `{ledgerService: …}`. */\nconst ledgerObjectClient = (sdk: SuiSdkShim): LedgerObjectClient =>\n\tsdk.client as unknown as LedgerObjectClient;\n\n/** Up-to-date `{objectId, version, digest}` ObjectRef for `objectId`,\n * fetched through the gRPC ledger service.\n *\n * Throws if the response envelope is missing any of `objectId` /\n * `version` / `digest` — e.g. when the object was deleted or never\n * existed. The error message includes the requested object id so\n * call-site context surfaces in plugin error traces. */\nexport const currentLedgerObjectRef = async (\n\tsdk: SuiSdkShim,\n\tobjectId: string,\n): Promise<{\n\treadonly objectId: string;\n\treadonly version: string;\n\treadonly digest: string;\n}> => {\n\tconst raw = await ledgerObjectClient(sdk).ledgerService.getObject({\n\t\tobjectId,\n\t\treadMask: { paths: ['object_id', 'version', 'digest'] },\n\t});\n\tconst object = raw.response?.object;\n\tif (\n\t\tobject === undefined ||\n\t\tobject.objectId === undefined ||\n\t\tobject.version === undefined ||\n\t\tobject.digest === undefined\n\t) {\n\t\tthrow new Error(\n\t\t\t`currentLedgerObjectRef: object '${objectId}' was not found (response missing one of objectId/version/digest).`,\n\t\t);\n\t}\n\treturn {\n\t\tobjectId: object.objectId,\n\t\tversion: object.version.toString(),\n\t\tdigest: object.digest,\n\t};\n};\n"],"mappings":";;;;AAgDA,MAAM,sBAAsB,QAC3B,IAAI;;;;;;;;AASL,MAAa,yBAAyB,OACrC,KACA,aAKK;CAKL,MAAM,UAAS,MAJG,mBAAmB,IAAI,CAAC,cAAc,UAAU;EACjE;EACA,UAAU,EAAE,OAAO;GAAC;GAAa;GAAW;GAAS,EAAE;EACvD,CAAC,EACiB,UAAU;AAC7B,KACC,WAAW,KAAA,KACX,OAAO,aAAa,KAAA,KACpB,OAAO,YAAY,KAAA,KACnB,OAAO,WAAW,KAAA,EAElB,OAAM,IAAI,MACT,mCAAmC,SAAS,oEAC5C;AAEF,QAAO;EACN,UAAU,OAAO;EACjB,SAAS,OAAO,QAAQ,UAAU;EAClC,QAAQ,OAAO;EACf"}