@mysten-incubation/devstack 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/README.md +7 -4
  2. package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
  5. package/dashboard-ui/index.html +2 -2
  6. package/dist/api/define-capabilities.d.mts +1 -20
  7. package/dist/api/define-capabilities.mjs +15 -22
  8. package/dist/api/define-capabilities.mjs.map +1 -1
  9. package/dist/api/define-devstack-with.d.mts +7 -1
  10. package/dist/api/define-devstack-with.mjs.map +1 -1
  11. package/dist/api/define-devstack.mjs.map +1 -1
  12. package/dist/api/define-plugin.d.mts +2 -1
  13. package/dist/api/inference-network.d.mts +31 -17
  14. package/dist/api/inference-network.mjs +40 -43
  15. package/dist/api/inference-network.mjs.map +1 -1
  16. package/dist/api/load-config.mjs +88 -0
  17. package/dist/api/load-config.mjs.map +1 -0
  18. package/dist/api/mode-narrowed-factory.d.mts +1 -1
  19. package/dist/api/mode-narrowed-factory.mjs.map +1 -1
  20. package/dist/api/run-stack-internal.mjs +202 -0
  21. package/dist/api/run-stack-internal.mjs.map +1 -0
  22. package/dist/api/run-stack.d.mts +82 -31
  23. package/dist/api/run-stack.mjs +22 -141
  24. package/dist/api/run-stack.mjs.map +1 -1
  25. package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
  26. package/dist/build-integrations/dapp-kit/index.mjs +58 -0
  27. package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
  28. package/dist/build-integrations/playwright/config.d.mts +1 -30
  29. package/dist/build-integrations/playwright/config.mjs +1 -27
  30. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  31. package/dist/build-integrations/playwright/errors.d.mts +4 -7
  32. package/dist/build-integrations/playwright/errors.mjs.map +1 -1
  33. package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
  34. package/dist/build-integrations/playwright/global-setup.mjs +142 -218
  35. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  36. package/dist/build-integrations/playwright/index.d.mts +2 -2
  37. package/dist/build-integrations/playwright/index.mjs +2 -2
  38. package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
  39. package/dist/build-integrations/playwright/stack-context.mjs +4 -2
  40. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  41. package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
  42. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  44. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
  46. package/dist/build-integrations/runtime/discover.d.mts +6 -4
  47. package/dist/build-integrations/runtime/discover.mjs +15 -4
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  49. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/errors.mjs.map +1 -1
  51. package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
  52. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  53. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
  54. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
  55. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
  57. package/dist/build-integrations/vite/index.d.mts +84 -19
  58. package/dist/build-integrations/vite/index.mjs +203 -28
  59. package/dist/build-integrations/vite/index.mjs.map +1 -1
  60. package/dist/build-integrations/vitest/config.d.mts +20 -2
  61. package/dist/build-integrations/vitest/config.mjs +16 -4
  62. package/dist/build-integrations/vitest/config.mjs.map +1 -1
  63. package/dist/build-integrations/vitest/env.d.mts +18 -10
  64. package/dist/build-integrations/vitest/env.mjs +11 -10
  65. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  66. package/dist/build-integrations/vitest/errors.d.mts +7 -11
  67. package/dist/build-integrations/vitest/errors.mjs +3 -4
  68. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  69. package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
  70. package/dist/build-integrations/vitest/global-setup.mjs +156 -0
  71. package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
  72. package/dist/build-integrations/vitest/index.d.mts +3 -2
  73. package/dist/build-integrations/vitest/index.mjs +3 -2
  74. package/dist/build-integrations/vitest/setup.mjs +2 -2
  75. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  76. package/dist/build-integrations/vitest/stack-context.d.mts +5 -3
  77. package/dist/build-integrations/vitest/stack-context.mjs +3 -2
  78. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  79. package/dist/cli/bail.mjs.map +1 -1
  80. package/dist/cli/doctor-probes.mjs +1 -3
  81. package/dist/cli/doctor-probes.mjs.map +1 -1
  82. package/dist/cli/main.d.mts +23 -1
  83. package/dist/cli/main.mjs +63 -8
  84. package/dist/cli/main.mjs.map +1 -1
  85. package/dist/cli/prune-direct.mjs.map +1 -1
  86. package/dist/cli/snapshot-reader.mjs.map +1 -1
  87. package/dist/cli/up-lifecycle.mjs.map +1 -1
  88. package/dist/cli/wirings/apply.mjs +28 -21
  89. package/dist/cli/wirings/apply.mjs.map +1 -1
  90. package/dist/cli/wirings/codegen.mjs +108 -0
  91. package/dist/cli/wirings/codegen.mjs.map +1 -0
  92. package/dist/cli/wirings/config-loader.mjs +12 -62
  93. package/dist/cli/wirings/config-loader.mjs.map +1 -1
  94. package/dist/cli/wirings/dump-ids.mjs +86 -0
  95. package/dist/cli/wirings/dump-ids.mjs.map +1 -0
  96. package/dist/cli/wirings/engine-command.mjs +1 -1
  97. package/dist/cli/wirings/engine-command.mjs.map +1 -1
  98. package/dist/cli/wirings/identity.mjs +2 -2
  99. package/dist/cli/wirings/identity.mjs.map +1 -1
  100. package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
  101. package/dist/cli/wirings/read-devstack-version.mjs +17 -0
  102. package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
  103. package/dist/cli/wirings/snapshot.mjs +27 -34
  104. package/dist/cli/wirings/snapshot.mjs.map +1 -1
  105. package/dist/cli/wirings/up-ipc.mjs +147 -0
  106. package/dist/cli/wirings/up-ipc.mjs.map +1 -0
  107. package/dist/cli/wirings/up.mjs +218 -198
  108. package/dist/cli/wirings/up.mjs.map +1 -1
  109. package/dist/cli/wirings/wipe.mjs +1 -1
  110. package/dist/cli/wirings/wipe.mjs.map +1 -1
  111. package/dist/contracts/chain-probe.d.mts +1 -1
  112. package/dist/contracts/chain-probe.mjs +1 -1
  113. package/dist/contracts/chain-probe.mjs.map +1 -1
  114. package/dist/contracts/codegenable.d.mts +60 -6
  115. package/dist/contracts/codegenable.mjs +28 -0
  116. package/dist/contracts/codegenable.mjs.map +1 -0
  117. package/dist/contracts/config-bindings.mjs +162 -0
  118. package/dist/contracts/config-bindings.mjs.map +1 -0
  119. package/dist/contracts/container-runtime.d.mts +23 -17
  120. package/dist/contracts/plugin-expander.mjs.map +1 -1
  121. package/dist/contracts/snapshotable.d.mts +5 -7
  122. package/dist/contracts/wallet-protocol.d.mts +2 -5
  123. package/dist/contracts/wallet-protocol.mjs +2 -5
  124. package/dist/contracts/wallet-protocol.mjs.map +1 -1
  125. package/dist/index.d.mts +21 -26
  126. package/dist/index.mjs +8 -9
  127. package/dist/orchestrators/boot.d.mts +28 -0
  128. package/dist/orchestrators/boot.mjs +440 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -31
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +286 -58
  151. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  152. package/dist/orchestrators/layers.mjs +31 -0
  153. package/dist/orchestrators/layers.mjs.map +1 -0
  154. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
  155. package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
  156. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
  157. package/dist/orchestrators/network-options.d.mts +52 -0
  158. package/dist/orchestrators/network-options.mjs +43 -0
  159. package/dist/orchestrators/network-options.mjs.map +1 -0
  160. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  161. package/dist/orchestrators/router/cors.mjs.map +1 -1
  162. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  163. package/dist/orchestrators/router/errors.mjs.map +1 -1
  164. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  165. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  166. package/dist/orchestrators/router/profile.mjs +1 -1
  167. package/dist/orchestrators/router/profile.mjs.map +1 -1
  168. package/dist/orchestrators/router/service.d.mts +2 -2
  169. package/dist/orchestrators/router/service.mjs +12 -27
  170. package/dist/orchestrators/router/service.mjs.map +1 -1
  171. package/dist/orchestrators/router/traefik-container.mjs +1 -1
  172. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  173. package/dist/orchestrators/snapshot/capture.mjs +171 -195
  174. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  175. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
  176. package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
  177. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  178. package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
  179. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
  180. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
  181. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
  182. package/dist/orchestrators/snapshot/index.mjs +1 -4
  183. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  184. package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
  185. package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
  186. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
  187. package/dist/orchestrators/snapshot/prune.mjs +40 -31
  188. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  189. package/dist/orchestrators/snapshot/restore.mjs +221 -196
  190. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  191. package/dist/orchestrators/snapshot/service.mjs +72 -62
  192. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  193. package/dist/orchestrators/snapshot/wipe.mjs +67 -56
  194. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  195. package/dist/plugins/account/codegen.mjs +3 -0
  196. package/dist/plugins/account/codegen.mjs.map +1 -1
  197. package/dist/plugins/account/errors.d.mts +2 -2
  198. package/dist/plugins/account/errors.mjs +1 -4
  199. package/dist/plugins/account/errors.mjs.map +1 -1
  200. package/dist/plugins/account/funding.mjs +3 -27
  201. package/dist/plugins/account/funding.mjs.map +1 -1
  202. package/dist/plugins/account/index.d.mts +3 -8
  203. package/dist/plugins/account/index.mjs +71 -35
  204. package/dist/plugins/account/index.mjs.map +1 -1
  205. package/dist/plugins/account/keypair.d.mts +8 -7
  206. package/dist/plugins/account/keypair.mjs +5 -18
  207. package/dist/plugins/account/keypair.mjs.map +1 -1
  208. package/dist/plugins/account/lease.mjs.map +1 -1
  209. package/dist/plugins/account/registry.d.mts +1 -46
  210. package/dist/plugins/account/registry.mjs.map +1 -1
  211. package/dist/plugins/account/service.d.mts +43 -34
  212. package/dist/plugins/account/service.mjs +9 -54
  213. package/dist/plugins/account/service.mjs.map +1 -1
  214. package/dist/plugins/account/snapshot.mjs.map +1 -1
  215. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
  216. package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
  217. package/dist/plugins/account/variants/signer.mjs.map +1 -1
  218. package/dist/plugins/action/discriminator.mjs.map +1 -1
  219. package/dist/plugins/action/errors.mjs +1 -4
  220. package/dist/plugins/action/errors.mjs.map +1 -1
  221. package/dist/plugins/action/execute.mjs +3 -4
  222. package/dist/plugins/action/execute.mjs.map +1 -1
  223. package/dist/plugins/action/index.d.mts +2 -2
  224. package/dist/plugins/action/index.mjs +7 -11
  225. package/dist/plugins/action/index.mjs.map +1 -1
  226. package/dist/plugins/action/service.d.mts +5 -7
  227. package/dist/plugins/action/service.mjs +2 -16
  228. package/dist/plugins/action/service.mjs.map +1 -1
  229. package/dist/plugins/coin/address-resolution.mjs.map +1 -1
  230. package/dist/plugins/coin/codegen.mjs +97 -16
  231. package/dist/plugins/coin/codegen.mjs.map +1 -1
  232. package/dist/plugins/coin/discovery.mjs.map +1 -1
  233. package/dist/plugins/coin/errors.mjs +1 -4
  234. package/dist/plugins/coin/errors.mjs.map +1 -1
  235. package/dist/plugins/coin/index.d.mts +4 -34
  236. package/dist/plugins/coin/index.mjs +47 -28
  237. package/dist/plugins/coin/index.mjs.map +1 -1
  238. package/dist/plugins/coin/metadata.d.mts +1 -0
  239. package/dist/plugins/coin/metadata.mjs +8 -9
  240. package/dist/plugins/coin/metadata.mjs.map +1 -1
  241. package/dist/plugins/coin/mint.mjs +7 -21
  242. package/dist/plugins/coin/mint.mjs.map +1 -1
  243. package/dist/plugins/coin/registry.mjs +33 -20
  244. package/dist/plugins/coin/registry.mjs.map +1 -1
  245. package/dist/plugins/coin/service.d.mts +1 -1
  246. package/dist/plugins/coin/service.mjs +1 -8
  247. package/dist/plugins/coin/service.mjs.map +1 -1
  248. package/dist/plugins/coin/snapshot.mjs.map +1 -1
  249. package/dist/plugins/coin/type-strings.mjs.map +1 -1
  250. package/dist/plugins/dashboard/domain.mjs +106 -167
  251. package/dist/plugins/dashboard/domain.mjs.map +1 -1
  252. package/dist/plugins/dashboard/index.mjs +13 -13
  253. package/dist/plugins/dashboard/index.mjs.map +1 -1
  254. package/dist/plugins/dashboard/origin-policy.mjs +3 -3
  255. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
  256. package/dist/plugins/dashboard/routable.mjs.map +1 -1
  257. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
  258. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
  259. package/dist/plugins/dashboard/schema/root.mjs +23 -44
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +37 -91
  262. package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
  263. package/dist/plugins/dashboard/schema.mjs.map +1 -1
  264. package/dist/plugins/dashboard/server.mjs.map +1 -1
  265. package/dist/plugins/deepbook/codegen.d.mts +12 -11
  266. package/dist/plugins/deepbook/codegen.mjs +108 -11
  267. package/dist/plugins/deepbook/codegen.mjs.map +1 -1
  268. package/dist/plugins/deepbook/deploy.mjs +7 -14
  269. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  270. package/dist/plugins/deepbook/errors.mjs +4 -2
  271. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  272. package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
  273. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  274. package/dist/plugins/deepbook/hash.mjs.map +1 -1
  275. package/dist/plugins/deepbook/index.d.mts +38 -34
  276. package/dist/plugins/deepbook/index.mjs +133 -64
  277. package/dist/plugins/deepbook/index.mjs.map +1 -1
  278. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
  279. package/dist/plugins/deepbook/pyth/index.mjs +4 -8
  280. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  281. package/dist/plugins/deepbook/snapshot.mjs +0 -1
  282. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  283. package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
  284. package/dist/plugins/deepbook/types.d.mts +2 -1
  285. package/dist/plugins/deepbook/types.mjs.map +1 -1
  286. package/dist/plugins/faucet/dispatcher.d.mts +3 -3
  287. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  288. package/dist/plugins/faucet/errors.mjs.map +1 -1
  289. package/dist/plugins/faucet/http.mjs +2 -10
  290. package/dist/plugins/faucet/http.mjs.map +1 -1
  291. package/dist/plugins/faucet/index.mjs +0 -1
  292. package/dist/plugins/faucet/index.mjs.map +1 -1
  293. package/dist/plugins/host-service/errors.d.mts +1 -3
  294. package/dist/plugins/host-service/errors.mjs +1 -2
  295. package/dist/plugins/host-service/errors.mjs.map +1 -1
  296. package/dist/plugins/host-service/index.d.mts +1 -2
  297. package/dist/plugins/host-service/index.mjs +11 -11
  298. package/dist/plugins/host-service/index.mjs.map +1 -1
  299. package/dist/plugins/host-service/routable.mjs.map +1 -1
  300. package/dist/plugins/host-service/service.mjs +13 -13
  301. package/dist/plugins/host-service/service.mjs.map +1 -1
  302. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
  303. package/dist/plugins/internal/codegen-helpers.mjs +2 -0
  304. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
  305. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
  306. package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
  307. package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
  308. package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
  309. package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
  310. package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
  311. package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
  312. package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
  313. package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
  314. package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
  315. package/dist/plugins/package/build.mjs +2 -2
  316. package/dist/plugins/package/build.mjs.map +1 -1
  317. package/dist/plugins/package/codegen.d.mts +7 -14
  318. package/dist/plugins/package/codegen.mjs +187 -59
  319. package/dist/plugins/package/codegen.mjs.map +1 -1
  320. package/dist/plugins/package/dep-resolution.mjs +51 -3
  321. package/dist/plugins/package/dep-resolution.mjs.map +1 -1
  322. package/dist/plugins/package/errors.mjs +1 -4
  323. package/dist/plugins/package/errors.mjs.map +1 -1
  324. package/dist/plugins/package/git-source.d.mts +18 -0
  325. package/dist/plugins/package/git-source.mjs +119 -0
  326. package/dist/plugins/package/git-source.mjs.map +1 -0
  327. package/dist/plugins/package/index.d.mts +28 -19
  328. package/dist/plugins/package/index.mjs +107 -32
  329. package/dist/plugins/package/index.mjs.map +1 -1
  330. package/dist/plugins/package/mode-known.mjs +2 -2
  331. package/dist/plugins/package/mode-known.mjs.map +1 -1
  332. package/dist/plugins/package/mode-local.mjs +18 -35
  333. package/dist/plugins/package/mode-local.mjs.map +1 -1
  334. package/dist/plugins/package/publish-executor.mjs +13 -8
  335. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  336. package/dist/plugins/package/publish-output.d.mts +1 -11
  337. package/dist/plugins/package/publish-output.mjs +1 -9
  338. package/dist/plugins/package/publish-output.mjs.map +1 -1
  339. package/dist/plugins/package/registry.d.mts +1 -1
  340. package/dist/plugins/package/registry.mjs +26 -14
  341. package/dist/plugins/package/registry.mjs.map +1 -1
  342. package/dist/plugins/package/service.mjs.map +1 -1
  343. package/dist/plugins/package/snapshot.mjs.map +1 -1
  344. package/dist/plugins/router-entrypoints.mjs +1 -3
  345. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  346. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
  347. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  348. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
  349. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  350. package/dist/plugins/seal/codegen.d.mts +1 -5
  351. package/dist/plugins/seal/codegen.mjs +83 -12
  352. package/dist/plugins/seal/codegen.mjs.map +1 -1
  353. package/dist/plugins/seal/config-render.mjs +2 -6
  354. package/dist/plugins/seal/config-render.mjs.map +1 -1
  355. package/dist/plugins/seal/deploy.mjs +18 -29
  356. package/dist/plugins/seal/deploy.mjs.map +1 -1
  357. package/dist/plugins/seal/errors.d.mts +4 -5
  358. package/dist/plugins/seal/errors.mjs +1 -8
  359. package/dist/plugins/seal/errors.mjs.map +1 -1
  360. package/dist/plugins/seal/index.d.mts +7 -28
  361. package/dist/plugins/seal/index.mjs +69 -47
  362. package/dist/plugins/seal/index.mjs.map +1 -1
  363. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  364. package/dist/plugins/seal/key-server.mjs +1 -6
  365. package/dist/plugins/seal/key-server.mjs.map +1 -1
  366. package/dist/plugins/seal/keygen.mjs +2 -3
  367. package/dist/plugins/seal/keygen.mjs.map +1 -1
  368. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  369. package/dist/plugins/seal/mode/live.mjs +1 -1
  370. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  371. package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
  372. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  373. package/dist/plugins/seal/plugin-key.mjs.map +1 -1
  374. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  375. package/dist/plugins/seal/routable.mjs.map +1 -1
  376. package/dist/plugins/seal/service.mjs.map +1 -1
  377. package/dist/plugins/seal/snapshot.mjs +1 -2
  378. package/dist/plugins/seal/snapshot.mjs.map +1 -1
  379. package/dist/plugins/sui/auto-tick.mjs +5 -5
  380. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  381. package/dist/plugins/sui/chain-build-container.mjs +2 -2
  382. package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
  383. package/dist/plugins/sui/chain-probe.mjs +4 -4
  384. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  385. package/dist/plugins/sui/codegen.d.mts +9 -7
  386. package/dist/plugins/sui/codegen.mjs +49 -46
  387. package/dist/plugins/sui/codegen.mjs.map +1 -1
  388. package/dist/plugins/sui/errors.d.mts +1 -1
  389. package/dist/plugins/sui/errors.mjs +1 -9
  390. package/dist/plugins/sui/errors.mjs.map +1 -1
  391. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
  392. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
  393. package/dist/plugins/sui/exec/index.mjs.map +1 -0
  394. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
  395. package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
  396. package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
  397. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
  398. package/dist/plugins/sui/fork-orchestration.mjs +13 -23
  399. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  400. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  401. package/dist/plugins/sui/index.d.mts +34 -83
  402. package/dist/plugins/sui/index.mjs +200 -68
  403. package/dist/plugins/sui/index.mjs.map +1 -1
  404. package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
  405. package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
  406. package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
  407. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
  408. package/dist/plugins/sui/log-attrs.mjs +11 -0
  409. package/dist/plugins/sui/log-attrs.mjs.map +1 -0
  410. package/dist/plugins/sui/mode/external.mjs +4 -12
  411. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  412. package/dist/plugins/sui/mode/fork.mjs +19 -16
  413. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  414. package/dist/plugins/sui/mode/live.mjs +4 -17
  415. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  416. package/dist/plugins/sui/mode/local.d.mts +1 -0
  417. package/dist/plugins/sui/mode/local.mjs +203 -61
  418. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  419. package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
  420. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  421. package/dist/plugins/sui/mode/shared.d.mts +6 -7
  422. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  423. package/dist/plugins/sui/mode/spec.d.mts +23 -6
  424. package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
  425. package/dist/plugins/sui/move/index.mjs.map +1 -0
  426. package/dist/plugins/sui/move-summary-runner.mjs +8 -4
  427. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
  428. package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
  429. package/dist/plugins/sui/network-resolver.d.mts +6 -6
  430. package/dist/plugins/sui/routable.mjs.map +1 -1
  431. package/dist/plugins/sui/service.mjs +10 -6
  432. package/dist/plugins/sui/service.mjs.map +1 -1
  433. package/dist/plugins/sui/snapshot.mjs +10 -5
  434. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  435. package/dist/plugins/wallet/codegen.d.mts +8 -6
  436. package/dist/plugins/wallet/codegen.mjs +4 -10
  437. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  438. package/dist/plugins/wallet/errors.mjs +1 -4
  439. package/dist/plugins/wallet/errors.mjs.map +1 -1
  440. package/dist/plugins/wallet/index.d.mts +3 -6
  441. package/dist/plugins/wallet/index.mjs +16 -21
  442. package/dist/plugins/wallet/index.mjs.map +1 -1
  443. package/dist/plugins/wallet/origin-policy.mjs +3 -3
  444. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  445. package/dist/plugins/wallet/pairing.mjs +6 -24
  446. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  447. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  448. package/dist/plugins/wallet/routable.mjs.map +1 -1
  449. package/dist/plugins/wallet/server.mjs +17 -24
  450. package/dist/plugins/wallet/server.mjs.map +1 -1
  451. package/dist/plugins/wallet/service.d.mts +2 -2
  452. package/dist/plugins/wallet/service.mjs +4 -15
  453. package/dist/plugins/wallet/service.mjs.map +1 -1
  454. package/dist/plugins/wallet/snapshot.mjs.map +1 -1
  455. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
  456. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  457. package/dist/plugins/walrus/codegen.d.mts +2 -13
  458. package/dist/plugins/walrus/codegen.mjs +93 -28
  459. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  460. package/dist/plugins/walrus/deploy-paths.mjs +2 -3
  461. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  462. package/dist/plugins/walrus/deploy.mjs +26 -19
  463. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  464. package/dist/plugins/walrus/errors.mjs +1 -8
  465. package/dist/plugins/walrus/errors.mjs.map +1 -1
  466. package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
  467. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  468. package/dist/plugins/walrus/index.d.mts +13 -44
  469. package/dist/plugins/walrus/index.mjs +119 -122
  470. package/dist/plugins/walrus/index.mjs.map +1 -1
  471. package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
  472. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  473. package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
  474. package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
  475. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  476. package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
  477. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  478. package/dist/plugins/walrus/routable.mjs.map +1 -1
  479. package/dist/plugins/walrus/service.mjs.map +1 -1
  480. package/dist/plugins/walrus/snapshot.mjs +3 -3
  481. package/dist/plugins/walrus/snapshot.mjs.map +1 -1
  482. package/dist/plugins/walrus/storage-nodes.mjs +53 -14
  483. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  484. package/dist/plugins/walrus/wal-swap.mjs +4 -8
  485. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  486. package/dist/primitives/artifact-publisher.mjs.map +1 -1
  487. package/dist/primitives/cache.d.mts +1 -1
  488. package/dist/runtime/docker/client.mjs +47 -3
  489. package/dist/runtime/docker/client.mjs.map +1 -1
  490. package/dist/runtime/docker/container.mjs +37 -57
  491. package/dist/runtime/docker/container.mjs.map +1 -1
  492. package/dist/runtime/docker/errors.mjs.map +1 -1
  493. package/dist/runtime/docker/exec.mjs +2 -2
  494. package/dist/runtime/docker/exec.mjs.map +1 -1
  495. package/dist/runtime/docker/image.mjs +10 -11
  496. package/dist/runtime/docker/image.mjs.map +1 -1
  497. package/dist/runtime/docker/index.mjs +0 -1
  498. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
  499. package/dist/runtime/docker/inventory.mjs +9 -9
  500. package/dist/runtime/docker/inventory.mjs.map +1 -1
  501. package/dist/runtime/docker/labels.mjs +12 -1
  502. package/dist/runtime/docker/labels.mjs.map +1 -1
  503. package/dist/runtime/docker/network.mjs +6 -6
  504. package/dist/runtime/docker/network.mjs.map +1 -1
  505. package/dist/runtime/docker/render-run-args.mjs.map +1 -1
  506. package/dist/runtime/docker/service.mjs +31 -45
  507. package/dist/runtime/docker/service.mjs.map +1 -1
  508. package/dist/runtime/docker/sweep.mjs +14 -64
  509. package/dist/runtime/docker/sweep.mjs.map +1 -1
  510. package/dist/runtime/docker/volume.mjs +1 -1
  511. package/dist/runtime/docker/volume.mjs.map +1 -1
  512. package/dist/runtime/docker/wrap.mjs +14 -2
  513. package/dist/runtime/docker/wrap.mjs.map +1 -1
  514. package/dist/substrate/brand.d.mts +2 -5
  515. package/dist/substrate/brand.mjs +3 -2
  516. package/dist/substrate/brand.mjs.map +1 -1
  517. package/dist/substrate/cross-process.mjs +2 -16
  518. package/dist/substrate/cross-process.mjs.map +1 -1
  519. package/dist/substrate/event-time.mjs +0 -2
  520. package/dist/substrate/event-time.mjs.map +1 -1
  521. package/dist/substrate/events.d.mts +46 -16
  522. package/dist/substrate/identity.d.mts +11 -5
  523. package/dist/substrate/manifest.d.mts +33 -26
  524. package/dist/substrate/manifest.mjs +8 -3
  525. package/dist/substrate/manifest.mjs.map +1 -1
  526. package/dist/substrate/options.d.mts +33 -4
  527. package/dist/substrate/plugin-ctx.d.mts +70 -0
  528. package/dist/substrate/plugin-ctx.mjs +66 -0
  529. package/dist/substrate/plugin-ctx.mjs.map +1 -0
  530. package/dist/substrate/plugin.d.mts +46 -38
  531. package/dist/substrate/plugin.mjs +13 -9
  532. package/dist/substrate/plugin.mjs.map +1 -1
  533. package/dist/substrate/projection.d.mts +1 -1
  534. package/dist/substrate/runtime/atomic-write.mjs +3 -4
  535. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  536. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  537. package/dist/substrate/runtime/cache/service.mjs +50 -20
  538. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  539. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  540. package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
  541. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
  542. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
  543. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
  544. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  545. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  546. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  547. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -1
  548. package/dist/substrate/runtime/cross-process/index.mjs +0 -2
  549. package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
  550. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
  551. package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
  552. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  553. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
  554. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
  555. package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
  556. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  557. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
  558. package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
  559. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  560. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  561. package/dist/substrate/runtime/errors.mjs +1 -13
  562. package/dist/substrate/runtime/errors.mjs.map +1 -1
  563. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
  564. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
  565. package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
  566. package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
  567. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  568. package/dist/substrate/runtime/http-probe.d.mts +1 -3
  569. package/dist/substrate/runtime/http-probe.mjs.map +1 -1
  570. package/dist/substrate/runtime/index.mjs +1 -6
  571. package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
  572. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  573. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
  574. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  575. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  576. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  578. package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
  579. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  580. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  582. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  583. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  585. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  587. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  589. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  590. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  592. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  593. package/dist/substrate/runtime/managed-container.mjs +8 -10
  594. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  595. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  596. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  597. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  598. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  599. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  600. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  602. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  603. package/dist/substrate/runtime/observability/index.mjs +4 -6
  604. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  605. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  606. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  607. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  608. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  610. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  614. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  615. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  616. package/dist/substrate/runtime/paths.mjs +27 -9
  617. package/dist/substrate/runtime/paths.mjs.map +1 -1
  618. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  619. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  620. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  621. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  622. package/dist/substrate/runtime/probes.d.mts +2 -3
  623. package/dist/substrate/runtime/probes.mjs.map +1 -1
  624. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  625. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  626. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/update.mjs +87 -11
  628. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  629. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  630. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  631. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  632. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  633. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  635. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  636. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  637. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  638. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  639. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  640. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  641. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  642. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  643. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  644. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  645. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  646. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  647. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  649. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  650. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  651. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  652. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  654. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  656. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  658. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  659. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  660. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  661. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  662. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  663. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
  665. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  666. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  667. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  668. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  670. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  671. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  672. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  673. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  674. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  675. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  676. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  677. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  678. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  679. package/dist/surfaces/cli/command-tree.mjs +49 -7
  680. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  681. package/dist/surfaces/cli/commands/config.mjs +1 -1
  682. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  683. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  685. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  686. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  689. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  690. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  692. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  693. package/dist/surfaces/cli/commands/status.mjs +1 -1
  694. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  695. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  697. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  698. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  699. package/dist/surfaces/cli/errors.mjs.map +1 -1
  700. package/dist/surfaces/cli/flags.mjs.map +1 -1
  701. package/dist/surfaces/cli/index.mjs +45 -14
  702. package/dist/surfaces/cli/index.mjs.map +1 -1
  703. package/dist/surfaces/cli/output.mjs.map +1 -1
  704. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  705. package/dist/surfaces/tui/app.mjs +0 -21
  706. package/dist/surfaces/tui/app.mjs.map +1 -1
  707. package/dist/surfaces/tui/dashboard.mjs +0 -48
  708. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  709. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  710. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  711. package/dist/surfaces/tui/errors.mjs.map +1 -1
  712. package/dist/surfaces/tui/event-log.mjs +0 -9
  713. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  714. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  715. package/dist/surfaces/tui/index.mjs +2 -2
  716. package/dist/surfaces/tui/index.mjs.map +1 -1
  717. package/dist/surfaces/tui/input.mjs.map +1 -1
  718. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  719. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  720. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  721. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  722. package/dist/surfaces/tui/resource-table.mjs +8 -10
  723. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  724. package/images/postgres/Dockerfile +0 -1
  725. package/images/sui/Dockerfile +27 -54
  726. package/images/sui/entrypoint.sh +17 -179
  727. package/package.json +23 -15
  728. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  729. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  730. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  731. package/dist/api/plugin-errors.d.mts +0 -7
  732. package/dist/api/plugin-errors.mjs +0 -10
  733. package/dist/api/plugin-errors.mjs.map +0 -1
  734. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  735. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  736. package/dist/contracts/capability-decl.d.mts +0 -40
  737. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  738. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  739. package/dist/orchestrators/run.mjs +0 -91
  740. package/dist/orchestrators/run.mjs.map +0 -1
  741. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  742. package/dist/orchestrators/runtime-composition.mjs +0 -252
  743. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  744. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  745. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  746. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  748. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  749. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  750. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  751. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  752. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  753. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  754. package/dist/plugins/account/spans.mjs +0 -16
  755. package/dist/plugins/account/spans.mjs.map +0 -1
  756. package/dist/plugins/account/variants/env.mjs +0 -24
  757. package/dist/plugins/account/variants/env.mjs.map +0 -1
  758. package/dist/plugins/account/variants/inline.mjs +0 -13
  759. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  760. package/dist/plugins/account/variants/keystore.mjs +0 -91
  761. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  762. package/dist/plugins/action/spans.mjs +0 -11
  763. package/dist/plugins/action/spans.mjs.map +0 -1
  764. package/dist/plugins/coin/spans.mjs +0 -20
  765. package/dist/plugins/coin/spans.mjs.map +0 -1
  766. package/dist/plugins/deepbook/spans.mjs +0 -18
  767. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  768. package/dist/plugins/faucet/spans.mjs +0 -12
  769. package/dist/plugins/faucet/spans.mjs.map +0 -1
  770. package/dist/plugins/package/spans.mjs +0 -14
  771. package/dist/plugins/package/spans.mjs.map +0 -1
  772. package/dist/plugins/postgres/codegen.mjs +0 -42
  773. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  774. package/dist/plugins/postgres/connection.d.mts +0 -33
  775. package/dist/plugins/postgres/connection.mjs.map +0 -1
  776. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  777. package/dist/plugins/postgres/errors.d.mts +0 -60
  778. package/dist/plugins/postgres/errors.mjs +0 -29
  779. package/dist/plugins/postgres/errors.mjs.map +0 -1
  780. package/dist/plugins/postgres/index.d.mts +0 -37
  781. package/dist/plugins/postgres/index.mjs +0 -68
  782. package/dist/plugins/postgres/index.mjs.map +0 -1
  783. package/dist/plugins/postgres/routable.mjs +0 -33
  784. package/dist/plugins/postgres/routable.mjs.map +0 -1
  785. package/dist/plugins/postgres/service.d.mts +0 -50
  786. package/dist/plugins/postgres/service.mjs +0 -179
  787. package/dist/plugins/postgres/service.mjs.map +0 -1
  788. package/dist/plugins/postgres/snapshot.mjs +0 -32
  789. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  790. package/dist/plugins/postgres/spans.mjs +0 -11
  791. package/dist/plugins/postgres/spans.mjs.map +0 -1
  792. package/dist/plugins/seal/spans.mjs +0 -18
  793. package/dist/plugins/seal/spans.mjs.map +0 -1
  794. package/dist/plugins/sui/spans.mjs +0 -17
  795. package/dist/plugins/sui/spans.mjs.map +0 -1
  796. package/dist/plugins/wallet/spans.mjs +0 -22
  797. package/dist/plugins/wallet/spans.mjs.map +0 -1
  798. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  799. package/dist/plugins/walrus/spans.mjs +0 -18
  800. package/dist/plugins/walrus/spans.mjs.map +0 -1
  801. package/dist/runtime/docker/logs.d.mts +0 -1
  802. package/dist/runtime/docker/logs.mjs +0 -34
  803. package/dist/runtime/docker/logs.mjs.map +0 -1
  804. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  805. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  806. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  807. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  808. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  809. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  810. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  811. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  812. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  813. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  814. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  815. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  816. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  818. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  819. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  820. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  821. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  822. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  823. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  826. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  829. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  830. package/dist/substrate/runtime/projection/index.mjs +0 -4
  831. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  832. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  833. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  834. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  835. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  836. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  837. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  839. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  840. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  841. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  842. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  844. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  845. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  846. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  847. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  850. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  851. package/dist/substrate/state-store.d.mts +0 -1
  852. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  853. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  854. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  855. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  856. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  857. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
  858. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
@@ -1,5 +1,5 @@
1
- import { DEFAULT_DISCOVERY_STACK, DEFAULT_DISCOVERY_STATE_DIR, resolveDiscoveryEnv } from "./resolve-discovery-env.mjs";
2
1
  import { inferPackageNameFromCwd, readPackageName } from "../../api/inference-network.mjs";
2
+ import { DEFAULT_DISCOVERY_STACK, DEFAULT_DISCOVERY_STATE_DIR, resolveDiscoveryEnv } from "./resolve-discovery-env.mjs";
3
3
  import { ManifestDiscoveryError } from "./errors.mjs";
4
4
  import { existsSync, readdirSync } from "node:fs";
5
5
  import { dirname, isAbsolute, join, resolve } from "node:path";
@@ -9,9 +9,19 @@ import { dirname, isAbsolute, join, resolve } from "node:path";
9
9
  * doesn't reach into the substrate package. Re-export of the
10
10
  * shared-resolver default so this module's public surface is stable. */
11
11
  const DEFAULT_STATE_DIR = DEFAULT_DISCOVERY_STATE_DIR;
12
- /** Default stack name when neither `opts.stack` nor `$DEVSTACK_STACK`
13
- * yields a useful value. */
12
+ /** Default stack name when neither `opts.stack`, `$DEVSTACK_STACK`,
13
+ * nor the package-name walk-up yields a useful value. */
14
14
  const DEFAULT_STACK = DEFAULT_DISCOVERY_STACK;
15
+ /** Explicit > `$DEVSTACK_STACK` > `'main'` — deliberately WITHOUT the
16
+ * package-name rung (no `cwd`). The sole production caller is the
17
+ * cold-start URL path (`cold-start-url.ts`), where package metadata
18
+ * supplies the APP name; deriving the stack from it too would double
19
+ * the package name into every minted hostname
20
+ * (`<service>.<pkg>.<pkg>.localhost`) — a separate decision, pinned by
21
+ * the cold-start tests. Manifest discovery, which must agree with the
22
+ * CLI about which stack a bare app runs, goes through
23
+ * `discoverManifestPath` below, which threads its walk-up cwd into the
24
+ * package rung. */
15
25
  const resolveBuildIntegrationStack = (explicit, env = process.env) => resolveDiscoveryEnv(env, explicit !== void 0 ? { stack: explicit } : {}).stack;
16
26
  /** Read `name` out of `<dir>/package.json`, strip the `@scope/`
17
27
  * prefix and any leading non-alphanumerics. Returns `undefined`
@@ -56,7 +66,8 @@ function discoverManifestPath(opts = {}) {
56
66
  const startDir = opts.cwd ?? process.cwd();
57
67
  const { stack, stateDir } = resolveDiscoveryEnv(env, {
58
68
  ...opts.stack !== void 0 ? { stack: opts.stack } : {},
59
- ...opts.stateDir !== void 0 ? { stateDir: opts.stateDir } : {}
69
+ ...opts.stateDir !== void 0 ? { stateDir: opts.stateDir } : {},
70
+ cwd: startDir
60
71
  });
61
72
  const candidates = isAbsolute(stateDir) ? [join(stateDir, "stacks", stack, "manifest.json")] : (() => {
62
73
  const acc = [];
@@ -1 +1 @@
1
- {"version":3,"file":"discover.mjs","names":[],"sources":["../../../src/build-integrations/runtime/discover.ts"],"sourcesContent":["// Manifest discovery — sync walk-up resolver.\n//\n// Read-side L5 (consumer) bridge between the on-disk manifest the\n// supervisor writes and the apps / build tools that need to find it.\n//\n// Precedence (top to bottom):\n//\n// 1. `DEVSTACK_MANIFEST_PATH` env var — top-level escape hatch. Wins\n// over every other input. If set to a missing file, returns\n// `undefined` (or throws when `required: true`).\n// 2. `override` argument — caller-explicit path. Same precedence\n// semantics as the env var, one rung lower.\n// 3. Walk up from `opts.cwd ?? process.cwd()`. At each directory,\n// check `<stateDir>/stacks/<stack>/manifest.json`. Build\n// integrations resolve `<stack>` from explicit option, then\n// `DEVSTACK_STACK`, then `main`; package metadata is app identity,\n// not an implicit manifest stack selector. The walk stops at the\n// filesystem root.\n//\n// Stack-scoped ONLY. The supervisor writes to\n// `<stateDir>/stacks/<stack>/manifest.json` exclusively; a hit at a\n// flat `<stateDir>/manifest.json` would be stale data from a deleted\n// stack, which would silently steer consumers at the wrong URLs /\n// package ids. Architecture § invariants: \"stack-scoped paths only —\n// a stale flat manifest must NOT be returned.\"\n//\n// Sync because the only host-process that drives this resolver is\n// Playwright config-load, and Playwright's loader API is sync. Cost is\n// a handful of `existsSync` calls — cheap.\n\nimport { existsSync, readdirSync } from 'node:fs';\nimport { dirname, isAbsolute, join, resolve } from 'node:path';\n\nimport { ManifestDiscoveryError } from './errors.ts';\nimport {\n\tDEFAULT_DISCOVERY_STACK,\n\tDEFAULT_DISCOVERY_STATE_DIR,\n\tresolveDiscoveryEnv,\n} from './resolve-discovery-env.ts';\nimport { inferPackageNameFromCwd, readPackageName } from '../../api/inference-network.ts';\n\n/** Default name of the supervisor's per-user state directory. Mirrors\n * the L0 path resolver. Held here as a literal so the discover walk\n * doesn't reach into the substrate package. Re-export of the\n * shared-resolver default so this module's public surface is stable. */\nexport const DEFAULT_STATE_DIR = DEFAULT_DISCOVERY_STATE_DIR;\n\n/** Default stack name when neither `opts.stack` nor `$DEVSTACK_STACK`\n * yields a useful value. */\nexport const DEFAULT_STACK = DEFAULT_DISCOVERY_STACK;\n\nexport const resolveBuildIntegrationStack = (\n\texplicit: string | undefined,\n\tenv: Readonly<Record<string, string | undefined>> = process.env,\n): string => resolveDiscoveryEnv(env, explicit !== undefined ? { stack: explicit } : {}).stack;\n\nexport interface DiscoverManifestPathOptions {\n\t/** Caller-supplied override path. Bypasses the walk-up but is still\n\t * existence-checked. Lower precedence than\n\t * `DEVSTACK_MANIFEST_PATH`. */\n\treadonly override?: string;\n\t/** Starting directory for the walk-up. Defaults to\n\t * `process.cwd()`. */\n\treadonly cwd?: string;\n\t/** Stack name. Defaults through `$DEVSTACK_STACK`, then `'main'`. */\n\treadonly stack?: string;\n\t/** State-dir name. Defaults through `$DEVSTACK_RUNTIME_ROOT`, then\n\t * the legacy `$DEVSTACK_STATE_DIR`, then `'.devstack'` (see\n\t * `resolveDiscoveryEnv`). Absolute paths are honored — the walk-up\n\t * degenerates into a single existence check in that case. */\n\treadonly stateDir?: string;\n\t/** Env bag for the env-precedence step. Defaults to `process.env`.\n\t * Tests pass a fixture (often `{}`) to suppress leaks from the\n\t * ambient environment. */\n\treadonly env?: Readonly<Record<string, string | undefined>>;\n\t/** When `true`, throw `ManifestDiscoveryError` on miss instead of\n\t * returning `undefined`. Default `false` (lets callers that treat\n\t * \"no manifest\" as cold-start branch cleanly). */\n\treadonly required?: boolean;\n}\n\n/** Read `name` out of `<dir>/package.json`, strip the `@scope/`\n * prefix and any leading non-alphanumerics. Returns `undefined`\n * when the file is missing / unreadable / has no name field. */\nexport const readAppName = readPackageName;\n\n/** Walk up from `cwd` to find the closest `package.json` and return\n * its un-scoped `name` field. Returns `undefined` if no package.json\n * is reachable. Bounded to 32 levels — defense against pathological\n * symlink loops. */\nexport const readAppNameWalkup = inferPackageNameFromCwd;\n\n/**\n * Locate an existing devstack manifest on disk. Sync — Playwright's\n * config loader and apps' startup paths both depend on this being\n * synchronous.\n *\n * Returns the absolute path of the first match per the precedence\n * documented at the top of this module, or `undefined` if no candidate\n * exists. Pass `{ required: true }` to throw `ManifestDiscoveryError`\n * on miss instead.\n */\nexport function discoverManifestPath(opts: DiscoverManifestPathOptions = {}): string | undefined {\n\tconst env = opts.env ?? (process.env as Readonly<Record<string, string | undefined>>);\n\tconst envOverride = env.DEVSTACK_MANIFEST_PATH;\n\t// Env + override misses ALWAYS throw — the `required: false` knob\n\t// only suppresses walk-up-not-found, not \"the user explicitly\n\t// pointed at a missing file.\" Silently falling back to walk-up on\n\t// a typo'd env var would steer callers at a stale ancestor manifest.\n\tif (envOverride !== undefined && envOverride !== '') {\n\t\tconst resolved = resolve(envOverride);\n\t\tif (existsSync(resolved)) return resolved;\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'env-missing',\n\t\t\tpath: resolved,\n\t\t\tmessage:\n\t\t\t\t`[devstack] DEVSTACK_MANIFEST_PATH points at ${resolved}, but no file exists there. ` +\n\t\t\t\t`Unset the env var or run \\`devstack up\\` to write the manifest.`,\n\t\t});\n\t}\n\tif (opts.override !== undefined && opts.override !== '') {\n\t\tconst resolved = resolve(opts.override);\n\t\tif (existsSync(resolved)) return resolved;\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'override-missing',\n\t\t\tpath: resolved,\n\t\t\tmessage:\n\t\t\t\t`[devstack] explicit manifest path ${resolved} does not exist. ` +\n\t\t\t\t`Run \\`devstack up\\` to write the manifest first.`,\n\t\t});\n\t}\n\tconst startDir = opts.cwd ?? process.cwd();\n\tconst { stack, stateDir } = resolveDiscoveryEnv(env, {\n\t\t...(opts.stack !== undefined ? { stack: opts.stack } : {}),\n\t\t...(opts.stateDir !== undefined ? { stateDir: opts.stateDir } : {}),\n\t});\n\t// An absolute `stateDir` / `DEVSTACK_RUNTIME_ROOT` pins the state\n\t// root, so the cwd walk-up is meaningless — `path.join` would also\n\t// drop the leading `dir` segment and mis-resolve the candidate.\n\t// Degenerate to a single existence check, mirroring\n\t// `discoverSingleStackManifestPath`.\n\tconst candidates = isAbsolute(stateDir)\n\t\t? [join(stateDir, 'stacks', stack, 'manifest.json')]\n\t\t: (() => {\n\t\t\t\tconst acc: string[] = [];\n\t\t\t\tlet dir = resolve(startDir);\n\t\t\t\twhile (true) {\n\t\t\t\t\tacc.push(join(dir, stateDir, 'stacks', stack, 'manifest.json'));\n\t\t\t\t\tconst parent = dirname(dir);\n\t\t\t\t\tif (parent === dir) return acc;\n\t\t\t\t\tdir = parent;\n\t\t\t\t}\n\t\t\t})();\n\tfor (const candidate of candidates) {\n\t\tif (existsSync(candidate)) return candidate;\n\t}\n\tif (opts.required === true) {\n\t\tconst expected = isAbsolute(stateDir)\n\t\t\t? join(stateDir, 'stacks', stack, 'manifest.json')\n\t\t\t: resolve(startDir, stateDir, 'stacks', stack, 'manifest.json');\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'walk-up',\n\t\t\tpath: expected,\n\t\t\tmessage:\n\t\t\t\t`[devstack] no manifest.json found walking up from ${startDir} ` +\n\t\t\t\t`(looked for ${stateDir}/stacks/${stack}/manifest.json at each level). ` +\n\t\t\t\t`Run \\`devstack up\\` — it writes the manifest at ${expected}.`,\n\t\t});\n\t}\n\treturn undefined;\n}\n\nexport interface DiscoverSingleStackManifestPathOptions {\n\t/** Starting directory for the walk-up. Defaults to `process.cwd()`. */\n\treadonly cwd?: string;\n\t/** State-dir name. Defaults to `.devstack`. Absolute paths are\n\t * honored — the walk-up degenerates into a single existence check\n\t * in that case. */\n\treadonly stateDir?: string;\n}\n\n/**\n * Walks up from `cwd` looking for a `<stateDir>` that contains EXACTLY\n * ONE stack subdirectory; returns that stack's `manifest.json` path.\n * Returns `null` when zero or >1 stacks are found at every ancestor.\n *\n * Used by integrations that need a no-explicit-stack auto-detect mode\n * (Playwright preset; future Vitest cold-start). The contract:\n *\n * - At each ancestor, list `<ancestor>/<stateDir>/stacks/*`.\n * - If exactly one stack dir with a `manifest.json` exists at that\n * level: return its path. Stop walking.\n * - If >1 stacks exist at that level: ambiguous → return `null` (do\n * NOT continue walking past an ambiguous level).\n * - If 0 stacks exist at that level: continue walking up.\n * - If the filesystem root is reached without resolution: return\n * `null`.\n *\n * Pure — does not consult env vars. Callers do their own gating (the\n * Playwright preset only invokes this when no explicit stack was\n * supplied via option or env).\n */\nexport const discoverSingleStackManifestPath = (\n\toptions: DiscoverSingleStackManifestPathOptions = {},\n): string | null => {\n\tconst cwd = resolve(options.cwd ?? process.cwd());\n\tconst stateDirName = options.stateDir ?? DEFAULT_STATE_DIR;\n\tconst startDirs = isAbsolute(stateDirName)\n\t\t? [stateDirName]\n\t\t: (() => {\n\t\t\t\tconst dirs: string[] = [];\n\t\t\t\tlet dir = cwd;\n\t\t\t\twhile (true) {\n\t\t\t\t\tdirs.push(join(dir, stateDirName));\n\t\t\t\t\tconst parent = dirname(dir);\n\t\t\t\t\tif (parent === dir) return dirs;\n\t\t\t\t\tdir = parent;\n\t\t\t\t}\n\t\t\t})();\n\n\tfor (const stateDir of startDirs) {\n\t\tconst stacksDir = join(stateDir, 'stacks');\n\t\tif (!existsSync(stacksDir)) continue;\n\t\tconst manifests = readdirSync(stacksDir, { withFileTypes: true })\n\t\t\t.filter((entry) => entry.isDirectory())\n\t\t\t.map((entry) => join(stacksDir, entry.name, 'manifest.json'))\n\t\t\t.filter((path) => existsSync(path))\n\t\t\t.sort();\n\t\tif (manifests.length === 1) return manifests[0]!;\n\t\tif (manifests.length > 1) return null;\n\t}\n\treturn null;\n};\n"],"mappings":";;;;;;;;;;AA6CA,MAAa,oBAAoB;;;AAIjC,MAAa,gBAAgB;AAE7B,MAAa,gCACZ,UACA,MAAoD,QAAQ,QAChD,oBAAoB,KAAK,aAAa,KAAA,IAAY,EAAE,OAAO,UAAU,GAAG,EAAE,CAAC,CAAC;;;;AA8BzF,MAAa,cAAc;;;;;AAM3B,MAAa,oBAAoB;;;;;;;;;;;AAYjC,SAAgB,qBAAqB,OAAoC,EAAE,EAAsB;CAChG,MAAM,MAAM,KAAK,OAAQ,QAAQ;CACjC,MAAM,cAAc,IAAI;AAKxB,KAAI,gBAAgB,KAAA,KAAa,gBAAgB,IAAI;EACpD,MAAM,WAAW,QAAQ,YAAY;AACrC,MAAI,WAAW,SAAS,CAAE,QAAO;AACjC,QAAM,IAAI,uBAAuB;GAChC,OAAO;GACP,MAAM;GACN,SACC,+CAA+C,SAAS;GAEzD,CAAC;;AAEH,KAAI,KAAK,aAAa,KAAA,KAAa,KAAK,aAAa,IAAI;EACxD,MAAM,WAAW,QAAQ,KAAK,SAAS;AACvC,MAAI,WAAW,SAAS,CAAE,QAAO;AACjC,QAAM,IAAI,uBAAuB;GAChC,OAAO;GACP,MAAM;GACN,SACC,qCAAqC,SAAS;GAE/C,CAAC;;CAEH,MAAM,WAAW,KAAK,OAAO,QAAQ,KAAK;CAC1C,MAAM,EAAE,OAAO,aAAa,oBAAoB,KAAK;EACpD,GAAI,KAAK,UAAU,KAAA,IAAY,EAAE,OAAO,KAAK,OAAO,GAAG,EAAE;EACzD,GAAI,KAAK,aAAa,KAAA,IAAY,EAAE,UAAU,KAAK,UAAU,GAAG,EAAE;EAClE,CAAC;CAMF,MAAM,aAAa,WAAW,SAAS,GACpC,CAAC,KAAK,UAAU,UAAU,OAAO,gBAAgB,CAAC,UAC3C;EACP,MAAM,MAAgB,EAAE;EACxB,IAAI,MAAM,QAAQ,SAAS;AAC3B,SAAO,MAAM;AACZ,OAAI,KAAK,KAAK,KAAK,UAAU,UAAU,OAAO,gBAAgB,CAAC;GAC/D,MAAM,SAAS,QAAQ,IAAI;AAC3B,OAAI,WAAW,IAAK,QAAO;AAC3B,SAAM;;KAEJ;AACN,MAAK,MAAM,aAAa,WACvB,KAAI,WAAW,UAAU,CAAE,QAAO;AAEnC,KAAI,KAAK,aAAa,MAAM;EAC3B,MAAM,WAAW,WAAW,SAAS,GAClC,KAAK,UAAU,UAAU,OAAO,gBAAgB,GAChD,QAAQ,UAAU,UAAU,UAAU,OAAO,gBAAgB;AAChE,QAAM,IAAI,uBAAuB;GAChC,OAAO;GACP,MAAM;GACN,SACC,qDAAqD,SAAS,eAC/C,SAAS,UAAU,MAAM,iFACW,SAAS;GAC7D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAmCJ,MAAa,mCACZ,UAAkD,EAAE,KACjC;CACnB,MAAM,MAAM,QAAQ,QAAQ,OAAO,QAAQ,KAAK,CAAC;CACjD,MAAM,eAAe,QAAQ,YAAY;CACzC,MAAM,YAAY,WAAW,aAAa,GACvC,CAAC,aAAa,UACP;EACP,MAAM,OAAiB,EAAE;EACzB,IAAI,MAAM;AACV,SAAO,MAAM;AACZ,QAAK,KAAK,KAAK,KAAK,aAAa,CAAC;GAClC,MAAM,SAAS,QAAQ,IAAI;AAC3B,OAAI,WAAW,IAAK,QAAO;AAC3B,SAAM;;KAEJ;AAEN,MAAK,MAAM,YAAY,WAAW;EACjC,MAAM,YAAY,KAAK,UAAU,SAAS;AAC1C,MAAI,CAAC,WAAW,UAAU,CAAE;EAC5B,MAAM,YAAY,YAAY,WAAW,EAAE,eAAe,MAAM,CAAC,CAC/D,QAAQ,UAAU,MAAM,aAAa,CAAC,CACtC,KAAK,UAAU,KAAK,WAAW,MAAM,MAAM,gBAAgB,CAAC,CAC5D,QAAQ,SAAS,WAAW,KAAK,CAAC,CAClC,MAAM;AACR,MAAI,UAAU,WAAW,EAAG,QAAO,UAAU;AAC7C,MAAI,UAAU,SAAS,EAAG,QAAO;;AAElC,QAAO"}
1
+ {"version":3,"file":"discover.mjs","names":[],"sources":["../../../src/build-integrations/runtime/discover.ts"],"sourcesContent":["// Manifest discovery — sync walk-up resolver.\n//\n// Read-side L5 (consumer) bridge between the on-disk manifest the\n// supervisor writes and the apps / build tools that need to find it.\n//\n// Precedence (top to bottom):\n//\n// 1. `DEVSTACK_MANIFEST_PATH` env var — top-level escape hatch. Wins\n// over every other input. If set to a missing file, returns\n// `undefined` (or throws when `required: true`).\n// 2. `override` argument — caller-explicit path. Same precedence\n// semantics as the env var, one rung lower.\n// 3. Walk up from `opts.cwd ?? process.cwd()`. At each directory,\n// check `<stateDir>/stacks/<stack>/manifest.json`. Build\n// integrations resolve `<stack>` with the same ladder as the CLI's\n// `resolveStackName`: explicit option, then `DEVSTACK_STACK`, then\n// the nearest package.json `name` above the walk-up start, then\n// `main`. The package rung exists because `devstack up` in a bare\n// app names the stack after the package — without it, discovery\n// (and therefore `pnpm test`) would look for a `main` manifest the\n// supervisor never wrote. The walk stops at the filesystem root.\n//\n// Stack-scoped ONLY. The supervisor writes to\n// `<stateDir>/stacks/<stack>/manifest.json` exclusively; a hit at a\n// flat `<stateDir>/manifest.json` would be stale data from a deleted\n// stack, which would silently steer consumers at the wrong URLs /\n// package ids. Architecture § invariants: \"stack-scoped paths only —\n// a stale flat manifest must NOT be returned.\"\n//\n// Sync because the only host-process that drives this resolver is\n// Playwright config-load, and Playwright's loader API is sync. Cost is\n// a handful of `existsSync` calls — cheap.\n\nimport { existsSync, readdirSync } from 'node:fs';\nimport { dirname, isAbsolute, join, resolve } from 'node:path';\n\nimport { ManifestDiscoveryError } from './errors.ts';\nimport {\n\tDEFAULT_DISCOVERY_STACK,\n\tDEFAULT_DISCOVERY_STATE_DIR,\n\tresolveDiscoveryEnv,\n} from './resolve-discovery-env.ts';\nimport { inferPackageNameFromCwd, readPackageName } from '../../api/inference-network.ts';\n\n/** Default name of the supervisor's per-user state directory. Mirrors\n * the L0 path resolver. Held here as a literal so the discover walk\n * doesn't reach into the substrate package. Re-export of the\n * shared-resolver default so this module's public surface is stable. */\nexport const DEFAULT_STATE_DIR = DEFAULT_DISCOVERY_STATE_DIR;\n\n/** Default stack name when neither `opts.stack`, `$DEVSTACK_STACK`,\n * nor the package-name walk-up yields a useful value. */\nexport const DEFAULT_STACK = DEFAULT_DISCOVERY_STACK;\n\n/** Explicit > `$DEVSTACK_STACK` > `'main'` — deliberately WITHOUT the\n * package-name rung (no `cwd`). The sole production caller is the\n * cold-start URL path (`cold-start-url.ts`), where package metadata\n * supplies the APP name; deriving the stack from it too would double\n * the package name into every minted hostname\n * (`<service>.<pkg>.<pkg>.localhost`) — a separate decision, pinned by\n * the cold-start tests. Manifest discovery, which must agree with the\n * CLI about which stack a bare app runs, goes through\n * `discoverManifestPath` below, which threads its walk-up cwd into the\n * package rung. */\nexport const resolveBuildIntegrationStack = (\n\texplicit: string | undefined,\n\tenv: Readonly<Record<string, string | undefined>> = process.env,\n): string => resolveDiscoveryEnv(env, explicit !== undefined ? { stack: explicit } : {}).stack;\n\nexport interface DiscoverManifestPathOptions {\n\t/** Caller-supplied override path. Bypasses the walk-up but is still\n\t * existence-checked. Lower precedence than\n\t * `DEVSTACK_MANIFEST_PATH`. */\n\treadonly override?: string;\n\t/** Starting directory for the walk-up. Defaults to\n\t * `process.cwd()`. */\n\treadonly cwd?: string;\n\t/** Stack name. Defaults through `$DEVSTACK_STACK`, then the nearest\n\t * package.json `name` above `cwd` (the CLI's stack-inference rung),\n\t * then `'main'`. */\n\treadonly stack?: string;\n\t/** State-dir name. Defaults through `$DEVSTACK_RUNTIME_ROOT`, then\n\t * `$DEVSTACK_STATE_DIR`, then `'.devstack'` (see\n\t * `resolveDiscoveryEnv`). Absolute paths are honored — the walk-up\n\t * degenerates into a single existence check in that case. */\n\treadonly stateDir?: string;\n\t/** Env bag for the env-precedence step. Defaults to `process.env`.\n\t * Tests pass a fixture (often `{}`) to suppress leaks from the\n\t * ambient environment. */\n\treadonly env?: Readonly<Record<string, string | undefined>>;\n\t/** When `true`, throw `ManifestDiscoveryError` on miss instead of\n\t * returning `undefined`. Default `false` (lets callers that treat\n\t * \"no manifest\" as cold-start branch cleanly). */\n\treadonly required?: boolean;\n}\n\n/** Read `name` out of `<dir>/package.json`, strip the `@scope/`\n * prefix and any leading non-alphanumerics. Returns `undefined`\n * when the file is missing / unreadable / has no name field. */\nexport const readAppName = readPackageName;\n\n/** Walk up from `cwd` to find the closest `package.json` and return\n * its un-scoped `name` field. Returns `undefined` if no package.json\n * is reachable. Bounded to 32 levels — defense against pathological\n * symlink loops. */\nexport const readAppNameWalkup = inferPackageNameFromCwd;\n\n/**\n * Locate an existing devstack manifest on disk. Sync — Playwright's\n * config loader and apps' startup paths both depend on this being\n * synchronous.\n *\n * Returns the absolute path of the first match per the precedence\n * documented at the top of this module, or `undefined` if no candidate\n * exists. Pass `{ required: true }` to throw `ManifestDiscoveryError`\n * on miss instead.\n */\nexport function discoverManifestPath(opts: DiscoverManifestPathOptions = {}): string | undefined {\n\tconst env = opts.env ?? (process.env as Readonly<Record<string, string | undefined>>);\n\tconst envOverride = env.DEVSTACK_MANIFEST_PATH;\n\t// Env + override misses ALWAYS throw — the `required: false` knob\n\t// only suppresses walk-up-not-found, not \"the user explicitly\n\t// pointed at a missing file.\" Silently falling back to walk-up on\n\t// a typo'd env var would steer callers at a stale ancestor manifest.\n\tif (envOverride !== undefined && envOverride !== '') {\n\t\tconst resolved = resolve(envOverride);\n\t\tif (existsSync(resolved)) return resolved;\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'env-missing',\n\t\t\tpath: resolved,\n\t\t\tmessage:\n\t\t\t\t`[devstack] DEVSTACK_MANIFEST_PATH points at ${resolved}, but no file exists there. ` +\n\t\t\t\t`Unset the env var or run \\`devstack up\\` to write the manifest.`,\n\t\t});\n\t}\n\tif (opts.override !== undefined && opts.override !== '') {\n\t\tconst resolved = resolve(opts.override);\n\t\tif (existsSync(resolved)) return resolved;\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'override-missing',\n\t\t\tpath: resolved,\n\t\t\tmessage:\n\t\t\t\t`[devstack] explicit manifest path ${resolved} does not exist. ` +\n\t\t\t\t`Run \\`devstack up\\` to write the manifest first.`,\n\t\t});\n\t}\n\tconst startDir = opts.cwd ?? process.cwd();\n\tconst { stack, stateDir } = resolveDiscoveryEnv(env, {\n\t\t...(opts.stack !== undefined ? { stack: opts.stack } : {}),\n\t\t...(opts.stateDir !== undefined ? { stateDir: opts.stateDir } : {}),\n\t\t// Package-name rung: infer from the same dir the manifest walk-up\n\t\t// starts at, so \"which stack\" and \"where to look\" always agree.\n\t\tcwd: startDir,\n\t});\n\t// An absolute `stateDir` / `DEVSTACK_RUNTIME_ROOT` pins the state\n\t// root, so the cwd walk-up is meaningless — `path.join` would also\n\t// drop the leading `dir` segment and mis-resolve the candidate.\n\t// Degenerate to a single existence check, mirroring\n\t// `discoverSingleStackManifestPath`.\n\tconst candidates = isAbsolute(stateDir)\n\t\t? [join(stateDir, 'stacks', stack, 'manifest.json')]\n\t\t: (() => {\n\t\t\t\tconst acc: string[] = [];\n\t\t\t\tlet dir = resolve(startDir);\n\t\t\t\twhile (true) {\n\t\t\t\t\tacc.push(join(dir, stateDir, 'stacks', stack, 'manifest.json'));\n\t\t\t\t\tconst parent = dirname(dir);\n\t\t\t\t\tif (parent === dir) return acc;\n\t\t\t\t\tdir = parent;\n\t\t\t\t}\n\t\t\t})();\n\tfor (const candidate of candidates) {\n\t\tif (existsSync(candidate)) return candidate;\n\t}\n\tif (opts.required === true) {\n\t\tconst expected = isAbsolute(stateDir)\n\t\t\t? join(stateDir, 'stacks', stack, 'manifest.json')\n\t\t\t: resolve(startDir, stateDir, 'stacks', stack, 'manifest.json');\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'walk-up',\n\t\t\tpath: expected,\n\t\t\tmessage:\n\t\t\t\t`[devstack] no manifest.json found walking up from ${startDir} ` +\n\t\t\t\t`(looked for ${stateDir}/stacks/${stack}/manifest.json at each level). ` +\n\t\t\t\t`Run \\`devstack up\\` — it writes the manifest at ${expected}.`,\n\t\t});\n\t}\n\treturn undefined;\n}\n\nexport interface DiscoverSingleStackManifestPathOptions {\n\t/** Starting directory for the walk-up. Defaults to `process.cwd()`. */\n\treadonly cwd?: string;\n\t/** State-dir name. Defaults to `.devstack`. Absolute paths are\n\t * honored — the walk-up degenerates into a single existence check\n\t * in that case. */\n\treadonly stateDir?: string;\n}\n\n/**\n * Walks up from `cwd` looking for a `<stateDir>` that contains EXACTLY\n * ONE stack subdirectory; returns that stack's `manifest.json` path.\n * Returns `null` when zero or >1 stacks are found at every ancestor.\n *\n * Used by integrations that need a no-explicit-stack auto-detect mode\n * (Playwright preset; future Vitest cold-start). The contract:\n *\n * - At each ancestor, list `<ancestor>/<stateDir>/stacks/*`.\n * - If exactly one stack dir with a `manifest.json` exists at that\n * level: return its path. Stop walking.\n * - If >1 stacks exist at that level: ambiguous → return `null` (do\n * NOT continue walking past an ambiguous level).\n * - If 0 stacks exist at that level: continue walking up.\n * - If the filesystem root is reached without resolution: return\n * `null`.\n *\n * Pure — does not consult env vars. Callers do their own gating (the\n * Playwright preset only invokes this when no explicit stack was\n * supplied via option or env).\n */\nexport const discoverSingleStackManifestPath = (\n\toptions: DiscoverSingleStackManifestPathOptions = {},\n): string | null => {\n\tconst cwd = resolve(options.cwd ?? process.cwd());\n\tconst stateDirName = options.stateDir ?? DEFAULT_STATE_DIR;\n\tconst startDirs = isAbsolute(stateDirName)\n\t\t? [stateDirName]\n\t\t: (() => {\n\t\t\t\tconst dirs: string[] = [];\n\t\t\t\tlet dir = cwd;\n\t\t\t\twhile (true) {\n\t\t\t\t\tdirs.push(join(dir, stateDirName));\n\t\t\t\t\tconst parent = dirname(dir);\n\t\t\t\t\tif (parent === dir) return dirs;\n\t\t\t\t\tdir = parent;\n\t\t\t\t}\n\t\t\t})();\n\n\tfor (const stateDir of startDirs) {\n\t\tconst stacksDir = join(stateDir, 'stacks');\n\t\tif (!existsSync(stacksDir)) continue;\n\t\tconst manifests = readdirSync(stacksDir, { withFileTypes: true })\n\t\t\t.filter((entry) => entry.isDirectory())\n\t\t\t.map((entry) => join(stacksDir, entry.name, 'manifest.json'))\n\t\t\t.filter((path) => existsSync(path))\n\t\t\t.sort();\n\t\tif (manifests.length === 1) return manifests[0]!;\n\t\tif (manifests.length > 1) return null;\n\t}\n\treturn null;\n};\n"],"mappings":";;;;;;;;;;AAgDA,MAAa,oBAAoB;;;AAIjC,MAAa,gBAAgB;;;;;;;;;;;AAY7B,MAAa,gCACZ,UACA,MAAoD,QAAQ,QAChD,oBAAoB,KAAK,aAAa,KAAA,IAAY,EAAE,OAAO,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC;;;;AAgCzF,MAAa,cAAc;;;;;AAM3B,MAAa,oBAAoB;;;;;;;;;;;AAYjC,SAAgB,qBAAqB,OAAoC,CAAC,GAAuB;CAChG,MAAM,MAAM,KAAK,OAAQ,QAAQ;CACjC,MAAM,cAAc,IAAI;CAKxB,IAAI,gBAAgB,KAAA,KAAa,gBAAgB,IAAI;EACpD,MAAM,WAAW,QAAQ,WAAW;EACpC,IAAI,WAAW,QAAQ,GAAG,OAAO;EACjC,MAAM,IAAI,uBAAuB;GAChC,OAAO;GACP,MAAM;GACN,SACC,+CAA+C,SAAS;EAE1D,CAAC;CACF;CACA,IAAI,KAAK,aAAa,KAAA,KAAa,KAAK,aAAa,IAAI;EACxD,MAAM,WAAW,QAAQ,KAAK,QAAQ;EACtC,IAAI,WAAW,QAAQ,GAAG,OAAO;EACjC,MAAM,IAAI,uBAAuB;GAChC,OAAO;GACP,MAAM;GACN,SACC,qCAAqC,SAAS;EAEhD,CAAC;CACF;CACA,MAAM,WAAW,KAAK,OAAO,QAAQ,IAAI;CACzC,MAAM,EAAE,OAAO,aAAa,oBAAoB,KAAK;EACpD,GAAI,KAAK,UAAU,KAAA,IAAY,EAAE,OAAO,KAAK,MAAM,IAAI,CAAC;EACxD,GAAI,KAAK,aAAa,KAAA,IAAY,EAAE,UAAU,KAAK,SAAS,IAAI,CAAC;EAGjE,KAAK;CACN,CAAC;CAMD,MAAM,aAAa,WAAW,QAAQ,IACnC,CAAC,KAAK,UAAU,UAAU,OAAO,eAAe,CAAC,WAC1C;EACP,MAAM,MAAgB,CAAC;EACvB,IAAI,MAAM,QAAQ,QAAQ;EAC1B,OAAO,MAAM;GACZ,IAAI,KAAK,KAAK,KAAK,UAAU,UAAU,OAAO,eAAe,CAAC;GAC9D,MAAM,SAAS,QAAQ,GAAG;GAC1B,IAAI,WAAW,KAAK,OAAO;GAC3B,MAAM;EACP;CACD,EAAA,CAAG;CACL,KAAK,MAAM,aAAa,YACvB,IAAI,WAAW,SAAS,GAAG,OAAO;CAEnC,IAAI,KAAK,aAAa,MAAM;EAC3B,MAAM,WAAW,WAAW,QAAQ,IACjC,KAAK,UAAU,UAAU,OAAO,eAAe,IAC/C,QAAQ,UAAU,UAAU,UAAU,OAAO,eAAe;EAC/D,MAAM,IAAI,uBAAuB;GAChC,OAAO;GACP,MAAM;GACN,SACC,qDAAqD,SAAS,eAC/C,SAAS,UAAU,MAAM,iFACW,SAAS;EAC9D,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,mCACZ,UAAkD,CAAC,MAChC;CACnB,MAAM,MAAM,QAAQ,QAAQ,OAAO,QAAQ,IAAI,CAAC;CAChD,MAAM,eAAe,QAAQ,YAAY;CACzC,MAAM,YAAY,WAAW,YAAY,IACtC,CAAC,YAAY,WACN;EACP,MAAM,OAAiB,CAAC;EACxB,IAAI,MAAM;EACV,OAAO,MAAM;GACZ,KAAK,KAAK,KAAK,KAAK,YAAY,CAAC;GACjC,MAAM,SAAS,QAAQ,GAAG;GAC1B,IAAI,WAAW,KAAK,OAAO;GAC3B,MAAM;EACP;CACD,EAAA,CAAG;CAEL,KAAK,MAAM,YAAY,WAAW;EACjC,MAAM,YAAY,KAAK,UAAU,QAAQ;EACzC,IAAI,CAAC,WAAW,SAAS,GAAG;EAC5B,MAAM,YAAY,YAAY,WAAW,EAAE,eAAe,KAAK,CAAC,CAAC,CAC/D,QAAQ,UAAU,MAAM,YAAY,CAAC,CAAC,CACtC,KAAK,UAAU,KAAK,WAAW,MAAM,MAAM,eAAe,CAAC,CAAC,CAC5D,QAAQ,SAAS,WAAW,IAAI,CAAC,CAAC,CAClC,KAAK;EACP,IAAI,UAAU,WAAW,GAAG,OAAO,UAAU;EAC7C,IAAI,UAAU,SAAS,GAAG,OAAO;CAClC;CACA,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint-registry.mjs","names":[],"sources":["../../../src/build-integrations/runtime/endpoint-registry.ts"],"sourcesContent":["// Typed endpoint lookup.\n//\n// `EndpointRegistry` wraps the manifest's flat `endpoints` map with\n// the small set of queries every consumer asks of it:\n//\n// - `byName(name)`: the load-bearing lookup. Playwright `baseURL`\n// and codegen emitters all key off endpoint name.\n// - `byPluginKey(key)`: group endpoints by the plugin that emitted\n// them. The CLI `status` command uses this to print one block\n// per plugin.\n// - `byKind(kind)`: filter on `wireProtocol` — currently one of\n// `'http' | 'h2c' | 'tcp'`. Cheap projection; lets callers filter\n// the gRPC or raw-TCP endpoints out of an HTTP-only health check.\n// - `all()`: stable-ordered iteration. Order is alphabetical by\n// endpoint name — the manifest writer emits in input-order, but\n// consumer iteration shouldn't depend on plugin registration\n// order.\n//\n// Plain class — no Effect, no Schema. Callable from any consumer\n// runtime (Node, browser bundle that imported the manifest via the\n// build-integration alias).\n\nimport type { ResolvedEndpoint } from './stack-context.ts';\n\n/** Read-only registry over the manifest's `endpoints` map. */\nexport class EndpointRegistry {\n\tprivate readonly entries: ReadonlyArray<ResolvedEndpoint>;\n\tprivate readonly byNameIndex: ReadonlyMap<string, ResolvedEndpoint>;\n\n\tconstructor(entries: ReadonlyArray<ResolvedEndpoint>) {\n\t\t// Defensive: sort by name so iteration is stable across\n\t\t// supervisor runs even if the writer hashed plugins in a\n\t\t// different order this time.\n\t\tconst sorted = [...entries].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));\n\t\tthis.entries = sorted;\n\t\tconst map = new Map<string, ResolvedEndpoint>();\n\t\tfor (const entry of sorted) map.set(entry.name, entry);\n\t\tthis.byNameIndex = map;\n\t}\n\n\t/** Look up an endpoint by its declared name. Returns `undefined`\n\t * when the name isn't in the manifest — callers that want a hard\n\t * fail should `??` to a thrown error. */\n\tbyName(name: string): ResolvedEndpoint | undefined {\n\t\treturn this.byNameIndex.get(name);\n\t}\n\n\t/** Group endpoints by the plugin that emitted them. Used by the\n\t * CLI status output. */\n\tbyPluginKey(pluginKey: string): ReadonlyArray<ResolvedEndpoint> {\n\t\treturn this.entries.filter((e) => e.pluginKey === pluginKey);\n\t}\n\n\t/** Filter endpoints by wire protocol — currently `'http' | 'h2c' |\n\t * 'tcp'`. Typed as `string` for forward-compat with plugin-added\n\t * protocols; mistyped values just return an empty array. */\n\tbyKind(wireProtocol: string): ReadonlyArray<ResolvedEndpoint> {\n\t\treturn this.entries.filter((e) => e.wireProtocol === wireProtocol);\n\t}\n\n\t/** All endpoints, alphabetical by name. */\n\tall(): ReadonlyArray<ResolvedEndpoint> {\n\t\treturn this.entries;\n\t}\n\n\t/** Names of every endpoint, alphabetical. Convenience for error\n\t * messages that want to list \"the supported names are: ...\". */\n\tnames(): ReadonlyArray<string> {\n\t\treturn this.entries.map((e) => e.name);\n\t}\n}\n"],"mappings":";;AAyBA,IAAa,mBAAb,MAA8B;CAC7B;CACA;CAEA,YAAY,SAA0C;EAIrD,MAAM,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,MAAO,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI,EAAG;AAC5F,OAAK,UAAU;EACf,MAAM,sBAAM,IAAI,KAA+B;AAC/C,OAAK,MAAM,SAAS,OAAQ,KAAI,IAAI,MAAM,MAAM,MAAM;AACtD,OAAK,cAAc;;;;;CAMpB,OAAO,MAA4C;AAClD,SAAO,KAAK,YAAY,IAAI,KAAK;;;;CAKlC,YAAY,WAAoD;AAC/D,SAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,cAAc,UAAU;;;;;CAM7D,OAAO,cAAuD;AAC7D,SAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,iBAAiB,aAAa;;;CAInE,MAAuC;AACtC,SAAO,KAAK;;;;CAKb,QAA+B;AAC9B,SAAO,KAAK,QAAQ,KAAK,MAAM,EAAE,KAAK"}
1
+ {"version":3,"file":"endpoint-registry.mjs","names":[],"sources":["../../../src/build-integrations/runtime/endpoint-registry.ts"],"sourcesContent":["// Typed endpoint lookup.\n//\n// `EndpointRegistry` wraps the manifest's flat `endpoints` map with\n// the small set of queries every consumer asks of it:\n//\n// - `byName(name)`: the load-bearing lookup. Playwright `baseURL`\n// and codegen emitters all key off endpoint name.\n// - `byPluginKey(key)`: group endpoints by the plugin that emitted\n// them. The CLI `status` command uses this to print one block\n// per plugin.\n// - `byKind(kind)`: filter on `wireProtocol` — currently one of\n// `'http' | 'h2c' | 'tcp'`. Cheap projection; lets callers filter\n// the gRPC or raw-TCP endpoints out of an HTTP-only health check.\n// - `all()`: stable-ordered iteration. Order is alphabetical by\n// endpoint name — the manifest writer emits in input-order, but\n// consumer iteration shouldn't depend on plugin registration\n// order.\n//\n// Plain class — no Effect, no Schema. Callable from any consumer\n// runtime (Node, browser bundle that imported the manifest via the\n// build-integration alias).\n\nimport type { ResolvedEndpoint } from './stack-context.ts';\n\n/** Read-only registry over the manifest's `endpoints` map. */\nexport class EndpointRegistry {\n\tprivate readonly entries: ReadonlyArray<ResolvedEndpoint>;\n\tprivate readonly byNameIndex: ReadonlyMap<string, ResolvedEndpoint>;\n\n\tconstructor(entries: ReadonlyArray<ResolvedEndpoint>) {\n\t\t// Defensive: sort by name so iteration is stable across\n\t\t// supervisor runs even if the writer hashed plugins in a\n\t\t// different order this time.\n\t\tconst sorted = [...entries].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));\n\t\tthis.entries = sorted;\n\t\tconst map = new Map<string, ResolvedEndpoint>();\n\t\tfor (const entry of sorted) map.set(entry.name, entry);\n\t\tthis.byNameIndex = map;\n\t}\n\n\t/** Look up an endpoint by its declared name. Returns `undefined`\n\t * when the name isn't in the manifest — callers that want a hard\n\t * fail should `??` to a thrown error. */\n\tbyName(name: string): ResolvedEndpoint | undefined {\n\t\treturn this.byNameIndex.get(name);\n\t}\n\n\t/** Group endpoints by the plugin that emitted them. Used by the\n\t * CLI status output. */\n\tbyPluginKey(pluginKey: string): ReadonlyArray<ResolvedEndpoint> {\n\t\treturn this.entries.filter((e) => e.pluginKey === pluginKey);\n\t}\n\n\t/** Filter endpoints by wire protocol — currently `'http' | 'h2c' |\n\t * 'tcp'`. Typed as `string` for forward-compat with plugin-added\n\t * protocols; mistyped values just return an empty array. */\n\tbyKind(wireProtocol: string): ReadonlyArray<ResolvedEndpoint> {\n\t\treturn this.entries.filter((e) => e.wireProtocol === wireProtocol);\n\t}\n\n\t/** All endpoints, alphabetical by name. */\n\tall(): ReadonlyArray<ResolvedEndpoint> {\n\t\treturn this.entries;\n\t}\n\n\t/** Names of every endpoint, alphabetical. Convenience for error\n\t * messages that want to list \"the supported names are: ...\". */\n\tnames(): ReadonlyArray<string> {\n\t\treturn this.entries.map((e) => e.name);\n\t}\n}\n"],"mappings":";;AAyBA,IAAa,mBAAb,MAA8B;CAC7B;CACA;CAEA,YAAY,SAA0C;EAIrD,MAAM,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,GAAG,MAAO,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,IAAI,CAAE;EAC3F,KAAK,UAAU;EACf,MAAM,sBAAM,IAAI,IAA8B;EAC9C,KAAK,MAAM,SAAS,QAAQ,IAAI,IAAI,MAAM,MAAM,KAAK;EACrD,KAAK,cAAc;CACpB;;;;CAKA,OAAO,MAA4C;EAClD,OAAO,KAAK,YAAY,IAAI,IAAI;CACjC;;;CAIA,YAAY,WAAoD;EAC/D,OAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,cAAc,SAAS;CAC5D;;;;CAKA,OAAO,cAAuD;EAC7D,OAAO,KAAK,QAAQ,QAAQ,MAAM,EAAE,iBAAiB,YAAY;CAClE;;CAGA,MAAuC;EACtC,OAAO,KAAK;CACb;;;CAIA,QAA+B;EAC9B,OAAO,KAAK,QAAQ,KAAK,MAAM,EAAE,IAAI;CACtC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build-integrations/runtime/errors.ts"],"sourcesContent":["// Build-integrations / runtime errors.\n//\n// The read-side surface for consumer code (apps, build tools). Two\n// failure shapes that callers care about distinguishing:\n//\n// - `ManifestDiscoveryError`: no manifest could be located. Includes\n// a recovery hint (\"run `devstack up`\") and the candidate path the\n// resolver expected.\n// - `ManifestShapeError`: a manifest was found but failed to parse\n// or decode. The two phases (`parse` vs `shape`) drive distinct\n// recovery recipes the caller can print.\n//\n// These are PLAIN classes (no Effect tags) because the read surface is\n// sync-blocking — apps load the manifest at startup and rely on plain\n// `try` / `catch`. The Effect-flavored read path (CLI / codegen) wraps\n// these into structured failure channels.\n\n/** Phase of a `ManifestDiscoveryError`. `walk-up` means the resolver\n * walked from cwd to root without finding a stack-scoped manifest;\n * `env-missing` means `DEVSTACK_MANIFEST_PATH` (top-precedence\n * override) pointed at a file that doesn't exist; `override-missing`\n * means a caller-supplied `manifestPath` / `override` doesn't exist;\n * `required-missing` is the catch-all for the `required: true`\n * branches. */\nexport type ManifestDiscoveryPhase =\n\t| 'walk-up'\n\t| 'env-missing'\n\t| 'override-missing'\n\t| 'required-missing';\n\n/** Thrown when the manifest cannot be located on disk. The message\n * embeds the candidate path and the canonical recovery recipe\n * (`run devstack up`); the field shape is stable so structured-log\n * consumers can pattern-match without parsing strings. */\nexport class ManifestDiscoveryError extends Error {\n\toverride readonly name = 'ManifestDiscoveryError';\n\treadonly phase: ManifestDiscoveryPhase;\n\treadonly path: string | undefined;\n\toverride readonly cause?: unknown;\n\tconstructor(args: {\n\t\treadonly phase: ManifestDiscoveryPhase;\n\t\treadonly message: string;\n\t\treadonly path?: string;\n\t\treadonly cause?: unknown;\n\t}) {\n\t\tsuper(args.message);\n\t\tthis.phase = args.phase;\n\t\tthis.path = args.path;\n\t\tif (args.cause !== undefined) this.cause = args.cause;\n\t}\n}\n\n/** Phase of a `ManifestShapeError`. `parse` means `JSON.parse` rejected\n * the bytes (truncation mid-write, hand-edit); `shape` means the bytes\n * parsed but the decoded value failed schema validation (wrong / stale\n * envelope shape); `version` means the manifest's `manifestVersion`\n * doesn't match the version this consumer was built against. */\nexport type ManifestShapePhase = 'parse' | 'shape' | 'version';\n\n/** Thrown when a discovered manifest exists but fails to parse / decode\n * / version-match. Carries the offending path so the recovery recipe\n * (`rm <path> && devstack up`) is actionable. */\nexport class ManifestShapeError extends Error {\n\toverride readonly name = 'ManifestShapeError';\n\treadonly phase: ManifestShapePhase;\n\treadonly path: string;\n\toverride readonly cause?: unknown;\n\tconstructor(args: {\n\t\treadonly phase: ManifestShapePhase;\n\t\treadonly message: string;\n\t\treadonly path: string;\n\t\treadonly cause?: unknown;\n\t}) {\n\t\tsuper(args.message);\n\t\tthis.phase = args.phase;\n\t\tthis.path = args.path;\n\t\tif (args.cause !== undefined) this.cause = args.cause;\n\t}\n}\n\n/** Thrown by `coldStartUrl(endpoint)` when the endpoint name is not\n * registered in the conventional-routes table and no manifest is\n * available either. The message lists the supported endpoint names\n * (derived from the registry, not hard-coded) so typos surface\n * obviously. */\nexport class NoConventionalRouteError extends Error {\n\toverride readonly name = 'NoConventionalRouteError';\n\treadonly endpoint: string;\n\treadonly supported: ReadonlyArray<string>;\n\tconstructor(args: {\n\t\treadonly endpoint: string;\n\t\treadonly supported: ReadonlyArray<string>;\n\t\treadonly message: string;\n\t}) {\n\t\tsuper(args.message);\n\t\tthis.endpoint = args.endpoint;\n\t\tthis.supported = args.supported;\n\t}\n}\n"],"mappings":";;;;;AAkCA,IAAa,yBAAb,cAA4C,MAAM;CACjD,OAAyB;CACzB;CACA;CACA;CACA,YAAY,MAKT;AACF,QAAM,KAAK,QAAQ;AACnB,OAAK,QAAQ,KAAK;AAClB,OAAK,OAAO,KAAK;AACjB,MAAI,KAAK,UAAU,KAAA,EAAW,MAAK,QAAQ,KAAK;;;;;;AAclD,IAAa,qBAAb,cAAwC,MAAM;CAC7C,OAAyB;CACzB;CACA;CACA;CACA,YAAY,MAKT;AACF,QAAM,KAAK,QAAQ;AACnB,OAAK,QAAQ,KAAK;AAClB,OAAK,OAAO,KAAK;AACjB,MAAI,KAAK,UAAU,KAAA,EAAW,MAAK,QAAQ,KAAK;;;;;;;;AASlD,IAAa,2BAAb,cAA8C,MAAM;CACnD,OAAyB;CACzB;CACA;CACA,YAAY,MAIT;AACF,QAAM,KAAK,QAAQ;AACnB,OAAK,WAAW,KAAK;AACrB,OAAK,YAAY,KAAK"}
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build-integrations/runtime/errors.ts"],"sourcesContent":["// Build-integrations / runtime errors.\n//\n// The read-side surface for consumer code (apps, build tools). Two\n// failure shapes that callers care about distinguishing:\n//\n// - `ManifestDiscoveryError`: no manifest could be located. Includes\n// a recovery hint (\"run `devstack up`\") and the candidate path the\n// resolver expected.\n// - `ManifestShapeError`: a manifest was found but failed to parse\n// or decode. The two phases (`parse` vs `shape`) drive distinct\n// recovery recipes the caller can print.\n//\n// These are PLAIN classes (no Effect tags) because the read surface is\n// sync-blocking — apps load the manifest at startup and rely on plain\n// `try` / `catch`. The Effect-flavored read path (CLI / codegen) wraps\n// these into structured failure channels.\n\n/** Phase of a `ManifestDiscoveryError`. `walk-up` means the resolver\n * walked from cwd to root without finding a stack-scoped manifest;\n * `env-missing` means `DEVSTACK_MANIFEST_PATH` (top-precedence\n * override) pointed at a file that doesn't exist; `override-missing`\n * means a caller-supplied `manifestPath` / `override` doesn't exist;\n * `required-missing` is the catch-all for the `required: true`\n * branches. */\nexport type ManifestDiscoveryPhase =\n\t| 'walk-up'\n\t| 'env-missing'\n\t| 'override-missing'\n\t| 'required-missing';\n\n/** Thrown when the manifest cannot be located on disk. The message\n * embeds the candidate path and the canonical recovery recipe\n * (`run devstack up`); the field shape is stable so structured-log\n * consumers can pattern-match without parsing strings. */\nexport class ManifestDiscoveryError extends Error {\n\toverride readonly name = 'ManifestDiscoveryError';\n\treadonly phase: ManifestDiscoveryPhase;\n\treadonly path: string | undefined;\n\toverride readonly cause?: unknown;\n\tconstructor(args: {\n\t\treadonly phase: ManifestDiscoveryPhase;\n\t\treadonly message: string;\n\t\treadonly path?: string;\n\t\treadonly cause?: unknown;\n\t}) {\n\t\tsuper(args.message);\n\t\tthis.phase = args.phase;\n\t\tthis.path = args.path;\n\t\tif (args.cause !== undefined) this.cause = args.cause;\n\t}\n}\n\n/** Phase of a `ManifestShapeError`. `parse` means `JSON.parse` rejected\n * the bytes (truncation mid-write, hand-edit); `shape` means the bytes\n * parsed but the decoded value failed schema validation (wrong / stale\n * envelope shape); `version` means the manifest's `manifestVersion`\n * doesn't match the version this consumer was built against. */\nexport type ManifestShapePhase = 'parse' | 'shape' | 'version';\n\n/** Thrown when a discovered manifest exists but fails to parse / decode\n * / version-match. Carries the offending path so the recovery recipe\n * (`rm <path> && devstack up`) is actionable. */\nexport class ManifestShapeError extends Error {\n\toverride readonly name = 'ManifestShapeError';\n\treadonly phase: ManifestShapePhase;\n\treadonly path: string;\n\toverride readonly cause?: unknown;\n\tconstructor(args: {\n\t\treadonly phase: ManifestShapePhase;\n\t\treadonly message: string;\n\t\treadonly path: string;\n\t\treadonly cause?: unknown;\n\t}) {\n\t\tsuper(args.message);\n\t\tthis.phase = args.phase;\n\t\tthis.path = args.path;\n\t\tif (args.cause !== undefined) this.cause = args.cause;\n\t}\n}\n\n/** Thrown by `coldStartUrl(endpoint)` when the endpoint name is not\n * registered in the conventional-routes table and no manifest is\n * available either. The message lists the supported endpoint names\n * (derived from the registry, not hard-coded) so typos surface\n * obviously. */\nexport class NoConventionalRouteError extends Error {\n\toverride readonly name = 'NoConventionalRouteError';\n\treadonly endpoint: string;\n\treadonly supported: ReadonlyArray<string>;\n\tconstructor(args: {\n\t\treadonly endpoint: string;\n\t\treadonly supported: ReadonlyArray<string>;\n\t\treadonly message: string;\n\t}) {\n\t\tsuper(args.message);\n\t\tthis.endpoint = args.endpoint;\n\t\tthis.supported = args.supported;\n\t}\n}\n"],"mappings":";;;;;AAkCA,IAAa,yBAAb,cAA4C,MAAM;CACjD,OAAyB;CACzB;CACA;CACA;CACA,YAAY,MAKT;EACF,MAAM,KAAK,OAAO;EAClB,KAAK,QAAQ,KAAK;EAClB,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;CACjD;AACD;;;;AAYA,IAAa,qBAAb,cAAwC,MAAM;CAC7C,OAAyB;CACzB;CACA;CACA;CACA,YAAY,MAKT;EACF,MAAM,KAAK,OAAO;EAClB,KAAK,QAAQ,KAAK;EAClB,KAAK,OAAO,KAAK;EACjB,IAAI,KAAK,UAAU,KAAA,GAAW,KAAK,QAAQ,KAAK;CACjD;AACD;;;;;;AAOA,IAAa,2BAAb,cAA8C,MAAM;CACnD,OAAyB;CACzB;CACA;CACA,YAAY,MAIT;EACF,MAAM,KAAK,OAAO;EAClB,KAAK,WAAW,KAAK;EACrB,KAAK,YAAY,KAAK;CACvB;AACD"}
@@ -58,7 +58,7 @@ const parseAndDecode = (raw, manifestPath) => {
58
58
  if (decoded.manifestVersion !== 1) throw new ManifestShapeError({
59
59
  phase: "version",
60
60
  path: manifestPath,
61
- message: `[devstack] manifest at ${manifestPath} has version ${decoded.manifestVersion}, but this consumer was built for version 1. RECOVERY: upgrade your devstack consumer dependency, or \`rm ${manifestPath} && devstack up\` to regenerate against the new version.`
61
+ message: `[devstack] manifest at ${manifestPath} has version ${decoded.manifestVersion}, but this consumer was built for version 1. RECOVERY: \`rm ${manifestPath} && devstack up\` to regenerate.`
62
62
  });
63
63
  return decoded;
64
64
  };
@@ -77,12 +77,12 @@ const project = (envelope, manifestPath) => {
77
77
  identity: {
78
78
  app: envelope.identity.app,
79
79
  stack: envelope.identity.stack,
80
- chain: envelope.identity.chain
80
+ network: envelope.identity.network
81
81
  },
82
82
  manifestPath,
83
83
  manifestVersion: envelope.manifestVersion,
84
84
  endpoints: new EndpointRegistry(entries),
85
- services: envelope.services,
85
+ services: envelope.services ?? {},
86
86
  extras: envelope.extras
87
87
  };
88
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"read-stack-context.mjs","names":[],"sources":["../../../src/build-integrations/runtime/read-stack-context.ts"],"sourcesContent":["// Sync manifest reader + projection.\n//\n// Read-side L5 surface. Loads the manifest envelope from disk,\n// validates it via the substrate's `ManifestEnvelopeSchema`, and\n// projects it to a plain TS `StackContext` consumer code can use\n// without depending on Effect or Schema.\n//\n// Sync — apps and Playwright config-load are sync surfaces. The cost\n// is one `readFileSync` and one synchronous Schema decode.\n//\n// Error contract:\n//\n// - Missing manifest → `ManifestDiscoveryError` (with `phase`).\n// - Manifest exists but `JSON.parse` rejected the bytes →\n// `ManifestShapeError(phase: 'parse')`.\n// - Manifest parsed but failed schema validation →\n// `ManifestShapeError(phase: 'shape')`.\n// - Manifest decoded but `manifestVersion` doesn't match the\n// consumer's pinned `CURRENT_MANIFEST_VERSION` →\n// `ManifestShapeError(phase: 'version')`.\n//\n// All three are plain `Error` subclasses (see `./errors.ts`) so the\n// caller's try / catch / instanceof flow works without importing\n// Effect. The CLI / codegen surfaces can still wrap this function in\n// `Effect.try` to lift the failure channel.\n//\n// Implementation detail: we use Effect Schema INTERNALLY for the\n// envelope decode (`ManifestEnvelopeSchema` lives in the substrate),\n// but the API surface is plain TS. Schema is a validation tool here,\n// not an exposed type.\n\nimport { readFileSync } from 'node:fs';\n\nimport {\n\tdecodeUnknownSync,\n\tManifestEnvelopeSchema,\n\tparseJsonTextSync,\n\ttype ManifestEnvelope,\n\ttype EndpointEntry,\n} from './manifest-types.ts';\nimport { discoverManifestPath, type DiscoverManifestPathOptions } from './discover.ts';\nimport { EndpointRegistry } from './endpoint-registry.ts';\nimport { ManifestDiscoveryError, ManifestShapeError } from './errors.ts';\nimport type { ResolvedEndpoint, StackContext } from './stack-context.ts';\n\n/** Pinned manifest-envelope version this consumer build was compiled\n * against. Must match the substrate's `CURRENT_MANIFEST_VERSION`\n * (kept as a literal here so the read path doesn't reach into the\n * substrate's writer module just for a number). When the substrate\n * bumps, the consumer must bump in lockstep — the version mismatch\n * error message names the recovery recipe. */\nexport const CONSUMER_MANIFEST_VERSION = 1 as const;\n\nexport interface ReadStackContextOptions extends DiscoverManifestPathOptions {\n\t/** Caller-supplied explicit manifest path. When set, bypasses the\n\t * walk-up (still existence-checked). Named `manifestPath` for\n\t * ergonomic parity with the CLI's `--manifest-path` flag. */\n\treadonly manifestPath?: string;\n}\n\nconst resolveManifestPath = (opts: ReadStackContextOptions): string => {\n\tconst override = opts.manifestPath ?? opts.override;\n\tconst resolved = discoverManifestPath({\n\t\t...opts,\n\t\t...(override !== undefined ? { override } : {}),\n\t\trequired: true,\n\t});\n\t// `required: true` throws on miss; this branch is unreachable but\n\t// keeps the type narrow without an `!`.\n\tif (resolved === undefined) {\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'required-missing',\n\t\t\tmessage: '[devstack] manifest discovery returned undefined despite required: true',\n\t\t});\n\t}\n\treturn resolved;\n};\n\nconst parseAndDecode = (raw: string, manifestPath: string): ManifestEnvelope => {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = parseJsonTextSync(raw, {\n\t\t\tsource: manifestPath,\n\t\t\tmkError: (issue) => issue,\n\t\t});\n\t} catch (cause) {\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'parse',\n\t\t\tpath: manifestPath,\n\t\t\tmessage:\n\t\t\t\t`[devstack] manifest at ${manifestPath} is not valid JSON ` +\n\t\t\t\t`(truncation or hand-edit). ` +\n\t\t\t\t`RECOVERY: \\`rm ${manifestPath} && devstack up\\` to regenerate.`,\n\t\t\tcause,\n\t\t});\n\t}\n\tlet decoded: ManifestEnvelope;\n\ttry {\n\t\tdecoded = decodeUnknownSync(ManifestEnvelopeSchema, parsed, {\n\t\t\tsource: manifestPath,\n\t\t\tmkError: (issue) => issue,\n\t\t});\n\t} catch (cause) {\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'shape',\n\t\t\tpath: manifestPath,\n\t\t\tmessage:\n\t\t\t\t`[devstack] manifest at ${manifestPath} does not match the manifest envelope schema ` +\n\t\t\t\t`(stale shape or hand-edit). ` +\n\t\t\t\t`RECOVERY: \\`rm ${manifestPath} && devstack up\\` to regenerate.`,\n\t\t\tcause,\n\t\t});\n\t}\n\tif (decoded.manifestVersion !== CONSUMER_MANIFEST_VERSION) {\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'version',\n\t\t\tpath: manifestPath,\n\t\t\tmessage:\n\t\t\t\t`[devstack] manifest at ${manifestPath} has version ${decoded.manifestVersion}, ` +\n\t\t\t\t`but this consumer was built for version ${CONSUMER_MANIFEST_VERSION}. ` +\n\t\t\t\t`RECOVERY: upgrade your devstack consumer dependency, or \\`rm ${manifestPath} && devstack up\\` ` +\n\t\t\t\t`to regenerate against the new version.`,\n\t\t});\n\t}\n\treturn decoded;\n};\n\n/** Project the decoded envelope to a plain `StackContext`. */\nconst project = (envelope: ManifestEnvelope, manifestPath: string): StackContext => {\n\tconst entries: ResolvedEndpoint[] = [];\n\tfor (const raw of Object.values(envelope.endpoints)) {\n\t\tentries.push({\n\t\t\tname: raw.name,\n\t\t\turl: raw.url,\n\t\t\tdisplayUrl: raw.displayUrl,\n\t\t\twireProtocol: raw.wireProtocol,\n\t\t\tpluginKey: raw.pluginKey,\n\t\t\tendpointKey: raw.endpointKey,\n\t\t});\n\t}\n\treturn {\n\t\tidentity: {\n\t\t\tapp: envelope.identity.app,\n\t\t\tstack: envelope.identity.stack,\n\t\t\tchain: envelope.identity.chain,\n\t\t},\n\t\tmanifestPath,\n\t\tmanifestVersion: envelope.manifestVersion,\n\t\tendpoints: new EndpointRegistry(entries),\n\t\tservices: envelope.services,\n\t\textras: envelope.extras,\n\t};\n};\n\n/** Reconstruct the manifest envelope from the runtime projection.\n * Integration adapters that preserve their older envelope-shaped\n * surfaces use this instead of duplicating endpoint-registry\n * projection logic. */\nexport const manifestEnvelopeFromStackContext = (ctx: StackContext): ManifestEnvelope => ({\n\tidentity: ctx.identity,\n\tmanifestVersion: ctx.manifestVersion,\n\tservices: ctx.services,\n\tendpoints: Object.fromEntries(\n\t\tctx.endpoints.all().map((e): [string, EndpointEntry] => [\n\t\t\te.endpointKey,\n\t\t\t{\n\t\t\t\tname: e.name,\n\t\t\t\turl: e.url,\n\t\t\t\tdisplayUrl: e.displayUrl,\n\t\t\t\twireProtocol: e.wireProtocol,\n\t\t\t\tpluginKey: e.pluginKey,\n\t\t\t\tendpointKey: e.endpointKey,\n\t\t\t},\n\t\t]),\n\t),\n\textras: ctx.extras,\n});\n\n/**\n * Sync read + decode + project. Throws `ManifestDiscoveryError` (no\n * manifest located) or `ManifestShapeError` (manifest found but\n * malformed / wrong version).\n *\n * Used by:\n * - Apps' generated `stack-handle.ts` at startup.\n * - Playwright config-load (`baseURL`, `webServer.url`).\n * - CLI surfaces that prefer sync-then-Effect.try over a native\n * Effect read.\n */\nexport const readStackContext = (opts: ReadStackContextOptions = {}): StackContext => {\n\tconst manifestPath = resolveManifestPath(opts);\n\tlet raw: string;\n\ttry {\n\t\traw = readFileSync(manifestPath, 'utf8');\n\t} catch (cause) {\n\t\t// File existed at discovery time but is unreadable now — race\n\t\t// with the supervisor's atomic-write would be a parse failure on\n\t\t// the next read; a true EACCES / disk-disconnect surfaces here.\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'parse',\n\t\t\tpath: manifestPath,\n\t\t\tmessage: `[devstack] failed to read manifest at ${manifestPath}: ${String(cause)}`,\n\t\t\tcause,\n\t\t});\n\t}\n\tconst envelope = parseAndDecode(raw, manifestPath);\n\treturn project(envelope, manifestPath);\n};\n"],"mappings":";;;;;;;;;;;;;;AAmDA,MAAa,4BAA4B;AASzC,MAAM,uBAAuB,SAA0C;CACtE,MAAM,WAAW,KAAK,gBAAgB,KAAK;CAC3C,MAAM,WAAW,qBAAqB;EACrC,GAAG;EACH,GAAI,aAAa,KAAA,IAAY,EAAE,UAAU,GAAG,EAAE;EAC9C,UAAU;EACV,CAAC;AAGF,KAAI,aAAa,KAAA,EAChB,OAAM,IAAI,uBAAuB;EAChC,OAAO;EACP,SAAS;EACT,CAAC;AAEH,QAAO;;AAGR,MAAM,kBAAkB,KAAa,iBAA2C;CAC/E,IAAI;AACJ,KAAI;AACH,WAAS,kBAAkB,KAAK;GAC/B,QAAQ;GACR,UAAU,UAAU;GACpB,CAAC;UACM,OAAO;AACf,QAAM,IAAI,mBAAmB;GAC5B,OAAO;GACP,MAAM;GACN,SACC,0BAA0B,aAAa,+DAErB,aAAa;GAChC;GACA,CAAC;;CAEH,IAAI;AACJ,KAAI;AACH,YAAU,kBAAkB,wBAAwB,QAAQ;GAC3D,QAAQ;GACR,UAAU,UAAU;GACpB,CAAC;UACM,OAAO;AACf,QAAM,IAAI,mBAAmB;GAC5B,OAAO;GACP,MAAM;GACN,SACC,0BAA0B,aAAa,0FAErB,aAAa;GAChC;GACA,CAAC;;AAEH,KAAI,QAAQ,oBAAA,EACX,OAAM,IAAI,mBAAmB;EAC5B,OAAO;EACP,MAAM;EACN,SACC,0BAA0B,aAAa,eAAe,QAAQ,gBAAgB,4GAEd,aAAa;EAE9E,CAAC;AAEH,QAAO;;;AAIR,MAAM,WAAW,UAA4B,iBAAuC;CACnF,MAAM,UAA8B,EAAE;AACtC,MAAK,MAAM,OAAO,OAAO,OAAO,SAAS,UAAU,CAClD,SAAQ,KAAK;EACZ,MAAM,IAAI;EACV,KAAK,IAAI;EACT,YAAY,IAAI;EAChB,cAAc,IAAI;EAClB,WAAW,IAAI;EACf,aAAa,IAAI;EACjB,CAAC;AAEH,QAAO;EACN,UAAU;GACT,KAAK,SAAS,SAAS;GACvB,OAAO,SAAS,SAAS;GACzB,OAAO,SAAS,SAAS;GACzB;EACD;EACA,iBAAiB,SAAS;EAC1B,WAAW,IAAI,iBAAiB,QAAQ;EACxC,UAAU,SAAS;EACnB,QAAQ,SAAS;EACjB;;;;;;AAOF,MAAa,oCAAoC,SAAyC;CACzF,UAAU,IAAI;CACd,iBAAiB,IAAI;CACrB,UAAU,IAAI;CACd,WAAW,OAAO,YACjB,IAAI,UAAU,KAAK,CAAC,KAAK,MAA+B,CACvD,EAAE,aACF;EACC,MAAM,EAAE;EACR,KAAK,EAAE;EACP,YAAY,EAAE;EACd,cAAc,EAAE;EAChB,WAAW,EAAE;EACb,aAAa,EAAE;EACf,CACD,CAAC,CACF;CACD,QAAQ,IAAI;CACZ;;;;;;;;;;;;AAaD,MAAa,oBAAoB,OAAgC,EAAE,KAAmB;CACrF,MAAM,eAAe,oBAAoB,KAAK;CAC9C,IAAI;AACJ,KAAI;AACH,QAAM,aAAa,cAAc,OAAO;UAChC,OAAO;AAIf,QAAM,IAAI,mBAAmB;GAC5B,OAAO;GACP,MAAM;GACN,SAAS,yCAAyC,aAAa,IAAI,OAAO,MAAM;GAChF;GACA,CAAC;;AAGH,QAAO,QADU,eAAe,KAAK,aACd,EAAE,aAAa"}
1
+ {"version":3,"file":"read-stack-context.mjs","names":[],"sources":["../../../src/build-integrations/runtime/read-stack-context.ts"],"sourcesContent":["// Sync manifest reader + projection.\n//\n// Read-side L5 surface. Loads the manifest envelope from disk,\n// validates it via the substrate's `ManifestEnvelopeSchema`, and\n// projects it to a plain TS `StackContext` consumer code can use\n// without depending on Effect or Schema.\n//\n// Sync — apps and Playwright config-load are sync surfaces. The cost\n// is one `readFileSync` and one synchronous Schema decode.\n//\n// Error contract:\n//\n// - Missing manifest → `ManifestDiscoveryError` (with `phase`).\n// - Manifest exists but `JSON.parse` rejected the bytes →\n// `ManifestShapeError(phase: 'parse')`.\n// - Manifest parsed but failed schema validation →\n// `ManifestShapeError(phase: 'shape')`.\n// - Manifest decoded but `manifestVersion` doesn't match the\n// consumer's pinned `CURRENT_MANIFEST_VERSION` →\n// `ManifestShapeError(phase: 'version')`.\n//\n// All three are plain `Error` subclasses (see `./errors.ts`) so the\n// caller's try / catch / instanceof flow works without importing\n// Effect. The CLI / codegen surfaces can still wrap this function in\n// `Effect.try` to lift the failure channel.\n//\n// Implementation detail: we use Effect Schema INTERNALLY for the\n// envelope decode (`ManifestEnvelopeSchema` lives in the substrate),\n// but the API surface is plain TS. Schema is a validation tool here,\n// not an exposed type.\n\nimport { readFileSync } from 'node:fs';\n\nimport {\n\tdecodeUnknownSync,\n\tManifestEnvelopeSchema,\n\tparseJsonTextSync,\n\ttype ManifestEnvelope,\n\ttype EndpointEntry,\n} from './manifest-types.ts';\nimport { discoverManifestPath, type DiscoverManifestPathOptions } from './discover.ts';\nimport { EndpointRegistry } from './endpoint-registry.ts';\nimport { ManifestDiscoveryError, ManifestShapeError } from './errors.ts';\nimport type { ResolvedEndpoint, StackContext } from './stack-context.ts';\n\n/** Pinned manifest-envelope version this consumer build was compiled\n * against. Must match the substrate's `CURRENT_MANIFEST_VERSION`\n * (kept as a literal here so the read path doesn't reach into the\n * substrate's writer module just for a number). When the substrate\n * bumps, the consumer must bump in lockstep — the version mismatch\n * error message names the recovery recipe. */\nexport const CONSUMER_MANIFEST_VERSION = 1 as const;\n\nexport interface ReadStackContextOptions extends DiscoverManifestPathOptions {\n\t/** Caller-supplied explicit manifest path. When set, bypasses the\n\t * walk-up (still existence-checked). Named `manifestPath` for\n\t * ergonomic parity with the CLI's `--manifest-path` flag. */\n\treadonly manifestPath?: string;\n}\n\nconst resolveManifestPath = (opts: ReadStackContextOptions): string => {\n\tconst override = opts.manifestPath ?? opts.override;\n\tconst resolved = discoverManifestPath({\n\t\t...opts,\n\t\t...(override !== undefined ? { override } : {}),\n\t\trequired: true,\n\t});\n\t// `required: true` throws on miss; this branch is unreachable but\n\t// keeps the type narrow without an `!`.\n\tif (resolved === undefined) {\n\t\tthrow new ManifestDiscoveryError({\n\t\t\tphase: 'required-missing',\n\t\t\tmessage: '[devstack] manifest discovery returned undefined despite required: true',\n\t\t});\n\t}\n\treturn resolved;\n};\n\nconst parseAndDecode = (raw: string, manifestPath: string): ManifestEnvelope => {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = parseJsonTextSync(raw, {\n\t\t\tsource: manifestPath,\n\t\t\tmkError: (issue) => issue,\n\t\t});\n\t} catch (cause) {\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'parse',\n\t\t\tpath: manifestPath,\n\t\t\tmessage:\n\t\t\t\t`[devstack] manifest at ${manifestPath} is not valid JSON ` +\n\t\t\t\t`(truncation or hand-edit). ` +\n\t\t\t\t`RECOVERY: \\`rm ${manifestPath} && devstack up\\` to regenerate.`,\n\t\t\tcause,\n\t\t});\n\t}\n\tlet decoded: ManifestEnvelope;\n\ttry {\n\t\tdecoded = decodeUnknownSync(ManifestEnvelopeSchema, parsed, {\n\t\t\tsource: manifestPath,\n\t\t\tmkError: (issue) => issue,\n\t\t});\n\t} catch (cause) {\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'shape',\n\t\t\tpath: manifestPath,\n\t\t\tmessage:\n\t\t\t\t`[devstack] manifest at ${manifestPath} does not match the manifest envelope schema ` +\n\t\t\t\t`(stale shape or hand-edit). ` +\n\t\t\t\t`RECOVERY: \\`rm ${manifestPath} && devstack up\\` to regenerate.`,\n\t\t\tcause,\n\t\t});\n\t}\n\tif (decoded.manifestVersion !== CONSUMER_MANIFEST_VERSION) {\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'version',\n\t\t\tpath: manifestPath,\n\t\t\tmessage:\n\t\t\t\t`[devstack] manifest at ${manifestPath} has version ${decoded.manifestVersion}, ` +\n\t\t\t\t`but this consumer was built for version ${CONSUMER_MANIFEST_VERSION}. ` +\n\t\t\t\t`RECOVERY: \\`rm ${manifestPath} && devstack up\\` to regenerate.`,\n\t\t});\n\t}\n\treturn decoded;\n};\n\n/** Project the decoded envelope to a plain `StackContext`. */\nconst project = (envelope: ManifestEnvelope, manifestPath: string): StackContext => {\n\tconst entries: ResolvedEndpoint[] = [];\n\tfor (const raw of Object.values(envelope.endpoints)) {\n\t\tentries.push({\n\t\t\tname: raw.name,\n\t\t\turl: raw.url,\n\t\t\tdisplayUrl: raw.displayUrl,\n\t\t\twireProtocol: raw.wireProtocol,\n\t\t\tpluginKey: raw.pluginKey,\n\t\t\tendpointKey: raw.endpointKey,\n\t\t});\n\t}\n\treturn {\n\t\tidentity: {\n\t\t\tapp: envelope.identity.app,\n\t\t\tstack: envelope.identity.stack,\n\t\t\tnetwork: envelope.identity.network,\n\t\t},\n\t\tmanifestPath,\n\t\tmanifestVersion: envelope.manifestVersion,\n\t\tendpoints: new EndpointRegistry(entries),\n\t\t// Default to an empty record when the manifest omits services.\n\t\tservices: envelope.services ?? {},\n\t\textras: envelope.extras,\n\t};\n};\n\n/** Reconstruct the manifest envelope from the runtime projection.\n * Integration adapters that preserve their older envelope-shaped\n * surfaces use this instead of duplicating endpoint-registry\n * projection logic. */\nexport const manifestEnvelopeFromStackContext = (ctx: StackContext): ManifestEnvelope => ({\n\tidentity: ctx.identity,\n\tmanifestVersion: ctx.manifestVersion,\n\tservices: ctx.services,\n\tendpoints: Object.fromEntries(\n\t\tctx.endpoints.all().map((e): [string, EndpointEntry] => [\n\t\t\te.endpointKey,\n\t\t\t{\n\t\t\t\tname: e.name,\n\t\t\t\turl: e.url,\n\t\t\t\tdisplayUrl: e.displayUrl,\n\t\t\t\twireProtocol: e.wireProtocol,\n\t\t\t\tpluginKey: e.pluginKey,\n\t\t\t\tendpointKey: e.endpointKey,\n\t\t\t},\n\t\t]),\n\t),\n\textras: ctx.extras,\n});\n\n/**\n * Sync read + decode + project. Throws `ManifestDiscoveryError` (no\n * manifest located) or `ManifestShapeError` (manifest found but\n * malformed / wrong version).\n *\n * Used by:\n * - Apps' generated `stack-handle.ts` at startup.\n * - Playwright config-load (`baseURL`, `webServer.url`).\n * - CLI surfaces that prefer sync-then-Effect.try over a native\n * Effect read.\n */\nexport const readStackContext = (opts: ReadStackContextOptions = {}): StackContext => {\n\tconst manifestPath = resolveManifestPath(opts);\n\tlet raw: string;\n\ttry {\n\t\traw = readFileSync(manifestPath, 'utf8');\n\t} catch (cause) {\n\t\t// File existed at discovery time but is unreadable now — race\n\t\t// with the supervisor's atomic-write would be a parse failure on\n\t\t// the next read; a true EACCES / disk-disconnect surfaces here.\n\t\tthrow new ManifestShapeError({\n\t\t\tphase: 'parse',\n\t\t\tpath: manifestPath,\n\t\t\tmessage: `[devstack] failed to read manifest at ${manifestPath}: ${String(cause)}`,\n\t\t\tcause,\n\t\t});\n\t}\n\tconst envelope = parseAndDecode(raw, manifestPath);\n\treturn project(envelope, manifestPath);\n};\n"],"mappings":";;;;;;;;;;;;;;AAmDA,MAAa,4BAA4B;AASzC,MAAM,uBAAuB,SAA0C;CACtE,MAAM,WAAW,KAAK,gBAAgB,KAAK;CAC3C,MAAM,WAAW,qBAAqB;EACrC,GAAG;EACH,GAAI,aAAa,KAAA,IAAY,EAAE,SAAS,IAAI,CAAC;EAC7C,UAAU;CACX,CAAC;CAGD,IAAI,aAAa,KAAA,GAChB,MAAM,IAAI,uBAAuB;EAChC,OAAO;EACP,SAAS;CACV,CAAC;CAEF,OAAO;AACR;AAEA,MAAM,kBAAkB,KAAa,iBAA2C;CAC/E,IAAI;CACJ,IAAI;EACH,SAAS,kBAAkB,KAAK;GAC/B,QAAQ;GACR,UAAU,UAAU;EACrB,CAAC;CACF,SAAS,OAAO;EACf,MAAM,IAAI,mBAAmB;GAC5B,OAAO;GACP,MAAM;GACN,SACC,0BAA0B,aAAa,+DAErB,aAAa;GAChC;EACD,CAAC;CACF;CACA,IAAI;CACJ,IAAI;EACH,UAAU,kBAAkB,wBAAwB,QAAQ;GAC3D,QAAQ;GACR,UAAU,UAAU;EACrB,CAAC;CACF,SAAS,OAAO;EACf,MAAM,IAAI,mBAAmB;GAC5B,OAAO;GACP,MAAM;GACN,SACC,0BAA0B,aAAa,0FAErB,aAAa;GAChC;EACD,CAAC;CACF;CACA,IAAI,QAAQ,oBAAA,GACX,MAAM,IAAI,mBAAmB;EAC5B,OAAO;EACP,MAAM;EACN,SACC,0BAA0B,aAAa,eAAe,QAAQ,gBAAgB,8DAE5D,aAAa;CACjC,CAAC;CAEF,OAAO;AACR;;AAGA,MAAM,WAAW,UAA4B,iBAAuC;CACnF,MAAM,UAA8B,CAAC;CACrC,KAAK,MAAM,OAAO,OAAO,OAAO,SAAS,SAAS,GACjD,QAAQ,KAAK;EACZ,MAAM,IAAI;EACV,KAAK,IAAI;EACT,YAAY,IAAI;EAChB,cAAc,IAAI;EAClB,WAAW,IAAI;EACf,aAAa,IAAI;CAClB,CAAC;CAEF,OAAO;EACN,UAAU;GACT,KAAK,SAAS,SAAS;GACvB,OAAO,SAAS,SAAS;GACzB,SAAS,SAAS,SAAS;EAC5B;EACA;EACA,iBAAiB,SAAS;EAC1B,WAAW,IAAI,iBAAiB,OAAO;EAEvC,UAAU,SAAS,YAAY,CAAC;EAChC,QAAQ,SAAS;CAClB;AACD;;;;;AAMA,MAAa,oCAAoC,SAAyC;CACzF,UAAU,IAAI;CACd,iBAAiB,IAAI;CACrB,UAAU,IAAI;CACd,WAAW,OAAO,YACjB,IAAI,UAAU,IAAI,CAAC,CAAC,KAAK,MAA+B,CACvD,EAAE,aACF;EACC,MAAM,EAAE;EACR,KAAK,EAAE;EACP,YAAY,EAAE;EACd,cAAc,EAAE;EAChB,WAAW,EAAE;EACb,aAAa,EAAE;CAChB,CACD,CAAC,CACF;CACA,QAAQ,IAAI;AACb;;;;;;;;;;;;AAaA,MAAa,oBAAoB,OAAgC,CAAC,MAAoB;CACrF,MAAM,eAAe,oBAAoB,IAAI;CAC7C,IAAI;CACJ,IAAI;EACH,MAAM,aAAa,cAAc,MAAM;CACxC,SAAS,OAAO;EAIf,MAAM,IAAI,mBAAmB;GAC5B,OAAO;GACP,MAAM;GACN,SAAS,yCAAyC,aAAa,IAAI,OAAO,KAAK;GAC/E;EACD,CAAC;CACF;CAEA,OAAO,QADU,eAAe,KAAK,YACf,GAAG,YAAY;AACtC"}
@@ -3,8 +3,11 @@
3
3
  * option nor any env override is present. Mirrors `DEFAULT_STATE_DIR`
4
4
  * in `discover.ts` (same literal `.devstack`). */
5
5
  declare const DEFAULT_DISCOVERY_STATE_DIR = ".devstack";
6
- /** Default stack name when neither an explicit option nor
7
- * `$DEVSTACK_STACK` yields a value. */
6
+ /** Default stack name when neither an explicit option, `$DEVSTACK_STACK`,
7
+ * nor the (opt-in) package-name rung yields a value. Re-export of the
8
+ * CLI resolver's `DEFAULT_STACK_NAME` literal — the literal lives in
9
+ * `inference-network.ts` because this module imports its inference
10
+ * helper (see the module-cycle note there). */
8
11
  declare const DEFAULT_DISCOVERY_STACK = "main";
9
12
  /** Env-var names the discovery ladder consults for the stack +
10
13
  * state-dir rungs. `MANIFEST_PATH` lives here for documentation parity
@@ -21,6 +24,12 @@ interface ResolveDiscoveryEnvOptions {
21
24
  readonly stack?: string;
22
25
  /** Explicit state-dir / runtime-root. Wins over both env vars. */
23
26
  readonly stateDir?: string;
27
+ /** Walk-up start for the package-name rung of the stack ladder,
28
+ * mirroring the CLI's `resolveStackName`. Opt-in: omit it and the
29
+ * resolver stays side-effect-free (no fs reads). When provided,
30
+ * the `package.json` walk-up runs LAZILY — only when both the
31
+ * explicit and `$DEVSTACK_STACK` rungs miss. */
32
+ readonly cwd?: string;
24
33
  }
25
34
  interface ResolvedDiscoveryEnv {
26
35
  /** Resolved stack name (never empty). */
@@ -33,14 +42,21 @@ interface ResolvedDiscoveryEnv {
33
42
  /**
34
43
  * Resolve the canonical stack + state-dir ladder.
35
44
  *
36
- * Precedence (highest → lowest), identical for both rungs:
37
- * - stack: `options.stack` > `$DEVSTACK_STACK` > `'main'`
45
+ * Precedence (highest → lowest):
46
+ * - stack: `options.stack` > `$DEVSTACK_STACK`
47
+ * > nearest package.json `name` above `options.cwd`
48
+ * (rung skipped when `cwd` is omitted)
49
+ * > `'main'`
38
50
  * - stateDir: `options.stateDir` > `$DEVSTACK_RUNTIME_ROOT`
39
51
  * > `$DEVSTACK_STATE_DIR` > `'.devstack'`
40
52
  *
41
- * Empty-string env values are treated as unset (a blank
42
- * `DEVSTACK_STATE_DIR=` must not pin the state root to the cwd). Pure —
43
- * no `process.env` read; callers pass the bag (a fixture in tests).
53
+ * The stack ladder matches the CLI's `resolveStackName`, so discovery
54
+ * agrees with `devstack up` about which stack a bare app runs (see the
55
+ * module header). Empty-string env values are treated as unset (a blank
56
+ * `DEVSTACK_STATE_DIR=` must not pin the state root to the cwd). No
57
+ * `process.env` read — callers pass the bag (a fixture in tests) — and
58
+ * no fs access unless `options.cwd` is provided AND the first two stack
59
+ * rungs miss (the package.json walk-up is lazy).
44
60
  */
45
61
  declare const resolveDiscoveryEnv: (env: Readonly<Record<string, string | undefined>>, options?: ResolveDiscoveryEnvOptions) => ResolvedDiscoveryEnv;
46
62
  //#endregion
@@ -1,11 +1,15 @@
1
+ import { DEFAULT_STACK_NAME, inferPackageNameFromCwd } from "../../api/inference-network.mjs";
1
2
  //#region src/build-integrations/runtime/resolve-discovery-env.ts
2
3
  /** Default state-dir / runtime-root name when neither an explicit
3
4
  * option nor any env override is present. Mirrors `DEFAULT_STATE_DIR`
4
5
  * in `discover.ts` (same literal `.devstack`). */
5
6
  const DEFAULT_DISCOVERY_STATE_DIR = ".devstack";
6
- /** Default stack name when neither an explicit option nor
7
- * `$DEVSTACK_STACK` yields a value. */
8
- const DEFAULT_DISCOVERY_STACK = "main";
7
+ /** Default stack name when neither an explicit option, `$DEVSTACK_STACK`,
8
+ * nor the (opt-in) package-name rung yields a value. Re-export of the
9
+ * CLI resolver's `DEFAULT_STACK_NAME` literal — the literal lives in
10
+ * `inference-network.ts` because this module imports its inference
11
+ * helper (see the module-cycle note there). */
12
+ const DEFAULT_DISCOVERY_STACK = DEFAULT_STACK_NAME;
9
13
  /** Env-var names the discovery ladder consults for the stack +
10
14
  * state-dir rungs. `MANIFEST_PATH` lives here for documentation parity
11
15
  * with the integration env tables but is resolved by
@@ -23,19 +27,28 @@ const firstNonEmpty = (...candidates) => {
23
27
  /**
24
28
  * Resolve the canonical stack + state-dir ladder.
25
29
  *
26
- * Precedence (highest → lowest), identical for both rungs:
27
- * - stack: `options.stack` > `$DEVSTACK_STACK` > `'main'`
30
+ * Precedence (highest → lowest):
31
+ * - stack: `options.stack` > `$DEVSTACK_STACK`
32
+ * > nearest package.json `name` above `options.cwd`
33
+ * (rung skipped when `cwd` is omitted)
34
+ * > `'main'`
28
35
  * - stateDir: `options.stateDir` > `$DEVSTACK_RUNTIME_ROOT`
29
36
  * > `$DEVSTACK_STATE_DIR` > `'.devstack'`
30
37
  *
31
- * Empty-string env values are treated as unset (a blank
32
- * `DEVSTACK_STATE_DIR=` must not pin the state root to the cwd). Pure —
33
- * no `process.env` read; callers pass the bag (a fixture in tests).
38
+ * The stack ladder matches the CLI's `resolveStackName`, so discovery
39
+ * agrees with `devstack up` about which stack a bare app runs (see the
40
+ * module header). Empty-string env values are treated as unset (a blank
41
+ * `DEVSTACK_STATE_DIR=` must not pin the state root to the cwd). No
42
+ * `process.env` read — callers pass the bag (a fixture in tests) — and
43
+ * no fs access unless `options.cwd` is provided AND the first two stack
44
+ * rungs miss (the package.json walk-up is lazy).
34
45
  */
35
- const resolveDiscoveryEnv = (env, options = {}) => ({
36
- stack: firstNonEmpty(options.stack?.trim(), env[DISCOVERY_ENV.STACK]?.trim()) ?? "main",
37
- stateDir: firstNonEmpty(options.stateDir, env[DISCOVERY_ENV.RUNTIME_ROOT], env[DISCOVERY_ENV.STATE_DIR]) ?? ".devstack"
38
- });
46
+ const resolveDiscoveryEnv = (env, options = {}) => {
47
+ return {
48
+ stack: firstNonEmpty(options.stack?.trim(), env[DISCOVERY_ENV.STACK]?.trim()) ?? (options.cwd !== void 0 ? inferPackageNameFromCwd(options.cwd) : void 0) ?? DEFAULT_DISCOVERY_STACK,
49
+ stateDir: firstNonEmpty(options.stateDir, env[DISCOVERY_ENV.RUNTIME_ROOT], env[DISCOVERY_ENV.STATE_DIR]) ?? ".devstack"
50
+ };
51
+ };
39
52
  //#endregion
40
53
  export { DEFAULT_DISCOVERY_STACK, DEFAULT_DISCOVERY_STATE_DIR, DISCOVERY_ENV, resolveDiscoveryEnv };
41
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-discovery-env.mjs","names":[],"sources":["../../../src/build-integrations/runtime/resolve-discovery-env.ts"],"sourcesContent":["// Shared discovery env-ladder resolver.\n//\n// ONE place that turns (caller options + env bag) into the resolved\n// `{ stack, stateDir }` tuple every build integration discovers a\n// manifest with. Before this existed the ladder was copy-pasted in\n// `discover.ts`, the vitest loader, the playwright stack-context, and\n// the playwright global-setup single-stack fallback — and the two\n// playwright sites had drifted: they read only `DEVSTACK_STATE_DIR`\n// and silently ignored `DEVSTACK_RUNTIME_ROOT`. Consolidating here\n// makes that omission impossible and matches STYLE_GUIDE §7: \"L5 build\n// integrations use `build-integrations/runtime/` as the canonical\n// substrate; per-integration reimplementations of manifest discovery\n// consolidate there.\"\n//\n// `DEVSTACK_MANIFEST_PATH` is deliberately NOT resolved here — it is a\n// whole-path escape hatch handled inside `discoverManifestPath`\n// (env-miss must throw, not fall through to the walk-up), so threading\n// it through this stateDir/stack ladder would be the wrong layer.\n\n/** Default state-dir / runtime-root name when neither an explicit\n * option nor any env override is present. Mirrors `DEFAULT_STATE_DIR`\n * in `discover.ts` (same literal `.devstack`). */\nexport const DEFAULT_DISCOVERY_STATE_DIR = '.devstack';\n\n/** Default stack name when neither an explicit option nor\n * `$DEVSTACK_STACK` yields a value. */\nexport const DEFAULT_DISCOVERY_STACK = 'main';\n\n/** Env-var names the discovery ladder consults for the stack +\n * state-dir rungs. `MANIFEST_PATH` lives here for documentation parity\n * with the integration env tables but is resolved by\n * `discoverManifestPath`, not this ladder. */\nexport const DISCOVERY_ENV = {\n\tSTACK: 'DEVSTACK_STACK',\n\tRUNTIME_ROOT: 'DEVSTACK_RUNTIME_ROOT',\n\t/** Legacy alias for `RUNTIME_ROOT`; lower precedence. */\n\tSTATE_DIR: 'DEVSTACK_STATE_DIR',\n\tMANIFEST_PATH: 'DEVSTACK_MANIFEST_PATH',\n} as const;\n\nexport interface ResolveDiscoveryEnvOptions {\n\t/** Explicit stack name. Wins over `$DEVSTACK_STACK`. */\n\treadonly stack?: string;\n\t/** Explicit state-dir / runtime-root. Wins over both env vars. */\n\treadonly stateDir?: string;\n}\n\nexport interface ResolvedDiscoveryEnv {\n\t/** Resolved stack name (never empty). */\n\treadonly stack: string;\n\t/** Resolved state-dir / runtime-root (never empty). May be absolute\n\t * — `discoverManifestPath` degenerates the walk-up to a single\n\t * existence check in that case. */\n\treadonly stateDir: string;\n}\n\nconst firstNonEmpty = (\n\t...candidates: ReadonlyArray<string | undefined>\n): string | undefined => {\n\tfor (const candidate of candidates) {\n\t\tif (candidate !== undefined && candidate !== '') return candidate;\n\t}\n\treturn undefined;\n};\n\n/**\n * Resolve the canonical stack + state-dir ladder.\n *\n * Precedence (highest → lowest), identical for both rungs:\n * - stack: `options.stack` > `$DEVSTACK_STACK` > `'main'`\n * - stateDir: `options.stateDir` > `$DEVSTACK_RUNTIME_ROOT`\n * > `$DEVSTACK_STATE_DIR` > `'.devstack'`\n *\n * Empty-string env values are treated as unset (a blank\n * `DEVSTACK_STATE_DIR=` must not pin the state root to the cwd). Pure —\n * no `process.env` read; callers pass the bag (a fixture in tests).\n */\nexport const resolveDiscoveryEnv = (\n\tenv: Readonly<Record<string, string | undefined>>,\n\toptions: ResolveDiscoveryEnvOptions = {},\n): ResolvedDiscoveryEnv => ({\n\tstack:\n\t\tfirstNonEmpty(options.stack?.trim(), env[DISCOVERY_ENV.STACK]?.trim()) ??\n\t\tDEFAULT_DISCOVERY_STACK,\n\tstateDir:\n\t\tfirstNonEmpty(\n\t\t\toptions.stateDir,\n\t\t\tenv[DISCOVERY_ENV.RUNTIME_ROOT],\n\t\t\tenv[DISCOVERY_ENV.STATE_DIR],\n\t\t) ?? DEFAULT_DISCOVERY_STATE_DIR,\n});\n"],"mappings":";;;;AAsBA,MAAa,8BAA8B;;;AAI3C,MAAa,0BAA0B;;;;;AAMvC,MAAa,gBAAgB;CAC5B,OAAO;CACP,cAAc;;CAEd,WAAW;CACX,eAAe;CACf;AAkBD,MAAM,iBACL,GAAG,eACqB;AACxB,MAAK,MAAM,aAAa,WACvB,KAAI,cAAc,KAAA,KAAa,cAAc,GAAI,QAAO;;;;;;;;;;;;;;AAiB1D,MAAa,uBACZ,KACA,UAAsC,EAAE,MACb;CAC3B,OACC,cAAc,QAAQ,OAAO,MAAM,EAAE,IAAI,cAAc,QAAQ,MAAM,CAAC,IAAA;CAEvE,UACC,cACC,QAAQ,UACR,IAAI,cAAc,eAClB,IAAI,cAAc,WAClB,IAAA;CACF"}
1
+ {"version":3,"file":"resolve-discovery-env.mjs","names":[],"sources":["../../../src/build-integrations/runtime/resolve-discovery-env.ts"],"sourcesContent":["// Shared discovery env-ladder resolver.\n//\n// ONE place that turns (caller options + env bag) into the resolved\n// `{ stack, stateDir }` tuple every build integration discovers a\n// manifest with. Before this existed the ladder was copy-pasted in\n// `discover.ts`, the vitest loader, the playwright stack-context, and\n// the playwright global-setup single-stack fallback — and the two\n// playwright sites had drifted: they read only `DEVSTACK_STATE_DIR`\n// and silently ignored `DEVSTACK_RUNTIME_ROOT`. Consolidating here\n// makes that omission impossible and matches STYLE_GUIDE §7: \"L5 build\n// integrations use `build-integrations/runtime/` as the canonical\n// substrate; per-integration reimplementations of manifest discovery\n// consolidate there.\"\n//\n// The stack ladder mirrors the CLI's `resolveStackName`\n// (`api/inference-network.ts`): explicit > `$DEVSTACK_STACK` > nearest\n// package.json `name` > `'main'`. The package-name rung is opt-in via\n// `options.cwd` and exists because `devstack up` in a bare app (no\n// `stackName` in config, no env) names the stack after the package —\n// a discovery ladder that hard-defaulted to `'main'` would look for a\n// manifest the supervisor never wrote, so `pnpm test` (vitest loader),\n// the playwright stack-context, and the vite plugin's cold start all\n// missed a live stack.\n//\n// `DEVSTACK_MANIFEST_PATH` is deliberately NOT resolved here — it is a\n// whole-path escape hatch handled inside `discoverManifestPath`\n// (env-miss must throw, not fall through to the walk-up), so threading\n// it through this stateDir/stack ladder would be the wrong layer.\n\nimport { DEFAULT_STACK_NAME, inferPackageNameFromCwd } from '../../api/inference-network.ts';\n\n/** Default state-dir / runtime-root name when neither an explicit\n * option nor any env override is present. Mirrors `DEFAULT_STATE_DIR`\n * in `discover.ts` (same literal `.devstack`). */\nexport const DEFAULT_DISCOVERY_STATE_DIR = '.devstack';\n\n/** Default stack name when neither an explicit option, `$DEVSTACK_STACK`,\n * nor the (opt-in) package-name rung yields a value. Re-export of the\n * CLI resolver's `DEFAULT_STACK_NAME` literal — the literal lives in\n * `inference-network.ts` because this module imports its inference\n * helper (see the module-cycle note there). */\nexport const DEFAULT_DISCOVERY_STACK = DEFAULT_STACK_NAME;\n\n/** Env-var names the discovery ladder consults for the stack +\n * state-dir rungs. `MANIFEST_PATH` lives here for documentation parity\n * with the integration env tables but is resolved by\n * `discoverManifestPath`, not this ladder. */\nexport const DISCOVERY_ENV = {\n\tSTACK: 'DEVSTACK_STACK',\n\tRUNTIME_ROOT: 'DEVSTACK_RUNTIME_ROOT',\n\t/** Legacy alias for `RUNTIME_ROOT`; lower precedence. */\n\tSTATE_DIR: 'DEVSTACK_STATE_DIR',\n\tMANIFEST_PATH: 'DEVSTACK_MANIFEST_PATH',\n} as const;\n\nexport interface ResolveDiscoveryEnvOptions {\n\t/** Explicit stack name. Wins over `$DEVSTACK_STACK`. */\n\treadonly stack?: string;\n\t/** Explicit state-dir / runtime-root. Wins over both env vars. */\n\treadonly stateDir?: string;\n\t/** Walk-up start for the package-name rung of the stack ladder,\n\t * mirroring the CLI's `resolveStackName`. Opt-in: omit it and the\n\t * resolver stays side-effect-free (no fs reads). When provided,\n\t * the `package.json` walk-up runs LAZILY — only when both the\n\t * explicit and `$DEVSTACK_STACK` rungs miss. */\n\treadonly cwd?: string;\n}\n\nexport interface ResolvedDiscoveryEnv {\n\t/** Resolved stack name (never empty). */\n\treadonly stack: string;\n\t/** Resolved state-dir / runtime-root (never empty). May be absolute\n\t * — `discoverManifestPath` degenerates the walk-up to a single\n\t * existence check in that case. */\n\treadonly stateDir: string;\n}\n\nconst firstNonEmpty = (...candidates: ReadonlyArray<string | undefined>): string | undefined => {\n\tfor (const candidate of candidates) {\n\t\tif (candidate !== undefined && candidate !== '') return candidate;\n\t}\n\treturn undefined;\n};\n\n/**\n * Resolve the canonical stack + state-dir ladder.\n *\n * Precedence (highest → lowest):\n * - stack: `options.stack` > `$DEVSTACK_STACK`\n * > nearest package.json `name` above `options.cwd`\n * (rung skipped when `cwd` is omitted)\n * > `'main'`\n * - stateDir: `options.stateDir` > `$DEVSTACK_RUNTIME_ROOT`\n * > `$DEVSTACK_STATE_DIR` > `'.devstack'`\n *\n * The stack ladder matches the CLI's `resolveStackName`, so discovery\n * agrees with `devstack up` about which stack a bare app runs (see the\n * module header). Empty-string env values are treated as unset (a blank\n * `DEVSTACK_STATE_DIR=` must not pin the state root to the cwd). No\n * `process.env` read callers pass the bag (a fixture in tests) — and\n * no fs access unless `options.cwd` is provided AND the first two stack\n * rungs miss (the package.json walk-up is lazy).\n */\nexport const resolveDiscoveryEnv = (\n\tenv: Readonly<Record<string, string | undefined>>,\n\toptions: ResolveDiscoveryEnvOptions = {},\n): ResolvedDiscoveryEnv => {\n\tconst stackFromInputs = firstNonEmpty(options.stack?.trim(), env[DISCOVERY_ENV.STACK]?.trim());\n\treturn {\n\t\tstack:\n\t\t\tstackFromInputs ??\n\t\t\t(options.cwd !== undefined ? inferPackageNameFromCwd(options.cwd) : undefined) ??\n\t\t\tDEFAULT_DISCOVERY_STACK,\n\t\tstateDir:\n\t\t\tfirstNonEmpty(\n\t\t\t\toptions.stateDir,\n\t\t\t\tenv[DISCOVERY_ENV.RUNTIME_ROOT],\n\t\t\t\tenv[DISCOVERY_ENV.STATE_DIR],\n\t\t\t) ?? DEFAULT_DISCOVERY_STATE_DIR,\n\t};\n};\n"],"mappings":";;;;;AAkCA,MAAa,8BAA8B;;;;;;AAO3C,MAAa,0BAA0B;;;;;AAMvC,MAAa,gBAAgB;CAC5B,OAAO;CACP,cAAc;;CAEd,WAAW;CACX,eAAe;AAChB;AAwBA,MAAM,iBAAiB,GAAG,eAAsE;CAC/F,KAAK,MAAM,aAAa,YACvB,IAAI,cAAc,KAAA,KAAa,cAAc,IAAI,OAAO;AAG1D;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,uBACZ,KACA,UAAsC,CAAC,MACb;CAE1B,OAAO;EACN,OAFuB,cAAc,QAAQ,OAAO,KAAK,GAAG,IAAI,cAAc,MAAM,EAAE,KAAK,CAG5E,MACb,QAAQ,QAAQ,KAAA,IAAY,wBAAwB,QAAQ,GAAG,IAAI,KAAA,MACpE;EACD,UACC,cACC,QAAQ,UACR,IAAI,cAAc,eAClB,IAAI,cAAc,UACnB,KAAA;CACF;AACD"}
@@ -7,7 +7,7 @@ import { EndpointRegistry } from "./endpoint-registry.mjs";
7
7
  interface StackIdentity {
8
8
  readonly app: string;
9
9
  readonly stack: string;
10
- readonly chain: string;
10
+ readonly network: string;
11
11
  }
12
12
  /** Flat endpoint entry exposed to consumers. Mirrors the substrate's
13
13
  * `EndpointEntry` but uses plain strings (no `Brand<>`) so callers
@@ -28,7 +28,7 @@ interface ResolvedEndpoint {
28
28
  * schema decoded": discovery surfaces add the resolved `manifestPath`
29
29
  * and the typed `endpoints` registry that wraps the flat map. */
30
30
  interface StackContext {
31
- /** Stack identity — name / app / chain. */
31
+ /** Stack identity — name / app / network. */
32
32
  readonly identity: StackIdentity;
33
33
  /** Absolute path to the on-disk manifest the projection derives
34
34
  * from. Used by error messages and by callers that want to watch
@@ -4,13 +4,59 @@
4
4
  * prefix in three derivable places: this plugin option, the
5
5
  * `tsconfig` `paths` entry, and its import specifiers. */
6
6
  declare const DEFAULT_GENERATED_ALIAS = "@generated";
7
+ /** Default dev-extras import-alias prefix. Resolves the PRIMARY stack's
8
+ * `.devstack/stacks/<stack>/generated-extras` tree (dev-only / secret
9
+ * artifacts — `accounts.ts`, `dev-wallet.ts`). Mirror the `@generated`
10
+ * three-place discipline: this option, the `tsconfig` `paths` entry,
11
+ * and the import specifiers. */
12
+ declare const DEFAULT_DEV_EXTRAS_ALIAS = "@devstack-dev";
7
13
  interface DevstackVitePluginOptions {
8
14
  /** Import-alias prefix. Default `'@generated'`. */
9
15
  readonly alias?: string;
16
+ /** Dev-extras import-alias prefix. Default `'@devstack-dev'`. */
17
+ readonly devExtrasAlias?: string;
10
18
  /** Explicit generated dir — bypasses manifest discovery entirely
11
19
  * (escape hatch for unusual layouts / tests). Relative paths
12
20
  * resolve against the Vite root. */
13
21
  readonly generatedDir?: string;
22
+ /** Explicit dev-extras dir — bypasses manifest discovery. Relative
23
+ * paths resolve against the Vite root. */
24
+ readonly extrasDir?: string;
25
+ /** Inject + register the devstack dev wallet on the page in DEV
26
+ * (wallet-standard, so dApp Kit auto-discovers it). Defaults to
27
+ * `true`. Production builds (`command === 'build'`) inject nothing
28
+ * regardless. */
29
+ readonly injectDevWallet?: boolean;
30
+ /** Auto-approve all dev-wallet signing requests (headless Playwright /
31
+ * in-app "Open/Join as" buttons). Defaults to the `DEVSTACK_AUTO_APPROVE`
32
+ * env (`'1'`/`'true'`), then to the active network's `autoApproveSigning`
33
+ * per-network policy (ON for every network except live `mainnet`). A
34
+ * single switch, replacing per-app `VITE_*_AUTO_APPROVE`.
35
+ *
36
+ * HARD-CLAMP: on live `mainnet` the per-network policy forces
37
+ * auto-approve OFF — a real-funds signature is NEVER granted without a
38
+ * human in the loop. An explicit `autoApprove: true` here, or
39
+ * `DEVSTACK_AUTO_APPROVE`, still take precedence (the author opted in
40
+ * deliberately), but the policy default never silently auto-approves on
41
+ * mainnet. */
42
+ readonly autoApprove?: boolean;
43
+ /** Per-network overrides for the dev-convenience policy (the same
44
+ * `networkOptions` shape `defineDevstack` takes, forwarded verbatim).
45
+ * Only the `autoApproveSigning` field is read here, to resolve the
46
+ * auto-approve default for the active network. Omitted ⇒ the built-in
47
+ * policy (ON except live `mainnet`) applies. The override RECORD is not
48
+ * otherwise on disk, so an app that customizes per-network signing must
49
+ * thread it here explicitly; the mainnet hard-clamp holds regardless. */
50
+ readonly networkOptions?: Readonly<Record<string, unknown>>;
51
+ /** Production id-config FILE — the known deployment's `devstack-ids.json`
52
+ * (same schema the dev stack writes), committed at e.g.
53
+ * `config/<network>.ids.json`. Used only for `command === 'build'` to
54
+ * inject `__DEVSTACK_IDS__`. Relative paths resolve against the Vite
55
+ * root. If omitted, the `DEVSTACK_IDS_FILE` env (a path pointer) is used.
56
+ * Neither ⇒ no ids baked, and the generated resolver throws loudly at
57
+ * id-access time. We deliberately take a FILE, not a JSON env blob: a
58
+ * real deployment's ids are many + nested. */
59
+ readonly ids?: string;
14
60
  }
15
61
  /** A `vite` `Plugin`'s `config` hook receives the partial user config.
16
62
  * We only ever read `config.root` and return a `resolve.alias` patch,
@@ -19,33 +65,52 @@ interface DevstackVitePluginOptions {
19
65
  * presets avoid importing their optional peer at module init). */
20
66
  interface ViteUserConfigLike {
21
67
  readonly root?: string;
68
+ readonly command?: 'build' | 'serve';
69
+ }
70
+ /** The structural `Plugin` shape we return — `name`, a `config` hook, and
71
+ * the DEV-only dev-wallet-injection hooks. Typed as the loose object Vite
72
+ * accepts (Vite's `Plugin` is structurally compatible) so callers spread
73
+ * it into `plugins: []` without devstack depending on `vite`. */
74
+ /** Vite's `config` hook second arg — `{ command, mode }`. We read only
75
+ * `command` to pick the dev vs prod id-injection source. */
76
+ interface ViteConfigEnvLike {
77
+ readonly command?: 'build' | 'serve';
22
78
  }
23
- /** The structural `Plugin` shape we return — `name` + a `config` hook.
24
- * Typed as the loose object Vite accepts (Vite's `Plugin` is
25
- * structurally compatible) so callers spread it into `plugins: []`
26
- * without devstack depending on `vite`. */
27
79
  interface DevstackVitePlugin {
28
80
  readonly name: string;
29
- readonly config: (config: ViteUserConfigLike) => {
81
+ readonly config: (config: ViteUserConfigLike, env?: ViteConfigEnvLike) => {
30
82
  readonly resolve: {
31
83
  readonly alias: Record<string, string>;
84
+ readonly dedupe?: string[];
85
+ };
86
+ readonly optimizeDeps?: {
87
+ readonly include: string[];
32
88
  };
89
+ /** Build-time `define` injecting the on-chain ids as the
90
+ * `__DEVSTACK_IDS__` global (the generated resolver reads it). */
91
+ readonly define: Record<string, string>;
33
92
  };
93
+ /** Capture the resolved command so injection is DEV-only. */
94
+ readonly configResolved: (config: ViteUserConfigLike) => void;
95
+ /** Resolve the dev-wallet virtual module. */
96
+ readonly resolveId: (id: string) => string | undefined;
97
+ /** Emit the dev-wallet register module (or a no-op when not applicable). */
98
+ readonly load: (id: string) => string | undefined;
99
+ /** Inject a `<script type="module">` importing the virtual module into
100
+ * the dev page's HTML. DEV-only. The return shape mirrors a structural
101
+ * subset of Vite's `IndexHtmlTransformResult` (mutable `tags`,
102
+ * `injectTo` as the literal `'head'`) so the plugin stays assignable to
103
+ * Vite's `Plugin` without devstack importing `vite`. */
104
+ readonly transformIndexHtml: (html: string) => {
105
+ html: string;
106
+ tags: Array<{
107
+ tag: string;
108
+ attrs: Record<string, string | boolean>;
109
+ injectTo: 'head';
110
+ }>;
111
+ } | undefined;
34
112
  }
35
- /**
36
- * Build the devstack Vite plugin that aliases `options.alias`
37
- * (default `@generated`) at the active stack's codegen output dir.
38
- *
39
- * // vite.config.ts
40
- * import { devstackVitePlugin } from '@mysten-incubation/devstack/vite';
41
- * export default defineConfig({ plugins: [devstackVitePlugin()] });
42
- * // or devstackVitePlugin({ alias: '@gen' })
43
- *
44
- * The plugin's `config` hook merges `resolve.alias[<prefix>] = <dir>`
45
- * into the user config (Vite deep-merges the returned partial). Sync;
46
- * reads `process.env` + the manifest once at config-load.
47
- */
48
113
  declare const devstackVitePlugin: (options?: DevstackVitePluginOptions) => DevstackVitePlugin;
49
114
  //#endregion
50
- export { DEFAULT_GENERATED_ALIAS, DevstackVitePlugin, DevstackVitePluginOptions, devstackVitePlugin };
115
+ export { DEFAULT_DEV_EXTRAS_ALIAS, DEFAULT_GENERATED_ALIAS, DevstackVitePlugin, DevstackVitePluginOptions, devstackVitePlugin };
51
116
  //# sourceMappingURL=index.d.mts.map