@mysten-incubation/devstack 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (838) hide show
  1. package/README.md +8 -4
  2. package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  3. package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  4. package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  5. package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  6. package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  7. package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  8. package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  9. package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  10. package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  11. package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  12. package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  13. package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
  14. package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
  15. package/dashboard-ui/assets/index-Deml9drg.css +1 -0
  16. package/dashboard-ui/index.html +13 -0
  17. package/dist/api/define-capabilities.d.mts +14 -3
  18. package/dist/api/define-capabilities.mjs +18 -1
  19. package/dist/api/define-capabilities.mjs.map +1 -1
  20. package/dist/api/define-devstack.d.mts +1 -1
  21. package/dist/api/define-devstack.mjs +6 -26
  22. package/dist/api/define-devstack.mjs.map +1 -1
  23. package/dist/api/define-plugin.d.mts +1 -0
  24. package/dist/api/define-plugin.mjs +2 -0
  25. package/dist/api/inference-network.d.mts +132 -0
  26. package/dist/api/inference-network.mjs +105 -16
  27. package/dist/api/inference-network.mjs.map +1 -1
  28. package/dist/api/plugin-errors.d.mts +7 -0
  29. package/dist/api/run-stack.d.mts +20 -9
  30. package/dist/api/run-stack.mjs +56 -29
  31. package/dist/api/run-stack.mjs.map +1 -1
  32. package/dist/build-integrations/playwright/config.d.mts +6 -4
  33. package/dist/build-integrations/playwright/config.mjs +5 -3
  34. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  35. package/dist/build-integrations/playwright/errors.d.mts +1 -1
  36. package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
  37. package/dist/build-integrations/playwright/global-setup.mjs +250 -13
  38. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  39. package/dist/build-integrations/playwright/index.d.mts +5 -3
  40. package/dist/build-integrations/playwright/index.mjs +4 -2
  41. package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
  42. package/dist/build-integrations/playwright/stack-context.mjs +24 -63
  43. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  44. package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
  45. package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
  46. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  47. package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
  48. package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
  49. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
  51. package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
  52. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
  53. package/dist/build-integrations/runtime/discover.d.mts +38 -30
  54. package/dist/build-integrations/runtime/discover.mjs +73 -70
  55. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
  57. package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
  58. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  59. package/dist/build-integrations/runtime/index.d.mts +7 -2
  60. package/dist/build-integrations/runtime/index.mjs +9 -2
  61. package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
  62. package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
  63. package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
  64. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
  65. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
  66. package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
  67. package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
  68. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  69. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
  70. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
  71. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
  72. package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
  73. package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
  74. package/dist/build-integrations/vite/index.d.mts +51 -0
  75. package/dist/build-integrations/vite/index.mjs +73 -0
  76. package/dist/build-integrations/vite/index.mjs.map +1 -0
  77. package/dist/build-integrations/vitest/env.d.mts +4 -3
  78. package/dist/build-integrations/vitest/env.mjs +6 -4
  79. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  80. package/dist/build-integrations/vitest/errors.d.mts +25 -4
  81. package/dist/build-integrations/vitest/errors.mjs +15 -2
  82. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  83. package/dist/build-integrations/vitest/index.d.mts +2 -2
  84. package/dist/build-integrations/vitest/index.mjs +3 -3
  85. package/dist/build-integrations/vitest/setup.d.mts +4 -2
  86. package/dist/build-integrations/vitest/setup.mjs +2 -2
  87. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  88. package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
  89. package/dist/build-integrations/vitest/stack-context.mjs +33 -13
  90. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  91. package/dist/cli/bail.mjs +23 -0
  92. package/dist/cli/bail.mjs.map +1 -0
  93. package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
  94. package/dist/cli/doctor-probes.mjs.map +1 -0
  95. package/dist/cli/main.d.mts +15 -1
  96. package/dist/cli/main.mjs +166 -482
  97. package/dist/cli/main.mjs.map +1 -1
  98. package/dist/cli/prune-direct.mjs +31 -201
  99. package/dist/cli/prune-direct.mjs.map +1 -1
  100. package/dist/cli/snapshot-reader.mjs +14 -11
  101. package/dist/cli/snapshot-reader.mjs.map +1 -1
  102. package/dist/cli/up-lifecycle.mjs +4 -1
  103. package/dist/cli/up-lifecycle.mjs.map +1 -1
  104. package/dist/cli/wirings/apply.mjs +95 -0
  105. package/dist/cli/wirings/apply.mjs.map +1 -0
  106. package/dist/cli/wirings/build-verb-layers.mjs +42 -0
  107. package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
  108. package/dist/cli/wirings/config-loader.mjs +69 -0
  109. package/dist/cli/wirings/config-loader.mjs.map +1 -0
  110. package/dist/cli/wirings/engine-command.mjs +30 -0
  111. package/dist/cli/wirings/engine-command.mjs.map +1 -0
  112. package/dist/cli/wirings/identity.mjs +72 -0
  113. package/dist/cli/wirings/identity.mjs.map +1 -0
  114. package/dist/cli/wirings/provide-file-system.mjs +7 -0
  115. package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
  116. package/dist/cli/wirings/snapshot.mjs +177 -0
  117. package/dist/cli/wirings/snapshot.mjs.map +1 -0
  118. package/dist/cli/wirings/up.mjs +287 -0
  119. package/dist/cli/wirings/up.mjs.map +1 -0
  120. package/dist/cli/wirings/wipe.mjs +40 -0
  121. package/dist/cli/wirings/wipe.mjs.map +1 -0
  122. package/dist/contracts/capability-decl.d.mts +0 -2
  123. package/dist/contracts/codegenable.d.mts +43 -0
  124. package/dist/contracts/container-runtime.d.mts +26 -1
  125. package/dist/contracts/faucet-strategy.d.mts +25 -0
  126. package/dist/contracts/funding-strategy.d.mts +42 -0
  127. package/dist/contracts/plugin-expander.mjs +60 -0
  128. package/dist/contracts/plugin-expander.mjs.map +1 -0
  129. package/dist/contracts/projection.d.mts +5 -3
  130. package/dist/contracts/renderer.d.mts +23 -0
  131. package/dist/contracts/routable.d.mts +14 -1
  132. package/dist/contracts/snapshotable.d.mts +25 -3
  133. package/dist/contracts/wallet-protocol.d.mts +52 -0
  134. package/dist/contracts/wallet-protocol.mjs +52 -0
  135. package/dist/contracts/wallet-protocol.mjs.map +1 -0
  136. package/dist/index.d.mts +26 -25
  137. package/dist/index.mjs +20 -13
  138. package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
  139. package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
  140. package/dist/orchestrators/codegen/bindings.d.mts +1 -2
  141. package/dist/orchestrators/codegen/bindings.mjs +52 -186
  142. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/emit.mjs +19 -1
  144. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  145. package/dist/orchestrators/codegen/errors.mjs +8 -3
  146. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/format.mjs +47 -39
  148. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/gitignore.mjs +3 -1
  150. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  151. package/dist/orchestrators/codegen/output-location.mjs +41 -0
  152. package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
  153. package/dist/orchestrators/codegen/paths.d.mts +1 -1
  154. package/dist/orchestrators/codegen/paths.mjs +40 -14
  155. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  156. package/dist/orchestrators/codegen/permissions.mjs +3 -1
  157. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  158. package/dist/orchestrators/codegen/service.mjs +157 -105
  159. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  160. package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
  161. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
  162. package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
  163. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
  164. package/dist/orchestrators/router/cleanup.mjs +26 -27
  165. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  166. package/dist/orchestrators/router/entrypoints.mjs +2 -2
  167. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  168. package/dist/orchestrators/router/file-provider.mjs +14 -5
  169. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  170. package/dist/orchestrators/router/hostname.mjs +19 -55
  171. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  172. package/dist/orchestrators/router/index.mjs +11 -0
  173. package/dist/orchestrators/router/profile.mjs +2 -2
  174. package/dist/orchestrators/router/sentinels.mjs +26 -0
  175. package/dist/orchestrators/router/sentinels.mjs.map +1 -0
  176. package/dist/orchestrators/router/service.mjs +40 -37
  177. package/dist/orchestrators/router/service.mjs.map +1 -1
  178. package/dist/orchestrators/router/traefik-container.mjs +27 -16
  179. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  180. package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
  181. package/dist/orchestrators/run.mjs.map +1 -0
  182. package/dist/orchestrators/runtime-composition.d.mts +1 -1
  183. package/dist/orchestrators/runtime-composition.mjs +123 -39
  184. package/dist/orchestrators/runtime-composition.mjs.map +1 -1
  185. package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
  186. package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
  187. package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
  188. package/dist/orchestrators/snapshot/capture.mjs +42 -28
  189. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  190. package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
  191. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  192. package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
  193. package/dist/orchestrators/snapshot/index.mjs +13 -0
  194. package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
  195. package/dist/orchestrators/snapshot/integrity.mjs +73 -17
  196. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  197. package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
  198. package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
  199. package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
  200. package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
  201. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
  202. package/dist/orchestrators/snapshot/prune.mjs +20 -55
  203. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  204. package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
  205. package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
  206. package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
  207. package/dist/orchestrators/snapshot/restore.mjs +118 -84
  208. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  209. package/dist/orchestrators/snapshot/service.mjs +53 -56
  210. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  211. package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
  212. package/dist/orchestrators/snapshot/state-document.mjs +47 -7
  213. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
  214. package/dist/orchestrators/snapshot/wipe.mjs +67 -10
  215. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  216. package/dist/plugins/account/codegen.mjs +9 -8
  217. package/dist/plugins/account/codegen.mjs.map +1 -1
  218. package/dist/plugins/account/errors.d.mts +33 -6
  219. package/dist/plugins/account/errors.mjs.map +1 -1
  220. package/dist/plugins/account/funding.d.mts +29 -19
  221. package/dist/plugins/account/funding.mjs +84 -66
  222. package/dist/plugins/account/funding.mjs.map +1 -1
  223. package/dist/plugins/account/index.d.mts +2 -4
  224. package/dist/plugins/account/index.mjs +64 -31
  225. package/dist/plugins/account/index.mjs.map +1 -1
  226. package/dist/plugins/account/keypair.mjs +6 -9
  227. package/dist/plugins/account/keypair.mjs.map +1 -1
  228. package/dist/plugins/account/lease.mjs +1 -0
  229. package/dist/plugins/account/lease.mjs.map +1 -1
  230. package/dist/plugins/account/registry.d.mts +14 -1
  231. package/dist/plugins/account/registry.mjs +18 -18
  232. package/dist/plugins/account/registry.mjs.map +1 -1
  233. package/dist/plugins/account/service.d.mts +23 -4
  234. package/dist/plugins/account/service.mjs +83 -45
  235. package/dist/plugins/account/service.mjs.map +1 -1
  236. package/dist/plugins/account/snapshot.mjs +2 -5
  237. package/dist/plugins/account/snapshot.mjs.map +1 -1
  238. package/dist/plugins/account/spans.mjs +16 -0
  239. package/dist/plugins/account/spans.mjs.map +1 -0
  240. package/dist/plugins/account/variants/keystore.mjs +6 -8
  241. package/dist/plugins/account/variants/keystore.mjs.map +1 -1
  242. package/dist/plugins/action/build-context.d.mts +3 -2
  243. package/dist/plugins/action/errors.d.mts +16 -12
  244. package/dist/plugins/action/errors.mjs.map +1 -1
  245. package/dist/plugins/action/execute.mjs +65 -103
  246. package/dist/plugins/action/execute.mjs.map +1 -1
  247. package/dist/plugins/action/index.d.mts +0 -2
  248. package/dist/plugins/action/index.mjs +17 -13
  249. package/dist/plugins/action/index.mjs.map +1 -1
  250. package/dist/plugins/action/service.mjs +38 -35
  251. package/dist/plugins/action/service.mjs.map +1 -1
  252. package/dist/plugins/action/spans.mjs +11 -0
  253. package/dist/plugins/action/spans.mjs.map +1 -0
  254. package/dist/plugins/coin/codegen.mjs +9 -8
  255. package/dist/plugins/coin/codegen.mjs.map +1 -1
  256. package/dist/plugins/coin/discovery.mjs +8 -4
  257. package/dist/plugins/coin/discovery.mjs.map +1 -1
  258. package/dist/plugins/coin/index.d.mts +11 -29
  259. package/dist/plugins/coin/index.mjs +56 -27
  260. package/dist/plugins/coin/index.mjs.map +1 -1
  261. package/dist/plugins/coin/metadata.mjs +8 -15
  262. package/dist/plugins/coin/metadata.mjs.map +1 -1
  263. package/dist/plugins/coin/mint.d.mts +30 -11
  264. package/dist/plugins/coin/mint.mjs +78 -74
  265. package/dist/plugins/coin/mint.mjs.map +1 -1
  266. package/dist/plugins/coin/registry.mjs +4 -7
  267. package/dist/plugins/coin/registry.mjs.map +1 -1
  268. package/dist/plugins/coin/service.d.mts +39 -1
  269. package/dist/plugins/coin/service.mjs +11 -4
  270. package/dist/plugins/coin/service.mjs.map +1 -1
  271. package/dist/plugins/coin/spans.mjs +20 -0
  272. package/dist/plugins/coin/spans.mjs.map +1 -0
  273. package/dist/plugins/dashboard/domain.mjs +402 -0
  274. package/dist/plugins/dashboard/domain.mjs.map +1 -0
  275. package/dist/plugins/dashboard/index.d.mts +29 -0
  276. package/dist/plugins/dashboard/index.mjs +91 -0
  277. package/dist/plugins/dashboard/index.mjs.map +1 -0
  278. package/dist/plugins/dashboard/origin-policy.mjs +36 -0
  279. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
  280. package/dist/plugins/dashboard/routable.mjs +27 -0
  281. package/dist/plugins/dashboard/routable.mjs.map +1 -0
  282. package/dist/plugins/dashboard/schema/builder.mjs +21 -0
  283. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
  284. package/dist/plugins/dashboard/schema/enums.mjs +72 -0
  285. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
  286. package/dist/plugins/dashboard/schema/root.mjs +351 -0
  287. package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
  288. package/dist/plugins/dashboard/schema/types.mjs +508 -0
  289. package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
  290. package/dist/plugins/dashboard/schema.mjs +11 -0
  291. package/dist/plugins/dashboard/schema.mjs.map +1 -0
  292. package/dist/plugins/dashboard/server.mjs +166 -0
  293. package/dist/plugins/dashboard/server.mjs.map +1 -0
  294. package/dist/plugins/deepbook/deploy.mjs +53 -115
  295. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  296. package/dist/plugins/deepbook/errors.mjs +1 -0
  297. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  298. package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
  299. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  300. package/dist/plugins/deepbook/hash.mjs +9 -0
  301. package/dist/plugins/deepbook/hash.mjs.map +1 -0
  302. package/dist/plugins/deepbook/index.d.mts +1 -10
  303. package/dist/plugins/deepbook/index.mjs +25 -22
  304. package/dist/plugins/deepbook/index.mjs.map +1 -1
  305. package/dist/plugins/deepbook/pyth/index.mjs +26 -55
  306. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  307. package/dist/plugins/deepbook/snapshot.mjs +17 -29
  308. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  309. package/dist/plugins/deepbook/spans.mjs +18 -0
  310. package/dist/plugins/deepbook/spans.mjs.map +1 -0
  311. package/dist/plugins/deepbook/type-strings.mjs +65 -0
  312. package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
  313. package/dist/plugins/deepbook/types.d.mts +2 -3
  314. package/dist/plugins/deepbook/types.mjs.map +1 -1
  315. package/dist/plugins/faucet/dispatcher.d.mts +21 -2
  316. package/dist/plugins/faucet/dispatcher.mjs +1 -2
  317. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  318. package/dist/plugins/faucet/errors.d.mts +11 -24
  319. package/dist/plugins/faucet/errors.mjs.map +1 -1
  320. package/dist/plugins/faucet/http.mjs +33 -14
  321. package/dist/plugins/faucet/http.mjs.map +1 -1
  322. package/dist/plugins/faucet/index.d.mts +15 -5
  323. package/dist/plugins/faucet/index.mjs +3 -0
  324. package/dist/plugins/faucet/index.mjs.map +1 -1
  325. package/dist/plugins/faucet/spans.mjs +12 -0
  326. package/dist/plugins/faucet/spans.mjs.map +1 -0
  327. package/dist/plugins/host-service/errors.d.mts +1 -1
  328. package/dist/plugins/host-service/index.mjs +34 -8
  329. package/dist/plugins/host-service/index.mjs.map +1 -1
  330. package/dist/plugins/host-service/routable.mjs +2 -1
  331. package/dist/plugins/host-service/routable.mjs.map +1 -1
  332. package/dist/plugins/host-service/service.d.mts +21 -0
  333. package/dist/plugins/host-service/service.mjs +136 -81
  334. package/dist/plugins/host-service/service.mjs.map +1 -1
  335. package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
  336. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
  337. package/dist/plugins/internal/codegen-helpers.mjs +18 -0
  338. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
  339. package/dist/plugins/internal/funding-failure-error.mjs +32 -0
  340. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
  341. package/dist/plugins/package/build.mjs +1 -1
  342. package/dist/plugins/package/build.mjs.map +1 -1
  343. package/dist/plugins/package/codegen.mjs +26 -0
  344. package/dist/plugins/package/codegen.mjs.map +1 -1
  345. package/dist/plugins/package/errors.d.mts +16 -6
  346. package/dist/plugins/package/errors.mjs.map +1 -1
  347. package/dist/plugins/package/index.d.mts +0 -4
  348. package/dist/plugins/package/index.mjs +27 -21
  349. package/dist/plugins/package/index.mjs.map +1 -1
  350. package/dist/plugins/package/mode-known.mjs +26 -12
  351. package/dist/plugins/package/mode-known.mjs.map +1 -1
  352. package/dist/plugins/package/mode-local.mjs +47 -41
  353. package/dist/plugins/package/mode-local.mjs.map +1 -1
  354. package/dist/plugins/package/publish-executor.mjs +55 -114
  355. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  356. package/dist/plugins/package/registry.mjs +2 -1
  357. package/dist/plugins/package/registry.mjs.map +1 -1
  358. package/dist/plugins/package/service.mjs.map +1 -1
  359. package/dist/plugins/package/spans.mjs +14 -0
  360. package/dist/plugins/package/spans.mjs.map +1 -0
  361. package/dist/plugins/postgres/db-ensure.mjs +19 -12
  362. package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
  363. package/dist/plugins/postgres/errors.d.mts +5 -0
  364. package/dist/plugins/postgres/errors.mjs.map +1 -1
  365. package/dist/plugins/postgres/index.mjs +10 -17
  366. package/dist/plugins/postgres/index.mjs.map +1 -1
  367. package/dist/plugins/postgres/service.mjs +58 -24
  368. package/dist/plugins/postgres/service.mjs.map +1 -1
  369. package/dist/plugins/postgres/snapshot.mjs.map +1 -1
  370. package/dist/plugins/postgres/spans.mjs +11 -0
  371. package/dist/plugins/postgres/spans.mjs.map +1 -0
  372. package/dist/plugins/router-entrypoints.mjs +4 -4
  373. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
  375. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
  377. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  378. package/dist/plugins/seal/codegen.d.mts +2 -3
  379. package/dist/plugins/seal/codegen.mjs.map +1 -1
  380. package/dist/plugins/seal/config-render.mjs +35 -8
  381. package/dist/plugins/seal/config-render.mjs.map +1 -1
  382. package/dist/plugins/seal/deploy.mjs +31 -39
  383. package/dist/plugins/seal/deploy.mjs.map +1 -1
  384. package/dist/plugins/seal/errors.d.mts +1 -3
  385. package/dist/plugins/seal/errors.mjs +7 -1
  386. package/dist/plugins/seal/errors.mjs.map +1 -1
  387. package/dist/plugins/seal/index.d.mts +1 -6
  388. package/dist/plugins/seal/index.mjs +40 -14
  389. package/dist/plugins/seal/index.mjs.map +1 -1
  390. package/dist/plugins/seal/key-manager.d.mts +1 -9
  391. package/dist/plugins/seal/key-manager.mjs +2 -18
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  393. package/dist/plugins/seal/key-server.mjs +37 -36
  394. package/dist/plugins/seal/key-server.mjs.map +1 -1
  395. package/dist/plugins/seal/keygen.mjs +16 -17
  396. package/dist/plugins/seal/keygen.mjs.map +1 -1
  397. package/dist/plugins/seal/mode/fork-known.mjs +36 -14
  398. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  399. package/dist/plugins/seal/mode/live.d.mts +6 -4
  400. package/dist/plugins/seal/mode/live.mjs +14 -21
  401. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  402. package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
  403. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  404. package/dist/plugins/seal/registry-publish.mjs +1 -0
  405. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  406. package/dist/plugins/seal/routable.mjs.map +1 -1
  407. package/dist/plugins/seal/service.mjs.map +1 -1
  408. package/dist/plugins/seal/spans.mjs +18 -0
  409. package/dist/plugins/seal/spans.mjs.map +1 -0
  410. package/dist/plugins/sui/auto-tick.mjs +17 -23
  411. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  412. package/dist/plugins/sui/chain-build-container.mjs +18 -0
  413. package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
  414. package/dist/plugins/sui/chain-probe.d.mts +5 -5
  415. package/dist/plugins/sui/chain-probe.mjs +28 -58
  416. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  417. package/dist/plugins/sui/codegen.mjs +26 -0
  418. package/dist/plugins/sui/codegen.mjs.map +1 -1
  419. package/dist/plugins/sui/errors.d.mts +2 -29
  420. package/dist/plugins/sui/errors.mjs +1 -3
  421. package/dist/plugins/sui/errors.mjs.map +1 -1
  422. package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
  423. package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
  424. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
  425. package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
  426. package/dist/plugins/sui/fork-orchestration.mjs +170 -2
  427. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  428. package/dist/plugins/sui/fork-transaction.d.mts +2 -0
  429. package/dist/plugins/sui/fork-transaction.mjs +92 -28
  430. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  431. package/dist/plugins/sui/index.d.mts +33 -70
  432. package/dist/plugins/sui/index.mjs +58 -35
  433. package/dist/plugins/sui/index.mjs.map +1 -1
  434. package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
  435. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
  436. package/dist/plugins/sui/mode/external.mjs +7 -13
  437. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  438. package/dist/plugins/sui/mode/fork.mjs +136 -59
  439. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  440. package/dist/plugins/sui/mode/live.mjs +10 -16
  441. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  442. package/dist/plugins/sui/mode/local.mjs +37 -36
  443. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  444. package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
  445. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  446. package/dist/plugins/sui/mode/shared.d.mts +1 -5
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  448. package/dist/plugins/sui/mode/spec.d.mts +18 -0
  449. package/dist/plugins/sui/move-summary-runner.mjs +207 -0
  450. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
  451. package/dist/plugins/sui/network-resolver.d.mts +4 -3
  452. package/dist/plugins/sui/service.mjs.map +1 -1
  453. package/dist/plugins/sui/snapshot.mjs +3 -0
  454. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  455. package/dist/plugins/sui/spans.mjs +17 -0
  456. package/dist/plugins/sui/spans.mjs.map +1 -0
  457. package/dist/plugins/wallet/codegen.d.mts +0 -1
  458. package/dist/plugins/wallet/codegen.mjs +8 -9
  459. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  460. package/dist/plugins/wallet/index.d.mts +6 -8
  461. package/dist/plugins/wallet/index.mjs +46 -35
  462. package/dist/plugins/wallet/index.mjs.map +1 -1
  463. package/dist/plugins/wallet/origin-policy.mjs +12 -28
  464. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  465. package/dist/plugins/wallet/pairing.mjs +6 -4
  466. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  467. package/dist/plugins/wallet/protocol.d.mts +1 -0
  468. package/dist/plugins/wallet/protocol.mjs +5 -44
  469. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  470. package/dist/plugins/wallet/routable.mjs +2 -8
  471. package/dist/plugins/wallet/routable.mjs.map +1 -1
  472. package/dist/plugins/wallet/server.mjs +36 -44
  473. package/dist/plugins/wallet/server.mjs.map +1 -1
  474. package/dist/plugins/wallet/service.d.mts +1 -5
  475. package/dist/plugins/wallet/service.mjs +22 -18
  476. package/dist/plugins/wallet/service.mjs.map +1 -1
  477. package/dist/plugins/wallet/spans.mjs +22 -0
  478. package/dist/plugins/wallet/spans.mjs.map +1 -0
  479. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
  480. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  481. package/dist/plugins/walrus/codegen.d.mts +3 -3
  482. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  483. package/dist/plugins/walrus/deploy-paths.mjs +21 -5
  484. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  485. package/dist/plugins/walrus/deploy.mjs +67 -69
  486. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  487. package/dist/plugins/walrus/errors.mjs +1 -0
  488. package/dist/plugins/walrus/errors.mjs.map +1 -1
  489. package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
  490. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  491. package/dist/plugins/walrus/index.d.mts +2 -13
  492. package/dist/plugins/walrus/index.mjs +18 -23
  493. package/dist/plugins/walrus/index.mjs.map +1 -1
  494. package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
  495. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  496. package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
  497. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  498. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  499. package/dist/plugins/walrus/routable.mjs +7 -23
  500. package/dist/plugins/walrus/routable.mjs.map +1 -1
  501. package/dist/plugins/walrus/service.mjs.map +1 -1
  502. package/dist/plugins/walrus/spans.mjs +18 -0
  503. package/dist/plugins/walrus/spans.mjs.map +1 -0
  504. package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
  505. package/dist/plugins/walrus/storage-nodes.mjs +15 -8
  506. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  507. package/dist/plugins/walrus/wal-swap.mjs +58 -15
  508. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  509. package/dist/primitives/artifact-publisher.d.mts +1 -1
  510. package/dist/primitives/artifact-publisher.mjs +15 -0
  511. package/dist/primitives/artifact-publisher.mjs.map +1 -0
  512. package/dist/runtime/docker/client.mjs +17 -4
  513. package/dist/runtime/docker/client.mjs.map +1 -1
  514. package/dist/runtime/docker/container.mjs +219 -132
  515. package/dist/runtime/docker/container.mjs.map +1 -1
  516. package/dist/runtime/docker/errors.mjs +0 -6
  517. package/dist/runtime/docker/errors.mjs.map +1 -1
  518. package/dist/runtime/docker/exec.mjs +21 -18
  519. package/dist/runtime/docker/exec.mjs.map +1 -1
  520. package/dist/runtime/docker/image.mjs +36 -13
  521. package/dist/runtime/docker/image.mjs.map +1 -1
  522. package/dist/runtime/docker/index.mjs +14 -0
  523. package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
  524. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
  525. package/dist/runtime/docker/inventory.mjs +14 -11
  526. package/dist/runtime/docker/inventory.mjs.map +1 -1
  527. package/dist/runtime/docker/labels.mjs +38 -5
  528. package/dist/runtime/docker/labels.mjs.map +1 -1
  529. package/dist/runtime/docker/logs.d.mts +1 -1
  530. package/dist/runtime/docker/logs.mjs.map +1 -1
  531. package/dist/runtime/docker/network.mjs +83 -47
  532. package/dist/runtime/docker/network.mjs.map +1 -1
  533. package/dist/runtime/docker/render-run-args.mjs +82 -0
  534. package/dist/runtime/docker/render-run-args.mjs.map +1 -0
  535. package/dist/runtime/docker/service.d.mts +1 -1
  536. package/dist/runtime/docker/service.mjs +12 -7
  537. package/dist/runtime/docker/service.mjs.map +1 -1
  538. package/dist/runtime/docker/sweep.mjs +118 -43
  539. package/dist/runtime/docker/sweep.mjs.map +1 -1
  540. package/dist/runtime/docker/volume.mjs +2 -0
  541. package/dist/runtime/docker/volume.mjs.map +1 -1
  542. package/dist/runtime/docker/wrap.mjs +30 -1
  543. package/dist/runtime/docker/wrap.mjs.map +1 -1
  544. package/dist/substrate/cross-process.mjs +14 -8
  545. package/dist/substrate/cross-process.mjs.map +1 -1
  546. package/dist/substrate/event-time.mjs +33 -0
  547. package/dist/substrate/event-time.mjs.map +1 -0
  548. package/dist/substrate/events.d.mts +28 -8
  549. package/dist/substrate/identity.d.mts +2 -1
  550. package/dist/substrate/manifest.d.mts +68 -5
  551. package/dist/substrate/manifest.mjs +34 -5
  552. package/dist/substrate/manifest.mjs.map +1 -1
  553. package/dist/substrate/network.d.mts +3 -5
  554. package/dist/substrate/options.d.mts +0 -2
  555. package/dist/substrate/plugin.d.mts +13 -0
  556. package/dist/substrate/plugin.mjs +4 -2
  557. package/dist/substrate/plugin.mjs.map +1 -1
  558. package/dist/substrate/projection.d.mts +35 -3
  559. package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
  560. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
  561. package/dist/substrate/runtime/atomic-write.mjs +97 -32
  562. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  563. package/dist/substrate/runtime/cache/index.mjs +3 -0
  564. package/dist/substrate/runtime/cache/schema.mjs +2 -2
  565. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  566. package/dist/substrate/runtime/cache/service.mjs +9 -7
  567. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  568. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
  569. package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
  570. package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
  571. package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
  572. package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
  573. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
  574. package/dist/substrate/runtime/config-validation.d.mts +1 -13
  575. package/dist/substrate/runtime/config-validation.mjs +2 -91
  576. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  577. package/dist/substrate/runtime/container-runtime.d.mts +1 -0
  578. package/dist/substrate/runtime/container-runtime.mjs +2 -0
  579. package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
  580. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
  581. package/dist/substrate/runtime/control-plane/service.mjs +7 -0
  582. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
  583. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
  584. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  585. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
  586. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  587. package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
  588. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
  589. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  590. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
  591. package/dist/substrate/runtime/cross-process/index.mjs +11 -0
  592. package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
  593. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
  594. package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
  595. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  596. package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
  597. package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
  598. package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
  599. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
  600. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
  601. package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
  602. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  603. package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
  604. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
  605. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
  606. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
  607. package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
  608. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  609. package/dist/substrate/runtime/current-plugin.mjs +2 -2
  610. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  611. package/dist/substrate/runtime/errors.mjs +12 -6
  612. package/dist/substrate/runtime/errors.mjs.map +1 -1
  613. package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
  614. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
  615. package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
  616. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
  617. package/dist/substrate/runtime/host-gateway.mjs +20 -0
  618. package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
  619. package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
  620. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  621. package/dist/substrate/runtime/http-probe.d.mts +1 -1
  622. package/dist/substrate/runtime/index.mjs +14 -0
  623. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
  624. package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
  625. package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
  626. package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
  627. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  628. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
  629. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  630. package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
  631. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
  632. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
  633. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  634. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
  635. package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
  636. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  637. package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
  638. package/dist/substrate/runtime/managed-container.d.mts +19 -1
  639. package/dist/substrate/runtime/managed-container.mjs +20 -1
  640. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  641. package/dist/substrate/runtime/manifest/index.mjs +3 -0
  642. package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
  643. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  644. package/dist/substrate/runtime/mode-errors.mjs +20 -0
  645. package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
  646. package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
  647. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  648. package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
  649. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
  650. package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
  651. package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
  652. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
  653. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  654. package/dist/substrate/runtime/observability/index.mjs +13 -0
  655. package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
  656. package/dist/substrate/runtime/observability/log-store.mjs +175 -0
  657. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
  658. package/dist/substrate/runtime/observability/logger.d.mts +2 -1
  659. package/dist/substrate/runtime/observability/logger.mjs +5 -9
  660. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  661. package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
  662. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
  663. package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
  664. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  665. package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
  666. package/dist/substrate/runtime/observability/redaction.mjs +8 -14
  667. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  668. package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
  669. package/dist/substrate/runtime/observability/span-store.mjs +110 -0
  670. package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
  671. package/dist/substrate/runtime/observability/spans.mjs +14 -14
  672. package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
  673. package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
  674. package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
  675. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
  676. package/dist/substrate/runtime/paths.d.mts +1 -1
  677. package/dist/substrate/runtime/paths.mjs +4 -3
  678. package/dist/substrate/runtime/paths.mjs.map +1 -1
  679. package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
  680. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
  681. package/dist/substrate/runtime/port-broker/index.mjs +3 -0
  682. package/dist/substrate/runtime/port-broker/service.mjs +170 -126
  683. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  684. package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
  685. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  686. package/dist/substrate/runtime/probes.d.mts +7 -5
  687. package/dist/substrate/runtime/probes.mjs +3 -1
  688. package/dist/substrate/runtime/probes.mjs.map +1 -1
  689. package/dist/substrate/runtime/projection/index.mjs +4 -0
  690. package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
  691. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  692. package/dist/substrate/runtime/projection/persisted.mjs +33 -15
  693. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
  694. package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
  695. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  696. package/dist/substrate/runtime/projection/update.mjs +88 -24
  697. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  698. package/dist/substrate/runtime/random-suffix.mjs +11 -0
  699. package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
  700. package/dist/substrate/runtime/retry-policy.d.mts +59 -1
  701. package/dist/substrate/runtime/retry-policy.mjs +66 -1
  702. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  703. package/dist/substrate/runtime/routed-url.d.mts +1 -0
  704. package/dist/substrate/runtime/routed-url.mjs +79 -0
  705. package/dist/substrate/runtime/routed-url.mjs.map +1 -0
  706. package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
  707. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  708. package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
  709. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  710. package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
  711. package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
  712. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
  713. package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
  714. package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
  715. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
  716. package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
  717. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  718. package/dist/substrate/runtime/state-store/index.d.mts +1 -0
  719. package/dist/substrate/runtime/state-store/index.mjs +3 -0
  720. package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
  721. package/dist/substrate/runtime/state-store/schema.mjs +19 -14
  722. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
  723. package/dist/substrate/runtime/state-store/service.d.mts +1 -0
  724. package/dist/substrate/runtime/state-store/service.mjs +145 -0
  725. package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
  726. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
  727. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
  728. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
  729. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
  730. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  731. package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
  732. package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
  733. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  734. package/dist/substrate/runtime/subnet-broker.mjs +60 -0
  735. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
  736. package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
  737. package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
  738. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
  739. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
  740. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
  741. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
  742. package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
  743. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
  744. package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
  745. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
  746. package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
  747. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
  748. package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
  749. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
  750. package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
  751. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
  752. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
  753. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
  754. package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
  755. package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
  756. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
  757. package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
  758. package/dist/substrate/runtime/supervisor/index.mjs +3 -0
  759. package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
  760. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
  761. package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
  762. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
  763. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
  764. package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
  765. package/dist/substrate/runtime/supervisor/state.mjs +22 -0
  766. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
  767. package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
  768. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
  769. package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
  770. package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
  771. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
  772. package/dist/substrate/runtime/typed-env.mjs +8 -0
  773. package/dist/substrate/runtime/typed-env.mjs.map +1 -0
  774. package/dist/substrate/state-store.d.mts +1 -0
  775. package/dist/substrate/versioned-doc-schema.mjs +17 -0
  776. package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
  777. package/dist/substrate/versioned-doc-sync.mjs +94 -0
  778. package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
  779. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  780. package/dist/surfaces/cli/commands/index.mjs +9 -0
  781. package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
  782. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
  783. package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
  784. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  785. package/dist/surfaces/cli/commands/prune.mjs +34 -17
  786. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  787. package/dist/surfaces/cli/commands/status.mjs +2 -2
  788. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  789. package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
  790. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  791. package/dist/surfaces/cli/commands/wipe.mjs +38 -4
  792. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  793. package/dist/surfaces/cli/errors.mjs +1 -1
  794. package/dist/surfaces/cli/errors.mjs.map +1 -1
  795. package/dist/surfaces/cli/flags.mjs +0 -1
  796. package/dist/surfaces/cli/flags.mjs.map +1 -1
  797. package/dist/surfaces/cli/index.mjs +98 -18
  798. package/dist/surfaces/cli/index.mjs.map +1 -1
  799. package/dist/surfaces/cli/output.mjs +1 -0
  800. package/dist/surfaces/cli/output.mjs.map +1 -1
  801. package/dist/surfaces/cli/sysexits.mjs +2 -1
  802. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  803. package/dist/surfaces/tui/app.mjs +25 -3
  804. package/dist/surfaces/tui/app.mjs.map +1 -1
  805. package/dist/surfaces/tui/display-derivation.mjs +23 -74
  806. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  807. package/dist/surfaces/tui/event-log.mjs +35 -23
  808. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  809. package/dist/surfaces/tui/input.mjs +5 -1
  810. package/dist/surfaces/tui/input.mjs.map +1 -1
  811. package/dist/surfaces/tui/plain-renderer.mjs +70 -34
  812. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  813. package/package.json +24 -4
  814. package/dist/contracts/liveness-classifier.d.mts +0 -19
  815. package/dist/contracts/network-resolver.d.mts +0 -15
  816. package/dist/contracts/network-resolver.mjs +0 -7
  817. package/dist/contracts/network-resolver.mjs.map +0 -1
  818. package/dist/orchestrators/codegen/extras.mjs +0 -16
  819. package/dist/orchestrators/codegen/extras.mjs.map +0 -1
  820. package/dist/plugins/deepbook/routable.mjs +0 -21
  821. package/dist/plugins/deepbook/routable.mjs.map +0 -1
  822. package/dist/plugins/faucet/service.d.mts +0 -20
  823. package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
  824. package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
  825. package/dist/plugins/sui/seed-objects.d.mts +0 -18
  826. package/dist/plugins/sui/seed-objects.mjs +0 -25
  827. package/dist/plugins/sui/seed-objects.mjs.map +0 -1
  828. package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
  829. package/dist/substrate/runtime/context-helpers.mjs +0 -32
  830. package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
  831. package/dist/substrate/runtime/run.mjs.map +0 -1
  832. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
  833. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
  834. package/dist/substrate/runtime/supervisor.d.mts +0 -1
  835. package/dist/substrate/runtime/supervisor.mjs +0 -831
  836. package/dist/substrate/runtime/supervisor.mjs.map +0 -1
  837. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
  838. /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-summary-runner.mjs","names":[],"sources":["../../../src/plugins/sui/move-summary-runner.ts"],"sourcesContent":["// Sui plugin — Move-summary runner Layer factories.\n//\n// The codegen orchestrator (L3) consumes an abstract\n// `MoveSummaryRunnerService`; it does NOT know which CLI image or\n// host binary produces the summary JSON. Both production\n// implementations live here because they encode Sui-specific\n// knowledge (the `sui` binary name, the Sui CLI image, the\n// `sui move summary` argv shape).\n//\n// Architecture: per \"Orchestrator boundaries — never names a\n// service\", the codegen orchestrator imports only the abstract\n// `MoveSummaryRunnerService` from its `bindings.ts`; the runtime\n// composer wires one of these sui-plugin layers in.\n//\n// Implementations:\n// - `layerSuiMoveSummaryRunnerDocker` — runs `sui move summary`\n// inside the Sui CLI container image; the default production\n// wiring (`runtime-composition.ts`).\n// - `layerSuiMoveSummaryRunnerHost` — runs the local `sui`\n// binary directly via `ChildProcessSpawner`. Useful for\n// embedders that already have a Sui CLI on PATH.\n\nimport { cp, mkdir, mkdtemp, rm } from 'node:fs/promises';\nimport { homedir, tmpdir } from 'node:os';\nimport { basename, dirname, join } from 'node:path';\n\nimport { Effect, Layer } from 'effect';\nimport { ChildProcess, ChildProcessSpawner } from 'effect/unstable/process';\n\nimport type { ContainerRuntime, ImageRef } from '../../contracts/container-runtime.ts';\nimport {\n\ttype MoveSummary,\n\ttype MoveSummaryInput,\n\tMoveSummaryRunnerService,\n} from '../../orchestrators/codegen/bindings.ts';\nimport { CodegenBindingsFailed } from '../../orchestrators/codegen/errors.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport { capture } from '../../substrate/runtime/observability/subprocess-capture.ts';\nimport {\n\tcopyLocalMoveDeps,\n\tshellQuote,\n\tsuiCliImageBuildContext,\n} from '../../substrate/runtime/sui-move-build/index.ts';\n\n// -----------------------------------------------------------------------------\n// Docker variant — `sui move summary` inside the Sui CLI container image.\n// -----------------------------------------------------------------------------\n\nexport const layerSuiMoveSummaryRunnerDocker: Layer.Layer<\n\tMoveSummaryRunnerService,\n\tnever,\n\tContainerRuntimeService\n> = Layer.effect(\n\tMoveSummaryRunnerService,\n\tEffect.gen(function* () {\n\t\tconst runtime: ContainerRuntime = yield* ContainerRuntimeService;\n\t\treturn MoveSummaryRunnerService.of({\n\t\t\trunSummary: (input) => runSummaryViaDocker(runtime, input),\n\t\t});\n\t}),\n);\n\n// -----------------------------------------------------------------------------\n// Host-binary variant — invoke a `sui` CLI on PATH directly.\n// -----------------------------------------------------------------------------\n\nexport const layerSuiMoveSummaryRunnerHost: Layer.Layer<\n\tMoveSummaryRunnerService,\n\tnever,\n\tChildProcessSpawner.ChildProcessSpawner\n> = Layer.effect(\n\tMoveSummaryRunnerService,\n\tEffect.gen(function* () {\n\t\tconst spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n\t\treturn MoveSummaryRunnerService.of({\n\t\t\trunSummary: ({ packageName, sourcePath }) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst scratchDir = yield* Effect.tryPromise({\n\t\t\t\t\t\ttry: () => mkdtemp(join(tmpdir(), 'devstack-move-summary-')),\n\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\tpackage: packageName,\n\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\treason: 'summary-failed',\n\t\t\t\t\t\t\t\thint: 'Unable to create a temporary directory for Move summary output.',\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tconst summaryPath = join(scratchDir, 'package');\n\t\t\t\t\t// Run summary inside a disposable copy of the package, never the\n\t\t\t\t\t// developer's real source — `sui move summary` rewrites Move.lock.\n\t\t\t\t\tconst stagedPkg = join(scratchDir, 'src');\n\t\t\t\t\tconst cleanupScratch = Effect.promise(() =>\n\t\t\t\t\t\trm(scratchDir, { recursive: true, force: true }),\n\t\t\t\t\t).pipe(Effect.ignore);\n\t\t\t\t\tconst result = yield* Effect.gen(function* () {\n\t\t\t\t\t\tyield* Effect.tryPromise({\n\t\t\t\t\t\t\ttry: async () => {\n\t\t\t\t\t\t\t\tawait mkdir(summaryPath, { recursive: true });\n\t\t\t\t\t\t\t\tawait cp(sourcePath, stagedPkg, { recursive: true });\n\t\t\t\t\t\t\t\t// Stage local relative deps so `sui move summary` resolves them.\n\t\t\t\t\t\t\t\tawait copyLocalMoveDeps(sourcePath, stagedPkg, dirname(stagedPkg));\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\t\tpackage: packageName,\n\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\treason: 'summary-failed',\n\t\t\t\t\t\t\t\t\thint: 'Unable to stage a disposable copy of the Move package for summary.',\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\tconst cmd = ChildProcess.make(\n\t\t\t\t\t\t\t'sui',\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'move',\n\t\t\t\t\t\t\t\t'summary',\n\t\t\t\t\t\t\t\t'--path',\n\t\t\t\t\t\t\t\t'.',\n\t\t\t\t\t\t\t\t'--install-dir',\n\t\t\t\t\t\t\t\tjoin(scratchDir, 'install'),\n\t\t\t\t\t\t\t\t'--output-directory',\n\t\t\t\t\t\t\t\tjoin(summaryPath, 'package_summaries'),\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t{ cwd: stagedPkg },\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn yield* capture(spawner, cmd, {\n\t\t\t\t\t\t\top: `sui move summary (${sourcePath})`,\n\t\t\t\t\t\t\tnonZeroIsFailure: true,\n\t\t\t\t\t\t\tstdoutTruncate: Infinity,\n\t\t\t\t\t\t\tstderrTruncate: 4_000,\n\t\t\t\t\t\t}).pipe(\n\t\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\t\t\tpackage: packageName,\n\t\t\t\t\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\t\t\t\t\treason: 'summary-failed',\n\t\t\t\t\t\t\t\t\t\thint: 'Install the Sui CLI and ensure this Move package can run `sui move summary`.',\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}).pipe(Effect.tapError(() => cleanupScratch));\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpackageName,\n\t\t\t\t\t\tsourcePath,\n\t\t\t\t\t\tsummaryPath,\n\t\t\t\t\t\tcleanupPath: scratchDir,\n\t\t\t\t\t\tsummaryJson: parseSummaryStdout(result.stdout),\n\t\t\t\t\t};\n\t\t\t\t}),\n\t\t});\n\t}),\n);\n\n// -----------------------------------------------------------------------------\n// Docker-variant helpers — shared with `runSummaryViaDocker`.\n// -----------------------------------------------------------------------------\n\nconst runSummaryViaDocker = (\n\truntime: ContainerRuntime,\n\tinput: MoveSummaryInput,\n): Effect.Effect<MoveSummary, CodegenBindingsFailed> =>\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tconst scratchDir = yield* makeSummaryScratch(input);\n\t\t\tconst summaryPath = join(scratchDir, 'package');\n\t\t\tconst cleanupScratch = Effect.promise(() =>\n\t\t\t\trm(scratchDir, { recursive: true, force: true }),\n\t\t\t).pipe(Effect.ignore);\n\t\t\tconst result = yield* Effect.gen(function* () {\n\t\t\t\tyield* prepareSummaryPackage(summaryPath, input);\n\t\t\t\tconst image = input.buildImage ?? (yield* resolveDefaultSummaryImage(runtime, input));\n\t\t\t\tconst moveHome = join(homedir(), '.move');\n\t\t\t\tyield* ensureMoveHome(moveHome, input);\n\t\t\t\tconst packageDir = basename(input.sourcePath);\n\t\t\t\t// Mount a disposable staged copy at /workspace, never the real source\n\t\t\t\t// tree — `sui move summary` rewrites Move.lock during resolution.\n\t\t\t\tconst stagedRoot = join(scratchDir, 'src');\n\t\t\t\tyield* stageSummarySource(input, join(stagedRoot, packageDir));\n\t\t\t\tconst hostUid = typeof process.getuid === 'function' ? process.getuid() : 0;\n\t\t\t\tconst hostGid = typeof process.getgid === 'function' ? process.getgid() : 0;\n\t\t\t\tconst command = [\n\t\t\t\t\t'set -e',\n\t\t\t\t\t'cleanup_summary() { status=$?; ' +\n\t\t\t\t\t\t'chmod -R a+rwX /summary /workspace 2>/dev/null || true; ' +\n\t\t\t\t\t\t`chown -R ${hostUid}:${hostGid} /summary /workspace 2>/dev/null || true; ` +\n\t\t\t\t\t\t'exit \"$status\"; }',\n\t\t\t\t\t'trap cleanup_summary EXIT',\n\t\t\t\t\t'mkdir -p /summary/package_summaries',\n\t\t\t\t\t`sui move summary --path /workspace/${shellQuote(packageDir)} ` +\n\t\t\t\t\t\t'--install-dir /tmp/devstack-move-summary-install ' +\n\t\t\t\t\t\t'--output-directory /summary/package_summaries',\n\t\t\t\t].join('; ');\n\t\t\t\tconst run = yield* runtime\n\t\t\t\t\t.runOneShot({\n\t\t\t\t\t\timage,\n\t\t\t\t\t\tentrypoint: 'sh',\n\t\t\t\t\t\targv: ['-c', command],\n\t\t\t\t\t\tmounts: [\n\t\t\t\t\t\t\t{ source: stagedRoot, target: '/workspace' },\n\t\t\t\t\t\t\t{ source: summaryPath, target: '/summary' },\n\t\t\t\t\t\t\t{ source: moveHome, target: '/root/.move' },\n\t\t\t\t\t\t],\n\t\t\t\t\t\ttimeoutMillis: 5 * 60_000,\n\t\t\t\t\t})\n\t\t\t\t\t.pipe(\n\t\t\t\t\t\tEffect.mapError(\n\t\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\t\t\t\t\treason: 'summary-failed',\n\t\t\t\t\t\t\t\t\thint: 'Docker runtime failed while running `sui move summary` for bindings codegen.',\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\tif (run.exitCode !== 0) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\t\t\treason: 'summary-failed',\n\t\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t\t`sui move summary exited ${run.exitCode}. ` +\n\t\t\t\t\t\t\t\t`stderr: ${run.stderr || '(empty)'}; stdout tail: ${\n\t\t\t\t\t\t\t\t\trun.stdout.slice(-400) || '(empty)'\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}\n\t\t\t\treturn run;\n\t\t\t}).pipe(Effect.tapError(() => cleanupScratch));\n\t\t\treturn {\n\t\t\t\tpackageName: input.packageName,\n\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\tsummaryPath,\n\t\t\t\tcleanupPath: scratchDir,\n\t\t\t\tsummaryJson: parseSummaryStdout(result.stdout),\n\t\t\t};\n\t\t}),\n\t);\n\nconst makeSummaryScratch = (\n\tinput: MoveSummaryInput,\n): Effect.Effect<string, CodegenBindingsFailed> =>\n\tEffect.tryPromise({\n\t\ttry: () => mkdtemp(join(tmpdir(), 'devstack-move-summary-')),\n\t\tcatch: (cause) =>\n\t\t\tnew CodegenBindingsFailed({\n\t\t\t\tpackage: input.packageName,\n\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\treason: 'summary-failed',\n\t\t\t\thint: 'Unable to create a temporary directory for Move summary output.',\n\t\t\t\tcause,\n\t\t\t}),\n\t});\n\nconst prepareSummaryPackage = (\n\tsummaryPath: string,\n\tinput: MoveSummaryInput,\n): Effect.Effect<void, CodegenBindingsFailed> =>\n\tEffect.tryPromise({\n\t\t// Only create the OUTPUT mount dir; the package itself is mounted from a\n\t\t// disposable staged copy (see `stageSummarySource`), never the real source.\n\t\ttry: () => mkdir(summaryPath, { recursive: true }).then(() => undefined),\n\t\tcatch: (cause) =>\n\t\t\tnew CodegenBindingsFailed({\n\t\t\t\tpackage: input.packageName,\n\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\treason: 'summary-failed',\n\t\t\t\thint: 'Unable to prepare a temporary Move summary output directory.',\n\t\t\t\tcause,\n\t\t\t}),\n\t});\n\n// Stage a disposable copy of the Move package. `sui move summary` rewrites\n// `Move.lock` during dependency resolution, so running it against the\n// developer's real checked-in tree would dirty their working copy. The copy\n// lives under the scoped scratch dir and is reaped with it.\nconst stageSummarySource = (\n\tinput: MoveSummaryInput,\n\tstagedPkg: string,\n): Effect.Effect<void, CodegenBindingsFailed> =>\n\tEffect.tryPromise({\n\t\ttry: async () => {\n\t\t\tawait mkdir(dirname(stagedPkg), { recursive: true });\n\t\t\tawait cp(input.sourcePath, stagedPkg, { recursive: true });\n\t\t\t// Bring local `../` deps (`{ local = \"../token\" }`) into the staged\n\t\t\t// tree so `sui move summary` resolves them (mirrors the build path).\n\t\t\tawait copyLocalMoveDeps(input.sourcePath, stagedPkg, dirname(stagedPkg));\n\t\t},\n\t\tcatch: (cause) =>\n\t\t\tnew CodegenBindingsFailed({\n\t\t\t\tpackage: input.packageName,\n\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\treason: 'summary-failed',\n\t\t\t\thint: 'Unable to stage a disposable copy of the Move package for summary.',\n\t\t\t\tcause,\n\t\t\t}),\n\t});\n\nconst resolveDefaultSummaryImage = (\n\truntime: ContainerRuntime,\n\tinput: MoveSummaryInput,\n): Effect.Effect<ImageRef, CodegenBindingsFailed> =>\n\t// Shared CLI image — owned at the daemon-level _per-app_ pin (see\n\t// `chain-build-container.ts:PER_APP_SHARED_STACK`), not per-stack;\n\t// the build container that materialises it carries the labels, so\n\t// `ensureImage` itself is intentionally label-free here.\n\truntime.ensureImage(suiCliImageBuildContext()).pipe(\n\t\tEffect.mapError(\n\t\t\t(cause) =>\n\t\t\t\tnew CodegenBindingsFailed({\n\t\t\t\t\tpackage: input.packageName,\n\t\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\t\treason: 'summary-failed',\n\t\t\t\t\thint: 'Unable to resolve the Sui CLI container image for Move bindings codegen.',\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t),\n\t);\n\nconst ensureMoveHome = (\n\tmoveHome: string,\n\tinput: MoveSummaryInput,\n): Effect.Effect<void, CodegenBindingsFailed> =>\n\tEffect.tryPromise({\n\t\ttry: () => mkdir(moveHome, { recursive: true }),\n\t\tcatch: (cause) =>\n\t\t\tnew CodegenBindingsFailed({\n\t\t\t\tpackage: input.packageName,\n\t\t\t\tsourcePath: input.sourcePath,\n\t\t\t\treason: 'summary-failed',\n\t\t\t\thint: `Unable to create Move cache mount source \"${moveHome}\".`,\n\t\t\t\tcause,\n\t\t\t}),\n\t}).pipe(Effect.asVoid);\n\nconst parseSummaryStdout = (stdout: string): unknown => {\n\tconst trimmed = stdout.trim();\n\tif (trimmed.length === 0) return null;\n\ttry {\n\t\treturn JSON.parse(trimmed) as unknown;\n\t} catch {\n\t\treturn trimmed;\n\t}\n};\n"],"mappings":";;;;;;;;;;;AAgDA,MAAa,kCAIT,MAAM,OACT,0BACA,OAAO,IAAI,aAAa;CACvB,MAAM,UAA4B,OAAO;AACzC,QAAO,yBAAyB,GAAG,EAClC,aAAa,UAAU,oBAAoB,SAAS,MAAM,EAC1D,CAAC;EACD,CACF;AAUG,MAAM,OACT,0BACA,OAAO,IAAI,aAAa;CACvB,MAAM,UAAU,OAAO,oBAAoB;AAC3C,QAAO,yBAAyB,GAAG,EAClC,aAAa,EAAE,aAAa,iBAC3B,OAAO,IAAI,aAAa;EACvB,MAAM,aAAa,OAAO,OAAO,WAAW;GAC3C,WAAW,QAAQ,KAAK,QAAQ,EAAE,yBAAyB,CAAC;GAC5D,QAAQ,UACP,IAAI,sBAAsB;IACzB,SAAS;IACT;IACA,QAAQ;IACR,MAAM;IACN;IACA,CAAC;GACH,CAAC;EACF,MAAM,cAAc,KAAK,YAAY,UAAU;EAG/C,MAAM,YAAY,KAAK,YAAY,MAAM;EACzC,MAAM,iBAAiB,OAAO,cAC7B,GAAG,YAAY;GAAE,WAAW;GAAM,OAAO;GAAM,CAAC,CAChD,CAAC,KAAK,OAAO,OAAO;AAkDrB,SAAO;GACN;GACA;GACA;GACA,aAAa;GACb,aAAa,oBAAmB,OAtDX,OAAO,IAAI,aAAa;AAC7C,WAAO,OAAO,WAAW;KACxB,KAAK,YAAY;AAChB,YAAM,MAAM,aAAa,EAAE,WAAW,MAAM,CAAC;AAC7C,YAAM,GAAG,YAAY,WAAW,EAAE,WAAW,MAAM,CAAC;AAEpD,YAAM,kBAAkB,YAAY,WAAW,QAAQ,UAAU,CAAC;;KAEnE,QAAQ,UACP,IAAI,sBAAsB;MACzB,SAAS;MACT;MACA,QAAQ;MACR,MAAM;MACN;MACA,CAAC;KACH,CAAC;AAeF,WAAO,OAAO,QAAQ,SAdV,aAAa,KACxB,OACA;KACC;KACA;KACA;KACA;KACA;KACA,KAAK,YAAY,UAAU;KAC3B;KACA,KAAK,aAAa,oBAAoB;KACtC,EACD,EAAE,KAAK,WAAW,CAEe,EAAE;KACnC,IAAI,qBAAqB,WAAW;KACpC,kBAAkB;KAClB,gBAAgB;KAChB,gBAAgB;KAChB,CAAC,CAAC,KACF,OAAO,UACL,UACA,IAAI,sBAAsB;KACzB,SAAS;KACT;KACA,QAAQ;KACR,MAAM;KACN;KACA,CAAC,CACH,CACD;KACA,CAAC,KAAK,OAAO,eAAe,eAAe,CAAC,EAMN,OAAO;GAC9C;GACA,EACH,CAAC;EACD,CACF;AAMD,MAAM,uBACL,SACA,UAEA,OAAO,OACN,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,OAAO,mBAAmB,MAAM;CACnD,MAAM,cAAc,KAAK,YAAY,UAAU;CAC/C,MAAM,iBAAiB,OAAO,cAC7B,GAAG,YAAY;EAAE,WAAW;EAAM,OAAO;EAAM,CAAC,CAChD,CAAC,KAAK,OAAO,OAAO;CACrB,MAAM,SAAS,OAAO,OAAO,IAAI,aAAa;AAC7C,SAAO,sBAAsB,aAAa,MAAM;EAChD,MAAM,QAAQ,MAAM,eAAe,OAAO,2BAA2B,SAAS,MAAM;EACpF,MAAM,WAAW,KAAK,SAAS,EAAE,QAAQ;AACzC,SAAO,eAAe,UAAU,MAAM;EACtC,MAAM,aAAa,SAAS,MAAM,WAAW;EAG7C,MAAM,aAAa,KAAK,YAAY,MAAM;AAC1C,SAAO,mBAAmB,OAAO,KAAK,YAAY,WAAW,CAAC;EAG9D,MAAM,UAAU;GACf;GACA,oGAJe,OAAO,QAAQ,WAAW,aAAa,QAAQ,QAAQ,GAAG,EAMpD,GALN,OAAO,QAAQ,WAAW,aAAa,QAAQ,QAAQ,GAAG,EAKzC;GAEhC;GACA;GACA,sCAAsC,WAAW,WAAW,CAAC;GAG7D,CAAC,KAAK,KAAK;EACZ,MAAM,MAAM,OAAO,QACjB,WAAW;GACX;GACA,YAAY;GACZ,MAAM,CAAC,MAAM,QAAQ;GACrB,QAAQ;IACP;KAAE,QAAQ;KAAY,QAAQ;KAAc;IAC5C;KAAE,QAAQ;KAAa,QAAQ;KAAY;IAC3C;KAAE,QAAQ;KAAU,QAAQ;KAAe;IAC3C;GACD,eAAe,IAAI;GACnB,CAAC,CACD,KACA,OAAO,UACL,UACA,IAAI,sBAAsB;GACzB,SAAS,MAAM;GACf,YAAY,MAAM;GAClB,QAAQ;GACR,MAAM;GACN;GACA,CAAC,CACH,CACD;AACF,MAAI,IAAI,aAAa,EACpB,QAAO,OAAO,OAAO,KACpB,IAAI,sBAAsB;GACzB,SAAS,MAAM;GACf,YAAY,MAAM;GAClB,QAAQ;GACR,MACC,2BAA2B,IAAI,SAAS,YAC7B,IAAI,UAAU,UAAU,iBAClC,IAAI,OAAO,MAAM,KAAK,IAAI;GAE5B,CAAC,CACF;AAEF,SAAO;GACN,CAAC,KAAK,OAAO,eAAe,eAAe,CAAC;AAC9C,QAAO;EACN,aAAa,MAAM;EACnB,YAAY,MAAM;EAClB;EACA,aAAa;EACb,aAAa,mBAAmB,OAAO,OAAO;EAC9C;EACA,CACF;AAEF,MAAM,sBACL,UAEA,OAAO,WAAW;CACjB,WAAW,QAAQ,KAAK,QAAQ,EAAE,yBAAyB,CAAC;CAC5D,QAAQ,UACP,IAAI,sBAAsB;EACzB,SAAS,MAAM;EACf,YAAY,MAAM;EAClB,QAAQ;EACR,MAAM;EACN;EACA,CAAC;CACH,CAAC;AAEH,MAAM,yBACL,aACA,UAEA,OAAO,WAAW;CAGjB,WAAW,MAAM,aAAa,EAAE,WAAW,MAAM,CAAC,CAAC,WAAW,KAAA,EAAU;CACxE,QAAQ,UACP,IAAI,sBAAsB;EACzB,SAAS,MAAM;EACf,YAAY,MAAM;EAClB,QAAQ;EACR,MAAM;EACN;EACA,CAAC;CACH,CAAC;AAMH,MAAM,sBACL,OACA,cAEA,OAAO,WAAW;CACjB,KAAK,YAAY;AAChB,QAAM,MAAM,QAAQ,UAAU,EAAE,EAAE,WAAW,MAAM,CAAC;AACpD,QAAM,GAAG,MAAM,YAAY,WAAW,EAAE,WAAW,MAAM,CAAC;AAG1D,QAAM,kBAAkB,MAAM,YAAY,WAAW,QAAQ,UAAU,CAAC;;CAEzE,QAAQ,UACP,IAAI,sBAAsB;EACzB,SAAS,MAAM;EACf,YAAY,MAAM;EAClB,QAAQ;EACR,MAAM;EACN;EACA,CAAC;CACH,CAAC;AAEH,MAAM,8BACL,SACA,UAMA,QAAQ,YAAY,yBAAyB,CAAC,CAAC,KAC9C,OAAO,UACL,UACA,IAAI,sBAAsB;CACzB,SAAS,MAAM;CACf,YAAY,MAAM;CAClB,QAAQ;CACR,MAAM;CACN;CACA,CAAC,CACH,CACD;AAEF,MAAM,kBACL,UACA,UAEA,OAAO,WAAW;CACjB,WAAW,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;CAC/C,QAAQ,UACP,IAAI,sBAAsB;EACzB,SAAS,MAAM;EACf,YAAY,MAAM;EAClB,QAAQ;EACR,MAAM,6CAA6C,SAAS;EAC5D;EACA,CAAC;CACH,CAAC,CAAC,KAAK,OAAO,OAAO;AAEvB,MAAM,sBAAsB,WAA4B;CACvD,MAAM,UAAU,OAAO,MAAM;AAC7B,KAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,KAAI;AACH,SAAO,KAAK,MAAM,QAAQ;SACnB;AACP,SAAO"}
@@ -1,14 +1,15 @@
1
1
  import { ChainId } from "../../substrate/brand.mjs";
2
2
  import { SuiPluginMode } from "./mode/spec.mjs";
3
+
3
4
  //#region src/plugins/sui/network-resolver.d.ts
4
5
  /** Plugin-internal shape — the resolved mode's identity, populated
5
- * by the mode-specific builder. The resolver below projects this
6
- * into the substrate's `NetworkConfig`. */
6
+ * by the mode-specific builder. */
7
7
  interface ResolvedSuiNetwork {
8
8
  readonly mode: SuiPluginMode;
9
9
  /** Branded chain identity — assembled by the mode builders so
10
10
  * downstream lookups (chain-probe / faucet capability keys) and
11
- * the `NetworkConfig` projection both accept it without a re-wrap. */
11
+ * the substrate's `NetworkConfig` projection both accept it without
12
+ * a re-wrap. */
12
13
  readonly chain: ChainId;
13
14
  readonly rpc: string;
14
15
  readonly faucet?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/sui/service.ts"],"sourcesContent":["// Sui plugin — service body.\n//\n// Architecture: the four modes are NOT four separate plugins. They\n// are one plugin with internal mode dispatch. The factory at the\n// barrel (`index.ts`) constructs a `SuiOptions` discriminator from\n// typed options; the `acquire` body below dispatches on `opts.mode`\n// and assembles the mode-appropriate subsystems.\n//\n// What this file does:\n//\n// 1. Receive resolved `SuiOptions`.\n// 2. Dispatch to the right `bootXxxMode` builder.\n// 3. Assemble the mode-aware `SuiClient` (the resolved value).\n//\n// What it does NOT do:\n//\n// - Provision the build container — `chain-build-container.ts`\n// owns that; the plugin acquires it ONLY when needed (Move\n// publish or codegen) via the ArtifactPublisher seam.\n// - Wire the StrategyContributor capabilities — that's the\n// barrel's job; the body just returns the resolved value.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type { SeedManifestMismatchError, SuiPluginError } from './errors.ts';\nimport type { ResolvedSuiNetwork } from './network-resolver.ts';\nimport type { SuiClient } from './mode/shared.ts';\nimport type { SuiOptions } from './mode/spec.ts';\nimport { bootLocalRpcMode } from './mode/external.ts';\nimport { bootForkMode } from './mode/fork.ts';\nimport { bootLiveMode } from './mode/live.ts';\nimport { bootLocalMode } from './mode/local.ts';\nimport type { ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport type { Identity } from '../../substrate/identity.ts';\nimport type { StackPaths } from '../../substrate/runtime/paths.ts';\nimport type { PortBroker } from '../../substrate/runtime/port-broker/index.ts';\n\n/** Bundled result of one acquire — resolved metadata + the user-facing\n * client. The barrel projects this into the Sui resource value; the\n * resolved metadata feeds the Codegenable + NetworkResolver contributions. */\nexport interface SuiBootResult {\n\treadonly resolved: ResolvedSuiNetwork;\n\treadonly client: SuiClient;\n}\n\n/** Dispatch on the typed mode and return the mode's boot artifacts.\n *\n * The `ContainerRuntime` is consumed by container-bearing modes\n * only (local + fork); external + live get `null` and a typed\n * refusal would surface if they tried to use it.\n *\n * Stub: the per-mode builders are all stubs; the orchestrator\n * here is the only fully-wired piece. */\nexport const bootSuiService = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\tportBroker: PortBroker,\n\tpaths: StackPaths,\n\topts: SuiOptions,\n): Effect.Effect<SuiBootResult, SuiPluginError | SeedManifestMismatchError, Scope.Scope> => {\n\tswitch (opts.mode) {\n\t\tcase 'local':\n\t\t\treturn bootLocalMode(runtime, identity, portBroker, opts).pipe(\n\t\t\t\tEffect.map(({ resolved, client }) => ({ resolved, client })),\n\t\t\t);\n\t\tcase 'local-rpc':\n\t\t\treturn bootLocalRpcMode(opts).pipe(\n\t\t\t\tEffect.map(({ resolved, client }) => ({ resolved, client })),\n\t\t\t);\n\t\tcase 'live':\n\t\t\treturn bootLiveMode(opts).pipe(Effect.map(({ resolved, client }) => ({ resolved, client })));\n\t\tcase 'fork':\n\t\t\treturn bootForkMode(runtime, identity, portBroker, paths, opts).pipe(\n\t\t\t\tEffect.map(({ resolved, client }) => ({ resolved, client })),\n\t\t\t);\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;AAqDA,MAAa,kBACZ,SACA,UACA,YACA,OACA,SAC2F;AAC3F,SAAQ,KAAK,MAAb;EACC,KAAK,QACJ,QAAO,cAAc,SAAS,UAAU,YAAY,KAAK,CAAC,KACzD,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D;EACF,KAAK,YACJ,QAAO,iBAAiB,KAAK,CAAC,KAC7B,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D;EACF,KAAK,OACJ,QAAO,aAAa,KAAK,CAAC,KAAK,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAAC;EAC7F,KAAK,OACJ,QAAO,aAAa,SAAS,UAAU,YAAY,OAAO,KAAK,CAAC,KAC/D,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D"}
1
+ {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/sui/service.ts"],"sourcesContent":["// Sui plugin — service body.\n//\n// Architecture: the four modes are NOT four separate plugins. They\n// are one plugin with internal mode dispatch. The factory at the\n// barrel (`index.ts`) constructs a `SuiOptions` discriminator from\n// typed options; the `acquire` body below dispatches on `opts.mode`\n// and assembles the mode-appropriate subsystems.\n//\n// What this file does:\n//\n// 1. Receive resolved `SuiOptions`.\n// 2. Dispatch to the right `bootXxxMode` builder.\n// 3. Assemble the mode-aware `SuiClient` (the resolved value).\n//\n// What it does NOT do:\n//\n// - Provision the build container — `chain-build-container.ts`\n// owns that; the plugin acquires it ONLY when needed (Move\n// publish or codegen) via the ArtifactPublisher seam.\n// - Wire the StrategyContributor capabilities — that's the\n// barrel's job; the body just returns the resolved value.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type { SuiConfigError, SuiPluginError } from './errors.ts';\nimport type { ResolvedSuiNetwork } from './network-resolver.ts';\nimport type { SuiClient } from './mode/shared.ts';\nimport type { SuiOptions } from './mode/spec.ts';\nimport { bootLocalRpcMode } from './mode/external.ts';\nimport { bootForkMode } from './mode/fork.ts';\nimport { bootLiveMode } from './mode/live.ts';\nimport { bootLocalMode } from './mode/local.ts';\nimport type { ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport type { Identity } from '../../substrate/identity.ts';\nimport type { StackPaths } from '../../substrate/runtime/paths.ts';\nimport type { PortBroker } from '../../substrate/runtime/port-broker/index.ts';\n\n/** Bundled result of one acquire — resolved metadata + the user-facing\n * client. The barrel projects this into the Sui resource value; the\n * resolved metadata feeds the Codegenable contribution. */\nexport interface SuiBootResult {\n\treadonly resolved: ResolvedSuiNetwork;\n\treadonly client: SuiClient;\n}\n\n/** Dispatch on the typed mode and return the mode's boot artifacts.\n *\n * The `ContainerRuntime` is consumed by container-bearing modes\n * only (local + fork); external + live get `null` and a typed\n * refusal would surface if they tried to use it.\n *\n * Stub: the per-mode builders are all stubs; the orchestrator\n * here is the only fully-wired piece. */\nexport const bootSuiService = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\tportBroker: PortBroker,\n\tpaths: StackPaths,\n\topts: SuiOptions,\n): Effect.Effect<\n\tSuiBootResult,\n\tSuiPluginError | SuiConfigError,\n\tScope.Scope\n> => {\n\tswitch (opts.mode) {\n\t\tcase 'local':\n\t\t\treturn bootLocalMode(runtime, identity, portBroker, opts).pipe(\n\t\t\t\tEffect.map(({ resolved, client }) => ({ resolved, client })),\n\t\t\t);\n\t\tcase 'local-rpc':\n\t\t\treturn bootLocalRpcMode(opts).pipe(\n\t\t\t\tEffect.map(({ resolved, client }) => ({ resolved, client })),\n\t\t\t);\n\t\tcase 'live':\n\t\t\treturn bootLiveMode(opts).pipe(Effect.map(({ resolved, client }) => ({ resolved, client })));\n\t\tcase 'fork':\n\t\t\treturn bootForkMode(runtime, identity, portBroker, paths, opts).pipe(\n\t\t\t\tEffect.map(({ resolved, client }) => ({ resolved, client })),\n\t\t\t);\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;AAqDA,MAAa,kBACZ,SACA,UACA,YACA,OACA,SAKI;AACJ,SAAQ,KAAK,MAAb;EACC,KAAK,QACJ,QAAO,cAAc,SAAS,UAAU,YAAY,KAAK,CAAC,KACzD,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D;EACF,KAAK,YACJ,QAAO,iBAAiB,KAAK,CAAC,KAC7B,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D;EACF,KAAK,OACJ,QAAO,aAAa,KAAK,CAAC,KAAK,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAAC;EAC7F,KAAK,OACJ,QAAO,aAAa,SAAS,UAAU,YAAY,OAAO,KAAK,CAAC,KAC/D,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D"}
@@ -21,6 +21,7 @@ const makeSnapshotable = (mode, app, stack, chain) => {
21
21
  missingTolerance: "fine",
22
22
  preRestore: Effect.succeed({
23
23
  kind: "sui-chain",
24
+ mode: "local",
24
25
  chain
25
26
  }),
26
27
  postRestore: Effect.void
@@ -32,6 +33,7 @@ const makeSnapshotable = (mode, app, stack, chain) => {
32
33
  missingTolerance: "fine",
33
34
  preRestore: Effect.succeed({
34
35
  kind: "sui-chain",
36
+ mode,
35
37
  chain
36
38
  })
37
39
  };
@@ -42,6 +44,7 @@ const makeSnapshotable = (mode, app, stack, chain) => {
42
44
  missingTolerance: "fine",
43
45
  preRestore: Effect.succeed({
44
46
  kind: "sui-chain",
47
+ mode: "fork",
45
48
  chain
46
49
  })
47
50
  };
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/plugins/sui/snapshot.ts"],"sourcesContent":["// Sui plugin — Snapshotable contribution.\n//\n// Architecture §3: the snapshot orchestrator captures and restores\n// without naming the plugin. Sui's contribution is mode-aware:\n//\n// - local mode — chain state (localnet validator) MUST live in\n// the writable container layer (NOT a named\n// volume), so `docker commit` captures it. Same\n// for the postgres indexer (PGDATA relocated off\n// the inherited VOLUME path).\n//\n// - external — no container, no snapshot. The `SnapshotableDecl`\n// has `missingTolerance: 'fine'` so restore against\n// a snapshot taken in local mode is a clean no-op.\n//\n// - live — same as external; no snapshot.\n//\n// - fork — data dir is a bind-mount; snapshot capture is\n// handled separately by the snapshot orchestrator.\n// This file emits the bind-mount subtree as the\n// capture descriptor.\n//\n// Chain identity (chainId + per-mode cluster id) is the canonical\n// identity-guard contribution from this plugin. The substrate's\n// pre-restore hook reads it; identity mismatch refuses the restore.\n\nimport { Effect } from 'effect';\n\nimport type { ContainerLabelTuple, SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { SuiPluginMode } from './mode/spec.ts';\n\n/** Build the Snapshotable contribution for a resolved mode + chain id.\n *\n * Identity guard data lives in `preRestore`: the substrate compares\n * the snapshot's stored chain identity against the resolver's\n * current answer; a mismatch refuses BEFORE any destructive\n * mutation. */\nexport const makeSnapshotable = (\n\tmode: SuiPluginMode,\n\tapp: string,\n\tstack: string,\n\tchain: string,\n): SnapshotableDecl => {\n\tconst labels = (role: string): ContainerLabelTuple => ({\n\t\tapp,\n\t\tstack,\n\t\tplugin: 'sui',\n\t\trole,\n\t});\n\n\tswitch (mode) {\n\t\tcase 'local': {\n\t\t\t// Validator's writable layer + postgres indexer's writable\n\t\t\t// layer. The runtime adapter pauses both before commit;\n\t\t\t// architecture default grace is \"pause container\".\n\t\t\treturn {\n\t\t\t\tkind: 'snapshotable',\n\t\t\t\t// Chain state lives in the writable container layer\n\t\t\t\t// — declared via `managedContainers`, not subtrees.\n\t\t\t\tsubtrees: [],\n\t\t\t\tmanagedContainers: [labels('validator'), labels('postgres')],\n\t\t\t\tmissingTolerance: 'fine',\n\t\t\t\tpreRestore: Effect.succeed({ kind: 'sui-chain', chain }),\n\t\t\t\tpostRestore: Effect.void,\n\t\t\t};\n\t\t}\n\t\tcase 'local-rpc':\n\t\tcase 'live': {\n\t\t\t// No container, no capture. The decl still exists so the\n\t\t\t// identity guard fires on restore (e.g. restoring a local\n\t\t\t// snapshot while the resolver says \"live testnet\" — the\n\t\t\t// identity-guard refuses).\n\t\t\treturn {\n\t\t\t\tkind: 'snapshotable',\n\t\t\t\tsubtrees: [],\n\t\t\t\tmissingTolerance: 'fine',\n\t\t\t\tpreRestore: Effect.succeed({ kind: 'sui-chain', chain }),\n\t\t\t};\n\t\t}\n\t\tcase 'fork': {\n\t\t\t// Data dir + meta are bind-mounted host paths; the\n\t\t\t// orchestrator walks the declared subtree. The fork\n\t\t\t// container itself is also captured (writable layer for\n\t\t\t// dep + cache state).\n\t\t\treturn {\n\t\t\t\tkind: 'snapshotable',\n\t\t\t\tsubtrees: ['sui-fork/'],\n\t\t\t\tmanagedContainers: [labels('fork-validator')],\n\t\t\t\tmissingTolerance: 'fine',\n\t\t\t\tpreRestore: Effect.succeed({ kind: 'sui-chain', chain }),\n\t\t\t};\n\t\t}\n\t}\n};\n"],"mappings":";;;;;;;;AAqCA,MAAa,oBACZ,MACA,KACA,OACA,UACsB;CACtB,MAAM,UAAU,UAAuC;EACtD;EACA;EACA,QAAQ;EACR;EACA;AAED,SAAQ,MAAR;EACC,KAAK,QAIJ,QAAO;GACN,MAAM;GAGN,UAAU,EAAE;GACZ,mBAAmB,CAAC,OAAO,YAAY,EAAE,OAAO,WAAW,CAAC;GAC5D,kBAAkB;GAClB,YAAY,OAAO,QAAQ;IAAE,MAAM;IAAa;IAAO,CAAC;GACxD,aAAa,OAAO;GACpB;EAEF,KAAK;EACL,KAAK,OAKJ,QAAO;GACN,MAAM;GACN,UAAU,EAAE;GACZ,kBAAkB;GAClB,YAAY,OAAO,QAAQ;IAAE,MAAM;IAAa;IAAO,CAAC;GACxD;EAEF,KAAK,OAKJ,QAAO;GACN,MAAM;GACN,UAAU,CAAC,YAAY;GACvB,mBAAmB,CAAC,OAAO,iBAAiB,CAAC;GAC7C,kBAAkB;GAClB,YAAY,OAAO,QAAQ;IAAE,MAAM;IAAa;IAAO,CAAC;GACxD"}
1
+ {"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/plugins/sui/snapshot.ts"],"sourcesContent":["// Sui plugin — Snapshotable contribution.\n//\n// Architecture §3: the snapshot orchestrator captures and restores\n// without naming the plugin. Sui's contribution is mode-aware:\n//\n// - local mode — chain state (localnet validator) MUST live in\n// the writable container layer (NOT a named\n// volume), so `docker commit` captures it. Same\n// for the postgres indexer (PGDATA relocated off\n// the inherited VOLUME path).\n//\n// - external — no container, no snapshot. The `SnapshotableDecl`\n// has `missingTolerance: 'fine'` so restore against\n// a snapshot taken in local mode is a clean no-op.\n//\n// - live — same as external; no snapshot.\n//\n// - fork — data dir is a bind-mount; snapshot capture is\n// handled separately by the snapshot orchestrator.\n// This file emits the bind-mount subtree as the\n// capture descriptor.\n//\n// Chain identity (chainId + per-mode cluster id) is the canonical\n// identity-guard contribution from this plugin. The substrate's\n// pre-restore hook reads it; identity mismatch refuses the restore.\n//\n// The `mode` discriminator is folded INTO the identity record (mirrors\n// walrus's `preRestore` carrying `mode`). It is load-bearing: container\n// `local` mode (committed chain-state artifacts in the writable layer)\n// and `local-rpc` mode (caller-owned external RPC, no container) can\n// resolve to the SAME chain id — e.g. a caller wrapping their own\n// localnet reporting `sui:localnet`, identical to the in-container\n// validator. Without the `mode` key the guard would compare only\n// `{kind, chain}` and let a container-`local` snapshot restore against a\n// `local-rpc` stack (and vice versa): restoring container chain-state\n// against an external RPC is a silent no-op masquerading as success.\n// With `mode` in the record the values differ on the `mode` key and the\n// guard refuses before any mutation.\n\nimport { Effect } from 'effect';\n\nimport type { ContainerLabelTuple, SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport type { SuiPluginMode } from './mode/spec.ts';\n\n/** Build the Snapshotable contribution for a resolved mode + chain id.\n *\n * Identity guard data lives in `preRestore`: the substrate compares\n * the snapshot's stored chain identity against the resolver's\n * current answer; a mismatch refuses BEFORE any destructive\n * mutation. */\nexport const makeSnapshotable = (\n\tmode: SuiPluginMode,\n\tapp: string,\n\tstack: string,\n\tchain: string,\n): SnapshotableDecl => {\n\tconst labels = (role: string): ContainerLabelTuple => ({\n\t\tapp,\n\t\tstack,\n\t\tplugin: 'sui',\n\t\trole,\n\t});\n\n\tswitch (mode) {\n\t\tcase 'local': {\n\t\t\t// Validator's writable layer + postgres indexer's writable\n\t\t\t// layer. The runtime adapter pauses both before commit;\n\t\t\t// architecture default grace is \"pause container\".\n\t\t\treturn {\n\t\t\t\tkind: 'snapshotable',\n\t\t\t\t// Chain state lives in the writable container layer\n\t\t\t\t// — declared via `managedContainers`, not subtrees.\n\t\t\t\tsubtrees: [],\n\t\t\t\tmanagedContainers: [labels('validator'), labels('postgres')],\n\t\t\t\tmissingTolerance: 'fine',\n\t\t\t\tpreRestore: Effect.succeed({ kind: 'sui-chain' as const, mode: 'local' as const, chain }),\n\t\t\t\tpostRestore: Effect.void,\n\t\t\t};\n\t\t}\n\t\tcase 'local-rpc':\n\t\tcase 'live': {\n\t\t\t// No container, no capture. The decl still exists so the\n\t\t\t// identity guard fires on restore (e.g. restoring a local\n\t\t\t// snapshot while the resolver says \"live testnet\" — the\n\t\t\t// identity-guard refuses). `mode` flows from the narrowed\n\t\t\t// parameter (`'local-rpc' | 'live'` here), so a `local-rpc`\n\t\t\t// snapshot also refuses against a container-`local` stack at\n\t\t\t// an identical chain id.\n\t\t\treturn {\n\t\t\t\tkind: 'snapshotable',\n\t\t\t\tsubtrees: [],\n\t\t\t\tmissingTolerance: 'fine',\n\t\t\t\tpreRestore: Effect.succeed({ kind: 'sui-chain' as const, mode, chain }),\n\t\t\t};\n\t\t}\n\t\tcase 'fork': {\n\t\t\t// Data dir + meta are bind-mounted host paths; the\n\t\t\t// orchestrator walks the declared subtree. The fork\n\t\t\t// container itself is also captured (writable layer for\n\t\t\t// dep + cache state).\n\t\t\treturn {\n\t\t\t\tkind: 'snapshotable',\n\t\t\t\tsubtrees: ['sui-fork/'],\n\t\t\t\tmanagedContainers: [labels('fork-validator')],\n\t\t\t\tmissingTolerance: 'fine',\n\t\t\t\tpreRestore: Effect.succeed({ kind: 'sui-chain' as const, mode: 'fork' as const, chain }),\n\t\t\t};\n\t\t}\n\t}\n};\n"],"mappings":";;;;;;;;AAkDA,MAAa,oBACZ,MACA,KACA,OACA,UACsB;CACtB,MAAM,UAAU,UAAuC;EACtD;EACA;EACA,QAAQ;EACR;EACA;AAED,SAAQ,MAAR;EACC,KAAK,QAIJ,QAAO;GACN,MAAM;GAGN,UAAU,EAAE;GACZ,mBAAmB,CAAC,OAAO,YAAY,EAAE,OAAO,WAAW,CAAC;GAC5D,kBAAkB;GAClB,YAAY,OAAO,QAAQ;IAAE,MAAM;IAAsB,MAAM;IAAkB;IAAO,CAAC;GACzF,aAAa,OAAO;GACpB;EAEF,KAAK;EACL,KAAK,OAQJ,QAAO;GACN,MAAM;GACN,UAAU,EAAE;GACZ,kBAAkB;GAClB,YAAY,OAAO,QAAQ;IAAE,MAAM;IAAsB;IAAM;IAAO,CAAC;GACvE;EAEF,KAAK,OAKJ,QAAO;GACN,MAAM;GACN,UAAU,CAAC,YAAY;GACvB,mBAAmB,CAAC,OAAO,iBAAiB,CAAC;GAC7C,kBAAkB;GAClB,YAAY,OAAO,QAAQ;IAAE,MAAM;IAAsB,MAAM;IAAiB;IAAO,CAAC;GACxF"}
@@ -0,0 +1,17 @@
1
+ //#region src/plugins/sui/spans.ts
2
+ const SuiSpans = {
3
+ autoTickIntervalMs: "sui.autoTick.intervalMs",
4
+ chain: "sui.chain",
5
+ container: "sui.container",
6
+ localFaucetLeaseKey: "faucet.lease.key",
7
+ localFaucetLeaseOwner: "faucet.lease.owner",
8
+ forkFaucetWhale: "sui.fork.faucet.whale",
9
+ liveFaucetUrl: "sui.live.faucetUrl",
10
+ liveNetwork: "sui.live.network",
11
+ liveRpcUrl: "sui.live.rpcUrl",
12
+ mode: "sui.mode"
13
+ };
14
+ //#endregion
15
+ export { SuiSpans };
16
+
17
+ //# sourceMappingURL=spans.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/sui/spans.ts"],"sourcesContent":["// Sui plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [SuiSpans.mode]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const SuiSpans = {\n\tautoTickIntervalMs: 'sui.autoTick.intervalMs',\n\tchain: 'sui.chain',\n\tcontainer: 'sui.container',\n\t// Local-faucet lease-broker serialization keys. Owned here because\n\t// the sui plugin owns the local-faucet container + its lease shape;\n\t// the faucet plugin only sees the strategy dispatch.\n\tlocalFaucetLeaseKey: 'faucet.lease.key',\n\tlocalFaucetLeaseOwner: 'faucet.lease.owner',\n\t// Fork-faucet impersonation source (the \"whale\" address).\n\tforkFaucetWhale: 'sui.fork.faucet.whale',\n\tliveFaucetUrl: 'sui.live.faucetUrl',\n\tliveNetwork: 'sui.live.network',\n\tliveRpcUrl: 'sui.live.rpcUrl',\n\tmode: 'sui.mode',\n} as const;\n"],"mappings":";AAOA,MAAa,WAAW;CACvB,oBAAoB;CACpB,OAAO;CACP,WAAW;CAIX,qBAAqB;CACrB,uBAAuB;CAEvB,iBAAiB;CACjB,eAAe;CACf,aAAa;CACb,YAAY;CACZ,MAAM;CACN"}
@@ -25,7 +25,6 @@ interface DappKitConfigBindings {
25
25
  readonly accounts: string;
26
26
  readonly signTransaction: string;
27
27
  readonly signPersonalMessage: string;
28
- readonly execute: string;
29
28
  };
30
29
  }
31
30
  //#endregion
@@ -1,3 +1,5 @@
1
+ import { defineSimpleConstExport } from "../internal/codegen-helpers.mjs";
2
+ import { WalletSpans } from "./spans.mjs";
1
3
  import { redactToken } from "./pairing.mjs";
2
4
  import { Effect } from "effect";
3
5
  //#region src/plugins/wallet/codegen.ts
@@ -14,18 +16,15 @@ import { Effect } from "effect";
14
16
  * placeholder so the type plumbing works; at codegen time the
15
17
  * substrate re-evaluates with the resolved values.
16
18
  */
17
- const makeWalletCodegen = (resolved) => ({
18
- kind: "codegenable",
19
+ const makeWalletCodegen = (resolved) => defineSimpleConstExport({
19
20
  emitterName: "dapp-kit-config",
20
21
  outputPath: "dapp-kit/config.ts",
22
+ exportName: "dappKitConfig",
23
+ value: resolved,
21
24
  sensitive: true,
22
- emit: (ctx) => Effect.gen(function* () {
23
- yield* Effect.annotateCurrentSpan({
24
- "wallet.codegen.pairUrl": redactToken(resolved.pairUrl),
25
- "wallet.codegen.walletUrl": resolved.walletUrl
26
- });
27
- ctx.exportConst("dappKitConfig", resolved);
28
- return ctx.done();
25
+ preEmit: Effect.annotateCurrentSpan({
26
+ [WalletSpans.codegenPairUrl]: redactToken(resolved.pairUrl),
27
+ [WalletSpans.codegenWalletUrl]: resolved.walletUrl
29
28
  })
30
29
  });
31
30
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/wallet/codegen.ts"],"sourcesContent":["// Wallet plugin — Codegenable contribution.\n//\n// Architecture (15-wallet.md §\"Capabilities PRODUCED\" + §\"Codegen\n// emits a `dapp-kit-config.ts`\"):\n//\n// - The browser-side dev-wallet adapter is the cross-boundary\n// consumer. It reads a typed `dapp-kit-config` value at startup,\n// constructs a `DevstackSignerAdapter`, and registers it with\n// `@mysten/dapp-kit`'s wallet-standard surface (in user-app\n// bundle code — devstack itself NEVER imports dapp-kit).\n//\n// - The emitted file lives at `dapp-kit/config.ts` under the staging\n// dir. The generated module owns the exported config value's type.\n//\n// SENSITIVE FLAG (task requirement #5 — manifest-vs-token threat\n// surface):\n//\n// - The emitted file carries the unredacted pair URL (incl. the\n// `#token=<32-hex>` fragment) so the dev-wallet adapter can wire\n// itself up without a side-channel read.\n// - Therefore `sensitive: true`. The codegen orchestrator tightens\n// the file mode to `0o600` on emit AND injects the file path into\n// `.gitignore`.\n//\n// Distilled-doc tension absorbed (15-wallet.md \"Manifest carries\n// unredacted pair URL while token file is 0o600 — pick one\"):\n//\n// We pick \"tighten the emit perms\". The token still lives in a\n// `0o600` side-channel file (see `pairing.ts:tokenPath`), AND the\n// codegen emit is also `0o600` via the sensitive flag. The legacy\n// `.devstack/manifest.json` write that left the pair URL world-\n// readable is GONE — the rewrite no longer emits an unredacted pair\n// URL into the manifest. Only the codegen file carries it, and that\n// file is tightened.\n//\n// See the report's §\"Architecture-doc revisions\" for the\n// architecture-doc note that needs to land alongside this.\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nimport { redactToken } from './pairing.ts';\n\n// ----------------------------------------------------------------------\n// Emitted shape\n// ----------------------------------------------------------------------\n\n/** The typed shape `dapp-kit/config.ts` exports. Downstream consumers\n * (the user-app's dapp-kit boot code) import and consume this.\n *\n * Field shape mirrors what `DevstackSignerAdapter` needs:\n *\n * - `walletUrl` : the wallet HTTP server's URL (router-fronted\n * host form when available, direct-loopback\n * fallback otherwise).\n * - `pairUrl` : `walletUrl` + `/#token=<32-hex>` (single\n * source of truth for the token).\n * - `protocolPaths` : path constants the adapter reads. Mirrored\n * here so the adapter doesn't depend on a\n * separate import.\n * - `chain` : Sui chain id the wallet's accounts are\n * scoped to. Surfaced so dapp-kit can pin its\n * active chain.\n */\nexport interface DappKitConfigBindings {\n\treadonly walletUrl: string;\n\treadonly pairUrl: string;\n\treadonly chain: string;\n\treadonly protocolPaths: {\n\t\treadonly health: string;\n\t\treadonly accounts: string;\n\t\treadonly signTransaction: string;\n\t\treadonly signPersonalMessage: string;\n\t\treadonly execute: string;\n\t};\n}\n\n// ----------------------------------------------------------------------\n// Decl construction\n// ----------------------------------------------------------------------\n\n/**\n * Construct the Codegenable contribution.\n *\n * Emits `dapp-kit/config.ts` with `sensitive: true` → the orchestrator\n * writes the file with `0o600` and gitignores it. The emitted shape\n * carries the unredacted pair URL; the side-channel token file is\n * also `0o600`.\n *\n * The `resolved` arg is supplied AFTER acquire (the substrate's\n * \"resolve-once\" memo). At factory time the barrel passes a\n * placeholder so the type plumbing works; at codegen time the\n * substrate re-evaluates with the resolved values.\n */\nexport const makeWalletCodegen = (\n\tresolved: DappKitConfigBindings,\n): CodegenableDecl<'dapp-kit-config'> => ({\n\tkind: 'codegenable',\n\temitterName: 'dapp-kit-config',\n\toutputPath: 'dapp-kit/config.ts',\n\t// SENSITIVE: drives 0o600 + .gitignore. The architecture has this\n\t// hook (`SnapshotableDecl` mirrors it for the snapshot subtree).\n\tsensitive: true,\n\temit: (ctx) =>\n\t\tEffect.gen(function* () {\n\t\t\t// Span annotation logs ONLY the redacted form — defense-in-\n\t\t\t// depth so any debug-mode span dump doesn't leak the token.\n\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t'wallet.codegen.pairUrl': redactToken(resolved.pairUrl),\n\t\t\t\t'wallet.codegen.walletUrl': resolved.walletUrl,\n\t\t\t});\n\t\t\tctx.exportConst('dappKitConfig', resolved);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;;;;;;;;;;;;;;;AA+FA,MAAa,qBACZ,cACyC;CACzC,MAAM;CACN,aAAa;CACb,YAAY;CAGZ,WAAW;CACX,OAAO,QACN,OAAO,IAAI,aAAa;AAGvB,SAAO,OAAO,oBAAoB;GACjC,0BAA0B,YAAY,SAAS,QAAQ;GACvD,4BAA4B,SAAS;GACrC,CAAC;AACF,MAAI,YAAY,iBAAiB,SAAS;AAC1C,SAAO,IAAI,MAAM;GAChB;CACH"}
1
+ {"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/wallet/codegen.ts"],"sourcesContent":["// Wallet plugin — Codegenable contribution.\n//\n// Architecture (15-wallet.md §\"Capabilities PRODUCED\" + §\"Codegen\n// emits a `dapp-kit-config.ts`\"):\n//\n// - The browser-side dev-wallet adapter is the cross-boundary\n// consumer. It reads a typed `dapp-kit-config` value at startup,\n// constructs a `DevstackSignerAdapter`, and registers it with\n// `@mysten/dapp-kit`'s wallet-standard surface (in user-app\n// bundle code — devstack itself NEVER imports dapp-kit).\n//\n// - The emitted file lives at `dapp-kit/config.ts` under the staging\n// dir. The generated module owns the exported config value's type.\n//\n// SENSITIVE FLAG (task requirement #5 — manifest-vs-token threat\n// surface):\n//\n// - The emitted file carries the unredacted pair URL (incl. the\n// `#token=<32-hex>` fragment) so the dev-wallet adapter can wire\n// itself up without a side-channel read.\n// - Therefore `sensitive: true`. The codegen orchestrator tightens\n// the file mode to `0o600` on emit AND injects the file path into\n// `.gitignore`.\n//\n// Distilled-doc tension absorbed (15-wallet.md \"Manifest carries\n// unredacted pair URL while token file is 0o600 — pick one\"):\n//\n// We pick \"tighten the emit perms\". The token still lives in a\n// `0o600` side-channel file (see `pairing.ts:tokenPath`), AND the\n// codegen emit is also `0o600` via the sensitive flag. The legacy\n// `.devstack/manifest.json` write that left the pair URL world-\n// readable is GONE — the rewrite no longer emits an unredacted pair\n// URL into the manifest. Only the codegen file carries it, and that\n// file is tightened.\n//\n// See the report's §\"Architecture-doc revisions\" for the\n// architecture-doc note that needs to land alongside this.\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nimport { defineSimpleConstExport } from '../internal/codegen-helpers.ts';\n\nimport { redactToken } from './pairing.ts';\nimport { WalletSpans } from './spans.ts';\n\n// ----------------------------------------------------------------------\n// Emitted shape\n// ----------------------------------------------------------------------\n\n/** The typed shape `dapp-kit/config.ts` exports. Downstream consumers\n * (the user-app's dapp-kit boot code) import and consume this.\n *\n * Field shape mirrors what `DevstackSignerAdapter` needs:\n *\n * - `walletUrl` : the wallet HTTP server's URL (router-fronted\n * host form when available, direct-loopback\n * fallback otherwise).\n * - `pairUrl` : `walletUrl` + `/#token=<32-hex>` (single\n * source of truth for the token).\n * - `protocolPaths` : path constants the adapter reads. Mirrored\n * here so the adapter doesn't depend on a\n * separate import.\n * - `chain` : Sui chain id the wallet's accounts are\n * scoped to. Surfaced so dapp-kit can pin its\n * active chain.\n */\nexport interface DappKitConfigBindings {\n\treadonly walletUrl: string;\n\treadonly pairUrl: string;\n\treadonly chain: string;\n\treadonly protocolPaths: {\n\t\treadonly health: string;\n\t\treadonly accounts: string;\n\t\treadonly signTransaction: string;\n\t\treadonly signPersonalMessage: string;\n\t};\n}\n\n// ----------------------------------------------------------------------\n// Decl construction\n// ----------------------------------------------------------------------\n\n/**\n * Construct the Codegenable contribution.\n *\n * Emits `dapp-kit/config.ts` with `sensitive: true` → the orchestrator\n * writes the file with `0o600` and gitignores it. The emitted shape\n * carries the unredacted pair URL; the side-channel token file is\n * also `0o600`.\n *\n * The `resolved` arg is supplied AFTER acquire (the substrate's\n * \"resolve-once\" memo). At factory time the barrel passes a\n * placeholder so the type plumbing works; at codegen time the\n * substrate re-evaluates with the resolved values.\n */\nexport const makeWalletCodegen = (\n\tresolved: DappKitConfigBindings,\n): CodegenableDecl<'dapp-kit-config'> =>\n\tdefineSimpleConstExport({\n\t\temitterName: 'dapp-kit-config',\n\t\toutputPath: 'dapp-kit/config.ts',\n\t\texportName: 'dappKitConfig',\n\t\tvalue: resolved,\n\t\t// SENSITIVE: drives 0o600 + .gitignore. The architecture has\n\t\t// this hook (`SnapshotableDecl` mirrors it for the snapshot\n\t\t// subtree).\n\t\tsensitive: true,\n\t\t// Span annotation logs ONLY the redacted form — defense-in-\n\t\t// depth so any debug-mode span dump doesn't leak the token.\n\t\tpreEmit: Effect.annotateCurrentSpan({\n\t\t\t[WalletSpans.codegenPairUrl]: redactToken(resolved.pairUrl),\n\t\t\t[WalletSpans.codegenWalletUrl]: resolved.walletUrl,\n\t\t}),\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiGA,MAAa,qBACZ,aAEA,wBAAwB;CACvB,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,OAAO;CAIP,WAAW;CAGX,SAAS,OAAO,oBAAoB;GAClC,YAAY,iBAAiB,YAAY,SAAS,QAAQ;GAC1D,YAAY,mBAAmB,SAAS;EACzC,CAAC;CACF,CAAC"}
@@ -1,8 +1,8 @@
1
+ import { WALLET_AUTH_HEADER, WALLET_BEARER_PREFIX, WALLET_ENDPOINT_KEY, WALLET_ENDPOINT_NAME, WALLET_PROTOCOL_PREFIX, WALLET_TOKEN_FRAGMENT_KEY, WALLET_TOKEN_HEX_LENGTH, WalletHttpPath, WalletHttpPathValue } from "../../contracts/wallet-protocol.mjs";
1
2
  import { CodegenableDecl } from "../../contracts/codegenable.mjs";
2
3
  import { RoutableDecl } from "../../contracts/routable.mjs";
3
4
  import { SnapshotableDecl } from "../../contracts/snapshotable.mjs";
4
5
  import { Plugin, ResourceRef } from "../../substrate/plugin.mjs";
5
- import { SeedObjectsAccumulator } from "../sui/seed-objects.mjs";
6
6
  import { SuiClient } from "../sui/mode/shared.mjs";
7
7
  import { SuiOptions } from "../sui/mode/spec.mjs";
8
8
  import { DappKitConfigBindings } from "./codegen.mjs";
@@ -32,12 +32,11 @@ import { WALLET_ACCOUNTS_ALL, WalletAccountMember, WalletOptions, WalletValue }
32
32
  * host-gateway address instead of host loopback. The published
33
33
  * wallet URL remains stack-scoped through the router.
34
34
  *
35
- * - `allowLocalhostVite: false`. The bare `http://localhost:<vite>`
36
- * form is OFF by default opt-in for headless test runners /
37
- * custom dev hosts. Defaulting it on would let a sibling stack
38
- * running vite on the same port pair with this wallet (because
39
- * `localhost` is not stack-scoped). See `origin-policy.ts` for
40
- * the rationale.
35
+ * - Origin allowlist is the router-fronted dev-server origin for
36
+ * this stack plus any explicit `allowedOrigins`. The wallet does
37
+ * not auto-allowlist a bare `http://localhost:<vite-port>` form
38
+ * `localhost` is not stack-scoped, so a sibling stack on the same
39
+ * port could pair with this wallet. See `origin-policy.ts`.
41
40
  *
42
41
  * - Pairing token in URL fragment only (`#token=<32-hex>`). Never
43
42
  * in query params (would land in access logs / referrers).
@@ -56,7 +55,6 @@ declare function wallet(opts: Omit<WalletOptions, 'accounts'> & {
56
55
  declare function wallet(): ReturnType<typeof makeWalletMember<readonly []>>;
57
56
  declare function makeWalletMember<Accounts extends ReadonlyArray<WalletAccountMember>>(opts: WalletOptions, accounts: Accounts): Plugin<"wallet", WalletValue, readonly [ResourceRef<"sui", SuiClient & {
58
57
  readonly mode: SuiOptions["mode"];
59
- readonly seedObjects: SeedObjectsAccumulator;
60
58
  }>, ...Accounts], readonly [SnapshotableDecl, CodegenableDecl<"dapp-kit-config">, RoutableDecl]>;
61
59
  //#endregion
62
60
  export { wallet };
@@ -1,39 +1,47 @@
1
1
  import { definePlugin, resource } from "../../substrate/plugin.mjs";
2
- import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
2
+ import { attachPluginExpander } from "../../contracts/plugin-expander.mjs";
3
+ import "../../api/define-plugin.mjs";
3
4
  import { IdentityContext, StackPathsService } from "../../substrate/runtime/paths.mjs";
4
- import { PortBrokerService } from "../../substrate/runtime/port-broker/service.mjs";
5
- import { renderUrl, routerHostname } from "../../orchestrators/router/hostname.mjs";
6
- import { suiResource } from "../sui/index.mjs";
5
+ import { DEFAULT_PORT_WINDOW, PortBrokerService } from "../../substrate/runtime/port-broker/service.mjs";
6
+ import "../../substrate/runtime/port-broker/index.mjs";
7
+ import { renderUrl, routedHostname } from "../../substrate/runtime/routed-url.mjs";
7
8
  import { HOST_SERVICE_DEFAULT_ENTRYPOINT_PORT } from "../host-service/routable.mjs";
9
+ import "../../contracts/wallet-protocol.mjs";
10
+ import { WALLET_ENTRYPOINT_PORT, makeWalletRoutable } from "./routable.mjs";
11
+ import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
12
+ import { suiResource } from "../sui/index.mjs";
13
+ import "../host-service/index.mjs";
8
14
  import { WALLET_ERROR_TAGS, walletBootError } from "./errors.mjs";
15
+ import "./spans.mjs";
9
16
  import "./protocol.mjs";
10
17
  import "./pairing.mjs";
11
18
  import { makeWalletCodegen } from "./codegen.mjs";
12
- import { WALLET_ENTRYPOINT_PORT, makeWalletRoutable } from "./routable.mjs";
13
19
  import { makeWalletSnapshotable } from "./snapshot.mjs";
14
20
  import "./origin-policy.mjs";
15
21
  import "./server.mjs";
16
22
  import { acquireWallet } from "./service.mjs";
17
23
  import { Effect } from "effect";
18
24
  //#region src/plugins/wallet/index.ts
19
- /** Composer-side expander hook for `wallet({ accounts: 'all' })`. The
20
- * wallet factory cannot know the stack's account members at its own
21
- * call site (members are introduced positionally to `defineDevstack`
22
- * AFTER the wallet factory has returned). The composer detects this
23
- * symbol on a member returned by the wallet factory, collects every
24
- * account-providing member from the final stack, and invokes the
25
- * hook to produce the real wallet member with a populated dependencies
26
- * tuple — keeping the dep-graph edges accurate.
25
+ /** Wallet's expander contributes through the substrate-owned
26
+ * `PluginExpander` contract (`contracts/plugin-expander.ts`). The
27
+ * composer dispatches every member's expander uniformly wallet has
28
+ * no special-case wiring in `api/define-devstack.ts`.
27
29
  *
28
- * Symbol-keyed (not a named property) so it cannot collide with any
29
- * user-facing member field. Globally registered via `Symbol.for(...)`
30
- * so the composer can look it up without importing the wallet
31
- * module's symbol-binding (this side-steps a TS2742 inferred-type
32
- * portability error: a `unique symbol`-keyed property in the wallet
33
- * member's return type would leak the symbol's compile-time identity
34
- * into the user's `defineDevstack(...)` inferred Stack type, forcing
35
- * every example's default export to carry an explicit annotation). */
36
- const WALLET_EXPAND_ACCOUNTS_ALL = Symbol.for("devstack.wallet.expand-accounts-all");
30
+ * Compose-time symmetry: any plugin needing the "rewrite this
31
+ * placeholder once the full member tuple is known" rewrite uses the
32
+ * same `attachPluginExpander(...)` seam wallet uses below. */
33
+ const ACCOUNT_RESOURCE_ID_PREFIX = "account/";
34
+ /** Type-narrowing predicate on a plugin's resource id. The account
35
+ * plugin's `AccountResourceId<Name>` template-literal type IS the
36
+ * substrate-owned discriminator (12-account.md "resource id flows into
37
+ * the on-disk path, the manifest key, container labels, and generated
38
+ * TypeScript exports") every account member's `id` reduces to
39
+ * `account/${Name}`. Probing through this typed predicate (vs. a bare
40
+ * `startsWith` whose narrowing returns `string`) prevents misclassifying
41
+ * a future plugin whose id happens to start with `account/` but is NOT
42
+ * the account-plugin shape, AND surfaces a compile error if the
43
+ * account-id prefix convention ever changes. */
44
+ const isAccountResourceMember = (member) => member.id.startsWith(ACCOUNT_RESOURCE_ID_PREFIX);
37
45
  /** The wallet plugin's resource identity. ONE per stack (15-wallet.md
38
46
  * "singleton per stack"). The id is `'wallet'` (singular). */
39
47
  const walletResource = resource("wallet");
@@ -42,11 +50,14 @@ function wallet(opts) {
42
50
  const resolvedOpts = opts ?? { accounts: "all" };
43
51
  if (resolvedOpts.accounts === "all") {
44
52
  const placeholder = makeWalletMember(resolvedOpts, []);
45
- const expander = (accountMembers) => makeWalletMember({
46
- ...resolvedOpts,
47
- accounts: accountMembers
48
- }, accountMembers);
49
- placeholder[WALLET_EXPAND_ACCOUNTS_ALL] = expander;
53
+ attachPluginExpander(placeholder, (members) => {
54
+ const accountMembers = [];
55
+ for (const m of members) if (isAccountResourceMember(m)) accountMembers.push(m);
56
+ return makeWalletMember({
57
+ ...resolvedOpts,
58
+ accounts: accountMembers
59
+ }, accountMembers);
60
+ });
50
61
  return placeholder;
51
62
  }
52
63
  return makeWalletMember(resolvedOpts, resolvedOpts.accounts);
@@ -61,12 +72,13 @@ function makeWalletMember(opts, accounts) {
61
72
  id: walletResource.id,
62
73
  dependsOn: dependencies,
63
74
  role: "service",
75
+ section: "service",
64
76
  start: (deps) => Effect.gen(function* () {
65
77
  const identity = yield* IdentityContext;
66
78
  const paths = yield* StackPathsService;
67
79
  const portBroker = yield* PortBrokerService;
68
80
  const [, ...resolvedAccounts] = deps;
69
- const routerFrontedUrl = yield* routerHostname(identity, "api").pipe(Effect.map((hostname) => renderUrl({
81
+ const routerFrontedUrl = yield* routedHostname(identity, "api").pipe(Effect.map((hostname) => renderUrl({
70
82
  protocol: "http",
71
83
  hostname,
72
84
  port: WALLET_ENTRYPOINT_PORT
@@ -75,7 +87,7 @@ function makeWalletMember(opts, accounts) {
75
87
  message: `wallet router URL construction failed: ${err.detail}`,
76
88
  cause: err
77
89
  })));
78
- const routedAppOrigin = yield* routerHostname(identity, "dev").pipe(Effect.map((hostname) => renderUrl({
90
+ const routedAppOrigin = yield* routedHostname(identity, "dev").pipe(Effect.map((hostname) => renderUrl({
79
91
  protocol: "http",
80
92
  hostname,
81
93
  port: HOST_SERVICE_DEFAULT_ENTRYPOINT_PORT
@@ -89,21 +101,20 @@ function makeWalletMember(opts, accounts) {
89
101
  stack: identity.stack,
90
102
  chain: identity.chain,
91
103
  stateRoot: paths.stackRoot,
92
- vitePortForThisStack: null,
93
104
  allocatePort: (preferred, probeHost) => portBroker.allocate({
94
- kind: "wallet",
105
+ owner: "wallet",
106
+ windowHint: DEFAULT_PORT_WINDOW,
95
107
  preferredPort: preferred,
96
108
  ...probeHost === void 0 ? {} : { probeHost }
97
109
  }).pipe(Effect.map((alloc) => alloc.port), Effect.mapError((err) => walletBootError({
98
110
  phase: "allocate-port",
99
111
  message: `port-broker allocate failed: ${err.detail}`,
100
- hint: err.reason === "preferred-busy" ? "another plugin in this stack is using your preferred port; omit `port` to let the broker pick." : err.reason === "no-free-port" ? "the wallet kind-window is exhausted; check for stray devstack supervisors holding ports." : "bind-probe failed — likely a privileged port or jail restriction.",
112
+ hint: err.reason === "preferred-busy" ? "another plugin in this stack is using your preferred port; omit `port` to let the broker pick." : err.reason === "no-free-port" ? "the wallet port window is exhausted; check for stray devstack supervisors holding ports." : "bind-probe failed — likely a privileged port or jail restriction.",
101
113
  cause: err
102
114
  }))),
103
115
  resolveAccounts: () => Effect.succeed(resolvedAccounts),
104
116
  routerFrontedUrl,
105
- routedAppOrigin,
106
- supervisorCtx: void 0
117
+ routedAppOrigin
107
118
  });
108
119
  }),
109
120
  errorContributions: walletErrorContributions,
@@ -121,6 +132,6 @@ function makeWalletMember(opts, accounts) {
121
132
  });
122
133
  }
123
134
  //#endregion
124
- export { WALLET_EXPAND_ACCOUNTS_ALL, wallet };
135
+ export { wallet };
125
136
 
126
137
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/wallet/index.ts"],"sourcesContent":["// Wallet plugin — barrel + `wallet(opts?)` factory.\n//\n// Architecture (15-wallet.md):\n//\n// The wallet bridges devstack (the supervisor host) and the\n// browser-side dev-wallet adapter (in the separate `dev-wallet`\n// package). Two parts:\n//\n// 1. The IN-PROCESS HTTP server. Owned here. Boot at acquire,\n// serve `/api/v1/devstack/*` routes (health, accounts,\n// sign-transaction, sign-personal-message, execute).\n//\n// 2. The BROWSER-SIDE ADAPTER. Owned by `dev-wallet`. Reads the\n// codegen-emitted `dapp-kit/config.ts`, constructs a\n// `DevstackSignerAdapter`, registers it with `@mysten/dapp-\n// kit`'s wallet-standard surface.\n//\n// The HTTP protocol is the ONE cross-boundary contract. THIS PACKAGE\n// NEVER IMPORTS `@mysten/dapp-kit*` OR `@mysten/wallet-standard`.\n//\n// Capabilities emitted:\n//\n// 1. Snapshotable — pairing token under `wallet/token`.\n// 2. Codegenable — `dapp-kit-config` bindings (the dev-wallet\n// adapter consumes this). Sensitive flag set — 0o600 + gitignore.\n// 3. Routable — wallet UI URL on the stack-scoped router.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport { PortBrokerService } from '../../substrate/runtime/port-broker/index.ts';\nimport { renderUrl, routerHostname } from '../../orchestrators/router/hostname.ts';\nimport { suiResource } from '../sui/index.ts';\nimport {\n\tHOST_SERVICE_DEFAULT_ENDPOINT_NAME,\n\tHOST_SERVICE_DEFAULT_ENTRYPOINT_PORT,\n} from '../host-service/routable.ts';\n\nimport { makeWalletCodegen } from './codegen.ts';\nimport { WALLET_ERROR_TAGS, walletBootError } from './errors.ts';\nimport { makeWalletRoutable, WALLET_ENTRYPOINT_PORT, WALLET_ROUTE_ROLE } from './routable.ts';\nimport { makeWalletSnapshotable } from './snapshot.ts';\nimport {\n\tacquireWallet,\n\tWALLET_ACCOUNTS_ALL,\n\ttype WalletAcquireContext,\n\ttype WalletAccountMember,\n\ttype WalletOptions,\n\ttype WalletValue,\n} from './service.ts';\nimport type { AnyPlugin } from '../../substrate/plugin.ts';\n\n/** Composer-side expander hook for `wallet({ accounts: 'all' })`. The\n * wallet factory cannot know the stack's account members at its own\n * call site (members are introduced positionally to `defineDevstack`\n * AFTER the wallet factory has returned). The composer detects this\n * symbol on a member returned by the wallet factory, collects every\n * account-providing member from the final stack, and invokes the\n * hook to produce the real wallet member with a populated dependencies\n * tuple — keeping the dep-graph edges accurate.\n *\n * Symbol-keyed (not a named property) so it cannot collide with any\n * user-facing member field. Globally registered via `Symbol.for(...)`\n * so the composer can look it up without importing the wallet\n * module's symbol-binding (this side-steps a TS2742 inferred-type\n * portability error: a `unique symbol`-keyed property in the wallet\n * member's return type would leak the symbol's compile-time identity\n * into the user's `defineDevstack(...)` inferred Stack type, forcing\n * every example's default export to carry an explicit annotation). */\nexport const WALLET_EXPAND_ACCOUNTS_ALL: symbol = Symbol.for('devstack.wallet.expand-accounts-all');\n\n/** Runtime-only expander shape attached to the placeholder wallet\n * member when the user passes `accounts: 'all'`. The composer reads\n * `member[WALLET_EXPAND_ACCOUNTS_ALL](accountMembers)` to mint the\n * resolved-tuple wallet member.\n *\n * Kept as a value-level shape (not a type-level intersection on the\n * factory's return signature) so the symbol-keyed property does NOT\n * leak into the user's inferred Stack type (see TS2742 note above). */\nexport type WalletExpandAccountsAllExpander = (\n\taccountMembers: ReadonlyArray<WalletAccountMember>,\n) => AnyPlugin;\n\n// ----------------------------------------------------------------------\n// Resource identity\n// ----------------------------------------------------------------------\n\n/** The wallet plugin's resource identity. ONE per stack (15-wallet.md\n * \"singleton per stack\"). The id is `'wallet'` (singular). */\nconst walletResource = resource<'wallet', WalletValue>('wallet');\nconst walletErrorContributions = pluginErrorContributions(WALLET_ERROR_TAGS);\n\n// ----------------------------------------------------------------------\n// User-facing factory\n// ----------------------------------------------------------------------\n\n/**\n * Construct the wallet plugin.\n *\n * Two parts of the wallet:\n *\n * - HERE: HTTP server + token + pairing protocol + codegen.\n * - DEV-WALLET PACKAGE: `@mysten/dapp-kit`-shaped adapter the\n * user-app's frontend bundle imports.\n *\n * Distilled-doc invariant (15-wallet.md \"Always explicit\"): the\n * composer NEVER auto-mounts the wallet. The user calls `wallet()`,\n * `wallet({ accounts: 'all' })`, or `wallet({ accounts: [alice, bob] })`\n * and passes the result to `defineDevstack(...)`.\n *\n * ### Security defaults\n *\n * - `bindAddress: '0.0.0.0'`. The router runs in Docker, so on\n * native Linux it reaches this host process through the Docker\n * host-gateway address instead of host loopback. The published\n * wallet URL remains stack-scoped through the router.\n *\n * - `allowLocalhostVite: false`. The bare `http://localhost:<vite>`\n * form is OFF by default — opt-in for headless test runners /\n * custom dev hosts. Defaulting it on would let a sibling stack\n * running vite on the same port pair with this wallet (because\n * `localhost` is not stack-scoped). See `origin-policy.ts` for\n * the rationale.\n *\n * - Pairing token in URL fragment only (`#token=<32-hex>`). Never\n * in query params (would land in access logs / referrers).\n *\n * - Constant-time bearer compare on every request.\n *\n * - Token file `0o600`. Codegen output (`dapp-kit/config.ts`)\n * `0o600` + gitignored via `sensitive: true`.\n */\nexport function wallet<const Accounts extends ReadonlyArray<WalletAccountMember>>(\n\topts: Omit<WalletOptions, 'accounts'> & { readonly accounts: Accounts },\n): ReturnType<typeof makeWalletMember<Accounts>>;\nexport function wallet(\n\topts: Omit<WalletOptions, 'accounts'> & { readonly accounts: typeof WALLET_ACCOUNTS_ALL },\n): ReturnType<typeof makeWalletMember<readonly []>>;\nexport function wallet(): ReturnType<typeof makeWalletMember<readonly []>>;\nexport function wallet(opts?: WalletOptions): AnyPlugin {\n\tconst resolvedOpts: WalletOptions =\n\t\topts ?? ({ accounts: WALLET_ACCOUNTS_ALL } satisfies WalletOptions);\n\tif (resolvedOpts.accounts === WALLET_ACCOUNTS_ALL) {\n\t\t// Deferred placeholder. `dependsOn` carries only `[suiResource]` —\n\t\t// the composer rewrites the member once it knows which account\n\t\t// members are in the stack (api-surface-design §4 D6). Without\n\t\t// composer expansion, the wallet would race account funding;\n\t\t// WITH composer expansion, every per-account dependency edge is\n\t\t// in place by the time the dep-graph builds.\n\t\t//\n\t\t// Type-level: the placeholder's `dependsOn` is `[suiResource]`. A\n\t\t// wider `ReadonlyArray<account/${string}>` would widen the\n\t\t// stack-level `MissingProviders` check to the template literal\n\t\t// (which never reduces to any concrete `account/<name>`), so\n\t\t// the placeholder MUST stay narrow.\n\t\t//\n\t\t// Runtime: the symbol-keyed expander is attached as a value-\n\t\t// only property; the factory's declared return type\n\t\t// intentionally does NOT surface it (a `unique symbol`-keyed\n\t\t// member field would leak into the user's inferred Stack type\n\t\t// and trigger TS2742 \"type cannot be named without a reference\n\t\t// to ./node_modules/.../plugins/wallet\" at every example's\n\t\t// default export).\n\t\tconst placeholder = makeWalletMember(resolvedOpts, [] as const);\n\t\tconst expander: WalletExpandAccountsAllExpander = (accountMembers) =>\n\t\t\tmakeWalletMember({ ...resolvedOpts, accounts: accountMembers }, accountMembers);\n\t\t(placeholder as unknown as Record<symbol, unknown>)[WALLET_EXPAND_ACCOUNTS_ALL] = expander;\n\t\treturn placeholder;\n\t}\n\treturn makeWalletMember(resolvedOpts, resolvedOpts.accounts);\n}\n\nfunction makeWalletMember<Accounts extends ReadonlyArray<WalletAccountMember>>(\n\topts: WalletOptions,\n\taccounts: Accounts,\n) {\n\t// Dependencies MUST include every account ref (15-wallet.md\n\t// \"upstreamKeys MUST include suiResource.id + every account id\" — same\n\t// load-bearing invariant). The substrate's topological scheduler\n\t// uses `dependsOn` to drive build order; without including the\n\t// account refs here, the wallet would race account funding and the\n\t// first `signTransaction` would fail with `address-not-found`.\n\t//\n\tconst dependencies = [suiResource, ...accounts] as const;\n\n\t// The resolved-opts shape acquireWallet sees has accounts pinned to\n\t// the resolved tuple — `'all'` is purely a user-surface convenience\n\t// the composer never propagates to the supervisor.\n\tconst resolvedOpts: WalletOptions<Accounts> = { ...opts, accounts };\n\n\treturn definePlugin({\n\t\tid: walletResource.id,\n\t\tdependsOn: dependencies,\n\t\t// The HTTP server is a long-lived host process; per-request\n\t\t// handlers fork off the supervisor-context fiber but the server\n\t\t// itself lives for the stack's lifetime.\n\t\trole: 'service',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// Pull identity, the stack-paths bundle, and the port-\n\t\t\t\t// broker from the supervisor-provided substrate context.\n\t\t\t\t// `StackPathsService.stackRoot` is the on-disk root for\n\t\t\t\t// per-stack runtime artifacts (incl. `wallet/token`); the\n\t\t\t\t// port broker is per-stack (Layer-driven, one instance per\n\t\t\t\t// stack scope); the wallet's scope hangs off the\n\t\t\t\t// supervisor's `acquireScope`, so any release finalizer\n\t\t\t\t// installed by these primitives unwinds with the rest of\n\t\t\t\t// the plugin's resources on cycle / teardown.\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst paths = yield* StackPathsService;\n\t\t\t\tconst portBroker = yield* PortBrokerService;\n\n\t\t\t\t// The first dependency is the hard Sui ordering edge; the\n\t\t\t\t// remaining values mirror the explicit account tuple.\n\t\t\t\tconst [, ...resolvedAccounts] = deps;\n\t\t\t\tconst routerFrontedUrl = yield* routerHostname(identity, WALLET_ROUTE_ROLE).pipe(\n\t\t\t\t\tEffect.map((hostname) =>\n\t\t\t\t\t\trenderUrl({\n\t\t\t\t\t\t\tprotocol: 'http',\n\t\t\t\t\t\t\thostname,\n\t\t\t\t\t\t\tport: WALLET_ENTRYPOINT_PORT,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.mapError((err) =>\n\t\t\t\t\t\twalletBootError({\n\t\t\t\t\t\t\tphase: 'route-url',\n\t\t\t\t\t\t\tmessage: `wallet router URL construction failed: ${err.detail}`,\n\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst routedAppOrigin = yield* routerHostname(\n\t\t\t\t\tidentity,\n\t\t\t\t\tHOST_SERVICE_DEFAULT_ENDPOINT_NAME,\n\t\t\t\t).pipe(\n\t\t\t\t\tEffect.map((hostname) =>\n\t\t\t\t\t\trenderUrl({\n\t\t\t\t\t\t\tprotocol: 'http',\n\t\t\t\t\t\t\thostname,\n\t\t\t\t\t\t\tport: HOST_SERVICE_DEFAULT_ENTRYPOINT_PORT,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.mapError((err) =>\n\t\t\t\t\t\twalletBootError({\n\t\t\t\t\t\t\tphase: 'route-url',\n\t\t\t\t\t\t\tmessage: `wallet app-origin URL construction failed: ${err.detail}`,\n\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\tconst acquireCtx: WalletAcquireContext = {\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\tchain: identity.chain,\n\t\t\t\t\tstateRoot: paths.stackRoot,\n\t\t\t\t\tvitePortForThisStack: null,\n\t\t\t\t\tallocatePort: (preferred, probeHost) =>\n\t\t\t\t\t\tportBroker\n\t\t\t\t\t\t\t.allocate({\n\t\t\t\t\t\t\t\tkind: 'wallet',\n\t\t\t\t\t\t\t\tpreferredPort: preferred,\n\t\t\t\t\t\t\t\t...(probeHost === undefined ? {} : { probeHost }),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\t\tEffect.map((alloc) => alloc.port),\n\t\t\t\t\t\t\t\tEffect.mapError((err) =>\n\t\t\t\t\t\t\t\t\twalletBootError({\n\t\t\t\t\t\t\t\t\t\tphase: 'allocate-port',\n\t\t\t\t\t\t\t\t\t\tmessage: `port-broker allocate failed: ${err.detail}`,\n\t\t\t\t\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t\t\t\t\terr.reason === 'preferred-busy'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'another plugin in this stack is using your preferred port; omit `port` to let the broker pick.'\n\t\t\t\t\t\t\t\t\t\t\t\t: err.reason === 'no-free-port'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'the wallet kind-window is exhausted; check for stray devstack supervisors holding ports.'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'bind-probe failed — likely a privileged port or jail restriction.',\n\t\t\t\t\t\t\t\t\t\tcause: err,\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),\n\t\t\t\t\tresolveAccounts: () => Effect.succeed(resolvedAccounts),\n\t\t\t\t\trouterFrontedUrl,\n\t\t\t\t\troutedAppOrigin,\n\t\t\t\t\tsupervisorCtx: undefined,\n\t\t\t\t};\n\n\t\t\t\treturn yield* acquireWallet(resolvedOpts, acquireCtx);\n\t\t\t}),\n\t\terrorContributions: walletErrorContributions,\n\t\t// Dynamic capability factory — receives the resolved\n\t\t// `WalletValue` + acquire context. Stamps the real dapp-kit\n\t\t// bindings (walletUrl, pairUrl, chain id, paths) into the\n\t\t// codegen decl, and the real identity app/stack into the\n\t\t// routable decl.\n\t\tcapabilities: ({ value: resolved, runtime: acquireCtx }) => {\n\t\t\tconst snapshot = makeWalletSnapshotable();\n\t\t\tconst codegen = makeWalletCodegen(resolved.bindings);\n\t\t\tconst routable = makeWalletRoutable({\n\t\t\t\tapp: acquireCtx.identity.app,\n\t\t\t\tstack: acquireCtx.identity.stack,\n\t\t\t\tport: resolved.localPort,\n\t\t\t});\n\t\t\treturn [snapshot, codegen, routable] as const;\n\t\t},\n\t});\n}\n\n// ----------------------------------------------------------------------\n// Re-exports\n// ----------------------------------------------------------------------\n\nexport type {\n\tWalletOptions,\n\tWalletValue,\n\tWalletAccountMember,\n\tWalletAccountsAll,\n} from './service.ts';\nexport { WALLET_ACCOUNTS_ALL } from './service.ts';\nexport type { DappKitConfigBindings } from './codegen.ts';\nexport {\n\tWalletHttpPath,\n\tWALLET_PROTOCOL_PREFIX,\n\tWALLET_AUTH_HEADER,\n\tWALLET_BEARER_PREFIX,\n\tWALLET_TOKEN_FRAGMENT_KEY,\n\tWALLET_TOKEN_HEX_LENGTH,\n\tSignRequestSchema,\n\tSignResponseSchema,\n\tExecuteRequestSchema,\n\tExecuteResponseSchema,\n\tHealthResponseSchema,\n\tAccountsResponseSchema,\n\tAccountSummarySchema,\n\tErrorResponseSchema,\n\tSuiAddressSchema,\n\tBase64Schema,\n\tSignatureSchemeSchema,\n\tAccountSourceSchema,\n\ttype WalletHttpPathValue,\n\ttype SignRequest,\n\ttype SignResponse,\n\ttype ExecuteRequest,\n\ttype ExecuteResponse,\n\ttype HealthResponse,\n\ttype AccountsResponse,\n\ttype AccountSummary,\n\ttype ErrorResponse,\n} from './protocol.ts';\nexport type {\n\tWalletError,\n\tWalletBootError,\n\tWalletBootPhase,\n\tWalletRequestError,\n\tWalletRequestPhase,\n} from './errors.ts';\nexport { WALLET_ERROR_TAGS } from './errors.ts';\nexport type { OriginPolicy, OriginPolicyInputs, OriginCheckResult } from './origin-policy.ts';\nexport { resolveOriginPolicy, checkOrigin, corsHeadersFor } from './origin-policy.ts';\nexport type { PairingToken } from './pairing.ts';\nexport {\n\tmintToken,\n\tacquirePairingToken,\n\ttokenPath,\n\tcomposePairUrl,\n\tparsePairUrl,\n\tparseBearerHeader,\n\tsafeBearerEquals,\n\tredactToken,\n} from './pairing.ts';\nexport { WALLET_ENDPOINT_NAME, makeWalletRoutable } from './routable.ts';\nexport {\n\tdispatch,\n\tstartHttpServer,\n\tMAX_BODY_BYTES,\n\ttype WalletRequest,\n\ttype WalletResponse,\n\ttype WalletServerConfig,\n\ttype WalletServerHandle,\n} from './server.ts';\nexport { makeWalletCodegen } from './codegen.ts';\nexport { makeWalletSnapshotable } from './snapshot.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAa,6BAAqC,OAAO,IAAI,sCAAsC;;;AAoBnG,MAAM,iBAAiB,SAAgC,SAAS;AAChE,MAAM,2BAA2B,yBAAyB,kBAAkB;AAiD5E,SAAgB,OAAO,MAAiC;CACvD,MAAM,eACL,QAAS,EAAE,UAAA,OAA+B;AAC3C,KAAI,aAAa,aAAA,OAAkC;EAqBlD,MAAM,cAAc,iBAAiB,cAAc,EAAE,CAAU;EAC/D,MAAM,YAA6C,mBAClD,iBAAiB;GAAE,GAAG;GAAc,UAAU;GAAgB,EAAE,eAAe;AAC/E,cAAmD,8BAA8B;AAClF,SAAO;;AAER,QAAO,iBAAiB,cAAc,aAAa,SAAS;;AAG7D,SAAS,iBACR,MACA,UACC;CAQD,MAAM,eAAe,CAAC,aAAa,GAAG,SAAS;CAK/C,MAAM,eAAwC;EAAE,GAAG;EAAM;EAAU;AAEnE,QAAO,aAAa;EACnB,IAAI,eAAe;EACnB,WAAW;EAIX,MAAM;EACN,QAAQ,SACP,OAAO,IAAI,aAAa;GAUvB,MAAM,WAAW,OAAO;GACxB,MAAM,QAAQ,OAAO;GACrB,MAAM,aAAa,OAAO;GAI1B,MAAM,GAAG,GAAG,oBAAoB;GAChC,MAAM,mBAAmB,OAAO,eAAe,UAAA,MAA4B,CAAC,KAC3E,OAAO,KAAK,aACX,UAAU;IACT,UAAU;IACV;IACA,MAAM;IACN,CAAC,CACF,EACD,OAAO,UAAU,QAChB,gBAAgB;IACf,OAAO;IACP,SAAS,0CAA0C,IAAI;IACvD,OAAO;IACP,CAAC,CACF,CACD;GACD,MAAM,kBAAkB,OAAO,eAC9B,UAAA,MAEA,CAAC,KACD,OAAO,KAAK,aACX,UAAU;IACT,UAAU;IACV;IACA,MAAM;IACN,CAAC,CACF,EACD,OAAO,UAAU,QAChB,gBAAgB;IACf,OAAO;IACP,SAAS,8CAA8C,IAAI;IAC3D,OAAO;IACP,CAAC,CACF,CACD;AAqCD,UAAO,OAAO,cAAc,cAAc;IAlCzC,KAAK,SAAS;IACd,OAAO,SAAS;IAChB,OAAO,SAAS;IAChB,WAAW,MAAM;IACjB,sBAAsB;IACtB,eAAe,WAAW,cACzB,WACE,SAAS;KACT,MAAM;KACN,eAAe;KACf,GAAI,cAAc,KAAA,IAAY,EAAE,GAAG,EAAE,WAAW;KAChD,CAAC,CACD,KACA,OAAO,KAAK,UAAU,MAAM,KAAK,EACjC,OAAO,UAAU,QAChB,gBAAgB;KACf,OAAO;KACP,SAAS,gCAAgC,IAAI;KAC7C,MACC,IAAI,WAAW,mBACZ,mGACA,IAAI,WAAW,iBACd,6FACA;KACL,OAAO;KACP,CAAC,CACF,CACD;IACH,uBAAuB,OAAO,QAAQ,iBAAiB;IACvD;IACA;IACA,eAAe,KAAA;IAGoC,CAAC;IACpD;EACH,oBAAoB;EAMpB,eAAe,EAAE,OAAO,UAAU,SAAS,iBAAiB;AAQ3D,UAAO;IAPU,wBAOD;IANA,kBAAkB,SAAS,SAMlB;IALR,mBAAmB;KACnC,KAAK,WAAW,SAAS;KACzB,OAAO,WAAW,SAAS;KAC3B,MAAM,SAAS;KACf,CACkC;IAAC;;EAErC,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/wallet/index.ts"],"sourcesContent":["// Wallet plugin — barrel + `wallet(opts?)` factory.\n//\n// Architecture (15-wallet.md):\n//\n// The wallet bridges devstack (the supervisor host) and the\n// browser-side dev-wallet adapter (in the separate `dev-wallet`\n// package). Two parts:\n//\n// 1. The IN-PROCESS HTTP server. Owned here. Boot at acquire,\n// serve `/api/v1/devstack/*` routes (health, accounts,\n// sign-transaction, sign-personal-message).\n//\n// 2. The BROWSER-SIDE ADAPTER. Owned by `dev-wallet`. Reads the\n// codegen-emitted `dapp-kit/config.ts`, constructs a\n// `DevstackSignerAdapter`, registers it with `@mysten/dapp-\n// kit`'s wallet-standard surface.\n//\n// The HTTP protocol is the ONE cross-boundary contract. THIS PACKAGE\n// NEVER IMPORTS `@mysten/dapp-kit*` OR `@mysten/wallet-standard`.\n//\n// Capabilities emitted:\n//\n// 1. Snapshotable — pairing token under `wallet/token`.\n// 2. Codegenable — `dapp-kit-config` bindings (the dev-wallet\n// adapter consumes this). Sensitive flag set — 0o600 + gitignore.\n// 3. Routable — wallet UI URL on the stack-scoped router.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport { attachPluginExpander } from '../../contracts/plugin-expander.ts';\nimport { IdentityContext, StackPathsService } from '../../substrate/runtime/paths.ts';\nimport {\n\tDEFAULT_PORT_WINDOW,\n\tPortBrokerService,\n} from '../../substrate/runtime/port-broker/index.ts';\nimport { renderUrl, routedHostname } from '../../substrate/runtime/routed-url.ts';\nimport { suiResource } from '../sui/index.ts';\nimport type { AccountResourceId } from '../account/index.ts';\nimport {\n\tHOST_SERVICE_DEFAULT_ENDPOINT_NAME,\n\tHOST_SERVICE_DEFAULT_ENTRYPOINT_PORT,\n} from '../host-service/index.ts';\n\nimport { makeWalletCodegen } from './codegen.ts';\nimport { WALLET_ERROR_TAGS, walletBootError } from './errors.ts';\nimport { makeWalletRoutable, WALLET_ENTRYPOINT_PORT, WALLET_ROUTE_ROLE } from './routable.ts';\nimport { makeWalletSnapshotable } from './snapshot.ts';\nimport {\n\tacquireWallet,\n\tWALLET_ACCOUNTS_ALL,\n\ttype WalletAcquireContext,\n\ttype WalletAccountMember,\n\ttype WalletOptions,\n\ttype WalletValue,\n} from './service.ts';\nimport type { AnyPlugin } from '../../substrate/plugin.ts';\n\n/** Wallet's expander contributes through the substrate-owned\n * `PluginExpander` contract (`contracts/plugin-expander.ts`). The\n * composer dispatches every member's expander uniformly — wallet has\n * no special-case wiring in `api/define-devstack.ts`.\n *\n * Compose-time symmetry: any plugin needing the \"rewrite this\n * placeholder once the full member tuple is known\" rewrite uses the\n * same `attachPluginExpander(...)` seam wallet uses below. */\n\nconst ACCOUNT_RESOURCE_ID_PREFIX = 'account/' as const;\n\n/** Type-narrowing predicate on a plugin's resource id. The account\n * plugin's `AccountResourceId<Name>` template-literal type IS the\n * substrate-owned discriminator (12-account.md \"resource id flows into\n * the on-disk path, the manifest key, container labels, and generated\n * TypeScript exports\") — every account member's `id` reduces to\n * `account/${Name}`. Probing through this typed predicate (vs. a bare\n * `startsWith` whose narrowing returns `string`) prevents misclassifying\n * a future plugin whose id happens to start with `account/` but is NOT\n * the account-plugin shape, AND surfaces a compile error if the\n * account-id prefix convention ever changes. */\nconst isAccountResourceMember = (\n\tmember: AnyPlugin,\n): member is AnyPlugin & { readonly id: AccountResourceId<string> } =>\n\tmember.id.startsWith(ACCOUNT_RESOURCE_ID_PREFIX);\n\n// ----------------------------------------------------------------------\n// Resource identity\n// ----------------------------------------------------------------------\n\n/** The wallet plugin's resource identity. ONE per stack (15-wallet.md\n * \"singleton per stack\"). The id is `'wallet'` (singular). */\nconst walletResource = resource<'wallet', WalletValue>('wallet');\nconst walletErrorContributions = pluginErrorContributions(WALLET_ERROR_TAGS);\n\n// ----------------------------------------------------------------------\n// User-facing factory\n// ----------------------------------------------------------------------\n\n/**\n * Construct the wallet plugin.\n *\n * Two parts of the wallet:\n *\n * - HERE: HTTP server + token + pairing protocol + codegen.\n * - DEV-WALLET PACKAGE: `@mysten/dapp-kit`-shaped adapter the\n * user-app's frontend bundle imports.\n *\n * Distilled-doc invariant (15-wallet.md \"Always explicit\"): the\n * composer NEVER auto-mounts the wallet. The user calls `wallet()`,\n * `wallet({ accounts: 'all' })`, or `wallet({ accounts: [alice, bob] })`\n * and passes the result to `defineDevstack(...)`.\n *\n * ### Security defaults\n *\n * - `bindAddress: '0.0.0.0'`. The router runs in Docker, so on\n * native Linux it reaches this host process through the Docker\n * host-gateway address instead of host loopback. The published\n * wallet URL remains stack-scoped through the router.\n *\n * - Origin allowlist is the router-fronted dev-server origin for\n * this stack plus any explicit `allowedOrigins`. The wallet does\n * not auto-allowlist a bare `http://localhost:<vite-port>` form —\n * `localhost` is not stack-scoped, so a sibling stack on the same\n * port could pair with this wallet. See `origin-policy.ts`.\n *\n * - Pairing token in URL fragment only (`#token=<32-hex>`). Never\n * in query params (would land in access logs / referrers).\n *\n * - Constant-time bearer compare on every request.\n *\n * - Token file `0o600`. Codegen output (`dapp-kit/config.ts`)\n * `0o600` + gitignored via `sensitive: true`.\n */\nexport function wallet<const Accounts extends ReadonlyArray<WalletAccountMember>>(\n\topts: Omit<WalletOptions, 'accounts'> & { readonly accounts: Accounts },\n): ReturnType<typeof makeWalletMember<Accounts>>;\nexport function wallet(\n\topts: Omit<WalletOptions, 'accounts'> & { readonly accounts: typeof WALLET_ACCOUNTS_ALL },\n): ReturnType<typeof makeWalletMember<readonly []>>;\nexport function wallet(): ReturnType<typeof makeWalletMember<readonly []>>;\nexport function wallet(opts?: WalletOptions): AnyPlugin {\n\tconst resolvedOpts: WalletOptions =\n\t\topts ?? ({ accounts: WALLET_ACCOUNTS_ALL } satisfies WalletOptions);\n\tif (resolvedOpts.accounts === WALLET_ACCOUNTS_ALL) {\n\t\t// Deferred placeholder. `dependsOn` carries only `[suiResource]` —\n\t\t// the composer rewrites the member once it knows which account\n\t\t// members are in the stack (api-surface-design §4 D6). Without\n\t\t// composer expansion, the wallet would race account funding;\n\t\t// WITH composer expansion, every per-account dependency edge is\n\t\t// in place by the time the dep-graph builds.\n\t\t//\n\t\t// Type-level: the placeholder's `dependsOn` is `[suiResource]`. A\n\t\t// wider `ReadonlyArray<account/${string}>` would widen the\n\t\t// stack-level `MissingProviders` check to the template literal\n\t\t// (which never reduces to any concrete `account/<name>`), so\n\t\t// the placeholder MUST stay narrow.\n\t\t//\n\t\t// Runtime: the symbol-keyed expander is attached as a value-\n\t\t// only property; the factory's declared return type\n\t\t// intentionally does NOT surface it (a `unique symbol`-keyed\n\t\t// member field would leak into the user's inferred Stack type\n\t\t// and trigger TS2742 \"type cannot be named without a reference\n\t\t// to ./node_modules/.../plugins/wallet\" at every example's\n\t\t// default export).\n\t\tconst placeholder = makeWalletMember(resolvedOpts, [] as const);\n\t\tattachPluginExpander(placeholder, (members) => {\n\t\t\t// Filter the full composed member tuple to the per-account\n\t\t\t// resource members the wallet would otherwise have to receive\n\t\t\t// at factory call. `isAccountResourceMember` narrows on the\n\t\t\t// `AccountResourceId<Name>` template-literal type — the typed\n\t\t\t// discriminator the account plugin's barrel exposes via\n\t\t\t// `AccountResourceId<Name>` — so a future plugin whose id\n\t\t\t// accidentally starts with `account/` cannot masquerade.\n\t\t\tconst accountMembers: Array<WalletAccountMember> = [];\n\t\t\tfor (const m of members) {\n\t\t\t\tif (isAccountResourceMember(m)) {\n\t\t\t\t\taccountMembers.push(m as unknown as WalletAccountMember);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn makeWalletMember({ ...resolvedOpts, accounts: accountMembers }, accountMembers);\n\t\t});\n\t\treturn placeholder;\n\t}\n\treturn makeWalletMember(resolvedOpts, resolvedOpts.accounts);\n}\n\nfunction makeWalletMember<Accounts extends ReadonlyArray<WalletAccountMember>>(\n\topts: WalletOptions,\n\taccounts: Accounts,\n) {\n\t// Dependencies MUST include every account ref (15-wallet.md\n\t// \"upstreamKeys MUST include suiResource.id + every account id\" — same\n\t// load-bearing invariant). The substrate's topological scheduler\n\t// uses `dependsOn` to drive build order; without including the\n\t// account refs here, the wallet would race account funding and the\n\t// first `signTransaction` would fail with `address-not-found`.\n\t//\n\tconst dependencies = [suiResource, ...accounts] as const;\n\n\t// The resolved-opts shape acquireWallet sees has accounts pinned to\n\t// the resolved tuple — `'all'` is purely a user-surface convenience\n\t// the composer never propagates to the supervisor.\n\tconst resolvedOpts: WalletOptions<Accounts> = { ...opts, accounts };\n\n\treturn definePlugin({\n\t\tid: walletResource.id,\n\t\tdependsOn: dependencies,\n\t\t// The HTTP server is a long-lived host process; per-request\n\t\t// handlers fork off the supervisor-context fiber but the server\n\t\t// itself lives for the stack's lifetime.\n\t\trole: 'service',\n\t\tsection: 'service',\n\t\tstart: (deps) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// Pull identity, the stack-paths bundle, and the port-\n\t\t\t\t// broker from the supervisor-provided substrate context.\n\t\t\t\t// `StackPathsService.stackRoot` is the on-disk root for\n\t\t\t\t// per-stack runtime artifacts (incl. `wallet/token`); the\n\t\t\t\t// port broker is per-stack (Layer-driven, one instance per\n\t\t\t\t// stack scope); the wallet's scope hangs off the\n\t\t\t\t// supervisor's `acquireScope`, so any release finalizer\n\t\t\t\t// installed by these primitives unwinds with the rest of\n\t\t\t\t// the plugin's resources on cycle / teardown.\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst paths = yield* StackPathsService;\n\t\t\t\tconst portBroker = yield* PortBrokerService;\n\n\t\t\t\t// The first dependency is the hard Sui ordering edge; the\n\t\t\t\t// remaining values mirror the explicit account tuple.\n\t\t\t\tconst [, ...resolvedAccounts] = deps;\n\t\t\t\tconst routerFrontedUrl = yield* routedHostname(identity, WALLET_ROUTE_ROLE).pipe(\n\t\t\t\t\tEffect.map((hostname) =>\n\t\t\t\t\t\trenderUrl({\n\t\t\t\t\t\t\tprotocol: 'http',\n\t\t\t\t\t\t\thostname,\n\t\t\t\t\t\t\tport: WALLET_ENTRYPOINT_PORT,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.mapError((err) =>\n\t\t\t\t\t\twalletBootError({\n\t\t\t\t\t\t\tphase: 'route-url',\n\t\t\t\t\t\t\tmessage: `wallet router URL construction failed: ${err.detail}`,\n\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst routedAppOrigin = yield* routedHostname(\n\t\t\t\t\tidentity,\n\t\t\t\t\tHOST_SERVICE_DEFAULT_ENDPOINT_NAME,\n\t\t\t\t).pipe(\n\t\t\t\t\tEffect.map((hostname) =>\n\t\t\t\t\t\trenderUrl({\n\t\t\t\t\t\t\tprotocol: 'http',\n\t\t\t\t\t\t\thostname,\n\t\t\t\t\t\t\tport: HOST_SERVICE_DEFAULT_ENTRYPOINT_PORT,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\tEffect.mapError((err) =>\n\t\t\t\t\t\twalletBootError({\n\t\t\t\t\t\t\tphase: 'route-url',\n\t\t\t\t\t\t\tmessage: `wallet app-origin URL construction failed: ${err.detail}`,\n\t\t\t\t\t\t\tcause: err,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\tconst acquireCtx: WalletAcquireContext = {\n\t\t\t\t\tapp: identity.app,\n\t\t\t\t\tstack: identity.stack,\n\t\t\t\t\tchain: identity.chain,\n\t\t\t\t\tstateRoot: paths.stackRoot,\n\t\t\t\t\tallocatePort: (preferred, probeHost) =>\n\t\t\t\t\t\tportBroker\n\t\t\t\t\t\t\t.allocate({\n\t\t\t\t\t\t\t\towner: 'wallet',\n\t\t\t\t\t\t\t\t// Pin the wallet's UX-meaningful range so the dev wallet\n\t\t\t\t\t\t\t\t// adapter's auto-connect-port heuristic keeps working even\n\t\t\t\t\t\t\t\t// after a fallback scan. The broker scan window is half-open\n\t\t\t\t\t\t\t\t// `[start, start + size)`, so `DEFAULT_PORT_WINDOW`\n\t\t\t\t\t\t\t\t// (start 39200, size 1000) covers 39200..40199 inclusive.\n\t\t\t\t\t\t\t\t// Reuse the broker's exported default rather than a local\n\t\t\t\t\t\t\t\t// literal so the two cannot silently drift (pinned by\n\t\t\t\t\t\t\t\t// `test/plugins/wallet/port-window-pin.test.ts`).\n\t\t\t\t\t\t\t\twindowHint: DEFAULT_PORT_WINDOW,\n\t\t\t\t\t\t\t\tpreferredPort: preferred,\n\t\t\t\t\t\t\t\t...(probeHost === undefined ? {} : { probeHost }),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\t\tEffect.map((alloc) => alloc.port),\n\t\t\t\t\t\t\t\tEffect.mapError((err) =>\n\t\t\t\t\t\t\t\t\twalletBootError({\n\t\t\t\t\t\t\t\t\t\tphase: 'allocate-port',\n\t\t\t\t\t\t\t\t\t\tmessage: `port-broker allocate failed: ${err.detail}`,\n\t\t\t\t\t\t\t\t\t\thint:\n\t\t\t\t\t\t\t\t\t\t\terr.reason === 'preferred-busy'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'another plugin in this stack is using your preferred port; omit `port` to let the broker pick.'\n\t\t\t\t\t\t\t\t\t\t\t\t: err.reason === 'no-free-port'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'the wallet port window is exhausted; check for stray devstack supervisors holding ports.'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'bind-probe failed — likely a privileged port or jail restriction.',\n\t\t\t\t\t\t\t\t\t\tcause: err,\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),\n\t\t\t\t\tresolveAccounts: () => Effect.succeed(resolvedAccounts),\n\t\t\t\t\trouterFrontedUrl,\n\t\t\t\t\troutedAppOrigin,\n\t\t\t\t};\n\n\t\t\t\treturn yield* acquireWallet(resolvedOpts, acquireCtx);\n\t\t\t}),\n\t\terrorContributions: walletErrorContributions,\n\t\t// Dynamic capability factory — receives the resolved\n\t\t// `WalletValue` + acquire context. Stamps the real dapp-kit\n\t\t// bindings (walletUrl, pairUrl, chain id, paths) into the\n\t\t// codegen decl, and the real identity app/stack into the\n\t\t// routable decl.\n\t\tcapabilities: ({ value: resolved, runtime: acquireCtx }) => {\n\t\t\tconst snapshot = makeWalletSnapshotable();\n\t\t\tconst codegen = makeWalletCodegen(resolved.bindings);\n\t\t\tconst routable = makeWalletRoutable({\n\t\t\t\tapp: acquireCtx.identity.app,\n\t\t\t\tstack: acquireCtx.identity.stack,\n\t\t\t\tport: resolved.localPort,\n\t\t\t});\n\t\t\treturn [snapshot, codegen, routable] as const;\n\t\t},\n\t});\n}\n\n// ----------------------------------------------------------------------\n// Re-exports\n// ----------------------------------------------------------------------\n\nexport type {\n\tWalletOptions,\n\tWalletValue,\n\tWalletAccountMember,\n\tWalletAccountsAll,\n} from './service.ts';\nexport { WALLET_ACCOUNTS_ALL } from './service.ts';\nexport type { DappKitConfigBindings } from './codegen.ts';\nexport {\n\tWalletHttpPath,\n\tWALLET_PROTOCOL_PREFIX,\n\tWALLET_AUTH_HEADER,\n\tWALLET_BEARER_PREFIX,\n\tWALLET_TOKEN_FRAGMENT_KEY,\n\tWALLET_TOKEN_HEX_LENGTH,\n\tSignRequestSchema,\n\tSignResponseSchema,\n\tHealthResponseSchema,\n\tAccountsResponseSchema,\n\tAccountSummarySchema,\n\tErrorResponseSchema,\n\tSuiAddressSchema,\n\tBase64Schema,\n\tSignatureSchemeSchema,\n\tAccountSourceSchema,\n\ttype WalletHttpPathValue,\n\ttype SignRequest,\n\ttype SignResponse,\n\ttype HealthResponse,\n\ttype AccountsResponse,\n\ttype AccountSummary,\n\ttype ErrorResponse,\n} from './protocol.ts';\nexport type {\n\tWalletError,\n\tWalletBootError,\n\tWalletBootPhase,\n\tWalletRequestError,\n\tWalletRequestPhase,\n} from './errors.ts';\nexport { WALLET_ERROR_TAGS } from './errors.ts';\nexport type { OriginPolicy, OriginPolicyInputs, OriginCheckResult } from './origin-policy.ts';\nexport { resolveOriginPolicy, checkOrigin, corsHeadersFor } from './origin-policy.ts';\nexport type { PairingToken } from './pairing.ts';\nexport {\n\tmintToken,\n\tacquirePairingToken,\n\ttokenPath,\n\tcomposePairUrl,\n\tparsePairUrl,\n\tparseBearerHeader,\n\tsafeBearerEquals,\n\tredactToken,\n} from './pairing.ts';\nexport { WALLET_ENDPOINT_NAME, WALLET_ENDPOINT_KEY, makeWalletRoutable } from './routable.ts';\nexport { WalletSpans } from './spans.ts';\nexport {\n\tdispatch,\n\tstartHttpServer,\n\tMAX_BODY_BYTES,\n\ttype WalletRequest,\n\ttype WalletResponse,\n\ttype WalletServerConfig,\n\ttype WalletServerHandle,\n} from './server.ts';\nexport { makeWalletCodegen } from './codegen.ts';\nexport { makeWalletSnapshotable } from './snapshot.ts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,MAAM,6BAA6B;;;;;;;;;;;AAYnC,MAAM,2BACL,WAEA,OAAO,GAAG,WAAW,2BAA2B;;;AAQjD,MAAM,iBAAiB,SAAgC,SAAS;AAChE,MAAM,2BAA2B,yBAAyB,kBAAkB;AAgD5E,SAAgB,OAAO,MAAiC;CACvD,MAAM,eACL,QAAS,EAAE,UAAA,OAA+B;AAC3C,KAAI,aAAa,aAAA,OAAkC;EAqBlD,MAAM,cAAc,iBAAiB,cAAc,EAAE,CAAU;AAC/D,uBAAqB,cAAc,YAAY;GAQ9C,MAAM,iBAA6C,EAAE;AACrD,QAAK,MAAM,KAAK,QACf,KAAI,wBAAwB,EAAE,CAC7B,gBAAe,KAAK,EAAoC;AAG1D,UAAO,iBAAiB;IAAE,GAAG;IAAc,UAAU;IAAgB,EAAE,eAAe;IACrF;AACF,SAAO;;AAER,QAAO,iBAAiB,cAAc,aAAa,SAAS;;AAG7D,SAAS,iBACR,MACA,UACC;CAQD,MAAM,eAAe,CAAC,aAAa,GAAG,SAAS;CAK/C,MAAM,eAAwC;EAAE,GAAG;EAAM;EAAU;AAEnE,QAAO,aAAa;EACnB,IAAI,eAAe;EACnB,WAAW;EAIX,MAAM;EACN,SAAS;EACT,QAAQ,SACP,OAAO,IAAI,aAAa;GAUvB,MAAM,WAAW,OAAO;GACxB,MAAM,QAAQ,OAAO;GACrB,MAAM,aAAa,OAAO;GAI1B,MAAM,GAAG,GAAG,oBAAoB;GAChC,MAAM,mBAAmB,OAAO,eAAe,UAAA,MAA4B,CAAC,KAC3E,OAAO,KAAK,aACX,UAAU;IACT,UAAU;IACV;IACA,MAAM;IACN,CAAC,CACF,EACD,OAAO,UAAU,QAChB,gBAAgB;IACf,OAAO;IACP,SAAS,0CAA0C,IAAI;IACvD,OAAO;IACP,CAAC,CACF,CACD;GACD,MAAM,kBAAkB,OAAO,eAC9B,UAAA,MAEA,CAAC,KACD,OAAO,KAAK,aACX,UAAU;IACT,UAAU;IACV;IACA,MAAM;IACN,CAAC,CACF,EACD,OAAO,UAAU,QAChB,gBAAgB;IACf,OAAO;IACP,SAAS,8CAA8C,IAAI;IAC3D,OAAO;IACP,CAAC,CACF,CACD;AA4CD,UAAO,OAAO,cAAc,cAAc;IAzCzC,KAAK,SAAS;IACd,OAAO,SAAS;IAChB,OAAO,SAAS;IAChB,WAAW,MAAM;IACjB,eAAe,WAAW,cACzB,WACE,SAAS;KACT,OAAO;KASP,YAAY;KACZ,eAAe;KACf,GAAI,cAAc,KAAA,IAAY,EAAE,GAAG,EAAE,WAAW;KAChD,CAAC,CACD,KACA,OAAO,KAAK,UAAU,MAAM,KAAK,EACjC,OAAO,UAAU,QAChB,gBAAgB;KACf,OAAO;KACP,SAAS,gCAAgC,IAAI;KAC7C,MACC,IAAI,WAAW,mBACZ,mGACA,IAAI,WAAW,iBACd,6FACA;KACL,OAAO;KACP,CAAC,CACF,CACD;IACH,uBAAuB,OAAO,QAAQ,iBAAiB;IACvD;IACA;IAGmD,CAAC;IACpD;EACH,oBAAoB;EAMpB,eAAe,EAAE,OAAO,UAAU,SAAS,iBAAiB;AAQ3D,UAAO;IAPU,wBAOD;IANA,kBAAkB,SAAS,SAMlB;IALR,mBAAmB;KACnC,KAAK,WAAW,SAAS;KACzB,OAAO,WAAW,SAAS;KAC3B,MAAM,SAAS;KACf,CACkC;IAAC;;EAErC,CAAC"}
@@ -4,45 +4,29 @@ import { Effect } from "effect";
4
4
  /**
5
5
  * Resolve the per-stack origin allowlist.
6
6
  *
7
- * - Always allowlisted: the stack-scoped router host
8
- * `http://dev.<stack>.<app>.localhost:<vite-port>`, IF the broker recorded
9
- * a vite port for this stack.
10
- * - Conditionally allowlisted: the bare `http://localhost:<vite-port>`
11
- * form. Off by default; on iff `allowLocalhostVite` is true.
7
+ * - Always allowlisted: the router-fronted dev-server origin for this
8
+ * stack (`routedAppOrigin`), when the router derivation produced one.
12
9
  * - Always allowlisted: any explicit caller-supplied origins from
13
10
  * `extraOrigins`.
14
11
  *
15
- * Empty-allowlist policy (vite absent AND no `extraOrigins`): allowed.
16
- * The wallet boots normally; with an empty allowlist the per-request
17
- * gate refuses every request (every Origin lands in `forbidden`). This
18
- * is the correct behavior for a stack composed without any client UI
19
- * (e.g. node-only smoke / e2e configs) — the wallet's keypair + token
20
- * are still useful for the host process, but the HTTP surface is
21
- * effectively closed. A `Effect.logWarning` surfaces the configuration
22
- * for operator visibility.
23
- *
24
- * Returns `Effect<OriginPolicy, WalletBootError>` (the error channel
25
- * is preserved for future fail-fast modes the resolver may grow).
12
+ * Empty-allowlist policy (no `routedAppOrigin` AND no `extraOrigins`):
13
+ * allowed. The wallet boots normally; with an empty allowlist the
14
+ * per-request gate refuses every request (every Origin lands in
15
+ * `forbidden`). This is the correct behavior for a stack composed
16
+ * without any client UI (e.g. node-only smoke / e2e configs) — the
17
+ * wallet's keypair + token are still useful for the host process, but
18
+ * the HTTP surface is effectively closed. A `Effect.logWarning`
19
+ * surfaces the configuration for operator visibility.
26
20
  */
27
21
  const resolveOriginPolicy = (inputs) => Effect.gen(function* () {
28
22
  const allowed = /* @__PURE__ */ new Set();
29
- const stackScopedHost = inputs.stack === "main" ? `dev.${inputs.app}.localhost` : `dev.${inputs.stack}.${inputs.app}.localhost`;
30
- if (inputs.vitePortForThisStack !== null) {
31
- allowed.add(`http://${stackScopedHost}:${inputs.vitePortForThisStack}`);
32
- if (inputs.allowLocalhostVite) allowed.add(`http://localhost:${inputs.vitePortForThisStack}`);
33
- }
34
23
  if (inputs.routedAppOrigin !== null) allowed.add(inputs.routedAppOrigin);
35
24
  for (const o of inputs.extraOrigins) allowed.add(o);
36
25
  if (allowed.size === 0) yield* Effect.logWarning("wallet origin allowlist is empty").pipe(Effect.annotateLogs({
37
26
  [SpanAttr.app]: inputs.app,
38
- [SpanAttr.stack]: inputs.stack,
39
- [SpanAttr.walletLocalhostViteEnabled]: inputs.allowLocalhostVite
27
+ [SpanAttr.stack]: inputs.stack
40
28
  }));
41
- return {
42
- allowed,
43
- localhostViteEnabled: inputs.allowLocalhostVite,
44
- stackScopedHost
45
- };
29
+ return { allowed };
46
30
  });
47
31
  const checkOrigin = (policy, headerValue) => {
48
32
  if (headerValue === void 0 || headerValue.length === 0) return "missing";