@mysten-incubation/devstack 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/README.md +7 -4
  2. package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
  5. package/dashboard-ui/index.html +2 -2
  6. package/dist/api/define-capabilities.d.mts +1 -20
  7. package/dist/api/define-capabilities.mjs +15 -22
  8. package/dist/api/define-capabilities.mjs.map +1 -1
  9. package/dist/api/define-devstack-with.d.mts +7 -1
  10. package/dist/api/define-devstack-with.mjs.map +1 -1
  11. package/dist/api/define-devstack.mjs.map +1 -1
  12. package/dist/api/define-plugin.d.mts +2 -1
  13. package/dist/api/inference-network.d.mts +31 -17
  14. package/dist/api/inference-network.mjs +40 -43
  15. package/dist/api/inference-network.mjs.map +1 -1
  16. package/dist/api/load-config.mjs +88 -0
  17. package/dist/api/load-config.mjs.map +1 -0
  18. package/dist/api/mode-narrowed-factory.d.mts +1 -1
  19. package/dist/api/mode-narrowed-factory.mjs.map +1 -1
  20. package/dist/api/run-stack-internal.mjs +202 -0
  21. package/dist/api/run-stack-internal.mjs.map +1 -0
  22. package/dist/api/run-stack.d.mts +82 -31
  23. package/dist/api/run-stack.mjs +22 -141
  24. package/dist/api/run-stack.mjs.map +1 -1
  25. package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
  26. package/dist/build-integrations/dapp-kit/index.mjs +58 -0
  27. package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
  28. package/dist/build-integrations/playwright/config.d.mts +1 -30
  29. package/dist/build-integrations/playwright/config.mjs +1 -27
  30. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  31. package/dist/build-integrations/playwright/errors.d.mts +4 -7
  32. package/dist/build-integrations/playwright/errors.mjs.map +1 -1
  33. package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
  34. package/dist/build-integrations/playwright/global-setup.mjs +142 -218
  35. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  36. package/dist/build-integrations/playwright/index.d.mts +2 -2
  37. package/dist/build-integrations/playwright/index.mjs +2 -2
  38. package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
  39. package/dist/build-integrations/playwright/stack-context.mjs +4 -2
  40. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  41. package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
  42. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  44. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
  46. package/dist/build-integrations/runtime/discover.d.mts +6 -4
  47. package/dist/build-integrations/runtime/discover.mjs +15 -4
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  49. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/errors.mjs.map +1 -1
  51. package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
  52. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  53. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
  54. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
  55. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
  57. package/dist/build-integrations/vite/index.d.mts +84 -19
  58. package/dist/build-integrations/vite/index.mjs +203 -28
  59. package/dist/build-integrations/vite/index.mjs.map +1 -1
  60. package/dist/build-integrations/vitest/config.d.mts +20 -2
  61. package/dist/build-integrations/vitest/config.mjs +16 -4
  62. package/dist/build-integrations/vitest/config.mjs.map +1 -1
  63. package/dist/build-integrations/vitest/env.d.mts +18 -10
  64. package/dist/build-integrations/vitest/env.mjs +11 -10
  65. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  66. package/dist/build-integrations/vitest/errors.d.mts +7 -11
  67. package/dist/build-integrations/vitest/errors.mjs +3 -4
  68. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  69. package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
  70. package/dist/build-integrations/vitest/global-setup.mjs +156 -0
  71. package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
  72. package/dist/build-integrations/vitest/index.d.mts +3 -2
  73. package/dist/build-integrations/vitest/index.mjs +3 -2
  74. package/dist/build-integrations/vitest/setup.mjs +2 -2
  75. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  76. package/dist/build-integrations/vitest/stack-context.d.mts +5 -3
  77. package/dist/build-integrations/vitest/stack-context.mjs +3 -2
  78. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  79. package/dist/cli/bail.mjs.map +1 -1
  80. package/dist/cli/doctor-probes.mjs +1 -3
  81. package/dist/cli/doctor-probes.mjs.map +1 -1
  82. package/dist/cli/main.d.mts +23 -1
  83. package/dist/cli/main.mjs +63 -8
  84. package/dist/cli/main.mjs.map +1 -1
  85. package/dist/cli/prune-direct.mjs.map +1 -1
  86. package/dist/cli/snapshot-reader.mjs.map +1 -1
  87. package/dist/cli/up-lifecycle.mjs.map +1 -1
  88. package/dist/cli/wirings/apply.mjs +28 -21
  89. package/dist/cli/wirings/apply.mjs.map +1 -1
  90. package/dist/cli/wirings/codegen.mjs +108 -0
  91. package/dist/cli/wirings/codegen.mjs.map +1 -0
  92. package/dist/cli/wirings/config-loader.mjs +12 -62
  93. package/dist/cli/wirings/config-loader.mjs.map +1 -1
  94. package/dist/cli/wirings/dump-ids.mjs +86 -0
  95. package/dist/cli/wirings/dump-ids.mjs.map +1 -0
  96. package/dist/cli/wirings/engine-command.mjs +1 -1
  97. package/dist/cli/wirings/engine-command.mjs.map +1 -1
  98. package/dist/cli/wirings/identity.mjs +2 -2
  99. package/dist/cli/wirings/identity.mjs.map +1 -1
  100. package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
  101. package/dist/cli/wirings/read-devstack-version.mjs +17 -0
  102. package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
  103. package/dist/cli/wirings/snapshot.mjs +27 -34
  104. package/dist/cli/wirings/snapshot.mjs.map +1 -1
  105. package/dist/cli/wirings/up-ipc.mjs +147 -0
  106. package/dist/cli/wirings/up-ipc.mjs.map +1 -0
  107. package/dist/cli/wirings/up.mjs +218 -198
  108. package/dist/cli/wirings/up.mjs.map +1 -1
  109. package/dist/cli/wirings/wipe.mjs +1 -1
  110. package/dist/cli/wirings/wipe.mjs.map +1 -1
  111. package/dist/contracts/chain-probe.d.mts +1 -1
  112. package/dist/contracts/chain-probe.mjs +1 -1
  113. package/dist/contracts/chain-probe.mjs.map +1 -1
  114. package/dist/contracts/codegenable.d.mts +60 -6
  115. package/dist/contracts/codegenable.mjs +28 -0
  116. package/dist/contracts/codegenable.mjs.map +1 -0
  117. package/dist/contracts/config-bindings.mjs +162 -0
  118. package/dist/contracts/config-bindings.mjs.map +1 -0
  119. package/dist/contracts/container-runtime.d.mts +23 -17
  120. package/dist/contracts/plugin-expander.mjs.map +1 -1
  121. package/dist/contracts/snapshotable.d.mts +5 -7
  122. package/dist/contracts/wallet-protocol.d.mts +2 -5
  123. package/dist/contracts/wallet-protocol.mjs +2 -5
  124. package/dist/contracts/wallet-protocol.mjs.map +1 -1
  125. package/dist/index.d.mts +21 -26
  126. package/dist/index.mjs +8 -9
  127. package/dist/orchestrators/boot.d.mts +28 -0
  128. package/dist/orchestrators/boot.mjs +440 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -31
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +286 -58
  151. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  152. package/dist/orchestrators/layers.mjs +31 -0
  153. package/dist/orchestrators/layers.mjs.map +1 -0
  154. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
  155. package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
  156. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
  157. package/dist/orchestrators/network-options.d.mts +52 -0
  158. package/dist/orchestrators/network-options.mjs +43 -0
  159. package/dist/orchestrators/network-options.mjs.map +1 -0
  160. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  161. package/dist/orchestrators/router/cors.mjs.map +1 -1
  162. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  163. package/dist/orchestrators/router/errors.mjs.map +1 -1
  164. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  165. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  166. package/dist/orchestrators/router/profile.mjs +1 -1
  167. package/dist/orchestrators/router/profile.mjs.map +1 -1
  168. package/dist/orchestrators/router/service.d.mts +2 -2
  169. package/dist/orchestrators/router/service.mjs +12 -27
  170. package/dist/orchestrators/router/service.mjs.map +1 -1
  171. package/dist/orchestrators/router/traefik-container.mjs +1 -1
  172. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  173. package/dist/orchestrators/snapshot/capture.mjs +171 -195
  174. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  175. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
  176. package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
  177. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  178. package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
  179. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
  180. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
  181. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
  182. package/dist/orchestrators/snapshot/index.mjs +1 -4
  183. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  184. package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
  185. package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
  186. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
  187. package/dist/orchestrators/snapshot/prune.mjs +40 -31
  188. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  189. package/dist/orchestrators/snapshot/restore.mjs +221 -196
  190. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  191. package/dist/orchestrators/snapshot/service.mjs +72 -62
  192. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  193. package/dist/orchestrators/snapshot/wipe.mjs +67 -56
  194. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  195. package/dist/plugins/account/codegen.mjs +3 -0
  196. package/dist/plugins/account/codegen.mjs.map +1 -1
  197. package/dist/plugins/account/errors.d.mts +2 -2
  198. package/dist/plugins/account/errors.mjs +1 -4
  199. package/dist/plugins/account/errors.mjs.map +1 -1
  200. package/dist/plugins/account/funding.mjs +3 -27
  201. package/dist/plugins/account/funding.mjs.map +1 -1
  202. package/dist/plugins/account/index.d.mts +3 -8
  203. package/dist/plugins/account/index.mjs +71 -35
  204. package/dist/plugins/account/index.mjs.map +1 -1
  205. package/dist/plugins/account/keypair.d.mts +8 -7
  206. package/dist/plugins/account/keypair.mjs +5 -18
  207. package/dist/plugins/account/keypair.mjs.map +1 -1
  208. package/dist/plugins/account/lease.mjs.map +1 -1
  209. package/dist/plugins/account/registry.d.mts +1 -46
  210. package/dist/plugins/account/registry.mjs.map +1 -1
  211. package/dist/plugins/account/service.d.mts +43 -34
  212. package/dist/plugins/account/service.mjs +9 -54
  213. package/dist/plugins/account/service.mjs.map +1 -1
  214. package/dist/plugins/account/snapshot.mjs.map +1 -1
  215. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
  216. package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
  217. package/dist/plugins/account/variants/signer.mjs.map +1 -1
  218. package/dist/plugins/action/discriminator.mjs.map +1 -1
  219. package/dist/plugins/action/errors.mjs +1 -4
  220. package/dist/plugins/action/errors.mjs.map +1 -1
  221. package/dist/plugins/action/execute.mjs +3 -4
  222. package/dist/plugins/action/execute.mjs.map +1 -1
  223. package/dist/plugins/action/index.d.mts +2 -2
  224. package/dist/plugins/action/index.mjs +7 -11
  225. package/dist/plugins/action/index.mjs.map +1 -1
  226. package/dist/plugins/action/service.d.mts +5 -7
  227. package/dist/plugins/action/service.mjs +2 -16
  228. package/dist/plugins/action/service.mjs.map +1 -1
  229. package/dist/plugins/coin/address-resolution.mjs.map +1 -1
  230. package/dist/plugins/coin/codegen.mjs +97 -16
  231. package/dist/plugins/coin/codegen.mjs.map +1 -1
  232. package/dist/plugins/coin/discovery.mjs.map +1 -1
  233. package/dist/plugins/coin/errors.mjs +1 -4
  234. package/dist/plugins/coin/errors.mjs.map +1 -1
  235. package/dist/plugins/coin/index.d.mts +4 -34
  236. package/dist/plugins/coin/index.mjs +47 -28
  237. package/dist/plugins/coin/index.mjs.map +1 -1
  238. package/dist/plugins/coin/metadata.d.mts +1 -0
  239. package/dist/plugins/coin/metadata.mjs +8 -9
  240. package/dist/plugins/coin/metadata.mjs.map +1 -1
  241. package/dist/plugins/coin/mint.mjs +7 -21
  242. package/dist/plugins/coin/mint.mjs.map +1 -1
  243. package/dist/plugins/coin/registry.mjs +33 -20
  244. package/dist/plugins/coin/registry.mjs.map +1 -1
  245. package/dist/plugins/coin/service.d.mts +1 -1
  246. package/dist/plugins/coin/service.mjs +1 -8
  247. package/dist/plugins/coin/service.mjs.map +1 -1
  248. package/dist/plugins/coin/snapshot.mjs.map +1 -1
  249. package/dist/plugins/coin/type-strings.mjs.map +1 -1
  250. package/dist/plugins/dashboard/domain.mjs +106 -167
  251. package/dist/plugins/dashboard/domain.mjs.map +1 -1
  252. package/dist/plugins/dashboard/index.mjs +13 -13
  253. package/dist/plugins/dashboard/index.mjs.map +1 -1
  254. package/dist/plugins/dashboard/origin-policy.mjs +3 -3
  255. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
  256. package/dist/plugins/dashboard/routable.mjs.map +1 -1
  257. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
  258. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
  259. package/dist/plugins/dashboard/schema/root.mjs +23 -44
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +37 -91
  262. package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
  263. package/dist/plugins/dashboard/schema.mjs.map +1 -1
  264. package/dist/plugins/dashboard/server.mjs.map +1 -1
  265. package/dist/plugins/deepbook/codegen.d.mts +12 -11
  266. package/dist/plugins/deepbook/codegen.mjs +108 -11
  267. package/dist/plugins/deepbook/codegen.mjs.map +1 -1
  268. package/dist/plugins/deepbook/deploy.mjs +7 -14
  269. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  270. package/dist/plugins/deepbook/errors.mjs +4 -2
  271. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  272. package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
  273. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  274. package/dist/plugins/deepbook/hash.mjs.map +1 -1
  275. package/dist/plugins/deepbook/index.d.mts +38 -34
  276. package/dist/plugins/deepbook/index.mjs +133 -64
  277. package/dist/plugins/deepbook/index.mjs.map +1 -1
  278. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
  279. package/dist/plugins/deepbook/pyth/index.mjs +4 -8
  280. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  281. package/dist/plugins/deepbook/snapshot.mjs +0 -1
  282. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  283. package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
  284. package/dist/plugins/deepbook/types.d.mts +2 -1
  285. package/dist/plugins/deepbook/types.mjs.map +1 -1
  286. package/dist/plugins/faucet/dispatcher.d.mts +3 -3
  287. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  288. package/dist/plugins/faucet/errors.mjs.map +1 -1
  289. package/dist/plugins/faucet/http.mjs +2 -10
  290. package/dist/plugins/faucet/http.mjs.map +1 -1
  291. package/dist/plugins/faucet/index.mjs +0 -1
  292. package/dist/plugins/faucet/index.mjs.map +1 -1
  293. package/dist/plugins/host-service/errors.d.mts +1 -3
  294. package/dist/plugins/host-service/errors.mjs +1 -2
  295. package/dist/plugins/host-service/errors.mjs.map +1 -1
  296. package/dist/plugins/host-service/index.d.mts +1 -2
  297. package/dist/plugins/host-service/index.mjs +11 -11
  298. package/dist/plugins/host-service/index.mjs.map +1 -1
  299. package/dist/plugins/host-service/routable.mjs.map +1 -1
  300. package/dist/plugins/host-service/service.mjs +13 -13
  301. package/dist/plugins/host-service/service.mjs.map +1 -1
  302. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
  303. package/dist/plugins/internal/codegen-helpers.mjs +2 -0
  304. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
  305. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
  306. package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
  307. package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
  308. package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
  309. package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
  310. package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
  311. package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
  312. package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
  313. package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
  314. package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
  315. package/dist/plugins/package/build.mjs +2 -2
  316. package/dist/plugins/package/build.mjs.map +1 -1
  317. package/dist/plugins/package/codegen.d.mts +7 -14
  318. package/dist/plugins/package/codegen.mjs +187 -59
  319. package/dist/plugins/package/codegen.mjs.map +1 -1
  320. package/dist/plugins/package/dep-resolution.mjs +51 -3
  321. package/dist/plugins/package/dep-resolution.mjs.map +1 -1
  322. package/dist/plugins/package/errors.mjs +1 -4
  323. package/dist/plugins/package/errors.mjs.map +1 -1
  324. package/dist/plugins/package/git-source.d.mts +18 -0
  325. package/dist/plugins/package/git-source.mjs +119 -0
  326. package/dist/plugins/package/git-source.mjs.map +1 -0
  327. package/dist/plugins/package/index.d.mts +28 -19
  328. package/dist/plugins/package/index.mjs +107 -32
  329. package/dist/plugins/package/index.mjs.map +1 -1
  330. package/dist/plugins/package/mode-known.mjs +2 -2
  331. package/dist/plugins/package/mode-known.mjs.map +1 -1
  332. package/dist/plugins/package/mode-local.mjs +18 -35
  333. package/dist/plugins/package/mode-local.mjs.map +1 -1
  334. package/dist/plugins/package/publish-executor.mjs +13 -8
  335. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  336. package/dist/plugins/package/publish-output.d.mts +1 -11
  337. package/dist/plugins/package/publish-output.mjs +1 -9
  338. package/dist/plugins/package/publish-output.mjs.map +1 -1
  339. package/dist/plugins/package/registry.d.mts +1 -1
  340. package/dist/plugins/package/registry.mjs +26 -14
  341. package/dist/plugins/package/registry.mjs.map +1 -1
  342. package/dist/plugins/package/service.mjs.map +1 -1
  343. package/dist/plugins/package/snapshot.mjs.map +1 -1
  344. package/dist/plugins/router-entrypoints.mjs +1 -3
  345. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  346. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
  347. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  348. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
  349. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  350. package/dist/plugins/seal/codegen.d.mts +1 -5
  351. package/dist/plugins/seal/codegen.mjs +83 -12
  352. package/dist/plugins/seal/codegen.mjs.map +1 -1
  353. package/dist/plugins/seal/config-render.mjs +2 -6
  354. package/dist/plugins/seal/config-render.mjs.map +1 -1
  355. package/dist/plugins/seal/deploy.mjs +18 -29
  356. package/dist/plugins/seal/deploy.mjs.map +1 -1
  357. package/dist/plugins/seal/errors.d.mts +4 -5
  358. package/dist/plugins/seal/errors.mjs +1 -8
  359. package/dist/plugins/seal/errors.mjs.map +1 -1
  360. package/dist/plugins/seal/index.d.mts +7 -28
  361. package/dist/plugins/seal/index.mjs +69 -47
  362. package/dist/plugins/seal/index.mjs.map +1 -1
  363. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  364. package/dist/plugins/seal/key-server.mjs +1 -6
  365. package/dist/plugins/seal/key-server.mjs.map +1 -1
  366. package/dist/plugins/seal/keygen.mjs +2 -3
  367. package/dist/plugins/seal/keygen.mjs.map +1 -1
  368. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  369. package/dist/plugins/seal/mode/live.mjs +1 -1
  370. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  371. package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
  372. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  373. package/dist/plugins/seal/plugin-key.mjs.map +1 -1
  374. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  375. package/dist/plugins/seal/routable.mjs.map +1 -1
  376. package/dist/plugins/seal/service.mjs.map +1 -1
  377. package/dist/plugins/seal/snapshot.mjs +1 -2
  378. package/dist/plugins/seal/snapshot.mjs.map +1 -1
  379. package/dist/plugins/sui/auto-tick.mjs +5 -5
  380. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  381. package/dist/plugins/sui/chain-build-container.mjs +2 -2
  382. package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
  383. package/dist/plugins/sui/chain-probe.mjs +4 -4
  384. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  385. package/dist/plugins/sui/codegen.d.mts +9 -7
  386. package/dist/plugins/sui/codegen.mjs +49 -46
  387. package/dist/plugins/sui/codegen.mjs.map +1 -1
  388. package/dist/plugins/sui/errors.d.mts +1 -1
  389. package/dist/plugins/sui/errors.mjs +1 -9
  390. package/dist/plugins/sui/errors.mjs.map +1 -1
  391. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
  392. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
  393. package/dist/plugins/sui/exec/index.mjs.map +1 -0
  394. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
  395. package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
  396. package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
  397. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
  398. package/dist/plugins/sui/fork-orchestration.mjs +13 -23
  399. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  400. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  401. package/dist/plugins/sui/index.d.mts +34 -83
  402. package/dist/plugins/sui/index.mjs +200 -68
  403. package/dist/plugins/sui/index.mjs.map +1 -1
  404. package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
  405. package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
  406. package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
  407. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
  408. package/dist/plugins/sui/log-attrs.mjs +11 -0
  409. package/dist/plugins/sui/log-attrs.mjs.map +1 -0
  410. package/dist/plugins/sui/mode/external.mjs +4 -12
  411. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  412. package/dist/plugins/sui/mode/fork.mjs +19 -16
  413. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  414. package/dist/plugins/sui/mode/live.mjs +4 -17
  415. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  416. package/dist/plugins/sui/mode/local.d.mts +1 -0
  417. package/dist/plugins/sui/mode/local.mjs +203 -61
  418. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  419. package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
  420. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  421. package/dist/plugins/sui/mode/shared.d.mts +6 -7
  422. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  423. package/dist/plugins/sui/mode/spec.d.mts +23 -6
  424. package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
  425. package/dist/plugins/sui/move/index.mjs.map +1 -0
  426. package/dist/plugins/sui/move-summary-runner.mjs +8 -4
  427. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
  428. package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
  429. package/dist/plugins/sui/network-resolver.d.mts +6 -6
  430. package/dist/plugins/sui/routable.mjs.map +1 -1
  431. package/dist/plugins/sui/service.mjs +10 -6
  432. package/dist/plugins/sui/service.mjs.map +1 -1
  433. package/dist/plugins/sui/snapshot.mjs +10 -5
  434. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  435. package/dist/plugins/wallet/codegen.d.mts +8 -6
  436. package/dist/plugins/wallet/codegen.mjs +4 -10
  437. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  438. package/dist/plugins/wallet/errors.mjs +1 -4
  439. package/dist/plugins/wallet/errors.mjs.map +1 -1
  440. package/dist/plugins/wallet/index.d.mts +3 -6
  441. package/dist/plugins/wallet/index.mjs +16 -21
  442. package/dist/plugins/wallet/index.mjs.map +1 -1
  443. package/dist/plugins/wallet/origin-policy.mjs +3 -3
  444. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  445. package/dist/plugins/wallet/pairing.mjs +6 -24
  446. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  447. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  448. package/dist/plugins/wallet/routable.mjs.map +1 -1
  449. package/dist/plugins/wallet/server.mjs +17 -24
  450. package/dist/plugins/wallet/server.mjs.map +1 -1
  451. package/dist/plugins/wallet/service.d.mts +2 -2
  452. package/dist/plugins/wallet/service.mjs +4 -15
  453. package/dist/plugins/wallet/service.mjs.map +1 -1
  454. package/dist/plugins/wallet/snapshot.mjs.map +1 -1
  455. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
  456. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  457. package/dist/plugins/walrus/codegen.d.mts +2 -13
  458. package/dist/plugins/walrus/codegen.mjs +93 -28
  459. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  460. package/dist/plugins/walrus/deploy-paths.mjs +2 -3
  461. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  462. package/dist/plugins/walrus/deploy.mjs +26 -19
  463. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  464. package/dist/plugins/walrus/errors.mjs +1 -8
  465. package/dist/plugins/walrus/errors.mjs.map +1 -1
  466. package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
  467. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  468. package/dist/plugins/walrus/index.d.mts +13 -44
  469. package/dist/plugins/walrus/index.mjs +119 -122
  470. package/dist/plugins/walrus/index.mjs.map +1 -1
  471. package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
  472. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  473. package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
  474. package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
  475. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  476. package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
  477. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  478. package/dist/plugins/walrus/routable.mjs.map +1 -1
  479. package/dist/plugins/walrus/service.mjs.map +1 -1
  480. package/dist/plugins/walrus/snapshot.mjs +3 -3
  481. package/dist/plugins/walrus/snapshot.mjs.map +1 -1
  482. package/dist/plugins/walrus/storage-nodes.mjs +53 -14
  483. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  484. package/dist/plugins/walrus/wal-swap.mjs +4 -8
  485. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  486. package/dist/primitives/artifact-publisher.mjs.map +1 -1
  487. package/dist/primitives/cache.d.mts +1 -1
  488. package/dist/runtime/docker/client.mjs +47 -3
  489. package/dist/runtime/docker/client.mjs.map +1 -1
  490. package/dist/runtime/docker/container.mjs +37 -57
  491. package/dist/runtime/docker/container.mjs.map +1 -1
  492. package/dist/runtime/docker/errors.mjs.map +1 -1
  493. package/dist/runtime/docker/exec.mjs +2 -2
  494. package/dist/runtime/docker/exec.mjs.map +1 -1
  495. package/dist/runtime/docker/image.mjs +10 -11
  496. package/dist/runtime/docker/image.mjs.map +1 -1
  497. package/dist/runtime/docker/index.mjs +0 -1
  498. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
  499. package/dist/runtime/docker/inventory.mjs +9 -9
  500. package/dist/runtime/docker/inventory.mjs.map +1 -1
  501. package/dist/runtime/docker/labels.mjs +12 -1
  502. package/dist/runtime/docker/labels.mjs.map +1 -1
  503. package/dist/runtime/docker/network.mjs +6 -6
  504. package/dist/runtime/docker/network.mjs.map +1 -1
  505. package/dist/runtime/docker/render-run-args.mjs.map +1 -1
  506. package/dist/runtime/docker/service.mjs +31 -45
  507. package/dist/runtime/docker/service.mjs.map +1 -1
  508. package/dist/runtime/docker/sweep.mjs +14 -64
  509. package/dist/runtime/docker/sweep.mjs.map +1 -1
  510. package/dist/runtime/docker/volume.mjs +1 -1
  511. package/dist/runtime/docker/volume.mjs.map +1 -1
  512. package/dist/runtime/docker/wrap.mjs +14 -2
  513. package/dist/runtime/docker/wrap.mjs.map +1 -1
  514. package/dist/substrate/brand.d.mts +2 -5
  515. package/dist/substrate/brand.mjs +3 -2
  516. package/dist/substrate/brand.mjs.map +1 -1
  517. package/dist/substrate/cross-process.mjs +2 -16
  518. package/dist/substrate/cross-process.mjs.map +1 -1
  519. package/dist/substrate/event-time.mjs +0 -2
  520. package/dist/substrate/event-time.mjs.map +1 -1
  521. package/dist/substrate/events.d.mts +46 -16
  522. package/dist/substrate/identity.d.mts +11 -5
  523. package/dist/substrate/manifest.d.mts +33 -26
  524. package/dist/substrate/manifest.mjs +8 -3
  525. package/dist/substrate/manifest.mjs.map +1 -1
  526. package/dist/substrate/options.d.mts +33 -4
  527. package/dist/substrate/plugin-ctx.d.mts +70 -0
  528. package/dist/substrate/plugin-ctx.mjs +66 -0
  529. package/dist/substrate/plugin-ctx.mjs.map +1 -0
  530. package/dist/substrate/plugin.d.mts +46 -38
  531. package/dist/substrate/plugin.mjs +13 -9
  532. package/dist/substrate/plugin.mjs.map +1 -1
  533. package/dist/substrate/projection.d.mts +1 -1
  534. package/dist/substrate/runtime/atomic-write.mjs +3 -4
  535. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  536. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  537. package/dist/substrate/runtime/cache/service.mjs +50 -20
  538. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  539. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  540. package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
  541. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
  542. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
  543. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
  544. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  545. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  546. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  547. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -1
  548. package/dist/substrate/runtime/cross-process/index.mjs +0 -2
  549. package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
  550. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
  551. package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
  552. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  553. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
  554. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
  555. package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
  556. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  557. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
  558. package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
  559. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  560. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  561. package/dist/substrate/runtime/errors.mjs +1 -13
  562. package/dist/substrate/runtime/errors.mjs.map +1 -1
  563. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
  564. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
  565. package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
  566. package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
  567. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  568. package/dist/substrate/runtime/http-probe.d.mts +1 -3
  569. package/dist/substrate/runtime/http-probe.mjs.map +1 -1
  570. package/dist/substrate/runtime/index.mjs +1 -6
  571. package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
  572. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  573. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
  574. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  575. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  576. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  578. package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
  579. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  580. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  582. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  583. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  585. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  587. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  589. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  590. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  592. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  593. package/dist/substrate/runtime/managed-container.mjs +8 -10
  594. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  595. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  596. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  597. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  598. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  599. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  600. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  602. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  603. package/dist/substrate/runtime/observability/index.mjs +4 -6
  604. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  605. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  606. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  607. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  608. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  610. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  614. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  615. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  616. package/dist/substrate/runtime/paths.mjs +27 -9
  617. package/dist/substrate/runtime/paths.mjs.map +1 -1
  618. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  619. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  620. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  621. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  622. package/dist/substrate/runtime/probes.d.mts +2 -3
  623. package/dist/substrate/runtime/probes.mjs.map +1 -1
  624. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  625. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  626. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/update.mjs +87 -11
  628. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  629. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  630. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  631. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  632. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  633. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  635. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  636. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  637. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  638. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  639. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  640. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  641. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  642. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  643. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  644. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  645. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  646. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  647. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  649. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  650. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  651. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  652. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  654. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  656. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  658. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  659. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  660. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  661. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  662. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  663. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
  665. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  666. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  667. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  668. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  670. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  671. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  672. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  673. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  674. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  675. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  676. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  677. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  678. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  679. package/dist/surfaces/cli/command-tree.mjs +49 -7
  680. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  681. package/dist/surfaces/cli/commands/config.mjs +1 -1
  682. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  683. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  685. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  686. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  689. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  690. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  692. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  693. package/dist/surfaces/cli/commands/status.mjs +1 -1
  694. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  695. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  697. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  698. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  699. package/dist/surfaces/cli/errors.mjs.map +1 -1
  700. package/dist/surfaces/cli/flags.mjs.map +1 -1
  701. package/dist/surfaces/cli/index.mjs +45 -14
  702. package/dist/surfaces/cli/index.mjs.map +1 -1
  703. package/dist/surfaces/cli/output.mjs.map +1 -1
  704. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  705. package/dist/surfaces/tui/app.mjs +0 -21
  706. package/dist/surfaces/tui/app.mjs.map +1 -1
  707. package/dist/surfaces/tui/dashboard.mjs +0 -48
  708. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  709. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  710. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  711. package/dist/surfaces/tui/errors.mjs.map +1 -1
  712. package/dist/surfaces/tui/event-log.mjs +0 -9
  713. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  714. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  715. package/dist/surfaces/tui/index.mjs +2 -2
  716. package/dist/surfaces/tui/index.mjs.map +1 -1
  717. package/dist/surfaces/tui/input.mjs.map +1 -1
  718. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  719. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  720. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  721. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  722. package/dist/surfaces/tui/resource-table.mjs +8 -10
  723. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  724. package/images/postgres/Dockerfile +0 -1
  725. package/images/sui/Dockerfile +27 -54
  726. package/images/sui/entrypoint.sh +17 -179
  727. package/package.json +23 -15
  728. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  729. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  730. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  731. package/dist/api/plugin-errors.d.mts +0 -7
  732. package/dist/api/plugin-errors.mjs +0 -10
  733. package/dist/api/plugin-errors.mjs.map +0 -1
  734. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  735. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  736. package/dist/contracts/capability-decl.d.mts +0 -40
  737. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  738. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  739. package/dist/orchestrators/run.mjs +0 -91
  740. package/dist/orchestrators/run.mjs.map +0 -1
  741. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  742. package/dist/orchestrators/runtime-composition.mjs +0 -252
  743. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  744. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  745. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  746. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  748. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  749. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  750. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  751. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  752. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  753. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  754. package/dist/plugins/account/spans.mjs +0 -16
  755. package/dist/plugins/account/spans.mjs.map +0 -1
  756. package/dist/plugins/account/variants/env.mjs +0 -24
  757. package/dist/plugins/account/variants/env.mjs.map +0 -1
  758. package/dist/plugins/account/variants/inline.mjs +0 -13
  759. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  760. package/dist/plugins/account/variants/keystore.mjs +0 -91
  761. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  762. package/dist/plugins/action/spans.mjs +0 -11
  763. package/dist/plugins/action/spans.mjs.map +0 -1
  764. package/dist/plugins/coin/spans.mjs +0 -20
  765. package/dist/plugins/coin/spans.mjs.map +0 -1
  766. package/dist/plugins/deepbook/spans.mjs +0 -18
  767. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  768. package/dist/plugins/faucet/spans.mjs +0 -12
  769. package/dist/plugins/faucet/spans.mjs.map +0 -1
  770. package/dist/plugins/package/spans.mjs +0 -14
  771. package/dist/plugins/package/spans.mjs.map +0 -1
  772. package/dist/plugins/postgres/codegen.mjs +0 -42
  773. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  774. package/dist/plugins/postgres/connection.d.mts +0 -33
  775. package/dist/plugins/postgres/connection.mjs.map +0 -1
  776. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  777. package/dist/plugins/postgres/errors.d.mts +0 -60
  778. package/dist/plugins/postgres/errors.mjs +0 -29
  779. package/dist/plugins/postgres/errors.mjs.map +0 -1
  780. package/dist/plugins/postgres/index.d.mts +0 -37
  781. package/dist/plugins/postgres/index.mjs +0 -68
  782. package/dist/plugins/postgres/index.mjs.map +0 -1
  783. package/dist/plugins/postgres/routable.mjs +0 -33
  784. package/dist/plugins/postgres/routable.mjs.map +0 -1
  785. package/dist/plugins/postgres/service.d.mts +0 -50
  786. package/dist/plugins/postgres/service.mjs +0 -179
  787. package/dist/plugins/postgres/service.mjs.map +0 -1
  788. package/dist/plugins/postgres/snapshot.mjs +0 -32
  789. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  790. package/dist/plugins/postgres/spans.mjs +0 -11
  791. package/dist/plugins/postgres/spans.mjs.map +0 -1
  792. package/dist/plugins/seal/spans.mjs +0 -18
  793. package/dist/plugins/seal/spans.mjs.map +0 -1
  794. package/dist/plugins/sui/spans.mjs +0 -17
  795. package/dist/plugins/sui/spans.mjs.map +0 -1
  796. package/dist/plugins/wallet/spans.mjs +0 -22
  797. package/dist/plugins/wallet/spans.mjs.map +0 -1
  798. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  799. package/dist/plugins/walrus/spans.mjs +0 -18
  800. package/dist/plugins/walrus/spans.mjs.map +0 -1
  801. package/dist/runtime/docker/logs.d.mts +0 -1
  802. package/dist/runtime/docker/logs.mjs +0 -34
  803. package/dist/runtime/docker/logs.mjs.map +0 -1
  804. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  805. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  806. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  807. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  808. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  809. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  810. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  811. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  812. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  813. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  814. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  815. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  816. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  818. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  819. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  820. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  821. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  822. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  823. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  826. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  829. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  830. package/dist/substrate/runtime/projection/index.mjs +0 -4
  831. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  832. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  833. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  834. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  835. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  836. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  837. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  839. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  840. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  841. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  842. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  844. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  845. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  846. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  847. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  850. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  851. package/dist/substrate/state-store.d.mts +0 -1
  852. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  853. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  854. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  855. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  856. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  857. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
  858. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"signer.mjs","names":[],"sources":["../../../../src/plugins/account/variants/signer.ts"],"sourcesContent":["// Account variant — signer (provided as a Signer object directly).\n//\n// Distilled-doc surface: the escape hatch for hardware wallets,\n// custom KMS adapters, and dApp-side signers. Devstack NEVER calls\n// `getSecretKey()` on this branch — the supplied signer's\n// `signTransaction` / `signPersonalMessage` / `signAndExecuteTransaction`\n// methods are called directly.\n//\n// Type-encoded contract: the `signer` field is the @mysten/sui\n// abstract `Signer` shape. We accept `unknown` here at the variant\n// boundary (the substrate's import surface stays SDK-free for tree-\n// shaking and version-pinning); the user-facing factory in `index.ts`\n// pins `Signer` from `@mysten/sui/cryptography`.\n\nimport { Effect } from 'effect';\n\nimport { accountAcquireError, type AccountAcquireError } from '../errors.ts';\nimport { normalizeScheme, type ResolvedKeypair } from '../keypair.ts';\n\nexport interface SignerVariantArgs {\n\treadonly name: string;\n\t/** A `@mysten/sui/cryptography` `Signer` instance. Typed loosely\n\t * here; the user-facing factory pins the SDK type. */\n\treadonly signer: {\n\t\treadonly toSuiAddress: () => string;\n\t\treadonly getKeyScheme: () => string;\n\t\treadonly getPublicKey: () => { readonly toRawBytes: () => Uint8Array };\n\t};\n\t/** Optional address override. When omitted, `signer.toSuiAddress()`\n\t * is called. Useful for signers whose address is more expensive\n\t * to derive than to memoize. */\n\treadonly addressOverride?: string;\n}\n\n/** Resolve the signer variant.\n *\n * The body reads the address + scheme via the SDK shim and hands\n * back the resolved-keypair view. The `bech32Secret` field is\n * `null` — we never fish the secret out of an external signer. */\nexport const resolveSignerVariant = (\n\targs: SignerVariantArgs,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.gen(function* () {\n\t\tconst address = args.addressOverride ?? args.signer.toSuiAddress();\n\t\tconst rawScheme = args.signer.getKeyScheme();\n\t\tconst scheme = yield* normalizeScheme(rawScheme, args.name, 'signer');\n\t\tconst publicKey = yield* Effect.try({\n\t\t\ttry: () => args.signer.getPublicKey().toRawBytes(),\n\t\t\tcatch: (cause) =>\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'bind-signer',\n\t\t\t\t\taccountName: args.name,\n\t\t\t\t\tvariant: 'signer',\n\t\t\t\t\tmessage: `Account '${args.name}': signer.getPublicKey().toRawBytes() threw.`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t});\n\t\treturn {\n\t\t\taddress,\n\t\t\tscheme,\n\t\t\tpublicKey,\n\t\t\tsigner: args.signer,\n\t\t\tbech32Secret: null,\n\t\t} satisfies ResolvedKeypair;\n\t});\n"],"mappings":";;;;;;;;;AAuCA,MAAa,wBACZ,SAEA,OAAO,IAAI,aAAa;AAevB,QAAO;EACN,SAfe,KAAK,mBAAmB,KAAK,OAAO,cAAc;EAgBjE,QAAA,OAdqB,gBADJ,KAAK,OAAO,cACiB,EAAE,KAAK,MAAM,SAAS;EAepE,WAAA,OAdwB,OAAO,IAAI;GACnC,WAAW,KAAK,OAAO,cAAc,CAAC,YAAY;GAClD,QAAQ,UACP,oBAAoB;IACnB,OAAO;IACP,aAAa,KAAK;IAClB,SAAS;IACT,SAAS,YAAY,KAAK,KAAK;IAC/B;IACA,CAAC;GACH,CAAC;EAKD,QAAQ,KAAK;EACb,cAAc;EACd;EACA"}
1
+ {"version":3,"file":"signer.mjs","names":[],"sources":["../../../../src/plugins/account/variants/signer.ts"],"sourcesContent":["// Account variant — signer (provided as a Signer object directly).\n//\n// Distilled-doc surface: the escape hatch for hardware wallets,\n// custom KMS adapters, and dApp-side signers. Devstack NEVER calls\n// `getSecretKey()` on this branch — the supplied signer's\n// `signTransaction` / `signPersonalMessage` / `signAndExecuteTransaction`\n// methods are called directly.\n//\n// Type-encoded contract: the `signer` field is the @mysten/sui\n// abstract `Signer` shape. We accept `unknown` here at the variant\n// boundary (the substrate's import surface stays SDK-free for tree-\n// shaking and version-pinning); the user-facing factory in `index.ts`\n// pins `Signer` from `@mysten/sui/cryptography`.\n\nimport { Effect } from 'effect';\n\nimport { accountAcquireError, type AccountAcquireError } from '../errors.ts';\nimport { normalizeScheme, type ResolvedKeypair } from '../keypair.ts';\n\nexport interface SignerVariantArgs {\n\treadonly name: string;\n\t/** A `@mysten/sui/cryptography` `Signer` instance. Typed loosely\n\t * here; the user-facing factory pins the SDK type. */\n\treadonly signer: {\n\t\treadonly toSuiAddress: () => string;\n\t\treadonly getKeyScheme: () => string;\n\t\treadonly getPublicKey: () => { readonly toRawBytes: () => Uint8Array };\n\t};\n\t/** Optional address override. When omitted, `signer.toSuiAddress()`\n\t * is called. Useful for signers whose address is more expensive\n\t * to derive than to memoize. */\n\treadonly addressOverride?: string;\n}\n\n/** Resolve the signer variant.\n *\n * The body reads the address + scheme via the SDK shim and hands\n * back the resolved-keypair view. The `bech32Secret` field is\n * `null` — we never fish the secret out of an external signer. */\nexport const resolveSignerVariant = (\n\targs: SignerVariantArgs,\n): Effect.Effect<ResolvedKeypair, AccountAcquireError> =>\n\tEffect.gen(function* () {\n\t\tconst address = args.addressOverride ?? args.signer.toSuiAddress();\n\t\tconst rawScheme = args.signer.getKeyScheme();\n\t\tconst scheme = yield* normalizeScheme(rawScheme, args.name, 'signer');\n\t\tconst publicKey = yield* Effect.try({\n\t\t\ttry: () => args.signer.getPublicKey().toRawBytes(),\n\t\t\tcatch: (cause) =>\n\t\t\t\taccountAcquireError({\n\t\t\t\t\tphase: 'bind-signer',\n\t\t\t\t\taccountName: args.name,\n\t\t\t\t\tvariant: 'signer',\n\t\t\t\t\tmessage: `Account '${args.name}': signer.getPublicKey().toRawBytes() threw.`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t});\n\t\treturn {\n\t\t\taddress,\n\t\t\tscheme,\n\t\t\tpublicKey,\n\t\t\tsigner: args.signer,\n\t\t\tbech32Secret: null,\n\t\t} satisfies ResolvedKeypair;\n\t});\n"],"mappings":";;;;;;;;;AAuCA,MAAa,wBACZ,SAEA,OAAO,IAAI,aAAa;CAevB,OAAO;EACN,SAfe,KAAK,mBAAmB,KAAK,OAAO,aAAa;EAgBhE,QAAA,OAdqB,gBADJ,KAAK,OAAO,aACgB,GAAG,KAAK,MAAM,QAAQ;EAenE,WAAA,OAdwB,OAAO,IAAI;GACnC,WAAW,KAAK,OAAO,aAAa,CAAC,CAAC,WAAW;GACjD,QAAQ,UACP,oBAAoB;IACnB,OAAO;IACP,aAAa,KAAK;IAClB,SAAS;IACT,SAAS,YAAY,KAAK,KAAK;IAC/B;GACD,CAAC;EACH,CAAC;EAKA,QAAQ,KAAK;EACb,cAAc;CACf;AACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"discriminator.mjs","names":[],"sources":["../../../src/plugins/action/discriminator.ts"],"sourcesContent":["// Action plugin — discriminator types.\n//\n// An action's cache key is `action/<chainId>/<contentHash>` where the\n// content hash folds in:\n//\n// - `actionName` — symbolic action name (drives namespace + TUI\n// attribution).\n// - `chainId` — substrate-folded automatically (substrate-side\n// of the artifact publisher cache key).\n// - `consumedKeys` — the literal resource ids of every entry in\n// `dependsOn`. Folded so reordering/changing\n// upstream deps invalidates the cache. Static —\n// resolved at factory construction time.\n// - `discriminator` — OPTIONAL caller-supplied extra material. Two\n// accepted shapes: a literal `string`, or a\n// callback `(ctx, deps) => Effect<string>`\n// receiving action helpers and resolved deps\n// shaped by `dependsOn`. The callback form re-runs\n// on EVERY acquire (hit OR miss) — mirrors v3's `cacheKey:\n// Effect<string>` semantics (16-action.md\n// invariant 5/6).\n//\n// The dynamic discriminator covers the common case where the action's\n// idempotency hinges on a value not known until upstream resolution\n// completes. The v3 example: `cacheKey: Effect.gen(function* () {\n// const pkg = yield* connectFour; return pkg.packageId; })`.\n\nimport type { Effect } from 'effect';\n\nimport type { ActionError } from './errors.ts';\nimport type { ActionBuildContext } from './build-context.ts';\n\n/** Static portion of the discriminator (known at factory construction\n * time). The substrate folds this into the content-hash so the\n * cache key changes when these fields do. */\nexport interface StaticDiscriminator {\n\t/** Symbolic action name. */\n\treadonly actionName: string;\n\t/** Resource-id literals of every entry in `dependsOn`, in declaration\n\t * order. Reordering MUST invalidate the cache (this is the v3\n\t * behavior — `needs.map(n => n.key)` was folded in order). */\n\treadonly dependencyResourceIds: ReadonlyArray<string>;\n}\n\n/** Dynamic portion (resolved at acquire time). Two accepted shapes:\n *\n * - `string` — literal cache-key fragment, used verbatim.\n * - `(ctx, deps) => Effect<string, ActionError>` — callback receiving\n * action helpers and resolved deps in the same shape\n * as the body callback. The Effect is yielded at\n * acquire time so the callback can derive the\n * discriminator from upstream resolved values (e.g.\n * fold in a freshly-published package id). Re-runs\n * on EVERY acquire (hit OR miss). User errors\n * propagate as `ActionError({phase: 'discriminator'})`. */\nexport type DynamicDiscriminator<Deps = unknown> =\n\t| string\n\t| ((ctx: ActionBuildContext, deps: Deps) => Effect.Effect<string, ActionError>);\n\n/** Build the content-hash input string from static + resolved-dynamic\n * pieces. Canonical shape: newline-delimited so two strings with\n * shared prefixes hash differently. */\nexport const composeDiscriminatorMaterial = (\n\tstaticParts: StaticDiscriminator,\n\tresolvedDynamic: string | undefined,\n): string => {\n\tconst lines: string[] = [\n\t\t`action=${staticParts.actionName}`,\n\t\t`dependencies=${JSON.stringify(staticParts.dependencyResourceIds)}`,\n\t];\n\tif (resolvedDynamic !== undefined) {\n\t\tlines.push(`discriminator=${resolvedDynamic}`);\n\t}\n\treturn lines.join('\\n');\n};\n"],"mappings":";;;;AA8DA,MAAa,gCACZ,aACA,oBACY;CACZ,MAAM,QAAkB,CACvB,UAAU,YAAY,cACtB,gBAAgB,KAAK,UAAU,YAAY,sBAAsB,GACjE;AACD,KAAI,oBAAoB,KAAA,EACvB,OAAM,KAAK,iBAAiB,kBAAkB;AAE/C,QAAO,MAAM,KAAK,KAAK"}
1
+ {"version":3,"file":"discriminator.mjs","names":[],"sources":["../../../src/plugins/action/discriminator.ts"],"sourcesContent":["// Action plugin — discriminator types.\n//\n// An action's cache key is `action/<chainId>/<contentHash>` where the\n// content hash folds in:\n//\n// - `actionName` — symbolic action name (drives namespace + TUI\n// attribution).\n// - `chainId` — substrate-folded automatically (substrate-side\n// of the artifact publisher cache key).\n// - `consumedKeys` — the literal resource ids of every entry in\n// `dependsOn`. Folded so reordering/changing\n// upstream deps invalidates the cache. Static —\n// resolved at factory construction time.\n// - `discriminator` — OPTIONAL caller-supplied extra material. Two\n// accepted shapes: a literal `string`, or a\n// callback `(ctx, deps) => Effect<string>`\n// receiving action helpers and resolved deps\n// shaped by `dependsOn`. The callback form re-runs\n// on EVERY acquire (hit OR miss) — a\n// `cacheKey: Effect<string>` (16-action.md\n// invariant 5/6).\n//\n// The dynamic discriminator covers the common case where the action's\n// idempotency hinges on a value not known until upstream resolution\n// completes, e.g. `cacheKey: Effect.gen(function* () {\n// const pkg = yield* connectFour; return pkg.packageId; })`.\n\nimport type { Effect } from 'effect';\n\nimport type { ActionError } from './errors.ts';\nimport type { ActionBuildContext } from './build-context.ts';\n\n/** Static portion of the discriminator (known at factory construction\n * time). The substrate folds this into the content-hash so the\n * cache key changes when these fields do. */\nexport interface StaticDiscriminator {\n\t/** Symbolic action name. */\n\treadonly actionName: string;\n\t/** Resource-id literals of every entry in `dependsOn`, in declaration\n\t * order. Reordering MUST invalidate the cache (`needs.map(n => n.key)`\n\t * is folded in order). */\n\treadonly dependencyResourceIds: ReadonlyArray<string>;\n}\n\n/** Dynamic portion (resolved at acquire time). Two accepted shapes:\n *\n * - `string` — literal cache-key fragment, used verbatim.\n * - `(ctx, deps) => Effect<string, ActionError>` — callback receiving\n * action helpers and resolved deps in the same shape\n * as the body callback. The Effect is yielded at\n * acquire time so the callback can derive the\n * discriminator from upstream resolved values (e.g.\n * fold in a freshly-published package id). Re-runs\n * on EVERY acquire (hit OR miss). User errors\n * propagate as `ActionError({phase: 'discriminator'})`. */\nexport type DynamicDiscriminator<Deps = unknown> =\n\t| string\n\t| ((ctx: ActionBuildContext, deps: Deps) => Effect.Effect<string, ActionError>);\n\n/** Build the content-hash input string from static + resolved-dynamic\n * pieces. Canonical shape: newline-delimited so two strings with\n * shared prefixes hash differently. */\nexport const composeDiscriminatorMaterial = (\n\tstaticParts: StaticDiscriminator,\n\tresolvedDynamic: string | undefined,\n): string => {\n\tconst lines: string[] = [\n\t\t`action=${staticParts.actionName}`,\n\t\t`dependencies=${JSON.stringify(staticParts.dependencyResourceIds)}`,\n\t];\n\tif (resolvedDynamic !== undefined) {\n\t\tlines.push(`discriminator=${resolvedDynamic}`);\n\t}\n\treturn lines.join('\\n');\n};\n"],"mappings":";;;;AA8DA,MAAa,gCACZ,aACA,oBACY;CACZ,MAAM,QAAkB,CACvB,UAAU,YAAY,cACtB,gBAAgB,KAAK,UAAU,YAAY,qBAAqB,GACjE;CACA,IAAI,oBAAoB,KAAA,GACvB,MAAM,KAAK,iBAAiB,iBAAiB;CAE9C,OAAO,MAAM,KAAK,IAAI;AACvB"}
@@ -4,10 +4,7 @@ const actionError = (phase, parts) => ({
4
4
  phase,
5
5
  ...parts
6
6
  });
7
- /** Error tags this plugin contributes — surfaced to the cause walker
8
- * via `PluginErrorContribution`. */
9
- const ACTION_ERROR_TAGS = ["ActionError"];
10
7
  //#endregion
11
- export { ACTION_ERROR_TAGS, actionError };
8
+ export { actionError };
12
9
 
13
10
  //# sourceMappingURL=errors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/action/errors.ts"],"sourcesContent":["// Action plugin — typed errors.\n//\n// Distilled doc 16-action.md \"Failure modes\": signing failure routes\n// through `PublishError({ phase: 'publish-tx' })`. The rewrite splits\n// the user-facing action error from `package`'s `PublishError` because\n// action-specific phases carry different semantics — `build` here is the\n// user-supplied transaction-builder Effect, `sign` is the build/sign/\n// submit transport (the `signAndExecute` invocation, including the\n// Account plugin's `no-digest` envelope violation surfaced via `cause`),\n// and `execute-failed` is the on-chain `FailedTransaction` outcome.\n//\n// Per architecture §Effect, errors are plain interfaces with a `_tag`\n// discriminator; `Effect.catchTag` / `catchTags` match on the literal.\n\n/** Phases for `ActionError`. Closed sum — adding a phase requires\n * editing this file (and the plugin doc's catalog).\n *\n * Phase semantics:\n * - `discriminator` — `opts.discriminator` Effect evaluation failed.\n * User-code defect or yielded upstream raised.\n * - `build` — `opts.body`'s build phase (the user-supplied\n * Effect) failed before producing a transaction.\n * - `sign` — signing / submit transport failed (signer\n * refused, RPC unreachable, finality timeout).\n * This is `account.signAndExecute`'s error\n * channel; it does NOT cover on-chain failures.\n * - `execute-failed` — transaction was delivered + executed by the\n * validator but the on-chain execution failed\n * (the `$kind: 'FailedTransaction'` variant of\n * `account.signAndExecute`'s return value).\n * - `verify` — verify probe authoritatively raised (transient\n * is masked by the lenient probe — does NOT raise\n * this).\n */\nexport type ActionPhase = 'discriminator' | 'build' | 'sign' | 'execute-failed' | 'verify';\n\n/** Single tagged action error. */\nexport interface ActionError {\n\treadonly _tag: 'ActionError';\n\treadonly phase: ActionPhase;\n\t/** Symbolic action name (the user-declared `action.name`). Flows\n\t * into the cache key namespace and the TUI row title. */\n\treadonly actionName: string;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const actionError = (\n\tphase: ActionPhase,\n\tparts: Omit<ActionError, '_tag' | 'phase'>,\n): ActionError => ({ _tag: 'ActionError', phase, ...parts });\n\n/** Error tags this plugin contributes surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const ACTION_ERROR_TAGS = ['ActionError'] as const;\n"],"mappings":";AA+CA,MAAa,eACZ,OACA,WACkB;CAAE,MAAM;CAAe;CAAO,GAAG;CAAO;;;AAI3D,MAAa,oBAAoB,CAAC,cAAc"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/action/errors.ts"],"sourcesContent":["// Action plugin — typed errors.\n//\n// Distilled doc 16-action.md \"Failure modes\": signing failure routes\n// through `PublishError({ phase: 'publish-tx' })`. The rewrite splits\n// the user-facing action error from `package`'s `PublishError` because\n// action-specific phases carry different semantics — `build` here is the\n// user-supplied transaction-builder Effect, `sign` is the build/sign/\n// submit transport (the `signAndExecute` invocation, including the\n// Account plugin's `no-digest` envelope violation surfaced via `cause`),\n// and `execute-failed` is the on-chain `FailedTransaction` outcome.\n//\n// Per architecture §Effect, errors are plain interfaces with a `_tag`\n// discriminator; `Effect.catchTag` / `catchTags` match on the literal.\n\n/** Phases for `ActionError`. Closed sum — adding a phase requires\n * editing this file (and the plugin doc's catalog).\n *\n * Phase semantics:\n * - `discriminator` — `opts.discriminator` Effect evaluation failed.\n * User-code defect or yielded upstream raised.\n * - `build` — `opts.body`'s build phase (the user-supplied\n * Effect) failed before producing a transaction.\n * - `sign` — signing / submit transport failed (signer\n * refused, RPC unreachable, finality timeout).\n * This is `account.signAndExecute`'s error\n * channel; it does NOT cover on-chain failures.\n * - `execute-failed` — transaction was delivered + executed by the\n * validator but the on-chain execution failed\n * (the `$kind: 'FailedTransaction'` variant of\n * `account.signAndExecute`'s return value).\n * - `verify` — verify probe authoritatively raised (transient\n * is masked by the lenient probe — does NOT raise\n * this).\n */\nexport type ActionPhase = 'discriminator' | 'build' | 'sign' | 'execute-failed' | 'verify';\n\n/** Single tagged action error. */\nexport interface ActionError {\n\treadonly _tag: 'ActionError';\n\treadonly phase: ActionPhase;\n\t/** Symbolic action name (the user-declared `action.name`). Flows\n\t * into the cache key namespace and the TUI row title. */\n\treadonly actionName: string;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const actionError = (\n\tphase: ActionPhase,\n\tparts: Omit<ActionError, '_tag' | 'phase'>,\n): ActionError => ({ _tag: 'ActionError', phase, ...parts });\n\n/** The catchable error tags this plugin exposes. Pinned against the\n * user-facing error catalog by the error-catalog-parity test. */\nexport const ACTION_ERROR_TAGS = ['ActionError'] as const;\n"],"mappings":";AA+CA,MAAa,eACZ,OACA,WACkB;CAAE,MAAM;CAAe;CAAO,GAAG;AAAM"}
@@ -1,10 +1,9 @@
1
1
  import { formatUnknownError } from "../../substrate/runtime/format-unknown-error.mjs";
2
- import { signAndDispatch } from "../../substrate/runtime/sui-execute/sign-and-dispatch.mjs";
3
- import { formatExecutedFailure } from "../../substrate/runtime/sui-execute/index.mjs";
2
+ import { formatExecutedFailure } from "../sui/exec/index.mjs";
4
3
  import { buildForkImpersonationTransactionBytes } from "../sui/fork-transaction.mjs";
4
+ import { signAndDispatch } from "../sui/exec/sign-and-dispatch.mjs";
5
5
  import "../sui/index.mjs";
6
6
  import { actionError } from "./errors.mjs";
7
- import { ActionSpans } from "./spans.mjs";
8
7
  import { Effect } from "effect";
9
8
  import { Transaction } from "@mysten/sui/transactions";
10
9
  //#region src/plugins/action/execute.ts
@@ -99,7 +98,7 @@ const signAndExecute = (params) => {
99
98
  message: `Action '${actionName}': transaction execution failed on-chain for account '${account.name}' (address=${account.address}) ` + formatExecutedFailure(failure)
100
99
  })),
101
100
  onSuccess: (txResult) => Effect.succeed(receiptFromTxResult(txResult))
102
- }).pipe(Effect.withSpan("devstack.plugin.action.signAndExecute", { attributes: { [ActionSpans.name]: actionName } }));
101
+ });
103
102
  };
104
103
  //#endregion
105
104
  export { signAndExecute };
@@ -1 +1 @@
1
- {"version":3,"file":"execute.mjs","names":[],"sources":["../../../src/plugins/action/execute.ts"],"sourcesContent":["// Action plugin — `signAndExecute` helper.\n//\n// Delegates the full build → sign → execute → wait → project pipeline\n// to the Account plugin's `withTransactionSigner` scope. The action\n// body never sees the SDK envelope; instead it receives the Account's\n// already-projected `TxResult`, which this module re-projects into the\n// action's `ActionReceipt` shape (bucketed `created`/`mutated` instead\n// of the account-flat `objectChanges`).\n//\n// Before the dedup, this module reimplemented the entire SDK roundtrip\n// (`executeTransaction`, `$kind`/`FailedTransaction`/no-digest envelope\n// projection, `waitForTransaction` finality wait). The same logic lived\n// in `account/service.ts:666-704` and `package/publish-executor.ts`, with\n// three near-identical SDK envelope projectors. Backlog item #29 lifts\n// the action path; the remaining package projector is tracked there too.\n//\n// Boundary discipline: this module imports the Account plugin's\n// `AccountValue` + `TxResult` (peer L4 contract) and a `SuiClient`\n// shim (peer L4 contract). It does not import `@mysten/sui/client` or\n// reach into the SDK envelope — those concerns live in\n// `account/service.ts`'s `projectTxResult`.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { AccountSignError, AccountValue, TxResult } from '../account/index.ts';\nimport { buildForkImpersonationTransactionBytes, type SuiClient } from '../sui/index.ts';\nimport { formatUnknownError } from '../../substrate/runtime/format-unknown-error.ts';\nimport { formatExecutedFailure } from '../../substrate/runtime/sui-execute/index.ts';\nimport { signAndDispatch } from '../../substrate/runtime/sui-execute/sign-and-dispatch.ts';\n\nimport { actionError, type ActionError } from './errors.ts';\nimport type { ActionReceipt } from './service.ts';\nimport { ActionSpans } from './spans.ts';\n\n// ---------------------------------------------------------------------------\n// Receipt object-change projection\n// ---------------------------------------------------------------------------\n\n/** Flat object-change record surfaced on an `ActionReceipt`. Mirrors\n * the package plugin's `PublishObjectChange` shape so consumers can\n * reuse `findCreatedByType`-style helpers across the two surfaces.\n *\n * - `kind`: 'created' when `idOperation === 'Created'`, else 'mutated'\n * (we expose the same two buckets the package plugin uses; finer\n * distinctions are recoverable from the raw `idOperation` /\n * `outputState` fields preserved alongside).\n * - `objectType`: optional fully-qualified type string\n * (`<packageId>::<module>::<Name>`) — present when the SDK's\n * `objectTypes` map carries the id. */\nexport interface ActionObjectChange {\n\treadonly kind: 'created' | 'mutated';\n\treadonly objectId: string;\n\treadonly objectType?: string;\n\treadonly outputState?: string;\n\treadonly idOperation?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Account TxResult → ActionReceipt projection\n// ---------------------------------------------------------------------------\n\n/**\n * Re-bucket the account's flat `objectChanges` into action-flavored\n * `created` / `mutated` rows. The account plugin's projection emits\n * `{type, objectId, objectType?, outputState?, idOperation?}`; we\n * carry through the optional fields and discriminate on `type` /\n * `kind` so a downstream `findCreatedByType` consumer keeps working.\n */\nconst projectAccountObjectChanges = (\n\tchanges: ReadonlyArray<unknown>,\n): ReadonlyArray<ActionObjectChange> =>\n\tchanges\n\t\t.filter(\n\t\t\t(\n\t\t\t\tchange,\n\t\t\t): change is {\n\t\t\t\treadonly type?: string;\n\t\t\t\treadonly kind?: string;\n\t\t\t\treadonly objectId: string;\n\t\t\t\treadonly objectType?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t} =>\n\t\t\t\ttypeof change === 'object' &&\n\t\t\t\tchange !== null &&\n\t\t\t\ttypeof (change as { readonly objectId?: unknown }).objectId === 'string',\n\t\t)\n\t\t.map((change) => {\n\t\t\tconst entry: {\n\t\t\t\t-readonly [K in keyof ActionObjectChange]: ActionObjectChange[K];\n\t\t\t} = {\n\t\t\t\tkind: change.type === 'created' || change.kind === 'created' ? 'created' : 'mutated',\n\t\t\t\tobjectId: change.objectId,\n\t\t\t};\n\t\t\tif (typeof change.objectType === 'string') entry.objectType = change.objectType;\n\t\t\tif (typeof change.outputState === 'string') entry.outputState = change.outputState;\n\t\t\tif (typeof change.idOperation === 'string') entry.idOperation = change.idOperation;\n\t\t\treturn entry;\n\t\t});\n\nconst receiptFromTxResult = (tx: TxResult): ActionReceipt => ({\n\tdigest: tx.digest,\n\tobjectChanges: projectAccountObjectChanges(tx.objectChanges),\n\tbalanceChanges: tx.balanceChanges,\n});\n\n// ---------------------------------------------------------------------------\n// AccountSignError → ActionError mapping\n// ---------------------------------------------------------------------------\n\n/**\n * Map an `AccountSignError` onto the action's `'sign'` phase. The\n * account's `signAndExecute` returns a discriminated `SignAndExecuteResult`\n * for the on-chain outcome (success vs FailedTransaction); only\n * transport / lifecycle failures surface here.\n */\nconst accountSignErrorToActionError =\n\t(actionName: string) =>\n\t(cause: AccountSignError): ActionError =>\n\t\tactionError('sign', {\n\t\t\tactionName,\n\t\t\tmessage:\n\t\t\t\t`Action '${actionName}': account sign/execute failed for ` +\n\t\t\t\t`'${cause.accountName}' (address=${cause.address}): ${cause.message}`,\n\t\t\tcause,\n\t\t});\n\n// ---------------------------------------------------------------------------\n// `signAndExecute` helper\n// ---------------------------------------------------------------------------\n\n/** Drive the full build → sign → execute → wait → project pipeline by\n * delegating to the account's `withTransactionSigner` /\n * `signAndExecute` surface, then re-projecting the returned\n * `TxResult` into the action's `ActionReceipt` shape.\n *\n * Allocates a fresh `Transaction`, sets the sender to the account's\n * address, lets the caller populate it via the `build` callback,\n * serialises via `Transaction.build({ client })` (or the fork-mode\n * builder for impersonation accounts), then hands the bytes to the\n * account's locked-signer scope. The account plugin owns sign,\n * execute, finality wait, and envelope projection.\n *\n * All failures surface as `ActionError`:\n * - `build` callback throws → `phase: 'sign'`.\n * - `Transaction.build` rejects → `phase: 'sign'`.\n * - `account.signAndExecute` rejects with `AccountSignError` → mapped\n * to `phase: 'sign'`. The Account plugin's `'no-digest'` phase\n * (SDK envelope protocol violation) flows through here as well —\n * the originating `AccountSignError` is preserved via `cause` so\n * the cause walker renders the underlying `phase: 'no-digest'`.\n *\n * The `actionName` parameter threads into every error's `actionName`\n * field so cause-walker output stays attributable.\n */\nexport const signAndExecute = (params: {\n\treadonly actionName: string;\n\treadonly sui: SuiClient;\n\treadonly account: AccountValue;\n\treadonly build: (tx: Transaction) => void;\n}): Effect.Effect<ActionReceipt, ActionError, Scope.Scope> => {\n\tconst { actionName, sui, account, build } = params;\n\tconst mapAccountErr = accountSignErrorToActionError(actionName);\n\t// Delegate the build → sign → execute → dispatch pipeline to the\n\t// shared `signAndDispatch` helper. The build closure handles both\n\t// the user callback (`build(tx)`) and mode-appropriate serialization\n\t// (fork impersonation vs SDK-resolver). On-chain failures surface\n\t// as `phase: 'execute-failed'` so cause-walker renders them distinctly\n\t// from transport-level signing failures (`phase: 'sign'`).\n\treturn signAndDispatch({\n\t\tsignerSource: account,\n\t\tbuildTxBytes: () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// --- 1. Allocate + populate the Transaction ------------------\n\t\t\t\tconst tx = new Transaction();\n\t\t\t\ttx.setSender(account.address);\n\t\t\t\tyield* Effect.try({\n\t\t\t\t\ttry: () => build(tx),\n\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage: `Action '${actionName}': build callback threw before serialisation.`,\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. Serialise via the mode-appropriate path --------------\n\t\t\t\t// Fork mode (impersonate OR real signer) must build offline with\n\t\t\t\t// explicit gas: the sui-fork binary has no simulate_transaction,\n\t\t\t\t// so the SDK's gas-estimating `tx.build({ client })` fails. The\n\t\t\t\t// real-vs-empty-signature split happens later in signAndExecute.\n\t\t\t\treturn account.source === 'impersonate' || sui.fork !== null\n\t\t\t\t\t? yield* buildForkImpersonationTransactionBytes(tx, account.address, sui.sdk.core).pipe(\n\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t(cause): ActionError =>\n\t\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': fork Transaction.build failed — ${cause.message}.`,\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t: yield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () => tx.build({ client: sui.sdk.client }),\n\t\t\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': Transaction.build failed — ${\n\t\t\t\t\t\t\t\t\t\tformatUnknownError(cause)\n\t\t\t\t\t\t\t\t\t}.`,\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}),\n\t\tmapSignError: mapAccountErr,\n\t\tonFailed: (failure) =>\n\t\t\tEffect.fail(\n\t\t\t\tactionError('execute-failed', {\n\t\t\t\t\tactionName,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Action '${actionName}': transaction execution failed on-chain ` +\n\t\t\t\t\t\t`for account '${account.name}' (address=${account.address}) ` +\n\t\t\t\t\t\tformatExecutedFailure(failure),\n\t\t\t\t}),\n\t\t\t),\n\t\tonSuccess: (txResult) => Effect.succeed(receiptFromTxResult(txResult)),\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.action.signAndExecute', {\n\t\t\tattributes: { [ActionSpans.name]: actionName },\n\t\t}),\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAsEA,MAAM,+BACL,YAEA,QACE,QAEC,WASA,OAAO,WAAW,YAClB,WAAW,QACX,OAAQ,OAA2C,aAAa,SACjE,CACA,KAAK,WAAW;CAChB,MAAM,QAEF;EACH,MAAM,OAAO,SAAS,aAAa,OAAO,SAAS,YAAY,YAAY;EAC3E,UAAU,OAAO;EACjB;AACD,KAAI,OAAO,OAAO,eAAe,SAAU,OAAM,aAAa,OAAO;AACrE,KAAI,OAAO,OAAO,gBAAgB,SAAU,OAAM,cAAc,OAAO;AACvE,KAAI,OAAO,OAAO,gBAAgB,SAAU,OAAM,cAAc,OAAO;AACvE,QAAO;EACN;AAEJ,MAAM,uBAAuB,QAAiC;CAC7D,QAAQ,GAAG;CACX,eAAe,4BAA4B,GAAG,cAAc;CAC5D,gBAAgB,GAAG;CACnB;;;;;;;AAYD,MAAM,iCACJ,gBACA,UACA,YAAY,QAAQ;CACnB;CACA,SACC,WAAW,WAAW,sCAClB,MAAM,YAAY,aAAa,MAAM,QAAQ,KAAK,MAAM;CAC7D;CACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AA8BJ,MAAa,kBAAkB,WAK+B;CAC7D,MAAM,EAAE,YAAY,KAAK,SAAS,UAAU;AAQ5C,QAAO,gBAAgB;EACtB,cAAc;EACd,oBACC,OAAO,IAAI,aAAa;GAEvB,MAAM,KAAK,IAAI,aAAa;AAC5B,MAAG,UAAU,QAAQ,QAAQ;AAC7B,UAAO,OAAO,IAAI;IACjB,WAAW,MAAM,GAAG;IACpB,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW;KAC/B;KACA,CAAC;IACH,CAAC;AAOF,UAAO,QAAQ,WAAW,iBAAiB,IAAI,SAAS,OACrD,OAAO,uCAAuC,IAAI,QAAQ,SAAS,IAAI,IAAI,KAAK,CAAC,KACjF,OAAO,UACL,UACA,YAAY,QAAQ;IACnB;IACA,SAAS,WAAW,WAAW,qCAAqC,MAAM,QAAQ;IAClF;IACA,CAAC,CACH,CACD,GACA,OAAO,OAAO,WAAW;IACzB,WAAW,GAAG,MAAM,EAAE,QAAQ,IAAI,IAAI,QAAQ,CAAC;IAC/C,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW,gCAC9B,mBAAmB,MAAM,CACzB;KACD;KACA,CAAC;IACH,CAAC;IACH;EACH,cApDqB,8BAA8B,WAoDxB;EAC3B,WAAW,YACV,OAAO,KACN,YAAY,kBAAkB;GAC7B;GACA,SACC,WAAW,WAAW,wDACN,QAAQ,KAAK,aAAa,QAAQ,QAAQ,MAC1D,sBAAsB,QAAQ;GAC/B,CAAC,CACF;EACF,YAAY,aAAa,OAAO,QAAQ,oBAAoB,SAAS,CAAC;EACtE,CAAC,CAAC,KACF,OAAO,SAAS,yCAAyC,EACxD,YAAY,GAAG,YAAY,OAAO,YAAY,EAC9C,CAAC,CACF"}
1
+ {"version":3,"file":"execute.mjs","names":[],"sources":["../../../src/plugins/action/execute.ts"],"sourcesContent":["// Action plugin — `signAndExecute` helper.\n//\n// Delegates the full build → sign → execute → wait → project pipeline\n// to the Account plugin's `withTransactionSigner` scope. The action\n// body never sees the SDK envelope; instead it receives the Account's\n// already-projected `TxResult`, which this module re-projects into the\n// action's `ActionReceipt` shape (bucketed `created`/`mutated` instead\n// of the account-flat `objectChanges`).\n//\n// Before the dedup, this module reimplemented the entire SDK roundtrip\n// (`executeTransaction`, `$kind`/`FailedTransaction`/no-digest envelope\n// projection, `waitForTransaction` finality wait). The same logic lived\n// in `account/service.ts:666-704` and `package/publish-executor.ts`, with\n// three near-identical SDK envelope projectors. Backlog item #29 lifts\n// the action path; the remaining package projector is tracked there too.\n//\n// Boundary discipline: this module imports the Account plugin's\n// `AccountValue` + `TxResult` (peer L4 contract) and a `SuiClient`\n// shim (peer L4 contract). It does not import `@mysten/sui/client` or\n// reach into the SDK envelope — those concerns live in\n// `account/service.ts`'s `projectTxResult`.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { AccountSignError, AccountValue, TxResult } from '../account/index.ts';\nimport {\n\tbuildForkImpersonationTransactionBytes,\n\tformatExecutedFailure,\n\tsignAndDispatch,\n\ttype SuiClient,\n} from '../sui/index.ts';\nimport { formatUnknownError } from '../../substrate/runtime/format-unknown-error.ts';\n\nimport { actionError, type ActionError } from './errors.ts';\nimport type { ActionReceipt } from './service.ts';\n\n// ---------------------------------------------------------------------------\n// Receipt object-change projection\n// ---------------------------------------------------------------------------\n\n/** Flat object-change record surfaced on an `ActionReceipt`. Mirrors\n * the package plugin's `PublishObjectChange` shape so consumers can\n * reuse `findCreatedByType`-style helpers across the two surfaces.\n *\n * - `kind`: 'created' when `idOperation === 'Created'`, else 'mutated'\n * (we expose the same two buckets the package plugin uses; finer\n * distinctions are recoverable from the raw `idOperation` /\n * `outputState` fields preserved alongside).\n * - `objectType`: optional fully-qualified type string\n * (`<packageId>::<module>::<Name>`) — present when the SDK's\n * `objectTypes` map carries the id. */\nexport interface ActionObjectChange {\n\treadonly kind: 'created' | 'mutated';\n\treadonly objectId: string;\n\treadonly objectType?: string;\n\treadonly outputState?: string;\n\treadonly idOperation?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Account TxResult → ActionReceipt projection\n// ---------------------------------------------------------------------------\n\n/**\n * Re-bucket the account's flat `objectChanges` into action-flavored\n * `created` / `mutated` rows. The account plugin's projection emits\n * `{type, objectId, objectType?, outputState?, idOperation?}`; we\n * carry through the optional fields and discriminate on `type` /\n * `kind` so a downstream `findCreatedByType` consumer keeps working.\n */\nconst projectAccountObjectChanges = (\n\tchanges: ReadonlyArray<unknown>,\n): ReadonlyArray<ActionObjectChange> =>\n\tchanges\n\t\t.filter(\n\t\t\t(\n\t\t\t\tchange,\n\t\t\t): change is {\n\t\t\t\treadonly type?: string;\n\t\t\t\treadonly kind?: string;\n\t\t\t\treadonly objectId: string;\n\t\t\t\treadonly objectType?: string;\n\t\t\t\treadonly outputState?: string;\n\t\t\t\treadonly idOperation?: string;\n\t\t\t} =>\n\t\t\t\ttypeof change === 'object' &&\n\t\t\t\tchange !== null &&\n\t\t\t\ttypeof (change as { readonly objectId?: unknown }).objectId === 'string',\n\t\t)\n\t\t.map((change) => {\n\t\t\tconst entry: {\n\t\t\t\t-readonly [K in keyof ActionObjectChange]: ActionObjectChange[K];\n\t\t\t} = {\n\t\t\t\tkind: change.type === 'created' || change.kind === 'created' ? 'created' : 'mutated',\n\t\t\t\tobjectId: change.objectId,\n\t\t\t};\n\t\t\tif (typeof change.objectType === 'string') entry.objectType = change.objectType;\n\t\t\tif (typeof change.outputState === 'string') entry.outputState = change.outputState;\n\t\t\tif (typeof change.idOperation === 'string') entry.idOperation = change.idOperation;\n\t\t\treturn entry;\n\t\t});\n\nconst receiptFromTxResult = (tx: TxResult): ActionReceipt => ({\n\tdigest: tx.digest,\n\tobjectChanges: projectAccountObjectChanges(tx.objectChanges),\n\tbalanceChanges: tx.balanceChanges,\n});\n\n// ---------------------------------------------------------------------------\n// AccountSignError → ActionError mapping\n// ---------------------------------------------------------------------------\n\n/**\n * Map an `AccountSignError` onto the action's `'sign'` phase. The\n * account's `signAndExecute` returns a discriminated `SignAndExecuteResult`\n * for the on-chain outcome (success vs FailedTransaction); only\n * transport / lifecycle failures surface here.\n */\nconst accountSignErrorToActionError =\n\t(actionName: string) =>\n\t(cause: AccountSignError): ActionError =>\n\t\tactionError('sign', {\n\t\t\tactionName,\n\t\t\tmessage:\n\t\t\t\t`Action '${actionName}': account sign/execute failed for ` +\n\t\t\t\t`'${cause.accountName}' (address=${cause.address}): ${cause.message}`,\n\t\t\tcause,\n\t\t});\n\n// ---------------------------------------------------------------------------\n// `signAndExecute` helper\n// ---------------------------------------------------------------------------\n\n/** Drive the full build → sign → execute → wait → project pipeline by\n * delegating to the account's `withTransactionSigner` /\n * `signAndExecute` surface, then re-projecting the returned\n * `TxResult` into the action's `ActionReceipt` shape.\n *\n * Allocates a fresh `Transaction`, sets the sender to the account's\n * address, lets the caller populate it via the `build` callback,\n * serialises via `Transaction.build({ client })` (or the fork-mode\n * builder for impersonation accounts), then hands the bytes to the\n * account's locked-signer scope. The account plugin owns sign,\n * execute, finality wait, and envelope projection.\n *\n * All failures surface as `ActionError`:\n * - `build` callback throws → `phase: 'sign'`.\n * - `Transaction.build` rejects → `phase: 'sign'`.\n * - `account.signAndExecute` rejects with `AccountSignError` → mapped\n * to `phase: 'sign'`. The Account plugin's `'no-digest'` phase\n * (SDK envelope protocol violation) flows through here as well —\n * the originating `AccountSignError` is preserved via `cause` so\n * the cause walker renders the underlying `phase: 'no-digest'`.\n *\n * The `actionName` parameter threads into every error's `actionName`\n * field so cause-walker output stays attributable.\n */\nexport const signAndExecute = (params: {\n\treadonly actionName: string;\n\treadonly sui: SuiClient;\n\treadonly account: AccountValue;\n\treadonly build: (tx: Transaction) => void;\n}): Effect.Effect<ActionReceipt, ActionError, Scope.Scope> => {\n\tconst { actionName, sui, account, build } = params;\n\tconst mapAccountErr = accountSignErrorToActionError(actionName);\n\t// Delegate the build → sign → execute → dispatch pipeline to the\n\t// shared `signAndDispatch` helper. The build closure handles both\n\t// the user callback (`build(tx)`) and mode-appropriate serialization\n\t// (fork impersonation vs SDK-resolver). On-chain failures surface\n\t// as `phase: 'execute-failed'` so cause-walker renders them distinctly\n\t// from transport-level signing failures (`phase: 'sign'`).\n\treturn signAndDispatch({\n\t\tsignerSource: account,\n\t\tbuildTxBytes: () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// --- 1. Allocate + populate the Transaction ------------------\n\t\t\t\tconst tx = new Transaction();\n\t\t\t\ttx.setSender(account.address);\n\t\t\t\tyield* Effect.try({\n\t\t\t\t\ttry: () => build(tx),\n\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\tmessage: `Action '${actionName}': build callback threw before serialisation.`,\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. Serialise via the mode-appropriate path --------------\n\t\t\t\t// Fork mode (impersonate OR real signer) must build offline with\n\t\t\t\t// explicit gas: the sui-fork binary has no simulate_transaction,\n\t\t\t\t// so the SDK's gas-estimating `tx.build({ client })` fails. The\n\t\t\t\t// real-vs-empty-signature split happens later in signAndExecute.\n\t\t\t\treturn account.source === 'impersonate' || sui.fork !== null\n\t\t\t\t\t? yield* buildForkImpersonationTransactionBytes(tx, account.address, sui.sdk.core).pipe(\n\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t(cause): ActionError =>\n\t\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': fork Transaction.build failed — ${cause.message}.`,\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t: yield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () => tx.build({ client: sui.sdk.client }),\n\t\t\t\t\t\t\tcatch: (cause): ActionError =>\n\t\t\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\t\t\tactionName,\n\t\t\t\t\t\t\t\t\tmessage: `Action '${actionName}': Transaction.build failed — ${formatUnknownError(\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t)}.`,\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}),\n\t\tmapSignError: mapAccountErr,\n\t\tonFailed: (failure) =>\n\t\t\tEffect.fail(\n\t\t\t\tactionError('execute-failed', {\n\t\t\t\t\tactionName,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Action '${actionName}': transaction execution failed on-chain ` +\n\t\t\t\t\t\t`for account '${account.name}' (address=${account.address}) ` +\n\t\t\t\t\t\tformatExecutedFailure(failure),\n\t\t\t\t}),\n\t\t\t),\n\t\tonSuccess: (txResult) => Effect.succeed(receiptFromTxResult(txResult)),\n\t});\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAwEA,MAAM,+BACL,YAEA,QACE,QAEC,WASA,OAAO,WAAW,YAClB,WAAW,QACX,OAAQ,OAA2C,aAAa,QAClE,CAAC,CACA,KAAK,WAAW;CAChB,MAAM,QAEF;EACH,MAAM,OAAO,SAAS,aAAa,OAAO,SAAS,YAAY,YAAY;EAC3E,UAAU,OAAO;CAClB;CACA,IAAI,OAAO,OAAO,eAAe,UAAU,MAAM,aAAa,OAAO;CACrE,IAAI,OAAO,OAAO,gBAAgB,UAAU,MAAM,cAAc,OAAO;CACvE,IAAI,OAAO,OAAO,gBAAgB,UAAU,MAAM,cAAc,OAAO;CACvE,OAAO;AACR,CAAC;AAEH,MAAM,uBAAuB,QAAiC;CAC7D,QAAQ,GAAG;CACX,eAAe,4BAA4B,GAAG,aAAa;CAC3D,gBAAgB,GAAG;AACpB;;;;;;;AAYA,MAAM,iCACJ,gBACA,UACA,YAAY,QAAQ;CACnB;CACA,SACC,WAAW,WAAW,sCAClB,MAAM,YAAY,aAAa,MAAM,QAAQ,KAAK,MAAM;CAC7D;AACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AA8BH,MAAa,kBAAkB,WAK+B;CAC7D,MAAM,EAAE,YAAY,KAAK,SAAS,UAAU;CAQ5C,OAAO,gBAAgB;EACtB,cAAc;EACd,oBACC,OAAO,IAAI,aAAa;GAEvB,MAAM,KAAK,IAAI,YAAY;GAC3B,GAAG,UAAU,QAAQ,OAAO;GAC5B,OAAO,OAAO,IAAI;IACjB,WAAW,MAAM,EAAE;IACnB,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW;KAC/B;IACD,CAAC;GACH,CAAC;GAOD,OAAO,QAAQ,WAAW,iBAAiB,IAAI,SAAS,OACrD,OAAO,uCAAuC,IAAI,QAAQ,SAAS,IAAI,IAAI,IAAI,CAAC,CAAC,KACjF,OAAO,UACL,UACA,YAAY,QAAQ;IACnB;IACA,SAAS,WAAW,WAAW,qCAAqC,MAAM,QAAQ;IAClF;GACD,CAAC,CACH,CACD,IACC,OAAO,OAAO,WAAW;IACzB,WAAW,GAAG,MAAM,EAAE,QAAQ,IAAI,IAAI,OAAO,CAAC;IAC9C,QAAQ,UACP,YAAY,QAAQ;KACnB;KACA,SAAS,WAAW,WAAW,gCAAgC,mBAC9D,KACD,EAAE;KACF;IACD,CAAC;GACH,CAAC;EACJ,CAAC;EACF,cApDqB,8BAA8B,UAoDzB;EAC1B,WAAW,YACV,OAAO,KACN,YAAY,kBAAkB;GAC7B;GACA,SACC,WAAW,WAAW,wDACN,QAAQ,KAAK,aAAa,QAAQ,QAAQ,MAC1D,sBAAsB,OAAO;EAC/B,CAAC,CACF;EACD,YAAY,aAAa,OAAO,QAAQ,oBAAoB,QAAQ,CAAC;CACtE,CAAC;AACF"}
@@ -1,6 +1,6 @@
1
1
  import { AnyResourceRef, DependencyInput, DependencyList, Plugin, ResolvedDependencies, ResourceRef } from "../../substrate/plugin.mjs";
2
- import { SuiClient } from "../sui/mode/shared.mjs";
3
2
  import { SuiOptions } from "../sui/mode/spec.mjs";
3
+ import { SuiClient } from "../sui/mode/shared.mjs";
4
4
  import { ActionError, ActionPhase } from "./errors.mjs";
5
5
  import { DynamicDiscriminator } from "./discriminator.mjs";
6
6
  import { ActionReceipt } from "./service.mjs";
@@ -48,7 +48,7 @@ interface ActionOptions<DependsOn extends ActionDependencySpec> {
48
48
  */
49
49
  declare const action: <const Name extends string, const DependsOn extends ActionDependencySpec>(name: Name, opts: ActionOptions<DependsOn>) => Plugin<`action:${Name}`, ActionReceipt, readonly [ResourceRef<"sui", SuiClient & {
50
50
  readonly mode: SuiOptions["mode"];
51
- }>, ...DependencyList<DependsOn>], readonly []>;
51
+ }>, ...DependencyList<DependsOn>]>;
52
52
  //#endregion
53
53
  export { ActionOptions, ActionUpstreamRef, action };
54
54
  //# sourceMappingURL=index.d.mts.map
@@ -1,17 +1,15 @@
1
1
  import { definePlugin, dependencyList, resolveDependencyValues, resource } from "../../substrate/plugin.mjs";
2
2
  import "../../api/define-plugin.mjs";
3
- import { ArtifactPublisherService } from "../../substrate/runtime/artifact-publisher/index.mjs";
3
+ import { CacheService } from "../../substrate/runtime/cache/service.mjs";
4
+ import "../../substrate/runtime/cache/index.mjs";
4
5
  import { chainProbeFor } from "../../substrate/runtime/strategy-registry/chain-probe-for.mjs";
5
6
  import "../../substrate/runtime/strategy-registry/index.mjs";
6
- import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
7
7
  import { suiResource } from "../sui/index.mjs";
8
- import { ACTION_ERROR_TAGS, actionError } from "./errors.mjs";
9
- import "./spans.mjs";
8
+ import { actionError } from "./errors.mjs";
10
9
  import { signAndExecute } from "./execute.mjs";
11
10
  import { bootActionService, resolveDiscriminator } from "./service.mjs";
12
11
  import { Effect } from "effect";
13
12
  //#region src/plugins/action/index.ts
14
- const actionErrorContributions = pluginErrorContributions(ACTION_ERROR_TAGS);
15
13
  /** Resource id constructor. The symbolic action name is part of the tag
16
14
  * identity so two `action('foo', ...)` calls in one stack collide
17
15
  * cleanly at compose time. */
@@ -46,8 +44,8 @@ const action = (name, opts) => {
46
44
  message: `Action '${name}': dependency '${ref.id}' was not resolved.`
47
45
  }));
48
46
  const readDeclaredDependency = (id) => resolvedByResourceId.get(id);
49
- const publisher = yield* ArtifactPublisherService;
50
- const probe = yield* chainProbeFor(sui.chain);
47
+ const publisher = yield* CacheService;
48
+ const probe = yield* chainProbeFor(sui.chainId);
51
49
  const bodyCtx = {
52
50
  sui,
53
51
  signAndExecute: (account, build) => signAndExecute({
@@ -60,7 +58,7 @@ const action = (name, opts) => {
60
58
  const bodyDeps = resolveDependencyValues(opts.dependsOn, (member) => readDeclaredDependency(member.id));
61
59
  return yield* bootActionService(publisher, probe, {
62
60
  actionName: name,
63
- chainId: sui.chain,
61
+ chainId: sui.chainId,
64
62
  staticDiscriminator: {
65
63
  actionName: name,
66
64
  dependencyResourceIds
@@ -75,9 +73,7 @@ const action = (name, opts) => {
75
73
  cause: err
76
74
  }))
77
75
  }));
78
- }),
79
- capabilities: [],
80
- errorContributions: actionErrorContributions
76
+ })
81
77
  });
82
78
  };
83
79
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["signAndExecuteImpl"],"sources":["../../../src/plugins/action/index.ts"],"sourcesContent":["// Action plugin — barrel + `action(name, opts)` factory.\n//\n// Architecture (16-action.md): an action is a ONE-SHOT on-chain effect\n// (mint, create-singleton-object, seed-config, etc.) that runs after\n// its declared upstream refs (typically a signer account + one or more\n// published packages) are ready. The result (digest + change arrays)\n// is yieldable through the action resource.\n//\n// User-facing factory shape (recommended high-level form):\n//\n// const openLobby = action('connect-four.openLobby', {\n// dependsOn: { signer: alice, pkg: connectFour },\n// body: (ctx, { signer, pkg }) =>\n// ctx.signAndExecute(signer, (tx) => {\n// tx.moveCall({ target: `${pkg.packageId}::game::create_lobby` });\n// }),\n// });\n//\n// The `ctx.signAndExecute(account, build)` helper folds the full\n// build → sign → execute (with `include: {effects, objectTypes}`) →\n// wait-for-finality → envelope-projection pipeline into a single call\n// (see `execute.ts`). The returned `ActionReceipt` carries the real\n// transaction digest and an `objectChanges` array that surfaces the\n// SDK's `changedObjects` (with `kind: 'created' | 'mutated'` + the\n// fully-qualified `objectType` string when available).\n//\n// Resource id: `'action:<name>'` — one tag per user-declared action (the\n// symbolic name is part of the identity so two `action('foo', ...)`\n// calls in one stack collide cleanly at compose time).\n//\n// Caching: delegated to the substrate's `ArtifactPublisher`.\n// Namespace is `action`; the cache key folds chainId + content-hash\n// derived from (name, dependencyResourceIds, dynamic discriminator).\n\nimport { Effect, type Scope } from 'effect';\n\nimport {\n\tdefinePlugin,\n\tdependencyList,\n\tresource,\n\tresolveDependencyValues,\n\ttype AnyResourceRef,\n\ttype DependencyInput,\n\ttype ResolvedDependencies,\n} from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { ArtifactPublisherService } from '../../substrate/runtime/artifact-publisher/index.ts';\nimport { chainProbeFor } from '../../substrate/runtime/strategy-registry/index.ts';\nimport { suiResource, type SuiProbeKey } from '../sui/index.ts';\n\nimport type { ActionBuildContext } from './build-context.ts';\nimport { actionError, ACTION_ERROR_TAGS, type ActionError } from './errors.ts';\nimport type { DynamicDiscriminator } from './discriminator.ts';\nimport { signAndExecute as signAndExecuteImpl } from './execute.ts';\nimport {\n\tbootActionService,\n\tresolveDiscriminator,\n\ttype ActionAcquireInputs,\n\ttype ActionReceipt,\n} from './service.ts';\n\nconst actionErrorContributions = pluginErrorContributions(ACTION_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared action, keyed by symbolic name\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic action name is part of the tag\n * identity so two `action('foo', ...)` calls in one stack collide\n * cleanly at compose time. */\nexport const actionResourceId = <Name extends string>(name: Name): `action:${Name}` =>\n\t`action:${name}`;\n\nexport type ActionResourceId<Name extends string> = `action:${Name}`;\n\n// ---------------------------------------------------------------------------\n// User-facing factory shape\n// ---------------------------------------------------------------------------\n\n/** A user-supplied upstream resource ref. The user passes plugin values\n * such as `account('alice')` or `localPackage('demo', ...)`; object,\n * tuple, and single-ref shapes are preserved for the action body. */\nexport type ActionUpstreamRef = AnyResourceRef;\n\n/** Options for `action(name, opts)`. */\ntype ActionDependencySpec = DependencyInput;\n\ntype ResolvedActionDependencies<Input extends ActionDependencySpec> = ResolvedDependencies<Input>;\n\nexport interface ActionOptions<DependsOn extends ActionDependencySpec> {\n\t/** Upstream refs the action depends on. The shape determines the\n\t * second argument passed to `body`. */\n\treadonly dependsOn: DependsOn;\n\t/** Optional caller-supplied discriminator material. Two shapes:\n\t * a literal `string`, or a callback `(ctx, deps) => Effect<string>`\n\t * that receives action helpers plus resolved deps shaped like\n\t * `dependsOn`, so the discriminator can derive its value from\n\t * upstream resolved values. See\n\t * `discriminator.ts`. */\n\treadonly discriminator?: DynamicDiscriminator<ResolvedActionDependencies<DependsOn>>;\n\t/** The user's body. Receives action helpers plus resolved deps\n\t * shaped like `dependsOn`, then returns the on-chain effect.\n\t *\n\t * Errors raised here surface as `ActionError({phase:'sign'})`\n\t * unless the body raises an `ActionError` itself (in which case\n\t * it propagates verbatim). */\n\treadonly body: (\n\t\tctx: ActionBuildContext,\n\t\tdeps: ResolvedActionDependencies<DependsOn>,\n\t) => Effect.Effect<ActionReceipt, ActionError, Scope.Scope>;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/** Construct the action plugin instance.\n *\n * The result is a plugin/resource ref that:\n *\n * - publishes an `ActionReceipt`-typed resource identified by\n * `action:<name>`,\n * - `dependsOn:` `[suiResource, ...userDependencies]` (Sui hard upstream for\n * ChainProbe lookup + chainId folding),\n * - `role: 'task'` — Action has no long-lived resources;\n * the substrate's lifecycle wrap surfaces it as \"done\" after\n * `start` resolves.\n */\nexport const action = <const Name extends string, const DependsOn extends ActionDependencySpec>(\n\tname: Name,\n\topts: ActionOptions<DependsOn>,\n) => {\n\tconst actionRef = resource<ActionResourceId<Name>, ActionReceipt>(actionResourceId(name));\n\n\t// Flatten the user-supplied upstream refs for ordering. The start\n\t// body below keeps the original `dependsOn` shape so it can\n\t// reconstruct the user's dependency argument.\n\tconst upstreamRefs = dependencyList(opts.dependsOn);\n\tconst dependencies = [suiResource, ...upstreamRefs] as const;\n\n\t// Static discriminator pieces — known at factory construction\n\t// time. The tag-ids preserve the literal `id` so two actions with\n\t// identical bodies but different upstream packages get different\n\t// cache keys.\n\tconst dependencyResourceIds = upstreamRefs.map(({ id }) => id) as ReadonlyArray<string>;\n\n\treturn definePlugin({\n\t\tid: actionRef.id,\n\t\tdependsOn: dependencies,\n\t\t// Action has no long-lived resources — the body runs once at\n\t\t// acquire and returns; supervisor's lifecycle wrap surfaces\n\t\t// \"done\" after that.\n\t\trole: 'task',\n\t\tsection: 'action',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui, ...resolvedUpstream] = deps;\n\t\t\t\tconst resolvedByResourceId = new Map<string, unknown>(\n\t\t\t\t\tupstreamRefs.map((ref, index) => [ref.id, resolvedUpstream[index]]),\n\t\t\t\t);\n\n\t\t\t\t// Substrate guarantees `deps` is the resolved positional\n\t\t\t\t// list matching `dependsOn`, so this map is densely\n\t\t\t\t// populated. If the invariant ever breaks (substrate\n\t\t\t\t// bug) we surface a typed ActionError(`build`) BEFORE\n\t\t\t\t// invoking the downstream sync resolver so the cause\n\t\t\t\t// walker attributes the failure to this action rather\n\t\t\t\t// than producing an unattributed defect.\n\t\t\t\tfor (const ref of upstreamRefs) {\n\t\t\t\t\tif (!resolvedByResourceId.has(ref.id)) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tactionError('build', {\n\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\tmessage: `Action '${name}': dependency '${ref.id}' was not resolved.`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst readDeclaredDependency = (id: string): unknown => resolvedByResourceId.get(id);\n\n\t\t\t\t// Substrate-context primitives. artifact publisher + strategy registry\n\t\t\t\t// are both provided by the supervisor's pluginContext.\n\t\t\t\tconst publisher = yield* ArtifactPublisherService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chain);\n\n\t\t\t\t// Compose the user's body Effect, closing over the\n\t\t\t\t// action helper context. Resolved upstream values are\n\t\t\t\t// passed separately in the same shape as `dependsOn`.\n\t\t\t\t// - `ctx.sui` — the resolved SuiClient (always set;\n\t\t\t\t// suiResource is the hard upstream).\n\t\t\t\t// - `ctx.signAndExecute(account, build)` — high-level\n\t\t\t\t// helper that drives the full build → sign → execute\n\t\t\t\t// → wait → project pipeline against the supplied\n\t\t\t\t// account, returning a parsed `ActionReceipt`. This\n\t\t\t\t// is what most action bodies want — it folds the\n\t\t\t\t// SDK-boundary cast + `include: {effects, objectTypes}`\n\t\t\t\t// execute + finality wait + envelope projection.\n\t\t\t\tconst bodyCtx: ActionBuildContext = {\n\t\t\t\t\tsui,\n\t\t\t\t\tsignAndExecute: (account, build) =>\n\t\t\t\t\t\tsignAndExecuteImpl({\n\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\tsui,\n\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\tbuild,\n\t\t\t\t\t\t}),\n\t\t\t\t};\n\n\t\t\t\tconst bodyDeps = resolveDependencyValues(opts.dependsOn, (member) =>\n\t\t\t\t\treadDeclaredDependency(member.id),\n\t\t\t\t) as ResolvedActionDependencies<DependsOn>;\n\t\t\t\tconst acquireInputs: ActionAcquireInputs = {\n\t\t\t\t\tactionName: name,\n\t\t\t\t\tchainId: sui.chain,\n\t\t\t\t\tstaticDiscriminator: {\n\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\tdependencyResourceIds,\n\t\t\t\t\t},\n\t\t\t\t\tdynamicMaterial: resolveDiscriminator(opts.discriminator, bodyCtx, bodyDeps),\n\t\t\t\t\tbody: opts.body(bodyCtx, bodyDeps),\n\t\t\t\t};\n\n\t\t\t\tconst receipt = yield* bootActionService(publisher, probe, acquireInputs).pipe(\n\t\t\t\t\t// `catchTags` narrows on the `_tag` discriminant so each\n\t\t\t\t\t// branch's handler sees the typed shape directly.\n\t\t\t\t\t//\n\t\t\t\t\t// The produce-side body in `service.ts` recovers any\n\t\t\t\t\t// stashed ActionError before the substrate's\n\t\t\t\t\t// mapError wrap, so an ArtifactPublishError reaching\n\t\t\t\t\t// here is always a substrate-side failure (cache\n\t\t\t\t\t// decode failure, verify exhausted). Surface those as\n\t\t\t\t\t// `phase: 'verify'` — they happen during the cache\n\t\t\t\t\t// verify cycle, not at sign-time.\n\t\t\t\t\tEffect.catchTags({\n\t\t\t\t\t\tActionError: (err) => Effect.fail(err),\n\t\t\t\t\t\tArtifactPublishError: (err) =>\n\t\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\t\tactionError('verify', {\n\t\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\t\tmessage: err.detail,\n\t\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\treturn receipt;\n\t\t\t}),\n\t\t// No capability decls today. Future surfaces (codegen of\n\t\t// action receipts, manifest extras) land here.\n\t\tcapabilities: [] as const,\n\t\t// Plugin-side error vocabulary. The supervisor's harvest loop\n\t\t// folds this into the substrate's FormatterRegistry; the\n\t\t// cascade formatter then renders `ActionError`-tagged failures\n\t\t// with the action's phase/message header.\n\t\terrorContributions: actionErrorContributions,\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport type { ActionBuildContext } from './build-context.ts';\nexport type { ActionError, ActionPhase } from './errors.ts';\nexport { ACTION_ERROR_TAGS } from './errors.ts';\nexport type { DynamicDiscriminator, StaticDiscriminator } from './discriminator.ts';\nexport type { ActionReceipt } from './service.ts';\nexport { ActionReceiptSchema } from './service.ts';\nexport type { ActionObjectChange } from './execute.ts';\nexport { signAndExecute } from './execute.ts';\n\nexport { ActionSpans } from './spans.ts';\n"],"mappings":";;;;;;;;;;;;;AA6DA,MAAM,2BAA2B,yBAAyB,kBAAkB;;;;AAS5E,MAAa,oBAAyC,SACrD,UAAU;;;;;;;;;;;;;AAyDX,MAAa,UACZ,MACA,SACI;CACJ,MAAM,YAAY,SAAgD,iBAAiB,KAAK,CAAC;CAKzF,MAAM,eAAe,eAAe,KAAK,UAAU;CACnD,MAAM,eAAe,CAAC,aAAa,GAAG,aAAa;CAMnD,MAAM,wBAAwB,aAAa,KAAK,EAAE,SAAS,GAAG;AAE9D,QAAO,aAAa;EACnB,IAAI,UAAU;EACd,WAAW;EAIX,MAAM;EACN,SAAS;EACT,QAAQ,SACP,OAAO,IAAI,aAAa;GACvB,MAAM,CAAC,KAAK,GAAG,oBAAoB;GACnC,MAAM,uBAAuB,IAAI,IAChC,aAAa,KAAK,KAAK,UAAU,CAAC,IAAI,IAAI,iBAAiB,OAAO,CAAC,CACnE;AASD,QAAK,MAAM,OAAO,aACjB,KAAI,CAAC,qBAAqB,IAAI,IAAI,GAAG,CACpC,QAAO,OAAO,OAAO,KACpB,YAAY,SAAS;IACpB,YAAY;IACZ,SAAS,WAAW,KAAK,iBAAiB,IAAI,GAAG;IACjD,CAAC,CACF;GAGH,MAAM,0BAA0B,OAAwB,qBAAqB,IAAI,GAAG;GAIpF,MAAM,YAAY,OAAO;GACzB,MAAM,QAAQ,OAAO,cAA2B,IAAI,MAAM;GAc1D,MAAM,UAA8B;IACnC;IACA,iBAAiB,SAAS,UACzBA,eAAmB;KAClB,YAAY;KACZ;KACA;KACA;KACA,CAAC;IACH;GAED,MAAM,WAAW,wBAAwB,KAAK,YAAY,WACzD,uBAAuB,OAAO,GAAG,CACjC;AAmCD,UAAO,OAvBgB,kBAAkB,WAAW,OAAO;IAV1D,YAAY;IACZ,SAAS,IAAI;IACb,qBAAqB;KACpB,YAAY;KACZ;KACA;IACD,iBAAiB,qBAAqB,KAAK,eAAe,SAAS,SAAS;IAC5E,MAAM,KAAK,KAAK,SAAS,SAAS;IAGqC,CAAC,CAAC,KAWzE,OAAO,UAAU;IAChB,cAAc,QAAQ,OAAO,KAAK,IAAI;IACtC,uBAAuB,QACtB,OAAO,KACN,YAAY,UAAU;KACrB,YAAY;KACZ,SAAS,IAAI;KACb,OAAO;KACP,CAAC,CACF;IACF,CAAC,CACF;IAEA;EAGH,cAAc,EAAE;EAKhB,oBAAoB;EACpB,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":["signAndExecuteImpl"],"sources":["../../../src/plugins/action/index.ts"],"sourcesContent":["// Action plugin — barrel + `action(name, opts)` factory.\n//\n// Architecture (16-action.md): an action is a ONE-SHOT on-chain effect\n// (mint, create-singleton-object, seed-config, etc.) that runs after\n// its declared upstream refs (typically a signer account + one or more\n// published packages) are ready. The result (digest + change arrays)\n// is yieldable through the action resource.\n//\n// User-facing factory shape (recommended high-level form):\n//\n// const openLobby = action('connect-four.openLobby', {\n// dependsOn: { signer: alice, pkg: connectFour },\n// body: (ctx, { signer, pkg }) =>\n// ctx.signAndExecute(signer, (tx) => {\n// tx.moveCall({ target: `${pkg.packageId}::game::create_lobby` });\n// }),\n// });\n//\n// The `ctx.signAndExecute(account, build)` helper folds the full\n// build → sign → execute (with `include: {effects, objectTypes}`) →\n// wait-for-finality → envelope-projection pipeline into a single call\n// (see `execute.ts`). The returned `ActionReceipt` carries the real\n// transaction digest and an `objectChanges` array that surfaces the\n// SDK's `changedObjects` (with `kind: 'created' | 'mutated'` + the\n// fully-qualified `objectType` string when available).\n//\n// Resource id: `'action:<name>'` — one tag per user-declared action (the\n// symbolic name is part of the identity so two `action('foo', ...)`\n// calls in one stack collide cleanly at compose time).\n//\n// Caching: delegated to the substrate's `ArtifactPublisher`.\n// Namespace is `action`; the cache key folds chainId + content-hash\n// derived from (name, dependencyResourceIds, dynamic discriminator).\n\nimport { Effect, type Scope } from 'effect';\n\nimport {\n\tdefinePlugin,\n\tdependencyList,\n\tresource,\n\tresolveDependencyValues,\n\ttype AnyResourceRef,\n\ttype DependencyInput,\n\ttype ResolvedDependencies,\n} from '../../api/define-plugin.ts';\nimport { CacheService } from '../../substrate/runtime/cache/index.ts';\nimport { chainProbeFor } from '../../substrate/runtime/strategy-registry/index.ts';\nimport { suiResource, type SuiProbeKey } from '../sui/index.ts';\n\nimport type { ActionBuildContext } from './build-context.ts';\nimport { actionError, type ActionError } from './errors.ts';\nimport type { DynamicDiscriminator } from './discriminator.ts';\nimport { signAndExecute as signAndExecuteImpl } from './execute.ts';\nimport {\n\tbootActionService,\n\tresolveDiscriminator,\n\ttype ActionAcquireInputs,\n\ttype ActionReceipt,\n} from './service.ts';\n\n// ---------------------------------------------------------------------------\n// Resource — one per declared action, keyed by symbolic name\n// ---------------------------------------------------------------------------\n\n/** Resource id constructor. The symbolic action name is part of the tag\n * identity so two `action('foo', ...)` calls in one stack collide\n * cleanly at compose time. */\nexport const actionResourceId = <Name extends string>(name: Name): `action:${Name}` =>\n\t`action:${name}`;\n\nexport type ActionResourceId<Name extends string> = `action:${Name}`;\n\n// ---------------------------------------------------------------------------\n// User-facing factory shape\n// ---------------------------------------------------------------------------\n\n/** A user-supplied upstream resource ref. The user passes plugin values\n * such as `account('alice')` or `localPackage('demo', ...)`; object,\n * tuple, and single-ref shapes are preserved for the action body. */\nexport type ActionUpstreamRef = AnyResourceRef;\n\n/** Options for `action(name, opts)`. */\ntype ActionDependencySpec = DependencyInput;\n\ntype ResolvedActionDependencies<Input extends ActionDependencySpec> = ResolvedDependencies<Input>;\n\nexport interface ActionOptions<DependsOn extends ActionDependencySpec> {\n\t/** Upstream refs the action depends on. The shape determines the\n\t * second argument passed to `body`. */\n\treadonly dependsOn: DependsOn;\n\t/** Optional caller-supplied discriminator material. Two shapes:\n\t * a literal `string`, or a callback `(ctx, deps) => Effect<string>`\n\t * that receives action helpers plus resolved deps shaped like\n\t * `dependsOn`, so the discriminator can derive its value from\n\t * upstream resolved values. See\n\t * `discriminator.ts`. */\n\treadonly discriminator?: DynamicDiscriminator<ResolvedActionDependencies<DependsOn>>;\n\t/** The user's body. Receives action helpers plus resolved deps\n\t * shaped like `dependsOn`, then returns the on-chain effect.\n\t *\n\t * Errors raised here surface as `ActionError({phase:'sign'})`\n\t * unless the body raises an `ActionError` itself (in which case\n\t * it propagates verbatim). */\n\treadonly body: (\n\t\tctx: ActionBuildContext,\n\t\tdeps: ResolvedActionDependencies<DependsOn>,\n\t) => Effect.Effect<ActionReceipt, ActionError, Scope.Scope>;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\n/** Construct the action plugin instance.\n *\n * The result is a plugin/resource ref that:\n *\n * - publishes an `ActionReceipt`-typed resource identified by\n * `action:<name>`,\n * - `dependsOn:` `[suiResource, ...userDependencies]` (Sui hard upstream for\n * ChainProbe lookup + chainId folding),\n * - `role: 'task'` — Action has no long-lived resources;\n * the substrate's lifecycle wrap surfaces it as \"done\" after\n * `start` resolves.\n */\nexport const action = <const Name extends string, const DependsOn extends ActionDependencySpec>(\n\tname: Name,\n\topts: ActionOptions<DependsOn>,\n) => {\n\tconst actionRef = resource<ActionResourceId<Name>, ActionReceipt>(actionResourceId(name));\n\n\t// Flatten the user-supplied upstream refs for ordering. The start\n\t// body below keeps the original `dependsOn` shape so it can\n\t// reconstruct the user's dependency argument.\n\tconst upstreamRefs = dependencyList(opts.dependsOn);\n\tconst dependencies = [suiResource, ...upstreamRefs] as const;\n\n\t// Static discriminator pieces — known at factory construction\n\t// time. The tag-ids preserve the literal `id` so two actions with\n\t// identical bodies but different upstream packages get different\n\t// cache keys.\n\tconst dependencyResourceIds = upstreamRefs.map(({ id }) => id) as ReadonlyArray<string>;\n\n\treturn definePlugin({\n\t\tid: actionRef.id,\n\t\tdependsOn: dependencies,\n\t\t// Action has no long-lived resources — the body runs once at\n\t\t// acquire and returns; supervisor's lifecycle wrap surfaces\n\t\t// \"done\" after that.\n\t\trole: 'task',\n\t\tsection: 'action',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst [sui, ...resolvedUpstream] = deps;\n\t\t\t\tconst resolvedByResourceId = new Map<string, unknown>(\n\t\t\t\t\tupstreamRefs.map((ref, index) => [ref.id, resolvedUpstream[index]]),\n\t\t\t\t);\n\n\t\t\t\t// Substrate guarantees `deps` is the resolved positional\n\t\t\t\t// list matching `dependsOn`, so this map is densely\n\t\t\t\t// populated. If the invariant ever breaks (substrate\n\t\t\t\t// bug) we surface a typed ActionError(`build`) BEFORE\n\t\t\t\t// invoking the downstream sync resolver so the cause\n\t\t\t\t// walker attributes the failure to this action rather\n\t\t\t\t// than producing an unattributed defect.\n\t\t\t\tfor (const ref of upstreamRefs) {\n\t\t\t\t\tif (!resolvedByResourceId.has(ref.id)) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tactionError('build', {\n\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\tmessage: `Action '${name}': dependency '${ref.id}' was not resolved.`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst readDeclaredDependency = (id: string): unknown => resolvedByResourceId.get(id);\n\n\t\t\t\t// Substrate-context primitives. artifact publisher + strategy registry\n\t\t\t\t// are both provided by the supervisor's pluginContext.\n\t\t\t\tconst publisher = yield* CacheService;\n\t\t\t\tconst probe = yield* chainProbeFor<SuiProbeKey>(sui.chainId);\n\n\t\t\t\t// Compose the user's body Effect, closing over the\n\t\t\t\t// action helper context. Resolved upstream values are\n\t\t\t\t// passed separately in the same shape as `dependsOn`.\n\t\t\t\t// - `ctx.sui` — the resolved SuiClient (always set;\n\t\t\t\t// suiResource is the hard upstream).\n\t\t\t\t// - `ctx.signAndExecute(account, build)` — high-level\n\t\t\t\t// helper that drives the full build → sign → execute\n\t\t\t\t// → wait → project pipeline against the supplied\n\t\t\t\t// account, returning a parsed `ActionReceipt`. This\n\t\t\t\t// is what most action bodies want — it folds the\n\t\t\t\t// SDK-boundary cast + `include: {effects, objectTypes}`\n\t\t\t\t// execute + finality wait + envelope projection.\n\t\t\t\tconst bodyCtx: ActionBuildContext = {\n\t\t\t\t\tsui,\n\t\t\t\t\tsignAndExecute: (account, build) =>\n\t\t\t\t\t\tsignAndExecuteImpl({\n\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\tsui,\n\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\tbuild,\n\t\t\t\t\t\t}),\n\t\t\t\t};\n\n\t\t\t\tconst bodyDeps = resolveDependencyValues(opts.dependsOn, (member) =>\n\t\t\t\t\treadDeclaredDependency(member.id),\n\t\t\t\t) as ResolvedActionDependencies<DependsOn>;\n\t\t\t\tconst acquireInputs: ActionAcquireInputs = {\n\t\t\t\t\tactionName: name,\n\t\t\t\t\tchainId: sui.chainId,\n\t\t\t\t\tstaticDiscriminator: {\n\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\tdependencyResourceIds,\n\t\t\t\t\t},\n\t\t\t\t\tdynamicMaterial: resolveDiscriminator(opts.discriminator, bodyCtx, bodyDeps),\n\t\t\t\t\tbody: opts.body(bodyCtx, bodyDeps),\n\t\t\t\t};\n\n\t\t\t\tconst receipt = yield* bootActionService(publisher, probe, acquireInputs).pipe(\n\t\t\t\t\t// `catchTags` narrows on the `_tag` discriminant so each\n\t\t\t\t\t// branch's handler sees the typed shape directly.\n\t\t\t\t\t//\n\t\t\t\t\t// The produce-side body in `service.ts` recovers any\n\t\t\t\t\t// stashed ActionError before the substrate's\n\t\t\t\t\t// mapError wrap, so an ArtifactPublishError reaching\n\t\t\t\t\t// here is always a substrate-side failure (cache\n\t\t\t\t\t// decode failure, verify exhausted). Surface those as\n\t\t\t\t\t// `phase: 'verify'` — they happen during the cache\n\t\t\t\t\t// verify cycle, not at sign-time.\n\t\t\t\t\tEffect.catchTags({\n\t\t\t\t\t\tActionError: (err) => Effect.fail(err),\n\t\t\t\t\t\tArtifactPublishError: (err) =>\n\t\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\t\tactionError('verify', {\n\t\t\t\t\t\t\t\t\tactionName: name,\n\t\t\t\t\t\t\t\t\tmessage: err.detail,\n\t\t\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\treturn receipt;\n\t\t\t}),\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// Re-exports\n// ---------------------------------------------------------------------------\n\nexport type { ActionBuildContext } from './build-context.ts';\nexport type { ActionError, ActionPhase } from './errors.ts';\nexport type { DynamicDiscriminator, StaticDiscriminator } from './discriminator.ts';\nexport type { ActionReceipt } from './service.ts';\nexport { ActionReceiptSchema } from './service.ts';\nexport type { ActionObjectChange } from './execute.ts';\nexport { signAndExecute } from './execute.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAmEA,MAAa,oBAAyC,SACrD,UAAU;;;;;;;;;;;;;AAyDX,MAAa,UACZ,MACA,SACI;CACJ,MAAM,YAAY,SAAgD,iBAAiB,IAAI,CAAC;CAKxF,MAAM,eAAe,eAAe,KAAK,SAAS;CAClD,MAAM,eAAe,CAAC,aAAa,GAAG,YAAY;CAMlD,MAAM,wBAAwB,aAAa,KAAK,EAAE,SAAS,EAAE;CAE7D,OAAO,aAAa;EACnB,IAAI,UAAU;EACd,WAAW;EAIX,MAAM;EACN,SAAS;EACT,QAAQ,SACP,OAAO,IAAI,aAAa;GACvB,MAAM,CAAC,KAAK,GAAG,oBAAoB;GACnC,MAAM,uBAAuB,IAAI,IAChC,aAAa,KAAK,KAAK,UAAU,CAAC,IAAI,IAAI,iBAAiB,MAAM,CAAC,CACnE;GASA,KAAK,MAAM,OAAO,cACjB,IAAI,CAAC,qBAAqB,IAAI,IAAI,EAAE,GACnC,OAAO,OAAO,OAAO,KACpB,YAAY,SAAS;IACpB,YAAY;IACZ,SAAS,WAAW,KAAK,iBAAiB,IAAI,GAAG;GAClD,CAAC,CACF;GAGF,MAAM,0BAA0B,OAAwB,qBAAqB,IAAI,EAAE;GAInF,MAAM,YAAY,OAAO;GACzB,MAAM,QAAQ,OAAO,cAA2B,IAAI,OAAO;GAc3D,MAAM,UAA8B;IACnC;IACA,iBAAiB,SAAS,UACzBA,eAAmB;KAClB,YAAY;KACZ;KACA;KACA;IACD,CAAC;GACH;GAEA,MAAM,WAAW,wBAAwB,KAAK,YAAY,WACzD,uBAAuB,OAAO,EAAE,CACjC;GAmCA,OAAO,OAvBgB,kBAAkB,WAAW,OAAO;IAV1D,YAAY;IACZ,SAAS,IAAI;IACb,qBAAqB;KACpB,YAAY;KACZ;IACD;IACA,iBAAiB,qBAAqB,KAAK,eAAe,SAAS,QAAQ;IAC3E,MAAM,KAAK,KAAK,SAAS,QAAQ;GAGqC,CAAC,CAAC,CAAC,KAWzE,OAAO,UAAU;IAChB,cAAc,QAAQ,OAAO,KAAK,GAAG;IACrC,uBAAuB,QACtB,OAAO,KACN,YAAY,UAAU;KACrB,YAAY;KACZ,SAAS,IAAI;KACb,OAAO;IACR,CAAC,CACF;GACF,CAAC,CACF;EAED,CAAC;CACH,CAAC;AACF"}
@@ -8,14 +8,12 @@ import { Effect, Schema, Scope } from "effect";
8
8
  * shape produced by the `ctx.signAndExecute` helper is
9
9
  * `ActionObjectChange` (`{ kind: 'created' | 'mutated', objectId,
10
10
  * objectType?, outputState?, idOperation? }`). Consumers can cast or
11
- * use `findCreatedByType`-style helpers — mirrors v3's
12
- * `pickCreatedByType(r.objectChanges, ...)` pattern from
13
- * `examples/connect-four/devstack.config.ts`.
11
+ * use `findCreatedByType`-style helpers, e.g.
12
+ * `pickCreatedByType(r.objectChanges, ...)` (see
13
+ * `examples/connect-four/devstack.config.ts`).
14
14
  *
15
- * Distilled doc §"Capabilities PRODUCED" the v3 Action's `TxResult`
16
- * carries `digest`, `effects`, `objectChanges`, `balanceChanges`. We
17
- * narrow to the columns that fit the cache + are actually used by
18
- * downstream consumers. */
15
+ * The receipt narrows to the columns that fit the cache + are actually
16
+ * used by downstream consumers. */
19
17
  interface ActionReceipt {
20
18
  readonly digest: string;
21
19
  readonly objectChanges?: ReadonlyArray<unknown>;
@@ -2,7 +2,6 @@ import { contentHash } from "../../substrate/brand.mjs";
2
2
  import { artifactPublishError } from "../../primitives/artifact-publisher.mjs";
3
3
  import { acquireOnChainArtifact } from "../internal/acquire-on-chain-artifact.mjs";
4
4
  import { actionError } from "./errors.mjs";
5
- import { ActionSpans } from "./spans.mjs";
6
5
  import { withPhasePreservingProduce } from "../../substrate/runtime/phase-preserving-produce.mjs";
7
6
  import { composeDiscriminatorMaterial } from "./discriminator.mjs";
8
7
  import { Cause, Effect, Schema } from "effect";
@@ -40,17 +39,12 @@ const buildVerifyProbe = (probe, cachedDigest) => probe.get({
40
39
  * `ActionError | ArtifactPublishError` — the latter when the substrate
41
40
  * itself surfaces a produce-failure wrap. */
42
41
  const bootActionService = (publisher, probe, inputs) => Effect.gen(function* () {
43
- yield* Effect.annotateCurrentSpan({
44
- [ActionSpans.name]: inputs.actionName,
45
- [ActionSpans.chain]: inputs.chainId
46
- });
47
42
  const resolvedDynamic = yield* inputs.dynamicMaterial;
48
43
  const material = composeDiscriminatorMaterial(inputs.staticDiscriminator, resolvedDynamic);
49
44
  const inputsHash = contentHash(createHash("sha256").update(material).digest("hex"));
50
45
  const { wrappedProduce, recoverTypedError } = yield* withPhasePreservingProduce({
51
46
  produce: Effect.gen(function* () {
52
- yield* Effect.annotateCurrentSpan({ [ActionSpans.phase]: "building" });
53
- const receipt = yield* inputs.body.pipe(Effect.catchCause((cause) => {
47
+ return yield* inputs.body.pipe(Effect.catchCause((cause) => {
54
48
  const failed = Cause.findError(cause);
55
49
  if (failed._tag === "Success") return Effect.fail(failed.success);
56
50
  if (Cause.hasInterruptsOnly(cause)) return Effect.failCause(cause);
@@ -62,11 +56,6 @@ const bootActionService = (publisher, probe, inputs) => Effect.gen(function* ()
62
56
  cause: defectValue
63
57
  }));
64
58
  }));
65
- yield* Effect.annotateCurrentSpan({
66
- [ActionSpans.phase]: "parsing",
67
- [ActionSpans.digest]: receipt.digest
68
- });
69
- return receipt;
70
59
  }),
71
60
  wrapProduceError: (err) => artifactPublishError("produce-failed", `action.${inputs.actionName} ${err.phase}: ${err.message}`)
72
61
  });
@@ -77,10 +66,7 @@ const bootActionService = (publisher, probe, inputs) => Effect.gen(function* ()
77
66
  verify: (cached) => buildVerifyProbe(probe, cached.digest),
78
67
  produce: wrappedProduce
79
68
  }).pipe(recoverTypedError);
80
- }).pipe(Effect.withSpan("devstack.plugin.action.boot", { attributes: {
81
- [ActionSpans.name]: inputs.actionName,
82
- [ActionSpans.chain]: inputs.chainId
83
- } }));
69
+ });
84
70
  //#endregion
85
71
  export { bootActionService, resolveDiscriminator };
86
72
 
@@ -1 +1 @@
1
- {"version":3,"file":"service.mjs","names":["brandContentHash"],"sources":["../../../src/plugins/action/service.ts"],"sourcesContent":["// Action plugin — main acquire body.\n//\n// Architecture (16-action.md): an action is a ONE-SHOT on-chain effect\n// that runs once per (chain × content-hash), caches its receipt, and\n// re-fires when its discriminator changes (or the chain regenesises).\n//\n// Implementation: thin wrapper over `ArtifactPublisher`. The\n// substrate handles the cache → verify → produce → register cycle; this\n// file composes the spec:\n//\n// - namespace = `action`\n// - chain = Sui dependency's resolved `chain`\n// - contentHash = hash of (actionName, upstreamResourceIds[], dynamic\n// discriminator if any)\n// - verify = `chainProbe.get({kind:'transaction', digest},\n// VerifyTxShape, 'lenient')` — null on transient\n// or not-found, NOT raise.\n// - produce = user's `body(ctx)` Effect. Wraps any non-tagged\n// throw in `ActionError({phase:'sign'})`.\n// - register = no-op (Action declares no in-process registry —\n// mirrors v3 `services/action.ts:189-191` \"Action\n// does NOT populate any in-process registries\").\n//\n// Constraints honored:\n//\n// - Cache key folds (name, chainId, dependency resource ids, discriminator?) —\n// 16-action.md invariant #1.\n// - Dynamic discriminator re-runs on EVERY acquire — invariant #6.\n// - Lenient verify probe — invariant #4.\n// - signAndExecute failure routes via ActionError(phase: 'sign') —\n// invariant #8 (mirroring v3's `PublishError({phase:'publish-tx'})`,\n// but tagged separately so action consumers `catchTag('ActionError')`\n// without clashing with package's tagged error).\n\nimport { createHash } from 'node:crypto';\n\nimport { Cause, Effect, Schema, type Scope } from 'effect';\n\nimport { contentHash as brandContentHash, type ChainId } from '../../substrate/brand.ts';\nimport {\n\tartifactPublishError,\n\ttype ArtifactPublishError,\n\ttype ArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport { acquireOnChainArtifact } from '../internal/acquire-on-chain-artifact.ts';\nimport { withPhasePreservingProduce } from '../../substrate/runtime/phase-preserving-produce.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { SuiProbeKey } from '../sui/index.ts';\nimport type { ActionBuildContext } from './build-context.ts';\nimport { actionError, type ActionError } from './errors.ts';\nimport {\n\tcomposeDiscriminatorMaterial,\n\ttype DynamicDiscriminator,\n\ttype StaticDiscriminator,\n} from './discriminator.ts';\nimport { ActionSpans } from './spans.ts';\n\n/** Action receipt — the cached value. Minimal shape: digest is the\n * load-bearing identifier (drives verify probe + downstream\n * consumers); the change arrays are surfaced opaquely (typed\n * `unknown` here so the cache schema stays narrow) but the in-memory\n * shape produced by the `ctx.signAndExecute` helper is\n * `ActionObjectChange` (`{ kind: 'created' | 'mutated', objectId,\n * objectType?, outputState?, idOperation? }`). Consumers can cast or\n * use `findCreatedByType`-style helpers — mirrors v3's\n * `pickCreatedByType(r.objectChanges, ...)` pattern from\n * `examples/connect-four/devstack.config.ts`.\n *\n * Distilled doc §\"Capabilities PRODUCED\" — the v3 Action's `TxResult`\n * carries `digest`, `effects`, `objectChanges`, `balanceChanges`. We\n * narrow to the columns that fit the cache + are actually used by\n * downstream consumers. */\nexport interface ActionReceipt {\n\treadonly digest: string;\n\treadonly objectChanges?: ReadonlyArray<unknown>;\n\treadonly balanceChanges?: ReadonlyArray<unknown>;\n}\n\n/** Schema for the cached `ActionReceipt`. `objectChanges` /\n * `balanceChanges` are `Unknown`-typed arrays — we don't enforce the\n * SDK's wide change-shape here because callers project these\n * manually (mirrors v3's `pickCreatedByType(r.objectChanges, ...)`\n * pattern from `examples/connect-four/devstack.config.ts`). */\nexport const ActionReceiptSchema = Schema.Struct({\n\tdigest: Schema.String,\n\tobjectChanges: Schema.optional(Schema.Array(Schema.Unknown)),\n\tbalanceChanges: Schema.optional(Schema.Array(Schema.Unknown)),\n});\n\n/** Verify-probe shape — what `getTransaction(digest)` returns on\n * success. We don't decode the full transaction envelope; presence\n * of the digest field is the \"exists\" signal. The lenient probe\n * already coerces transient + not-found to null. */\nconst VerifyTxShape = Schema.Struct({\n\tdigest: Schema.String,\n});\n\n/** Per-acquire inputs handed to `bootActionService`. The dynamic\n * discriminator is pre-resolved by `index.ts` — at this layer the\n * `staticDiscriminator` + optional `dynamicMaterial` string suffice. */\nexport interface ActionAcquireInputs {\n\treadonly actionName: string;\n\treadonly chainId: ChainId;\n\treadonly staticDiscriminator: StaticDiscriminator;\n\t/** Resolved dynamic-discriminator material — already projected to\n\t * a string at acquire-time by `index.ts` (the callback form\n\t * receives the `ActionBuildContext` there). */\n\treadonly dynamicMaterial: Effect.Effect<string | undefined, ActionError>;\n\t/** The user's body Effect. Receives no parameter — it closes over\n\t * upstream-tag values via the outer `acquire` scope. Returns the\n\t * receipt of the on-chain effect; the plugin caches this. */\n\treadonly body: Effect.Effect<ActionReceipt, ActionError, Scope.Scope>;\n}\n\n/** Resolve a `DynamicDiscriminator` against the action's\n * action context and resolved dependency values. Two input shapes\n * (per `DynamicDiscriminator`) collapse onto\n * `Effect<string | undefined, ActionError>`. */\nexport const resolveDiscriminator = <Deps>(\n\tdynamic: DynamicDiscriminator<Deps> | undefined,\n\tctx: ActionBuildContext,\n\tdeps: Deps,\n): Effect.Effect<string | undefined, ActionError> => {\n\tif (dynamic === undefined) return Effect.succeed(undefined);\n\tif (typeof dynamic === 'string') return Effect.succeed(dynamic);\n\t// The dynamic discriminator's error channel is typed `ActionError`\n\t// (see `DynamicDiscriminator<Deps>` in `discriminator.ts`), so user\n\t// failures already arrive in the tagged shape — no wrap or\n\t// re-projection needed. (Prior code ran `Effect.catch` to fall\n\t// through tag-or-wrap, but the channel is exhaustively\n\t// ActionError; the wrap branch was unreachable.)\n\treturn dynamic(ctx, deps);\n};\n\n/** Build the verify-probe Effect for a given cached digest. Lenient\n * mode coerces transient + not-found to null; the substrate then\n * re-produces on null. */\nconst buildVerifyProbe = (\n\tprobe: ChainProbe<SuiProbeKey>,\n\tcachedDigest: string,\n): Effect.Effect<typeof VerifyTxShape.Type | null, never> =>\n\tprobe.get({ kind: 'transaction', digest: cachedDigest }, VerifyTxShape, 'lenient').pipe(\n\t\t// `decode-failed` on verify is stale shape — null so the\n\t\t// substrate re-fires rather than carry forward a mismatch.\n\t\tEffect.catch(() => Effect.succeed(null as typeof VerifyTxShape.Type | null)),\n\t);\n\n/** Main acquire body. Composes the ArtifactSpec for the action\n * and yields it to the publisher.\n *\n * Returns the cached/produced `ActionReceipt`. Errors flow as\n * `ActionError | ArtifactPublishError` — the latter when the substrate\n * itself surfaces a produce-failure wrap. */\nexport const bootActionService = (\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tinputs: ActionAcquireInputs,\n): Effect.Effect<ActionReceipt, ActionError | ArtifactPublishError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t[ActionSpans.name]: inputs.actionName,\n\t\t\t[ActionSpans.chain]: inputs.chainId,\n\t\t});\n\n\t\t// --- Pull the pre-projected dynamic-discriminator material\n\t\t// (every acquire — hit OR miss). The callback form's\n\t\t// `(ctx) => Effect<string>` is invoked by `index.ts` before\n\t\t// reaching here, so this layer sees only the resolved Effect.\n\t\tconst resolvedDynamic = yield* inputs.dynamicMaterial;\n\n\t\t// --- Compose content-hash inputs\n\t\tconst material = composeDiscriminatorMaterial(inputs.staticDiscriminator, resolvedDynamic);\n\t\tconst inputsHash = brandContentHash(createHash('sha256').update(material).digest('hex'));\n\n\t\t// --- Phase-preserving produce.\n\t\t//\n\t\t// `publisher.publish`'s `produce` channel must surface failures\n\t\t// as `ArtifactPublishError` per the substrate contract. That\n\t\t// erases the original `ActionError.phase`.\n\t\t// `withPhasePreservingProduce` stashes the typed `ActionError`\n\t\t// in a Ref BEFORE the mapError boundary so the outer recovery\n\t\t// (`recoverTypedError`) can re-raise it untouched. The caller in\n\t\t// `index.ts` then sees the original `phase` rather than a\n\t\t// uniformly-stamped `'sign'`.\n\t\tconst typedProduce = Effect.gen(function* () {\n\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t[ActionSpans.phase]: 'building',\n\t\t\t});\n\t\t\t// `inputs.body` is a USER-SUPPLIED Effect. Two failure\n\t\t\t// surfaces must collapse onto a single `ActionError`:\n\t\t\t//\n\t\t\t// 1. Typed `ActionError` on the failure channel —\n\t\t\t// `catchTag('ActionError')` re-raises untouched so\n\t\t\t// the original `phase` survives.\n\t\t\t// 2. Defects (sync `throw` inside the body, `die(...)`)\n\t\t\t// bypass typed catches entirely — `catchCause` is\n\t\t\t// the only seam that sees them. Defects get\n\t\t\t// rebadged to `phase: 'sign'` so a user body that\n\t\t\t// throws lands on the typed channel rather than\n\t\t\t// crashing the produce step. Interrupt-only causes\n\t\t\t// propagate untouched so cancellation semantics\n\t\t\t// survive.\n\t\t\tconst receipt: ActionReceipt = yield* inputs.body.pipe(\n\t\t\t\tEffect.catchCause((cause) => {\n\t\t\t\t\t// 1. Typed `ActionError` on the failure channel —\n\t\t\t\t\t// re-raise untouched so the original `phase`\n\t\t\t\t\t// survives the downstream re-wrap step.\n\t\t\t\t\tconst failed = Cause.findError(cause);\n\t\t\t\t\tif (failed._tag === 'Success') {\n\t\t\t\t\t\treturn Effect.fail(failed.success);\n\t\t\t\t\t}\n\t\t\t\t\t// 2. Interrupt-only causes propagate untouched so\n\t\t\t\t\t// cancellation semantics survive.\n\t\t\t\t\tif (Cause.hasInterruptsOnly(cause)) {\n\t\t\t\t\t\treturn Effect.failCause(cause);\n\t\t\t\t\t}\n\t\t\t\t\t// 3. Defects (sync `throw` inside the body, `die(...)`)\n\t\t\t\t\t// bypass typed catches entirely — `catchCause` is\n\t\t\t\t\t// the only seam that sees them. Rebadge to\n\t\t\t\t\t// `phase: 'sign'` so a user body that throws\n\t\t\t\t\t// lands on the typed channel rather than crashing\n\t\t\t\t\t// the produce step.\n\t\t\t\t\tconst defect = Cause.findDefect(cause);\n\t\t\t\t\tconst defectValue =\n\t\t\t\t\t\tdefect._tag === 'Success' ? defect.success : Cause.squash(cause);\n\t\t\t\t\treturn Effect.fail(\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName: inputs.actionName,\n\t\t\t\t\t\t\tmessage: `Action '${inputs.actionName}': body Effect raised a defect.`,\n\t\t\t\t\t\t\tcause: defectValue,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t);\n\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t[ActionSpans.phase]: 'parsing',\n\t\t\t\t[ActionSpans.digest]: receipt.digest,\n\t\t\t});\n\t\t\treturn receipt;\n\t\t});\n\n\t\tconst { wrappedProduce, recoverTypedError } = yield* withPhasePreservingProduce({\n\t\t\tproduce: typedProduce,\n\t\t\twrapProduceError: (err: ActionError): ArtifactPublishError =>\n\t\t\t\tartifactPublishError(\n\t\t\t\t\t'produce-failed',\n\t\t\t\t\t`action.${inputs.actionName} ${err.phase}: ${err.message}`,\n\t\t\t\t),\n\t\t});\n\n\t\t// --- Submit the spec to the publisher.\n\t\t//\n\t\t// The artifact publisher substrate decodes the cached `ActionReceipt` and\n\t\t// passes it into `verify(cached)` — so the verify Effect can\n\t\t// pull the digest off the cached payload directly. No\n\t\t// in-process registry-hop required (mirrors the seam pattern\n\t\t// the package plugin's mode-local TODO calls out).\n\t\tconst receipt: ActionReceipt = yield* acquireOnChainArtifact<\n\t\t\tActionReceipt,\n\t\t\ttypeof VerifyTxShape.Type\n\t\t>(publisher, {\n\t\t\tnamespace: 'action',\n\t\t\tchain: inputs.chainId,\n\t\t\tcontentHash: inputsHash,\n\t\t\tverify: (cached) => buildVerifyProbe(probe, cached.digest),\n\t\t\tproduce: wrappedProduce,\n\t\t}).pipe(recoverTypedError);\n\n\t\t// The substrate hands back the decoded `ActionReceipt` on every\n\t\t// path (decoded cached payload on hit, fresh produce on miss).\n\t\treturn receipt;\n\t}).pipe(\n\t\t// Outer span so the per-action `annotateCurrentSpan` annotations\n\t\t// above attach to a real span instead of dropping silently when\n\t\t// `bootActionService` is invoked outside a parent span.\n\t\tEffect.withSpan('devstack.plugin.action.boot', {\n\t\t\tattributes: {\n\t\t\t\t[ActionSpans.name]: inputs.actionName,\n\t\t\t\t[ActionSpans.chain]: inputs.chainId,\n\t\t\t},\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;AAmFmC,OAAO,OAAO;CAChD,QAAQ,OAAO;CACf,eAAe,OAAO,SAAS,OAAO,MAAM,OAAO,QAAQ,CAAC;CAC5D,gBAAgB,OAAO,SAAS,OAAO,MAAM,OAAO,QAAQ,CAAC;CAC7D,CAAC;;;;;AAMF,MAAM,gBAAgB,OAAO,OAAO,EACnC,QAAQ,OAAO,QACf,CAAC;;;;;AAuBF,MAAa,wBACZ,SACA,KACA,SACoD;AACpD,KAAI,YAAY,KAAA,EAAW,QAAO,OAAO,QAAQ,KAAA,EAAU;AAC3D,KAAI,OAAO,YAAY,SAAU,QAAO,OAAO,QAAQ,QAAQ;AAO/D,QAAO,QAAQ,KAAK,KAAK;;;;;AAM1B,MAAM,oBACL,OACA,iBAEA,MAAM,IAAI;CAAE,MAAM;CAAe,QAAQ;CAAc,EAAE,eAAe,UAAU,CAAC,KAGlF,OAAO,YAAY,OAAO,QAAQ,KAAyC,CAAC,CAC5E;;;;;;;AAQF,MAAa,qBACZ,WACA,OACA,WAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB;GAChC,YAAY,OAAO,OAAO;GAC1B,YAAY,QAAQ,OAAO;EAC5B,CAAC;CAMF,MAAM,kBAAkB,OAAO,OAAO;CAGtC,MAAM,WAAW,6BAA6B,OAAO,qBAAqB,gBAAgB;CAC1F,MAAM,aAAaA,YAAiB,WAAW,SAAS,CAAC,OAAO,SAAS,CAAC,OAAO,MAAM,CAAC;CAqExF,MAAM,EAAE,gBAAgB,sBAAsB,OAAO,2BAA2B;EAC/E,SA1DoB,OAAO,IAAI,aAAa;AAC5C,UAAO,OAAO,oBAAoB,GAChC,YAAY,QAAQ,YACrB,CAAC;GAeF,MAAM,UAAyB,OAAO,OAAO,KAAK,KACjD,OAAO,YAAY,UAAU;IAI5B,MAAM,SAAS,MAAM,UAAU,MAAM;AACrC,QAAI,OAAO,SAAS,UACnB,QAAO,OAAO,KAAK,OAAO,QAAQ;AAInC,QAAI,MAAM,kBAAkB,MAAM,CACjC,QAAO,OAAO,UAAU,MAAM;IAQ/B,MAAM,SAAS,MAAM,WAAW,MAAM;IACtC,MAAM,cACL,OAAO,SAAS,YAAY,OAAO,UAAU,MAAM,OAAO,MAAM;AACjE,WAAO,OAAO,KACb,YAAY,QAAQ;KACnB,YAAY,OAAO;KACnB,SAAS,WAAW,OAAO,WAAW;KACtC,OAAO;KACP,CAAC,CACF;KACA,CACF;AACD,UAAO,OAAO,oBAAoB;KAChC,YAAY,QAAQ;KACpB,YAAY,SAAS,QAAQ;IAC9B,CAAC;AACF,UAAO;IAIc;EACrB,mBAAmB,QAClB,qBACC,kBACA,UAAU,OAAO,WAAW,GAAG,IAAI,MAAM,IAAI,IAAI,UACjD;EACF,CAAC;AAsBF,QAAO,OAb+B,uBAGpC,WAAW;EACZ,WAAW;EACX,OAAO,OAAO;EACd,aAAa;EACb,SAAS,WAAW,iBAAiB,OAAO,OAAO,OAAO;EAC1D,SAAS;EACT,CAAC,CAAC,KAAK,kBAAkB;EAKzB,CAAC,KAIF,OAAO,SAAS,+BAA+B,EAC9C,YAAY;EACV,YAAY,OAAO,OAAO;EAC1B,YAAY,QAAQ,OAAO;CAC5B,EACD,CAAC,CACF"}
1
+ {"version":3,"file":"service.mjs","names":["brandContentHash"],"sources":["../../../src/plugins/action/service.ts"],"sourcesContent":["// Action plugin — main acquire body.\n//\n// Architecture (16-action.md): an action is a ONE-SHOT on-chain effect\n// that runs once per (chain × content-hash), caches its receipt, and\n// re-fires when its discriminator changes (or the chain regenesises).\n//\n// Implementation: thin wrapper over `ArtifactPublisher`. The\n// substrate handles the cache → verify → produce → register cycle; this\n// file composes the spec:\n//\n// - namespace = `action`\n// - chainId = Sui dependency's resolved `chainId`\n// - contentHash = hash of (actionName, upstreamResourceIds[], dynamic\n// discriminator if any)\n// - verify = `chainProbe.get({kind:'transaction', digest},\n// VerifyTxShape, 'lenient')` — null on transient\n// or not-found, NOT raise.\n// - produce = user's `body(ctx)` Effect. Wraps any non-tagged\n// throw in `ActionError({phase:'sign'})`.\n// - register = no-op (Action declares no in-process registry —\n// it does NOT populate any in-process registries).\n//\n// Constraints honored:\n//\n// - Cache key folds (name, chainId, dependency resource ids, discriminator?) —\n// 16-action.md invariant #1.\n// - Dynamic discriminator re-runs on EVERY acquire — invariant #6.\n// - Lenient verify probe — invariant #4.\n// - signAndExecute failure routes via ActionError(phase: 'sign') —\n// invariant #8 (tagged separately so action consumers\n// `catchTag('ActionError')` without clashing with package's tagged\n// error).\n\nimport { createHash } from 'node:crypto';\n\nimport { Cause, Effect, Schema, type Scope } from 'effect';\n\nimport { contentHash as brandContentHash } from '../../substrate/brand.ts';\nimport {\n\tartifactPublishError,\n\ttype ArtifactPublishError,\n\ttype ArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport { acquireOnChainArtifact } from '../internal/acquire-on-chain-artifact.ts';\nimport { withPhasePreservingProduce } from '../../substrate/runtime/phase-preserving-produce.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { SuiProbeKey } from '../sui/index.ts';\nimport type { ActionBuildContext } from './build-context.ts';\nimport { actionError, type ActionError } from './errors.ts';\nimport {\n\tcomposeDiscriminatorMaterial,\n\ttype DynamicDiscriminator,\n\ttype StaticDiscriminator,\n} from './discriminator.ts';\n\n/** Action receipt — the cached value. Minimal shape: digest is the\n * load-bearing identifier (drives verify probe + downstream\n * consumers); the change arrays are surfaced opaquely (typed\n * `unknown` here so the cache schema stays narrow) but the in-memory\n * shape produced by the `ctx.signAndExecute` helper is\n * `ActionObjectChange` (`{ kind: 'created' | 'mutated', objectId,\n * objectType?, outputState?, idOperation? }`). Consumers can cast or\n * use `findCreatedByType`-style helpers, e.g.\n * `pickCreatedByType(r.objectChanges, ...)` (see\n * `examples/connect-four/devstack.config.ts`).\n *\n * The receipt narrows to the columns that fit the cache + are actually\n * used by downstream consumers. */\nexport interface ActionReceipt {\n\treadonly digest: string;\n\treadonly objectChanges?: ReadonlyArray<unknown>;\n\treadonly balanceChanges?: ReadonlyArray<unknown>;\n}\n\n/** Schema for the cached `ActionReceipt`. `objectChanges` /\n * `balanceChanges` are `Unknown`-typed arrays — we don't enforce the\n * SDK's wide change-shape here because callers project these\n * manually (e.g. `pickCreatedByType(r.objectChanges, ...)`; see\n * `examples/connect-four/devstack.config.ts`). */\nexport const ActionReceiptSchema = Schema.Struct({\n\tdigest: Schema.String,\n\tobjectChanges: Schema.optional(Schema.Array(Schema.Unknown)),\n\tbalanceChanges: Schema.optional(Schema.Array(Schema.Unknown)),\n});\n\n/** Verify-probe shape — what `getTransaction(digest)` returns on\n * success. We don't decode the full transaction envelope; presence\n * of the digest field is the \"exists\" signal. The lenient probe\n * already coerces transient + not-found to null. */\nconst VerifyTxShape = Schema.Struct({\n\tdigest: Schema.String,\n});\n\n/** Per-acquire inputs handed to `bootActionService`. The dynamic\n * discriminator is pre-resolved by `index.ts` — at this layer the\n * `staticDiscriminator` + optional `dynamicMaterial` string suffice. */\nexport interface ActionAcquireInputs {\n\treadonly actionName: string;\n\treadonly chainId: string;\n\treadonly staticDiscriminator: StaticDiscriminator;\n\t/** Resolved dynamic-discriminator material — already projected to\n\t * a string at acquire-time by `index.ts` (the callback form\n\t * receives the `ActionBuildContext` there). */\n\treadonly dynamicMaterial: Effect.Effect<string | undefined, ActionError>;\n\t/** The user's body Effect. Receives no parameter — it closes over\n\t * upstream-tag values via the outer `acquire` scope. Returns the\n\t * receipt of the on-chain effect; the plugin caches this. */\n\treadonly body: Effect.Effect<ActionReceipt, ActionError, Scope.Scope>;\n}\n\n/** Resolve a `DynamicDiscriminator` against the action's\n * action context and resolved dependency values. Two input shapes\n * (per `DynamicDiscriminator`) collapse onto\n * `Effect<string | undefined, ActionError>`. */\nexport const resolveDiscriminator = <Deps>(\n\tdynamic: DynamicDiscriminator<Deps> | undefined,\n\tctx: ActionBuildContext,\n\tdeps: Deps,\n): Effect.Effect<string | undefined, ActionError> => {\n\tif (dynamic === undefined) return Effect.succeed(undefined);\n\tif (typeof dynamic === 'string') return Effect.succeed(dynamic);\n\t// The dynamic discriminator's error channel is typed `ActionError`\n\t// (see `DynamicDiscriminator<Deps>` in `discriminator.ts`), so user\n\t// failures already arrive in the tagged shape — no wrap or\n\t// re-projection needed. (Prior code ran `Effect.catch` to fall\n\t// through tag-or-wrap, but the channel is exhaustively\n\t// ActionError; the wrap branch was unreachable.)\n\treturn dynamic(ctx, deps);\n};\n\n/** Build the verify-probe Effect for a given cached digest. Lenient\n * mode coerces transient + not-found to null; the substrate then\n * re-produces on null. */\nconst buildVerifyProbe = (\n\tprobe: ChainProbe<SuiProbeKey>,\n\tcachedDigest: string,\n): Effect.Effect<typeof VerifyTxShape.Type | null, never> =>\n\tprobe.get({ kind: 'transaction', digest: cachedDigest }, VerifyTxShape, 'lenient').pipe(\n\t\t// `decode-failed` on verify is stale shape — null so the\n\t\t// substrate re-fires rather than carry forward a mismatch.\n\t\tEffect.catch(() => Effect.succeed(null as typeof VerifyTxShape.Type | null)),\n\t);\n\n/** Main acquire body. Composes the ArtifactSpec for the action\n * and yields it to the publisher.\n *\n * Returns the cached/produced `ActionReceipt`. Errors flow as\n * `ActionError | ArtifactPublishError` — the latter when the substrate\n * itself surfaces a produce-failure wrap. */\nexport const bootActionService = (\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tinputs: ActionAcquireInputs,\n): Effect.Effect<ActionReceipt, ActionError | ArtifactPublishError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\t// --- Pull the pre-projected dynamic-discriminator material\n\t\t// (every acquire — hit OR miss). The callback form's\n\t\t// `(ctx) => Effect<string>` is invoked by `index.ts` before\n\t\t// reaching here, so this layer sees only the resolved Effect.\n\t\tconst resolvedDynamic = yield* inputs.dynamicMaterial;\n\n\t\t// --- Compose content-hash inputs\n\t\tconst material = composeDiscriminatorMaterial(inputs.staticDiscriminator, resolvedDynamic);\n\t\tconst inputsHash = brandContentHash(createHash('sha256').update(material).digest('hex'));\n\n\t\t// --- Phase-preserving produce.\n\t\t//\n\t\t// `publisher.publish`'s `produce` channel must surface failures\n\t\t// as `ArtifactPublishError` per the substrate contract. That\n\t\t// erases the original `ActionError.phase`.\n\t\t// `withPhasePreservingProduce` stashes the typed `ActionError`\n\t\t// in a Ref BEFORE the mapError boundary so the outer recovery\n\t\t// (`recoverTypedError`) can re-raise it untouched. The caller in\n\t\t// `index.ts` then sees the original `phase` rather than a\n\t\t// uniformly-stamped `'sign'`.\n\t\tconst typedProduce = Effect.gen(function* () {\n\t\t\t// `inputs.body` is a USER-SUPPLIED Effect. Two failure\n\t\t\t// surfaces must collapse onto a single `ActionError`:\n\t\t\t//\n\t\t\t// 1. Typed `ActionError` on the failure channel —\n\t\t\t// `catchTag('ActionError')` re-raises untouched so\n\t\t\t// the original `phase` survives.\n\t\t\t// 2. Defects (sync `throw` inside the body, `die(...)`)\n\t\t\t// bypass typed catches entirely — `catchCause` is\n\t\t\t// the only seam that sees them. Defects get\n\t\t\t// rebadged to `phase: 'sign'` so a user body that\n\t\t\t// throws lands on the typed channel rather than\n\t\t\t// crashing the produce step. Interrupt-only causes\n\t\t\t// propagate untouched so cancellation semantics\n\t\t\t// survive.\n\t\t\tconst receipt: ActionReceipt = yield* inputs.body.pipe(\n\t\t\t\tEffect.catchCause((cause) => {\n\t\t\t\t\t// 1. Typed `ActionError` on the failure channel —\n\t\t\t\t\t// re-raise untouched so the original `phase`\n\t\t\t\t\t// survives the downstream re-wrap step.\n\t\t\t\t\tconst failed = Cause.findError(cause);\n\t\t\t\t\tif (failed._tag === 'Success') {\n\t\t\t\t\t\treturn Effect.fail(failed.success);\n\t\t\t\t\t}\n\t\t\t\t\t// 2. Interrupt-only causes propagate untouched so\n\t\t\t\t\t// cancellation semantics survive.\n\t\t\t\t\tif (Cause.hasInterruptsOnly(cause)) {\n\t\t\t\t\t\treturn Effect.failCause(cause);\n\t\t\t\t\t}\n\t\t\t\t\t// 3. Defects (sync `throw` inside the body, `die(...)`)\n\t\t\t\t\t// bypass typed catches entirely — `catchCause` is\n\t\t\t\t\t// the only seam that sees them. Rebadge to\n\t\t\t\t\t// `phase: 'sign'` so a user body that throws\n\t\t\t\t\t// lands on the typed channel rather than crashing\n\t\t\t\t\t// the produce step.\n\t\t\t\t\tconst defect = Cause.findDefect(cause);\n\t\t\t\t\tconst defectValue = defect._tag === 'Success' ? defect.success : Cause.squash(cause);\n\t\t\t\t\treturn Effect.fail(\n\t\t\t\t\t\tactionError('sign', {\n\t\t\t\t\t\t\tactionName: inputs.actionName,\n\t\t\t\t\t\t\tmessage: `Action '${inputs.actionName}': body Effect raised a defect.`,\n\t\t\t\t\t\t\tcause: defectValue,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn receipt;\n\t\t});\n\n\t\tconst { wrappedProduce, recoverTypedError } = yield* withPhasePreservingProduce({\n\t\t\tproduce: typedProduce,\n\t\t\twrapProduceError: (err: ActionError): ArtifactPublishError =>\n\t\t\t\tartifactPublishError(\n\t\t\t\t\t'produce-failed',\n\t\t\t\t\t`action.${inputs.actionName} ${err.phase}: ${err.message}`,\n\t\t\t\t),\n\t\t});\n\n\t\t// --- Submit the spec to the publisher.\n\t\t//\n\t\t// The artifact publisher substrate decodes the cached `ActionReceipt` and\n\t\t// passes it into `verify(cached)` — so the verify Effect can\n\t\t// pull the digest off the cached payload directly. No\n\t\t// in-process registry-hop required (mirrors the seam pattern\n\t\t// the package plugin's mode-local TODO calls out).\n\t\tconst receipt: ActionReceipt = yield* acquireOnChainArtifact<\n\t\t\tActionReceipt,\n\t\t\ttypeof VerifyTxShape.Type\n\t\t>(publisher, {\n\t\t\tnamespace: 'action',\n\t\t\tchain: inputs.chainId,\n\t\t\tcontentHash: inputsHash,\n\t\t\tverify: (cached) => buildVerifyProbe(probe, cached.digest),\n\t\t\tproduce: wrappedProduce,\n\t\t}).pipe(recoverTypedError);\n\n\t\t// The substrate hands back the decoded `ActionReceipt` on every\n\t\t// path (decoded cached payload on hit, fresh produce on miss).\n\t\treturn receipt;\n\t});\n"],"mappings":";;;;;;;;AA+EmC,OAAO,OAAO;CAChD,QAAQ,OAAO;CACf,eAAe,OAAO,SAAS,OAAO,MAAM,OAAO,OAAO,CAAC;CAC3D,gBAAgB,OAAO,SAAS,OAAO,MAAM,OAAO,OAAO,CAAC;AAC7D,CAAC;;;;;AAMD,MAAM,gBAAgB,OAAO,OAAO,EACnC,QAAQ,OAAO,OAChB,CAAC;;;;;AAuBD,MAAa,wBACZ,SACA,KACA,SACoD;CACpD,IAAI,YAAY,KAAA,GAAW,OAAO,OAAO,QAAQ,KAAA,CAAS;CAC1D,IAAI,OAAO,YAAY,UAAU,OAAO,OAAO,QAAQ,OAAO;CAO9D,OAAO,QAAQ,KAAK,IAAI;AACzB;;;;AAKA,MAAM,oBACL,OACA,iBAEA,MAAM,IAAI;CAAE,MAAM;CAAe,QAAQ;AAAa,GAAG,eAAe,SAAS,CAAC,CAAC,KAGlF,OAAO,YAAY,OAAO,QAAQ,IAAwC,CAAC,CAC5E;;;;;;;AAQD,MAAa,qBACZ,WACA,OACA,WAEA,OAAO,IAAI,aAAa;CAKvB,MAAM,kBAAkB,OAAO,OAAO;CAGtC,MAAM,WAAW,6BAA6B,OAAO,qBAAqB,eAAe;CACzF,MAAM,aAAaA,YAAiB,WAAW,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC;CA6DvF,MAAM,EAAE,gBAAgB,sBAAsB,OAAO,2BAA2B;EAC/E,SAlDoB,OAAO,IAAI,aAAa;GA8C5C,OAAO,OA/B+B,OAAO,KAAK,KACjD,OAAO,YAAY,UAAU;IAI5B,MAAM,SAAS,MAAM,UAAU,KAAK;IACpC,IAAI,OAAO,SAAS,WACnB,OAAO,OAAO,KAAK,OAAO,OAAO;IAIlC,IAAI,MAAM,kBAAkB,KAAK,GAChC,OAAO,OAAO,UAAU,KAAK;IAQ9B,MAAM,SAAS,MAAM,WAAW,KAAK;IACrC,MAAM,cAAc,OAAO,SAAS,YAAY,OAAO,UAAU,MAAM,OAAO,KAAK;IACnF,OAAO,OAAO,KACb,YAAY,QAAQ;KACnB,YAAY,OAAO;KACnB,SAAS,WAAW,OAAO,WAAW;KACtC,OAAO;IACR,CAAC,CACF;GACD,CAAC,CACF;EAED,CAGqB;EACpB,mBAAmB,QAClB,qBACC,kBACA,UAAU,OAAO,WAAW,GAAG,IAAI,MAAM,IAAI,IAAI,SAClD;CACF,CAAC;CAsBD,OAAO,OAb+B,uBAGpC,WAAW;EACZ,WAAW;EACX,OAAO,OAAO;EACd,aAAa;EACb,SAAS,WAAW,iBAAiB,OAAO,OAAO,MAAM;EACzD,SAAS;CACV,CAAC,CAAC,CAAC,KAAK,iBAAiB;AAK1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"address-resolution.mjs","names":[],"sources":["../../../src/plugins/coin/address-resolution.ts"],"sourcesContent":["// Coin address-resolution — the three user-facing forms unified.\n//\n// Distilled-doc 13-coin.md §Configuration: the user-facing\n// `coin(...)` factory takes one of three address forms. Each form\n// resolves to a `ResolvedCoin`:\n//\n// 1. **Package-scoped witness** — `coin.fromPackage(pkg, 'MOCK_USDC')`.\n// Forces a dependency edge on the publishing package resource, then\n// reads its publish output's discovered coins. Statically typed\n// against local packages only (KnownPackages have no output).\n//\n// 2. **Bare on-chain type** — `coin.known('0x...::DEEP::DEEP')`.\n// Bypasses the registry; calls `getCoinMetadata` against the\n// resolved Sui client. Use for live-net coins (mainnet DEEP).\n//\n// 3. **Builtin SUI** — `coin.builtin('sui')`. Pure constant.\n// Resolves to `0x2::sui::SUI` with `decimals: 9` synchronously.\n//\n// Each form returns a `ResolvedCoin` carrying the same shape so\n// downstream consumers (Wallet balance UI, Faucet treasury-cap mint,\n// Deepbook market maker) see one consistent value.\n\nimport { Effect } from 'effect';\n\nimport { coinError, type CoinError } from './errors.ts';\nimport {\n\tfetchCoinMetadataOnce,\n\tisBareCoinType,\n\tvalidateBareCoinType,\n\ttype MetadataSdkShim,\n} from './metadata.ts';\nimport type { CoinRecord, CoinRegistry } from './registry.ts';\n\n/** The Tag's resolved value. One uniform shape across all three\n * address forms — downstream consumers branch on `source` only if\n * they care about provenance. */\nexport interface ResolvedCoin {\n\treadonly fullCoinType: string;\n\treadonly decimals: number;\n\treadonly source: 'registry' | 'on-chain' | 'builtin';\n\treadonly symbol?: string;\n\treadonly displayName?: string;\n\treadonly iconUrl?: string;\n\treadonly treasuryCapId?: string;\n\treadonly metadataId?: string;\n\treadonly packageId?: string;\n}\n\n// -----------------------------------------------------------------------------\n// Builtin SUI\n// -----------------------------------------------------------------------------\n\n/** Distilled-doc 13-coin.md Invariant 4: `BUILTIN_COINS.sui` MUST\n * always be `0x2::sui::SUI` with `decimals: 9`. Protocol-defined; any\n * divergence breaks downstream guards (Deepbook's SUI guard, the\n * balance UI's canonical-type compare). */\nexport const BUILTIN_COINS = {\n\tsui: {\n\t\tfullCoinType: '0x2::sui::SUI',\n\t\tdecimals: 9,\n\t\tsource: 'builtin' as const,\n\t\tsymbol: 'SUI',\n\t\tdisplayName: 'Sui',\n\t} satisfies ResolvedCoin,\n} as const;\n\nexport type BuiltinCoinName = keyof typeof BUILTIN_COINS;\n\n/** Resolve a builtin coin. Pure constant — no Effect, no upstream. */\nexport const resolveBuiltin = (name: BuiltinCoinName): ResolvedCoin => BUILTIN_COINS[name];\n\n// -----------------------------------------------------------------------------\n// Registry record projection\n// -----------------------------------------------------------------------------\n\n/** Project a `CoinRecord` to the resolved-value shape. Shared across\n * registry-backed forms. */\nconst projectRecord = (record: CoinRecord, source: 'registry'): ResolvedCoin => ({\n\tfullCoinType: record.type,\n\tdecimals: record.decimals,\n\tsource,\n\t...(record.symbol !== undefined ? { symbol: record.symbol } : {}),\n\t...(record.displayName !== undefined ? { displayName: record.displayName } : {}),\n\t...(record.iconUrl !== undefined ? { iconUrl: record.iconUrl } : {}),\n\t...(record.treasuryCapId !== undefined ? { treasuryCapId: record.treasuryCapId } : {}),\n\t...(record.metadataId !== undefined ? { metadataId: record.metadataId } : {}),\n\tpackageId: record.packageId,\n});\n\n// -----------------------------------------------------------------------------\n// Form 1: package-scoped witness → registry\n// -----------------------------------------------------------------------------\n\n/** Resolve a coin by `(publishing package's symbolic name, witness)`.\n * Distilled-doc 13-coin.md §\"Lifecycle\" path 3: the caller yields\n * the package tag first to force the dep edge; this helper assumes\n * the registry is already populated by the time it runs. */\nexport const resolveByWitness = (\n\tregistry: CoinRegistry,\n\tpackageName: string,\n\twitness: string,\n): Effect.Effect<ResolvedCoin, CoinError> =>\n\tEffect.gen(function* () {\n\t\tconst record = yield* registry.byWitness(packageName, witness);\n\t\tif (record === null) {\n\t\t\tconst candidates = (yield* registry.list())\n\t\t\t\t.filter((r) => r.publishingPackageName === packageName)\n\t\t\t\t.map((r) => r.symbol ?? r.witness);\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tcoinError('not-found', {\n\t\t\t\t\tidentifier: `${packageName}::${witness}`,\n\t\t\t\t\tmessage: `coin.fromPackage('${packageName}', '${witness}'): witness not present in the package's discovered coins.`,\n\t\t\t\t\tcandidates,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn projectRecord(record, 'registry');\n\t});\n\n// -----------------------------------------------------------------------------\n// Form 2: bare on-chain type → live RPC\n// -----------------------------------------------------------------------------\n\n/** Resolve a coin by bare on-chain type. Calls `getCoinMetadata`\n * against the resolved Sui client; soft-degrades to `decimals: 0` on\n * RPC failure (distilled-doc 13-coin.md Failure modes table).\n *\n * Bare type is validated first (distilled-doc invariant 7: refuses\n * nested generics). The validator surfaces `CoinError('nested-\n * generic')`; everything else falls through to the lenient fetch. */\nexport const resolveByBareType = (\n\tsdk: MetadataSdkShim,\n\tfullCoinType: string,\n): Effect.Effect<ResolvedCoin, CoinError> =>\n\tEffect.gen(function* () {\n\t\tconst validation = validateBareCoinType(fullCoinType);\n\t\tif (validation !== null) {\n\t\t\treturn yield* Effect.fail(validation);\n\t\t}\n\t\tif (!isBareCoinType(fullCoinType)) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tcoinError('not-found', {\n\t\t\t\t\tidentifier: fullCoinType,\n\t\t\t\t\tmessage: `coin.known('${fullCoinType}'): not a bare on-chain coin type — expected '0xHEX::module::Witness'.`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tconst metadata = yield* fetchCoinMetadataOnce(sdk, fullCoinType);\n\t\tif (metadata === null) {\n\t\t\t// Soft-degradation: surface a record with decimals=0 and no\n\t\t\t// metadata. Downstream consumers that NEED metadata see\n\t\t\t// degraded fields — but we don't fail boot.\n\t\t\treturn {\n\t\t\t\tfullCoinType,\n\t\t\t\tdecimals: 0,\n\t\t\t\tsource: 'on-chain',\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tfullCoinType,\n\t\t\tdecimals: metadata.decimals,\n\t\t\tsource: 'on-chain',\n\t\t\tsymbol: metadata.symbol,\n\t\t\tdisplayName: metadata.name,\n\t\t\t...(metadata.iconUrl !== undefined ? { iconUrl: metadata.iconUrl } : {}),\n\t\t\tmetadataId: metadata.id,\n\t\t};\n\t});\n"],"mappings":";;;;;;;;AAwDA,MAAa,gBAAgB,EAC5B,KAAK;CACJ,cAAc;CACd,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,aAAa;CACb,EACD;;AAKD,MAAa,kBAAkB,SAAwC,cAAc;;;AAQrF,MAAM,iBAAiB,QAAoB,YAAsC;CAChF,cAAc,OAAO;CACrB,UAAU,OAAO;CACjB;CACA,GAAI,OAAO,WAAW,KAAA,IAAY,EAAE,QAAQ,OAAO,QAAQ,GAAG,EAAE;CAChE,GAAI,OAAO,gBAAgB,KAAA,IAAY,EAAE,aAAa,OAAO,aAAa,GAAG,EAAE;CAC/E,GAAI,OAAO,YAAY,KAAA,IAAY,EAAE,SAAS,OAAO,SAAS,GAAG,EAAE;CACnE,GAAI,OAAO,kBAAkB,KAAA,IAAY,EAAE,eAAe,OAAO,eAAe,GAAG,EAAE;CACrF,GAAI,OAAO,eAAe,KAAA,IAAY,EAAE,YAAY,OAAO,YAAY,GAAG,EAAE;CAC5E,WAAW,OAAO;CAClB;;;;;AAUD,MAAa,oBACZ,UACA,aACA,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,SAAS,UAAU,aAAa,QAAQ;AAC9D,KAAI,WAAW,MAAM;EACpB,MAAM,cAAc,OAAO,SAAS,MAAM,EACxC,QAAQ,MAAM,EAAE,0BAA0B,YAAY,CACtD,KAAK,MAAM,EAAE,UAAU,EAAE,QAAQ;AACnC,SAAO,OAAO,OAAO,KACpB,UAAU,aAAa;GACtB,YAAY,GAAG,YAAY,IAAI;GAC/B,SAAS,qBAAqB,YAAY,MAAM,QAAQ;GACxD;GACA,CAAC,CACF;;AAEF,QAAO,cAAc,QAAQ,WAAW;EACvC;;;;;;;;AAaH,MAAa,qBACZ,KACA,iBAEA,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,qBAAqB,aAAa;AACrD,KAAI,eAAe,KAClB,QAAO,OAAO,OAAO,KAAK,WAAW;AAEtC,KAAI,CAAC,eAAe,aAAa,CAChC,QAAO,OAAO,OAAO,KACpB,UAAU,aAAa;EACtB,YAAY;EACZ,SAAS,eAAe,aAAa;EACrC,CAAC,CACF;CAEF,MAAM,WAAW,OAAO,sBAAsB,KAAK,aAAa;AAChE,KAAI,aAAa,KAIhB,QAAO;EACN;EACA,UAAU;EACV,QAAQ;EACR;AAEF,QAAO;EACN;EACA,UAAU,SAAS;EACnB,QAAQ;EACR,QAAQ,SAAS;EACjB,aAAa,SAAS;EACtB,GAAI,SAAS,YAAY,KAAA,IAAY,EAAE,SAAS,SAAS,SAAS,GAAG,EAAE;EACvE,YAAY,SAAS;EACrB;EACA"}
1
+ {"version":3,"file":"address-resolution.mjs","names":[],"sources":["../../../src/plugins/coin/address-resolution.ts"],"sourcesContent":["// Coin address-resolution — the three user-facing forms unified.\n//\n// Distilled-doc 13-coin.md §Configuration: the user-facing\n// `coin(...)` factory takes one of three address forms. Each form\n// resolves to a `ResolvedCoin`:\n//\n// 1. **Package-scoped witness** — `coin.fromPackage(pkg, 'MOCK_USDC')`.\n// Forces a dependency edge on the publishing package resource, then\n// reads its publish output's discovered coins. Statically typed\n// against local packages only (KnownPackages have no output).\n//\n// 2. **Bare on-chain type** — `coin.known('0x...::DEEP::DEEP')`.\n// Bypasses the registry; calls `getCoinMetadata` against the\n// resolved Sui client. Use for live-net coins (mainnet DEEP).\n//\n// 3. **Builtin SUI** — `coin.builtin('sui')`. Pure constant.\n// Resolves to `0x2::sui::SUI` with `decimals: 9` synchronously.\n//\n// Each form returns a `ResolvedCoin` carrying the same shape so\n// downstream consumers (Wallet balance UI, Faucet treasury-cap mint,\n// Deepbook market maker) see one consistent value.\n\nimport { Effect } from 'effect';\n\nimport { coinError, type CoinError } from './errors.ts';\nimport {\n\tfetchCoinMetadataOnce,\n\tisBareCoinType,\n\tvalidateBareCoinType,\n\ttype MetadataSdkShim,\n} from './metadata.ts';\nimport type { CoinRecord, CoinRegistry } from './registry.ts';\n\n/** The Tag's resolved value. One uniform shape across all three\n * address forms — downstream consumers branch on `source` only if\n * they care about provenance. */\nexport interface ResolvedCoin {\n\treadonly fullCoinType: string;\n\treadonly decimals: number;\n\treadonly source: 'registry' | 'on-chain' | 'builtin';\n\treadonly symbol?: string;\n\treadonly displayName?: string;\n\treadonly iconUrl?: string;\n\treadonly treasuryCapId?: string;\n\treadonly metadataId?: string;\n\treadonly packageId?: string;\n}\n\n// -----------------------------------------------------------------------------\n// Builtin SUI\n// -----------------------------------------------------------------------------\n\n/** Distilled-doc 13-coin.md Invariant 4: `BUILTIN_COINS.sui` MUST\n * always be `0x2::sui::SUI` with `decimals: 9`. Protocol-defined; any\n * divergence breaks downstream guards (Deepbook's SUI guard, the\n * balance UI's canonical-type compare). */\nexport const BUILTIN_COINS = {\n\tsui: {\n\t\tfullCoinType: '0x2::sui::SUI',\n\t\tdecimals: 9,\n\t\tsource: 'builtin' as const,\n\t\tsymbol: 'SUI',\n\t\tdisplayName: 'Sui',\n\t} satisfies ResolvedCoin,\n} as const;\n\nexport type BuiltinCoinName = keyof typeof BUILTIN_COINS;\n\n/** Resolve a builtin coin. Pure constant — no Effect, no upstream. */\nexport const resolveBuiltin = (name: BuiltinCoinName): ResolvedCoin => BUILTIN_COINS[name];\n\n// -----------------------------------------------------------------------------\n// Registry record projection\n// -----------------------------------------------------------------------------\n\n/** Project a `CoinRecord` to the resolved-value shape. Shared across\n * registry-backed forms. */\nconst projectRecord = (record: CoinRecord, source: 'registry'): ResolvedCoin => ({\n\tfullCoinType: record.type,\n\tdecimals: record.decimals,\n\tsource,\n\t...(record.symbol !== undefined ? { symbol: record.symbol } : {}),\n\t...(record.displayName !== undefined ? { displayName: record.displayName } : {}),\n\t...(record.iconUrl !== undefined ? { iconUrl: record.iconUrl } : {}),\n\t...(record.treasuryCapId !== undefined ? { treasuryCapId: record.treasuryCapId } : {}),\n\t...(record.metadataId !== undefined ? { metadataId: record.metadataId } : {}),\n\tpackageId: record.packageId,\n});\n\n// -----------------------------------------------------------------------------\n// Form 1: package-scoped witness → registry\n// -----------------------------------------------------------------------------\n\n/** Resolve a coin by `(publishing package's symbolic name, witness)`.\n * Distilled-doc 13-coin.md §\"Lifecycle\" path 3: the caller yields\n * the package tag first to force the dep edge; this helper assumes\n * the registry is already populated by the time it runs. */\nexport const resolveByWitness = (\n\tregistry: CoinRegistry,\n\tpackageName: string,\n\twitness: string,\n): Effect.Effect<ResolvedCoin, CoinError> =>\n\tEffect.gen(function* () {\n\t\tconst record = yield* registry.byWitness(packageName, witness);\n\t\tif (record === null) {\n\t\t\tconst candidates = (yield* registry.list())\n\t\t\t\t.filter((r) => r.publishingPackageName === packageName)\n\t\t\t\t.map((r) => r.symbol ?? r.witness);\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tcoinError('not-found', {\n\t\t\t\t\tidentifier: `${packageName}::${witness}`,\n\t\t\t\t\tmessage: `coin.fromPackage('${packageName}', '${witness}'): witness not present in the package's discovered coins.`,\n\t\t\t\t\tcandidates,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn projectRecord(record, 'registry');\n\t});\n\n// -----------------------------------------------------------------------------\n// Form 2: bare on-chain type → live RPC\n// -----------------------------------------------------------------------------\n\n/** Resolve a coin by bare on-chain type. Calls `getCoinMetadata`\n * against the resolved Sui client; soft-degrades to `decimals: 0` on\n * RPC failure (distilled-doc 13-coin.md Failure modes table).\n *\n * Bare type is validated first (distilled-doc invariant 7: refuses\n * nested generics). The validator surfaces `CoinError('nested-\n * generic')`; everything else falls through to the lenient fetch. */\nexport const resolveByBareType = (\n\tsdk: MetadataSdkShim,\n\tfullCoinType: string,\n): Effect.Effect<ResolvedCoin, CoinError> =>\n\tEffect.gen(function* () {\n\t\tconst validation = validateBareCoinType(fullCoinType);\n\t\tif (validation !== null) {\n\t\t\treturn yield* Effect.fail(validation);\n\t\t}\n\t\tif (!isBareCoinType(fullCoinType)) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tcoinError('not-found', {\n\t\t\t\t\tidentifier: fullCoinType,\n\t\t\t\t\tmessage: `coin.known('${fullCoinType}'): not a bare on-chain coin type — expected '0xHEX::module::Witness'.`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tconst metadata = yield* fetchCoinMetadataOnce(sdk, fullCoinType);\n\t\tif (metadata === null) {\n\t\t\t// Soft-degradation: surface a record with decimals=0 and no\n\t\t\t// metadata. Downstream consumers that NEED metadata see\n\t\t\t// degraded fields — but we don't fail boot.\n\t\t\treturn {\n\t\t\t\tfullCoinType,\n\t\t\t\tdecimals: 0,\n\t\t\t\tsource: 'on-chain',\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tfullCoinType,\n\t\t\tdecimals: metadata.decimals,\n\t\t\tsource: 'on-chain',\n\t\t\tsymbol: metadata.symbol,\n\t\t\tdisplayName: metadata.name,\n\t\t\t...(metadata.iconUrl !== undefined ? { iconUrl: metadata.iconUrl } : {}),\n\t\t\tmetadataId: metadata.id,\n\t\t};\n\t});\n"],"mappings":";;;;;;;;AAwDA,MAAa,gBAAgB,EAC5B,KAAK;CACJ,cAAc;CACd,UAAU;CACV,QAAQ;CACR,QAAQ;CACR,aAAa;AACd,EACD;;AAKA,MAAa,kBAAkB,SAAwC,cAAc;;;AAQrF,MAAM,iBAAiB,QAAoB,YAAsC;CAChF,cAAc,OAAO;CACrB,UAAU,OAAO;CACjB;CACA,GAAI,OAAO,WAAW,KAAA,IAAY,EAAE,QAAQ,OAAO,OAAO,IAAI,CAAC;CAC/D,GAAI,OAAO,gBAAgB,KAAA,IAAY,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;CAC9E,GAAI,OAAO,YAAY,KAAA,IAAY,EAAE,SAAS,OAAO,QAAQ,IAAI,CAAC;CAClE,GAAI,OAAO,kBAAkB,KAAA,IAAY,EAAE,eAAe,OAAO,cAAc,IAAI,CAAC;CACpF,GAAI,OAAO,eAAe,KAAA,IAAY,EAAE,YAAY,OAAO,WAAW,IAAI,CAAC;CAC3E,WAAW,OAAO;AACnB;;;;;AAUA,MAAa,oBACZ,UACA,aACA,YAEA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,SAAS,UAAU,aAAa,OAAO;CAC7D,IAAI,WAAW,MAAM;EACpB,MAAM,cAAc,OAAO,SAAS,KAAK,EAAA,CACvC,QAAQ,MAAM,EAAE,0BAA0B,WAAW,CAAC,CACtD,KAAK,MAAM,EAAE,UAAU,EAAE,OAAO;EAClC,OAAO,OAAO,OAAO,KACpB,UAAU,aAAa;GACtB,YAAY,GAAG,YAAY,IAAI;GAC/B,SAAS,qBAAqB,YAAY,MAAM,QAAQ;GACxD;EACD,CAAC,CACF;CACD;CACA,OAAO,cAAc,QAAQ,UAAU;AACxC,CAAC;;;;;;;;AAaF,MAAa,qBACZ,KACA,iBAEA,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,qBAAqB,YAAY;CACpD,IAAI,eAAe,MAClB,OAAO,OAAO,OAAO,KAAK,UAAU;CAErC,IAAI,CAAC,eAAe,YAAY,GAC/B,OAAO,OAAO,OAAO,KACpB,UAAU,aAAa;EACtB,YAAY;EACZ,SAAS,eAAe,aAAa;CACtC,CAAC,CACF;CAED,MAAM,WAAW,OAAO,sBAAsB,KAAK,YAAY;CAC/D,IAAI,aAAa,MAIhB,OAAO;EACN;EACA,UAAU;EACV,QAAQ;CACT;CAED,OAAO;EACN;EACA,UAAU,SAAS;EACnB,QAAQ;EACR,QAAQ,SAAS;EACjB,aAAa,SAAS;EACtB,GAAI,SAAS,YAAY,KAAA,IAAY,EAAE,SAAS,SAAS,QAAQ,IAAI,CAAC;EACtE,YAAY,SAAS;CACtB;AACD,CAAC"}