@mysten-incubation/devstack 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (838) hide show
  1. package/README.md +7 -3
  2. package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  3. package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  4. package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  5. package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  6. package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  7. package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  8. package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  9. package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  10. package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  11. package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  12. package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  13. package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
  14. package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
  15. package/dashboard-ui/assets/index-Deml9drg.css +1 -0
  16. package/dashboard-ui/index.html +13 -0
  17. package/dist/api/define-capabilities.d.mts +14 -3
  18. package/dist/api/define-capabilities.mjs +18 -1
  19. package/dist/api/define-capabilities.mjs.map +1 -1
  20. package/dist/api/define-devstack.d.mts +1 -1
  21. package/dist/api/define-devstack.mjs +6 -26
  22. package/dist/api/define-devstack.mjs.map +1 -1
  23. package/dist/api/define-plugin.d.mts +1 -0
  24. package/dist/api/define-plugin.mjs +2 -0
  25. package/dist/api/inference-network.d.mts +132 -0
  26. package/dist/api/inference-network.mjs +105 -16
  27. package/dist/api/inference-network.mjs.map +1 -1
  28. package/dist/api/plugin-errors.d.mts +7 -0
  29. package/dist/api/run-stack.d.mts +20 -9
  30. package/dist/api/run-stack.mjs +56 -29
  31. package/dist/api/run-stack.mjs.map +1 -1
  32. package/dist/build-integrations/playwright/config.d.mts +6 -4
  33. package/dist/build-integrations/playwright/config.mjs +5 -3
  34. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  35. package/dist/build-integrations/playwright/errors.d.mts +1 -1
  36. package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
  37. package/dist/build-integrations/playwright/global-setup.mjs +250 -13
  38. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  39. package/dist/build-integrations/playwright/index.d.mts +5 -3
  40. package/dist/build-integrations/playwright/index.mjs +4 -2
  41. package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
  42. package/dist/build-integrations/playwright/stack-context.mjs +24 -63
  43. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  44. package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
  45. package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
  46. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  47. package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
  48. package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
  49. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
  51. package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
  52. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
  53. package/dist/build-integrations/runtime/discover.d.mts +38 -30
  54. package/dist/build-integrations/runtime/discover.mjs +73 -70
  55. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
  57. package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
  58. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  59. package/dist/build-integrations/runtime/index.d.mts +7 -2
  60. package/dist/build-integrations/runtime/index.mjs +9 -2
  61. package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
  62. package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
  63. package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
  64. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
  65. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
  66. package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
  67. package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
  68. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  69. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
  70. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
  71. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
  72. package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
  73. package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
  74. package/dist/build-integrations/vite/index.d.mts +51 -0
  75. package/dist/build-integrations/vite/index.mjs +73 -0
  76. package/dist/build-integrations/vite/index.mjs.map +1 -0
  77. package/dist/build-integrations/vitest/env.d.mts +4 -3
  78. package/dist/build-integrations/vitest/env.mjs +6 -4
  79. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  80. package/dist/build-integrations/vitest/errors.d.mts +25 -4
  81. package/dist/build-integrations/vitest/errors.mjs +15 -2
  82. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  83. package/dist/build-integrations/vitest/index.d.mts +2 -2
  84. package/dist/build-integrations/vitest/index.mjs +3 -3
  85. package/dist/build-integrations/vitest/setup.d.mts +4 -2
  86. package/dist/build-integrations/vitest/setup.mjs +2 -2
  87. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  88. package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
  89. package/dist/build-integrations/vitest/stack-context.mjs +33 -13
  90. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  91. package/dist/cli/bail.mjs +23 -0
  92. package/dist/cli/bail.mjs.map +1 -0
  93. package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
  94. package/dist/cli/doctor-probes.mjs.map +1 -0
  95. package/dist/cli/main.d.mts +15 -1
  96. package/dist/cli/main.mjs +166 -482
  97. package/dist/cli/main.mjs.map +1 -1
  98. package/dist/cli/prune-direct.mjs +31 -201
  99. package/dist/cli/prune-direct.mjs.map +1 -1
  100. package/dist/cli/snapshot-reader.mjs +14 -11
  101. package/dist/cli/snapshot-reader.mjs.map +1 -1
  102. package/dist/cli/up-lifecycle.mjs +4 -1
  103. package/dist/cli/up-lifecycle.mjs.map +1 -1
  104. package/dist/cli/wirings/apply.mjs +95 -0
  105. package/dist/cli/wirings/apply.mjs.map +1 -0
  106. package/dist/cli/wirings/build-verb-layers.mjs +42 -0
  107. package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
  108. package/dist/cli/wirings/config-loader.mjs +69 -0
  109. package/dist/cli/wirings/config-loader.mjs.map +1 -0
  110. package/dist/cli/wirings/engine-command.mjs +30 -0
  111. package/dist/cli/wirings/engine-command.mjs.map +1 -0
  112. package/dist/cli/wirings/identity.mjs +72 -0
  113. package/dist/cli/wirings/identity.mjs.map +1 -0
  114. package/dist/cli/wirings/provide-file-system.mjs +7 -0
  115. package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
  116. package/dist/cli/wirings/snapshot.mjs +177 -0
  117. package/dist/cli/wirings/snapshot.mjs.map +1 -0
  118. package/dist/cli/wirings/up.mjs +287 -0
  119. package/dist/cli/wirings/up.mjs.map +1 -0
  120. package/dist/cli/wirings/wipe.mjs +40 -0
  121. package/dist/cli/wirings/wipe.mjs.map +1 -0
  122. package/dist/contracts/capability-decl.d.mts +0 -2
  123. package/dist/contracts/codegenable.d.mts +43 -0
  124. package/dist/contracts/container-runtime.d.mts +26 -1
  125. package/dist/contracts/faucet-strategy.d.mts +25 -0
  126. package/dist/contracts/funding-strategy.d.mts +42 -0
  127. package/dist/contracts/plugin-expander.mjs +60 -0
  128. package/dist/contracts/plugin-expander.mjs.map +1 -0
  129. package/dist/contracts/projection.d.mts +5 -3
  130. package/dist/contracts/renderer.d.mts +23 -0
  131. package/dist/contracts/routable.d.mts +14 -1
  132. package/dist/contracts/snapshotable.d.mts +25 -3
  133. package/dist/contracts/wallet-protocol.d.mts +52 -0
  134. package/dist/contracts/wallet-protocol.mjs +52 -0
  135. package/dist/contracts/wallet-protocol.mjs.map +1 -0
  136. package/dist/index.d.mts +26 -25
  137. package/dist/index.mjs +20 -13
  138. package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
  139. package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
  140. package/dist/orchestrators/codegen/bindings.d.mts +1 -2
  141. package/dist/orchestrators/codegen/bindings.mjs +52 -186
  142. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/emit.mjs +19 -1
  144. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  145. package/dist/orchestrators/codegen/errors.mjs +8 -3
  146. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/format.mjs +47 -39
  148. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/gitignore.mjs +3 -1
  150. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  151. package/dist/orchestrators/codegen/output-location.mjs +40 -0
  152. package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
  153. package/dist/orchestrators/codegen/paths.d.mts +1 -1
  154. package/dist/orchestrators/codegen/paths.mjs +40 -14
  155. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  156. package/dist/orchestrators/codegen/permissions.mjs +3 -1
  157. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  158. package/dist/orchestrators/codegen/service.mjs +157 -105
  159. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  160. package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
  161. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
  162. package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
  163. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
  164. package/dist/orchestrators/router/cleanup.mjs +26 -27
  165. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  166. package/dist/orchestrators/router/entrypoints.mjs +2 -2
  167. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  168. package/dist/orchestrators/router/file-provider.mjs +14 -5
  169. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  170. package/dist/orchestrators/router/hostname.mjs +19 -55
  171. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  172. package/dist/orchestrators/router/index.mjs +11 -0
  173. package/dist/orchestrators/router/profile.mjs +2 -2
  174. package/dist/orchestrators/router/sentinels.mjs +26 -0
  175. package/dist/orchestrators/router/sentinels.mjs.map +1 -0
  176. package/dist/orchestrators/router/service.mjs +40 -37
  177. package/dist/orchestrators/router/service.mjs.map +1 -1
  178. package/dist/orchestrators/router/traefik-container.mjs +27 -16
  179. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  180. package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
  181. package/dist/orchestrators/run.mjs.map +1 -0
  182. package/dist/orchestrators/runtime-composition.d.mts +1 -1
  183. package/dist/orchestrators/runtime-composition.mjs +123 -39
  184. package/dist/orchestrators/runtime-composition.mjs.map +1 -1
  185. package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
  186. package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
  187. package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
  188. package/dist/orchestrators/snapshot/capture.mjs +42 -28
  189. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  190. package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
  191. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  192. package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
  193. package/dist/orchestrators/snapshot/index.mjs +13 -0
  194. package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
  195. package/dist/orchestrators/snapshot/integrity.mjs +73 -17
  196. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  197. package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
  198. package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
  199. package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
  200. package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
  201. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
  202. package/dist/orchestrators/snapshot/prune.mjs +20 -55
  203. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  204. package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
  205. package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
  206. package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
  207. package/dist/orchestrators/snapshot/restore.mjs +118 -84
  208. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  209. package/dist/orchestrators/snapshot/service.mjs +53 -56
  210. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  211. package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
  212. package/dist/orchestrators/snapshot/state-document.mjs +47 -7
  213. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
  214. package/dist/orchestrators/snapshot/wipe.mjs +67 -10
  215. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  216. package/dist/plugins/account/codegen.mjs +9 -8
  217. package/dist/plugins/account/codegen.mjs.map +1 -1
  218. package/dist/plugins/account/errors.d.mts +33 -6
  219. package/dist/plugins/account/errors.mjs.map +1 -1
  220. package/dist/plugins/account/funding.d.mts +29 -19
  221. package/dist/plugins/account/funding.mjs +84 -66
  222. package/dist/plugins/account/funding.mjs.map +1 -1
  223. package/dist/plugins/account/index.d.mts +2 -4
  224. package/dist/plugins/account/index.mjs +64 -31
  225. package/dist/plugins/account/index.mjs.map +1 -1
  226. package/dist/plugins/account/keypair.mjs +6 -9
  227. package/dist/plugins/account/keypair.mjs.map +1 -1
  228. package/dist/plugins/account/lease.mjs +1 -0
  229. package/dist/plugins/account/lease.mjs.map +1 -1
  230. package/dist/plugins/account/registry.d.mts +14 -1
  231. package/dist/plugins/account/registry.mjs +18 -18
  232. package/dist/plugins/account/registry.mjs.map +1 -1
  233. package/dist/plugins/account/service.d.mts +23 -4
  234. package/dist/plugins/account/service.mjs +83 -45
  235. package/dist/plugins/account/service.mjs.map +1 -1
  236. package/dist/plugins/account/snapshot.mjs +2 -5
  237. package/dist/plugins/account/snapshot.mjs.map +1 -1
  238. package/dist/plugins/account/spans.mjs +16 -0
  239. package/dist/plugins/account/spans.mjs.map +1 -0
  240. package/dist/plugins/account/variants/keystore.mjs +6 -8
  241. package/dist/plugins/account/variants/keystore.mjs.map +1 -1
  242. package/dist/plugins/action/build-context.d.mts +3 -2
  243. package/dist/plugins/action/errors.d.mts +16 -12
  244. package/dist/plugins/action/errors.mjs.map +1 -1
  245. package/dist/plugins/action/execute.mjs +65 -103
  246. package/dist/plugins/action/execute.mjs.map +1 -1
  247. package/dist/plugins/action/index.d.mts +0 -2
  248. package/dist/plugins/action/index.mjs +17 -13
  249. package/dist/plugins/action/index.mjs.map +1 -1
  250. package/dist/plugins/action/service.mjs +38 -35
  251. package/dist/plugins/action/service.mjs.map +1 -1
  252. package/dist/plugins/action/spans.mjs +11 -0
  253. package/dist/plugins/action/spans.mjs.map +1 -0
  254. package/dist/plugins/coin/codegen.mjs +9 -8
  255. package/dist/plugins/coin/codegen.mjs.map +1 -1
  256. package/dist/plugins/coin/discovery.mjs +8 -4
  257. package/dist/plugins/coin/discovery.mjs.map +1 -1
  258. package/dist/plugins/coin/index.d.mts +11 -29
  259. package/dist/plugins/coin/index.mjs +56 -27
  260. package/dist/plugins/coin/index.mjs.map +1 -1
  261. package/dist/plugins/coin/metadata.mjs +8 -15
  262. package/dist/plugins/coin/metadata.mjs.map +1 -1
  263. package/dist/plugins/coin/mint.d.mts +30 -11
  264. package/dist/plugins/coin/mint.mjs +78 -74
  265. package/dist/plugins/coin/mint.mjs.map +1 -1
  266. package/dist/plugins/coin/registry.mjs +4 -7
  267. package/dist/plugins/coin/registry.mjs.map +1 -1
  268. package/dist/plugins/coin/service.d.mts +39 -1
  269. package/dist/plugins/coin/service.mjs +11 -4
  270. package/dist/plugins/coin/service.mjs.map +1 -1
  271. package/dist/plugins/coin/spans.mjs +20 -0
  272. package/dist/plugins/coin/spans.mjs.map +1 -0
  273. package/dist/plugins/dashboard/domain.mjs +402 -0
  274. package/dist/plugins/dashboard/domain.mjs.map +1 -0
  275. package/dist/plugins/dashboard/index.d.mts +29 -0
  276. package/dist/plugins/dashboard/index.mjs +91 -0
  277. package/dist/plugins/dashboard/index.mjs.map +1 -0
  278. package/dist/plugins/dashboard/origin-policy.mjs +36 -0
  279. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
  280. package/dist/plugins/dashboard/routable.mjs +27 -0
  281. package/dist/plugins/dashboard/routable.mjs.map +1 -0
  282. package/dist/plugins/dashboard/schema/builder.mjs +21 -0
  283. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
  284. package/dist/plugins/dashboard/schema/enums.mjs +72 -0
  285. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
  286. package/dist/plugins/dashboard/schema/root.mjs +351 -0
  287. package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
  288. package/dist/plugins/dashboard/schema/types.mjs +508 -0
  289. package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
  290. package/dist/plugins/dashboard/schema.mjs +11 -0
  291. package/dist/plugins/dashboard/schema.mjs.map +1 -0
  292. package/dist/plugins/dashboard/server.mjs +166 -0
  293. package/dist/plugins/dashboard/server.mjs.map +1 -0
  294. package/dist/plugins/deepbook/deploy.mjs +53 -115
  295. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  296. package/dist/plugins/deepbook/errors.mjs +1 -0
  297. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  298. package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
  299. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  300. package/dist/plugins/deepbook/hash.mjs +9 -0
  301. package/dist/plugins/deepbook/hash.mjs.map +1 -0
  302. package/dist/plugins/deepbook/index.d.mts +1 -10
  303. package/dist/plugins/deepbook/index.mjs +25 -22
  304. package/dist/plugins/deepbook/index.mjs.map +1 -1
  305. package/dist/plugins/deepbook/pyth/index.mjs +26 -55
  306. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  307. package/dist/plugins/deepbook/snapshot.mjs +17 -29
  308. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  309. package/dist/plugins/deepbook/spans.mjs +18 -0
  310. package/dist/plugins/deepbook/spans.mjs.map +1 -0
  311. package/dist/plugins/deepbook/type-strings.mjs +65 -0
  312. package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
  313. package/dist/plugins/deepbook/types.d.mts +2 -3
  314. package/dist/plugins/deepbook/types.mjs.map +1 -1
  315. package/dist/plugins/faucet/dispatcher.d.mts +21 -2
  316. package/dist/plugins/faucet/dispatcher.mjs +1 -2
  317. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  318. package/dist/plugins/faucet/errors.d.mts +11 -24
  319. package/dist/plugins/faucet/errors.mjs.map +1 -1
  320. package/dist/plugins/faucet/http.mjs +33 -14
  321. package/dist/plugins/faucet/http.mjs.map +1 -1
  322. package/dist/plugins/faucet/index.d.mts +15 -5
  323. package/dist/plugins/faucet/index.mjs +3 -0
  324. package/dist/plugins/faucet/index.mjs.map +1 -1
  325. package/dist/plugins/faucet/spans.mjs +12 -0
  326. package/dist/plugins/faucet/spans.mjs.map +1 -0
  327. package/dist/plugins/host-service/errors.d.mts +1 -1
  328. package/dist/plugins/host-service/index.mjs +34 -8
  329. package/dist/plugins/host-service/index.mjs.map +1 -1
  330. package/dist/plugins/host-service/routable.mjs +2 -1
  331. package/dist/plugins/host-service/routable.mjs.map +1 -1
  332. package/dist/plugins/host-service/service.d.mts +21 -0
  333. package/dist/plugins/host-service/service.mjs +136 -81
  334. package/dist/plugins/host-service/service.mjs.map +1 -1
  335. package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
  336. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
  337. package/dist/plugins/internal/codegen-helpers.mjs +18 -0
  338. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
  339. package/dist/plugins/internal/funding-failure-error.mjs +32 -0
  340. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
  341. package/dist/plugins/package/build.mjs +1 -1
  342. package/dist/plugins/package/build.mjs.map +1 -1
  343. package/dist/plugins/package/codegen.mjs +26 -0
  344. package/dist/plugins/package/codegen.mjs.map +1 -1
  345. package/dist/plugins/package/errors.d.mts +16 -6
  346. package/dist/plugins/package/errors.mjs.map +1 -1
  347. package/dist/plugins/package/index.d.mts +0 -4
  348. package/dist/plugins/package/index.mjs +27 -21
  349. package/dist/plugins/package/index.mjs.map +1 -1
  350. package/dist/plugins/package/mode-known.mjs +26 -12
  351. package/dist/plugins/package/mode-known.mjs.map +1 -1
  352. package/dist/plugins/package/mode-local.mjs +47 -41
  353. package/dist/plugins/package/mode-local.mjs.map +1 -1
  354. package/dist/plugins/package/publish-executor.mjs +55 -114
  355. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  356. package/dist/plugins/package/registry.mjs +2 -1
  357. package/dist/plugins/package/registry.mjs.map +1 -1
  358. package/dist/plugins/package/service.mjs.map +1 -1
  359. package/dist/plugins/package/spans.mjs +14 -0
  360. package/dist/plugins/package/spans.mjs.map +1 -0
  361. package/dist/plugins/postgres/db-ensure.mjs +19 -12
  362. package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
  363. package/dist/plugins/postgres/errors.d.mts +5 -0
  364. package/dist/plugins/postgres/errors.mjs.map +1 -1
  365. package/dist/plugins/postgres/index.mjs +10 -17
  366. package/dist/plugins/postgres/index.mjs.map +1 -1
  367. package/dist/plugins/postgres/service.mjs +58 -24
  368. package/dist/plugins/postgres/service.mjs.map +1 -1
  369. package/dist/plugins/postgres/snapshot.mjs.map +1 -1
  370. package/dist/plugins/postgres/spans.mjs +11 -0
  371. package/dist/plugins/postgres/spans.mjs.map +1 -0
  372. package/dist/plugins/router-entrypoints.mjs +4 -4
  373. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
  375. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
  377. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  378. package/dist/plugins/seal/codegen.d.mts +2 -3
  379. package/dist/plugins/seal/codegen.mjs.map +1 -1
  380. package/dist/plugins/seal/config-render.mjs +35 -8
  381. package/dist/plugins/seal/config-render.mjs.map +1 -1
  382. package/dist/plugins/seal/deploy.mjs +31 -39
  383. package/dist/plugins/seal/deploy.mjs.map +1 -1
  384. package/dist/plugins/seal/errors.d.mts +1 -3
  385. package/dist/plugins/seal/errors.mjs +7 -1
  386. package/dist/plugins/seal/errors.mjs.map +1 -1
  387. package/dist/plugins/seal/index.d.mts +1 -6
  388. package/dist/plugins/seal/index.mjs +40 -14
  389. package/dist/plugins/seal/index.mjs.map +1 -1
  390. package/dist/plugins/seal/key-manager.d.mts +1 -9
  391. package/dist/plugins/seal/key-manager.mjs +2 -18
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  393. package/dist/plugins/seal/key-server.mjs +37 -36
  394. package/dist/plugins/seal/key-server.mjs.map +1 -1
  395. package/dist/plugins/seal/keygen.mjs +16 -17
  396. package/dist/plugins/seal/keygen.mjs.map +1 -1
  397. package/dist/plugins/seal/mode/fork-known.mjs +36 -14
  398. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  399. package/dist/plugins/seal/mode/live.d.mts +6 -4
  400. package/dist/plugins/seal/mode/live.mjs +14 -21
  401. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  402. package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
  403. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  404. package/dist/plugins/seal/registry-publish.mjs +1 -0
  405. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  406. package/dist/plugins/seal/routable.mjs.map +1 -1
  407. package/dist/plugins/seal/service.mjs.map +1 -1
  408. package/dist/plugins/seal/spans.mjs +18 -0
  409. package/dist/plugins/seal/spans.mjs.map +1 -0
  410. package/dist/plugins/sui/auto-tick.mjs +17 -23
  411. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  412. package/dist/plugins/sui/chain-build-container.mjs +18 -0
  413. package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
  414. package/dist/plugins/sui/chain-probe.d.mts +5 -5
  415. package/dist/plugins/sui/chain-probe.mjs +28 -58
  416. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  417. package/dist/plugins/sui/codegen.mjs +26 -0
  418. package/dist/plugins/sui/codegen.mjs.map +1 -1
  419. package/dist/plugins/sui/errors.d.mts +2 -29
  420. package/dist/plugins/sui/errors.mjs +1 -3
  421. package/dist/plugins/sui/errors.mjs.map +1 -1
  422. package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
  423. package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
  424. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
  425. package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
  426. package/dist/plugins/sui/fork-orchestration.mjs +170 -2
  427. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  428. package/dist/plugins/sui/fork-transaction.d.mts +2 -0
  429. package/dist/plugins/sui/fork-transaction.mjs +92 -28
  430. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  431. package/dist/plugins/sui/index.d.mts +33 -70
  432. package/dist/plugins/sui/index.mjs +58 -35
  433. package/dist/plugins/sui/index.mjs.map +1 -1
  434. package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
  435. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
  436. package/dist/plugins/sui/mode/external.mjs +7 -13
  437. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  438. package/dist/plugins/sui/mode/fork.mjs +136 -59
  439. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  440. package/dist/plugins/sui/mode/live.mjs +10 -16
  441. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  442. package/dist/plugins/sui/mode/local.mjs +37 -36
  443. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  444. package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
  445. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  446. package/dist/plugins/sui/mode/shared.d.mts +1 -5
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  448. package/dist/plugins/sui/mode/spec.d.mts +18 -0
  449. package/dist/plugins/sui/move-summary-runner.mjs +207 -0
  450. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
  451. package/dist/plugins/sui/network-resolver.d.mts +4 -3
  452. package/dist/plugins/sui/service.mjs.map +1 -1
  453. package/dist/plugins/sui/snapshot.mjs +3 -0
  454. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  455. package/dist/plugins/sui/spans.mjs +17 -0
  456. package/dist/plugins/sui/spans.mjs.map +1 -0
  457. package/dist/plugins/wallet/codegen.d.mts +0 -1
  458. package/dist/plugins/wallet/codegen.mjs +8 -9
  459. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  460. package/dist/plugins/wallet/index.d.mts +6 -8
  461. package/dist/plugins/wallet/index.mjs +46 -35
  462. package/dist/plugins/wallet/index.mjs.map +1 -1
  463. package/dist/plugins/wallet/origin-policy.mjs +12 -28
  464. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  465. package/dist/plugins/wallet/pairing.mjs +6 -4
  466. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  467. package/dist/plugins/wallet/protocol.d.mts +1 -0
  468. package/dist/plugins/wallet/protocol.mjs +5 -44
  469. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  470. package/dist/plugins/wallet/routable.mjs +2 -8
  471. package/dist/plugins/wallet/routable.mjs.map +1 -1
  472. package/dist/plugins/wallet/server.mjs +36 -44
  473. package/dist/plugins/wallet/server.mjs.map +1 -1
  474. package/dist/plugins/wallet/service.d.mts +1 -5
  475. package/dist/plugins/wallet/service.mjs +22 -18
  476. package/dist/plugins/wallet/service.mjs.map +1 -1
  477. package/dist/plugins/wallet/spans.mjs +22 -0
  478. package/dist/plugins/wallet/spans.mjs.map +1 -0
  479. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
  480. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  481. package/dist/plugins/walrus/codegen.d.mts +3 -3
  482. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  483. package/dist/plugins/walrus/deploy-paths.mjs +21 -5
  484. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  485. package/dist/plugins/walrus/deploy.mjs +67 -69
  486. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  487. package/dist/plugins/walrus/errors.mjs +1 -0
  488. package/dist/plugins/walrus/errors.mjs.map +1 -1
  489. package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
  490. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  491. package/dist/plugins/walrus/index.d.mts +2 -13
  492. package/dist/plugins/walrus/index.mjs +18 -23
  493. package/dist/plugins/walrus/index.mjs.map +1 -1
  494. package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
  495. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  496. package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
  497. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  498. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  499. package/dist/plugins/walrus/routable.mjs +7 -23
  500. package/dist/plugins/walrus/routable.mjs.map +1 -1
  501. package/dist/plugins/walrus/service.mjs.map +1 -1
  502. package/dist/plugins/walrus/spans.mjs +18 -0
  503. package/dist/plugins/walrus/spans.mjs.map +1 -0
  504. package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
  505. package/dist/plugins/walrus/storage-nodes.mjs +15 -8
  506. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  507. package/dist/plugins/walrus/wal-swap.mjs +58 -15
  508. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  509. package/dist/primitives/artifact-publisher.d.mts +1 -1
  510. package/dist/primitives/artifact-publisher.mjs +15 -0
  511. package/dist/primitives/artifact-publisher.mjs.map +1 -0
  512. package/dist/runtime/docker/client.mjs +17 -4
  513. package/dist/runtime/docker/client.mjs.map +1 -1
  514. package/dist/runtime/docker/container.mjs +219 -132
  515. package/dist/runtime/docker/container.mjs.map +1 -1
  516. package/dist/runtime/docker/errors.mjs +0 -6
  517. package/dist/runtime/docker/errors.mjs.map +1 -1
  518. package/dist/runtime/docker/exec.mjs +21 -18
  519. package/dist/runtime/docker/exec.mjs.map +1 -1
  520. package/dist/runtime/docker/image.mjs +36 -13
  521. package/dist/runtime/docker/image.mjs.map +1 -1
  522. package/dist/runtime/docker/index.mjs +14 -0
  523. package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
  524. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
  525. package/dist/runtime/docker/inventory.mjs +14 -11
  526. package/dist/runtime/docker/inventory.mjs.map +1 -1
  527. package/dist/runtime/docker/labels.mjs +38 -5
  528. package/dist/runtime/docker/labels.mjs.map +1 -1
  529. package/dist/runtime/docker/logs.d.mts +1 -1
  530. package/dist/runtime/docker/logs.mjs.map +1 -1
  531. package/dist/runtime/docker/network.mjs +83 -47
  532. package/dist/runtime/docker/network.mjs.map +1 -1
  533. package/dist/runtime/docker/render-run-args.mjs +82 -0
  534. package/dist/runtime/docker/render-run-args.mjs.map +1 -0
  535. package/dist/runtime/docker/service.d.mts +1 -1
  536. package/dist/runtime/docker/service.mjs +12 -7
  537. package/dist/runtime/docker/service.mjs.map +1 -1
  538. package/dist/runtime/docker/sweep.mjs +118 -43
  539. package/dist/runtime/docker/sweep.mjs.map +1 -1
  540. package/dist/runtime/docker/volume.mjs +2 -0
  541. package/dist/runtime/docker/volume.mjs.map +1 -1
  542. package/dist/runtime/docker/wrap.mjs +30 -1
  543. package/dist/runtime/docker/wrap.mjs.map +1 -1
  544. package/dist/substrate/cross-process.mjs +14 -8
  545. package/dist/substrate/cross-process.mjs.map +1 -1
  546. package/dist/substrate/event-time.mjs +33 -0
  547. package/dist/substrate/event-time.mjs.map +1 -0
  548. package/dist/substrate/events.d.mts +28 -8
  549. package/dist/substrate/identity.d.mts +2 -1
  550. package/dist/substrate/manifest.d.mts +68 -5
  551. package/dist/substrate/manifest.mjs +34 -5
  552. package/dist/substrate/manifest.mjs.map +1 -1
  553. package/dist/substrate/network.d.mts +3 -5
  554. package/dist/substrate/options.d.mts +0 -2
  555. package/dist/substrate/plugin.d.mts +13 -0
  556. package/dist/substrate/plugin.mjs +4 -2
  557. package/dist/substrate/plugin.mjs.map +1 -1
  558. package/dist/substrate/projection.d.mts +35 -3
  559. package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
  560. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
  561. package/dist/substrate/runtime/atomic-write.mjs +97 -32
  562. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  563. package/dist/substrate/runtime/cache/index.mjs +3 -0
  564. package/dist/substrate/runtime/cache/schema.mjs +2 -2
  565. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  566. package/dist/substrate/runtime/cache/service.mjs +9 -7
  567. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  568. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
  569. package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
  570. package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
  571. package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
  572. package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
  573. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
  574. package/dist/substrate/runtime/config-validation.d.mts +1 -13
  575. package/dist/substrate/runtime/config-validation.mjs +2 -91
  576. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  577. package/dist/substrate/runtime/container-runtime.d.mts +1 -0
  578. package/dist/substrate/runtime/container-runtime.mjs +2 -0
  579. package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
  580. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
  581. package/dist/substrate/runtime/control-plane/service.mjs +7 -0
  582. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
  583. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
  584. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  585. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
  586. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  587. package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
  588. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
  589. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  590. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
  591. package/dist/substrate/runtime/cross-process/index.mjs +11 -0
  592. package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
  593. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
  594. package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
  595. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  596. package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
  597. package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
  598. package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
  599. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
  600. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
  601. package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
  602. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  603. package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
  604. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
  605. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
  606. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
  607. package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
  608. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  609. package/dist/substrate/runtime/current-plugin.mjs +2 -2
  610. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  611. package/dist/substrate/runtime/errors.mjs +12 -6
  612. package/dist/substrate/runtime/errors.mjs.map +1 -1
  613. package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
  614. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
  615. package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
  616. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
  617. package/dist/substrate/runtime/host-gateway.mjs +20 -0
  618. package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
  619. package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
  620. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  621. package/dist/substrate/runtime/http-probe.d.mts +1 -1
  622. package/dist/substrate/runtime/index.mjs +14 -0
  623. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
  624. package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
  625. package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
  626. package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
  627. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  628. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
  629. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  630. package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
  631. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
  632. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
  633. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  634. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
  635. package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
  636. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  637. package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
  638. package/dist/substrate/runtime/managed-container.d.mts +19 -1
  639. package/dist/substrate/runtime/managed-container.mjs +20 -1
  640. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  641. package/dist/substrate/runtime/manifest/index.mjs +3 -0
  642. package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
  643. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  644. package/dist/substrate/runtime/mode-errors.mjs +20 -0
  645. package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
  646. package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
  647. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  648. package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
  649. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
  650. package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
  651. package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
  652. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
  653. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  654. package/dist/substrate/runtime/observability/index.mjs +13 -0
  655. package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
  656. package/dist/substrate/runtime/observability/log-store.mjs +175 -0
  657. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
  658. package/dist/substrate/runtime/observability/logger.d.mts +2 -1
  659. package/dist/substrate/runtime/observability/logger.mjs +5 -9
  660. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  661. package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
  662. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
  663. package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
  664. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  665. package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
  666. package/dist/substrate/runtime/observability/redaction.mjs +8 -14
  667. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  668. package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
  669. package/dist/substrate/runtime/observability/span-store.mjs +110 -0
  670. package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
  671. package/dist/substrate/runtime/observability/spans.mjs +14 -14
  672. package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
  673. package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
  674. package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
  675. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
  676. package/dist/substrate/runtime/paths.d.mts +1 -1
  677. package/dist/substrate/runtime/paths.mjs +4 -3
  678. package/dist/substrate/runtime/paths.mjs.map +1 -1
  679. package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
  680. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
  681. package/dist/substrate/runtime/port-broker/index.mjs +3 -0
  682. package/dist/substrate/runtime/port-broker/service.mjs +170 -126
  683. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  684. package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
  685. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  686. package/dist/substrate/runtime/probes.d.mts +7 -5
  687. package/dist/substrate/runtime/probes.mjs +3 -1
  688. package/dist/substrate/runtime/probes.mjs.map +1 -1
  689. package/dist/substrate/runtime/projection/index.mjs +4 -0
  690. package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
  691. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  692. package/dist/substrate/runtime/projection/persisted.mjs +33 -15
  693. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
  694. package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
  695. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  696. package/dist/substrate/runtime/projection/update.mjs +88 -24
  697. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  698. package/dist/substrate/runtime/random-suffix.mjs +11 -0
  699. package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
  700. package/dist/substrate/runtime/retry-policy.d.mts +59 -1
  701. package/dist/substrate/runtime/retry-policy.mjs +66 -1
  702. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  703. package/dist/substrate/runtime/routed-url.d.mts +1 -0
  704. package/dist/substrate/runtime/routed-url.mjs +79 -0
  705. package/dist/substrate/runtime/routed-url.mjs.map +1 -0
  706. package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
  707. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  708. package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
  709. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  710. package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
  711. package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
  712. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
  713. package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
  714. package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
  715. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
  716. package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
  717. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  718. package/dist/substrate/runtime/state-store/index.d.mts +1 -0
  719. package/dist/substrate/runtime/state-store/index.mjs +3 -0
  720. package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
  721. package/dist/substrate/runtime/state-store/schema.mjs +19 -14
  722. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
  723. package/dist/substrate/runtime/state-store/service.d.mts +1 -0
  724. package/dist/substrate/runtime/state-store/service.mjs +145 -0
  725. package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
  726. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
  727. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
  728. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
  729. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
  730. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  731. package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
  732. package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
  733. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  734. package/dist/substrate/runtime/subnet-broker.mjs +60 -0
  735. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
  736. package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
  737. package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
  738. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
  739. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
  740. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
  741. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
  742. package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
  743. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
  744. package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
  745. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
  746. package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
  747. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
  748. package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
  749. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
  750. package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
  751. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
  752. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
  753. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
  754. package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
  755. package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
  756. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
  757. package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
  758. package/dist/substrate/runtime/supervisor/index.mjs +3 -0
  759. package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
  760. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
  761. package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
  762. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
  763. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
  764. package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
  765. package/dist/substrate/runtime/supervisor/state.mjs +22 -0
  766. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
  767. package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
  768. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
  769. package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
  770. package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
  771. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
  772. package/dist/substrate/runtime/typed-env.mjs +8 -0
  773. package/dist/substrate/runtime/typed-env.mjs.map +1 -0
  774. package/dist/substrate/state-store.d.mts +1 -0
  775. package/dist/substrate/versioned-doc-schema.mjs +17 -0
  776. package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
  777. package/dist/substrate/versioned-doc-sync.mjs +94 -0
  778. package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
  779. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  780. package/dist/surfaces/cli/commands/index.mjs +9 -0
  781. package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
  782. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
  783. package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
  784. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  785. package/dist/surfaces/cli/commands/prune.mjs +34 -17
  786. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  787. package/dist/surfaces/cli/commands/status.mjs +2 -2
  788. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  789. package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
  790. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  791. package/dist/surfaces/cli/commands/wipe.mjs +38 -4
  792. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  793. package/dist/surfaces/cli/errors.mjs +1 -1
  794. package/dist/surfaces/cli/errors.mjs.map +1 -1
  795. package/dist/surfaces/cli/flags.mjs +0 -1
  796. package/dist/surfaces/cli/flags.mjs.map +1 -1
  797. package/dist/surfaces/cli/index.mjs +98 -18
  798. package/dist/surfaces/cli/index.mjs.map +1 -1
  799. package/dist/surfaces/cli/output.mjs +1 -0
  800. package/dist/surfaces/cli/output.mjs.map +1 -1
  801. package/dist/surfaces/cli/sysexits.mjs +2 -1
  802. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  803. package/dist/surfaces/tui/app.mjs +25 -3
  804. package/dist/surfaces/tui/app.mjs.map +1 -1
  805. package/dist/surfaces/tui/display-derivation.mjs +23 -74
  806. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  807. package/dist/surfaces/tui/event-log.mjs +35 -23
  808. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  809. package/dist/surfaces/tui/input.mjs +5 -1
  810. package/dist/surfaces/tui/input.mjs.map +1 -1
  811. package/dist/surfaces/tui/plain-renderer.mjs +70 -34
  812. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  813. package/package.json +24 -4
  814. package/dist/contracts/liveness-classifier.d.mts +0 -19
  815. package/dist/contracts/network-resolver.d.mts +0 -15
  816. package/dist/contracts/network-resolver.mjs +0 -7
  817. package/dist/contracts/network-resolver.mjs.map +0 -1
  818. package/dist/orchestrators/codegen/extras.mjs +0 -16
  819. package/dist/orchestrators/codegen/extras.mjs.map +0 -1
  820. package/dist/plugins/deepbook/routable.mjs +0 -21
  821. package/dist/plugins/deepbook/routable.mjs.map +0 -1
  822. package/dist/plugins/faucet/service.d.mts +0 -20
  823. package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
  824. package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
  825. package/dist/plugins/sui/seed-objects.d.mts +0 -18
  826. package/dist/plugins/sui/seed-objects.mjs +0 -25
  827. package/dist/plugins/sui/seed-objects.mjs.map +0 -1
  828. package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
  829. package/dist/substrate/runtime/context-helpers.mjs +0 -32
  830. package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
  831. package/dist/substrate/runtime/run.mjs.map +0 -1
  832. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
  833. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
  834. package/dist/substrate/runtime/supervisor.d.mts +0 -1
  835. package/dist/substrate/runtime/supervisor.mjs +0 -831
  836. package/dist/substrate/runtime/supervisor.mjs.map +0 -1
  837. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
  838. /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
@@ -1,8 +1,11 @@
1
1
  import { contentHash } from "../../substrate/brand.mjs";
2
2
  import { pickPublishedChange, pickUpgradeCapChange } from "./publish-output.mjs";
3
+ import "./registry.mjs";
3
4
  import { publishError } from "./errors.mjs";
4
5
  import { hashMoveSources, scrubLocksHost } from "./build.mjs";
6
+ import { PackageSpans } from "./spans.mjs";
5
7
  import { mvrSlugify } from "./dep-resolution.mjs";
8
+ import { artifactPublishError } from "../../primitives/artifact-publisher.mjs";
6
9
  import { Duration, Effect, Schema } from "effect";
7
10
  //#region src/plugins/package/mode-local.ts
8
11
  /** Verify-schema: what we expect when probing `getObject(packageId)`.
@@ -67,26 +70,30 @@ const buildVerifyProbe = (probe, cachedPackageIdHint, opts) => Effect.gen(functi
67
70
  * - calling `register` on EVERY cycle.
68
71
  */
69
72
  const acquireLocal = (publisher, probe, registry, inputs) => Effect.gen(function* () {
73
+ const existing = yield* registry.find(inputs.packageName);
74
+ if (existing !== null && existing.kind === "local" && existing.sourcePath !== inputs.sourcePath) return yield* Effect.fail(publishError("parse", {
75
+ sourcePath: inputs.sourcePath,
76
+ packageName: inputs.packageName,
77
+ message: `localPackage('${inputs.packageName}') is declared twice in the same stack with different sourcePaths (${existing.sourcePath} vs ${inputs.sourcePath}). The substrate is name-blind at runtime and the second declaration would silently overwrite the first registry entry. Pick distinct package names (the symbolic name is the registry key consumers look up).`
78
+ }));
70
79
  const inputsHash = combineInputsHash(yield* hashMoveSources(inputs.sourcePath), inputs.publisherAddress);
71
80
  const mvrPlaceholder = mvrSlugify(inputs.mvrOverride ?? inputs.packageName);
72
- const priorEntry = yield* registry.find(inputs.packageName);
73
81
  let producedOutput = null;
74
- const resolved = yield* publisher.publish({
82
+ const entry = yield* publisher.publish({
75
83
  namespace: "package",
76
84
  chain: inputs.chainId,
77
85
  contentHash: inputsHash,
78
- verifySchema: PackageVerifyShape,
79
86
  verify: (cached) => cached.output === void 0 ? Effect.succeed(null) : buildVerifyProbe(probe, cached.packageId),
80
87
  produce: Effect.gen(function* () {
81
88
  yield* Effect.annotateCurrentSpan({
82
- "package.publish.package": inputs.packageName,
83
- "package.publish.sourcePath": inputs.sourcePath,
84
- "package.publish.chainId": inputs.chainId,
85
- "package.publish.publisher": inputs.publisherAddress
89
+ [PackageSpans.publish.package]: inputs.packageName,
90
+ [PackageSpans.publish.sourcePath]: inputs.sourcePath,
91
+ [PackageSpans.publish.chainId]: inputs.chainId,
92
+ [PackageSpans.publish.publisher]: inputs.publisherAddress
86
93
  });
87
- yield* Effect.annotateCurrentSpan({ "package.publish.phase": "scrub" });
88
- yield* scrubLocksHost(inputs.sourcePath, "~/.move", { packageLockFailures: inputs.executor.scrubsInsideContainer ? "best-effort" : "fatal" });
89
- yield* Effect.annotateCurrentSpan({ "package.publish.phase": "build" });
94
+ yield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: "scrub" });
95
+ yield* scrubLocksHost(inputs.sourcePath, "~/.move");
96
+ yield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: "build" });
90
97
  const buildOutput = yield* inputs.executor.build({
91
98
  sourcePath: inputs.sourcePath,
92
99
  packageName: inputs.packageName,
@@ -96,7 +103,7 @@ const acquireLocal = (publisher, probe, registry, inputs) => Effect.gen(function
96
103
  sourcePath: inputs.sourcePath,
97
104
  packageName: inputs.packageName
98
105
  })));
99
- yield* Effect.annotateCurrentSpan({ "package.publish.phase": "publish-tx" });
106
+ yield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: "publish-tx" });
100
107
  const output = yield* inputs.executor.publishTx({
101
108
  modules: buildOutput.modules,
102
109
  dependencies: buildOutput.dependencies,
@@ -104,9 +111,9 @@ const acquireLocal = (publisher, probe, registry, inputs) => Effect.gen(function
104
111
  packageName: inputs.packageName
105
112
  });
106
113
  producedOutput = output;
107
- yield* Effect.annotateCurrentSpan({ "package.publish.phase": "waiting-for-index" });
108
- yield* inputs.executor.waitForReady(output.packageId);
109
- yield* Effect.annotateCurrentSpan({ "package.publish.phase": "parse" });
114
+ yield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: "waiting-for-index" });
115
+ yield* inputs.executor.postPublishReadyHint(output.packageId);
116
+ yield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: "parse" });
110
117
  const published = pickPublishedChange(output.objectChanges);
111
118
  if (!published?.objectId) return yield* Effect.fail(publishError("parse", {
112
119
  sourcePath: inputs.sourcePath,
@@ -131,50 +138,49 @@ const acquireLocal = (publisher, probe, registry, inputs) => Effect.gen(function
131
138
  captured,
132
139
  output
133
140
  };
134
- }).pipe(Effect.mapError((err) => ({
135
- _tag: "ArtifactPublishError",
136
- reason: "produce-failed",
137
- detail: `package.publish ${err.phase}: ${err.message}`
138
- }))),
141
+ }).pipe(Effect.mapError((err) => artifactPublishError("produce-failed", `package.publish ${err.phase}: ${err.message}`))),
139
142
  register: (artifact) => Effect.gen(function* () {
140
- const entry = "packageId" in artifact ? {
141
- ...artifact,
142
- captured: inputs.capture !== void 0 && artifact.output !== void 0 ? (() => {
143
- try {
144
- return inputs.capture(artifact.output);
145
- } catch {
146
- return artifact.captured;
147
- }
148
- })() : artifact.captured
149
- } : {
150
- packageId: artifact.objectId,
151
- publisher: inputs.publisherAddress,
152
- mvrPlaceholder: priorEntry && priorEntry.kind === "local" ? priorEntry.mvrPlaceholder : mvrPlaceholder,
153
- captured: priorEntry && priorEntry.kind === "local" ? priorEntry.captured : {},
154
- upgradeCapId: priorEntry && priorEntry.kind === "local" ? priorEntry.upgradeCapId : void 0
155
- };
156
143
  const r = {
157
144
  kind: "local",
158
145
  name: inputs.packageName,
159
- packageId: entry.packageId,
160
- upgradeCapId: entry.upgradeCapId,
146
+ packageId: artifact.packageId,
147
+ upgradeCapId: artifact.upgradeCapId,
161
148
  sourcePath: inputs.sourcePath,
162
- mvrPlaceholder: entry.mvrPlaceholder,
163
- captured: entry.captured
149
+ mvrPlaceholder: artifact.mvrPlaceholder,
150
+ captured: artifact.captured
164
151
  };
165
152
  yield* registry.set(r.name, r);
166
153
  })
167
154
  });
155
+ if (producedOutput === null && inputs.capture !== void 0 && entry.output !== void 0) {
156
+ const recomputedCaptured = yield* Effect.try({
157
+ try: () => inputs.capture(entry.output),
158
+ catch: (cause) => publishError("parse", {
159
+ sourcePath: inputs.sourcePath,
160
+ packageName: inputs.packageName,
161
+ message: "capture callback threw",
162
+ cause
163
+ })
164
+ }).pipe(Effect.mapError((err) => artifactPublishError("produce-failed", `package.publish ${err.phase}: ${err.message}`)));
165
+ yield* registry.set(inputs.packageName, {
166
+ kind: "local",
167
+ name: inputs.packageName,
168
+ packageId: entry.packageId,
169
+ upgradeCapId: entry.upgradeCapId,
170
+ sourcePath: inputs.sourcePath,
171
+ mvrPlaceholder: entry.mvrPlaceholder,
172
+ captured: recomputedCaptured
173
+ });
174
+ }
168
175
  const final = yield* registry.find(inputs.packageName);
169
176
  if (!final || final.kind !== "local") return yield* Effect.fail(publishError("parse", {
170
177
  sourcePath: inputs.sourcePath,
171
178
  packageName: inputs.packageName,
172
179
  message: "register did not surface entry — artifact publisher register invariant violation"
173
180
  }));
174
- const cachedOutput = "packageId" in resolved && "output" in resolved ? resolved.output ?? null : null;
175
181
  return {
176
182
  resolved: final,
177
- output: producedOutput ?? cachedOutput
183
+ output: producedOutput ?? entry.output ?? null
178
184
  };
179
185
  });
180
186
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"mode-local.mjs","names":["brandContentHash"],"sources":["../../../src/plugins/package/mode-local.ts"],"sourcesContent":["// Local mode — build from source + publish.\n//\n// This is the canonical implementation of the\n// `ArtifactPublisher` substrate primitive (distilled doc\n// §Generic artifact-publisher-publish pattern). The five-phase shape:\n//\n// 1. Inputs — `{ sourceHash, signerAddress }` →\n// `contentHash(inputs)`.\n// 2. Cache key — `<namespace=package>/<chainId>/<contentHash>`.\n// Substrate folds in chainId for us; we hand\n// it the namespace + contentHash.\n// 3. Verify — `chainProbe.get({ objectId: cachedId },\n// PackageObjectSchema, 'lenient')`. Lenient mode\n// coerces transient RPC failure → null\n// → re-derive (cheap over-derive vs spurious\n// eviction — distilled doc §Constraint \"lenient\n// verify is cheaper than aggressive eviction\").\n// 4. Produce — scrub locks → build → publish-tx → wait-for-\n// index. Each phase narrates to TUI via span\n// annotation.\n// 5. Register — write registry entry on EVERY cycle (hit AND\n// miss). Distilled doc Invariant 6.\n//\n// The publish output is exposed on the resolved value and emitted as a\n// package-owned extension contribution for sibling folds.\n\nimport { Duration, Effect, Schema, type Scope } from 'effect';\n\nimport { contentHash as brandContentHash, type ChainId } from '../../substrate/brand.ts';\nimport {\n\tpickPublishedChange,\n\tpickUpgradeCapChange,\n\ttype PackagePublishObjectChange,\n\ttype LocalPackagePublishOutput,\n} from './publish-output.ts';\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { SuiProbeKey } from '../sui/chain-probe.ts';\nimport { hashMoveSources, scrubLocksHost, type BuildOutput } from './build.ts';\nimport { mvrSlugify } from './dep-resolution.ts';\nimport { type PackageRegistry, type ResolvedLocalPackage } from './registry.ts';\nimport { publishError, type PublishError } from './errors.ts';\n\n/** Cache-stored payload — the stable id verify re-confirms on\n * every cycle. Distilled doc Invariant 8: the probe MUST consume\n * a stable identifier (the packageId), NOT a derived hash. */\nexport interface CachedPackageEntry {\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly publisher: string;\n\treadonly mvrPlaceholder: string;\n\treadonly captured: Readonly<Record<string, string>>;\n\treadonly output?: LocalPackagePublishOutput;\n}\n\n/** Verify-schema: what we expect when probing `getObject(packageId)`.\n * Minimal — the substrate's `ChainProbe` decodes against this; any\n * decode failure surfaces structured. */\nexport const PackageVerifyShape = Schema.Struct({\n\tobjectId: Schema.String,\n\t// A Move package's `type` is the literal `\"package\"` wrapper;\n\t// the SDK's exact shape varies — we keep it open as `Unknown`\n\t// and rely on objectId presence for the \"exists\" signal.\n\ttype: Schema.Unknown,\n});\n\n/**\n * Publish-tx executor — narrow shim that abstracts the concrete\n * `@mysten/sui` wiring (Transaction builder, signer, fullnode\n * ready-probe). The mode-local produce body composes its 5-phase\n * shape against this interface; the concrete implementation lives in\n * `publish-executor.ts` and is constructed once per acquire by the\n * barrel from the resolved `SuiClient` + publisher `AccountValue` +\n * `ContainerRuntime`.\n *\n * The shim parallels `coin/mint.ts::MintSigner` + `MintSdkShim`. We\n * keep them split (publish vs sign vs ready-probe) so the produce\n * body can attribute span annotations per phase + so failures map\n * back to a typed `PublishError` phase enum.\n */\nexport interface PublishExecutor {\n\treadonly scrubsInsideContainer: boolean;\n\n\t/** Build the Move source tree into `{ modules, dependencies }`.\n\t * Dispatches between (a) per-app build container, (b) fresh\n\t * `docker run --rm`, (c) host `sui` CLI. The produce body just\n\t * calls and propagates `PublishError`. */\n\treadonly build: (inputs: {\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t\treadonly chainId: ChainId;\n\t}) => Effect.Effect<BuildOutput, PublishError, Scope.Scope>;\n\n\t/** Construct + sign + execute a `Transaction.publish({modules,\n\t * dependencies})` against the publisher account. Returns the\n\t * output projection that downstream consumers (Coin, manifest,\n\t * capture spec) need. Distilled doc §Move-specific concerns —\n\t * the output is the source of `published` change + the\n\t * `UpgradeCap` `created` change. */\n\treadonly publishTx: (inputs: {\n\t\treadonly modules: ReadonlyArray<Uint8Array>;\n\t\treadonly dependencies: ReadonlyArray<string>;\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t}) => Effect.Effect<LocalPackagePublishOutput, PublishError, Scope.Scope>;\n\n\t/** Post-publish fullnode/indexer ready-probe. Distilled doc\n\t * Invariant 5: publish-tx commit precedes index visibility.\n\t * Polls `getObject(packageId)` until success or a 10s ceiling\n\t * at ~200ms cadence. Failure raises `PublishError('parse')`\n\t * per the distilled doc's phase catalog (\"stuck indexer\"). */\n\treadonly waitForReady: (packageId: string) => Effect.Effect<void, PublishError, Scope.Scope>;\n}\n\nexport interface LocalModeInputs {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly chainId: ChainId;\n\treadonly publisherAddress: string;\n\treadonly mvrOverride?: string;\n\treadonly capture?: (output: LocalPackagePublishOutput) => Readonly<Record<string, string>>;\n\t/** Publish executor — constructed per-acquire by the barrel from\n\t * the resolved SuiClient + publisher account + ContainerRuntime\n\t * (see `publish-executor.ts`). */\n\treadonly executor: PublishExecutor;\n}\n\nexport interface LocalModeOutputs {\n\treadonly resolved: ResolvedLocalPackage;\n\treadonly output: LocalPackagePublishOutput | null;\n}\n\n/**\n * Build the content hash for the publish cache key. Distilled doc\n * §Move-specific: inputs are `(sourceHash, signerAddress)`. The\n * `hashMoveSources` helper already normalises Move.lock pinned\n * sections via the shared `stripPinnedSections`; we fold the\n * publisher address in here as a stable string so reusing the\n * same source under a different signer correctly misses (Invariant\n * 4: \"Signer MUST be an explicit upstream\").\n */\nconst LOCAL_PACKAGE_CACHE_SCHEMA_VERSION = 'v3';\nconst PACKAGE_CACHE_VERIFY_MAX_ATTEMPTS = 20;\nconst PACKAGE_CACHE_VERIFY_DELAY_MS = 250;\n\nconst combineInputsHash = (sourceHash: string, publisherAddress: string) =>\n\tbrandContentHash(\n\t\t`${LOCAL_PACKAGE_CACHE_SCHEMA_VERSION}::source=${sourceHash}::publisher=${publisherAddress}`,\n\t);\n\n/**\n * Verify probe — lenient `getObject(packageId)`. Returns the decoded\n * shape on success; null for BOTH not-found AND transient (distilled\n * doc Invariant 7 + the \"lenient verify cheaper than aggressive\n * eviction\" Constraint).\n *\n * The cached id is hinted in via parameter. The artifact publisher substrate is\n * expected to thread the cached payload through to this closure on\n * cache hit; today we get the id from the registry's previous-cycle\n * entry (in-process, per-supervisor lookup — see `acquireLocal`\n * below). When no hint exists (first cycle / cold boot), we\n * short-circuit to null so the substrate runs `produce`.\n *\n * Mirrors `coin/mint.ts::buildVerifyProbe` exactly so the two artifact publisher\n * consumers stay shape-aligned.\n */\nexport const buildVerifyProbe = (\n\tprobe: ChainProbe<SuiProbeKey>,\n\tcachedPackageIdHint: string | null,\n\topts?: { readonly maxAttempts?: number; readonly delayMs?: number },\n): Effect.Effect<typeof PackageVerifyShape.Type | null, never> =>\n\tEffect.gen(function* () {\n\t\tif (cachedPackageIdHint === null) return null;\n\t\tconst maxAttempts = opts?.maxAttempts ?? PACKAGE_CACHE_VERIFY_MAX_ATTEMPTS;\n\t\tconst delayMs = opts?.delayMs ?? PACKAGE_CACHE_VERIFY_DELAY_MS;\n\t\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\t\t// Lenient mode in the underlying probe already coerces\n\t\t\t// not-found AND transient → null. We retry nulls briefly\n\t\t\t// because local Sui restart can report ready before package\n\t\t\t// objects are immediately queryable, and a false cache miss\n\t\t\t// turns a warm restart into an unnecessary publish.\n\t\t\tconst result: typeof PackageVerifyShape.Type | null = yield* probe\n\t\t\t\t.get({ kind: 'object', objectId: cachedPackageIdHint }, PackageVerifyShape, 'lenient')\n\t\t\t\t.pipe(\n\t\t\t\t\t// The probe's own error channel is `ChainProbeError`; under\n\t\t\t\t\t// lenient mode only `decode-failed` surfaces (not-found +\n\t\t\t\t\t// transient already coerce to null). A decode failure on\n\t\t\t\t\t// verify is treated as \"stale shape\" — null so the substrate\n\t\t\t\t\t// re-publishes rather than carry forward a mismatch.\n\t\t\t\t\tEffect.catch(() => Effect.succeed(null as typeof PackageVerifyShape.Type | null)),\n\t\t\t\t);\n\t\t\tif (result !== null) return result;\n\t\t\tif (attempt < maxAttempts && delayMs > 0) {\n\t\t\t\tyield* Effect.sleep(Duration.millis(delayMs));\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t});\n\n/**\n * Compose the ArtifactSpec for a local publish.\n *\n * The substrate-side `ArtifactPublisher.publish` consumes\n * this spec and handles:\n *\n * - cache lookup under `<namespace>/<chainId>/<contentHash>`;\n * - verify (lenient) when there's a hit;\n * - re-running `produce` on miss OR verify-fail;\n * - calling `register` on EVERY cycle.\n */\nexport const acquireLocal = (\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tregistry: PackageRegistry,\n\tinputs: LocalModeInputs,\n): Effect.Effect<LocalModeOutputs, PublishError | ArtifactPublishError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\t// Distilled doc §Move-specific: hash inputs are `(sourceHash,\n\t\t// signerAddress)`. The hashing helper strips Move.lock pinned\n\t\t// sections (Invariant 2) so warm restarts hit the cache.\n\t\tconst sourceHash = yield* hashMoveSources(inputs.sourcePath);\n\t\tconst inputsHash = combineInputsHash(sourceHash, inputs.publisherAddress);\n\n\t\tconst mvrPlaceholder = mvrSlugify(inputs.mvrOverride ?? inputs.packageName);\n\n\t\t// The in-process registry is consulted on the `register`\n\t\t// callback (verify-hit path) to recover `mvrPlaceholder` +\n\t\t// `captured` columns when the substrate hands back the bare\n\t\t// `{objectId, type}` verify shape; see the register body below.\n\t\tconst priorEntry = yield* registry.find(inputs.packageName);\n\n\t\t// We capture the produce-side output out-of-band so the\n\t\t// returned `LocalModeOutputs.output` can expose it; the artifact publisher\n\t\t// substrate's `Produced | Verified` discrimination collapses\n\t\t// the output away.\n\t\tlet producedOutput: LocalPackagePublishOutput | null = null;\n\n\t\tconst resolved = yield* publisher.publish<CachedPackageEntry, typeof PackageVerifyShape.Type>({\n\t\t\tnamespace: 'package',\n\t\t\tchain: inputs.chainId,\n\t\t\tcontentHash: inputsHash,\n\t\t\tverifySchema: PackageVerifyShape,\n\t\t\tverify: (cached) =>\n\t\t\t\tcached.output === undefined\n\t\t\t\t\t? Effect.succeed(null)\n\t\t\t\t\t: buildVerifyProbe(probe, cached.packageId),\n\t\t\t// Produce: scrub → build → publish-tx → wait-for-index → parse.\n\t\t\t// PublishError is the plugin-internal phase taxonomy; we map\n\t\t\t// it to `ArtifactPublishError` at the substrate boundary.\n\t\t\tproduce: Effect.gen(function* () {\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t'package.publish.package': inputs.packageName,\n\t\t\t\t\t'package.publish.sourcePath': inputs.sourcePath,\n\t\t\t\t\t'package.publish.chainId': inputs.chainId,\n\t\t\t\t\t'package.publish.publisher': inputs.publisherAddress,\n\t\t\t\t});\n\n\t\t\t\t// Produce 1/5 — scrub locks. Distilled doc §Move-specific\n\t\t\t\t// concerns + Invariant 14: strip pinned sections from BOTH\n\t\t\t\t// the package's own Move.lock AND every\n\t\t\t\t// `~/.move/git/**/Move.lock` (vendored dep caches) before\n\t\t\t\t// invoking the build. Uses the unified `stripPinnedSections`\n\t\t\t\t// (re-exported through `build.ts` → from\n\t\t\t\t// `../sui/move-lock-scrub.ts`) — NO duplicate.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ 'package.publish.phase': 'scrub' });\n\t\t\t\tyield* scrubLocksHost(inputs.sourcePath, '~/.move', {\n\t\t\t\t\tpackageLockFailures: inputs.executor.scrubsInsideContainer ? 'best-effort' : 'fatal',\n\t\t\t\t});\n\n\t\t\t\t// Produce 2/5 — build. Executor dispatches between (a)\n\t\t\t\t// per-app build container, (b) `docker run --rm`, (c) host\n\t\t\t\t// `sui` CLI.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ 'package.publish.phase': 'build' });\n\t\t\t\tconst buildOutput: BuildOutput = yield* inputs.executor\n\t\t\t\t\t.build({\n\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\tchainId: inputs.chainId,\n\t\t\t\t\t})\n\t\t\t\t\t.pipe(\n\t\t\t\t\t\tEffect.catchTag(\n\t\t\t\t\t\t\t'PublishError',\n\t\t\t\t\t\t\t(err): Effect.Effect<BuildOutput, PublishError> =>\n\t\t\t\t\t\t\t\t// Re-stamp sourcePath/packageName if the underlying\n\t\t\t\t\t\t\t\t// caller omitted them (every throw site MUST surface\n\t\t\t\t\t\t\t\t// the context — see distilled doc §Opportunities).\n\t\t\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\t\t\terr.sourcePath\n\t\t\t\t\t\t\t\t\t\t? err\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\t...err,\n\t\t\t\t\t\t\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\t\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\t\t// Produce 3/5 — publish-tx. Construct `Transaction.publish`,\n\t\t\t\t// sign + execute via the publisher's account signer, decode\n\t\t\t\t// the output.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ 'package.publish.phase': 'publish-tx' });\n\t\t\t\tconst output: LocalPackagePublishOutput = yield* inputs.executor.publishTx({\n\t\t\t\t\tmodules: buildOutput.modules,\n\t\t\t\t\tdependencies: buildOutput.dependencies,\n\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t});\n\t\t\t\tproducedOutput = output;\n\n\t\t\t\t// Produce 4/5 — wait-for-index. Distilled doc Invariant 5:\n\t\t\t\t// publish-tx commit precedes index visibility. Without this\n\t\t\t\t// gate, downstream tx builders fail with \"Dependent package\n\t\t\t\t// not found\". Failure surfaces as `PublishError('parse')`\n\t\t\t\t// per the distilled doc's phase catalog (\"stuck indexer\").\n\t\t\t\tyield* Effect.annotateCurrentSpan({ 'package.publish.phase': 'waiting-for-index' });\n\t\t\t\tyield* inputs.executor.waitForReady(output.packageId);\n\n\t\t\t\t// Produce 5/5 — parse. Distilled doc §Move-specific\n\t\t\t\t// concerns: pick the `'published'` change for packageId;\n\t\t\t\t// pick the `UpgradeCap`-typed `'created'` change for the\n\t\t\t\t// upgrade cap.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ 'package.publish.phase': 'parse' });\n\t\t\t\tconst published = pickPublishedChange(output.objectChanges);\n\t\t\t\tif (!published?.objectId) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tpublishError('parse', {\n\t\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t'no \"published\" change in output — SDK shape drift (distilled doc §Edge cases)',\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst upgradeCap: PackagePublishObjectChange | undefined = pickUpgradeCapChange(\n\t\t\t\t\toutput.objectChanges,\n\t\t\t\t);\n\n\t\t\t\t// Capture spec — user-declared projection from output to\n\t\t\t\t// typed object id map. Distilled doc §Outputs + Invariant:\n\t\t\t\t// safe to swallow individual key failures (callback form\n\t\t\t\t// is user code), but a callback throw bubbles up as a\n\t\t\t\t// PublishError('parse') so the user catches the typo.\n\t\t\t\tconst captured: Readonly<Record<string, string>> = inputs.capture\n\t\t\t\t\t? yield* Effect.try({\n\t\t\t\t\t\t\ttry: () => inputs.capture!(output),\n\t\t\t\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\t\t\t\tpublishError('parse', {\n\t\t\t\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\t\t\t\tmessage: 'capture callback threw',\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t})\n\t\t\t\t\t: {};\n\n\t\t\t\tconst entry: CachedPackageEntry = {\n\t\t\t\t\tpackageId: published.objectId,\n\t\t\t\t\tupgradeCapId: upgradeCap?.objectId,\n\t\t\t\t\tpublisher: inputs.publisherAddress,\n\t\t\t\t\tmvrPlaceholder,\n\t\t\t\t\tcaptured,\n\t\t\t\t\toutput,\n\t\t\t\t};\n\t\t\t\treturn entry;\n\t\t\t}).pipe(\n\t\t\t\tEffect.mapError(\n\t\t\t\t\t(err): ArtifactPublishError => ({\n\t\t\t\t\t\t_tag: 'ArtifactPublishError',\n\t\t\t\t\t\treason: 'produce-failed',\n\t\t\t\t\t\tdetail: `package.publish ${err.phase}: ${err.message}`,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t\t// Register: on EVERY cycle. Distilled doc Invariant 6.\n\t\t\t// The publisher hands us either `Produced` (CachedPackageEntry)\n\t\t\t// or `Verified` (`{ objectId, type }` from the verifySchema).\n\t\t\t// On verify-hit we project to a synthesized entry; on produce\n\t\t\t// we already have the full shape. The cache-hit path needs\n\t\t\t// to thread through the cached mvrPlaceholder + output. Recompute\n\t\t\t// `captured` from the current capture spec when cached output is\n\t\t\t// present so changing capture keys does not require a republish.\n\t\t\tregister: (artifact) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst entry: CachedPackageEntry =\n\t\t\t\t\t\t'packageId' in artifact\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...artifact,\n\t\t\t\t\t\t\t\t\tcaptured:\n\t\t\t\t\t\t\t\t\t\tinputs.capture !== undefined && artifact.output !== undefined\n\t\t\t\t\t\t\t\t\t\t\t? (() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn inputs.capture(artifact.output);\n\t\t\t\t\t\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn artifact.captured;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t})()\n\t\t\t\t\t\t\t\t\t\t\t: artifact.captured,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t// Verify-hit path: project from the bare\n\t\t\t\t\t\t\t\t\t// `{ objectId, type }` probe shape using the\n\t\t\t\t\t\t\t\t\t// previously-resolved registry entry to recover\n\t\t\t\t\t\t\t\t\t// `mvrPlaceholder` + `captured`. If no prior\n\t\t\t\t\t\t\t\t\t// entry exists (first cold-boot verify hit —\n\t\t\t\t\t\t\t\t\t// unusual; implies a different process wrote\n\t\t\t\t\t\t\t\t\t// the cache), we fall back to safe defaults.\n\t\t\t\t\t\t\t\t\tpackageId: artifact.objectId,\n\t\t\t\t\t\t\t\t\tpublisher: inputs.publisherAddress,\n\t\t\t\t\t\t\t\t\tmvrPlaceholder:\n\t\t\t\t\t\t\t\t\t\tpriorEntry && priorEntry.kind === 'local'\n\t\t\t\t\t\t\t\t\t\t\t? priorEntry.mvrPlaceholder\n\t\t\t\t\t\t\t\t\t\t\t: mvrPlaceholder,\n\t\t\t\t\t\t\t\t\tcaptured: priorEntry && priorEntry.kind === 'local' ? priorEntry.captured : {},\n\t\t\t\t\t\t\t\t\tupgradeCapId:\n\t\t\t\t\t\t\t\t\t\tpriorEntry && priorEntry.kind === 'local' ? priorEntry.upgradeCapId : undefined,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\tconst r: ResolvedLocalPackage = {\n\t\t\t\t\t\tkind: 'local',\n\t\t\t\t\t\tname: inputs.packageName,\n\t\t\t\t\t\tpackageId: entry.packageId,\n\t\t\t\t\t\tupgradeCapId: entry.upgradeCapId,\n\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\tmvrPlaceholder: entry.mvrPlaceholder,\n\t\t\t\t\t\tcaptured: entry.captured,\n\t\t\t\t\t};\n\t\t\t\t\tyield* registry.set(r.name, r);\n\t\t\t\t}),\n\t\t});\n\n\t\t// Project the cached/verified entry back to the resolved shape.\n\t\t// The publisher's `Produced | Verified` union — Produced is\n\t\t// CachedPackageEntry (full); Verified is `{ objectId, type }`\n\t\t// from the verify schema. Both collapse onto the registry's\n\t\t// projected `ResolvedLocalPackage` — and `register` already\n\t\t// performed that projection. Re-read the registry to recover\n\t\t// the unified shape regardless of which arm fired.\n\t\tconst final = yield* registry.find(inputs.packageName);\n\t\tif (!final || final.kind !== 'local') {\n\t\t\t// Defensive — register fires unconditionally; missing entry\n\t\t\t// here would mean substrate skipped register, violating\n\t\t\t// Invariant 6. Surface as a parse-phase failure since it's\n\t\t\t// indistinguishable from a missing 'published' change from\n\t\t\t// the consumer's perspective.\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tpublishError('parse', {\n\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'register did not surface entry — artifact publisher register invariant violation',\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\t// Silence the unused-binding lint for the artifact publisher `resolved` — the\n\t\t// substrate's `Produced | Verified` return is informational\n\t\t// here (we project through the registry instead).\n\t\tvoid resolved;\n\n\t\tconst cachedOutput =\n\t\t\t'packageId' in resolved && 'output' in resolved ? (resolved.output ?? null) : null;\n\n\t\treturn {\n\t\t\tresolved: final,\n\t\t\toutput: producedOutput ?? cachedOutput,\n\t\t};\n\t});\n"],"mappings":";;;;;;;;;;AA6DA,MAAa,qBAAqB,OAAO,OAAO;CAC/C,UAAU,OAAO;CAIjB,MAAM,OAAO;CACb,CAAC;;;;;;;;;;AA6EF,MAAM,qCAAqC;AAC3C,MAAM,oCAAoC;AAC1C,MAAM,gCAAgC;AAEtC,MAAM,qBAAqB,YAAoB,qBAC9CA,YACC,GAAG,mCAAmC,WAAW,WAAW,cAAc,mBAC1E;;;;;;;;;;;;;;;;;AAkBF,MAAa,oBACZ,OACA,qBACA,SAEA,OAAO,IAAI,aAAa;AACvB,KAAI,wBAAwB,KAAM,QAAO;CACzC,MAAM,cAAc,MAAM,eAAe;CACzC,MAAM,UAAU,MAAM,WAAW;AACjC,MAAK,IAAI,UAAU,GAAG,WAAW,aAAa,WAAW;EAMxD,MAAM,SAAgD,OAAO,MAC3D,IAAI;GAAE,MAAM;GAAU,UAAU;GAAqB,EAAE,oBAAoB,UAAU,CACrF,KAMA,OAAO,YAAY,OAAO,QAAQ,KAA8C,CAAC,CACjF;AACF,MAAI,WAAW,KAAM,QAAO;A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E,cACC,cAAc,WAAW,SAAS,UAAU,WAAW,eAAe,KAAA;IACvE;GACJ,MAAM,IAA0B;IAC/B,MAAM;IACN,MAAM,OAAO;IACb,WAAW,MAAM;IACjB,cAAc,MAAM;IACpB,YAAY,OAAO;IACnB,gBAAgB,MAAM;IACtB,UAAU,MAAM;IAChB;AACD,UAAO,SAAS,IAAI,EAAE,MAAM,EAAE;IAC7B;EACH,CAAC;CASF,MAAM,QAAQ,OAAO,SAAS,KAAK,OAAO,YAAY;AACtD,KAAI,CAAC,SAAS,MAAM,SAAS,QAM5B,QAAO,OAAO,OAAO,KACpB,aAAa,SAAS;EACrB,YAAY,OAAO;EACnB,aAAa,OAAO;EACpB,SACC;EACD,CAAC,CACF;CAQF,MAAM,eACL,eAAe,YAAY,YAAY,WAAY,SAAS,UAAU,OAAQ;AAE/E,QAAO;EACN,UAAU;EACV,QAAQ,kBAAkB;EAC1B;EACA"}
1
+ {"version":3,"file":"mode-local.mjs","names":["brandContentHash"],"sources":["../../../src/plugins/package/mode-local.ts"],"sourcesContent":["// Local mode — build from source + publish.\n//\n// This is the canonical implementation of the\n// `ArtifactPublisher` substrate primitive (distilled doc\n// §Generic artifact-publisher-publish pattern). The five-phase shape:\n//\n// 1. Inputs — `{ sourceHash, signerAddress }` →\n// `contentHash(inputs)`.\n// 2. Cache key — `<namespace=package>/<chainId>/<contentHash>`.\n// Substrate folds in chainId for us; we hand\n// it the namespace + contentHash.\n// 3. Verify — `chainProbe.get({ objectId: cachedId },\n// PackageObjectSchema, 'lenient')`. Lenient mode\n// coerces transient RPC failure → null\n// → re-derive (cheap over-derive vs spurious\n// eviction — distilled doc §Constraint \"lenient\n// verify is cheaper than aggressive eviction\").\n// 4. Produce — scrub locks → build → publish-tx → wait-for-\n// index. Each phase narrates to TUI via span\n// annotation.\n// 5. Register — write registry entry on EVERY cycle (hit AND\n// miss). Distilled doc Invariant 6.\n//\n// The publish output is exposed on the resolved value and emitted as a\n// package-owned extension contribution for sibling folds.\n\nimport { Duration, Effect, Schema, type Scope } from 'effect';\n\nimport { contentHash as brandContentHash, type ChainId } from '../../substrate/brand.ts';\nimport {\n\tpickPublishedChange,\n\tpickUpgradeCapChange,\n\ttype PackagePublishObjectChange,\n\ttype LocalPackagePublishOutput,\n} from './publish-output.ts';\nimport {\n\tartifactPublishError,\n\ttype ArtifactPublishError,\n\ttype ArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { SuiProbeKey } from '../sui/index.ts';\nimport { hashMoveSources, scrubLocksHost, type BuildOutput } from './build.ts';\nimport { mvrSlugify } from './dep-resolution.ts';\nimport { type PackageRegistry, type ResolvedLocalPackage } from './registry.ts';\nimport { publishError, type PublishError } from './errors.ts';\nimport { PackageSpans } from './spans.ts';\n\n/** Cache-stored payload — the stable id verify re-confirms on\n * every cycle. Distilled doc Invariant 8: the probe MUST consume\n * a stable identifier (the packageId), NOT a derived hash. */\nexport interface CachedPackageEntry {\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly publisher: string;\n\treadonly mvrPlaceholder: string;\n\treadonly captured: Readonly<Record<string, string>>;\n\treadonly output?: LocalPackagePublishOutput;\n}\n\n/** Verify-schema: what we expect when probing `getObject(packageId)`.\n * Minimal — the substrate's `ChainProbe` decodes against this; any\n * decode failure surfaces structured. */\nexport const PackageVerifyShape = Schema.Struct({\n\tobjectId: Schema.String,\n\t// A Move package's `type` is the literal `\"package\"` wrapper;\n\t// the SDK's exact shape varies — we keep it open as `Unknown`\n\t// and rely on objectId presence for the \"exists\" signal.\n\ttype: Schema.Unknown,\n});\n\n/**\n * Publish-tx executor — narrow shim that abstracts the concrete\n * `@mysten/sui` wiring (Transaction builder, signer, fullnode\n * ready-probe). The mode-local produce body composes its 5-phase\n * shape against this interface; the concrete implementation lives in\n * `publish-executor.ts` and is constructed once per acquire by the\n * barrel from the resolved `SuiClient` + publisher `AccountValue` +\n * `ContainerRuntime`.\n *\n * The shim parallels `coin/mint.ts::MintSigner` + `MintSdkShim`. We\n * keep them split (publish vs sign vs ready-probe) so the produce\n * body can attribute span annotations per phase + so failures map\n * back to a typed `PublishError` phase enum.\n */\nexport interface PublishExecutor {\n\treadonly scrubsInsideContainer: boolean;\n\n\t/** Build the Move source tree into `{ modules, dependencies }`.\n\t * Dispatches between (a) per-app build container, (b) fresh\n\t * `docker run --rm`, (c) host `sui` CLI. The produce body just\n\t * calls and propagates `PublishError`. */\n\treadonly build: (inputs: {\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t\treadonly chainId: ChainId;\n\t}) => Effect.Effect<BuildOutput, PublishError, Scope.Scope>;\n\n\t/** Construct + sign + execute a `Transaction.publish({modules,\n\t * dependencies})` against the publisher account. Returns the\n\t * output projection that downstream consumers (Coin, manifest,\n\t * capture spec) need. Distilled doc §Move-specific concerns —\n\t * the output is the source of `published` change + the\n\t * `UpgradeCap` `created` change. */\n\treadonly publishTx: (inputs: {\n\t\treadonly modules: ReadonlyArray<Uint8Array>;\n\t\treadonly dependencies: ReadonlyArray<string>;\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t}) => Effect.Effect<LocalPackagePublishOutput, PublishError, Scope.Scope>;\n\n\t/** Post-publish fullnode/indexer ready HINT. Distilled doc\n\t * Invariant 5: publish-tx commit precedes index visibility. This\n\t * is BEST-EFFORT — the concrete executor swallows transient\n\t * `getObject` misses (cold index races) because the publisher\n\t * account's `signAndExecute` already calls `waitForTransaction`\n\t * before returning, AND the downstream `parse` phase only\n\t * inspects the publish output. A typed `PublishError('parse')`\n\t * surfaces only when the `getObject` infrastructure itself\n\t * faults (network down / SDK throws non-recoverably), NOT when\n\t * the object is merely not-yet-indexed.\n\t *\n\t * The \"Hint\" suffix encodes the contract: callers MUST NOT treat\n\t * a successful return as \"package definitely queryable now\". */\n\treadonly postPublishReadyHint: (\n\t\tpackageId: string,\n\t) => Effect.Effect<void, PublishError, Scope.Scope>;\n}\n\nexport interface LocalModeInputs {\n\treadonly packageName: string;\n\treadonly sourcePath: string;\n\treadonly chainId: ChainId;\n\treadonly publisherAddress: string;\n\treadonly mvrOverride?: string;\n\treadonly capture?: (output: LocalPackagePublishOutput) => Readonly<Record<string, string>>;\n\t/** Publish executor — constructed per-acquire by the barrel from\n\t * the resolved SuiClient + publisher account + ContainerRuntime\n\t * (see `publish-executor.ts`). */\n\treadonly executor: PublishExecutor;\n}\n\nexport interface LocalModeOutputs {\n\treadonly resolved: ResolvedLocalPackage;\n\treadonly output: LocalPackagePublishOutput | null;\n}\n\n/**\n * Build the content hash for the publish cache key. Distilled doc\n * §Move-specific: inputs are `(sourceHash, signerAddress)`. The\n * `hashMoveSources` helper already normalises Move.lock pinned\n * sections via the shared `stripPinnedSections`; we fold the\n * publisher address in here as a stable string so reusing the\n * same source under a different signer correctly misses (Invariant\n * 4: \"Signer MUST be an explicit upstream\").\n */\nconst LOCAL_PACKAGE_CACHE_SCHEMA_VERSION = 'v3';\nconst PACKAGE_CACHE_VERIFY_MAX_ATTEMPTS = 20;\nconst PACKAGE_CACHE_VERIFY_DELAY_MS = 250;\n\nconst combineInputsHash = (sourceHash: string, publisherAddress: string) =>\n\tbrandContentHash(\n\t\t`${LOCAL_PACKAGE_CACHE_SCHEMA_VERSION}::source=${sourceHash}::publisher=${publisherAddress}`,\n\t);\n\n/**\n * Verify probe — lenient `getObject(packageId)`. Returns the decoded\n * shape on success; null for BOTH not-found AND transient (distilled\n * doc Invariant 7 + the \"lenient verify cheaper than aggressive\n * eviction\" Constraint).\n *\n * The cached id is hinted in via parameter. The artifact publisher substrate is\n * expected to thread the cached payload through to this closure on\n * cache hit; today we get the id from the registry's previous-cycle\n * entry (in-process, per-supervisor lookup — see `acquireLocal`\n * below). When no hint exists (first cycle / cold boot), we\n * short-circuit to null so the substrate runs `produce`.\n *\n * Mirrors `coin/mint.ts::buildVerifyProbe` exactly so the two artifact publisher\n * consumers stay shape-aligned.\n */\nexport const buildVerifyProbe = (\n\tprobe: ChainProbe<SuiProbeKey>,\n\tcachedPackageIdHint: string | null,\n\topts?: { readonly maxAttempts?: number; readonly delayMs?: number },\n): Effect.Effect<typeof PackageVerifyShape.Type | null, never> =>\n\tEffect.gen(function* () {\n\t\tif (cachedPackageIdHint === null) return null;\n\t\tconst maxAttempts = opts?.maxAttempts ?? PACKAGE_CACHE_VERIFY_MAX_ATTEMPTS;\n\t\tconst delayMs = opts?.delayMs ?? PACKAGE_CACHE_VERIFY_DELAY_MS;\n\t\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\t\t// Lenient mode in the underlying probe already coerces\n\t\t\t// not-found AND transient → null. We retry nulls briefly\n\t\t\t// because local Sui restart can report ready before package\n\t\t\t// objects are immediately queryable, and a false cache miss\n\t\t\t// turns a warm restart into an unnecessary publish.\n\t\t\tconst result: typeof PackageVerifyShape.Type | null = yield* probe\n\t\t\t\t.get({ kind: 'object', objectId: cachedPackageIdHint }, PackageVerifyShape, 'lenient')\n\t\t\t\t.pipe(\n\t\t\t\t\t// The probe's own error channel is `ChainProbeError`; under\n\t\t\t\t\t// lenient mode only `decode-failed` surfaces (not-found +\n\t\t\t\t\t// transient already coerce to null). A decode failure on\n\t\t\t\t\t// verify is treated as \"stale shape\" — null so the substrate\n\t\t\t\t\t// re-publishes rather than carry forward a mismatch.\n\t\t\t\t\tEffect.catch(() => Effect.succeed(null as typeof PackageVerifyShape.Type | null)),\n\t\t\t\t);\n\t\t\tif (result !== null) return result;\n\t\t\tif (attempt < maxAttempts && delayMs > 0) {\n\t\t\t\tyield* Effect.sleep(Duration.millis(delayMs));\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t});\n\n/**\n * Compose the ArtifactSpec for a local publish.\n *\n * The substrate-side `ArtifactPublisher.publish` consumes\n * this spec and handles:\n *\n * - cache lookup under `<namespace>/<chainId>/<contentHash>`;\n * - verify (lenient) when there's a hit;\n * - re-running `produce` on miss OR verify-fail;\n * - calling `register` on EVERY cycle.\n */\nexport const acquireLocal = (\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tregistry: PackageRegistry,\n\tinputs: LocalModeInputs,\n): Effect.Effect<LocalModeOutputs, PublishError | ArtifactPublishError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\t// Intra-stack name collision guard.\n\t\t//\n\t\t// The registry is keyed by symbolic `packageName`; two\n\t\t// `localPackage('foo', ...)` calls in the same stack would both\n\t\t// call `register({ name: 'foo', ... })` and the second `set`\n\t\t// would silently overwrite the first. Upstream's\n\t\t// `resolveGraph` (substrate/runtime/lifecycle/dep-graph.ts:127)\n\t\t// explicitly documents \"we don't enforce uniqueness at runtime;\n\t\t// the duplicate just resolves to the latest declaration\" —\n\t\t// compile-time `MissingProviders` only catches collisions on\n\t\t// the user-typed dependency path, NOT two members declared on\n\t\t// the same stack with the same id. We catch the collision here\n\t\t// so the user sees a typed parse-phase failure instead of a\n\t\t// confusing \"wrong packageId\" downstream.\n\t\t//\n\t\t// The check tolerates re-entry from the SAME `localPackage(...)`\n\t\t// call (warm restart / re-acquire on the same scope): a\n\t\t// pre-existing entry with the SAME `sourcePath` is the\n\t\t// previous cycle's register, not a collision.\n\t\tconst existing = yield* registry.find(inputs.packageName);\n\t\tif (\n\t\t\texisting !== null &&\n\t\t\texisting.kind === 'local' &&\n\t\t\texisting.sourcePath !== inputs.sourcePath\n\t\t) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tpublishError('parse', {\n\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`localPackage('${inputs.packageName}') is declared twice in the same stack ` +\n\t\t\t\t\t\t`with different sourcePaths (${existing.sourcePath} vs ${inputs.sourcePath}). ` +\n\t\t\t\t\t\t`The substrate is name-blind at runtime and the second declaration would ` +\n\t\t\t\t\t\t`silently overwrite the first registry entry. Pick distinct package names ` +\n\t\t\t\t\t\t`(the symbolic name is the registry key consumers look up).`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\t// Distilled doc §Move-specific: hash inputs are `(sourceHash,\n\t\t// signerAddress)`. The hashing helper strips Move.lock pinned\n\t\t// sections (Invariant 2) so warm restarts hit the cache.\n\t\tconst sourceHash = yield* hashMoveSources(inputs.sourcePath);\n\t\tconst inputsHash = combineInputsHash(sourceHash, inputs.publisherAddress);\n\n\t\tconst mvrPlaceholder = mvrSlugify(inputs.mvrOverride ?? inputs.packageName);\n\n\t\t// We capture the produce-side output out-of-band so the\n\t\t// returned `LocalModeOutputs.output` can expose it. The\n\t\t// substrate hands back the decoded `CachedPackageEntry` on\n\t\t// every path; `producedOutput` is the freshly-emitted output\n\t\t// from THIS cycle (cache miss only).\n\t\tlet producedOutput: LocalPackagePublishOutput | null = null;\n\n\t\tconst entry: CachedPackageEntry = yield* publisher.publish<\n\t\t\tCachedPackageEntry,\n\t\t\ttypeof PackageVerifyShape.Type\n\t\t>({\n\t\t\tnamespace: 'package',\n\t\t\tchain: inputs.chainId,\n\t\t\tcontentHash: inputsHash,\n\t\t\tverify: (cached) =>\n\t\t\t\tcached.output === undefined\n\t\t\t\t\t? Effect.succeed(null)\n\t\t\t\t\t: buildVerifyProbe(probe, cached.packageId),\n\t\t\t// Produce: scrub → build → publish-tx → wait-for-index → parse.\n\t\t\t// PublishError is the plugin-internal phase taxonomy; we map\n\t\t\t// it to `ArtifactPublishError` at the substrate boundary.\n\t\t\tproduce: Effect.gen(function* () {\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t[PackageSpans.publish.package]: inputs.packageName,\n\t\t\t\t\t[PackageSpans.publish.sourcePath]: inputs.sourcePath,\n\t\t\t\t\t[PackageSpans.publish.chainId]: inputs.chainId,\n\t\t\t\t\t[PackageSpans.publish.publisher]: inputs.publisherAddress,\n\t\t\t\t});\n\n\t\t\t\t// Produce 1/5 — scrub locks. Distilled doc §Move-specific\n\t\t\t\t// concerns + Invariant 14: strip pinned sections from every\n\t\t\t\t// `~/.move/git/**/Move.lock` (vendored dep caches) before\n\t\t\t\t// invoking the build. The package's own Move.lock is scrubbed\n\t\t\t\t// inside the container on a disposable copy, so the developer's\n\t\t\t\t// checked-in source is left untouched host-side. Uses the\n\t\t\t\t// unified `stripPinnedSections` (re-exported through `build.ts`\n\t\t\t\t// → from `../sui/move-lock-scrub.ts`) — NO duplicate.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: 'scrub' });\n\t\t\t\tyield* scrubLocksHost(inputs.sourcePath, '~/.move');\n\n\t\t\t\t// Produce 2/5 — build. Executor dispatches between (a)\n\t\t\t\t// per-app build container, (b) `docker run --rm`, (c) host\n\t\t\t\t// `sui` CLI.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: 'build' });\n\t\t\t\tconst buildOutput: BuildOutput = yield* inputs.executor\n\t\t\t\t\t.build({\n\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\tchainId: inputs.chainId,\n\t\t\t\t\t})\n\t\t\t\t\t.pipe(\n\t\t\t\t\t\tEffect.catchTag(\n\t\t\t\t\t\t\t'PublishError',\n\t\t\t\t\t\t\t(err): Effect.Effect<BuildOutput, PublishError> =>\n\t\t\t\t\t\t\t\t// Re-stamp sourcePath/packageName if the underlying\n\t\t\t\t\t\t\t\t// caller omitted them (every throw site MUST surface\n\t\t\t\t\t\t\t\t// the context — see distilled doc §Opportunities).\n\t\t\t\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\t\t\t\terr.sourcePath\n\t\t\t\t\t\t\t\t\t\t? err\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\t...err,\n\t\t\t\t\t\t\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\t\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\n\t\t\t\t// Produce 3/5 — publish-tx. Construct `Transaction.publish`,\n\t\t\t\t// sign + execute via the publisher's account signer, decode\n\t\t\t\t// the output.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: 'publish-tx' });\n\t\t\t\tconst output: LocalPackagePublishOutput = yield* inputs.executor.publishTx({\n\t\t\t\t\tmodules: buildOutput.modules,\n\t\t\t\t\tdependencies: buildOutput.dependencies,\n\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t});\n\t\t\t\tproducedOutput = output;\n\n\t\t\t\t// Produce 4/5 — wait-for-index. Distilled doc Invariant 5:\n\t\t\t\t// publish-tx commit precedes index visibility. This is a\n\t\t\t\t// hint-only probe (see `postPublishReadyHint` doc on\n\t\t\t\t// `PublishExecutor`): the publisher account's\n\t\t\t\t// `signAndExecute` already awaits `waitForTransaction`, so\n\t\t\t\t// the typical race is closed before we reach here.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: 'waiting-for-index' });\n\t\t\t\t// Best-effort only: the executor's hint swallows transient\n\t\t\t\t// `getObject` misses and logs at debug, so its error channel\n\t\t\t\t// collapses to `never` (see `publish-executor.ts →\n\t\t\t\t// postPublishReadyHint`). No re-stamp is needed because no\n\t\t\t\t// failure surfaces here.\n\t\t\t\tyield* inputs.executor.postPublishReadyHint(output.packageId);\n\n\t\t\t\t// Produce 5/5 — parse. Distilled doc §Move-specific\n\t\t\t\t// concerns: pick the `'published'` change for packageId;\n\t\t\t\t// pick the `UpgradeCap`-typed `'created'` change for the\n\t\t\t\t// upgrade cap.\n\t\t\t\tyield* Effect.annotateCurrentSpan({ [PackageSpans.publish.phase]: 'parse' });\n\t\t\t\tconst published = pickPublishedChange(output.objectChanges);\n\t\t\t\tif (!published?.objectId) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tpublishError('parse', {\n\t\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t'no \"published\" change in output — SDK shape drift (distilled doc §Edge cases)',\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst upgradeCap: PackagePublishObjectChange | undefined = pickUpgradeCapChange(\n\t\t\t\t\toutput.objectChanges,\n\t\t\t\t);\n\n\t\t\t\t// Capture spec — user-declared projection from output to\n\t\t\t\t// typed object id map. Distilled doc §Outputs: the callback\n\t\t\t\t// is user code, so a throw is a USER BUG (typo / missing\n\t\t\t\t// field) — surface as `PublishError('parse')` so the user\n\t\t\t\t// catches the mistake instead of silently shipping a stale\n\t\t\t\t// captured map. The cache-HIT path performs the symmetric\n\t\t\t\t// recompute post-`publisher.publish` (see comment block\n\t\t\t\t// below the `publisher.publish` call) — both paths bubble\n\t\t\t\t// the same `PublishError('parse')` shape.\n\t\t\t\tconst captured: Readonly<Record<string, string>> = inputs.capture\n\t\t\t\t\t? yield* Effect.try({\n\t\t\t\t\t\t\ttry: () => inputs.capture!(output),\n\t\t\t\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\t\t\t\tpublishError('parse', {\n\t\t\t\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\t\t\t\tmessage: 'capture callback threw',\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t})\n\t\t\t\t\t: {};\n\n\t\t\t\tconst entry: CachedPackageEntry = {\n\t\t\t\t\tpackageId: published.objectId,\n\t\t\t\t\tupgradeCapId: upgradeCap?.objectId,\n\t\t\t\t\tpublisher: inputs.publisherAddress,\n\t\t\t\t\tmvrPlaceholder,\n\t\t\t\t\tcaptured,\n\t\t\t\t\toutput,\n\t\t\t\t};\n\t\t\t\treturn entry;\n\t\t\t}).pipe(\n\t\t\t\tEffect.mapError(\n\t\t\t\t\t(err): ArtifactPublishError =>\n\t\t\t\t\t\tartifactPublishError('produce-failed', `package.publish ${err.phase}: ${err.message}`),\n\t\t\t\t),\n\t\t\t),\n\t\t\t// Register: on EVERY cycle. Distilled doc Invariant 6. The\n\t\t\t// substrate hands the decoded `CachedPackageEntry` payload\n\t\t\t// here on both verify-hit and freshly-produced paths.\n\t\t\t//\n\t\t\t// Register writes the entry verbatim using `artifact.captured`\n\t\t\t// (produce-time on miss; cached on hit). The user's `capture`\n\t\t\t// callback is NOT re-run here — `register`'s contract is\n\t\t\t// `Effect.Effect<void, never>` (primitives/artifact-publisher.ts)\n\t\t\t// and a user-bug throw needs a typed failure channel. The\n\t\t\t// post-publish recompute below (cache-hit branch) re-runs\n\t\t\t// `capture` so renamed/typo keys surface IDENTICALLY to the\n\t\t\t// cache-miss path (mode-local.ts:346-357) — i.e., as\n\t\t\t// `PublishError('parse')`.\n\t\t\tregister: (artifact) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst r: ResolvedLocalPackage = {\n\t\t\t\t\t\tkind: 'local',\n\t\t\t\t\t\tname: inputs.packageName,\n\t\t\t\t\t\tpackageId: artifact.packageId,\n\t\t\t\t\t\tupgradeCapId: artifact.upgradeCapId,\n\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\tmvrPlaceholder: artifact.mvrPlaceholder,\n\t\t\t\t\t\tcaptured: artifact.captured,\n\t\t\t\t\t};\n\t\t\t\t\tyield* registry.set(r.name, r);\n\t\t\t\t}),\n\t\t});\n\n\t\t// Post-publish capture recompute — cache-hit ONLY.\n\t\t//\n\t\t// Symmetric with the produce-time capture (L346-357): the user's\n\t\t// `capture` callback is user code; a throw is a user bug (typo /\n\t\t// renamed key against a stale cached output) and MUST surface as\n\t\t// `PublishError('parse')` so the user sees the mistake instead of\n\t\t// silently carrying forward `artifact.captured` (the historical\n\t\t// `try { ... } catch { return artifact.captured }` hid renamed\n\t\t// keys behind stale data — A5 of the remediation plan).\n\t\t//\n\t\t// Cache miss: `producedOutput` was set inside `produce`, the\n\t\t// produce-time capture already ran (Effect.try → PublishError),\n\t\t// and the substrate cached the produced entry. Re-running here\n\t\t// would be redundant and would double-throw on user bugs.\n\t\t//\n\t\t// Cache hit: `producedOutput` is null, `entry.output` came from\n\t\t// the cached payload, and `entry.captured` is whatever the user's\n\t\t// `capture` returned at the time of the original publish. We\n\t\t// re-run `capture(entry.output)` so warm restarts with renamed\n\t\t// capture keys (a) reflect the new shape in the registry without\n\t\t// requiring a republish, and (b) FAIL LOUDLY on user-callback\n\t\t// throws — the symmetric counterpart to the produce-time guard.\n\t\tconst cacheHit = producedOutput === null;\n\t\tif (cacheHit && inputs.capture !== undefined && entry.output !== undefined) {\n\t\t\tconst recomputedCaptured: Readonly<Record<string, string>> = yield* Effect.try({\n\t\t\t\ttry: () => inputs.capture!(entry.output!),\n\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\tpublishError('parse', {\n\t\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\t\tmessage: 'capture callback threw',\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t}).pipe(\n\t\t\t\t// Match the produce-body `mapError` projection (L373-379)\n\t\t\t\t// so callers see ONE consistent failure shape on\n\t\t\t\t// `capture` throws — `ArtifactPublishError('produce-failed')`\n\t\t\t\t// with `detail: \"package.publish parse: capture callback\n\t\t\t\t// threw\"` — regardless of whether the bug surfaces on a\n\t\t\t\t// cache miss (inside `produce`) or a cache hit (here).\n\t\t\t\tEffect.mapError(\n\t\t\t\t\t(err): ArtifactPublishError =>\n\t\t\t\t\t\tartifactPublishError('produce-failed', `package.publish ${err.phase}: ${err.message}`),\n\t\t\t\t),\n\t\t\t);\n\t\t\tyield* registry.set(inputs.packageName, {\n\t\t\t\tkind: 'local',\n\t\t\t\tname: inputs.packageName,\n\t\t\t\tpackageId: entry.packageId,\n\t\t\t\tupgradeCapId: entry.upgradeCapId,\n\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\tmvrPlaceholder: entry.mvrPlaceholder,\n\t\t\t\tcaptured: recomputedCaptured,\n\t\t\t});\n\t\t}\n\n\t\t// Project the cached entry back to the resolved shape. The\n\t\t// publisher returned the decoded `CachedPackageEntry`; re-read\n\t\t// the registry to recover the canonical `ResolvedLocalPackage`\n\t\t// shape (`register` ran on every cycle and wrote it).\n\t\tconst final = yield* registry.find(inputs.packageName);\n\t\tif (!final || final.kind !== 'local') {\n\t\t\t// Defensive — register fires unconditionally; missing entry\n\t\t\t// here would mean substrate skipped register, violating\n\t\t\t// Invariant 6. Surface as a parse-phase failure since it's\n\t\t\t// indistinguishable from a missing 'published' change from\n\t\t\t// the consumer's perspective.\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tpublishError('parse', {\n\t\t\t\t\tsourcePath: inputs.sourcePath,\n\t\t\t\t\tpackageName: inputs.packageName,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'register did not surface entry — artifact publisher register invariant violation',\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tresolved: final,\n\t\t\toutput: producedOutput ?? entry.output ?? null,\n\t\t};\n\t});\n"],"mappings":";;;;;;;;;;;;;AA+DA,MAAa,qBAAqB,OAAO,OAAO;CAC/C,UAAU,OAAO;CAIjB,MAAM,OAAO;CACb,CAAC;;;;;;;;;;AAuFF,MAAM,qCAAqC;AAC3C,MAAM,oCAAoC;AAC1C,MAAM,gCAAgC;AAEtC,MAAM,qBAAqB,YAAoB,qBAC9CA,YACC,GAAG,mCAAmC,WAAW,WAAW,cAAc,mBAC1E;;;;;;;;;;;;;;;;;AAkBF,MAAa,oBACZ,OACA,qBACA,SAEA,OAAO,IAAI,aAAa;AACvB,KAAI,wBAAwB,KAAM,QAAO;CACzC,MAAM,cAAc,MAAM,eAAe;CACzC,MAAM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IACA;IACA;IAEW;IACX,CAAC,KACF,OAAO,UACL,QACA,qBAAqB,kBAAkB,mBAAmB,IAAI,MAAM,IAAI,IAAI,UAAU,CACvF,CACD;EAcD,WAAW,aACV,OAAO,IAAI,aAAa;GACvB,MAAM,IAA0B;IAC/B,MAAM;IACN,MAAM,OAAO;IACb,WAAW,SAAS;IACpB,cAAc,SAAS;IACvB,YAAY,OAAO;IACnB,gBAAgB,SAAS;IACzB,UAAU,SAAS;IACnB;AACD,UAAO,SAAS,IAAI,EAAE,MAAM,EAAE;IAC7B;EACH,CAAC;AAyBF,KADiB,mBAAmB,QACpB,OAAO,YAAY,KAAA,KAAa,MAAM,WAAW,KAAA,GAAW;EAC3E,MAAM,qBAAuD,OAAO,OAAO,IAAI;GAC9E,WAAW,OAAO,QAAS,MAAM,OAAQ;GACzC,QAAQ,UACP,aAAa,SAAS;IACrB,YAAY,OAAO;IACnB,aAAa,OAAO;IACpB,SAAS;IACT;IACA,CAAC;GACH,CAAC,CAAC,KAOF,OAAO,UACL,QACA,qBAAqB,kBAAkB,mBAAmB,IAAI,MAAM,IAAI,IAAI,UAAU,CACvF,CACD;AACD,SAAO,SAAS,IAAI,OAAO,aAAa;GACvC,MAAM;GACN,MAAM,OAAO;GACb,WAAW,MAAM;GACjB,cAAc,MAAM;GACpB,YAAY,OAAO;GACnB,gBAAgB,MAAM;GACtB,UAAU;GACV,CAAC;;CAOH,MAAM,QAAQ,OAAO,SAAS,KAAK,OAAO,YAAY;AACtD,KAAI,CAAC,SAAS,MAAM,SAAS,QAM5B,QAAO,OAAO,OAAO,KACpB,aAAa,SAAS;EACrB,YAAY,OAAO;EACnB,aAAa,OAAO;EACpB,SACC;EACD,CAAC,CACF;AAGF,QAAO;EACN,UAAU;EACV,QAAQ,kBAAkB,MAAM,UAAU;EAC1C;EACA"}
@@ -1,6 +1,11 @@
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";
1
4
  import { buildForkImpersonationTransactionBytes } from "../sui/fork-transaction.mjs";
5
+ import "../sui/index.mjs";
2
6
  import { publishError } from "./errors.mjs";
3
7
  import { runMoveBuild } from "./build.mjs";
8
+ import { PackageSpans } from "./spans.mjs";
4
9
  import { Effect } from "effect";
5
10
  import { Transaction } from "@mysten/sui/transactions";
6
11
  //#region src/plugins/package/publish-executor.ts
@@ -20,47 +25,45 @@ const projectHydratedObjectFields = (raw) => {
20
25
  };
21
26
  const hydrateCreatedObject = (sdk, change) => {
22
27
  if (!shouldHydrateCreatedObject(change) || change.objectId === void 0) return Effect.succeed(change);
28
+ const objectId = change.objectId;
23
29
  return Effect.tryPromise({
24
30
  try: () => sdk.core.getObject({
25
- objectId: change.objectId,
31
+ objectId,
26
32
  include: { json: true }
27
33
  }),
28
- catch: () => null
34
+ catch: (cause) => cause
29
35
  }).pipe(Effect.map((raw) => ({
30
36
  ...change,
31
37
  ...raw === null ? {} : projectHydratedObjectFields(raw)
32
- })), Effect.catch(() => Effect.succeed(change)));
38
+ })), Effect.catch((cause) => Effect.logDebug("package: hydrate-created-object cache miss").pipe(Effect.annotateLogs({
39
+ objectId,
40
+ cause: String(cause)
41
+ }), Effect.as(change))));
33
42
  };
34
43
  const hydrateCreatedObjects = (sdk, changes) => Effect.forEach(changes, (change) => hydrateCreatedObject(sdk, change), { concurrency: "unbounded" });
35
- const rawEnvelopeFromAccountTx = (tx) => {
36
- const objectTypes = {};
37
- const changedObjects = [];
44
+ /** Project an account TxResult's flat `objectChanges` (`{type,
45
+ * objectId, objectType?, ...}`) into the publish-output
46
+ * `PackagePublishObjectChange[]` shape. The account plugin's
47
+ * projection already classifies entries by `type`
48
+ * (`published` for `outputState: 'PackageWrite'`, `created` for
49
+ * `idOperation: 'Created'`, `mutated` otherwise); we just narrow
50
+ * to the entries we care about (published + created) and drop the
51
+ * extras. */
52
+ const publishChangesFromTxResult = (tx) => {
53
+ const out = [];
38
54
  for (const change of tx.objectChanges) {
39
55
  if (typeof change !== "object" || change === null) continue;
40
- const objectId = change.objectId;
41
- if (typeof objectId !== "string") continue;
42
- const objectType = change.objectType;
43
- if (typeof objectType === "string") objectTypes[objectId] = objectType;
44
- const type = change.type;
45
- const outputState = change.outputState;
46
- const idOperation = change.idOperation;
47
- const entry = { objectId };
48
- if (typeof outputState === "string") entry.outputState = outputState;
49
- else if (type === "published") entry.outputState = "PackageWrite";
50
- else if (type === "created" || type === "mutated") entry.outputState = "ObjectWrite";
51
- if (typeof idOperation === "string") entry.idOperation = idOperation;
52
- else if (type === "created" || type === "published") entry.idOperation = "Created";
53
- else if (type === "mutated") entry.idOperation = "None";
54
- changedObjects.push(entry);
56
+ const projected = change;
57
+ if (typeof projected.objectId !== "string") continue;
58
+ if (projected.type !== "published" && projected.type !== "created") continue;
59
+ const objectType = typeof projected.objectType === "string" ? projected.objectType : void 0;
60
+ out.push({
61
+ type: projected.type,
62
+ objectId: projected.objectId,
63
+ ...objectType !== void 0 ? { objectType } : {}
64
+ });
55
65
  }
56
- return {
57
- $kind: "Transaction",
58
- Transaction: {
59
- digest: tx.digest,
60
- effects: { changedObjects },
61
- objectTypes
62
- }
63
- };
66
+ return out;
64
67
  };
65
68
  /**
66
69
  * Construct a `PublishExecutor` from the barrel's resolved inputs.
@@ -86,115 +89,53 @@ const makePublishExecutor = (inputs) => ({
86
89
  dependencies: [...dependencies]
87
90
  });
88
91
  tx.transferObjects([upgradeCapArg], inputs.account.address);
89
- const sdkClient = inputs.sdk.client;
90
- const rawResult = yield* inputs.account.withTransactionSigner((lockedSigner) => Effect.gen(function* () {
91
- const txBytes = inputs.account.source === "impersonate" ? yield* buildForkImpersonationTransactionBytes(tx, inputs.account.address, inputs.sdk.core).pipe(Effect.mapError((cause) => publishError("publish-tx", {
92
+ const { digest, objectChanges } = yield* signAndDispatch({
93
+ signerSource: inputs.account,
94
+ buildTxBytes: () => inputs.account.source === "impersonate" || inputs.forkMode === true ? buildForkImpersonationTransactionBytes(tx, inputs.account.address, inputs.sdk.core).pipe(Effect.mapError((cause) => publishError("publish-tx", {
92
95
  sourcePath,
93
96
  packageName,
94
97
  message: `Fork impersonation Transaction.build failed for package '${packageName}': ` + cause.message,
95
98
  cause
96
- }))) : yield* Effect.tryPromise({
99
+ }))) : Effect.tryPromise({
97
100
  try: () => tx.build({ client: inputs.sdk.client }),
98
101
  catch: (cause) => publishError("publish-tx", {
99
102
  sourcePath,
100
103
  packageName,
101
- message: `Transaction.build failed for package '${packageName}': ` + (cause instanceof Error ? cause.message : String(cause)),
104
+ message: `Transaction.build failed for package '${packageName}': ` + formatUnknownError(cause),
102
105
  cause
103
106
  })
104
- });
105
- if (inputs.account.source === "impersonate") return rawEnvelopeFromAccountTx(yield* lockedSigner.signAndExecute(txBytes).pipe(Effect.mapError((cause) => publishError("publish-tx", {
107
+ }),
108
+ mapSignError: (cause) => publishError("publish-tx", {
106
109
  sourcePath,
107
110
  packageName,
108
- message: `account.signAndExecute failed for publisher '${inputs.account.name}' (address=${inputs.account.address}): ${cause instanceof Error ? cause.message : String(cause)}`,
111
+ message: `account.signAndExecute failed for publisher '${inputs.account.name}' (address=${inputs.account.address}): ${formatUnknownError(cause)}`,
109
112
  cause
110
- }))));
111
- const signed = yield* lockedSigner.signTransaction(txBytes).pipe(Effect.mapError((cause) => publishError("publish-tx", {
113
+ }),
114
+ onFailed: (failure) => Effect.fail(publishError("publish-tx", {
112
115
  sourcePath,
113
116
  packageName,
114
- message: `account.signTransaction failed for publisher '${inputs.account.name}' (address=${inputs.account.address}): ${cause instanceof Error ? cause.message : String(cause)}`,
115
- cause
116
- })));
117
- const raw = yield* Effect.tryPromise({
118
- try: () => sdkClient.executeTransaction({
119
- transaction: txBytes,
120
- signatures: [signed.signature],
121
- include: {
122
- effects: true,
123
- objectTypes: true
124
- }
125
- }),
126
- catch: (cause) => publishError("publish-tx", {
127
- sourcePath,
128
- packageName,
129
- message: `executeTransaction failed for publisher '${inputs.account.name}': ` + (cause instanceof Error ? cause.message : String(cause)),
130
- cause
131
- })
132
- });
133
- const envelope = raw;
134
- const digest = envelope.Transaction?.digest ?? envelope.FailedTransaction?.digest;
135
- if (digest !== void 0) yield* Effect.tryPromise({
136
- try: () => sdkClient.waitForTransaction({ digest }),
137
- catch: (cause) => publishError("publish-tx", {
138
- sourcePath,
139
- packageName,
140
- message: `waitForTransaction(${digest}) failed`,
141
- cause
142
- })
143
- });
144
- return raw;
145
- }));
146
- const env = rawResult;
147
- if (env.$kind === "FailedTransaction") return yield* Effect.fail(publishError("publish-tx", {
148
- sourcePath,
149
- packageName,
150
- message: `executeTransaction returned FailedTransaction (digest=${env.FailedTransaction?.digest ?? "<unknown>"}): ` + (env.FailedTransaction?.status?.error ?? "<no error>")
151
- }));
152
- const txOk = env.Transaction;
153
- if (txOk?.digest === void 0) return yield* Effect.fail(publishError("publish-tx", {
154
- sourcePath,
155
- packageName,
156
- message: `executeTransaction returned no digest. Raw=${JSON.stringify(rawResult).slice(0, 300)}`
157
- }));
158
- const objectChanges = [];
159
- const objectTypes = txOk.objectTypes ?? {};
160
- for (const ch of txOk.effects?.changedObjects ?? []) {
161
- if (!ch.objectId) continue;
162
- const objectType = objectTypes[ch.objectId];
163
- if (ch.outputState === "PackageWrite") objectChanges.push({
164
- type: "published",
165
- objectId: ch.objectId,
166
- ...objectType !== void 0 ? { objectType } : {}
167
- });
168
- else if (ch.idOperation === "Created") objectChanges.push({
169
- type: "created",
170
- objectId: ch.objectId,
171
- ...objectType !== void 0 ? { objectType } : {}
172
- });
173
- }
117
+ message: `executeTransaction returned FailedTransaction ` + formatExecutedFailure(failure)
118
+ })),
119
+ onSuccess: (txResult) => Effect.succeed({
120
+ digest: txResult.digest,
121
+ objectChanges: publishChangesFromTxResult(txResult)
122
+ })
123
+ });
174
124
  const published = objectChanges.find((c) => c.type === "published");
175
125
  const upgradeCap = objectChanges.find((c) => c.type === "created" && (c.objectType?.endsWith("::package::UpgradeCap") ?? false));
176
126
  const hydratedObjectChanges = yield* hydrateCreatedObjects(inputs.sdk, objectChanges);
177
127
  return {
178
- digest: txOk.digest,
128
+ digest,
179
129
  packageId: published?.objectId ?? "",
180
130
  publisher: inputs.account.address,
181
131
  ...upgradeCap?.objectId !== void 0 ? { upgradeCapId: upgradeCap.objectId } : {},
182
132
  objectChanges: hydratedObjectChanges
183
133
  };
184
- }).pipe(Effect.withSpan("package.publish-tx", { attributes: { "package.publish.packageName": packageName } })),
185
- waitForReady: (packageId) => Effect.tryPromise({
186
- try: async () => {
187
- try {
188
- await inputs.sdk.core.getObject({ objectId: packageId });
189
- } catch {}
190
- },
191
- catch: (cause) => publishError("parse", {
192
- sourcePath: "<wait-for-ready>",
193
- packageName: packageId,
194
- message: `waitForReady(${packageId}) failed`,
195
- cause
196
- })
197
- }).pipe(Effect.withSpan("package.wait-for-ready", { attributes: { "package.publish.packageId": packageId } }))
134
+ }).pipe(Effect.withSpan("devstack.plugin.package.publish-tx", { attributes: { [PackageSpans.publish.packageName]: packageName } })),
135
+ postPublishReadyHint: (packageId) => Effect.tryPromise(() => inputs.sdk.core.getObject({ objectId: packageId })).pipe(Effect.asVoid, Effect.catch((cause) => Effect.logDebug("package: post-publish ready-hint read failed").pipe(Effect.annotateLogs({
136
+ packageId,
137
+ cause: String(cause)
138
+ }))), Effect.withSpan("devstack.plugin.package.post-publish-ready-hint", { attributes: { [PackageSpans.publish.packageId]: packageId } }))
198
139
  });
199
140
  //#endregion
200
141
  export { makePublishExecutor };
@@ -1 +1 @@
1
- {"version":3,"file":"publish-executor.mjs","names":[],"sources":["../../../src/plugins/package/publish-executor.ts"],"sourcesContent":["// Concrete `PublishExecutor` — wires the Move build, publish-tx\n// builder, and post-publish ready-probe over (a) the resolved\n// `SuiClient` from the Sui dependency and (b) the publisher account's signer\n// from the account dependency.\n//\n// Architecture: the executor is a small adapter — `mode-local.ts`\n// owns the 5-phase produce body (scrub → build → publish-tx → wait-\n// for-index → parse); this file just satisfies the `PublishExecutor`\n// interface by:\n//\n// 1. Delegating `build` to `runMoveBuild` (the existing path-(a)/\n// path-(b)/path-(c) dispatcher in `build.ts`).\n// 2. Constructing a `Transaction.publish({modules, dependencies})`\n// for `publishTx`, serialising via `tx.build({ client })`,\n// signing/executing inside the publisher account's transaction\n// critical section, and projecting the response to a\n// `LocalPackagePublishOutput`.\n// 3. Wrapping `sdk.core.waitForTransaction({ digest })` for\n// `waitForReady` — the SDK already retries / waits for index\n// visibility internally.\n//\n// Errors:\n// - Each method maps its concrete failure → a typed `PublishError`\n// whose `phase:` matches the produce-step taxonomy\n// (`build` / `publish-tx` / `parse`).\n// - Account sign failures roll into `publish-tx` with cause-chain\n// preserved; the cascade formatter unwraps them.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { AccountValue, TxResult } from '../account/service.ts';\nimport type { ContainerRuntime, ImageRef } from '../../contracts/container-runtime.ts';\nimport type { ChainId } from '../../substrate/brand.ts';\nimport { buildForkImpersonationTransactionBytes } from '../sui/fork-transaction.ts';\nimport { runMoveBuild, type BuildOutput } from './build.ts';\nimport type { LocalPackagePublishOutput, PackagePublishObjectChange } from './publish-output.ts';\nimport { publishError, type PublishError } from './errors.ts';\nimport type { PublishExecutor } from './mode-local.ts';\nimport type { SuiSdkShim } from '../sui/chain-probe.ts';\n\nconst shouldHydrateCreatedObject = (change: PackagePublishObjectChange): boolean =>\n\tchange.type === 'created' &&\n\tchange.objectId !== undefined &&\n\tchange.objectType !== undefined &&\n\t(change.objectType.includes('::coin::TreasuryCap<') ||\n\t\tchange.objectType.includes('::coin::CoinMetadata<') ||\n\t\tchange.objectType.includes('::coin_registry::Currency<'));\n\nconst projectObjectPayload = (raw: unknown): unknown => {\n\tif (raw !== null && typeof raw === 'object' && 'object' in raw) {\n\t\treturn (raw as { readonly object?: unknown }).object;\n\t}\n\treturn raw;\n};\n\nconst projectHydratedObjectFields = (\n\traw: unknown,\n): Pick<PackagePublishObjectChange, 'owner' | 'json'> => {\n\tconst object = projectObjectPayload(raw);\n\tif (object === null || typeof object !== 'object') return {};\n\tconst payload = object as { readonly owner?: unknown; readonly json?: unknown };\n\treturn {\n\t\t...(payload.owner === undefined ? {} : { owner: payload.owner }),\n\t\t...(payload.json === undefined ? {} : { json: payload.json }),\n\t};\n};\n\nconst hydrateCreatedObject = (\n\tsdk: SuiSdkShim,\n\tchange: PackagePublishObjectChange,\n): Effect.Effect<PackagePublishObjectChange> => {\n\tif (!shouldHydrateCreatedObject(change) || change.objectId === undefined) {\n\t\treturn Effect.succeed(change);\n\t}\n\treturn Effect.tryPromise({\n\t\ttry: () =>\n\t\t\tsdk.core.getObject({\n\t\t\t\tobjectId: change.objectId!,\n\t\t\t\tinclude: { json: true },\n\t\t\t}),\n\t\tcatch: () => null,\n\t}).pipe(\n\t\tEffect.map((raw) => ({\n\t\t\t...change,\n\t\t\t...(raw === null ? {} : projectHydratedObjectFields(raw)),\n\t\t})),\n\t\tEffect.catch(() => Effect.succeed(change)),\n\t);\n};\n\nconst hydrateCreatedObjects = (\n\tsdk: SuiSdkShim,\n\tchanges: ReadonlyArray<PackagePublishObjectChange>,\n): Effect.Effect<ReadonlyArray<PackagePublishObjectChange>> =>\n\tEffect.forEach(changes, (change) => hydrateCreatedObject(sdk, change), {\n\t\tconcurrency: 'unbounded',\n\t});\n\nconst rawEnvelopeFromAccountTx = (tx: TxResult): unknown => {\n\tconst objectTypes: Record<string, string> = {};\n\tconst changedObjects: Array<{\n\t\treadonly objectId: string;\n\t\treadonly outputState?: string;\n\t\treadonly idOperation?: string;\n\t}> = [];\n\tfor (const change of tx.objectChanges) {\n\t\tif (typeof change !== 'object' || change === null) continue;\n\t\tconst objectId = (change as { readonly objectId?: unknown }).objectId;\n\t\tif (typeof objectId !== 'string') continue;\n\t\tconst objectType = (change as { readonly objectType?: unknown }).objectType;\n\t\tif (typeof objectType === 'string') objectTypes[objectId] = objectType;\n\t\tconst type = (change as { readonly type?: unknown }).type;\n\t\tconst outputState = (change as { readonly outputState?: unknown }).outputState;\n\t\tconst idOperation = (change as { readonly idOperation?: unknown }).idOperation;\n\t\tconst entry: {\n\t\t\tobjectId: string;\n\t\t\toutputState?: string;\n\t\t\tidOperation?: string;\n\t\t} = { objectId };\n\t\tif (typeof outputState === 'string') {\n\t\t\tentry.outputState = outputState;\n\t\t} else if (type === 'published') {\n\t\t\tentry.outputState = 'PackageWrite';\n\t\t} else if (type === 'created' || type === 'mutated') {\n\t\t\tentry.outputState = 'ObjectWrite';\n\t\t}\n\t\tif (typeof idOperation === 'string') {\n\t\t\tentry.idOperation = idOperation;\n\t\t} else if (type === 'created' || type === 'published') {\n\t\t\tentry.idOperation = 'Created';\n\t\t} else if (type === 'mutated') {\n\t\t\tentry.idOperation = 'None';\n\t\t}\n\t\tchangedObjects.push(entry);\n\t}\n\treturn {\n\t\t$kind: 'Transaction',\n\t\tTransaction: {\n\t\t\tdigest: tx.digest,\n\t\t\teffects: { changedObjects },\n\t\t\tobjectTypes,\n\t\t},\n\t};\n};\n\n// ---------------------------------------------------------------------------\n// Per-acquire inputs threaded by the barrel\n// ---------------------------------------------------------------------------\n\nexport interface PublishExecutorInputs {\n\t/** The resolved SDK shim from the Sui dependency. Carries `core.executeTransaction`,\n\t * `core.waitForTransaction`, plus the opaque `client` ref used by\n\t * `Transaction.build({ client })`. */\n\treadonly sdk: SuiSdkShim;\n\t/** Publisher account — provides `signAndExecute` (which internally\n\t * signs, submits via `executeTransaction`, and awaits finality via\n\t * `waitForTransaction`). The address surfaces as the publisher on\n\t * the output. */\n\treadonly account: AccountValue;\n\t/** Container runtime + image consumed by `runMoveBuild`'s path-(b)\n\t * (`docker run --rm`). Absent → path-(c) (host CLI). */\n\treadonly runtime?: ContainerRuntime | undefined;\n\treadonly buildImage?: ImageRef | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Executor factory\n// ---------------------------------------------------------------------------\n\n/**\n * Construct a `PublishExecutor` from the barrel's resolved inputs.\n *\n * The factory exists so the barrel can compose the executor once per\n * acquire and hand the result to `acquireLocal`. Internally the three\n * methods are closures over the inputs; no per-call construction.\n */\nexport const makePublishExecutor = (inputs: PublishExecutorInputs): PublishExecutor => ({\n\tscrubsInsideContainer: inputs.runtime !== undefined && inputs.buildImage !== undefined,\n\n\t// Build step — delegate to the Move-build dispatcher in `build.ts`.\n\tbuild: ({\n\t\tsourcePath,\n\t\tpackageName,\n\t\tchainId,\n\t}: {\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t\treadonly chainId: ChainId;\n\t}): Effect.Effect<BuildOutput, PublishError, Scope.Scope> =>\n\t\trunMoveBuild({\n\t\t\tsourcePath,\n\t\t\tpackageName,\n\t\t\tchainId,\n\t\t\t...(inputs.runtime !== undefined ? { runtime: inputs.runtime } : {}),\n\t\t\t...(inputs.buildImage !== undefined ? { buildImage: inputs.buildImage } : {}),\n\t\t}),\n\n\t// Publish step — build + sign + execute the publish tx.\n\tpublishTx: ({\n\t\tmodules,\n\t\tdependencies,\n\t\tsourcePath,\n\t\tpackageName,\n\t}: {\n\t\treadonly modules: ReadonlyArray<Uint8Array>;\n\t\treadonly dependencies: ReadonlyArray<string>;\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t}): Effect.Effect<LocalPackagePublishOutput, PublishError, Scope.Scope> =>\n\t\tEffect.gen(function* () {\n\t\t\t// Build the publish transaction. `tx.publish` accepts\n\t\t\t// `modules: number[][] | string[]` — coerce Uint8Array → number[].\n\t\t\t// `dependencies` is the array of dependency package ids from the\n\t\t\t// build output.\n\t\t\t//\n\t\t\t// `tx.publish` RETURNS the `UpgradeCap` (a value of `package::\n\t\t\t// UpgradeCap` — `key + store`, NO `drop`). The Move VM refuses\n\t\t\t// transactions that leave such values unused\n\t\t\t// (`UnusedValueWithoutDrop`); we MUST transfer the cap to a\n\t\t\t// concrete owner. Convention (matches v3 + dev-wallet's\n\t\t\t// MintNFT demo): transfer to the publisher account so the\n\t\t\t// stack-owner retains upgrade authority.\n\t\t\tconst tx = new Transaction();\n\t\t\ttx.setSender(inputs.account.address);\n\t\t\tconst upgradeCapArg = tx.publish({\n\t\t\t\tmodules: modules.map((m) => Array.from(m)),\n\t\t\t\tdependencies: [...dependencies],\n\t\t\t});\n\t\t\ttx.transferObjects([upgradeCapArg], inputs.account.address);\n\n\t\t\tconst sdkClient = inputs.sdk.client as {\n\t\t\t\treadonly executeTransaction: (args: {\n\t\t\t\t\treadonly transaction: Uint8Array;\n\t\t\t\t\treadonly signatures: ReadonlyArray<string>;\n\t\t\t\t\treadonly include?: {\n\t\t\t\t\t\treadonly effects?: boolean;\n\t\t\t\t\t\treadonly objectTypes?: boolean;\n\t\t\t\t\t};\n\t\t\t\t}) => Promise<unknown>;\n\t\t\t\treadonly waitForTransaction: (args: {\n\t\t\t\t\treadonly digest: string;\n\t\t\t\t\treadonly include?: { readonly effects?: boolean };\n\t\t\t\t\treadonly timeout?: number;\n\t\t\t\t}) => Promise<unknown>;\n\t\t\t};\n\n\t\t\tconst rawResult = yield* inputs.account.withTransactionSigner((lockedSigner) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t// Serialise while the account lease is held. Real signers use the SDK resolver;\n\t\t\t\t\t// fork impersonation must build offline with explicit gas fields because the\n\t\t\t\t\t// fork binary does not support the normal gas-selection simulation path.\n\t\t\t\t\tconst txBytes =\n\t\t\t\t\t\tinputs.account.source === 'impersonate'\n\t\t\t\t\t\t\t? yield* buildForkImpersonationTransactionBytes(\n\t\t\t\t\t\t\t\t\ttx,\n\t\t\t\t\t\t\t\t\tinputs.account.address,\n\t\t\t\t\t\t\t\t\tinputs.sdk.core,\n\t\t\t\t\t\t\t\t).pipe(\n\t\t\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t\t\t(cause): PublishError =>\n\t\t\t\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t\t\t`Fork impersonation Transaction.build failed for package '${packageName}': ` +\n\t\t\t\t\t\t\t\t\t\t\t\t\tcause.message,\n\t\t\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: yield* Effect.tryPromise({\n\t\t\t\t\t\t\t\t\ttry: () =>\n\t\t\t\t\t\t\t\t\t\ttx.build({\n\t\t\t\t\t\t\t\t\t\t\tclient: inputs.sdk.client as Parameters<typeof tx.build>[0] extends\n\t\t\t\t\t\t\t\t\t\t\t\t| { client?: infer C }\n\t\t\t\t\t\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t\t\t\t\t\t\t\t? C\n\t\t\t\t\t\t\t\t\t\t\t\t: never,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t\t`Transaction.build failed for package '${packageName}': ` +\n\t\t\t\t\t\t\t\t\t\t\t\t(cause instanceof Error ? cause.message : String(cause)),\n\t\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\tif (inputs.account.source === 'impersonate') {\n\t\t\t\t\t\tconst result = yield* lockedSigner.signAndExecute(txBytes).pipe(\n\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t(cause): PublishError =>\n\t\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t`account.signAndExecute failed for publisher '${inputs.account.name}' ` +\n\t\t\t\t\t\t\t\t\t\t\t`(address=${inputs.account.address}): ${\n\t\t\t\t\t\t\t\t\t\t\t\tcause instanceof Error ? cause.message : String(cause)\n\t\t\t\t\t\t\t\t\t\t\t}`,\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\treturn rawEnvelopeFromAccountTx(result);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst signed = yield* lockedSigner.signTransaction(txBytes).pipe(\n\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t(cause): PublishError =>\n\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t`account.signTransaction failed for publisher '${inputs.account.name}' ` +\n\t\t\t\t\t\t\t\t\t\t`(address=${inputs.account.address}): ${\n\t\t\t\t\t\t\t\t\t\t\tcause instanceof Error ? cause.message : String(cause)\n\t\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\t\t);\n\n\t\t\t\t\tconst raw = yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: () =>\n\t\t\t\t\t\t\tsdkClient.executeTransaction({\n\t\t\t\t\t\t\t\ttransaction: txBytes,\n\t\t\t\t\t\t\t\tsignatures: [signed.signature],\n\t\t\t\t\t\t\t\t// Include flags drive readMask paths in the SDK's\n\t\t\t\t\t\t\t\t// `executeTransaction` (see grpc/core.mjs). Effects\n\t\t\t\t\t\t\t\t// gives us `changedObjects` (PackageWrite + Created\n\t\t\t\t\t\t\t\t// upgrade cap); objectTypes maps changed ids →\n\t\t\t\t\t\t\t\t// fully-qualified type strings so the UpgradeCap is\n\t\t\t\t\t\t\t\t// identifiable unambiguously.\n\t\t\t\t\t\t\t\tinclude: { effects: true, objectTypes: true },\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t`executeTransaction failed for publisher '${inputs.account.name}': ` +\n\t\t\t\t\t\t\t\t\t(cause instanceof Error ? cause.message : String(cause)),\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\n\t\t\t\t\tconst envelope = raw as {\n\t\t\t\t\t\treadonly Transaction?: { readonly digest?: string };\n\t\t\t\t\t\treadonly FailedTransaction?: { readonly digest?: string };\n\t\t\t\t\t};\n\t\t\t\t\tconst digest = envelope.Transaction?.digest ?? envelope.FailedTransaction?.digest;\n\t\t\t\t\tif (digest !== undefined) {\n\t\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: () =>\n\t\t\t\t\t\t\t\tsdkClient.waitForTransaction({\n\t\t\t\t\t\t\t\t\tdigest,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\tmessage: `waitForTransaction(${digest}) failed`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn raw;\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\t// Project the SDK's `TransactionResult` envelope to the\n\t\t\t// output shape. On `$kind: FailedTransaction` we raise a\n\t\t\t// publish-tx error; on the success branch we walk\n\t\t\t// `effects.changedObjects` for the published package id and\n\t\t\t// the upgrade cap.\n\t\t\t//\n\t\t\t// changedObjects entries are flat: `{objectId, inputState,\n\t\t\t// outputState, idOperation, ...}` — `outputState` is a\n\t\t\t// string literal (`'PackageWrite'` | `'ObjectWrite'` |\n\t\t\t// `'DoesNotExist'`), `idOperation` is a string literal\n\t\t\t// (`'Created'` | `'Deleted'` | `'None'`).\n\t\t\tconst env = rawResult as {\n\t\t\t\treadonly $kind?: 'Transaction' | 'FailedTransaction';\n\t\t\t\treadonly Transaction?: {\n\t\t\t\t\treadonly digest?: string;\n\t\t\t\t\treadonly status?: { readonly success?: boolean; readonly error?: string };\n\t\t\t\t\treadonly effects?: {\n\t\t\t\t\t\treadonly changedObjects?: ReadonlyArray<{\n\t\t\t\t\t\t\treadonly objectId?: string;\n\t\t\t\t\t\t\treadonly outputState?: string;\n\t\t\t\t\t\t\treadonly idOperation?: string;\n\t\t\t\t\t\t}>;\n\t\t\t\t\t};\n\t\t\t\t\treadonly objectTypes?: Readonly<Record<string, string>>;\n\t\t\t\t};\n\t\t\t\treadonly FailedTransaction?: {\n\t\t\t\t\treadonly digest?: string;\n\t\t\t\t\treadonly status?: { readonly error?: string };\n\t\t\t\t};\n\t\t\t};\n\t\t\tif (env.$kind === 'FailedTransaction') {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`executeTransaction returned FailedTransaction (digest=${env.FailedTransaction?.digest ?? '<unknown>'}): ` +\n\t\t\t\t\t\t\t(env.FailedTransaction?.status?.error ?? '<no error>'),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst txOk = env.Transaction;\n\t\t\tif (txOk?.digest === undefined) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\tmessage: `executeTransaction returned no digest. Raw=${JSON.stringify(rawResult).slice(0, 300)}`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst objectChanges: Array<PackagePublishObjectChange> = [];\n\t\t\tconst objectTypes = txOk.objectTypes ?? {};\n\t\t\tfor (const ch of txOk.effects?.changedObjects ?? []) {\n\t\t\t\tif (!ch.objectId) continue;\n\t\t\t\tconst objectType = objectTypes[ch.objectId];\n\t\t\t\tif (ch.outputState === 'PackageWrite') {\n\t\t\t\t\tobjectChanges.push({\n\t\t\t\t\t\ttype: 'published',\n\t\t\t\t\t\tobjectId: ch.objectId,\n\t\t\t\t\t\t...(objectType !== undefined ? { objectType } : {}),\n\t\t\t\t\t});\n\t\t\t\t} else if (ch.idOperation === 'Created') {\n\t\t\t\t\tobjectChanges.push({\n\t\t\t\t\t\ttype: 'created',\n\t\t\t\t\t\tobjectId: ch.objectId,\n\t\t\t\t\t\t...(objectType !== undefined ? { objectType } : {}),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst published = objectChanges.find((c) => c.type === 'published');\n\t\t\tconst upgradeCap = objectChanges.find(\n\t\t\t\t(c) => c.type === 'created' && (c.objectType?.endsWith('::package::UpgradeCap') ?? false),\n\t\t\t);\n\t\t\tconst hydratedObjectChanges = yield* hydrateCreatedObjects(inputs.sdk, objectChanges);\n\n\t\t\tconst output: LocalPackagePublishOutput = {\n\t\t\t\tdigest: txOk.digest,\n\t\t\t\tpackageId: published?.objectId ?? '',\n\t\t\t\tpublisher: inputs.account.address,\n\t\t\t\t...(upgradeCap?.objectId !== undefined ? { upgradeCapId: upgradeCap.objectId } : {}),\n\t\t\t\tobjectChanges: hydratedObjectChanges,\n\t\t\t};\n\n\t\t\treturn output;\n\t\t}).pipe(\n\t\t\tEffect.withSpan('package.publish-tx', {\n\t\t\t\tattributes: { 'package.publish.packageName': packageName },\n\t\t\t}),\n\t\t),\n\n\t// Wait-for-index step — post-publish ready-probe. The SDK's\n\t// `waitForTransaction` already polls fullnode index visibility\n\t// internally; we wrap it once with a typed PublishError on failure.\n\twaitForReady: (packageId: string): Effect.Effect<void, PublishError, Scope.Scope> =>\n\t\tEffect.tryPromise({\n\t\t\ttry: async () => {\n\t\t\t\t// The publish account's `signAndExecute` already calls\n\t\t\t\t// `waitForTransaction(digest)` before returning; the read\n\t\t\t\t// on `packageId` here is a second-layer probe to catch the\n\t\t\t\t// \"tx written but object not yet queryable\" race the\n\t\t\t\t// chain-probe verify step also guards against. Falls\n\t\t\t\t// through silently — if the follow-up `getObject` succeeds\n\t\t\t\t// the index is ready, else the next verify cycle picks it\n\t\t\t\t// up.\n\t\t\t\ttry {\n\t\t\t\t\tawait inputs.sdk.core.getObject({ objectId: packageId });\n\t\t\t\t} catch {\n\t\t\t\t\t// A stale object read here is non-fatal — the next\n\t\t\t\t\t// produce phase (parse) only inspects the output.\n\t\t\t\t}\n\t\t\t},\n\t\t\tcatch: (cause): PublishError =>\n\t\t\t\tpublishError('parse', {\n\t\t\t\t\tsourcePath: '<wait-for-ready>',\n\t\t\t\t\tpackageName: packageId,\n\t\t\t\t\tmessage: `waitForReady(${packageId}) failed`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t}).pipe(\n\t\t\tEffect.withSpan('package.wait-for-ready', {\n\t\t\t\tattributes: { 'package.publish.packageId': packageId },\n\t\t\t}),\n\t\t),\n});\n"],"mappings":";;;;;;AA0CA,MAAM,8BAA8B,WACnC,OAAO,SAAS,aAChB,OAAO,aAAa,KAAA,KACpB,OAAO,eAAe,KAAA,MACrB,OAAO,WAAW,SAAS,uBAAuB,IAClD,OAAO,WAAW,SAAS,wBAAwB,IACnD,OAAO,WAAW,SAAS,6BAA6B;AAE1D,MAAM,wBAAwB,QAA0B;AACvD,KAAI,QAAQ,QAAQ,OAAO,Q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,QAAQ,KAAK;GACb,WAAW,WAAW,YAAY;GAClC,WAAW,OAAO,QAAQ;GAC1B,GAAI,YAAY,aAAa,KAAA,IAAY,EAAE,cAAc,WAAW,UAAU,GAAG,EAAE;GACnF,eAAe;GAGH;GACZ,CAAC,KACF,OAAO,SAAS,sBAAsB,EACrC,YAAY,EAAE,+BAA+B,aAAa,EAC1D,CAAC,CACF;CAKF,eAAe,cACd,OAAO,WAAW;EACjB,KAAK,YAAY;AAShB,OAAI;AACH,UAAM,OAAO,IAAI,KAAK,UAAU,EAAE,UAAU,WAAW,CAAC;WACjD;;EAKT,QAAQ,UACP,aAAa,SAAS;GACrB,YAAY;GACZ,aAAa;GACb,SAAS,gBAAgB,UAAU;GACnC;GACA,CAAC;EACH,CAAC,CAAC,KACF,OAAO,SAAS,0BAA0B,EACzC,YAAY,EAAE,6BAA6B,WAAW,EACtD,CAAC,CACF;CACF"}
1
+ {"version":3,"file":"publish-executor.mjs","names":[],"sources":["../../../src/plugins/package/publish-executor.ts"],"sourcesContent":["// Concrete `PublishExecutor` — wires the Move build, publish-tx\n// builder, and post-publish ready-probe over (a) the resolved\n// `SuiClient` from the Sui dependency and (b) the publisher account's signer\n// from the account dependency.\n//\n// Architecture: the executor is a small adapter — `mode-local.ts`\n// owns the 5-phase produce body (scrub → build → publish-tx → wait-\n// for-index → parse); this file just satisfies the `PublishExecutor`\n// interface by:\n//\n// 1. Delegating `build` to `runMoveBuild` (the existing path-(a)/\n// path-(b)/path-(c) dispatcher in `build.ts`).\n// 2. Constructing a `Transaction.publish({modules, dependencies})`\n// for `publishTx`, serialising via `tx.build({ client })`,\n// signing/executing inside the publisher account's transaction\n// critical section, and projecting the response to a\n// `LocalPackagePublishOutput`.\n// 3. Wrapping `sdk.core.waitForTransaction({ digest })` for\n// `postPublishReadyHint` — the SDK already retries / waits for\n// index visibility internally. The probe is hint-only: transient\n// `getObject` misses (cold index race) are intentionally\n// swallowed because the publisher account's `signAndExecute` has\n// already awaited `waitForTransaction(digest)`.\n//\n// Errors:\n// - Each method maps its concrete failure → a typed `PublishError`\n// whose `phase:` matches the produce-step taxonomy\n// (`build` / `publish-tx` / `parse`).\n// - Account sign failures roll into `publish-tx` with cause-chain\n// preserved; the cascade formatter unwraps them.\n\nimport { Effect, type Scope } from 'effect';\n\nimport { Transaction } from '@mysten/sui/transactions';\n\nimport type { AccountValue, TxResult } from '../account/index.ts';\nimport type { ContainerRuntime, ImageRef } from '../../contracts/container-runtime.ts';\nimport type { ChainId } from '../../substrate/brand.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';\nimport { buildForkImpersonationTransactionBytes } from '../sui/index.ts';\nimport { runMoveBuild, type BuildOutput } from './build.ts';\nimport type { LocalPackagePublishOutput, PackagePublishObjectChange } from './publish-output.ts';\nimport { publishError, type PublishError } from './errors.ts';\nimport type { PublishExecutor } from './mode-local.ts';\nimport { PackageSpans } from './spans.ts';\nimport type { SuiSdkShim } from '../sui/index.ts';\n\nconst shouldHydrateCreatedObject = (change: PackagePublishObjectChange): boolean =>\n\tchange.type === 'created' &&\n\tchange.objectId !== undefined &&\n\tchange.objectType !== undefined &&\n\t(change.objectType.includes('::coin::TreasuryCap<') ||\n\t\tchange.objectType.includes('::coin::CoinMetadata<') ||\n\t\tchange.objectType.includes('::coin_registry::Currency<'));\n\nconst projectObjectPayload = (raw: unknown): unknown => {\n\tif (raw !== null && typeof raw === 'object' && 'object' in raw) {\n\t\treturn (raw as { readonly object?: unknown }).object;\n\t}\n\treturn raw;\n};\n\nconst projectHydratedObjectFields = (\n\traw: unknown,\n): Pick<PackagePublishObjectChange, 'owner' | 'json'> => {\n\tconst object = projectObjectPayload(raw);\n\tif (object === null || typeof object !== 'object') return {};\n\tconst payload = object as { readonly owner?: unknown; readonly json?: unknown };\n\treturn {\n\t\t...(payload.owner === undefined ? {} : { owner: payload.owner }),\n\t\t...(payload.json === undefined ? {} : { json: payload.json }),\n\t};\n};\n\nconst hydrateCreatedObject = (\n\tsdk: SuiSdkShim,\n\tchange: PackagePublishObjectChange,\n): Effect.Effect<PackagePublishObjectChange> => {\n\tif (!shouldHydrateCreatedObject(change) || change.objectId === undefined) {\n\t\treturn Effect.succeed(change);\n\t}\n\tconst objectId = change.objectId;\n\treturn Effect.tryPromise({\n\t\ttry: () =>\n\t\t\tsdk.core.getObject({\n\t\t\t\tobjectId,\n\t\t\t\tinclude: { json: true },\n\t\t\t}),\n\t\tcatch: (cause) => cause,\n\t}).pipe(\n\t\tEffect.map((raw) => ({\n\t\t\t...change,\n\t\t\t...(raw === null ? {} : projectHydratedObjectFields(raw)),\n\t\t})),\n\t\t// Hydration is best-effort — a cold-cache `getObject` miss must\n\t\t// not fail the publish. Log at debug so the miss is visible (the\n\t\t// `tryPromise` catch wraps the original cause; cause-detail\n\t\t// extraction is non-trivial here, so we log the objectId — the\n\t\t// fact that this happened is the actionable signal).\n\t\tEffect.catch((cause) =>\n\t\t\tEffect.logDebug('package: hydrate-created-object cache miss').pipe(\n\t\t\t\tEffect.annotateLogs({ objectId, cause: String(cause) }),\n\t\t\t\tEffect.as(change),\n\t\t\t),\n\t\t),\n\t);\n};\n\nconst hydrateCreatedObjects = (\n\tsdk: SuiSdkShim,\n\tchanges: ReadonlyArray<PackagePublishObjectChange>,\n): Effect.Effect<ReadonlyArray<PackagePublishObjectChange>> =>\n\tEffect.forEach(changes, (change) => hydrateCreatedObject(sdk, change), {\n\t\tconcurrency: 'unbounded',\n\t});\n\n/** Project an account TxResult's flat `objectChanges` (`{type,\n * objectId, objectType?, ...}`) into the publish-output\n * `PackagePublishObjectChange[]` shape. The account plugin's\n * projection already classifies entries by `type`\n * (`published` for `outputState: 'PackageWrite'`, `created` for\n * `idOperation: 'Created'`, `mutated` otherwise); we just narrow\n * to the entries we care about (published + created) and drop the\n * extras. */\nconst publishChangesFromTxResult = (tx: TxResult): ReadonlyArray<PackagePublishObjectChange> => {\n\tconst out: Array<PackagePublishObjectChange> = [];\n\tfor (const change of tx.objectChanges) {\n\t\tif (typeof change !== 'object' || change === null) continue;\n\t\tconst projected = change as {\n\t\t\treadonly type?: string;\n\t\t\treadonly objectId?: unknown;\n\t\t\treadonly objectType?: unknown;\n\t\t};\n\t\tif (typeof projected.objectId !== 'string') continue;\n\t\tif (projected.type !== 'published' && projected.type !== 'created') continue;\n\t\tconst objectType = typeof projected.objectType === 'string' ? projected.objectType : undefined;\n\t\tout.push({\n\t\t\ttype: projected.type,\n\t\t\tobjectId: projected.objectId,\n\t\t\t...(objectType !== undefined ? { objectType } : {}),\n\t\t});\n\t}\n\treturn out;\n};\n\n// ---------------------------------------------------------------------------\n// Per-acquire inputs threaded by the barrel\n// ---------------------------------------------------------------------------\n\nexport interface PublishExecutorInputs {\n\t/** The resolved SDK shim from the Sui dependency. Carries `core.executeTransaction`,\n\t * `core.waitForTransaction`, plus the opaque `client` ref used by\n\t * `Transaction.build({ client })`. */\n\treadonly sdk: SuiSdkShim;\n\t/** Publisher account — provides `signAndExecute` (which internally\n\t * signs, submits via `executeTransaction`, and awaits finality via\n\t * `waitForTransaction`). The address surfaces as the publisher on\n\t * the output. */\n\treadonly account: AccountValue;\n\t/** Container runtime + image consumed by `runMoveBuild`'s path-(b)\n\t * (`docker run --rm`). Absent → path-(c) (host CLI). */\n\treadonly runtime?: ContainerRuntime | undefined;\n\treadonly buildImage?: ImageRef | undefined;\n\t/** Fork mode — real signers (not just impersonate) must build offline\n\t * with explicit gas, because the sui-fork binary has no\n\t * `simulate_transaction` for the SDK's gas-estimating `tx.build`. */\n\treadonly forkMode?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Executor factory\n// ---------------------------------------------------------------------------\n\n/**\n * Construct a `PublishExecutor` from the barrel's resolved inputs.\n *\n * The factory exists so the barrel can compose the executor once per\n * acquire and hand the result to `acquireLocal`. Internally the three\n * methods are closures over the inputs; no per-call construction.\n */\nexport const makePublishExecutor = (inputs: PublishExecutorInputs): PublishExecutor => ({\n\tscrubsInsideContainer: inputs.runtime !== undefined && inputs.buildImage !== undefined,\n\n\t// Build step — delegate to the Move-build dispatcher in `build.ts`.\n\tbuild: ({\n\t\tsourcePath,\n\t\tpackageName,\n\t\tchainId,\n\t}: {\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t\treadonly chainId: ChainId;\n\t}): Effect.Effect<BuildOutput, PublishError, Scope.Scope> =>\n\t\trunMoveBuild({\n\t\t\tsourcePath,\n\t\t\tpackageName,\n\t\t\tchainId,\n\t\t\t...(inputs.runtime !== undefined ? { runtime: inputs.runtime } : {}),\n\t\t\t...(inputs.buildImage !== undefined ? { buildImage: inputs.buildImage } : {}),\n\t\t}),\n\n\t// Publish step — build + sign + execute the publish tx.\n\tpublishTx: ({\n\t\tmodules,\n\t\tdependencies,\n\t\tsourcePath,\n\t\tpackageName,\n\t}: {\n\t\treadonly modules: ReadonlyArray<Uint8Array>;\n\t\treadonly dependencies: ReadonlyArray<string>;\n\t\treadonly sourcePath: string;\n\t\treadonly packageName: string;\n\t}): Effect.Effect<LocalPackagePublishOutput, PublishError, Scope.Scope> =>\n\t\tEffect.gen(function* () {\n\t\t\t// Build the publish transaction. `tx.publish` accepts\n\t\t\t// `modules: number[][] | string[]` — coerce Uint8Array → number[].\n\t\t\t// `dependencies` is the array of dependency package ids from the\n\t\t\t// build output.\n\t\t\t//\n\t\t\t// `tx.publish` RETURNS the `UpgradeCap` (a value of `package::\n\t\t\t// UpgradeCap` — `key + store`, NO `drop`). The Move VM refuses\n\t\t\t// transactions that leave such values unused\n\t\t\t// (`UnusedValueWithoutDrop`); we MUST transfer the cap to a\n\t\t\t// concrete owner. Convention (matches v3 + dev-wallet's\n\t\t\t// MintNFT demo): transfer to the publisher account so the\n\t\t\t// stack-owner retains upgrade authority.\n\t\t\tconst tx = new Transaction();\n\t\t\ttx.setSender(inputs.account.address);\n\t\t\tconst upgradeCapArg = tx.publish({\n\t\t\t\tmodules: modules.map((m) => Array.from(m)),\n\t\t\t\tdependencies: [...dependencies],\n\t\t\t});\n\t\t\ttx.transferObjects([upgradeCapArg], inputs.account.address);\n\n\t\t\t// Both real-signer and impersonate paths route through the\n\t\t\t// account's `signAndExecute` (which signs, executes, waits,\n\t\t\t// and projects to the SDK-shaped `SignAndExecuteResult`\n\t\t\t// discriminated union). The impersonate path internally\n\t\t\t// hands off to `fork.impersonate`; the real-signer path\n\t\t\t// goes through the SDK directly. `signAndDispatch` compacts\n\t\t\t// the build → sign → execute → $kind dispatch boilerplate.\n\t\t\tconst { digest, objectChanges } = yield* signAndDispatch({\n\t\t\t\tsignerSource: inputs.account,\n\t\t\t\tbuildTxBytes: () =>\n\t\t\t\t\t// Serialise while the account lease is held. Non-fork real\n\t\t\t\t\t// signers use the SDK resolver. Fork mode (impersonate OR real\n\t\t\t\t\t// signer) must build offline with explicit gas fields: the\n\t\t\t\t\t// sui-fork binary has no simulate_transaction, so the SDK's\n\t\t\t\t\t// gas-estimating build path fails. The real-vs-empty-signature\n\t\t\t\t\t// split happens later in the account's signAndExecute.\n\t\t\t\t\tinputs.account.source === 'impersonate' || inputs.forkMode === true\n\t\t\t\t\t\t? buildForkImpersonationTransactionBytes(\n\t\t\t\t\t\t\t\ttx,\n\t\t\t\t\t\t\t\tinputs.account.address,\n\t\t\t\t\t\t\t\tinputs.sdk.core,\n\t\t\t\t\t\t\t).pipe(\n\t\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t\t(cause): PublishError =>\n\t\t\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t\t`Fork impersonation Transaction.build failed for package '${packageName}': ` +\n\t\t\t\t\t\t\t\t\t\t\t\tcause.message,\n\t\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: Effect.tryPromise({\n\t\t\t\t\t\t\t\ttry: () => tx.build({ client: inputs.sdk.client }),\n\t\t\t\t\t\t\t\tcatch: (cause): PublishError =>\n\t\t\t\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t\t`Transaction.build failed for package '${packageName}': ` +\n\t\t\t\t\t\t\t\t\t\t\t(formatUnknownError(cause)),\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\tmapSignError: (cause): PublishError =>\n\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`account.signAndExecute failed for publisher '${inputs.account.name}' ` +\n\t\t\t\t\t\t\t`(address=${inputs.account.address}): ${\n\t\t\t\t\t\t\t\tformatUnknownError(cause)\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t\tonFailed: (failure) =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\tpublishError('publish-tx', {\n\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`executeTransaction returned FailedTransaction ` + formatExecutedFailure(failure),\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\tonSuccess: (txResult: TxResult) =>\n\t\t\t\t\tEffect.succeed({\n\t\t\t\t\t\tdigest: txResult.digest,\n\t\t\t\t\t\tobjectChanges: publishChangesFromTxResult(txResult),\n\t\t\t\t\t}),\n\t\t\t});\n\n\t\t\tconst published = objectChanges.find((c) => c.type === 'published');\n\t\t\tconst upgradeCap = objectChanges.find(\n\t\t\t\t(c) => c.type === 'created' && (c.objectType?.endsWith('::package::UpgradeCap') ?? false),\n\t\t\t);\n\t\t\tconst hydratedObjectChanges = yield* hydrateCreatedObjects(inputs.sdk, objectChanges);\n\n\t\t\tconst output: LocalPackagePublishOutput = {\n\t\t\t\tdigest,\n\t\t\t\tpackageId: published?.objectId ?? '',\n\t\t\t\tpublisher: inputs.account.address,\n\t\t\t\t...(upgradeCap?.objectId !== undefined ? { upgradeCapId: upgradeCap.objectId } : {}),\n\t\t\t\tobjectChanges: hydratedObjectChanges,\n\t\t\t};\n\n\t\t\treturn output;\n\t\t}).pipe(\n\t\t\tEffect.withSpan('devstack.plugin.package.publish-tx', {\n\t\t\t\tattributes: { [PackageSpans.publish.packageName]: packageName },\n\t\t\t}),\n\t\t),\n\n\t// Post-publish ready HINT — a best-effort second-layer probe. The publish\n\t// account's `signAndExecute` already calls `waitForTransaction(digest)`\n\t// before returning, so the read on `packageId` here only catches the\n\t// \"tx written but object not yet queryable\" race. It MUST NOT fail the\n\t// publish: a transient / not-yet-indexed read is expected. The failure is\n\t// logged at debug (§18) so the miss stays visible rather than silently\n\t// swallowed, then the hint succeeds regardless.\n\tpostPublishReadyHint: (packageId: string): Effect.Effect<void, PublishError, Scope.Scope> =>\n\t\tEffect.tryPromise(() => inputs.sdk.core.getObject({ objectId: packageId })).pipe(\n\t\t\tEffect.asVoid,\n\t\t\tEffect.catch((cause) =>\n\t\t\t\tEffect.logDebug('package: post-publish ready-hint read failed').pipe(\n\t\t\t\t\tEffect.annotateLogs({ packageId, cause: String(cause) }),\n\t\t\t\t),\n\t\t\t),\n\t\t\tEffect.withSpan('devstack.plugin.package.post-publish-ready-hint', {\n\t\t\t\tattributes: { [PackageSpans.publish.packageId]: packageId },\n\t\t\t}),\n\t\t),\n});\n"],"mappings":";;;;;;;;;;;AAiDA,MAAM,8BA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