@mysten-incubation/devstack 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/README.md +6 -3
  2. package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
  5. package/dashboard-ui/index.html +2 -2
  6. package/dist/api/define-capabilities.d.mts +1 -20
  7. package/dist/api/define-capabilities.mjs +15 -22
  8. package/dist/api/define-capabilities.mjs.map +1 -1
  9. package/dist/api/define-devstack-with.d.mts +7 -1
  10. package/dist/api/define-devstack-with.mjs.map +1 -1
  11. package/dist/api/define-devstack.mjs.map +1 -1
  12. package/dist/api/define-plugin.d.mts +2 -1
  13. package/dist/api/inference-network.d.mts +31 -17
  14. package/dist/api/inference-network.mjs +40 -43
  15. package/dist/api/inference-network.mjs.map +1 -1
  16. package/dist/api/load-config.mjs +88 -0
  17. package/dist/api/load-config.mjs.map +1 -0
  18. package/dist/api/mode-narrowed-factory.d.mts +1 -1
  19. package/dist/api/mode-narrowed-factory.mjs.map +1 -1
  20. package/dist/api/run-stack-internal.mjs +202 -0
  21. package/dist/api/run-stack-internal.mjs.map +1 -0
  22. package/dist/api/run-stack.d.mts +82 -31
  23. package/dist/api/run-stack.mjs +22 -141
  24. package/dist/api/run-stack.mjs.map +1 -1
  25. package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
  26. package/dist/build-integrations/dapp-kit/index.mjs +58 -0
  27. package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
  28. package/dist/build-integrations/playwright/config.d.mts +1 -30
  29. package/dist/build-integrations/playwright/config.mjs +1 -27
  30. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  31. package/dist/build-integrations/playwright/errors.d.mts +4 -7
  32. package/dist/build-integrations/playwright/errors.mjs.map +1 -1
  33. package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
  34. package/dist/build-integrations/playwright/global-setup.mjs +142 -218
  35. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  36. package/dist/build-integrations/playwright/index.d.mts +2 -2
  37. package/dist/build-integrations/playwright/index.mjs +2 -2
  38. package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
  39. package/dist/build-integrations/playwright/stack-context.mjs +4 -2
  40. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  41. package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
  42. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  44. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
  46. package/dist/build-integrations/runtime/discover.d.mts +6 -4
  47. package/dist/build-integrations/runtime/discover.mjs +15 -4
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  49. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/errors.mjs.map +1 -1
  51. package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
  52. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  53. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
  54. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
  55. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
  57. package/dist/build-integrations/vite/index.d.mts +84 -19
  58. package/dist/build-integrations/vite/index.mjs +203 -28
  59. package/dist/build-integrations/vite/index.mjs.map +1 -1
  60. package/dist/build-integrations/vitest/config.d.mts +20 -2
  61. package/dist/build-integrations/vitest/config.mjs +16 -4
  62. package/dist/build-integrations/vitest/config.mjs.map +1 -1
  63. package/dist/build-integrations/vitest/env.d.mts +18 -10
  64. package/dist/build-integrations/vitest/env.mjs +11 -10
  65. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  66. package/dist/build-integrations/vitest/errors.d.mts +7 -11
  67. package/dist/build-integrations/vitest/errors.mjs +3 -4
  68. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  69. package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
  70. package/dist/build-integrations/vitest/global-setup.mjs +156 -0
  71. package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
  72. package/dist/build-integrations/vitest/index.d.mts +3 -2
  73. package/dist/build-integrations/vitest/index.mjs +3 -2
  74. package/dist/build-integrations/vitest/setup.mjs +2 -2
  75. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  76. package/dist/build-integrations/vitest/stack-context.d.mts +5 -3
  77. package/dist/build-integrations/vitest/stack-context.mjs +3 -2
  78. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  79. package/dist/cli/bail.mjs.map +1 -1
  80. package/dist/cli/doctor-probes.mjs +1 -3
  81. package/dist/cli/doctor-probes.mjs.map +1 -1
  82. package/dist/cli/main.d.mts +23 -1
  83. package/dist/cli/main.mjs +63 -8
  84. package/dist/cli/main.mjs.map +1 -1
  85. package/dist/cli/prune-direct.mjs.map +1 -1
  86. package/dist/cli/snapshot-reader.mjs.map +1 -1
  87. package/dist/cli/up-lifecycle.mjs.map +1 -1
  88. package/dist/cli/wirings/apply.mjs +28 -21
  89. package/dist/cli/wirings/apply.mjs.map +1 -1
  90. package/dist/cli/wirings/codegen.mjs +108 -0
  91. package/dist/cli/wirings/codegen.mjs.map +1 -0
  92. package/dist/cli/wirings/config-loader.mjs +12 -62
  93. package/dist/cli/wirings/config-loader.mjs.map +1 -1
  94. package/dist/cli/wirings/dump-ids.mjs +86 -0
  95. package/dist/cli/wirings/dump-ids.mjs.map +1 -0
  96. package/dist/cli/wirings/engine-command.mjs +1 -1
  97. package/dist/cli/wirings/engine-command.mjs.map +1 -1
  98. package/dist/cli/wirings/identity.mjs +2 -2
  99. package/dist/cli/wirings/identity.mjs.map +1 -1
  100. package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
  101. package/dist/cli/wirings/read-devstack-version.mjs +17 -0
  102. package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
  103. package/dist/cli/wirings/snapshot.mjs +27 -34
  104. package/dist/cli/wirings/snapshot.mjs.map +1 -1
  105. package/dist/cli/wirings/up-ipc.mjs +147 -0
  106. package/dist/cli/wirings/up-ipc.mjs.map +1 -0
  107. package/dist/cli/wirings/up.mjs +218 -198
  108. package/dist/cli/wirings/up.mjs.map +1 -1
  109. package/dist/cli/wirings/wipe.mjs +1 -1
  110. package/dist/cli/wirings/wipe.mjs.map +1 -1
  111. package/dist/contracts/chain-probe.d.mts +1 -1
  112. package/dist/contracts/chain-probe.mjs +1 -1
  113. package/dist/contracts/chain-probe.mjs.map +1 -1
  114. package/dist/contracts/codegenable.d.mts +60 -6
  115. package/dist/contracts/codegenable.mjs +28 -0
  116. package/dist/contracts/codegenable.mjs.map +1 -0
  117. package/dist/contracts/config-bindings.mjs +162 -0
  118. package/dist/contracts/config-bindings.mjs.map +1 -0
  119. package/dist/contracts/container-runtime.d.mts +23 -17
  120. package/dist/contracts/plugin-expander.mjs.map +1 -1
  121. package/dist/contracts/snapshotable.d.mts +5 -7
  122. package/dist/contracts/wallet-protocol.d.mts +2 -5
  123. package/dist/contracts/wallet-protocol.mjs +2 -5
  124. package/dist/contracts/wallet-protocol.mjs.map +1 -1
  125. package/dist/index.d.mts +21 -26
  126. package/dist/index.mjs +8 -9
  127. package/dist/orchestrators/boot.d.mts +28 -0
  128. package/dist/orchestrators/boot.mjs +440 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -32
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +286 -58
  151. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  152. package/dist/orchestrators/layers.mjs +31 -0
  153. package/dist/orchestrators/layers.mjs.map +1 -0
  154. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
  155. package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
  156. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
  157. package/dist/orchestrators/network-options.d.mts +52 -0
  158. package/dist/orchestrators/network-options.mjs +43 -0
  159. package/dist/orchestrators/network-options.mjs.map +1 -0
  160. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  161. package/dist/orchestrators/router/cors.mjs.map +1 -1
  162. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  163. package/dist/orchestrators/router/errors.mjs.map +1 -1
  164. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  165. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  166. package/dist/orchestrators/router/profile.mjs +1 -1
  167. package/dist/orchestrators/router/profile.mjs.map +1 -1
  168. package/dist/orchestrators/router/service.d.mts +2 -2
  169. package/dist/orchestrators/router/service.mjs +12 -27
  170. package/dist/orchestrators/router/service.mjs.map +1 -1
  171. package/dist/orchestrators/router/traefik-container.mjs +1 -1
  172. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  173. package/dist/orchestrators/snapshot/capture.mjs +171 -195
  174. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  175. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
  176. package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
  177. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  178. package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
  179. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
  180. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
  181. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
  182. package/dist/orchestrators/snapshot/index.mjs +1 -4
  183. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  184. package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
  185. package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
  186. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
  187. package/dist/orchestrators/snapshot/prune.mjs +40 -31
  188. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  189. package/dist/orchestrators/snapshot/restore.mjs +221 -196
  190. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  191. package/dist/orchestrators/snapshot/service.mjs +72 -62
  192. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  193. package/dist/orchestrators/snapshot/wipe.mjs +67 -56
  194. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  195. package/dist/plugins/account/codegen.mjs +3 -0
  196. package/dist/plugins/account/codegen.mjs.map +1 -1
  197. package/dist/plugins/account/errors.d.mts +2 -2
  198. package/dist/plugins/account/errors.mjs +1 -4
  199. package/dist/plugins/account/errors.mjs.map +1 -1
  200. package/dist/plugins/account/funding.mjs +3 -27
  201. package/dist/plugins/account/funding.mjs.map +1 -1
  202. package/dist/plugins/account/index.d.mts +3 -8
  203. package/dist/plugins/account/index.mjs +71 -35
  204. package/dist/plugins/account/index.mjs.map +1 -1
  205. package/dist/plugins/account/keypair.d.mts +8 -7
  206. package/dist/plugins/account/keypair.mjs +5 -18
  207. package/dist/plugins/account/keypair.mjs.map +1 -1
  208. package/dist/plugins/account/lease.mjs.map +1 -1
  209. package/dist/plugins/account/registry.d.mts +1 -46
  210. package/dist/plugins/account/registry.mjs.map +1 -1
  211. package/dist/plugins/account/service.d.mts +43 -34
  212. package/dist/plugins/account/service.mjs +9 -54
  213. package/dist/plugins/account/service.mjs.map +1 -1
  214. package/dist/plugins/account/snapshot.mjs.map +1 -1
  215. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
  216. package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
  217. package/dist/plugins/account/variants/signer.mjs.map +1 -1
  218. package/dist/plugins/action/discriminator.mjs.map +1 -1
  219. package/dist/plugins/action/errors.mjs +1 -4
  220. package/dist/plugins/action/errors.mjs.map +1 -1
  221. package/dist/plugins/action/execute.mjs +3 -4
  222. package/dist/plugins/action/execute.mjs.map +1 -1
  223. package/dist/plugins/action/index.d.mts +2 -2
  224. package/dist/plugins/action/index.mjs +7 -11
  225. package/dist/plugins/action/index.mjs.map +1 -1
  226. package/dist/plugins/action/service.d.mts +5 -7
  227. package/dist/plugins/action/service.mjs +2 -16
  228. package/dist/plugins/action/service.mjs.map +1 -1
  229. package/dist/plugins/coin/address-resolution.mjs.map +1 -1
  230. package/dist/plugins/coin/codegen.mjs +97 -16
  231. package/dist/plugins/coin/codegen.mjs.map +1 -1
  232. package/dist/plugins/coin/discovery.mjs.map +1 -1
  233. package/dist/plugins/coin/errors.mjs +1 -4
  234. package/dist/plugins/coin/errors.mjs.map +1 -1
  235. package/dist/plugins/coin/index.d.mts +4 -34
  236. package/dist/plugins/coin/index.mjs +47 -28
  237. package/dist/plugins/coin/index.mjs.map +1 -1
  238. package/dist/plugins/coin/metadata.d.mts +1 -0
  239. package/dist/plugins/coin/metadata.mjs +8 -9
  240. package/dist/plugins/coin/metadata.mjs.map +1 -1
  241. package/dist/plugins/coin/mint.mjs +7 -21
  242. package/dist/plugins/coin/mint.mjs.map +1 -1
  243. package/dist/plugins/coin/registry.mjs +33 -20
  244. package/dist/plugins/coin/registry.mjs.map +1 -1
  245. package/dist/plugins/coin/service.d.mts +1 -1
  246. package/dist/plugins/coin/service.mjs +1 -8
  247. package/dist/plugins/coin/service.mjs.map +1 -1
  248. package/dist/plugins/coin/snapshot.mjs.map +1 -1
  249. package/dist/plugins/coin/type-strings.mjs.map +1 -1
  250. package/dist/plugins/dashboard/domain.mjs +106 -167
  251. package/dist/plugins/dashboard/domain.mjs.map +1 -1
  252. package/dist/plugins/dashboard/index.mjs +13 -13
  253. package/dist/plugins/dashboard/index.mjs.map +1 -1
  254. package/dist/plugins/dashboard/origin-policy.mjs +3 -3
  255. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
  256. package/dist/plugins/dashboard/routable.mjs.map +1 -1
  257. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
  258. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
  259. package/dist/plugins/dashboard/schema/root.mjs +23 -44
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +37 -91
  262. package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
  263. package/dist/plugins/dashboard/schema.mjs.map +1 -1
  264. package/dist/plugins/dashboard/server.mjs.map +1 -1
  265. package/dist/plugins/deepbook/codegen.d.mts +12 -11
  266. package/dist/plugins/deepbook/codegen.mjs +108 -11
  267. package/dist/plugins/deepbook/codegen.mjs.map +1 -1
  268. package/dist/plugins/deepbook/deploy.mjs +7 -14
  269. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  270. package/dist/plugins/deepbook/errors.mjs +4 -2
  271. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  272. package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
  273. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  274. package/dist/plugins/deepbook/hash.mjs.map +1 -1
  275. package/dist/plugins/deepbook/index.d.mts +38 -34
  276. package/dist/plugins/deepbook/index.mjs +133 -64
  277. package/dist/plugins/deepbook/index.mjs.map +1 -1
  278. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
  279. package/dist/plugins/deepbook/pyth/index.mjs +4 -8
  280. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  281. package/dist/plugins/deepbook/snapshot.mjs +0 -1
  282. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  283. package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
  284. package/dist/plugins/deepbook/types.d.mts +2 -1
  285. package/dist/plugins/deepbook/types.mjs.map +1 -1
  286. package/dist/plugins/faucet/dispatcher.d.mts +3 -3
  287. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  288. package/dist/plugins/faucet/errors.mjs.map +1 -1
  289. package/dist/plugins/faucet/http.mjs +2 -10
  290. package/dist/plugins/faucet/http.mjs.map +1 -1
  291. package/dist/plugins/faucet/index.mjs +0 -1
  292. package/dist/plugins/faucet/index.mjs.map +1 -1
  293. package/dist/plugins/host-service/errors.d.mts +1 -3
  294. package/dist/plugins/host-service/errors.mjs +1 -2
  295. package/dist/plugins/host-service/errors.mjs.map +1 -1
  296. package/dist/plugins/host-service/index.d.mts +1 -2
  297. package/dist/plugins/host-service/index.mjs +11 -11
  298. package/dist/plugins/host-service/index.mjs.map +1 -1
  299. package/dist/plugins/host-service/routable.mjs.map +1 -1
  300. package/dist/plugins/host-service/service.mjs +13 -13
  301. package/dist/plugins/host-service/service.mjs.map +1 -1
  302. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
  303. package/dist/plugins/internal/codegen-helpers.mjs +2 -0
  304. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
  305. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
  306. package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
  307. package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
  308. package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
  309. package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
  310. package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
  311. package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
  312. package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
  313. package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
  314. package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
  315. package/dist/plugins/package/build.mjs +2 -2
  316. package/dist/plugins/package/build.mjs.map +1 -1
  317. package/dist/plugins/package/codegen.d.mts +7 -14
  318. package/dist/plugins/package/codegen.mjs +187 -59
  319. package/dist/plugins/package/codegen.mjs.map +1 -1
  320. package/dist/plugins/package/dep-resolution.mjs +51 -3
  321. package/dist/plugins/package/dep-resolution.mjs.map +1 -1
  322. package/dist/plugins/package/errors.mjs +1 -4
  323. package/dist/plugins/package/errors.mjs.map +1 -1
  324. package/dist/plugins/package/git-source.d.mts +18 -0
  325. package/dist/plugins/package/git-source.mjs +119 -0
  326. package/dist/plugins/package/git-source.mjs.map +1 -0
  327. package/dist/plugins/package/index.d.mts +28 -19
  328. package/dist/plugins/package/index.mjs +107 -32
  329. package/dist/plugins/package/index.mjs.map +1 -1
  330. package/dist/plugins/package/mode-known.mjs +2 -2
  331. package/dist/plugins/package/mode-known.mjs.map +1 -1
  332. package/dist/plugins/package/mode-local.mjs +18 -35
  333. package/dist/plugins/package/mode-local.mjs.map +1 -1
  334. package/dist/plugins/package/publish-executor.mjs +13 -8
  335. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  336. package/dist/plugins/package/publish-output.d.mts +1 -11
  337. package/dist/plugins/package/publish-output.mjs +1 -9
  338. package/dist/plugins/package/publish-output.mjs.map +1 -1
  339. package/dist/plugins/package/registry.d.mts +1 -1
  340. package/dist/plugins/package/registry.mjs +26 -14
  341. package/dist/plugins/package/registry.mjs.map +1 -1
  342. package/dist/plugins/package/service.mjs.map +1 -1
  343. package/dist/plugins/package/snapshot.mjs.map +1 -1
  344. package/dist/plugins/router-entrypoints.mjs +1 -3
  345. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  346. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
  347. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  348. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
  349. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  350. package/dist/plugins/seal/codegen.d.mts +1 -5
  351. package/dist/plugins/seal/codegen.mjs +83 -12
  352. package/dist/plugins/seal/codegen.mjs.map +1 -1
  353. package/dist/plugins/seal/config-render.mjs +2 -6
  354. package/dist/plugins/seal/config-render.mjs.map +1 -1
  355. package/dist/plugins/seal/deploy.mjs +18 -29
  356. package/dist/plugins/seal/deploy.mjs.map +1 -1
  357. package/dist/plugins/seal/errors.d.mts +4 -5
  358. package/dist/plugins/seal/errors.mjs +1 -8
  359. package/dist/plugins/seal/errors.mjs.map +1 -1
  360. package/dist/plugins/seal/index.d.mts +7 -28
  361. package/dist/plugins/seal/index.mjs +69 -47
  362. package/dist/plugins/seal/index.mjs.map +1 -1
  363. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  364. package/dist/plugins/seal/key-server.mjs +1 -6
  365. package/dist/plugins/seal/key-server.mjs.map +1 -1
  366. package/dist/plugins/seal/keygen.mjs +2 -3
  367. package/dist/plugins/seal/keygen.mjs.map +1 -1
  368. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  369. package/dist/plugins/seal/mode/live.mjs +1 -1
  370. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  371. package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
  372. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  373. package/dist/plugins/seal/plugin-key.mjs.map +1 -1
  374. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  375. package/dist/plugins/seal/routable.mjs.map +1 -1
  376. package/dist/plugins/seal/service.mjs.map +1 -1
  377. package/dist/plugins/seal/snapshot.mjs +1 -2
  378. package/dist/plugins/seal/snapshot.mjs.map +1 -1
  379. package/dist/plugins/sui/auto-tick.mjs +5 -5
  380. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  381. package/dist/plugins/sui/chain-build-container.mjs +2 -2
  382. package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
  383. package/dist/plugins/sui/chain-probe.mjs +4 -4
  384. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  385. package/dist/plugins/sui/codegen.d.mts +9 -7
  386. package/dist/plugins/sui/codegen.mjs +49 -46
  387. package/dist/plugins/sui/codegen.mjs.map +1 -1
  388. package/dist/plugins/sui/errors.d.mts +1 -1
  389. package/dist/plugins/sui/errors.mjs +1 -9
  390. package/dist/plugins/sui/errors.mjs.map +1 -1
  391. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
  392. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
  393. package/dist/plugins/sui/exec/index.mjs.map +1 -0
  394. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
  395. package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
  396. package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
  397. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
  398. package/dist/plugins/sui/fork-orchestration.mjs +13 -23
  399. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  400. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  401. package/dist/plugins/sui/index.d.mts +34 -83
  402. package/dist/plugins/sui/index.mjs +200 -68
  403. package/dist/plugins/sui/index.mjs.map +1 -1
  404. package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
  405. package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
  406. package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
  407. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
  408. package/dist/plugins/sui/log-attrs.mjs +11 -0
  409. package/dist/plugins/sui/log-attrs.mjs.map +1 -0
  410. package/dist/plugins/sui/mode/external.mjs +4 -12
  411. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  412. package/dist/plugins/sui/mode/fork.mjs +19 -16
  413. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  414. package/dist/plugins/sui/mode/live.mjs +4 -17
  415. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  416. package/dist/plugins/sui/mode/local.d.mts +1 -0
  417. package/dist/plugins/sui/mode/local.mjs +203 -61
  418. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  419. package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
  420. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  421. package/dist/plugins/sui/mode/shared.d.mts +6 -7
  422. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  423. package/dist/plugins/sui/mode/spec.d.mts +23 -6
  424. package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
  425. package/dist/plugins/sui/move/index.mjs.map +1 -0
  426. package/dist/plugins/sui/move-summary-runner.mjs +8 -4
  427. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
  428. package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
  429. package/dist/plugins/sui/network-resolver.d.mts +6 -6
  430. package/dist/plugins/sui/routable.mjs.map +1 -1
  431. package/dist/plugins/sui/service.mjs +10 -6
  432. package/dist/plugins/sui/service.mjs.map +1 -1
  433. package/dist/plugins/sui/snapshot.mjs +10 -5
  434. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  435. package/dist/plugins/wallet/codegen.d.mts +8 -6
  436. package/dist/plugins/wallet/codegen.mjs +4 -10
  437. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  438. package/dist/plugins/wallet/errors.mjs +1 -4
  439. package/dist/plugins/wallet/errors.mjs.map +1 -1
  440. package/dist/plugins/wallet/index.d.mts +3 -6
  441. package/dist/plugins/wallet/index.mjs +16 -21
  442. package/dist/plugins/wallet/index.mjs.map +1 -1
  443. package/dist/plugins/wallet/origin-policy.mjs +3 -3
  444. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  445. package/dist/plugins/wallet/pairing.mjs +6 -24
  446. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  447. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  448. package/dist/plugins/wallet/routable.mjs.map +1 -1
  449. package/dist/plugins/wallet/server.mjs +17 -24
  450. package/dist/plugins/wallet/server.mjs.map +1 -1
  451. package/dist/plugins/wallet/service.d.mts +2 -2
  452. package/dist/plugins/wallet/service.mjs +4 -15
  453. package/dist/plugins/wallet/service.mjs.map +1 -1
  454. package/dist/plugins/wallet/snapshot.mjs.map +1 -1
  455. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
  456. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  457. package/dist/plugins/walrus/codegen.d.mts +2 -13
  458. package/dist/plugins/walrus/codegen.mjs +93 -28
  459. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  460. package/dist/plugins/walrus/deploy-paths.mjs +2 -3
  461. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  462. package/dist/plugins/walrus/deploy.mjs +26 -19
  463. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  464. package/dist/plugins/walrus/errors.mjs +1 -8
  465. package/dist/plugins/walrus/errors.mjs.map +1 -1
  466. package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
  467. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  468. package/dist/plugins/walrus/index.d.mts +13 -44
  469. package/dist/plugins/walrus/index.mjs +119 -122
  470. package/dist/plugins/walrus/index.mjs.map +1 -1
  471. package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
  472. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  473. package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
  474. package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
  475. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  476. package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
  477. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  478. package/dist/plugins/walrus/routable.mjs.map +1 -1
  479. package/dist/plugins/walrus/service.mjs.map +1 -1
  480. package/dist/plugins/walrus/snapshot.mjs +3 -3
  481. package/dist/plugins/walrus/snapshot.mjs.map +1 -1
  482. package/dist/plugins/walrus/storage-nodes.mjs +53 -14
  483. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  484. package/dist/plugins/walrus/wal-swap.mjs +4 -8
  485. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  486. package/dist/primitives/artifact-publisher.mjs.map +1 -1
  487. package/dist/primitives/cache.d.mts +1 -1
  488. package/dist/runtime/docker/client.mjs +47 -3
  489. package/dist/runtime/docker/client.mjs.map +1 -1
  490. package/dist/runtime/docker/container.mjs +37 -57
  491. package/dist/runtime/docker/container.mjs.map +1 -1
  492. package/dist/runtime/docker/errors.mjs.map +1 -1
  493. package/dist/runtime/docker/exec.mjs +2 -2
  494. package/dist/runtime/docker/exec.mjs.map +1 -1
  495. package/dist/runtime/docker/image.mjs +10 -11
  496. package/dist/runtime/docker/image.mjs.map +1 -1
  497. package/dist/runtime/docker/index.mjs +0 -1
  498. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
  499. package/dist/runtime/docker/inventory.mjs +9 -9
  500. package/dist/runtime/docker/inventory.mjs.map +1 -1
  501. package/dist/runtime/docker/labels.mjs +12 -1
  502. package/dist/runtime/docker/labels.mjs.map +1 -1
  503. package/dist/runtime/docker/network.mjs +6 -6
  504. package/dist/runtime/docker/network.mjs.map +1 -1
  505. package/dist/runtime/docker/render-run-args.mjs.map +1 -1
  506. package/dist/runtime/docker/service.mjs +31 -45
  507. package/dist/runtime/docker/service.mjs.map +1 -1
  508. package/dist/runtime/docker/sweep.mjs +14 -64
  509. package/dist/runtime/docker/sweep.mjs.map +1 -1
  510. package/dist/runtime/docker/volume.mjs +1 -1
  511. package/dist/runtime/docker/volume.mjs.map +1 -1
  512. package/dist/runtime/docker/wrap.mjs +14 -2
  513. package/dist/runtime/docker/wrap.mjs.map +1 -1
  514. package/dist/substrate/brand.d.mts +2 -5
  515. package/dist/substrate/brand.mjs +3 -2
  516. package/dist/substrate/brand.mjs.map +1 -1
  517. package/dist/substrate/cross-process.mjs +2 -16
  518. package/dist/substrate/cross-process.mjs.map +1 -1
  519. package/dist/substrate/event-time.mjs +0 -2
  520. package/dist/substrate/event-time.mjs.map +1 -1
  521. package/dist/substrate/events.d.mts +46 -16
  522. package/dist/substrate/identity.d.mts +11 -5
  523. package/dist/substrate/manifest.d.mts +33 -26
  524. package/dist/substrate/manifest.mjs +8 -3
  525. package/dist/substrate/manifest.mjs.map +1 -1
  526. package/dist/substrate/options.d.mts +33 -4
  527. package/dist/substrate/plugin-ctx.d.mts +70 -0
  528. package/dist/substrate/plugin-ctx.mjs +66 -0
  529. package/dist/substrate/plugin-ctx.mjs.map +1 -0
  530. package/dist/substrate/plugin.d.mts +46 -38
  531. package/dist/substrate/plugin.mjs +13 -9
  532. package/dist/substrate/plugin.mjs.map +1 -1
  533. package/dist/substrate/projection.d.mts +1 -1
  534. package/dist/substrate/runtime/atomic-write.mjs +3 -4
  535. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  536. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  537. package/dist/substrate/runtime/cache/service.mjs +50 -20
  538. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  539. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  540. package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
  541. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
  542. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
  543. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
  544. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  545. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  546. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  547. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -1
  548. package/dist/substrate/runtime/cross-process/index.mjs +0 -2
  549. package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
  550. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
  551. package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
  552. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  553. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
  554. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
  555. package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
  556. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  557. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
  558. package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
  559. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  560. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  561. package/dist/substrate/runtime/errors.mjs +1 -13
  562. package/dist/substrate/runtime/errors.mjs.map +1 -1
  563. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
  564. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
  565. package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
  566. package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
  567. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  568. package/dist/substrate/runtime/http-probe.d.mts +1 -3
  569. package/dist/substrate/runtime/http-probe.mjs.map +1 -1
  570. package/dist/substrate/runtime/index.mjs +1 -6
  571. package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
  572. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  573. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
  574. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  575. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  576. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  578. package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
  579. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  580. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  582. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  583. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  585. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  587. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  589. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  590. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  592. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  593. package/dist/substrate/runtime/managed-container.mjs +8 -10
  594. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  595. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  596. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  597. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  598. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  599. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  600. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  602. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  603. package/dist/substrate/runtime/observability/index.mjs +4 -6
  604. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  605. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  606. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  607. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  608. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  610. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  614. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  615. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  616. package/dist/substrate/runtime/paths.mjs +27 -9
  617. package/dist/substrate/runtime/paths.mjs.map +1 -1
  618. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  619. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  620. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  621. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  622. package/dist/substrate/runtime/probes.d.mts +2 -3
  623. package/dist/substrate/runtime/probes.mjs.map +1 -1
  624. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  625. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  626. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/update.mjs +87 -11
  628. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  629. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  630. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  631. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  632. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  633. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  635. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  636. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  637. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  638. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  639. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  640. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  641. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  642. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  643. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  644. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  645. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  646. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  647. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  649. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  650. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  651. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  652. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  654. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  656. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  658. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  659. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  660. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  661. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  662. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  663. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
  665. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  666. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  667. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  668. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  670. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  671. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  672. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  673. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  674. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  675. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  676. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  677. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  678. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  679. package/dist/surfaces/cli/command-tree.mjs +49 -7
  680. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  681. package/dist/surfaces/cli/commands/config.mjs +1 -1
  682. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  683. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  685. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  686. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  689. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  690. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  692. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  693. package/dist/surfaces/cli/commands/status.mjs +1 -1
  694. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  695. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  697. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  698. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  699. package/dist/surfaces/cli/errors.mjs.map +1 -1
  700. package/dist/surfaces/cli/flags.mjs.map +1 -1
  701. package/dist/surfaces/cli/index.mjs +45 -14
  702. package/dist/surfaces/cli/index.mjs.map +1 -1
  703. package/dist/surfaces/cli/output.mjs.map +1 -1
  704. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  705. package/dist/surfaces/tui/app.mjs +0 -21
  706. package/dist/surfaces/tui/app.mjs.map +1 -1
  707. package/dist/surfaces/tui/dashboard.mjs +0 -48
  708. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  709. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  710. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  711. package/dist/surfaces/tui/errors.mjs.map +1 -1
  712. package/dist/surfaces/tui/event-log.mjs +0 -9
  713. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  714. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  715. package/dist/surfaces/tui/index.mjs +2 -2
  716. package/dist/surfaces/tui/index.mjs.map +1 -1
  717. package/dist/surfaces/tui/input.mjs.map +1 -1
  718. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  719. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  720. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  721. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  722. package/dist/surfaces/tui/resource-table.mjs +8 -10
  723. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  724. package/images/postgres/Dockerfile +0 -1
  725. package/images/sui/Dockerfile +27 -54
  726. package/images/sui/entrypoint.sh +17 -179
  727. package/package.json +23 -15
  728. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  729. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  730. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  731. package/dist/api/plugin-errors.d.mts +0 -7
  732. package/dist/api/plugin-errors.mjs +0 -10
  733. package/dist/api/plugin-errors.mjs.map +0 -1
  734. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  735. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  736. package/dist/contracts/capability-decl.d.mts +0 -40
  737. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  738. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  739. package/dist/orchestrators/run.mjs +0 -91
  740. package/dist/orchestrators/run.mjs.map +0 -1
  741. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  742. package/dist/orchestrators/runtime-composition.mjs +0 -252
  743. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  744. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  745. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  746. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  748. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  749. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  750. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  751. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  752. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  753. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  754. package/dist/plugins/account/spans.mjs +0 -16
  755. package/dist/plugins/account/spans.mjs.map +0 -1
  756. package/dist/plugins/account/variants/env.mjs +0 -24
  757. package/dist/plugins/account/variants/env.mjs.map +0 -1
  758. package/dist/plugins/account/variants/inline.mjs +0 -13
  759. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  760. package/dist/plugins/account/variants/keystore.mjs +0 -91
  761. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  762. package/dist/plugins/action/spans.mjs +0 -11
  763. package/dist/plugins/action/spans.mjs.map +0 -1
  764. package/dist/plugins/coin/spans.mjs +0 -20
  765. package/dist/plugins/coin/spans.mjs.map +0 -1
  766. package/dist/plugins/deepbook/spans.mjs +0 -18
  767. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  768. package/dist/plugins/faucet/spans.mjs +0 -12
  769. package/dist/plugins/faucet/spans.mjs.map +0 -1
  770. package/dist/plugins/package/spans.mjs +0 -14
  771. package/dist/plugins/package/spans.mjs.map +0 -1
  772. package/dist/plugins/postgres/codegen.mjs +0 -42
  773. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  774. package/dist/plugins/postgres/connection.d.mts +0 -33
  775. package/dist/plugins/postgres/connection.mjs.map +0 -1
  776. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  777. package/dist/plugins/postgres/errors.d.mts +0 -60
  778. package/dist/plugins/postgres/errors.mjs +0 -29
  779. package/dist/plugins/postgres/errors.mjs.map +0 -1
  780. package/dist/plugins/postgres/index.d.mts +0 -37
  781. package/dist/plugins/postgres/index.mjs +0 -68
  782. package/dist/plugins/postgres/index.mjs.map +0 -1
  783. package/dist/plugins/postgres/routable.mjs +0 -33
  784. package/dist/plugins/postgres/routable.mjs.map +0 -1
  785. package/dist/plugins/postgres/service.d.mts +0 -50
  786. package/dist/plugins/postgres/service.mjs +0 -179
  787. package/dist/plugins/postgres/service.mjs.map +0 -1
  788. package/dist/plugins/postgres/snapshot.mjs +0 -32
  789. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  790. package/dist/plugins/postgres/spans.mjs +0 -11
  791. package/dist/plugins/postgres/spans.mjs.map +0 -1
  792. package/dist/plugins/seal/spans.mjs +0 -18
  793. package/dist/plugins/seal/spans.mjs.map +0 -1
  794. package/dist/plugins/sui/spans.mjs +0 -17
  795. package/dist/plugins/sui/spans.mjs.map +0 -1
  796. package/dist/plugins/wallet/spans.mjs +0 -22
  797. package/dist/plugins/wallet/spans.mjs.map +0 -1
  798. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  799. package/dist/plugins/walrus/spans.mjs +0 -18
  800. package/dist/plugins/walrus/spans.mjs.map +0 -1
  801. package/dist/runtime/docker/logs.d.mts +0 -1
  802. package/dist/runtime/docker/logs.mjs +0 -34
  803. package/dist/runtime/docker/logs.mjs.map +0 -1
  804. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  805. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  806. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  807. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  808. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  809. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  810. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  811. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  812. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  813. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  814. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  815. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  816. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  818. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  819. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  820. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  821. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  822. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  823. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  826. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  829. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  830. package/dist/substrate/runtime/projection/index.mjs +0 -4
  831. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  832. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  833. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  834. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  835. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  836. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  837. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  839. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  840. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  841. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  842. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  844. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  845. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  846. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  847. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  850. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  851. package/dist/substrate/state-store.d.mts +0 -1
  852. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  853. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  854. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  855. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  856. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  857. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
  858. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"env.mjs","names":[],"sources":["../../../src/build-integrations/vitest/env.ts"],"sourcesContent":["// Vitest build-integration — env-var contract.\n//\n// Architecture (distilled/23-build-integrations.md § Inputs /\n// dependencies, distilled/24-examples.md § Lifecycle / invocation\n// patterns): test runs MUST set `DEVSTACK_STACK=test` so they don't\n// contend with a parallel `pnpm dev` on the `main` stack. The\n// supervisor's port allocator + manifest discovery key off this var\n// to keep two stacks coexisting.\n//\n// `DEVSTACK_RUNTIME_ROOT` is the optional override for the on-disk\n// state root that contains `stacks/<stack>/manifest.json`. It maps to\n// the legacy `DEVSTACK_STATE_DIR` env var; both names are accepted on\n// read so the rewrite can roll out without coordinated env-var\n// renames across every example app.\n//\n// `DEVSTACK_MANIFEST_PATH` is the top-of-the-precedence-ladder escape\n// hatch the engine writes; build integrations also honor it. Listed\n// here for completeness — the typical vitest run does not set it.\n//\n// NOTE: this module is a pure declaration of names + defaults. No env\n// reads happen at module import time; readers fetch on demand so\n// tests can stub `process.env` per-case.\n\nimport { DEFAULT_DISCOVERY_STACK } from '../runtime/resolve-discovery-env.ts';\n\n// -----------------------------------------------------------------------------\n// Canonical env-var names\n// -----------------------------------------------------------------------------\n\n/** Env-var names the vitest integration consults. Centralized so\n * test-setup printouts can name the var the caller forgot to set. */\nexport const VITEST_ENV_VARS = {\n\t/** Stack name; the canonical signal for \"isolate this test run\n\t * from other stacks\". Tests SHOULD set this to `'test'`. */\n\tSTACK: 'DEVSTACK_STACK',\n\t/** Override for the runtime root that holds\n\t * `stacks/<stack>/manifest.json`. Defaults to `.devstack`. */\n\tRUNTIME_ROOT: 'DEVSTACK_RUNTIME_ROOT',\n\t/** Legacy alias for `RUNTIME_ROOT`. Accepted on read so the\n\t * rewrite can coexist with example apps that still set the\n\t * pre-rewrite name. New callers should use `RUNTIME_ROOT`. */\n\tRUNTIME_ROOT_LEGACY: 'DEVSTACK_STATE_DIR',\n\t/** Top-precedence absolute path to a specific manifest file. The\n\t * engine sets this when it spawns child processes; rarely set\n\t * by hand. */\n\tMANIFEST_PATH: 'DEVSTACK_MANIFEST_PATH',\n} as const;\n\nexport type VitestEnvVarName = (typeof VITEST_ENV_VARS)[keyof typeof VITEST_ENV_VARS];\n\n// -----------------------------------------------------------------------------\n// Defaults\n// -----------------------------------------------------------------------------\n\n/** Default stack name when `DEVSTACK_STACK` is unset. Re-exported from\n * the discovery ladder's `DEFAULT_DISCOVERY_STACK` (single source of\n * truth) — but tests should explicitly set `DEVSTACK_STACK=test`\n * rather than rely on this. */\nexport const DEFAULT_STACK_NAME = DEFAULT_DISCOVERY_STACK;\n\n/** Default runtime root when neither `DEVSTACK_RUNTIME_ROOT` nor the\n * legacy `DEVSTACK_STATE_DIR` is set. */\nexport const DEFAULT_RUNTIME_ROOT = '.devstack';\n\n/** The recommended stack name for test runs — the value the\n * `test`-script env should set. Exported as a constant so example\n * apps' `package.json` can wire it from one symbol if a future\n * scaffolder lands. */\nexport const RECOMMENDED_TEST_STACK = 'test';\n\n// -----------------------------------------------------------------------------\n// Pure resolvers — no module-init side effects\n// -----------------------------------------------------------------------------\n\nexport interface ResolvedVitestEnv {\n\treadonly stack: string;\n\treadonly runtimeRoot: string;\n\treadonly manifestPathOverride: string | undefined;\n\t/** True when the caller's env explicitly set `DEVSTACK_STACK`. The\n\t * test-setup hook uses this to print a louder advisory when a\n\t * user runs `pnpm test` without the recommended wiring. */\n\treadonly stackWasExplicit: boolean;\n}\n\n/** Resolve the vitest env contract from an arbitrary env bag.\n * Side-effect free — tests pass a fixture; production code passes\n * `process.env`. */\nexport const resolveVitestEnv = (\n\tenv: Readonly<Record<string, string | undefined>>,\n): ResolvedVitestEnv => {\n\tconst stackRaw = env[VITEST_ENV_VARS.STACK];\n\tconst stack = stackRaw !== undefined && stackRaw !== '' ? stackRaw : DEFAULT_STACK_NAME;\n\tconst runtimeRoot =\n\t\tenv[VITEST_ENV_VARS.RUNTIME_ROOT] ??\n\t\tenv[VITEST_ENV_VARS.RUNTIME_ROOT_LEGACY] ??\n\t\tDEFAULT_RUNTIME_ROOT;\n\tconst manifestPathOverride = env[VITEST_ENV_VARS.MANIFEST_PATH];\n\treturn {\n\t\tstack,\n\t\truntimeRoot: runtimeRoot === '' ? DEFAULT_RUNTIME_ROOT : runtimeRoot,\n\t\tmanifestPathOverride:\n\t\t\tmanifestPathOverride !== undefined && manifestPathOverride !== ''\n\t\t\t\t? manifestPathOverride\n\t\t\t\t: undefined,\n\t\tstackWasExplicit: stackRaw !== undefined && stackRaw !== '',\n\t};\n};\n"],"mappings":";;;;AA+BA,MAAa,kBAAkB;;;CAG9B,OAAO;;;CAGP,cAAc;;;;CAId,qBAAqB;;;;CAIrB,eAAe;CACf;;;;;AAYD,MAAa,qBAAqB;;;AAIlC,MAAa,uBAAuB;;;;;AAMpC,MAAa,yBAAyB;;;;AAmBtC,MAAa,oBACZ,QACuB;CACvB,MAAM,WAAW,IAAI,gBAAgB;CACrC,MAAM,QAAQ,aAAa,KAAA,KAAa,aAAa,KAAK,WAAW;CACrE,MAAM,cACL,IAAI,gBAAgB,iBACpB,IAAI,gBAAgB,wBAAA;CAErB,MAAM,uBAAuB,IAAI,gBAAgB;AACjD,QAAO;EACN;EACA,aAAa,gBAAgB,KAAK,uBAAuB;EACzD,sBACC,yBAAyB,KAAA,KAAa,yBAAyB,KAC5D,uBACA,KAAA;EACJ,kBAAkB,aAAa,KAAA,KAAa,aAAa;EACzD"}
1
+ {"version":3,"file":"env.mjs","names":[],"sources":["../../../src/build-integrations/vitest/env.ts"],"sourcesContent":["// Vitest build-integration — env-var contract.\n//\n// Architecture (distilled/23-build-integrations.md § Inputs /\n// dependencies, distilled/24-examples.md § Lifecycle / invocation\n// patterns): test runs MUST set `DEVSTACK_STACK=test` so they don't\n// contend with a parallel `pnpm dev` on the `main` stack. The\n// supervisor's port allocator + manifest discovery key off this var\n// to keep two stacks coexisting.\n//\n// `DEVSTACK_RUNTIME_ROOT` is the optional override for the on-disk\n// state root that contains `stacks/<stack>/manifest.json`.\n//\n// `DEVSTACK_MANIFEST_PATH` is the top-of-the-precedence-ladder escape\n// hatch the engine writes; build integrations also honor it. Listed\n// here for completeness — the typical vitest run does not set it.\n//\n// NOTE: this module is a pure declaration of names + defaults. No env\n// reads happen at module import time; readers fetch on demand so\n// tests can stub `process.env` per-case.\n\nimport { inferPackageNameFromCwd } from '../../api/inference-network.ts';\nimport { DEFAULT_DISCOVERY_STACK } from '../runtime/resolve-discovery-env.ts';\n\n// -----------------------------------------------------------------------------\n// Canonical env-var names\n// -----------------------------------------------------------------------------\n\n/** Env-var names the vitest integration consults. Centralized so\n * test-setup printouts can name the var the caller forgot to set. */\nexport const VITEST_ENV_VARS = {\n\t/** Stack name; the canonical signal for \"isolate this test run\n\t * from other stacks\". Tests SHOULD set this to `'test'`. */\n\tSTACK: 'DEVSTACK_STACK',\n\t/** Override for the runtime root that holds\n\t * `stacks/<stack>/manifest.json`. Defaults to `.devstack`. */\n\tRUNTIME_ROOT: 'DEVSTACK_RUNTIME_ROOT',\n\t/** Alias for `RUNTIME_ROOT`. New callers should use `RUNTIME_ROOT`. */\n\tRUNTIME_ROOT_LEGACY: 'DEVSTACK_STATE_DIR',\n\t/** Top-precedence absolute path to a specific manifest file. The\n\t * engine sets this when it spawns child processes; rarely set\n\t * by hand. */\n\tMANIFEST_PATH: 'DEVSTACK_MANIFEST_PATH',\n} as const;\n\nexport type VitestEnvVarName = (typeof VITEST_ENV_VARS)[keyof typeof VITEST_ENV_VARS];\n\n// -----------------------------------------------------------------------------\n// Defaults\n// -----------------------------------------------------------------------------\n\n/** Default stack name when `DEVSTACK_STACK` is unset. Re-exported from\n * the discovery ladder's `DEFAULT_DISCOVERY_STACK` (single source of\n * truth) — but tests should explicitly set `DEVSTACK_STACK=test`\n * rather than rely on this. */\nexport const DEFAULT_STACK_NAME = DEFAULT_DISCOVERY_STACK;\n\n/** Default runtime root when no runtime-root override is set. */\nexport const DEFAULT_RUNTIME_ROOT = '.devstack';\n\n/** The recommended stack name for test runs — the value the\n * `test`-script env should set. Exported as a constant so example\n * apps' `package.json` can wire it from one symbol if a future\n * scaffolder lands. */\nexport const RECOMMENDED_TEST_STACK = 'test';\n\n// -----------------------------------------------------------------------------\n// Pure resolvers — no module-init side effects\n// -----------------------------------------------------------------------------\n\nexport interface ResolvedVitestEnv {\n\treadonly stack: string;\n\treadonly runtimeRoot: string;\n\treadonly manifestPathOverride: string | undefined;\n\t/** True when the caller's env explicitly set `DEVSTACK_STACK`. The\n\t * test-setup hook uses this to print a louder advisory when a\n\t * user runs `pnpm test` without the recommended wiring. */\n\treadonly stackWasExplicit: boolean;\n}\n\nexport interface ResolveVitestEnvOptions {\n\t/** Walk-up start for the package-name rung of the stack ladder,\n\t * mirroring `resolveDiscoveryEnv` / the CLI's `resolveStackName`:\n\t * when `DEVSTACK_STACK` is unset, the stack falls back to the\n\t * nearest package.json `name` above `cwd` before `'main'`. Opt-in —\n\t * omit it and the resolver stays fs-free with the bare\n\t * env > `'main'` ladder. The setup hook threads it so the advisory\n\t * names the stack `loadStackContext` will actually read. */\n\treadonly cwd?: string;\n}\n\n/** Resolve the vitest env contract from an arbitrary env bag.\n * Side-effect free when `options.cwd` is omitted — tests pass a\n * fixture; production code passes `process.env`. With `cwd`, the only\n * fs access is the lazy package.json walk-up on the stack rung, and\n * only when `DEVSTACK_STACK` is unset. */\nexport const resolveVitestEnv = (\n\tenv: Readonly<Record<string, string | undefined>>,\n\toptions: ResolveVitestEnvOptions = {},\n): ResolvedVitestEnv => {\n\tconst stackRaw = env[VITEST_ENV_VARS.STACK];\n\tconst stackWasExplicit = stackRaw !== undefined && stackRaw !== '';\n\tconst stack = stackWasExplicit\n\t\t? stackRaw\n\t\t: ((options.cwd !== undefined ? inferPackageNameFromCwd(options.cwd) : undefined) ??\n\t\t\tDEFAULT_STACK_NAME);\n\tconst runtimeRoot =\n\t\tenv[VITEST_ENV_VARS.RUNTIME_ROOT] ??\n\t\tenv[VITEST_ENV_VARS.RUNTIME_ROOT_LEGACY] ??\n\t\tDEFAULT_RUNTIME_ROOT;\n\tconst manifestPathOverride = env[VITEST_ENV_VARS.MANIFEST_PATH];\n\treturn {\n\t\tstack,\n\t\truntimeRoot: runtimeRoot === '' ? DEFAULT_RUNTIME_ROOT : runtimeRoot,\n\t\tmanifestPathOverride:\n\t\t\tmanifestPathOverride !== undefined && manifestPathOverride !== ''\n\t\t\t\t? manifestPathOverride\n\t\t\t\t: undefined,\n\t\tstackWasExplicit,\n\t};\n};\n"],"mappings":";;;;;AA6BA,MAAa,kBAAkB;;;CAG9B,OAAO;;;CAGP,cAAc;;CAEd,qBAAqB;;;;CAIrB,eAAe;AAChB;;;;;AAYA,MAAa,qBAAqB;;AAGlC,MAAa,uBAAuB;;;;;AAMpC,MAAa,yBAAyB;;;;;;AAgCtC,MAAa,oBACZ,KACA,UAAmC,CAAC,MACb;CACvB,MAAM,WAAW,IAAI,gBAAgB;CACrC,MAAM,mBAAmB,aAAa,KAAA,KAAa,aAAa;CAChE,MAAM,QAAQ,mBACX,YACE,QAAQ,QAAQ,KAAA,IAAY,wBAAwB,QAAQ,GAAG,IAAI,KAAA,MACtE;CACF,MAAM,cACL,IAAI,gBAAgB,iBACpB,IAAI,gBAAgB,wBAAA;CAErB,MAAM,uBAAuB,IAAI,gBAAgB;CACjD,OAAO;EACN;EACA,aAAa,gBAAgB,KAAK,uBAAuB;EACzD,sBACC,yBAAyB,KAAA,KAAa,yBAAyB,KAC5D,uBACA,KAAA;EACJ;CACD;AACD"}
@@ -1,8 +1,5 @@
1
- import * as _$effect_Cause0 from "effect/Cause";
2
- import * as _$effect_Types0 from "effect/Types";
3
-
4
1
  //#region src/build-integrations/vitest/errors.d.ts
5
- declare const VitestManifestNotFoundError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
2
+ declare const VitestManifestNotFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
6
3
  readonly _tag: "VitestManifestNotFoundError";
7
4
  } & Readonly<A>;
8
5
  /** A test-setup hook asked for the manifest but no on-disk file was
@@ -15,7 +12,7 @@ declare class VitestManifestNotFoundError extends VitestManifestNotFoundError_ba
15
12
  readonly stateDir: string;
16
13
  readonly recovery: string;
17
14
  }> {}
18
- declare const VitestManifestShapeError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
15
+ declare const VitestManifestShapeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
19
16
  readonly _tag: "VitestManifestShapeError";
20
17
  } & Readonly<A>;
21
18
  /** The manifest exists but doesn't decode against the L0 envelope schema
@@ -25,8 +22,8 @@ declare const VitestManifestShapeError_base: new <A extends Record<string, any>
25
22
  * the "manifest looks like garbage / your envelope was wrong" recovery
26
23
  * ("regenerate the manifest"); the version-mismatch tag carries the
27
24
  * "build-integration and supervisor are at different versions"
28
- * recovery (upgrade the consumer dependency). Splitting the two lets
29
- * callers `catchTag` independently and surface a precise hint. */
25
+ * recovery. Splitting the two lets callers `catchTag`
26
+ * independently and surface a precise hint. */
30
27
  declare class VitestManifestShapeError extends VitestManifestShapeError_base<{
31
28
  readonly message: string;
32
29
  readonly path: string;
@@ -34,21 +31,20 @@ declare class VitestManifestShapeError extends VitestManifestShapeError_base<{
34
31
  readonly recovery: string;
35
32
  readonly cause?: unknown;
36
33
  }> {}
37
- declare const VitestManifestVersionMismatchError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
34
+ declare const VitestManifestVersionMismatchError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
38
35
  readonly _tag: "VitestManifestVersionMismatchError";
39
36
  } & Readonly<A>;
40
37
  /** The manifest exists, decodes structurally, but its `manifestVersion`
41
38
  * doesn't match what this consumer build was compiled for. Distinct
42
39
  * from `VitestManifestShapeError` so callers can `catchTag` the two
43
- * separately — the recovery action is "upgrade your devstack
44
- * consumer dependency" rather than "regenerate the manifest". */
40
+ * separately. */
45
41
  declare class VitestManifestVersionMismatchError extends VitestManifestVersionMismatchError_base<{
46
42
  readonly message: string;
47
43
  readonly path: string;
48
44
  readonly recovery: string;
49
45
  readonly cause?: unknown;
50
46
  }> {}
51
- declare const VitestSetupPreconditionError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
47
+ declare const VitestSetupPreconditionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
52
48
  readonly _tag: "VitestSetupPreconditionError";
53
49
  } & Readonly<A>;
54
50
  /** A test-setup precondition was violated. Currently only one case:
@@ -11,14 +11,13 @@ var VitestManifestNotFoundError = class extends Data.TaggedError("VitestManifest
11
11
  * the "manifest looks like garbage / your envelope was wrong" recovery
12
12
  * ("regenerate the manifest"); the version-mismatch tag carries the
13
13
  * "build-integration and supervisor are at different versions"
14
- * recovery (upgrade the consumer dependency). Splitting the two lets
15
- * callers `catchTag` independently and surface a precise hint. */
14
+ * recovery. Splitting the two lets callers `catchTag`
15
+ * independently and surface a precise hint. */
16
16
  var VitestManifestShapeError = class extends Data.TaggedError("VitestManifestShapeError") {};
17
17
  /** The manifest exists, decodes structurally, but its `manifestVersion`
18
18
  * doesn't match what this consumer build was compiled for. Distinct
19
19
  * from `VitestManifestShapeError` so callers can `catchTag` the two
20
- * separately — the recovery action is "upgrade your devstack
21
- * consumer dependency" rather than "regenerate the manifest". */
20
+ * separately. */
22
21
  var VitestManifestVersionMismatchError = class extends Data.TaggedError("VitestManifestVersionMismatchError") {};
23
22
  /** A test-setup precondition was violated. Currently only one case:
24
23
  * the caller asked for `requireDevstack: true` but the manifest wasn't
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build-integrations/vitest/errors.ts"],"sourcesContent":["// Vitest build-integration — typed errors.\n//\n// Architecture (distilled/23-build-integrations.md § Per-integration\n// requirements → Vitest, § Edge cases): the vitest preset is a pure\n// reader of files + env vars. The two failure modes it surfaces are\n// (a) manifest discovery failed when a test-setup hook asked for it,\n// (b) manifest exists but its shape doesn't match.\n// Both errors carry a `recovery` string so the test-setup printout is\n// actionable instead of a generic schema-decode trace.\n//\n// These tags mirror the engine's `ManifestDiscoveryError` /\n// `ManifestShapeError` (substrate-side; see `runtime/` once it lands)\n// but stay local to the vitest surface so consumers can `catchTag`\n// without importing from substrate.\n\nimport { Data } from 'effect';\n\n/** A test-setup hook asked for the manifest but no on-disk file was\n * found by the walk-up or override path. The supervisor either hasn't\n * run yet or the wrong stack/state-dir is configured. */\nexport class VitestManifestNotFoundError extends Data.TaggedError('VitestManifestNotFoundError')<{\n\treadonly message: string;\n\treadonly searchedFrom: string;\n\treadonly stack: string;\n\treadonly stateDir: string;\n\treadonly recovery: string;\n}> {}\n\n/** The manifest exists but doesn't decode against the L0 envelope schema\n * — either malformed JSON (`parse`) or shape drift (`shape`).\n *\n * Distinct from `VitestManifestVersionMismatchError`: this tag carries\n * the \"manifest looks like garbage / your envelope was wrong\" recovery\n * (\"regenerate the manifest\"); the version-mismatch tag carries the\n * \"build-integration and supervisor are at different versions\"\n * recovery (upgrade the consumer dependency). Splitting the two lets\n * callers `catchTag` independently and surface a precise hint. */\nexport class VitestManifestShapeError extends Data.TaggedError('VitestManifestShapeError')<{\n\treadonly message: string;\n\treadonly path: string;\n\treadonly phase: 'parse' | 'shape';\n\treadonly recovery: string;\n\treadonly cause?: unknown;\n}> {}\n\n/** The manifest exists, decodes structurally, but its `manifestVersion`\n * doesn't match what this consumer build was compiled for. Distinct\n * from `VitestManifestShapeError` so callers can `catchTag` the two\n * separately — the recovery action is \"upgrade your devstack\n * consumer dependency\" rather than \"regenerate the manifest\". */\nexport class VitestManifestVersionMismatchError extends Data.TaggedError(\n\t'VitestManifestVersionMismatchError',\n)<{\n\treadonly message: string;\n\treadonly path: string;\n\treadonly recovery: string;\n\treadonly cause?: unknown;\n}> {}\n\n/** A test-setup precondition was violated. Currently only one case:\n * the caller asked for `requireDevstack: true` but the manifest wasn't\n * discoverable. Distinct from the discovery error because the caller\n * opted IN to the requirement. */\nexport class VitestSetupPreconditionError extends Data.TaggedError('VitestSetupPreconditionError')<{\n\treadonly message: string;\n\treadonly hint?: string;\n}> {}\n\nexport type VitestIntegrationError =\n\t| VitestManifestNotFoundError\n\t| VitestManifestShapeError\n\t| VitestManifestVersionMismatchError\n\t| VitestSetupPreconditionError;\n"],"mappings":";;;;;AAoBA,IAAa,8BAAb,cAAiD,KAAK,YAAY,8BAA8B,CAM7F;;;;;;;;;;AAWH,IAAa,2BAAb,cAA8C,KAAK,YAAY,2BAA2B,CAMvF;;;;;;AAOH,IAAa,qCAAb,cAAwD,KAAK,YAC5D,qCACA,CAKE;;;;;AAMH,IAAa,+BAAb,cAAkD,KAAK,YAAY,+BAA+B,CAG/F"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build-integrations/vitest/errors.ts"],"sourcesContent":["// Vitest build-integration — typed errors.\n//\n// Architecture (distilled/23-build-integrations.md § Per-integration\n// requirements → Vitest, § Edge cases): the vitest preset is a pure\n// reader of files + env vars. The two failure modes it surfaces are\n// (a) manifest discovery failed when a test-setup hook asked for it,\n// (b) manifest exists but its shape doesn't match.\n// Both errors carry a `recovery` string so the test-setup printout is\n// actionable instead of a generic schema-decode trace.\n//\n// These tags mirror the engine's `ManifestDiscoveryError` /\n// `ManifestShapeError` (substrate-side; see `runtime/` once it lands)\n// but stay local to the vitest surface so consumers can `catchTag`\n// without importing from substrate.\n\nimport { Data } from 'effect';\n\n/** A test-setup hook asked for the manifest but no on-disk file was\n * found by the walk-up or override path. The supervisor either hasn't\n * run yet or the wrong stack/state-dir is configured. */\nexport class VitestManifestNotFoundError extends Data.TaggedError('VitestManifestNotFoundError')<{\n\treadonly message: string;\n\treadonly searchedFrom: string;\n\treadonly stack: string;\n\treadonly stateDir: string;\n\treadonly recovery: string;\n}> {}\n\n/** The manifest exists but doesn't decode against the L0 envelope schema\n * — either malformed JSON (`parse`) or shape drift (`shape`).\n *\n * Distinct from `VitestManifestVersionMismatchError`: this tag carries\n * the \"manifest looks like garbage / your envelope was wrong\" recovery\n * (\"regenerate the manifest\"); the version-mismatch tag carries the\n * \"build-integration and supervisor are at different versions\"\n * recovery. Splitting the two lets callers `catchTag`\n * independently and surface a precise hint. */\nexport class VitestManifestShapeError extends Data.TaggedError('VitestManifestShapeError')<{\n\treadonly message: string;\n\treadonly path: string;\n\treadonly phase: 'parse' | 'shape';\n\treadonly recovery: string;\n\treadonly cause?: unknown;\n}> {}\n\n/** The manifest exists, decodes structurally, but its `manifestVersion`\n * doesn't match what this consumer build was compiled for. Distinct\n * from `VitestManifestShapeError` so callers can `catchTag` the two\n * separately. */\nexport class VitestManifestVersionMismatchError extends Data.TaggedError(\n\t'VitestManifestVersionMismatchError',\n)<{\n\treadonly message: string;\n\treadonly path: string;\n\treadonly recovery: string;\n\treadonly cause?: unknown;\n}> {}\n\n/** A test-setup precondition was violated. Currently only one case:\n * the caller asked for `requireDevstack: true` but the manifest wasn't\n * discoverable. Distinct from the discovery error because the caller\n * opted IN to the requirement. */\nexport class VitestSetupPreconditionError extends Data.TaggedError('VitestSetupPreconditionError')<{\n\treadonly message: string;\n\treadonly hint?: string;\n}> {}\n\nexport type VitestIntegrationError =\n\t| VitestManifestNotFoundError\n\t| VitestManifestShapeError\n\t| VitestManifestVersionMismatchError\n\t| VitestSetupPreconditionError;\n"],"mappings":";;;;;AAoBA,IAAa,8BAAb,cAAiD,KAAK,YAAY,6BAA6B,CAAC,CAM7F,CAAC;;;;;;;;;;AAWJ,IAAa,2BAAb,cAA8C,KAAK,YAAY,0BAA0B,CAAC,CAMvF,CAAC;;;;;AAMJ,IAAa,qCAAb,cAAwD,KAAK,YAC5D,oCACD,CAAC,CAKE,CAAC;;;;;AAMJ,IAAa,+BAAb,cAAkD,KAAK,YAAY,8BAA8B,CAAC,CAG/F,CAAC"}
@@ -0,0 +1,35 @@
1
+ //#region src/build-integrations/vitest/global-setup.d.ts
2
+ interface DevstackVitestGlobalSetupOptions {
3
+ /** Stack name to boot. Default: `DEVSTACK_STACK` if set, else
4
+ * `RECOMMENDED_TEST_STACK` (`'test'`). The booted identity forces
5
+ * this stack, so it coexists with a developer's `main` dev stack. */
6
+ readonly stack?: string;
7
+ /** Path to the app's `devstack.config.ts`. Default: walk-up from cwd. */
8
+ readonly configPath?: string;
9
+ /** Runtime root holding `stacks/<stack>/manifest.json`. Default:
10
+ * `DEVSTACK_RUNTIME_ROOT` / `DEVSTACK_STATE_DIR` / `.devstack`. */
11
+ readonly runtimeRoot?: string;
12
+ /** Reuse an already-running stack instead of booting a fresh one (no
13
+ * boot, no teardown). Default: `false` — also enabled by
14
+ * `DEVSTACK_TEST_REUSE=1`. */
15
+ readonly reuse?: boolean;
16
+ /** Hard cap (ms) for the stack to reach ready. Default 300_000 (5 min)
17
+ * — accounts for cold supervisor boot under Docker image pulls. */
18
+ readonly bootTimeoutMs?: number;
19
+ }
20
+ /** Vitest's `globalSetup` contract: a setup function that optionally
21
+ * returns a teardown function. */
22
+ type DevstackVitestGlobalSetup = () => Promise<() => Promise<void>>;
23
+ /**
24
+ * Build a vitest `globalSetup` that boots (or reuses) a dedicated test
25
+ * stack. Wire it via `devstackVitestTestConfig({ autoBoot: true })`, or
26
+ * reference the module path directly in `test.globalSetup`.
27
+ */
28
+ declare const devstackVitestGlobalSetup: (opts?: DevstackVitestGlobalSetupOptions) => DevstackVitestGlobalSetup;
29
+ /** Default export = a ready-to-use vitest `globalSetup`. This is what
30
+ * `test.globalSetup: '@mysten-incubation/devstack/vitest/global-setup'`
31
+ * resolves to. */
32
+ declare const _default: DevstackVitestGlobalSetup;
33
+ //#endregion
34
+ export { DevstackVitestGlobalSetup, DevstackVitestGlobalSetupOptions, _default as default, devstackVitestGlobalSetup };
35
+ //# sourceMappingURL=global-setup.d.mts.map
@@ -0,0 +1,156 @@
1
+ import { runStack } from "../../api/run-stack.mjs";
2
+ import { loadDevstackConfig } from "../../api/load-config.mjs";
3
+ import { VITEST_ENV_VARS } from "./env.mjs";
4
+ import { loadStackContext } from "./stack-context.mjs";
5
+ import { Effect } from "effect";
6
+ import { existsSync, readFileSync } from "node:fs";
7
+ import { dirname } from "node:path";
8
+ import { spawn } from "node:child_process";
9
+ import { fileURLToPath } from "node:url";
10
+ //#region src/build-integrations/vitest/global-setup.ts
11
+ const DEFAULT_BOOT_TIMEOUT_MS = 3e5;
12
+ const isTruthyEnv = (value) => value === "1" || value === "true" || value === "yes";
13
+ const resolveRuntimeRoot = (opts, env) => opts.runtimeRoot ?? (env[VITEST_ENV_VARS.RUNTIME_ROOT] || env[VITEST_ENV_VARS.RUNTIME_ROOT_LEGACY] || void 0) ?? ".devstack";
14
+ const resolveStackName = (opts, env) => {
15
+ const fromEnv = env[VITEST_ENV_VARS.STACK];
16
+ return opts.stack ?? (fromEnv && fromEnv !== "" ? fromEnv : "test");
17
+ };
18
+ const withTimeout = async (promise, ms, label) => {
19
+ let timer;
20
+ const timeout = new Promise((_, reject) => {
21
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`${label} timed out after ${ms}ms`)), ms);
22
+ });
23
+ try {
24
+ return await Promise.race([promise, timeout]);
25
+ } finally {
26
+ if (timer !== void 0) clearTimeout(timer);
27
+ }
28
+ };
29
+ const safeStop = async (handle) => {
30
+ try {
31
+ await Effect.runPromise(handle.stop);
32
+ } catch {}
33
+ try {
34
+ await Effect.runPromise(handle.awaitShutdown);
35
+ } catch {}
36
+ };
37
+ /** After the in-process supervisor has exited, graceful shutdown only
38
+ * STOPS the stack's containers (devstack keeps them for warm restarts).
39
+ * An ephemeral test stack should leave nothing behind, so run the
40
+ * production `devstack wipe` verb (force-removes containers + networks +
41
+ * volumes + per-stack on-disk state) for the booted stack. Best-effort:
42
+ * failure here never fails the test run, and a leftover stopped stack is
43
+ * force-recreated by the next boot anyway. Skip with `DEVSTACK_TEST_KEEP=1`
44
+ * to leave the stack up for debugging. */
45
+ const wipeStack = (stack, runtimeRoot, cwd) => new Promise((resolve) => {
46
+ const cliEntry = fileURLToPath(new URL("../../cli/main.mjs", import.meta.url));
47
+ if (!existsSync(cliEntry)) {
48
+ resolve();
49
+ return;
50
+ }
51
+ const child = spawn(process.execPath, [
52
+ cliEntry,
53
+ "wipe",
54
+ "--yes"
55
+ ], {
56
+ cwd,
57
+ env: {
58
+ ...process.env,
59
+ DEVSTACK_STACK: stack,
60
+ DEVSTACK_RUNTIME_ROOT: runtimeRoot
61
+ },
62
+ stdio: "ignore"
63
+ });
64
+ child.unref();
65
+ const done = () => resolve();
66
+ child.on("error", done);
67
+ child.on("exit", done);
68
+ setTimeout(() => {
69
+ child.kill();
70
+ resolve();
71
+ }, 12e4).unref?.();
72
+ });
73
+ /** Best-effort, sync read of the booted stack's `codegen.idsFile` from its
74
+ * manifest. The generated `config-runtime.ts` resolver reads the injected
75
+ * `__DEVSTACK_IDS__` Vite `define`, but under vitest the Vite config (and
76
+ * thus that define) is evaluated BEFORE this `globalSetup` boots the stack,
77
+ * so the define bakes to `null`. The resolver's Node-only fallback reads
78
+ * `process.env.DEVSTACK_IDS_FILE` at id-access time instead — we point it at
79
+ * the freshly-booted stack's live id-config file here. Mirrors the Vite
80
+ * plugin's `readCodegenField`; degrades to `null` on any miss. */
81
+ const readIdsFileFromManifest = (manifestPath) => {
82
+ try {
83
+ if (!existsSync(manifestPath)) return null;
84
+ const parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
85
+ if (typeof parsed !== "object" || parsed === null) return null;
86
+ const codegen = parsed.codegen;
87
+ if (typeof codegen !== "object" || codegen === null) return null;
88
+ const value = codegen.idsFile;
89
+ return typeof value === "string" && value.length > 0 ? value : null;
90
+ } catch {
91
+ return null;
92
+ }
93
+ };
94
+ /** Publish the env handoff vitest forwards to test workers, so per-file
95
+ * `getStackContext()` resolves the stack this setup booted/attached, and the
96
+ * generated `config-runtime.ts` resolver can read the live ids
97
+ * (`DEVSTACK_IDS_FILE` — its Node fallback when the Vite `define` is null). */
98
+ const publishHandoff = (stack, runtimeRoot, manifestPath) => {
99
+ process.env[VITEST_ENV_VARS.STACK] = stack;
100
+ process.env[VITEST_ENV_VARS.RUNTIME_ROOT] = runtimeRoot;
101
+ process.env[VITEST_ENV_VARS.MANIFEST_PATH] = manifestPath;
102
+ const idsFile = readIdsFileFromManifest(manifestPath);
103
+ if (idsFile !== null) process.env.DEVSTACK_IDS_FILE = idsFile;
104
+ };
105
+ /**
106
+ * Build a vitest `globalSetup` that boots (or reuses) a dedicated test
107
+ * stack. Wire it via `devstackVitestTestConfig({ autoBoot: true })`, or
108
+ * reference the module path directly in `test.globalSetup`.
109
+ */
110
+ const devstackVitestGlobalSetup = (opts = {}) => async () => {
111
+ const env = process.env;
112
+ const stack = resolveStackName(opts, env);
113
+ const runtimeRoot = resolveRuntimeRoot(opts, env);
114
+ if (opts.reuse ?? isTruthyEnv(env.DEVSTACK_TEST_REUSE)) {
115
+ publishHandoff(stack, runtimeRoot, loadStackContext({
116
+ stack,
117
+ runtimeRoot,
118
+ required: true
119
+ }).manifestPath);
120
+ return async () => {};
121
+ }
122
+ const loaded = await Effect.runPromise(loadDevstackConfig(opts.configPath)).catch((cause) => {
123
+ throw new Error(`devstack autoBoot: failed to load devstack config — ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
124
+ });
125
+ const handle = runStack(loaded.stack, {
126
+ identity: { stack },
127
+ appRoot: dirname(loaded.resolvedConfigPath),
128
+ runtimeRoot,
129
+ ...loaded.engine.options.codegen !== void 0 ? { codegen: loaded.engine.options.codegen } : {}
130
+ });
131
+ try {
132
+ await withTimeout(Effect.runPromise(handle.start), opts.bootTimeoutMs ?? DEFAULT_BOOT_TIMEOUT_MS, `devstack autoBoot: '${stack}' stack boot`);
133
+ } catch (cause) {
134
+ await safeStop(handle);
135
+ throw new Error(`devstack autoBoot: failed to boot the '${stack}' stack. If a '${stack}' stack is already running, stop it with \`devstack down ${stack}\` or set DEVSTACK_TEST_REUSE=1 to run tests against it. Cause: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
136
+ }
137
+ publishHandoff(stack, runtimeRoot, loadStackContext({
138
+ cwd: dirname(loaded.resolvedConfigPath),
139
+ stack,
140
+ runtimeRoot,
141
+ required: true
142
+ }).manifestPath);
143
+ const keep = isTruthyEnv(env.DEVSTACK_TEST_KEEP);
144
+ return async () => {
145
+ await safeStop(handle);
146
+ if (!keep) await wipeStack(stack, runtimeRoot, dirname(loaded.resolvedConfigPath));
147
+ };
148
+ };
149
+ /** Default export = a ready-to-use vitest `globalSetup`. This is what
150
+ * `test.globalSetup: '@mysten-incubation/devstack/vitest/global-setup'`
151
+ * resolves to. */
152
+ var global_setup_default = devstackVitestGlobalSetup();
153
+ //#endregion
154
+ export { global_setup_default as default, devstackVitestGlobalSetup };
155
+
156
+ //# sourceMappingURL=global-setup.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-setup.mjs","names":[],"sources":["../../../src/build-integrations/vitest/global-setup.ts"],"sourcesContent":["// Vitest `globalSetup` that boots a dedicated `test` stack for the run\n// and tears it down on completion.\n//\n// Why this exists (distilled/23-build-integrations.md § Vitest): the\n// per-file `setup.ts` preset is a passive manifest READER — it requires\n// a stack someone already started. This module is the missing boot seam:\n// `pnpm test` brings up its OWN isolated `test` stack so tests run in\n// parallel to a developer's `pnpm dev` (`main`) stack without contending\n// for ports / faucet / wallet, and without requiring the dev stack to be\n// up at all.\n//\n// Lifecycle (the locked design — \"boot fresh + teardown each run\"):\n// setup → load config, runStack(identity.stack='test'), await ready\n// handoff → publish env (DEVSTACK_STACK + DEVSTACK_MANIFEST_PATH) so the\n// per-file workers' `loadStackContext` resolves THIS stack\n// teardown → stop + awaitShutdown (robust: still tears down a half-booted\n// stack so no `devstack.stack=test` containers leak)\n//\n// Escape hatch (reuse an already-running stack — e.g. your dev stack):\n// set `DEVSTACK_TEST_REUSE=1` (and optionally point `DEVSTACK_STACK` at\n// the running stack), or pass `{ reuse: true }`. Reuse mode does NOT\n// boot and does NOT tear down — it only publishes the env handoff to the\n// existing manifest.\n//\n// CRITICAL: vitest runs `globalSetup` in a SEPARATE process from the test\n// workers, so the handoff is via `process.env` (which vitest forwards to\n// workers), NOT an in-memory stash. We reuse the existing\n// `DEVSTACK_MANIFEST_PATH` top-precedence rung (`env.ts`) that the engine\n// already uses when it spawns child processes.\n//\n// This module imports only the CLI-free `api/` surface (`runStack`,\n// `loadDevstackConfig`) so the vitest entrypoint never pulls the CLI/TUI\n// graph into its bundle.\n\nimport { spawn } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { Effect } from 'effect';\n\nimport { loadDevstackConfig } from '../../api/load-config.ts';\nimport { runStack, type RunHandle } from '../../api/run-stack.ts';\nimport { DEFAULT_RUNTIME_ROOT, RECOMMENDED_TEST_STACK, VITEST_ENV_VARS } from './env.ts';\nimport { loadStackContext } from './stack-context.ts';\n\nexport interface DevstackVitestGlobalSetupOptions {\n\t/** Stack name to boot. Default: `DEVSTACK_STACK` if set, else\n\t * `RECOMMENDED_TEST_STACK` (`'test'`). The booted identity forces\n\t * this stack, so it coexists with a developer's `main` dev stack. */\n\treadonly stack?: string;\n\t/** Path to the app's `devstack.config.ts`. Default: walk-up from cwd. */\n\treadonly configPath?: string;\n\t/** Runtime root holding `stacks/<stack>/manifest.json`. Default:\n\t * `DEVSTACK_RUNTIME_ROOT` / `DEVSTACK_STATE_DIR` / `.devstack`. */\n\treadonly runtimeRoot?: string;\n\t/** Reuse an already-running stack instead of booting a fresh one (no\n\t * boot, no teardown). Default: `false` — also enabled by\n\t * `DEVSTACK_TEST_REUSE=1`. */\n\treadonly reuse?: boolean;\n\t/** Hard cap (ms) for the stack to reach ready. Default 300_000 (5 min)\n\t * — accounts for cold supervisor boot under Docker image pulls. */\n\treadonly bootTimeoutMs?: number;\n}\n\n/** Vitest's `globalSetup` contract: a setup function that optionally\n * returns a teardown function. */\nexport type DevstackVitestGlobalSetup = () => Promise<() => Promise<void>>;\n\nconst DEFAULT_BOOT_TIMEOUT_MS = 300_000;\n\nconst isTruthyEnv = (value: string | undefined): boolean =>\n\tvalue === '1' || value === 'true' || value === 'yes';\n\nconst resolveRuntimeRoot = (\n\topts: DevstackVitestGlobalSetupOptions,\n\tenv: NodeJS.ProcessEnv,\n): string =>\n\topts.runtimeRoot ??\n\t(env[VITEST_ENV_VARS.RUNTIME_ROOT] || env[VITEST_ENV_VARS.RUNTIME_ROOT_LEGACY] || undefined) ??\n\tDEFAULT_RUNTIME_ROOT;\n\nconst resolveStackName = (\n\topts: DevstackVitestGlobalSetupOptions,\n\tenv: NodeJS.ProcessEnv,\n): string => {\n\tconst fromEnv = env[VITEST_ENV_VARS.STACK];\n\treturn opts.stack ?? (fromEnv && fromEnv !== '' ? fromEnv : RECOMMENDED_TEST_STACK);\n};\n\nconst withTimeout = async <A>(promise: Promise<A>, ms: number, label: string): Promise<A> => {\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tconst timeout = new Promise<never>((_, reject) => {\n\t\ttimer = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms);\n\t});\n\ttry {\n\t\treturn await Promise.race([promise, timeout]);\n\t} finally {\n\t\tif (timer !== undefined) clearTimeout(timer);\n\t}\n};\n\nconst safeStop = async (handle: RunHandle): Promise<void> => {\n\ttry {\n\t\tawait Effect.runPromise(handle.stop);\n\t} catch {\n\t\t// best-effort — fall through to awaitShutdown\n\t}\n\ttry {\n\t\tawait Effect.runPromise(handle.awaitShutdown);\n\t} catch {\n\t\t// supervisor may have already exited; nothing more to do\n\t}\n};\n\n/** After the in-process supervisor has exited, graceful shutdown only\n * STOPS the stack's containers (devstack keeps them for warm restarts).\n * An ephemeral test stack should leave nothing behind, so run the\n * production `devstack wipe` verb (force-removes containers + networks +\n * volumes + per-stack on-disk state) for the booted stack. Best-effort:\n * failure here never fails the test run, and a leftover stopped stack is\n * force-recreated by the next boot anyway. Skip with `DEVSTACK_TEST_KEEP=1`\n * to leave the stack up for debugging. */\nconst wipeStack = (stack: string, runtimeRoot: string, cwd: string): Promise<void> =>\n\tnew Promise((resolve) => {\n\t\t// The CLI entry ships beside this module in the built package:\n\t\t// dist/build-integrations/vitest/global-setup.mjs → dist/cli/main.mjs.\n\t\tconst cliEntry = fileURLToPath(new URL('../../cli/main.mjs', import.meta.url));\n\t\tif (!existsSync(cliEntry)) {\n\t\t\tresolve();\n\t\t\treturn;\n\t\t}\n\t\tconst child = spawn(process.execPath, [cliEntry, 'wipe', '--yes'], {\n\t\t\tcwd,\n\t\t\tenv: { ...process.env, DEVSTACK_STACK: stack, DEVSTACK_RUNTIME_ROOT: runtimeRoot },\n\t\t\tstdio: 'ignore',\n\t\t});\n\t\tchild.unref();\n\t\tconst done = () => resolve();\n\t\tchild.on('error', done);\n\t\tchild.on('exit', done);\n\t\tconst timer = setTimeout(() => {\n\t\t\tchild.kill();\n\t\t\tresolve();\n\t\t}, 120_000);\n\t\ttimer.unref?.();\n\t});\n\n/** Best-effort, sync read of the booted stack's `codegen.idsFile` from its\n * manifest. The generated `config-runtime.ts` resolver reads the injected\n * `__DEVSTACK_IDS__` Vite `define`, but under vitest the Vite config (and\n * thus that define) is evaluated BEFORE this `globalSetup` boots the stack,\n * so the define bakes to `null`. The resolver's Node-only fallback reads\n * `process.env.DEVSTACK_IDS_FILE` at id-access time instead — we point it at\n * the freshly-booted stack's live id-config file here. Mirrors the Vite\n * plugin's `readCodegenField`; degrades to `null` on any miss. */\nconst readIdsFileFromManifest = (manifestPath: string): string | null => {\n\ttry {\n\t\tif (!existsSync(manifestPath)) return null;\n\t\tconst parsed: unknown = JSON.parse(readFileSync(manifestPath, 'utf8'));\n\t\tif (typeof parsed !== 'object' || parsed === null) return null;\n\t\tconst codegen = (parsed as { readonly codegen?: unknown }).codegen;\n\t\tif (typeof codegen !== 'object' || codegen === null) return null;\n\t\tconst value = (codegen as Record<string, unknown>).idsFile;\n\t\treturn typeof value === 'string' && value.length > 0 ? value : null;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n/** Publish the env handoff vitest forwards to test workers, so per-file\n * `getStackContext()` resolves the stack this setup booted/attached, and the\n * generated `config-runtime.ts` resolver can read the live ids\n * (`DEVSTACK_IDS_FILE` — its Node fallback when the Vite `define` is null). */\nconst publishHandoff = (stack: string, runtimeRoot: string, manifestPath: string): void => {\n\tprocess.env[VITEST_ENV_VARS.STACK] = stack;\n\tprocess.env[VITEST_ENV_VARS.RUNTIME_ROOT] = runtimeRoot;\n\tprocess.env[VITEST_ENV_VARS.MANIFEST_PATH] = manifestPath;\n\tconst idsFile = readIdsFileFromManifest(manifestPath);\n\tif (idsFile !== null) process.env.DEVSTACK_IDS_FILE = idsFile;\n};\n\n/**\n * Build a vitest `globalSetup` that boots (or reuses) a dedicated test\n * stack. Wire it via `devstackVitestTestConfig({ autoBoot: true })`, or\n * reference the module path directly in `test.globalSetup`.\n */\nexport const devstackVitestGlobalSetup =\n\t(opts: DevstackVitestGlobalSetupOptions = {}): DevstackVitestGlobalSetup =>\n\tasync () => {\n\t\tconst env = process.env;\n\t\tconst stack = resolveStackName(opts, env);\n\t\tconst runtimeRoot = resolveRuntimeRoot(opts, env);\n\t\tconst reuse = opts.reuse ?? isTruthyEnv(env.DEVSTACK_TEST_REUSE);\n\n\t\t// Reuse path: attach to an already-running stack. No boot, no teardown.\n\t\tif (reuse) {\n\t\t\tconst ctx = loadStackContext({ stack, runtimeRoot, required: true });\n\t\t\t// `required: true` throws VitestManifestNotFoundError on miss.\n\t\t\tpublishHandoff(stack, runtimeRoot, ctx!.manifestPath);\n\t\t\treturn async () => {};\n\t\t}\n\n\t\t// Fresh boot (default). Load the app's stack the same way the CLI does.\n\t\tconst loaded = await Effect.runPromise(loadDevstackConfig(opts.configPath)).catch((cause) => {\n\t\t\tthrow new Error(\n\t\t\t\t`devstack autoBoot: failed to load devstack config — ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\t{ cause },\n\t\t\t);\n\t\t});\n\n\t\tconst handle = runStack(loaded.stack, {\n\t\t\tidentity: { stack },\n\t\t\tappRoot: dirname(loaded.resolvedConfigPath),\n\t\t\truntimeRoot,\n\t\t\t...(loaded.engine.options.codegen !== undefined\n\t\t\t\t? { codegen: loaded.engine.options.codegen }\n\t\t\t\t: {}),\n\t\t});\n\n\t\ttry {\n\t\t\tawait withTimeout(\n\t\t\t\tEffect.runPromise(handle.start),\n\t\t\t\topts.bootTimeoutMs ?? DEFAULT_BOOT_TIMEOUT_MS,\n\t\t\t\t`devstack autoBoot: '${stack}' stack boot`,\n\t\t\t);\n\t\t} catch (cause) {\n\t\t\tawait safeStop(handle);\n\t\t\tthrow new Error(\n\t\t\t\t`devstack autoBoot: failed to boot the '${stack}' stack. ` +\n\t\t\t\t\t`If a '${stack}' stack is already running, stop it with \\`devstack down ${stack}\\` ` +\n\t\t\t\t\t`or set DEVSTACK_TEST_REUSE=1 to run tests against it. ` +\n\t\t\t\t\t`Cause: ${cause instanceof Error ? cause.message : String(cause)}`,\n\t\t\t\t{ cause },\n\t\t\t);\n\t\t}\n\n\t\t// Resolve the freshly-written manifest the workers will read.\n\t\tconst ctx = loadStackContext({\n\t\t\tcwd: dirname(loaded.resolvedConfigPath),\n\t\t\tstack,\n\t\t\truntimeRoot,\n\t\t\trequired: true,\n\t\t});\n\t\tpublishHandoff(stack, runtimeRoot, ctx!.manifestPath);\n\n\t\tconst keep = isTruthyEnv(env.DEVSTACK_TEST_KEEP);\n\t\treturn async () => {\n\t\t\tawait safeStop(handle);\n\t\t\tif (!keep) {\n\t\t\t\tawait wipeStack(stack, runtimeRoot, dirname(loaded.resolvedConfigPath));\n\t\t\t}\n\t\t};\n\t};\n\n/** Default export = a ready-to-use vitest `globalSetup`. This is what\n * `test.globalSetup: '@mysten-incubation/devstack/vitest/global-setup'`\n * resolves to. */\nexport default devstackVitestGlobalSetup();\n"],"mappings":";;;;;;;;;;AAqEA,MAAM,0BAA0B;AAEhC,MAAM,eAAe,UACpB,UAAU,OAAO,UAAU,UAAU,UAAU;AAEhD,MAAM,sBACL,MACA,QAEA,KAAK,gBACJ,IAAI,gBAAgB,iBAAiB,IAAI,gBAAgB,wBAAwB,KAAA,MAAA;AAGnF,MAAM,oBACL,MACA,QACY;CACZ,MAAM,UAAU,IAAI,gBAAgB;CACpC,OAAO,KAAK,UAAU,WAAW,YAAY,KAAK,UAAA;AACnD;AAEA,MAAM,cAAc,OAAU,SAAqB,IAAY,UAA8B;CAC5F,IAAI;CACJ,MAAM,UAAU,IAAI,SAAgB,GAAG,WAAW;EACjD,QAAQ,iBAAiB,uBAAO,IAAI,MAAM,GAAG,MAAM,mBAAmB,GAAG,GAAG,CAAC,GAAG,EAAE;CACnF,CAAC;CACD,IAAI;EACH,OAAO,MAAM,QAAQ,KAAK,CAAC,SAAS,OAAO,CAAC;CAC7C,UAAU;EACT,IAAI,UAAU,KAAA,GAAW,aAAa,KAAK;CAC5C;AACD;AAEA,MAAM,WAAW,OAAO,WAAqC;CAC5D,IAAI;EACH,MAAM,OAAO,WAAW,OAAO,IAAI;CACpC,QAAQ,CAER;CACA,IAAI;EACH,MAAM,OAAO,WAAW,OAAO,aAAa;CAC7C,QAAQ,CAER;AACD;;;;;;;;;AAUA,MAAM,aAAa,OAAe,aAAqB,QACtD,IAAI,SAAS,YAAY;CAGxB,MAAM,WAAW,cAAc,IAAI,IAAI,sBAAsB,OAAO,KAAK,GAAG,CAAC;CAC7E,IAAI,CAAC,WAAW,QAAQ,GAAG;EAC1B,QAAQ;EACR;CACD;CACA,MAAM,QAAQ,MAAM,QAAQ,UAAU;EAAC;EAAU;EAAQ;CAAO,GAAG;EAClE;EACA,KAAK;GAAE,GAAG,QAAQ;GAAK,gBAAgB;GAAO,uBAAuB;EAAY;EACjF,OAAO;CACR,CAAC;CACD,MAAM,MAAM;CACZ,MAAM,aAAa,QAAQ;CAC3B,MAAM,GAAG,SAAS,IAAI;CACtB,MAAM,GAAG,QAAQ,IAAI;CAKrB,iBAJ+B;EAC9B,MAAM,KAAK;EACX,QAAQ;CACT,GAAG,IACC,CAAC,CAAC,QAAQ;AACf,CAAC;;;;;;;;;AAUF,MAAM,2BAA2B,iBAAwC;CACxE,IAAI;EACH,IAAI,CAAC,WAAW,YAAY,GAAG,OAAO;EACtC,MAAM,SAAkB,KAAK,MAAM,aAAa,cAAc,MAAM,CAAC;EACrE,IAAI,OAAO,WAAW,YAAY,WAAW,MAAM,OAAO;EAC1D,MAAM,UAAW,OAA0C;EAC3D,IAAI,OAAO,YAAY,YAAY,YAAY,MAAM,OAAO;EAC5D,MAAM,QAAS,QAAoC;EACnD,OAAO,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ;CAChE,QAAQ;EACP,OAAO;CACR;AACD;;;;;AAMA,MAAM,kBAAkB,OAAe,aAAqB,iBAA+B;CAC1F,QAAQ,IAAI,gBAAgB,SAAS;CACrC,QAAQ,IAAI,gBAAgB,gBAAgB;CAC5C,QAAQ,IAAI,gBAAgB,iBAAiB;CAC7C,MAAM,UAAU,wBAAwB,YAAY;CACpD,IAAI,YAAY,MAAM,QAAQ,IAAI,oBAAoB;AACvD;;;;;;AAOA,MAAa,6BACX,OAAyC,CAAC,MAC3C,YAAY;CACX,MAAM,MAAM,QAAQ;CACpB,MAAM,QAAQ,iBAAiB,MAAM,GAAG;CACxC,MAAM,cAAc,mBAAmB,MAAM,GAAG;CAIhD,IAHc,KAAK,SAAS,YAAY,IAAI,mBAAmB,GAGpD;EAGV,eAAe,OAAO,aAFV,iBAAiB;GAAE;GAAO;GAAa,UAAU;EAAK,CAE7B,CAAC,CAAE,YAAY;EACpD,OAAO,YAAY,CAAC;CACrB;CAGA,MAAM,SAAS,MAAM,OAAO,WAAW,mBAAmB,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,UAAU;EAC5F,MAAM,IAAI,MACT,uDAAuD,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAC5G,EAAE,MAAM,CACT;CACD,CAAC;CAED,MAAM,SAAS,SAAS,OAAO,OAAO;EACrC,UAAU,EAAE,MAAM;EAClB,SAAS,QAAQ,OAAO,kBAAkB;EAC1C;EACA,GAAI,OAAO,OAAO,QAAQ,YAAY,KAAA,IACnC,EAAE,SAAS,OAAO,OAAO,QAAQ,QAAQ,IACzC,CAAC;CACL,CAAC;CAED,IAAI;EACH,MAAM,YACL,OAAO,WAAW,OAAO,KAAK,GAC9B,KAAK,iBAAiB,yBACtB,uBAAuB,MAAM,aAC9B;CACD,SAAS,OAAO;EACf,MAAM,SAAS,MAAM;EACrB,MAAM,IAAI,MACT,0CAA0C,MAAM,iBACtC,MAAM,2DAA2D,MAAM,kEAEtE,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,KAChE,EAAE,MAAM,CACT;CACD;CASA,eAAe,OAAO,aANV,iBAAiB;EAC5B,KAAK,QAAQ,OAAO,kBAAkB;EACtC;EACA;EACA,UAAU;CACX,CACqC,CAAC,CAAE,YAAY;CAEpD,MAAM,OAAO,YAAY,IAAI,kBAAkB;CAC/C,OAAO,YAAY;EAClB,MAAM,SAAS,MAAM;EACrB,IAAI,CAAC,MACJ,MAAM,UAAU,OAAO,aAAa,QAAQ,OAAO,kBAAkB,CAAC;CAExE;AACD;;;;AAKD,IAAA,uBAAe,0BAA0B"}
@@ -1,6 +1,7 @@
1
+ import { DevstackVitestGlobalSetup, DevstackVitestGlobalSetupOptions, devstackVitestGlobalSetup } from "./global-setup.mjs";
1
2
  import { LoadStackContextOptions, StackContext, loadStackContext } from "./stack-context.mjs";
2
3
  import { TestSetupOptions, VitestLifecycleHooks, getStackContext, runDevstackAfterAll, runDevstackBeforeAll, useDevstackTestSetup } from "./setup.mjs";
3
4
  import { DevstackVitestTestConfigOptions, devstackVitestServerConfig, devstackVitestTestConfig } from "./config.mjs";
4
- import { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, RECOMMENDED_TEST_STACK, ResolvedVitestEnv, VITEST_ENV_VARS, VitestEnvVarName, resolveVitestEnv } from "./env.mjs";
5
+ import { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, RECOMMENDED_TEST_STACK, ResolveVitestEnvOptions, ResolvedVitestEnv, VITEST_ENV_VARS, VitestEnvVarName, resolveVitestEnv } from "./env.mjs";
5
6
  import { VitestIntegrationError, VitestManifestNotFoundError, VitestManifestShapeError, VitestManifestVersionMismatchError, VitestSetupPreconditionError } from "./errors.mjs";
6
- export { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, type DevstackVitestTestConfigOptions, type LoadStackContextOptions, RECOMMENDED_TEST_STACK, type ResolvedVitestEnv, type StackContext, type TestSetupOptions, VITEST_ENV_VARS, type VitestEnvVarName, type VitestIntegrationError, type VitestLifecycleHooks, VitestManifestNotFoundError, VitestManifestShapeError, VitestManifestVersionMismatchError, VitestSetupPreconditionError, devstackVitestServerConfig, devstackVitestTestConfig, getStackContext, loadStackContext, resolveVitestEnv, runDevstackAfterAll, runDevstackBeforeAll, useDevstackTestSetup };
7
+ export { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, type DevstackVitestGlobalSetup, type DevstackVitestGlobalSetupOptions, type DevstackVitestTestConfigOptions, type LoadStackContextOptions, RECOMMENDED_TEST_STACK, type ResolveVitestEnvOptions, type ResolvedVitestEnv, type StackContext, type TestSetupOptions, VITEST_ENV_VARS, type VitestEnvVarName, type VitestIntegrationError, type VitestLifecycleHooks, VitestManifestNotFoundError, VitestManifestShapeError, VitestManifestVersionMismatchError, VitestSetupPreconditionError, devstackVitestGlobalSetup, devstackVitestServerConfig, devstackVitestTestConfig, getStackContext, loadStackContext, resolveVitestEnv, runDevstackAfterAll, runDevstackBeforeAll, useDevstackTestSetup };
@@ -1,6 +1,7 @@
1
1
  import { devstackVitestServerConfig, devstackVitestTestConfig } from "./config.mjs";
2
+ import { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, RECOMMENDED_TEST_STACK, VITEST_ENV_VARS, resolveVitestEnv } from "./env.mjs";
2
3
  import { VitestManifestNotFoundError, VitestManifestShapeError, VitestManifestVersionMismatchError, VitestSetupPreconditionError } from "./errors.mjs";
3
4
  import { loadStackContext } from "./stack-context.mjs";
4
- import { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, RECOMMENDED_TEST_STACK, VITEST_ENV_VARS, resolveVitestEnv } from "./env.mjs";
5
+ import { devstackVitestGlobalSetup } from "./global-setup.mjs";
5
6
  import { getStackContext, runDevstackAfterAll, runDevstackBeforeAll, useDevstackTestSetup } from "./setup.mjs";
6
- export { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, RECOMMENDED_TEST_STACK, VITEST_ENV_VARS, VitestManifestNotFoundError, VitestManifestShapeError, VitestManifestVersionMismatchError, VitestSetupPreconditionError, devstackVitestServerConfig, devstackVitestTestConfig, getStackContext, loadStackContext, resolveVitestEnv, runDevstackAfterAll, runDevstackBeforeAll, useDevstackTestSetup };
7
+ export { DEFAULT_RUNTIME_ROOT, DEFAULT_STACK_NAME, RECOMMENDED_TEST_STACK, VITEST_ENV_VARS, VitestManifestNotFoundError, VitestManifestShapeError, VitestManifestVersionMismatchError, VitestSetupPreconditionError, devstackVitestGlobalSetup, devstackVitestServerConfig, devstackVitestTestConfig, getStackContext, loadStackContext, resolveVitestEnv, runDevstackAfterAll, runDevstackBeforeAll, useDevstackTestSetup };
@@ -1,6 +1,6 @@
1
+ import { RECOMMENDED_TEST_STACK, VITEST_ENV_VARS, resolveVitestEnv } from "./env.mjs";
1
2
  import { VitestSetupPreconditionError } from "./errors.mjs";
2
3
  import { loadStackContext } from "./stack-context.mjs";
3
- import { RECOMMENDED_TEST_STACK, VITEST_ENV_VARS, resolveVitestEnv } from "./env.mjs";
4
4
  //#region src/build-integrations/vitest/setup.ts
5
5
  let captured;
6
6
  /** Return the StackContext captured by `runDevstackBeforeAll`. Returns
@@ -16,7 +16,7 @@ const clearStackContext = () => {
16
16
  * it into Vitest's hooks directly OR call it inline from a
17
17
  * setup-file. */
18
18
  const runDevstackBeforeAll = (options = {}) => {
19
- const resolved = resolveVitestEnv(options.env ?? process.env);
19
+ const resolved = resolveVitestEnv(options.env ?? process.env, { cwd: options.cwd ?? process.cwd() });
20
20
  if (!options.silent && !resolved.stackWasExplicit) (options.writeAdvisory ?? ((line) => void process.stderr.write(`${line}\n`)))(`[devstack/vitest] ${VITEST_ENV_VARS.STACK} is unset; tests will read the '${resolved.stack}' stack. Set ${VITEST_ENV_VARS.STACK}=${RECOMMENDED_TEST_STACK} in the test script to avoid contention with \`pnpm dev\`.`);
21
21
  const ctx = loadStackContext({
22
22
  ...options,
@@ -1 +1 @@
1
- {"version":3,"file":"setup.mjs","names":[],"sources":["../../../src/build-integrations/vitest/setup.ts"],"sourcesContent":["// Vitest build-integration — test-setup hooks.\n//\n// Architecture (distilled/23-build-integrations.md § Per-integration\n// requirements → Vitest, § Lifecycle states): the preset itself does\n// NOT boot devstack; it is the test file's job (via\n// `@effect/vitest`'s `it.layer(stack.layer)`) to drive the lifecycle.\n//\n// But suites that talk to a LIVE devstack still need a small\n// before/after surface to:\n// - Print a one-line advisory when `DEVSTACK_STACK` is unset (the\n// test would otherwise run against `main`, contending with\n// `pnpm dev`).\n// - Optionally verify the manifest is on disk before the first\n// `it.effect` fires (cheap probe, friendly error).\n// - Optionally project the manifest into a shared fixture handle\n// suites can `import { stackContext } from './setup-fixture.ts'`.\n//\n// This module is OPT-IN. A suite wires it via Vitest's `setupFiles`\n// (or via the `useTestSetup` registrar below for programmatic\n// composition). The preset wires it automatically when\n// `opts.testSetup` is truthy.\n//\n// Hook firing order:\n// beforeAll (once per file)\n// 1. resolveVitestEnv → print stack/runtimeRoot advisory if needed\n// 2. if requireDevstack: loadStackContext({required: true})\n// else: loadStackContext() (may be undefined)\n// 3. publish to the captured fixture so `getStackContext()` works\n// synchronously inside `it`/`test` bodies\n// afterAll (once per file)\n// 4. clear the captured fixture (so a stale handle doesn't survive\n// between watch runs)\n//\n// No teardown of the devstack itself — that's the supervisor's job;\n// the preset is a pure reader.\n//\n// NOTE: this module must NOT import `vitest` at the top level. The\n// public `./vitest` barrel re-exports this file, and the build is\n// unbundled — so a bare `import … from 'vitest'` here would land a\n// runtime `import { … } from 'vitest'` at barrel module-init. `vitest`\n// is an OPTIONAL peer (declared in package.json's\n// `peerDependenciesMeta`), and the documented way to consume the config\n// helpers is from a `vitest.config.ts`; a consumer who legitimately\n// lacks `vitest` and imports the barrel would otherwise get a hard\n// `Cannot find package 'vitest'` at barrel evaluation. The\n// `VitestLifecycleHooks` shape below is matched STRUCTURALLY for the\n// same reason.\n\nimport {\n\tloadStackContext,\n\ttype LoadStackContextOptions,\n\ttype StackContext,\n} from './stack-context.ts';\nimport { resolveVitestEnv, VITEST_ENV_VARS, RECOMMENDED_TEST_STACK } from './env.ts';\nimport { VitestSetupPreconditionError } from './errors.ts';\n\n// -----------------------------------------------------------------------------\n// Captured fixture — single per-worker handle\n// -----------------------------------------------------------------------------\n//\n// Vitest workers reuse a single module-level binding across the test\n// files they run, and run those files strictly sequentially\n// (`beforeAll → its → afterAll`, then the next file). The isolation\n// guarantee that matters is therefore narrow: a file's fixture must not\n// bleed into a LATER file that forgot `useDevstackTestSetup`. That is\n// satisfied by `runDevstackAfterAll` clearing the binding at end-of-file\n// — no per-test-path keying is needed (and keying would require reading\n// `expect.getState().testPath`, forcing the forbidden top-level `vitest`\n// import; see the module header). A single binding cleared on `afterAll`\n// is both sufficient and keeps the barrel's transitive graph free of any\n// runtime `vitest` import.\n\nlet captured: StackContext | undefined;\n\n/** Return the StackContext captured by `runDevstackBeforeAll`. Returns\n * `undefined` until `beforeAll` has run (or when the suite ran with\n * `requireDevstack: false` and no manifest exists). */\nexport const getStackContext = (): StackContext | undefined => captured;\n\n/** Reset the captured fixture. Called by `runDevstackAfterAll`; also\n * exported so test helpers can wipe between describe-block setups. */\nexport const clearStackContext = (): void => {\n\tcaptured = undefined;\n};\n\n// -----------------------------------------------------------------------------\n// Options\n// -----------------------------------------------------------------------------\n\nexport interface TestSetupOptions extends LoadStackContextOptions {\n\t/** When `true`, `beforeAll` throws if no manifest is on disk. Use\n\t * for suites that depend on a live devstack and would fail\n\t * confusingly later. Default `false` (manifest is best-effort). */\n\treadonly requireDevstack?: boolean;\n\t/** Suppress the stack-name advisory. Default `false`. */\n\treadonly silent?: boolean;\n\t/** Custom writer for the advisory line. Defaults to a stderr\n\t * writer (`process.stderr.write(line + '\\n')`) — matches the\n\t * build-integration surface IO discipline (no `console.*` in\n\t * production paths). Tests substitute a buffer. */\n\treadonly writeAdvisory?: (line: string) => void;\n}\n\n// -----------------------------------------------------------------------------\n// Hooks\n// -----------------------------------------------------------------------------\n\n/** `beforeAll` body. Exported as a plain function so callers can wire\n * it into Vitest's hooks directly OR call it inline from a\n * setup-file. */\nexport const runDevstackBeforeAll = (options: TestSetupOptions = {}): void => {\n\tconst env = options.env ?? (process.env as Readonly<Record<string, string | undefined>>);\n\tconst resolved = resolveVitestEnv(env);\n\n\tif (!options.silent && !resolved.stackWasExplicit) {\n\t\tconst write =\n\t\t\toptions.writeAdvisory ?? ((line: string) => void process.stderr.write(`${line}\\n`));\n\t\twrite(\n\t\t\t`[devstack/vitest] ${VITEST_ENV_VARS.STACK} is unset; tests will read the '${resolved.stack}' stack. ` +\n\t\t\t\t`Set ${VITEST_ENV_VARS.STACK}=${RECOMMENDED_TEST_STACK} in the test script to avoid contention with \\`pnpm dev\\`.`,\n\t\t);\n\t}\n\n\tconst ctx = loadStackContext({\n\t\t...options,\n\t\trequired: options.requireDevstack === true,\n\t});\n\n\tif (options.requireDevstack === true && ctx === undefined) {\n\t\t// `loadStackContext({required: true})` should have thrown.\n\t\t// Defensive — surfaces a clearer error if a future refactor\n\t\t// changes the required-miss semantics.\n\t\tthrow new VitestSetupPreconditionError({\n\t\t\tmessage: `requireDevstack: true but loadStackContext returned undefined`,\n\t\t\thint: 'this is a devstack bug; please file an issue',\n\t\t});\n\t}\n\n\tcaptured = ctx;\n};\n\n/** `afterAll` body. Currently just clears the captured fixture; the\n * separate symbol lets us extend later (e.g. snapshot diagnostics)\n * without touching consumer setup files. */\nexport const runDevstackAfterAll = (): void => {\n\tclearStackContext();\n};\n\n// -----------------------------------------------------------------------------\n// Vitest hook registrar\n// -----------------------------------------------------------------------------\n\n/** Vitest's `beforeAll` / `afterAll` hook signatures. Match the\n * `vitest`-package shapes without importing the module (so this file\n * stays consumable by orchestrators that don't ship vitest as a\n * hard dep). */\nexport interface VitestLifecycleHooks {\n\treadonly beforeAll: (fn: () => void | Promise<void>) => void;\n\treadonly afterAll: (fn: () => void | Promise<void>) => void;\n}\n\n/**\n * Wire the devstack setup/teardown into a vitest test file's hook\n * functions. Typical usage in a `test-setup.ts`:\n *\n * import { beforeAll, afterAll } from 'vitest';\n * import { useDevstackTestSetup }\n * from '@mysten-incubation/devstack/vitest';\n *\n * useDevstackTestSetup({ beforeAll, afterAll }, { requireDevstack: true });\n *\n * The preset wires this automatically when `opts.testSetup: true`.\n */\nexport const useDevstackTestSetup = (\n\thooks: VitestLifecycleHooks,\n\toptions: TestSetupOptions = {},\n): void => {\n\thooks.beforeAll(() => runDevstackBeforeAll(options));\n\thooks.afterAll(() => runDevstackAfterAll());\n};\n"],"mappings":";;;;AAwEA,IAAI;;;;AAKJ,MAAa,wBAAkD;;;AAI/D,MAAa,0BAAgC;AAC5C,YAAW,KAAA;;;;;AA4BZ,MAAa,wBAAwB,UAA4B,EAAE,KAAW;CAE7E,MAAM,WAAW,iBADL,QAAQ,OAAQ,QAAQ,IACE;AAEtC,KAAI,CAAC,QAAQ,UAAU,CAAC,SAAS,iBAGhC,EADC,QAAQ,mBAAmB,SAAiB,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,IAAI,GAElF,qBAAqB,gBAAgB,MAAM,kCAAkC,SAAS,MAAM,eACpF,gBAAgB,MAAM,GAAG,uBAAuB,4DACxD;CAGF,MAAM,MAAM,iBAAiB;EAC5B,GAAG;EACH,UAAU,QAAQ,oBAAoB;EACtC,CAAC;AAEF,KAAI,QAAQ,oBAAoB,QAAQ,QAAQ,KAAA,EAI/C,OAAM,IAAI,6BAA6B;EACtC,SAAS;EACT,MAAM;EACN,CAAC;AAGH,YAAW;;;;;AAMZ,MAAa,4BAAkC;AAC9C,oBAAmB;;;;;;;;;;;;;;AA4BpB,MAAa,wBACZ,OACA,UAA4B,EAAE,KACpB;AACV,OAAM,gBAAgB,qBAAqB,QAAQ,CAAC;AACpD,OAAM,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"setup.mjs","names":[],"sources":["../../../src/build-integrations/vitest/setup.ts"],"sourcesContent":["// Vitest build-integration — test-setup hooks.\n//\n// Architecture (distilled/23-build-integrations.md § Per-integration\n// requirements → Vitest, § Lifecycle states): this per-file setup\n// module does NOT boot devstack. Booting is either the test file's job\n// (via `@effect/vitest`'s `it.layer(stack.layer)`) or, for `*.e2e`\n// suites, the separate `global-setup.ts` boot seam wired by\n// `devstackVitestTestConfig({ autoBoot: true })`. This module stays a\n// pure reader either way.\n//\n// But suites that talk to a LIVE devstack still need a small\n// before/after surface to:\n// - Print a one-line advisory when `DEVSTACK_STACK` is unset (the\n// test would otherwise run against `main`, contending with\n// `pnpm dev`).\n// - Optionally verify the manifest is on disk before the first\n// `it.effect` fires (cheap probe, friendly error).\n// - Optionally project the manifest into a shared fixture handle\n// suites can `import { stackContext } from './setup-fixture.ts'`.\n//\n// This module is OPT-IN. A suite wires it via Vitest's `setupFiles`\n// (or via the `useTestSetup` registrar below for programmatic\n// composition). The preset wires it automatically when\n// `opts.testSetup` is truthy.\n//\n// Hook firing order:\n// beforeAll (once per file)\n// 1. resolveVitestEnv → print stack/runtimeRoot advisory if needed\n// 2. if requireDevstack: loadStackContext({required: true})\n// else: loadStackContext() (may be undefined)\n// 3. publish to the captured fixture so `getStackContext()` works\n// synchronously inside `it`/`test` bodies\n// afterAll (once per file)\n// 4. clear the captured fixture (so a stale handle doesn't survive\n// between watch runs)\n//\n// No teardown of the devstack itself — that's the supervisor's job (or,\n// under `autoBoot`, the `global-setup.ts` teardown). This per-file setup\n// module is a pure reader.\n//\n// NOTE: this module must NOT import `vitest` at the top level. The\n// public `./vitest` barrel re-exports this file, and the build is\n// unbundled — so a bare `import … from 'vitest'` here would land a\n// runtime `import { … } from 'vitest'` at barrel module-init. `vitest`\n// is an OPTIONAL peer (declared in package.json's\n// `peerDependenciesMeta`), and the documented way to consume the config\n// helpers is from a `vitest.config.ts`; a consumer who legitimately\n// lacks `vitest` and imports the barrel would otherwise get a hard\n// `Cannot find package 'vitest'` at barrel evaluation. The\n// `VitestLifecycleHooks` shape below is matched STRUCTURALLY for the\n// same reason.\n\nimport {\n\tloadStackContext,\n\ttype LoadStackContextOptions,\n\ttype StackContext,\n} from './stack-context.ts';\nimport { resolveVitestEnv, VITEST_ENV_VARS, RECOMMENDED_TEST_STACK } from './env.ts';\nimport { VitestSetupPreconditionError } from './errors.ts';\n\n// -----------------------------------------------------------------------------\n// Captured fixture — single per-worker handle\n// -----------------------------------------------------------------------------\n//\n// Vitest workers reuse a single module-level binding across the test\n// files they run, and run those files strictly sequentially\n// (`beforeAll → its → afterAll`, then the next file). The isolation\n// guarantee that matters is therefore narrow: a file's fixture must not\n// bleed into a LATER file that forgot `useDevstackTestSetup`. That is\n// satisfied by `runDevstackAfterAll` clearing the binding at end-of-file\n// — no per-test-path keying is needed (and keying would require reading\n// `expect.getState().testPath`, forcing the forbidden top-level `vitest`\n// import; see the module header). A single binding cleared on `afterAll`\n// is both sufficient and keeps the barrel's transitive graph free of any\n// runtime `vitest` import.\n\nlet captured: StackContext | undefined;\n\n/** Return the StackContext captured by `runDevstackBeforeAll`. Returns\n * `undefined` until `beforeAll` has run (or when the suite ran with\n * `requireDevstack: false` and no manifest exists). */\nexport const getStackContext = (): StackContext | undefined => captured;\n\n/** Reset the captured fixture. Called by `runDevstackAfterAll`; also\n * exported so test helpers can wipe between describe-block setups. */\nexport const clearStackContext = (): void => {\n\tcaptured = undefined;\n};\n\n// -----------------------------------------------------------------------------\n// Options\n// -----------------------------------------------------------------------------\n\nexport interface TestSetupOptions extends LoadStackContextOptions {\n\t/** When `true`, `beforeAll` throws if no manifest is on disk. Use\n\t * for suites that depend on a live devstack and would fail\n\t * confusingly later. Default `false` (manifest is best-effort). */\n\treadonly requireDevstack?: boolean;\n\t/** Suppress the stack-name advisory. Default `false`. */\n\treadonly silent?: boolean;\n\t/** Custom writer for the advisory line. Defaults to a stderr\n\t * writer (`process.stderr.write(line + '\\n')`) — matches the\n\t * build-integration surface IO discipline (no `console.*` in\n\t * production paths). Tests substitute a buffer. */\n\treadonly writeAdvisory?: (line: string) => void;\n}\n\n// -----------------------------------------------------------------------------\n// Hooks\n// -----------------------------------------------------------------------------\n\n/** `beforeAll` body. Exported as a plain function so callers can wire\n * it into Vitest's hooks directly OR call it inline from a\n * setup-file. */\nexport const runDevstackBeforeAll = (options: TestSetupOptions = {}): void => {\n\tconst env = options.env ?? (process.env as Readonly<Record<string, string | undefined>>);\n\t// Thread the loader's walk-up start so the advisory below names the\n\t// stack `loadStackContext` will actually read (package-name rung).\n\tconst resolved = resolveVitestEnv(env, { cwd: options.cwd ?? process.cwd() });\n\n\tif (!options.silent && !resolved.stackWasExplicit) {\n\t\tconst write =\n\t\t\toptions.writeAdvisory ?? ((line: string) => void process.stderr.write(`${line}\\n`));\n\t\twrite(\n\t\t\t`[devstack/vitest] ${VITEST_ENV_VARS.STACK} is unset; tests will read the '${resolved.stack}' stack. ` +\n\t\t\t\t`Set ${VITEST_ENV_VARS.STACK}=${RECOMMENDED_TEST_STACK} in the test script to avoid contention with \\`pnpm dev\\`.`,\n\t\t);\n\t}\n\n\tconst ctx = loadStackContext({\n\t\t...options,\n\t\trequired: options.requireDevstack === true,\n\t});\n\n\tif (options.requireDevstack === true && ctx === undefined) {\n\t\t// `loadStackContext({required: true})` should have thrown.\n\t\t// Defensive — surfaces a clearer error if a future refactor\n\t\t// changes the required-miss semantics.\n\t\tthrow new VitestSetupPreconditionError({\n\t\t\tmessage: `requireDevstack: true but loadStackContext returned undefined`,\n\t\t\thint: 'this is a devstack bug; please file an issue',\n\t\t});\n\t}\n\n\tcaptured = ctx;\n};\n\n/** `afterAll` body. Currently just clears the captured fixture; the\n * separate symbol lets us extend later (e.g. snapshot diagnostics)\n * without touching consumer setup files. */\nexport const runDevstackAfterAll = (): void => {\n\tclearStackContext();\n};\n\n// -----------------------------------------------------------------------------\n// Vitest hook registrar\n// -----------------------------------------------------------------------------\n\n/** Vitest's `beforeAll` / `afterAll` hook signatures. Match the\n * `vitest`-package shapes without importing the module (so this file\n * stays consumable by orchestrators that don't ship vitest as a\n * hard dep). */\nexport interface VitestLifecycleHooks {\n\treadonly beforeAll: (fn: () => void | Promise<void>) => void;\n\treadonly afterAll: (fn: () => void | Promise<void>) => void;\n}\n\n/**\n * Wire the devstack setup/teardown into a vitest test file's hook\n * functions. Typical usage in a `test-setup.ts`:\n *\n * import { beforeAll, afterAll } from 'vitest';\n * import { useDevstackTestSetup }\n * from '@mysten-incubation/devstack/vitest';\n *\n * useDevstackTestSetup({ beforeAll, afterAll }, { requireDevstack: true });\n *\n * The preset wires this automatically when `opts.testSetup: true`.\n */\nexport const useDevstackTestSetup = (\n\thooks: VitestLifecycleHooks,\n\toptions: TestSetupOptions = {},\n): void => {\n\thooks.beforeAll(() => runDevstackBeforeAll(options));\n\thooks.afterAll(() => runDevstackAfterAll());\n};\n"],"mappings":";;;;AA4EA,IAAI;;;;AAKJ,MAAa,wBAAkD;;;AAI/D,MAAa,0BAAgC;CAC5C,WAAW,KAAA;AACZ;;;;AA2BA,MAAa,wBAAwB,UAA4B,CAAC,MAAY;CAI7E,MAAM,WAAW,iBAHL,QAAQ,OAAQ,QAAQ,KAGG,EAAE,KAAK,QAAQ,OAAO,QAAQ,IAAI,EAAE,CAAC;CAE5E,IAAI,CAAC,QAAQ,UAAU,CAAC,SAAS,kBAGhC,CADC,QAAQ,mBAAmB,SAAiB,KAAK,QAAQ,OAAO,MAAM,GAAG,KAAK,GAAG,GAAA,CAEjF,qBAAqB,gBAAgB,MAAM,kCAAkC,SAAS,MAAM,eACpF,gBAAgB,MAAM,GAAG,uBAAuB,2DACzD;CAGD,MAAM,MAAM,iBAAiB;EAC5B,GAAG;EACH,UAAU,QAAQ,oBAAoB;CACvC,CAAC;CAED,IAAI,QAAQ,oBAAoB,QAAQ,QAAQ,KAAA,GAI/C,MAAM,IAAI,6BAA6B;EACtC,SAAS;EACT,MAAM;CACP,CAAC;CAGF,WAAW;AACZ;;;;AAKA,MAAa,4BAAkC;CAC9C,kBAAkB;AACnB;;;;;;;;;;;;;AA2BA,MAAa,wBACZ,OACA,UAA4B,CAAC,MACnB;CACV,MAAM,gBAAgB,qBAAqB,OAAO,CAAC;CACnD,MAAM,eAAe,oBAAoB,CAAC;AAC3C"}
@@ -21,10 +21,12 @@ interface StackContext {
21
21
  interface LoadStackContextOptions {
22
22
  /** Starting directory for the walk-up. Defaults to `process.cwd()`. */
23
23
  readonly cwd?: string;
24
- /** Stack name override. Defaults to `process.env.DEVSTACK_STACK`
25
- * with a final fallback to `'main'`. */
24
+ /** Stack name override. Defaults to `process.env.DEVSTACK_STACK`,
25
+ * then the nearest package.json `name` above `cwd` (matching the
26
+ * CLI's `resolveStackName` inference), with a final fallback to
27
+ * `'main'`. */
26
28
  readonly stack?: string;
27
- /** Runtime root override (legacy `.devstack` directory). Defaults
29
+ /** Runtime root override. Defaults
28
30
  * to `process.env.DEVSTACK_RUNTIME_ROOT` /
29
31
  * `process.env.DEVSTACK_STATE_DIR` with a final fallback to
30
32
  * `'.devstack'`. */
@@ -35,7 +35,8 @@ const loadStackContext = (opts = {}) => {
35
35
  const env = opts.env ?? process.env;
36
36
  const { stack, stateDir: runtimeRoot } = resolveDiscoveryEnv(env, {
37
37
  ...opts.stack !== void 0 ? { stack: opts.stack } : {},
38
- ...opts.runtimeRoot !== void 0 ? { stateDir: opts.runtimeRoot } : {}
38
+ ...opts.runtimeRoot !== void 0 ? { stateDir: opts.runtimeRoot } : {},
39
+ cwd: opts.cwd ?? process.cwd()
39
40
  });
40
41
  try {
41
42
  return project(readStackContext({
@@ -67,7 +68,7 @@ const loadStackContext = (opts = {}) => {
67
68
  if (err.phase === "version") throw new VitestManifestVersionMismatchError({
68
69
  path: err.path,
69
70
  message: err.message,
70
- recovery: "upgrade @mysten-incubation/devstack to a build that matches the supervisor's manifestVersion, or run `devstack up` to regenerate the manifest with this consumer's version.",
71
+ recovery: `run \`devstack up\` to regenerate the manifest.`,
71
72
  cause: err
72
73
  });
73
74
  throw new VitestManifestShapeError({
@@ -1 +1 @@
1
- {"version":3,"file":"stack-context.mjs","names":["readStackContextRuntime"],"sources":["../../../src/build-integrations/vitest/stack-context.ts"],"sourcesContent":["// Stack-context loader for the vitest integration — thin wrapper\n// over `runtime/readStackContext`.\n//\n// The vitest preset is a passive reader of the supervisor's manifest.\n// Discovery, decode, and version-gate live in `runtime/`; this module\n// only:\n// - resolves the vitest-flavored env contract (`DEVSTACK_RUNTIME_ROOT`\n// plus legacy `DEVSTACK_STATE_DIR` alias),\n// - exposes the manifest plus `endpoint(name)` / `displayEndpoint(name)`\n// convenience accessors test bodies use,\n// - re-shapes the canonical error tags into the vitest-flavored union\n// (`VitestManifestNotFoundError` / `VitestManifestShapeError`) so\n// caller `catchTag` flows stay stable.\n\nimport {\n\tmanifestEnvelopeFromStackContext,\n\tManifestDiscoveryError,\n\tManifestShapeError,\n\treadStackContext as readStackContextRuntime,\n\tresolveBuiltInEndpointAlias,\n\tresolveDiscoveryEnv,\n\ttype ManifestEnvelope,\n\ttype StackContext as RuntimeStackContext,\n} from '../runtime/index.ts';\nimport {\n\tVitestManifestNotFoundError,\n\tVitestManifestShapeError,\n\tVitestManifestVersionMismatchError,\n} from './errors.ts';\n\n/** Read-only projection over the live manifest, scoped to the vitest\n * surface's needs. The full envelope is reconstructed (`manifest`)\n * for the test-side helpers that compare deep shapes; the convenience\n * accessors cover the common case. */\nexport interface StackContext {\n\t/** Absolute path of the manifest file the projection came from. */\n\treadonly manifestPath: string;\n\t/** Reconstructed envelope — same shape downstream consumers had\n\t * pre-consolidation. */\n\treadonly manifest: ManifestEnvelope;\n\t/** Identity tuple shortcut. */\n\treadonly identity: ManifestEnvelope['identity'];\n\t/** Flat endpoint lookup — returns the URL string or `undefined`. */\n\treadonly endpoint: (name: string) => string | undefined;\n\t/** Display URL variant — falls back to `url` when `displayUrl` is\n\t * null (the routed-vs-direct distinction the router decides). */\n\treadonly displayEndpoint: (name: string) => string | undefined;\n}\n\nexport interface LoadStackContextOptions {\n\t/** Starting directory for the walk-up. Defaults to `process.cwd()`. */\n\treadonly cwd?: string;\n\t/** Stack name override. Defaults to `process.env.DEVSTACK_STACK`\n\t * with a final fallback to `'main'`. */\n\treadonly stack?: string;\n\t/** Runtime root override (legacy `.devstack` directory). Defaults\n\t * to `process.env.DEVSTACK_RUNTIME_ROOT` /\n\t * `process.env.DEVSTACK_STATE_DIR` with a final fallback to\n\t * `'.devstack'`. */\n\treadonly runtimeRoot?: string;\n\t/** Explicit absolute manifest path. Bypasses the walk-up but is\n\t * still validated to exist. Lower precedence than the\n\t * `DEVSTACK_MANIFEST_PATH` env var. */\n\treadonly manifestPath?: string;\n\t/** Env bag for the resolver. Defaults to `process.env`. Tests pass\n\t * a fixture. */\n\treadonly env?: Readonly<Record<string, string | undefined>>;\n\t/** When `true`, throw `VitestManifestNotFoundError` on miss instead\n\t * of returning `undefined`. */\n\treadonly required?: boolean;\n}\n\nconst project = (ctx: RuntimeStackContext): StackContext => {\n\tconst envelope: ManifestEnvelope = manifestEnvelopeFromStackContext(ctx);\n\t// Alias-resolve the user-typed name BEFORE the registry lookup so\n\t// `endpoint('app')` resolves to whatever canonical key the substrate\n\t// emits (`'dev'` today). Mirrors the playwright surface\n\t// (`playwrightEndpointNameFor` in `playwright/stack-context.ts`) so\n\t// both build integrations share one alias table from\n\t// `runtime/conventional-routes.ts`. Without this, the `endpoint(name)`\n\t// accessor silently returns `undefined` for legit aliases the\n\t// playwright fixture happily accepts.\n\tconst lookup = (nameOrAlias: string) =>\n\t\tctx.endpoints.byName(resolveBuiltInEndpointAlias(nameOrAlias));\n\treturn {\n\t\tmanifestPath: ctx.manifestPath,\n\t\tmanifest: envelope,\n\t\tidentity: envelope.identity,\n\t\tendpoint: (name) => lookup(name)?.url,\n\t\tdisplayEndpoint: (name) => {\n\t\t\tconst e = lookup(name);\n\t\t\tif (e === undefined) return undefined;\n\t\t\treturn e.displayUrl ?? e.url;\n\t\t},\n\t};\n};\n\n/**\n * Read the on-disk manifest, decode against the envelope schema, and\n * return a projection. Returns `undefined` on miss; pass\n * `{ required: true }` to throw `VitestManifestNotFoundError`.\n *\n * Precedence ladder (highest → lowest):\n * 1. `env.DEVSTACK_MANIFEST_PATH`\n * 2. `opts.manifestPath`\n * 3. walk-up from `opts.cwd` looking for\n * `<runtimeRoot>/stacks/<stack>/manifest.json`\n */\nexport const loadStackContext = (opts: LoadStackContextOptions = {}): StackContext | undefined => {\n\tconst env = opts.env ?? (process.env as Readonly<Record<string, string | undefined>>);\n\t// `runtimeRoot` is the vitest-flavored name for the shared resolver's\n\t// `stateDir` rung; the ladder (option > DEVSTACK_RUNTIME_ROOT >\n\t// DEVSTACK_STATE_DIR > '.devstack') lives in `resolveDiscoveryEnv`.\n\tconst { stack, stateDir: runtimeRoot } = resolveDiscoveryEnv(env, {\n\t\t...(opts.stack !== undefined ? { stack: opts.stack } : {}),\n\t\t...(opts.runtimeRoot !== undefined ? { stateDir: opts.runtimeRoot } : {}),\n\t});\n\n\ttry {\n\t\tconst ctx = readStackContextRuntime({\n\t\t\t...(opts.cwd !== undefined ? { cwd: opts.cwd } : {}),\n\t\t\tstack,\n\t\t\tstateDir: runtimeRoot,\n\t\t\tenv,\n\t\t\t...(opts.manifestPath !== undefined ? { manifestPath: opts.manifestPath } : {}),\n\t\t});\n\t\treturn project(ctx);\n\t} catch (err) {\n\t\tif (err instanceof ManifestDiscoveryError) {\n\t\t\t// `env-missing` / `override-missing` surface regardless of\n\t\t\t// `required` — the user explicitly pointed at a file that\n\t\t\t// doesn't exist; silently returning `undefined` would\n\t\t\t// quietly fall back to cold-start defaults and hide the typo.\n\t\t\t// `required: false` only suppresses the walk-up-not-found\n\t\t\t// path (`phase: 'walk-up' | 'required-missing'`).\n\t\t\tif (err.phase === 'env-missing' || err.phase === 'override-missing') {\n\t\t\t\tthrow new VitestManifestNotFoundError({\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tsearchedFrom: opts.cwd ?? process.cwd(),\n\t\t\t\t\tstack,\n\t\t\t\t\tstateDir: runtimeRoot,\n\t\t\t\t\trecovery: `run \\`devstack up\\` (or unset DEVSTACK_MANIFEST_PATH / pass an existing manifestPath)`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (opts.required === true) {\n\t\t\t\tthrow new VitestManifestNotFoundError({\n\t\t\t\t\tmessage: `no devstack manifest found for stack '${stack}' under '${runtimeRoot}'`,\n\t\t\t\t\tsearchedFrom: opts.cwd ?? process.cwd(),\n\t\t\t\t\tstack,\n\t\t\t\t\tstateDir: runtimeRoot,\n\t\t\t\t\trecovery: `run \\`devstack up\\` (or set DEVSTACK_MANIFEST_PATH to an existing file)`,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tif (err instanceof ManifestShapeError) {\n\t\t\t// The runtime tags decode-failure, structural drift, and\n\t\t\t// version-mismatch as `phase: 'parse' | 'shape' | 'version'`.\n\t\t\t// We surface them as TWO distinct error tags so consumers can\n\t\t\t// `catchTag` independently the recovery actions diverge:\n\t\t\t//\n\t\t\t// - parse/shape → regenerate the manifest (the file is wrong)\n\t\t\t// - version upgrade the consumer dependency (your\n\t\t\t// build and the supervisor are out of sync)\n\t\t\tif (err.phase === 'version') {\n\t\t\t\tthrow new VitestManifestVersionMismatchError({\n\t\t\t\t\tpath: err.path,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\trecovery:\n\t\t\t\t\t\t`upgrade @mysten-incubation/devstack to a build that matches the ` +\n\t\t\t\t\t\t`supervisor's manifestVersion, or run \\`devstack up\\` to regenerate ` +\n\t\t\t\t\t\t`the manifest with this consumer's version.`,\n\t\t\t\t\tcause: err,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow new VitestManifestShapeError({\n\t\t\t\tphase: err.phase,\n\t\t\t\tpath: err.path,\n\t\t\t\tmessage: err.message,\n\t\t\t\trecovery:\n\t\t\t\t\terr.phase === 'parse'\n\t\t\t\t\t\t? `rm ${err.path} && devstack apply # regenerate from the registries`\n\t\t\t\t\t\t: `rm -rf <runtimeRoot>/stacks/<stack>/manifest.json && devstack apply # regenerate`,\n\t\t\t\tcause: err,\n\t\t\t});\n\t\t}\n\t\tthrow err;\n\t}\n};\n"],"mappings":";;;;;;;AAwEA,MAAM,WAAW,QAA2C;CAC3D,MAAM,WAA6B,iCAAiC,IAAI;CASxE,MAAM,UAAU,gBACf,IAAI,UAAU,OAAO,4BAA4B,YAAY,CAAC;AAC/D,QAAO;EACN,cAAc,IAAI;EAClB,UAAU;EACV,UAAU,SAAS;EACnB,WAAW,SAAS,OAAO,KAAK,EAAE;EAClC,kBAAkB,SAAS;GAC1B,MAAM,IAAI,OAAO,KAAK;AACtB,OAAI,MAAM,KAAA,EAAW,QAAO,KAAA;AAC5B,UAAO,EAAE,cAAc,EAAE;;EAE1B;;;;;;;;;;;;;AAcF,MAAa,oBAAoB,OAAgC,EAAE,KAA+B;CACjG,MAAM,MAAM,KAAK,OAAQ,QAAQ;CAIjC,MAAM,EAAE,OAAO,UAAU,gBAAgB,oBAAoB,KAAK;EACjE,GAAI,KAAK,UAAU,KAAA,IAAY,EAAE,OAAO,KAAK,OAAO,GAAG,EAAE;EACzD,GAAI,KAAK,gBAAgB,KAAA,IAAY,EAAE,UAAU,KAAK,aAAa,GAAG,EAAE;EACxE,CAAC;AAEF,KAAI;AAQH,SAAO,QAPKA,iBAAwB;GACnC,GAAI,KAAK,QAAQ,KAAA,IAAY,EAAE,KAAK,KAAK,KAAK,GAAG,EAAE;GACnD;GACA,UAAU;GACV;GACA,GAAI,KAAK,iBAAiB,KAAA,IAAY,EAAE,cAAc,KAAK,cAAc,GAAG,EAAE;GAC9E,CACiB,CAAC;UACX,KAAK;AACb,MAAI,eAAe,wBAAwB;AAO1C,OAAI,IAAI,UAAU,iBAAiB,IAAI,UAAU,mBAChD,OAAM,IAAI,4BAA4B;IACrC,SAAS,IAAI;IACb,cAAc,KAAK,OAAO,QAAQ,KAAK;IACvC;IACA,UAAU;IACV,UAAU;IACV,CAAC;AAEH,OAAI,KAAK,aAAa,KACrB,OAAM,IAAI,4BAA4B;IACrC,SAAS,yCAAyC,MAAM,WAAW,YAAY;IAC/E,cAAc,KAAK,OAAO,QAAQ,KAAK;IACvC;IACA,UAAU;IACV,UAAU;IACV,CAAC;AAEH;;AAED,MAAI,eAAe,oBAAoB;AAStC,OAAI,IAAI,UAAU,UACjB,OAAM,IAAI,mCAAmC;IAC5C,MAAM,IAAI;IACV,SAAS,IAAI;IACb,UACC;IAGD,OAAO;IACP,CAAC;AAEH,SAAM,IAAI,yBAAyB;IAClC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,SAAS,IAAI;IACb,UACC,IAAI,UAAU,UACX,MAAM,IAAI,KAAK,wDACf;IACJ,OAAO;IACP,CAAC;;AAEH,QAAM"}
1
+ {"version":3,"file":"stack-context.mjs","names":["readStackContextRuntime"],"sources":["../../../src/build-integrations/vitest/stack-context.ts"],"sourcesContent":["// Stack-context loader for the vitest integration — thin wrapper\n// over `runtime/readStackContext`.\n//\n// This module is a passive reader of the supervisor's manifest. (Booting\n// a stack for `*.e2e` suites is the separate `global-setup.ts` seam, wired\n// by `devstackVitestTestConfig({ autoBoot: true })`; this reader is\n// unaffected by it.) Discovery, decode, and version-gate live in\n// `runtime/`; this module only:\n// - resolves the vitest-flavored env contract (`DEVSTACK_RUNTIME_ROOT`\n// plus `DEVSTACK_STATE_DIR` alias),\n// - exposes the manifest plus `endpoint(name)` / `displayEndpoint(name)`\n// convenience accessors test bodies use,\n// - re-shapes the canonical error tags into the vitest-flavored union\n// (`VitestManifestNotFoundError` / `VitestManifestShapeError`) so\n// caller `catchTag` flows stay stable.\n\nimport {\n\tmanifestEnvelopeFromStackContext,\n\tManifestDiscoveryError,\n\tManifestShapeError,\n\treadStackContext as readStackContextRuntime,\n\tresolveBuiltInEndpointAlias,\n\tresolveDiscoveryEnv,\n\ttype ManifestEnvelope,\n\ttype StackContext as RuntimeStackContext,\n} from '../runtime/index.ts';\nimport {\n\tVitestManifestNotFoundError,\n\tVitestManifestShapeError,\n\tVitestManifestVersionMismatchError,\n} from './errors.ts';\n\n/** Read-only projection over the live manifest, scoped to the vitest\n * surface's needs. The full envelope is reconstructed (`manifest`)\n * for the test-side helpers that compare deep shapes; the convenience\n * accessors cover the common case. */\nexport interface StackContext {\n\t/** Absolute path of the manifest file the projection came from. */\n\treadonly manifestPath: string;\n\t/** Reconstructed envelope — same shape downstream consumers had\n\t * pre-consolidation. */\n\treadonly manifest: ManifestEnvelope;\n\t/** Identity tuple shortcut. */\n\treadonly identity: ManifestEnvelope['identity'];\n\t/** Flat endpoint lookup — returns the URL string or `undefined`. */\n\treadonly endpoint: (name: string) => string | undefined;\n\t/** Display URL variant — falls back to `url` when `displayUrl` is\n\t * null (the routed-vs-direct distinction the router decides). */\n\treadonly displayEndpoint: (name: string) => string | undefined;\n}\n\nexport interface LoadStackContextOptions {\n\t/** Starting directory for the walk-up. Defaults to `process.cwd()`. */\n\treadonly cwd?: string;\n\t/** Stack name override. Defaults to `process.env.DEVSTACK_STACK`,\n\t * then the nearest package.json `name` above `cwd` (matching the\n\t * CLI's `resolveStackName` inference), with a final fallback to\n\t * `'main'`. */\n\treadonly stack?: string;\n\t/** Runtime root override. Defaults\n\t * to `process.env.DEVSTACK_RUNTIME_ROOT` /\n\t * `process.env.DEVSTACK_STATE_DIR` with a final fallback to\n\t * `'.devstack'`. */\n\treadonly runtimeRoot?: string;\n\t/** Explicit absolute manifest path. Bypasses the walk-up but is\n\t * still validated to exist. Lower precedence than the\n\t * `DEVSTACK_MANIFEST_PATH` env var. */\n\treadonly manifestPath?: string;\n\t/** Env bag for the resolver. Defaults to `process.env`. Tests pass\n\t * a fixture. */\n\treadonly env?: Readonly<Record<string, string | undefined>>;\n\t/** When `true`, throw `VitestManifestNotFoundError` on miss instead\n\t * of returning `undefined`. */\n\treadonly required?: boolean;\n}\n\nconst project = (ctx: RuntimeStackContext): StackContext => {\n\tconst envelope: ManifestEnvelope = manifestEnvelopeFromStackContext(ctx);\n\t// Alias-resolve the user-typed name BEFORE the registry lookup so\n\t// `endpoint('app')` resolves to whatever canonical key the substrate\n\t// emits (`'dev'` today). Mirrors the playwright surface\n\t// (`playwrightEndpointNameFor` in `playwright/stack-context.ts`) so\n\t// both build integrations share one alias table from\n\t// `runtime/conventional-routes.ts`. Without this, the `endpoint(name)`\n\t// accessor silently returns `undefined` for legit aliases the\n\t// playwright fixture happily accepts.\n\tconst lookup = (nameOrAlias: string) =>\n\t\tctx.endpoints.byName(resolveBuiltInEndpointAlias(nameOrAlias));\n\treturn {\n\t\tmanifestPath: ctx.manifestPath,\n\t\tmanifest: envelope,\n\t\tidentity: envelope.identity,\n\t\tendpoint: (name) => lookup(name)?.url,\n\t\tdisplayEndpoint: (name) => {\n\t\t\tconst e = lookup(name);\n\t\t\tif (e === undefined) return undefined;\n\t\t\treturn e.displayUrl ?? e.url;\n\t\t},\n\t};\n};\n\n/**\n * Read the on-disk manifest, decode against the envelope schema, and\n * return a projection. Returns `undefined` on miss; pass\n * `{ required: true }` to throw `VitestManifestNotFoundError`.\n *\n * Precedence ladder (highest → lowest):\n * 1. `env.DEVSTACK_MANIFEST_PATH`\n * 2. `opts.manifestPath`\n * 3. walk-up from `opts.cwd` looking for\n * `<runtimeRoot>/stacks/<stack>/manifest.json`\n */\nexport const loadStackContext = (opts: LoadStackContextOptions = {}): StackContext | undefined => {\n\tconst env = opts.env ?? (process.env as Readonly<Record<string, string | undefined>>);\n\t// `runtimeRoot` is the vitest-flavored name for the shared resolver's\n\t// `stateDir` rung; the ladder (option > DEVSTACK_RUNTIME_ROOT >\n\t// DEVSTACK_STATE_DIR > '.devstack') lives in `resolveDiscoveryEnv`.\n\t// The stack rung threads the loader's walk-up start so a bare app's\n\t// package-name-derived stack (the CLI's inference) is found without\n\t// DEVSTACK_STACK being set.\n\tconst { stack, stateDir: runtimeRoot } = resolveDiscoveryEnv(env, {\n\t\t...(opts.stack !== undefined ? { stack: opts.stack } : {}),\n\t\t...(opts.runtimeRoot !== undefined ? { stateDir: opts.runtimeRoot } : {}),\n\t\tcwd: opts.cwd ?? process.cwd(),\n\t});\n\n\ttry {\n\t\tconst ctx = readStackContextRuntime({\n\t\t\t...(opts.cwd !== undefined ? { cwd: opts.cwd } : {}),\n\t\t\tstack,\n\t\t\tstateDir: runtimeRoot,\n\t\t\tenv,\n\t\t\t...(opts.manifestPath !== undefined ? { manifestPath: opts.manifestPath } : {}),\n\t\t});\n\t\treturn project(ctx);\n\t} catch (err) {\n\t\tif (err instanceof ManifestDiscoveryError) {\n\t\t\t// `env-missing` / `override-missing` surface regardless of\n\t\t\t// `required` — the user explicitly pointed at a file that\n\t\t\t// doesn't exist; silently returning `undefined` would\n\t\t\t// quietly fall back to cold-start defaults and hide the typo.\n\t\t\t// `required: false` only suppresses the walk-up-not-found\n\t\t\t// path (`phase: 'walk-up' | 'required-missing'`).\n\t\t\tif (err.phase === 'env-missing' || err.phase === 'override-missing') {\n\t\t\t\tthrow new VitestManifestNotFoundError({\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\tsearchedFrom: opts.cwd ?? process.cwd(),\n\t\t\t\t\tstack,\n\t\t\t\t\tstateDir: runtimeRoot,\n\t\t\t\t\trecovery: `run \\`devstack up\\` (or unset DEVSTACK_MANIFEST_PATH / pass an existing manifestPath)`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (opts.required === true) {\n\t\t\t\tthrow new VitestManifestNotFoundError({\n\t\t\t\t\tmessage: `no devstack manifest found for stack '${stack}' under '${runtimeRoot}'`,\n\t\t\t\t\tsearchedFrom: opts.cwd ?? process.cwd(),\n\t\t\t\t\tstack,\n\t\t\t\t\tstateDir: runtimeRoot,\n\t\t\t\t\trecovery: `run \\`devstack up\\` (or set DEVSTACK_MANIFEST_PATH to an existing file)`,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\tif (err instanceof ManifestShapeError) {\n\t\t\t// The runtime tags decode-failure, structural drift, and\n\t\t\t// version-mismatch as `phase: 'parse' | 'shape' | 'version'`.\n\t\t\t// We surface them as two distinct error tags so callers can\n\t\t\t// distinguish malformed manifests from version mismatches.\n\t\t\tif (err.phase === 'version') {\n\t\t\t\tthrow new VitestManifestVersionMismatchError({\n\t\t\t\t\tpath: err.path,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\trecovery: `run \\`devstack up\\` to regenerate the manifest.`,\n\t\t\t\t\tcause: err,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow new VitestManifestShapeError({\n\t\t\t\tphase: err.phase,\n\t\t\t\tpath: err.path,\n\t\t\t\tmessage: err.message,\n\t\t\t\trecovery:\n\t\t\t\t\terr.phase === 'parse'\n\t\t\t\t\t\t? `rm ${err.path} && devstack apply # regenerate from the registries`\n\t\t\t\t\t\t: `rm -rf <runtimeRoot>/stacks/<stack>/manifest.json && devstack apply # regenerate`,\n\t\t\t\tcause: err,\n\t\t\t});\n\t\t}\n\t\tthrow err;\n\t}\n};\n"],"mappings":";;;;;;;AA4EA,MAAM,WAAW,QAA2C;CAC3D,MAAM,WAA6B,iCAAiC,GAAG;CASvE,MAAM,UAAU,gBACf,IAAI,UAAU,OAAO,4BAA4B,WAAW,CAAC;CAC9D,OAAO;EACN,cAAc,IAAI;EAClB,UAAU;EACV,UAAU,SAAS;EACnB,WAAW,SAAS,OAAO,IAAI,CAAC,EAAE;EAClC,kBAAkB,SAAS;GAC1B,MAAM,IAAI,OAAO,IAAI;GACrB,IAAI,MAAM,KAAA,GAAW,OAAO,KAAA;GAC5B,OAAO,EAAE,cAAc,EAAE;EAC1B;CACD;AACD;;;;;;;;;;;;AAaA,MAAa,oBAAoB,OAAgC,CAAC,MAAgC;CACjG,MAAM,MAAM,KAAK,OAAQ,QAAQ;CAOjC,MAAM,EAAE,OAAO,UAAU,gBAAgB,oBAAoB,KAAK;EACjE,GAAI,KAAK,UAAU,KAAA,IAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;EACxD,GAAI,KAAK,gBAAgB,KAAA,IAAY,EAAE,UAAU,KAAK,YAAY,IAAI,CAAC;EACvE,KAAK,KAAK,OAAO,QAAQ,IAAI;CAC9B,CAAC;CAED,IAAI;EAQH,OAAO,QAPKA,iBAAwB;GACnC,GAAI,KAAK,QAAQ,KAAA,IAAY,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC;GAClD;GACA,UAAU;GACV;GACA,GAAI,KAAK,iBAAiB,KAAA,IAAY,EAAE,cAAc,KAAK,aAAa,IAAI,CAAC;EAC9E,CACiB,CAAC;CACnB,SAAS,KAAK;EACb,IAAI,eAAe,wBAAwB;GAO1C,IAAI,IAAI,UAAU,iBAAiB,IAAI,UAAU,oBAChD,MAAM,IAAI,4BAA4B;IACrC,SAAS,IAAI;IACb,cAAc,KAAK,OAAO,QAAQ,IAAI;IACtC;IACA,UAAU;IACV,UAAU;GACX,CAAC;GAEF,IAAI,KAAK,aAAa,MACrB,MAAM,IAAI,4BAA4B;IACrC,SAAS,yCAAyC,MAAM,WAAW,YAAY;IAC/E,cAAc,KAAK,OAAO,QAAQ,IAAI;IACtC;IACA,UAAU;IACV,UAAU;GACX,CAAC;GAEF;EACD;EACA,IAAI,eAAe,oBAAoB;GAKtC,IAAI,IAAI,UAAU,WACjB,MAAM,IAAI,mCAAmC;IAC5C,MAAM,IAAI;IACV,SAAS,IAAI;IACb,UAAU;IACV,OAAO;GACR,CAAC;GAEF,MAAM,IAAI,yBAAyB;IAClC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,SAAS,IAAI;IACb,UACC,IAAI,UAAU,UACX,MAAM,IAAI,KAAK,wDACf;IACJ,OAAO;GACR,CAAC;EACF;EACA,MAAM;CACP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"bail.mjs","names":[],"sources":["../../src/cli/bail.ts"],"sourcesContent":["// Verb-wiring bail helpers — promote raw `process.stderr.write` +\n// `process.exitCode = ...` shortcuts to typed `CliError` failures.\n//\n// Why this exists:\n// The dispatcher's outer `Effect.catch((error: CliError) =>\n// emitFailure(...))` in `surfaces/cli/index.ts` already knows how to\n// render a typed error AS a JSON envelope (when `--json`) or a human\n// stderr line (otherwise). Wirings that bypass the typed-error path\n// and write raw bytes to stderr break the JSON-envelope contract:\n// `devstack up --json` against a live supervisor would emit raw\n// `error: supervisor live for <app>/<stack>\\n` text on stderr instead\n// of a structured `{ok:false, error.code:'SUPERVISOR_LIVE'}` envelope\n// on stdout. The fix is to surface the failure as\n// `Effect.fail(new CliSupervisorLiveError(...))` and let the\n// dispatcher's envelope renderer handle the projection.\n//\n// This module exists so the canonical pattern is one import + one\n// function call, not a 6-line `Effect.fail(new …)` boilerplate at every\n// bail site.\n\nimport { Cause, type Exit } from 'effect';\n\nimport {\n\ttype CliConfigInvalidError,\n\ttype CliConfigNotFoundError,\n\ttype CliError,\n\tCliInternalError,\n} from '../surfaces/cli/errors.ts';\n\n/** Project a config-loader `Exit.Failure` cause to the typed `CliError`\n * the dispatcher expects. The config loader fails with\n * `CliConfigNotFoundError | CliConfigInvalidError`; defect paths (a\n * thrown non-Error) bottom out at `CliInternalError`. */\nexport const cliErrorFromConfigExit = (\n\texit: Exit.Exit<unknown, CliConfigNotFoundError | CliConfigInvalidError>,\n): CliError => {\n\tif (exit._tag === 'Success') {\n\t\t// Caller-side contract: only invoke on failure. Defensive\n\t\t// fallback returns an internal error instead of throwing so a\n\t\t// misuse doesn't crash the dispatcher.\n\t\treturn new CliInternalError({\n\t\t\tmessage: 'cliErrorFromConfigExit invoked on a successful exit',\n\t\t});\n\t}\n\tconst fail = exit.cause.reasons.find(Cause.isFailReason);\n\tif (fail !== undefined) {\n\t\tconst err = fail.error;\n\t\tif (err._tag === 'CliConfigNotFoundError' || err._tag === 'CliConfigInvalidError') {\n\t\t\treturn err;\n\t\t}\n\t}\n\treturn new CliInternalError({\n\t\tmessage: 'config load failed with an unexpected cause',\n\t\tcause: exit.cause,\n\t});\n};\n"],"mappings":";;;;;;;AAiCA,MAAa,0BACZ,SACc;AACd,KAAI,KAAK,SAAS,UAIjB,QAAO,IAAI,iBAAiB,EAC3B,SAAS,uDACT,CAAC;CAEH,MAAM,OAAO,KAAK,MAAM,QAAQ,KAAK,MAAM,aAAa;AACxD,KAAI,SAAS,KAAA,GAAW;EACvB,MAAM,MAAM,KAAK;AACjB,MAAI,IAAI,SAAS,4BAA4B,IAAI,SAAS,wBACzD,QAAO;;AAGT,QAAO,IAAI,iBAAiB;EAC3B,SAAS;EACT,OAAO,KAAK;EACZ,CAAC"}
1
+ {"version":3,"file":"bail.mjs","names":[],"sources":["../../src/cli/bail.ts"],"sourcesContent":["// Verb-wiring bail helpers — promote raw `process.stderr.write` +\n// `process.exitCode = ...` shortcuts to typed `CliError` failures.\n//\n// Why this exists:\n// The dispatcher's outer `Effect.catch((error: CliError) =>\n// emitFailure(...))` in `surfaces/cli/index.ts` already knows how to\n// render a typed error AS a JSON envelope (when `--json`) or a human\n// stderr line (otherwise). Wirings that bypass the typed-error path\n// and write raw bytes to stderr break the JSON-envelope contract:\n// `devstack up --json` against a live supervisor would emit raw\n// `error: supervisor live for <app>/<stack>\\n` text on stderr instead\n// of a structured `{ok:false, error.code:'SUPERVISOR_LIVE'}` envelope\n// on stdout. The fix is to surface the failure as\n// `Effect.fail(new CliSupervisorLiveError(...))` and let the\n// dispatcher's envelope renderer handle the projection.\n//\n// This module exists so the canonical pattern is one import + one\n// function call, not a 6-line `Effect.fail(new …)` boilerplate at every\n// bail site.\n\nimport { Cause, type Exit } from 'effect';\n\nimport {\n\ttype CliConfigInvalidError,\n\ttype CliConfigNotFoundError,\n\ttype CliError,\n\tCliInternalError,\n} from '../surfaces/cli/errors.ts';\n\n/** Project a config-loader `Exit.Failure` cause to the typed `CliError`\n * the dispatcher expects. The config loader fails with\n * `CliConfigNotFoundError | CliConfigInvalidError`; defect paths (a\n * thrown non-Error) bottom out at `CliInternalError`. */\nexport const cliErrorFromConfigExit = (\n\texit: Exit.Exit<unknown, CliConfigNotFoundError | CliConfigInvalidError>,\n): CliError => {\n\tif (exit._tag === 'Success') {\n\t\t// Caller-side contract: only invoke on failure. Defensive\n\t\t// fallback returns an internal error instead of throwing so a\n\t\t// misuse doesn't crash the dispatcher.\n\t\treturn new CliInternalError({\n\t\t\tmessage: 'cliErrorFromConfigExit invoked on a successful exit',\n\t\t});\n\t}\n\tconst fail = exit.cause.reasons.find(Cause.isFailReason);\n\tif (fail !== undefined) {\n\t\tconst err = fail.error;\n\t\tif (err._tag === 'CliConfigNotFoundError' || err._tag === 'CliConfigInvalidError') {\n\t\t\treturn err;\n\t\t}\n\t}\n\treturn new CliInternalError({\n\t\tmessage: 'config load failed with an unexpected cause',\n\t\tcause: exit.cause,\n\t});\n};\n"],"mappings":";;;;;;;AAiCA,MAAa,0BACZ,SACc;CACd,IAAI,KAAK,SAAS,WAIjB,OAAO,IAAI,iBAAiB,EAC3B,SAAS,sDACV,CAAC;CAEF,MAAM,OAAO,KAAK,MAAM,QAAQ,KAAK,MAAM,YAAY;CACvD,IAAI,SAAS,KAAA,GAAW;EACvB,MAAM,MAAM,KAAK;EACjB,IAAI,IAAI,SAAS,4BAA4B,IAAI,SAAS,yBACzD,OAAO;CAET;CACA,OAAO,IAAI,iBAAiB;EAC3B,SAAS;EACT,OAAO,KAAK;CACb,CAAC;AACF"}
@@ -11,7 +11,6 @@ import { Effect } from "effect";
11
11
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
12
12
  import { join } from "node:path";
13
13
  import { execFileSync } from "node:child_process";
14
- import { hostname } from "node:os";
15
14
  import { createConnection } from "node:net";
16
15
  //#region src/cli/doctor-probes.ts
17
16
  const okOutcome = (detail) => detail !== void 0 ? {
@@ -354,7 +353,6 @@ const locksProbe = (appRoot) => ({
354
353
  required: false,
355
354
  run: () => Effect.gen(function* () {
356
355
  if (!existsSync(appRoot)) return okOutcome("(no app root yet)");
357
- const ownHost = hostname();
358
356
  const probe = yield* LivenessProbeScope;
359
357
  let orphans = 0;
360
358
  let totalLive = 0;
@@ -373,7 +371,7 @@ const locksProbe = (appRoot) => ({
373
371
  version: 1,
374
372
  holders: []
375
373
  })));
376
- for (const holder of doc.holders) if ((yield* probe.probeHolderLiveness(holder, ownHost).pipe(Effect.catch(() => Effect.succeed("alive")))) === "alive") totalLive += 1;
374
+ for (const holder of doc.holders) if ((yield* probe.probeHolderLiveness(holder).pipe(Effect.catch(() => Effect.succeed("alive")))) === "alive") totalLive += 1;
377
375
  else orphans += 1;
378
376
  }
379
377
  } catch (cause) {