@mysten-incubation/devstack 0.1.1 → 0.3.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 (861) hide show
  1. package/README.md +6 -3
  2. package/dashboard-ui/assets/grpc-Clz0oOtc.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-Cmqv9kiU.js +1283 -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 +203 -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 +3 -31
  29. package/dist/build-integrations/playwright/config.mjs +2 -28
  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 +114 -19
  58. package/dist/build-integrations/vite/index.mjs +239 -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 +15 -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 +8 -5
  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 +225 -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 +450 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -32
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +303 -60
  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 +124 -168
  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 +25 -46
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +52 -93
  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 +45 -37
  276. package/dist/plugins/deepbook/index.mjs +136 -67
  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 +44 -93
  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 +37 -6
  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 +2 -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/file-watcher.mjs +54 -0
  576. package/dist/substrate/runtime/lifecycle/file-watcher.mjs.map +1 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  578. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  579. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  580. package/dist/substrate/runtime/lifecycle/index.mjs +3 -2
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  582. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  583. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  585. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  587. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  589. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  590. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  592. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +76 -7
  593. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  594. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  595. package/dist/substrate/runtime/managed-container.mjs +8 -10
  596. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  597. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  598. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  599. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  600. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  602. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  603. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  604. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  605. package/dist/substrate/runtime/observability/index.mjs +4 -6
  606. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  607. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  608. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  610. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  614. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  615. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  616. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  617. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  618. package/dist/substrate/runtime/paths.mjs +27 -9
  619. package/dist/substrate/runtime/paths.mjs.map +1 -1
  620. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  621. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  622. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  623. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  624. package/dist/substrate/runtime/probes.d.mts +2 -3
  625. package/dist/substrate/runtime/probes.mjs.map +1 -1
  626. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  628. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  629. package/dist/substrate/runtime/projection/update.mjs +87 -11
  630. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  631. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  632. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  633. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  635. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  636. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  637. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  638. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  639. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  640. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  641. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  642. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  643. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  644. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  645. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  646. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  647. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  649. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  650. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  651. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  652. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  654. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  656. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  658. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  659. package/dist/substrate/runtime/supervisor/contribution-dispatcher.d.mts +1 -0
  660. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  661. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  662. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  663. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  665. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  666. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  667. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +61 -75
  668. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  670. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  671. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  672. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  673. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  674. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  675. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  676. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  677. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  678. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  679. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  680. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  681. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  682. package/dist/surfaces/cli/command-tree.mjs +49 -7
  683. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/config.mjs +1 -1
  685. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  686. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  689. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  690. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  692. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  693. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  694. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  695. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/status.mjs +1 -1
  697. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  698. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  699. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  700. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  701. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  702. package/dist/surfaces/cli/errors.mjs.map +1 -1
  703. package/dist/surfaces/cli/flags.mjs.map +1 -1
  704. package/dist/surfaces/cli/index.mjs +45 -14
  705. package/dist/surfaces/cli/index.mjs.map +1 -1
  706. package/dist/surfaces/cli/output.mjs.map +1 -1
  707. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  708. package/dist/surfaces/tui/app.mjs +0 -21
  709. package/dist/surfaces/tui/app.mjs.map +1 -1
  710. package/dist/surfaces/tui/dashboard.mjs +0 -48
  711. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  712. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  713. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  714. package/dist/surfaces/tui/errors.mjs.map +1 -1
  715. package/dist/surfaces/tui/event-log.mjs +0 -9
  716. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  717. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  718. package/dist/surfaces/tui/index.mjs +2 -2
  719. package/dist/surfaces/tui/index.mjs.map +1 -1
  720. package/dist/surfaces/tui/input.mjs.map +1 -1
  721. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  722. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  723. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  724. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  725. package/dist/surfaces/tui/resource-table.mjs +8 -10
  726. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  727. package/images/postgres/Dockerfile +0 -1
  728. package/images/sui/Dockerfile +27 -54
  729. package/images/sui/entrypoint.sh +17 -179
  730. package/package.json +23 -15
  731. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  732. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  733. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  734. package/dist/api/plugin-errors.d.mts +0 -7
  735. package/dist/api/plugin-errors.mjs +0 -10
  736. package/dist/api/plugin-errors.mjs.map +0 -1
  737. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  738. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  739. package/dist/contracts/capability-decl.d.mts +0 -40
  740. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  741. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  742. package/dist/orchestrators/run.mjs +0 -91
  743. package/dist/orchestrators/run.mjs.map +0 -1
  744. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  745. package/dist/orchestrators/runtime-composition.mjs +0 -252
  746. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  748. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  749. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  750. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  751. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  752. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  753. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  754. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  755. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  756. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  757. package/dist/plugins/account/spans.mjs +0 -16
  758. package/dist/plugins/account/spans.mjs.map +0 -1
  759. package/dist/plugins/account/variants/env.mjs +0 -24
  760. package/dist/plugins/account/variants/env.mjs.map +0 -1
  761. package/dist/plugins/account/variants/inline.mjs +0 -13
  762. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  763. package/dist/plugins/account/variants/keystore.mjs +0 -91
  764. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  765. package/dist/plugins/action/spans.mjs +0 -11
  766. package/dist/plugins/action/spans.mjs.map +0 -1
  767. package/dist/plugins/coin/spans.mjs +0 -20
  768. package/dist/plugins/coin/spans.mjs.map +0 -1
  769. package/dist/plugins/deepbook/spans.mjs +0 -18
  770. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  771. package/dist/plugins/faucet/spans.mjs +0 -12
  772. package/dist/plugins/faucet/spans.mjs.map +0 -1
  773. package/dist/plugins/package/spans.mjs +0 -14
  774. package/dist/plugins/package/spans.mjs.map +0 -1
  775. package/dist/plugins/postgres/codegen.mjs +0 -42
  776. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  777. package/dist/plugins/postgres/connection.d.mts +0 -33
  778. package/dist/plugins/postgres/connection.mjs.map +0 -1
  779. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  780. package/dist/plugins/postgres/errors.d.mts +0 -60
  781. package/dist/plugins/postgres/errors.mjs +0 -29
  782. package/dist/plugins/postgres/errors.mjs.map +0 -1
  783. package/dist/plugins/postgres/index.d.mts +0 -37
  784. package/dist/plugins/postgres/index.mjs +0 -68
  785. package/dist/plugins/postgres/index.mjs.map +0 -1
  786. package/dist/plugins/postgres/routable.mjs +0 -33
  787. package/dist/plugins/postgres/routable.mjs.map +0 -1
  788. package/dist/plugins/postgres/service.d.mts +0 -50
  789. package/dist/plugins/postgres/service.mjs +0 -179
  790. package/dist/plugins/postgres/service.mjs.map +0 -1
  791. package/dist/plugins/postgres/snapshot.mjs +0 -32
  792. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  793. package/dist/plugins/postgres/spans.mjs +0 -11
  794. package/dist/plugins/postgres/spans.mjs.map +0 -1
  795. package/dist/plugins/seal/spans.mjs +0 -18
  796. package/dist/plugins/seal/spans.mjs.map +0 -1
  797. package/dist/plugins/sui/spans.mjs +0 -17
  798. package/dist/plugins/sui/spans.mjs.map +0 -1
  799. package/dist/plugins/wallet/spans.mjs +0 -22
  800. package/dist/plugins/wallet/spans.mjs.map +0 -1
  801. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  802. package/dist/plugins/walrus/spans.mjs +0 -18
  803. package/dist/plugins/walrus/spans.mjs.map +0 -1
  804. package/dist/runtime/docker/logs.d.mts +0 -1
  805. package/dist/runtime/docker/logs.mjs +0 -34
  806. package/dist/runtime/docker/logs.mjs.map +0 -1
  807. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  808. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  809. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  810. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  811. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  812. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  813. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  814. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  815. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  816. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  818. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  819. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  820. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  821. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  822. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  823. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  826. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  829. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  830. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  831. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  832. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  833. package/dist/substrate/runtime/projection/index.mjs +0 -4
  834. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  835. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  836. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  837. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  839. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  840. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  841. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  842. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  844. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  845. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  846. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  847. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  850. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  851. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  852. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  853. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  854. package/dist/substrate/state-store.d.mts +0 -1
  855. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  856. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  857. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  858. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  859. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  860. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → lifecycle/file-watcher.d.mts} +0 -0
  861. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"selective-restart.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/selective-restart.ts"],"sourcesContent":["// Selective-restart driver.\n//\n// Architecture § Watch-triggered invalidation:\n// \"L0 watcher emits a debounced+deduped content-hash event. L3 watch\n// dispatcher consults plugin watch decls. Matched plugins enter\n// `selective-restart-pending`. Scheduler runs subset invalidate: evict\n// shadow-cache entry BEFORE closing scope; run finalizers (parallel\n// strategy); re-acquire.\"\n//\n// Architecture § Selective restart cascading:\n// \"Invalidating a producer invalidates downstream consumers along\n// dep-graph edges (cascade semantics — engine already has this).\"\n//\n// This module is the planner: given a set of root keys to invalidate,\n// compute the downstream slice, order it for teardown and re-acquire.\n// The actual `Scope.close` / `acquire` calls live in `supervisor.ts`\n// so it can fold them into the per-cycle event stream.\n\nimport { Data, Effect } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport { downstreamClosure, orderByLevel, type ResolvedGraph } from './dep-graph.ts';\n\n/** Tagged error: a restart was requested for a key that isn't in the\n * graph. The supervisor lifts this from `attribute()` callers that\n * somehow produced a stale key — defensive. */\nexport class RestartTargetMissing extends Data.TaggedError('RestartTargetMissing')<{\n\treadonly pluginKey: PluginKey;\n}> {}\n\n/** A planned slice of work for selective restart. The supervisor:\n * 1. Tears down `teardownOrder` (reverse-dep, parallel-within-level).\n * 2. Re-acquires `acquireOrder` (forward, level-batched-parallel).\n *\n * The two arrays cover the same set of keys; the difference is the\n * iteration direction. */\nexport interface RestartPlan {\n\treadonly slice: ReadonlySet<PluginKey>;\n\treadonly teardownOrder: ReadonlyArray<PluginKey>;\n\treadonly acquireOrder: ReadonlyArray<PluginKey>;\n}\n\n/**\n * Build a restart plan from a set of root invalidation targets. Each\n * root contributes its full downstream closure to the slice.\n */\nexport const planRestart = (\n\tgraph: ResolvedGraph,\n\troots: ReadonlySet<PluginKey>,\n): Effect.Effect<RestartPlan, RestartTargetMissing> =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.annotateCurrentSpan({ 'devstack.restart.rootCount': roots.size });\n\t\tfor (const root of roots) {\n\t\t\tif (!graph.nodes.has(root)) {\n\t\t\t\treturn yield* Effect.fail(new RestartTargetMissing({ pluginKey: root }));\n\t\t\t}\n\t\t}\n\t\tconst slice = new Set<PluginKey>();\n\t\tfor (const root of roots) {\n\t\t\tfor (const key of downstreamClosure(graph, root)) slice.add(key);\n\t\t}\n\t\tconst teardownOrder = orderByLevel(graph, slice, 'reverse');\n\t\tconst acquireOrder = orderByLevel(graph, slice, 'forward');\n\t\treturn { slice, teardownOrder, acquireOrder } satisfies RestartPlan;\n\t}).pipe(Effect.withSpan('lifecycle.selective-restart.plan'));\n\n/**\n * Drain plan for `stack.stop` and graceful shutdown. All keys in\n * dep-graph order, reverse. Architecture § Stack lifecycle:\n * \"shutdown.requested parallel teardown (max grace, not sum grace)\"\n *\n * The \"parallel within a level\" semantics live in the supervisor's\n * execution loop; this planner just produces the level batches in\n * reverse.\n */\nexport const planFullDrain = (graph: ResolvedGraph): RestartPlan => {\n\tconst slice = new Set<PluginKey>(graph.nodes.keys());\n\tconst teardownOrder = orderByLevel(graph, slice, 'reverse');\n\tconst acquireOrder = orderByLevel(graph, slice, 'forward');\n\treturn { slice, teardownOrder, acquireOrder };\n};\n"],"mappings":";;;;;;AA0BA,IAAa,uBAAb,cAA0C,KAAK,YAAY,uBAAuB,CAE/E;;;;;AAkBH,MAAa,eACZ,OACA,UAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB,EAAE,8BAA8B,MAAM,MAAM,CAAC;AAC/E,MAAK,MAAM,QAAQ,MAClB,KAAI,CAAC,MAAM,MAAM,IAAI,KAAK,CACzB,QAAO,OAAO,OAAO,KAAK,IAAI,qBAAqB,EAAE,WAAW,MAAM,CAAC,CAAC;CAG1E,MAAM,wBAAQ,IAAI,KAAgB;AAClC,MAAK,MAAM,QAAQ,MAClB,MAAK,MAAM,OAAO,kBAAkB,OAAO,KAAK,CAAE,OAAM,IAAI,IAAI;AAIjE,QAAO;EAAE;EAAO,eAFM,aAAa,OAAO,OAAO,UAEpB;EAAE,cADV,aAAa,OAAO,OAAO,UACL;EAAE;EAC5C,CAAC,KAAK,OAAO,SAAS,mCAAmC,CAAC;;;;;;;;;;AAW7D,MAAa,iBAAiB,UAAsC;CACnE,MAAM,QAAQ,IAAI,IAAe,MAAM,MAAM,MAAM,CAAC;AAGpD,QAAO;EAAE;EAAO,eAFM,aAAa,OAAO,OAAO,UAEpB;EAAE,cADV,aAAa,OAAO,OAAO,UACL;EAAE"}
1
+ {"version":3,"file":"selective-restart.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/selective-restart.ts"],"sourcesContent":["// Selective-restart driver.\n//\n// Architecture § Watch-triggered invalidation:\n// \"L0 watcher emits a debounced+deduped content-hash event. L3 watch\n// dispatcher consults plugin watch decls. Matched plugins enter\n// `selective-restart-pending`. Scheduler runs subset invalidate: evict\n// shadow-cache entry BEFORE closing scope; run finalizers (parallel\n// strategy); re-acquire.\"\n//\n// Architecture § Selective restart cascading:\n// \"Invalidating a producer invalidates downstream consumers along\n// dep-graph edges (cascade semantics — engine already has this).\"\n//\n// This module is the planner: given a set of root keys to invalidate,\n// compute the downstream slice, order it for teardown and re-acquire.\n// The actual `Scope.close` / `acquire` calls live in `supervisor.ts`\n// so it can fold them into the per-cycle event stream.\n\nimport { Data, Effect } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport { plan, type GraphPlan } from '../reconcile/graph.ts';\nimport { downstreamClosure, type DepNode, type ResolvedGraph } from './dep-graph.ts';\n\n/** Tagged error: a restart was requested for a key that isn't in the\n * graph. The supervisor lifts this from `attribute()` callers that\n * somehow produced a stale key — defensive. */\nexport class RestartTargetMissing extends Data.TaggedError('RestartTargetMissing')<{\n\treadonly pluginKey: PluginKey;\n}> {}\n\n/**\n * Build a restart plan from a set of root invalidation targets. Each\n * root contributes its full downstream closure to the slice. The\n * downstream-closure slice computation + the root-membership validation\n * are this planner's unique work; the dep-ordering itself delegates to\n * the shared reconcile `plan` body, which returns a `GraphPlan`.\n */\nexport const planRestart = (\n\tgraph: ResolvedGraph,\n\troots: ReadonlySet<PluginKey>,\n): Effect.Effect<GraphPlan, RestartTargetMissing> =>\n\tEffect.gen(function* () {\n\t\tfor (const root of roots) {\n\t\t\tif (!graph.nodes.has(root)) {\n\t\t\t\treturn yield* Effect.fail(new RestartTargetMissing({ pluginKey: root }));\n\t\t\t}\n\t\t}\n\t\tconst slice = new Set<PluginKey>();\n\t\tfor (const root of roots) {\n\t\t\tfor (const key of downstreamClosure(graph, root)) slice.add(key);\n\t\t}\n\t\treturn plan(graph, { kind: 'graph-keys', keys: [...slice] });\n\t});\n\n/** Plan a drain + re-acquire of the whole graph MINUS the nodes matched by\n * `exclude`. The excluded nodes stay live while every other plugin is\n * drained + re-acquired.\n *\n * The live `snapshot.restore` re-acquire passes a predicate over the\n * plugin-declared keep-alive flag so a plugin whose transport is\n * answering the restore isn't torn down mid-flight (which would surface\n * to its caller as a 502 even though the restore succeeded). This module\n * filters purely on the node flag it has no knowledge of which plugins\n * set it. `stack.restart` / CLI full-restart drains everything by passing\n * the full key set straight to `plan`. */\nexport const planExcluding = (\n\tgraph: ResolvedGraph,\n\texclude: (node: DepNode) => boolean,\n): GraphPlan => {\n\tconst slice = new Set<PluginKey>();\n\tfor (const [key, node] of graph.nodes) {\n\t\tif (!exclude(node)) slice.add(key);\n\t}\n\treturn plan(graph, { kind: 'graph-keys', keys: [...slice] });\n};\n"],"mappings":";;;;;;;AA2BA,IAAa,uBAAb,cAA0C,KAAK,YAAY,sBAAsB,CAAC,CAE/E,CAAC;;;;;;;;AASJ,MAAa,eACZ,OACA,UAEA,OAAO,IAAI,aAAa;CACvB,KAAK,MAAM,QAAQ,OAClB,IAAI,CAAC,MAAM,MAAM,IAAI,IAAI,GACxB,OAAO,OAAO,OAAO,KAAK,IAAI,qBAAqB,EAAE,WAAW,KAAK,CAAC,CAAC;CAGzE,MAAM,wBAAQ,IAAI,IAAe;CACjC,KAAK,MAAM,QAAQ,OAClB,KAAK,MAAM,OAAO,kBAAkB,OAAO,IAAI,GAAG,MAAM,IAAI,GAAG;CAEhE,OAAO,KAAK,OAAO;EAAE,MAAM;EAAc,MAAM,CAAC,GAAG,KAAK;CAAE,CAAC;AAC5D,CAAC;;;;;;;;;;;;AAaF,MAAa,iBACZ,OACA,YACe;CACf,MAAM,wBAAQ,IAAI,IAAe;CACjC,KAAK,MAAM,CAAC,KAAK,SAAS,MAAM,OAC/B,IAAI,CAAC,QAAQ,IAAI,GAAG,MAAM,IAAI,GAAG;CAElC,OAAO,KAAK,OAAO;EAAE,MAAM;EAAc,MAAM,CAAC,GAAG,KAAK;CAAE,CAAC;AAC5D"}
@@ -57,7 +57,7 @@ const installSignalHandler = (commands, options = {}) => Effect.gen(function* ()
57
57
  for (const { signal, listener } of handlers) process.removeListener(signal, listener);
58
58
  }));
59
59
  return yield* Effect.never;
60
- }).pipe(Effect.withSpan("lifecycle.signals.installSignalHandler"));
60
+ });
61
61
  //#endregion
62
62
  export { installSignalHandler };
63
63
 
@@ -1 +1 @@
1
- {"version":3,"file":"signals.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/signals.ts"],"sourcesContent":["// POSIX signal handling.\n//\n// Architecture § Engine / supervisor split:\n// \"signals → L0 (one POSIX signal handler at process boot), routed\n// via the command channel.\"\n//\n// Discipline:\n// - ONE handler per process. Registering twice is a programmer\n// error.\n// - Signals translate to `EngineCommand`s on the typed command stream\n// (`shutdown.requested` for graceful, `shutdown.hardKillRequested`\n// for hard).\n// - Second SIGINT/SIGTERM escalates to abort: the hard-kill command\n// is offered first, then `process.exit(130)` (or 143 for SIGTERM)\n// is scheduled.\n//\n// The supervisor wires this fiber once at boot via `Effect.forkScoped`;\n// its scope is the supervisor's outer scope, so the handler unregisters\n// when the supervisor tears down (test environments that boot multiple\n// supervisors must close them before booting the next).\n\nimport { Effect, Queue, Scope } from 'effect';\n\nimport type { EngineCommand, ShutdownSignal } from '../../events.ts';\n\n/** Signals the supervisor handles. SIGHUP intentionally omitted —\n * reconfigure is a command-channel concern, not a signal one. */\nconst HANDLED_SIGNALS = ['SIGINT', 'SIGTERM'] as const satisfies ReadonlyArray<ShutdownSignal>;\ntype HandledSignal = (typeof HANDLED_SIGNALS)[number];\n\n/** Map a signal to the exit code POSIX clients expect — 128 + N. */\nconst exitCodeForSignal = (signal: HandledSignal): number => {\n\tswitch (signal) {\n\t\tcase 'SIGINT':\n\t\t\treturn 130;\n\t\tcase 'SIGTERM':\n\t\t\treturn 143;\n\t}\n};\n\nexport interface SignalHandlerOptions {\n\treadonly scheduleExit?: (exitCode: number) => void;\n}\n\nconst scheduleProcessExit = (exitCode: number): void => {\n\tsetImmediate(() => {\n\t\tprocess.exit(exitCode);\n\t});\n};\n\n/**\n * Install signal handlers that publish `shutdown.requested` (first\n * signal) and `shutdown.hardKillRequested` before scheduling process\n * exit (second handled signal).\n *\n * Returns an Effect that runs forever in its Scope; the supervisor\n * forks it via `Effect.forkScoped`. Scope close unregisters the\n * listeners — Node's `process` listeners persist past the scope\n * otherwise, leading to \"ghost\" handlers from prior test boots.\n */\nexport const installSignalHandler = (\n\tcommands: Queue.Enqueue<EngineCommand>,\n\toptions: SignalHandlerOptions = {},\n): Effect.Effect<never, never, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst scheduleExit = options.scheduleExit ?? scheduleProcessExit;\n\t\t// Capture the surrounding fiber's Context so the signal-listener\n\t\t// fork inherits the supervisor's logger Layer, fiber-refs, and\n\t\t// span context. Bare `Effect.runFork` evaluates against an empty\n\t\t// context — warnings/spans from the offered command would\n\t\t// otherwise bypass redaction rules and supervisor instrumentation.\n\t\tconst supervisorContext = yield* Effect.context<never>();\n\t\tconst runForkInherited = Effect.runForkWith(supervisorContext);\n\t\tlet shutdownRequested = false;\n\n\t\tconst handlers: Array<{\n\t\t\treadonly signal: HandledSignal;\n\t\t\treadonly listener: NodeJS.SignalsListener;\n\t\t}> = [];\n\n\t\tfor (const signal of HANDLED_SIGNALS) {\n\t\t\tconst listener: NodeJS.SignalsListener = () => {\n\t\t\t\tconst exitCode = exitCodeForSignal(signal);\n\t\t\t\tif (shutdownRequested) {\n\t\t\t\t\tconst offerEffect = Queue.offer(commands, {\n\t\t\t\t\t\ttag: 'shutdown.hardKillRequested',\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\texitCode,\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t} satisfies EngineCommand).pipe(\n\t\t\t\t\t\tEffect.andThen(Effect.sync(() => scheduleExit(exitCode))),\n\t\t\t\t\t);\n\t\t\t\t\trunForkInherited(offerEffect);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tshutdownRequested = true;\n\t\t\t\tprocess.exitCode ??= exitCode;\n\t\t\t\t// Publish `shutdown.requested` — same shape regardless of\n\t\t\t\t// which signal fired. The supervisor decides drain vs abort\n\t\t\t\t// on its own loop.\n\t\t\t\tconst offerEffect = Queue.offer(commands, {\n\t\t\t\t\ttag: 'shutdown.requested',\n\t\t\t\t} satisfies EngineCommand);\n\t\t\t\t// We're inside a Node listener; bridge into Effect via the\n\t\t\t\t// captured supervisor Context so the offered command\n\t\t\t\t// inherits logger/fiber-refs/spans. `runFork` returns a\n\t\t\t\t// fiber but we don't track it — the queue is bounded by\n\t\t\t\t// the supervisor's lifetime.\n\t\t\t\trunForkInherited(offerEffect);\n\t\t\t};\n\t\t\tprocess.on(signal, listener);\n\t\t\thandlers.push({ signal, listener });\n\t\t}\n\n\t\tyield* Effect.addFinalizer(() =>\n\t\t\tEffect.sync(() => {\n\t\t\t\tfor (const { signal, listener } of handlers) {\n\t\t\t\t\tprocess.removeListener(signal, listener);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\t// Park forever; the listeners themselves run synchronously in\n\t\t// Node's event loop, not in this fiber.\n\t\treturn yield* Effect.never;\n\t}).pipe(Effect.withSpan('lifecycle.signals.installSignalHandler'));\n\n/** Re-export the handled-signal list so tests / docs can enumerate. */\nexport const handledSignals: ReadonlyArray<HandledSignal> = HANDLED_SIGNALS;\n"],"mappings":";;;;AA2BA,MAAM,kBAAkB,CAAC,UAAU,UAAU;;AAI7C,MAAM,qBAAqB,WAAkC;AAC5D,SAAQ,QAAR;EACC,KAAK,SACJ,QAAO;EACR,KAAK,UACJ,QAAO;;;AAQV,MAAM,uBAAuB,aAA2B;AACvD,oBAAmB;AAClB,UAAQ,KAAK,SAAS;GACrB;;;;;;;;;;;;AAaH,MAAa,wBACZ,UACA,UAAgC,EAAE,KAElC,OAAO,IAAI,aAAa;CACvB,MAAM,eAAe,QAAQ,gBAAgB;CAM7C,MAAM,oBAAoB,OAAO,OAAO,SAAgB;CACxD,MAAM,mBAAmB,OAAO,YAAY,kBAAkB;CAC9D,IAAI,oBAAoB;CAExB,MAAM,WAGD,EAAE;AAEP,MAAK,MAAM,UAAU,iBAAiB;EACrC,MAAM,iBAAyC;GAC9C,MAAM,WAAW,kBAAkB,OAAO;AAC1C,OAAI,mBAAmB;AAStB,qBARoB,MAAM,MAAM,UAAU;KACzC,KAAK;KACL;KACA;KACA,IAAI,KAAK,KAAK;KACd,CAAyB,CAAC,KAC1B,OAAO,QAAQ,OAAO,WAAW,aAAa,SAAS,CAAC,CAAC,CAE9B,CAAC;AAC7B;;AAED,uBAAoB;AACpB,WAAQ,aAAa;AAYrB,oBARoB,MAAM,MAAM,UAAU,EACzC,KAAK,sBACL,CAM2B,CAAC;;AAE9B,UAAQ,GAAG,QAAQ,SAAS;AAC5B,WAAS,KAAK;GAAE;GAAQ;GAAU,CAAC;;AAGpC,QAAO,OAAO,mBACb,OAAO,WAAW;AACjB,OAAK,MAAM,EAAE,QAAQ,cAAc,SAClC,SAAQ,eAAe,QAAQ,SAAS;GAExC,CACF;AAID,QAAO,OAAO,OAAO;EACpB,CAAC,KAAK,OAAO,SAAS,yCAAyC,CAAC"}
1
+ {"version":3,"file":"signals.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/signals.ts"],"sourcesContent":["// POSIX signal handling.\n//\n// Architecture § Engine / supervisor split:\n// \"signals → L0 (one POSIX signal handler at process boot), routed\n// via the command channel.\"\n//\n// Discipline:\n// - ONE handler per process. Registering twice is a programmer\n// error.\n// - Signals translate to `EngineCommand`s on the typed command stream\n// (`shutdown.requested` for graceful, `shutdown.hardKillRequested`\n// for hard).\n// - Second SIGINT/SIGTERM escalates to abort: the hard-kill command\n// is offered first, then `process.exit(130)` (or 143 for SIGTERM)\n// is scheduled.\n//\n// The supervisor wires this fiber once at boot via `Effect.forkScoped`;\n// its scope is the supervisor's outer scope, so the handler unregisters\n// when the supervisor tears down (test environments that boot multiple\n// supervisors must close them before booting the next).\n\nimport { Effect, Queue, Scope } from 'effect';\n\nimport type { EngineCommand, ShutdownSignal } from '../../events.ts';\n\n/** Signals the supervisor handles. SIGHUP intentionally omitted —\n * reconfigure is a command-channel concern, not a signal one. */\nconst HANDLED_SIGNALS = ['SIGINT', 'SIGTERM'] as const satisfies ReadonlyArray<ShutdownSignal>;\ntype HandledSignal = (typeof HANDLED_SIGNALS)[number];\n\n/** Map a signal to the exit code POSIX clients expect — 128 + N. */\nconst exitCodeForSignal = (signal: HandledSignal): number => {\n\tswitch (signal) {\n\t\tcase 'SIGINT':\n\t\t\treturn 130;\n\t\tcase 'SIGTERM':\n\t\t\treturn 143;\n\t}\n};\n\nexport interface SignalHandlerOptions {\n\treadonly scheduleExit?: (exitCode: number) => void;\n}\n\nconst scheduleProcessExit = (exitCode: number): void => {\n\tsetImmediate(() => {\n\t\tprocess.exit(exitCode);\n\t});\n};\n\n/**\n * Install signal handlers that publish `shutdown.requested` (first\n * signal) and `shutdown.hardKillRequested` before scheduling process\n * exit (second handled signal).\n *\n * Returns an Effect that runs forever in its Scope; the supervisor\n * forks it via `Effect.forkScoped`. Scope close unregisters the\n * listeners — Node's `process` listeners persist past the scope\n * otherwise, leading to \"ghost\" handlers from prior test boots.\n */\nexport const installSignalHandler = (\n\tcommands: Queue.Enqueue<EngineCommand>,\n\toptions: SignalHandlerOptions = {},\n): Effect.Effect<never, never, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst scheduleExit = options.scheduleExit ?? scheduleProcessExit;\n\t\t// Capture the surrounding fiber's Context so the signal-listener\n\t\t// fork inherits the supervisor's logger Layer, fiber-refs, and\n\t\t// span context. Bare `Effect.runFork` evaluates against an empty\n\t\t// context — warnings/spans from the offered command would\n\t\t// otherwise bypass redaction rules and supervisor instrumentation.\n\t\tconst supervisorContext = yield* Effect.context<never>();\n\t\tconst runForkInherited = Effect.runForkWith(supervisorContext);\n\t\tlet shutdownRequested = false;\n\n\t\tconst handlers: Array<{\n\t\t\treadonly signal: HandledSignal;\n\t\t\treadonly listener: NodeJS.SignalsListener;\n\t\t}> = [];\n\n\t\tfor (const signal of HANDLED_SIGNALS) {\n\t\t\tconst listener: NodeJS.SignalsListener = () => {\n\t\t\t\tconst exitCode = exitCodeForSignal(signal);\n\t\t\t\tif (shutdownRequested) {\n\t\t\t\t\tconst offerEffect = Queue.offer(commands, {\n\t\t\t\t\t\ttag: 'shutdown.hardKillRequested',\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t\texitCode,\n\t\t\t\t\t\tat: Date.now(),\n\t\t\t\t\t} satisfies EngineCommand).pipe(\n\t\t\t\t\t\tEffect.andThen(Effect.sync(() => scheduleExit(exitCode))),\n\t\t\t\t\t);\n\t\t\t\t\trunForkInherited(offerEffect);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tshutdownRequested = true;\n\t\t\t\tprocess.exitCode ??= exitCode;\n\t\t\t\t// Publish `shutdown.requested` — same shape regardless of\n\t\t\t\t// which signal fired. The supervisor decides drain vs abort\n\t\t\t\t// on its own loop.\n\t\t\t\tconst offerEffect = Queue.offer(commands, {\n\t\t\t\t\ttag: 'shutdown.requested',\n\t\t\t\t} satisfies EngineCommand);\n\t\t\t\t// We're inside a Node listener; bridge into Effect via the\n\t\t\t\t// captured supervisor Context so the offered command\n\t\t\t\t// inherits logger/fiber-refs/spans. `runFork` returns a\n\t\t\t\t// fiber but we don't track it — the queue is bounded by\n\t\t\t\t// the supervisor's lifetime.\n\t\t\t\trunForkInherited(offerEffect);\n\t\t\t};\n\t\t\tprocess.on(signal, listener);\n\t\t\thandlers.push({ signal, listener });\n\t\t}\n\n\t\tyield* Effect.addFinalizer(() =>\n\t\t\tEffect.sync(() => {\n\t\t\t\tfor (const { signal, listener } of handlers) {\n\t\t\t\t\tprocess.removeListener(signal, listener);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\t// Park forever; the listeners themselves run synchronously in\n\t\t// Node's event loop, not in this fiber.\n\t\treturn yield* Effect.never;\n\t});\n\n/** Re-export the handled-signal list so tests / docs can enumerate. */\nexport const handledSignals: ReadonlyArray<HandledSignal> = HANDLED_SIGNALS;\n"],"mappings":";;;;AA2BA,MAAM,kBAAkB,CAAC,UAAU,SAAS;;AAI5C,MAAM,qBAAqB,WAAkC;CAC5D,QAAQ,QAAR;EACC,KAAK,UACJ,OAAO;EACR,KAAK,WACJ,OAAO;CACT;AACD;AAMA,MAAM,uBAAuB,aAA2B;CACvD,mBAAmB;EAClB,QAAQ,KAAK,QAAQ;CACtB,CAAC;AACF;;;;;;;;;;;AAYA,MAAa,wBACZ,UACA,UAAgC,CAAC,MAEjC,OAAO,IAAI,aAAa;CACvB,MAAM,eAAe,QAAQ,gBAAgB;CAM7C,MAAM,oBAAoB,OAAO,OAAO,QAAe;CACvD,MAAM,mBAAmB,OAAO,YAAY,iBAAiB;CAC7D,IAAI,oBAAoB;CAExB,MAAM,WAGD,CAAC;CAEN,KAAK,MAAM,UAAU,iBAAiB;EACrC,MAAM,iBAAyC;GAC9C,MAAM,WAAW,kBAAkB,MAAM;GACzC,IAAI,mBAAmB;IAStB,iBARoB,MAAM,MAAM,UAAU;KACzC,KAAK;KACL;KACA;KACA,IAAI,KAAK,IAAI;IACd,CAAyB,CAAC,CAAC,KAC1B,OAAO,QAAQ,OAAO,WAAW,aAAa,QAAQ,CAAC,CAAC,CAE9B,CAAC;IAC5B;GACD;GACA,oBAAoB;GACpB,QAAQ,aAAa;GAYrB,iBARoB,MAAM,MAAM,UAAU,EACzC,KAAK,qBACN,CAM2B,CAAC;EAC7B;EACA,QAAQ,GAAG,QAAQ,QAAQ;EAC3B,SAAS,KAAK;GAAE;GAAQ;EAAS,CAAC;CACnC;CAEA,OAAO,OAAO,mBACb,OAAO,WAAW;EACjB,KAAK,MAAM,EAAE,QAAQ,cAAc,UAClC,QAAQ,eAAe,QAAQ,QAAQ;CAEzC,CAAC,CACF;CAIA,OAAO,OAAO,OAAO;AACtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"state-machine.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/state-machine.ts"],"sourcesContent":["// Lifecycle state-machine — runtime guard over `LifecycleTransition`.\n//\n// Architecture § Lifecycle state. The transition table is declared in\n// `substrate/lifecycle.ts`; this file asserts moves against it at runtime\n// so an off-table transition lands as a typed Defect (programmer-error\n// class), not a corrupt projection.\n//\n// The state machine is per-plugin. Callers (the supervisor) hold a\n// `Ref` of `LifecycleStatus` and route every change through\n// `transition`, which:\n// - validates the move,\n// - emits the `lifecycle.statusChanged` typed event,\n// - returns the new status.\n\nimport { Data, Effect } from 'effect';\n\nimport type { LifecycleStatus, LifecycleTransition } from '../../lifecycle.ts';\n\n/** Off-table transition — programmer error. Surfaced as a defect via\n * `Effect.die` so the renderer / cause walker sees the impossible\n * transition rather than silently corrupting the projection. */\nexport class InvalidLifecycleTransition extends Data.TaggedError('InvalidLifecycleTransition')<{\n\treadonly from: LifecycleStatus;\n\treadonly to: LifecycleStatus;\n}> {}\n\n/** Canonical transition table — mirrors the type-level\n * `LifecycleTransition` from `substrate/lifecycle.ts` exactly. Adding\n * a transition requires updating BOTH (the type-level union AND this\n * table). */\nconst ALLOWED: ReadonlyMap<LifecycleStatus, ReadonlySet<LifecycleStatus>> = new Map([\n\t['pending', new Set<LifecycleStatus>(['acquiring', 'failed'])],\n\t['acquiring', new Set<LifecycleStatus>(['ready', 'failed'])],\n\t['ready', new Set<LifecycleStatus>(['stopping', 'failed', 'done'])],\n\t['stopping', new Set<LifecycleStatus>(['stopped', 'failed'])],\n\t['failed', new Set<LifecycleStatus>(['pending'])],\n\t['stopped', new Set<LifecycleStatus>(['pending'])],\n\t['done', new Set<LifecycleStatus>(['pending', 'failed'])],\n] as const);\n\n/** Predicate that the type-table and the runtime table agree. The\n * compiler checks the type-level shape; this conditional verifies the\n * runtime table covers exactly the same `from` set. */\ntype _AllFroms = LifecycleTransition['from'];\ntype _RuntimeFroms = 'pending' | 'acquiring' | 'ready' | 'stopping' | 'failed' | 'stopped' | 'done';\ntype _TableShape = _AllFroms extends _RuntimeFroms\n\t? _RuntimeFroms extends _AllFroms | 'done'\n\t\t? true\n\t\t: false\n\t: false;\n// Force the check by exporting the assertion.\nexport type __LifecycleTableShape = _TableShape extends true ? true : never;\n\n/** Returns true iff `from → to` is on the allowed-transition table. */\nexport const isAllowedTransition = (from: LifecycleStatus, to: LifecycleStatus): boolean =>\n\tALLOWED.get(from)?.has(to) ?? false;\n\n/** Effect-flavored transition assertion. Returns the new status on\n * success; dies with `InvalidLifecycleTransition` otherwise. */\nexport const assertTransition = (\n\tfrom: LifecycleStatus,\n\tto: LifecycleStatus,\n): Effect.Effect<LifecycleStatus> =>\n\tisAllowedTransition(from, to)\n\t\t? Effect.succeed(to)\n\t\t: Effect.die(new InvalidLifecycleTransition({ from, to }));\n\n/** Completed task status. It counts as ready, restart can return it to pending,\n * and post-acquire failures can still mark it failed. */\nexport const isTerminal = (status: LifecycleStatus): boolean => status === 'done';\n\n/** Statuses that count toward \"stack is ready\" — every plugin must be\n * in one of these for the stack to surface `running`. */\nexport const isReadyOrTerminal = (status: LifecycleStatus): boolean =>\n\tstatus === 'ready' || status === 'done';\n"],"mappings":";;;;;AAqBA,IAAa,6BAAb,cAAgD,KAAK,YAAY,6BAA6B,CAG3F;;;;;AAMH,MAAM,UAAsE,IAAI,IAAI;CACnF,CAAC,WAAW,IAAI,IAAqB,CAAC,aAAa,SAAS,CAAC,CAAC;CAC9D,CAAC,aAAa,IAAI,IAAqB,CAAC,SAAS,SAAS,CAAC,CAAC;CAC5D,CAAC,SAAS,IAAI,IAAqB;EAAC;EAAY;EAAU;EAAO,CAAC,CAAC;CACnE,CAAC,YAAY,IAAI,IAAqB,CAAC,WAAW,SAAS,CAAC,CAAC;CAC7D,CAAC,UAAU,IAAI,IAAqB,CAAC,UAAU,CAAC,CAAC;CACjD,CAAC,WAAW,IAAI,IAAqB,CAAC,UAAU,CAAC,CAAC;CAClD,CAAC,QAAQ,IAAI,IAAqB,CAAC,WAAW,SAAS,CAAC,CAAC;CACzD,CAAU;;AAgBX,MAAa,uBAAuB,MAAuB,OAC1D,QAAQ,IAAI,KAAK,EAAE,IAAI,GAAG,IAAI;;;AAI/B,MAAa,oBACZ,MACA,OAEA,oBAAoB,MAAM,GAAG,GAC1B,OAAO,QAAQ,GAAG,GAClB,OAAO,IAAI,IAAI,2BAA2B;CAAE;CAAM;CAAI,CAAC,CAAC;;;AAQ5D,MAAa,qBAAqB,WACjC,WAAW,WAAW,WAAW"}
1
+ {"version":3,"file":"state-machine.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/state-machine.ts"],"sourcesContent":["// Lifecycle state-machine — runtime guard over `LifecycleTransition`.\n//\n// Architecture § Lifecycle state. The transition table is declared in\n// `substrate/lifecycle.ts`; this file asserts moves against it at runtime\n// so an off-table transition lands as a typed Defect (programmer-error\n// class), not a corrupt projection.\n//\n// The state machine is per-plugin. Callers (the supervisor) hold a\n// `Ref` of `LifecycleStatus` and route every change through\n// `transition`, which:\n// - validates the move,\n// - emits the `lifecycle.statusChanged` typed event,\n// - returns the new status.\n\nimport { Data, Effect } from 'effect';\n\nimport type { LifecycleStatus, LifecycleTransition } from '../../lifecycle.ts';\n\n/** Off-table transition — programmer error. Surfaced as a defect via\n * `Effect.die` so the renderer / cause walker sees the impossible\n * transition rather than silently corrupting the projection. */\nexport class InvalidLifecycleTransition extends Data.TaggedError('InvalidLifecycleTransition')<{\n\treadonly from: LifecycleStatus;\n\treadonly to: LifecycleStatus;\n}> {}\n\n/** Canonical transition table — mirrors the type-level\n * `LifecycleTransition` from `substrate/lifecycle.ts` exactly. Adding\n * a transition requires updating BOTH (the type-level union AND this\n * table). */\nconst ALLOWED: ReadonlyMap<LifecycleStatus, ReadonlySet<LifecycleStatus>> = new Map([\n\t['pending', new Set<LifecycleStatus>(['acquiring', 'failed'])],\n\t['acquiring', new Set<LifecycleStatus>(['ready', 'failed'])],\n\t['ready', new Set<LifecycleStatus>(['stopping', 'failed', 'done'])],\n\t['stopping', new Set<LifecycleStatus>(['stopped', 'failed'])],\n\t['failed', new Set<LifecycleStatus>(['pending'])],\n\t['stopped', new Set<LifecycleStatus>(['pending'])],\n\t['done', new Set<LifecycleStatus>(['pending', 'failed'])],\n] as const);\n\n/** Predicate that the type-table and the runtime table agree. The\n * compiler checks the type-level shape; this conditional verifies the\n * runtime table covers exactly the same `from` set. */\ntype _AllFroms = LifecycleTransition['from'];\ntype _RuntimeFroms = 'pending' | 'acquiring' | 'ready' | 'stopping' | 'failed' | 'stopped' | 'done';\ntype _TableShape = _AllFroms extends _RuntimeFroms\n\t? _RuntimeFroms extends _AllFroms | 'done'\n\t\t? true\n\t\t: false\n\t: false;\n// Force the check by exporting the assertion.\nexport type __LifecycleTableShape = _TableShape extends true ? true : never;\n\n/** Returns true iff `from → to` is on the allowed-transition table. */\nexport const isAllowedTransition = (from: LifecycleStatus, to: LifecycleStatus): boolean =>\n\tALLOWED.get(from)?.has(to) ?? false;\n\n/** Effect-flavored transition assertion. Returns the new status on\n * success; dies with `InvalidLifecycleTransition` otherwise. */\nexport const assertTransition = (\n\tfrom: LifecycleStatus,\n\tto: LifecycleStatus,\n): Effect.Effect<LifecycleStatus> =>\n\tisAllowedTransition(from, to)\n\t\t? Effect.succeed(to)\n\t\t: Effect.die(new InvalidLifecycleTransition({ from, to }));\n\n/** Statuses that count toward \"stack is ready\" — every plugin must be\n * in one of these for the stack to surface `running`. */\nexport const isReadyOrTerminal = (status: LifecycleStatus): boolean =>\n\tstatus === 'ready' || status === 'done';\n"],"mappings":";;;;;AAqBA,IAAa,6BAAb,cAAgD,KAAK,YAAY,4BAA4B,CAAC,CAG3F,CAAC;;;;;AAMJ,MAAM,UAAsE,IAAI,IAAI;CACnF,CAAC,WAAW,IAAI,IAAqB,CAAC,aAAa,QAAQ,CAAC,CAAC;CAC7D,CAAC,aAAa,IAAI,IAAqB,CAAC,SAAS,QAAQ,CAAC,CAAC;CAC3D,CAAC,SAAS,IAAI,IAAqB;EAAC;EAAY;EAAU;CAAM,CAAC,CAAC;CAClE,CAAC,YAAY,IAAI,IAAqB,CAAC,WAAW,QAAQ,CAAC,CAAC;CAC5D,CAAC,UAAU,IAAI,IAAqB,CAAC,SAAS,CAAC,CAAC;CAChD,CAAC,WAAW,IAAI,IAAqB,CAAC,SAAS,CAAC,CAAC;CACjD,CAAC,QAAQ,IAAI,IAAqB,CAAC,WAAW,QAAQ,CAAC,CAAC;AACzD,CAAU;;AAgBV,MAAa,uBAAuB,MAAuB,OAC1D,QAAQ,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK;;;AAI/B,MAAa,oBACZ,MACA,OAEA,oBAAoB,MAAM,EAAE,IACzB,OAAO,QAAQ,EAAE,IACjB,OAAO,IAAI,IAAI,2BAA2B;CAAE;CAAM;AAAG,CAAC,CAAC;;;AAI3D,MAAa,qBAAqB,WACjC,WAAW,WAAW,WAAW"}
@@ -1 +1 @@
1
- import { Effect } from "effect";
1
+ export { };
@@ -1,4 +1,3 @@
1
- import "effect";
2
1
  //#region src/substrate/runtime/lifecycle/watch-attribution.ts
3
2
  /** Build the watch index from a resolved dep-graph's nodes. */
4
3
  const buildWatchIndex = (nodes) => {
@@ -15,13 +14,83 @@ const buildWatchIndex = (nodes) => {
15
14
  return out;
16
15
  };
17
16
  /**
18
- * Default fallback matcher exact-prefix only. Provided so unit
19
- * tests / single-stack boots without a real minimatch dependency
20
- * still function. The L0 thick watcher's minimatch is the production
21
- * matcher.
17
+ * Given the firing `firedPath` (already debounced + content-hash dedup'd
18
+ * by L0), return the plugin keys whose declared paths match.
19
+ *
20
+ * Matching is glob-aware via minimatch semantics — the substrate-level
21
+ * attribution here delegates to a supplied `match` predicate to keep
22
+ * this module dependency-free. The supervisor wires the matcher in.
22
23
  */
23
- const exactPrefixMatch = (pattern, path) => path === pattern || path.startsWith(pattern.replace(/\*+$/, ""));
24
+ const attribute = (index, firedPath, match) => {
25
+ const out = /* @__PURE__ */ new Set();
26
+ for (const entry of index) for (const pattern of entry.paths) if (match(pattern, firedPath)) {
27
+ out.add(entry.pluginKey);
28
+ break;
29
+ }
30
+ return out;
31
+ };
32
+ const REGEXP_SPECIALS = new Set(".+^${}()|[]\\".split(""));
33
+ /**
34
+ * Compile a watch glob to an anchored `RegExp`. Supports the only glob
35
+ * features the package plugin emits (architecture § WatchDecl):
36
+ * - `**\/` — zero or more path segments (so `root/**\/*.move` matches both
37
+ * `root/x.move` and `root/sources/x.move`)
38
+ * - `**` — any characters including `/` (trailing-segment form)
39
+ * - `*` — any characters except `/` (within one segment)
40
+ * - `?` — one character except `/`
41
+ * Everything else is matched literally. This is the dependency-free stand-in
42
+ * for the architecture's "minimatch" matcher — devstack pulls in no glob
43
+ * library (cf. the hand-rolled `collectHashedSources`).
44
+ */
45
+ const globToRegExp = (glob) => {
46
+ let body = "";
47
+ for (let i = 0; i < glob.length; i += 1) {
48
+ const c = glob[i];
49
+ if (c === "*" && glob[i + 1] === "*") if (glob[i + 2] === "/") {
50
+ body += "(?:.*/)?";
51
+ i += 2;
52
+ } else {
53
+ body += ".*";
54
+ i += 1;
55
+ }
56
+ else if (c === "*") body += "[^/]*";
57
+ else if (c === "?") body += "[^/]";
58
+ else if (REGEXP_SPECIALS.has(c)) body += `\\${c}`;
59
+ else body += c;
60
+ }
61
+ return new RegExp(`^${body}$`);
62
+ };
63
+ /** Glob-aware matcher — the production matcher the supervisor wires into
64
+ * `attribute`. Honors `**`, `*`, `?`; everything else is literal. Both
65
+ * sides are normalized to POSIX separators first: the watcher feeds paths
66
+ * from `join(root, filename)`, which is `\`-separated on Windows, while
67
+ * glob patterns are always `/`-separated. */
68
+ const toPosix = (p) => p.replace(/\\/g, "/");
69
+ const globMatch = (pattern, path) => globToRegExp(toPosix(pattern)).test(toPosix(path));
70
+ /** Literal directory prefix of a watch glob — the path up to (but not
71
+ * including) the first segment containing a glob metacharacter. Both
72
+ * `root/**\/*.move` and the exact `root/Move.toml` collapse to `root`,
73
+ * so the L0 watcher places ONE recursive watch per source tree. A
74
+ * pattern whose literal prefix has no directory separator — a bare
75
+ * basename (`Move.toml`), a leading glob (`*.move` ⇒ empty prefix), or a
76
+ * same-segment glob (`src*`) — collapses to `.` (the cwd), never to a
77
+ * bare filename: `fs.watch` must be handed a directory, and `globMatch`
78
+ * still filters the events. */
79
+ const literalRoot = (pattern) => {
80
+ const metaIdx = pattern.search(/[*?]/);
81
+ const literal = metaIdx === -1 ? pattern : pattern.slice(0, metaIdx);
82
+ const slash = literal.lastIndexOf("/");
83
+ if (slash === 0) return "/";
84
+ return slash > 0 ? literal.slice(0, slash) : ".";
85
+ };
86
+ /** Distinct recursive-watch roots for a watch index — the directories the
87
+ * L0 file watcher hands to `fs.watch(root, { recursive: true })`. */
88
+ const deriveWatchRoots = (index) => {
89
+ const roots = /* @__PURE__ */ new Set();
90
+ for (const entry of index) for (const pattern of entry.paths) roots.add(literalRoot(pattern));
91
+ return [...roots];
92
+ };
24
93
  //#endregion
25
- export { buildWatchIndex, exactPrefixMatch };
94
+ export { attribute, buildWatchIndex, deriveWatchRoots, globMatch };
26
95
 
27
96
  //# sourceMappingURL=watch-attribution.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"watch-attribution.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/watch-attribution.ts"],"sourcesContent":["// Watch-path → owning plugin attribution.\n//\n// Architecture § L3 Watch dispatcher: \"collects all plugin `watch`\n// declarations, receives watcher events from L0 (which already\n// debounced + dedup'd), triggers selective restart through the\n// scheduler's invalidate-with-cascade.\"\n//\n// L0 owns the file watcher (debounce + content-hash dedup). The\n// supervisor's role at watch time is just: given a fired path, which\n// plugin row(s) should be invalidated? This module builds and queries\n// that index. Selective-restart is the supervisor's concern; watch\n// attribution stays pure.\n\nimport { Effect } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport type { DepNode } from './dep-graph.ts';\n\n/** Per-plugin watch entry — a copy of the plugin's declared `watch`\n * decl with the owning key attached. */\nexport interface WatchEntry {\n\treadonly pluginKey: PluginKey;\n\treadonly paths: ReadonlyArray<string>;\n\t/** Whether downstream consumers should cascade-invalidate when this\n\t * fires. Defaults to true (architecture § WatchDecl). */\n\treadonly cascade: boolean;\n}\n\n/** Build the watch index from a resolved dep-graph's nodes. */\nexport const buildWatchIndex = (\n\tnodes: ReadonlyMap<PluginKey, DepNode>,\n): ReadonlyArray<WatchEntry> => {\n\tconst out: WatchEntry[] = [];\n\tfor (const [key, node] of nodes) {\n\t\tconst watch = node.member.watch;\n\t\tif (watch === undefined || watch.paths.length === 0) continue;\n\t\tout.push({\n\t\t\tpluginKey: key,\n\t\t\tpaths: watch.paths,\n\t\t\tcascade: watch.cascade ?? true,\n\t\t});\n\t}\n\treturn out;\n};\n\n/**\n * Given the firing `firedPath` (already debounced + content-hash dedup'd\n * by L0), return the plugin keys whose declared paths match.\n *\n * Matching is glob-aware via minimatch semantics — the substrate-level\n * attribution here delegates to a supplied `match` predicate to keep\n * this module dependency-free. The supervisor wires the matcher in.\n */\nexport const attribute = (\n\tindex: ReadonlyArray<WatchEntry>,\n\tfiredPath: string,\n\tmatch: (pattern: string, path: string) => boolean,\n): ReadonlySet<PluginKey> => {\n\tconst out = new Set<PluginKey>();\n\tfor (const entry of index) {\n\t\tfor (const pattern of entry.paths) {\n\t\t\tif (match(pattern, firedPath)) {\n\t\t\t\tout.add(entry.pluginKey);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n};\n\n/**\n * Effect-flavored wrapperspan-instrumented for tracing. Wraps the\n * pure `attribute` so the supervisor's invalidate-with-cascade trace\n * shows the watch fan-out alongside the dep-graph restart slice.\n */\nexport const attributeFire = (\n\tindex: ReadonlyArray<WatchEntry>,\n\tfiredPath: string,\n\tmatch: (pattern: string, path: string) => boolean,\n): Effect.Effect<ReadonlySet<PluginKey>> =>\n\tEffect.gen(function* () {\n\t\tconst keys = attribute(index, firedPath, match);\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'devstack.watch.firedPath': firedPath,\n\t\t\t'devstack.watch.matchedCount': keys.size,\n\t\t});\n\t\treturn keys;\n\t}).pipe(Effect.withSpan('lifecycle.watch.attribute'));\n\n/**\n * Default fallback matcher — exact-prefix only. Provided so unit\n * tests / single-stack boots without a real minimatch dependency\n * still function. The L0 thick watcher's minimatch is the production\n * matcher.\n */\nexport const exactPrefixMatch = (pattern: string, path: string): boolean =>\n\tpath === pattern || path.startsWith(pattern.replace(/\\*+$/, ''));\n"],"mappings":";;;AA6BA,MAAa,mBACZ,UAC+B;CAC/B,MAAM,MAAoB,EAAE;AAC5B,MAAK,MAAM,CAAC,KAAK,SAAS,OAAO;EAChC,MAAM,QAAQ,KAAK,OAAO;AAC1B,MAAI,UAAU,KAAA,KAAa,MAAM,MAAM,WAAW,EAAG;AACrD,MAAI,KAAK;GACR,WAAW;GACX,OAAO,MAAM;GACb,SAAS,MAAM,WAAW;GAC1B,CAAC;;AAEH,QAAO;;;;;;;;AAqDR,MAAa,oBAAoB,SAAiB,SACjD,SAAS,WAAW,KAAK,WAAW,QAAQ,QAAQ,QAAQ,GAAG,CAAC"}
1
+ {"version":3,"file":"watch-attribution.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/watch-attribution.ts"],"sourcesContent":["// Watch-path → owning plugin attribution.\n//\n// Architecture § L3 Watch dispatcher: \"collects all plugin `watch`\n// declarations, receives watcher events from L0 (which already\n// debounced + dedup'd), triggers selective restart through the\n// scheduler's invalidate-with-cascade.\"\n//\n// L0 owns the file watcher (debounce + content-hash dedup). The\n// supervisor's role at watch time is just: given a fired path, which\n// plugin row(s) should be invalidated? This module builds and queries\n// that index. Selective-restart is the supervisor's concern; watch\n// attribution stays pure.\n\nimport type { PluginKey } from '../../brand.ts';\nimport type { DepNode } from './dep-graph.ts';\n\n/** Per-plugin watch entry — a copy of the plugin's declared `watch`\n * decl with the owning key attached. */\nexport interface WatchEntry {\n\treadonly pluginKey: PluginKey;\n\treadonly paths: ReadonlyArray<string>;\n\t/** Whether downstream consumers should cascade-invalidate when this\n\t * fires. Defaults to true (architecture § WatchDecl). */\n\treadonly cascade: boolean;\n}\n\n/** Build the watch index from a resolved dep-graph's nodes. */\nexport const buildWatchIndex = (\n\tnodes: ReadonlyMap<PluginKey, DepNode>,\n): ReadonlyArray<WatchEntry> => {\n\tconst out: WatchEntry[] = [];\n\tfor (const [key, node] of nodes) {\n\t\tconst watch = node.member.watch;\n\t\tif (watch === undefined || watch.paths.length === 0) continue;\n\t\tout.push({\n\t\t\tpluginKey: key,\n\t\t\tpaths: watch.paths,\n\t\t\tcascade: watch.cascade ?? true,\n\t\t});\n\t}\n\treturn out;\n};\n\n/**\n * Given the firing `firedPath` (already debounced + content-hash dedup'd\n * by L0), return the plugin keys whose declared paths match.\n *\n * Matching is glob-aware via minimatch semantics — the substrate-level\n * attribution here delegates to a supplied `match` predicate to keep\n * this module dependency-free. The supervisor wires the matcher in.\n */\nexport const attribute = (\n\tindex: ReadonlyArray<WatchEntry>,\n\tfiredPath: string,\n\tmatch: (pattern: string, path: string) => boolean,\n): ReadonlySet<PluginKey> => {\n\tconst out = new Set<PluginKey>();\n\tfor (const entry of index) {\n\t\tfor (const pattern of entry.paths) {\n\t\t\tif (match(pattern, firedPath)) {\n\t\t\t\tout.add(entry.pluginKey);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn out;\n};\n\nconst REGEXP_SPECIALS = new Set('.+^${}()|[]\\\\'.split(''));\n\n/**\n * Compile a watch glob to an anchored `RegExp`. Supports the only glob\n * features the package plugin emits (architecture § WatchDecl):\n * - `**\\/`zero or more path segments (so `root/**\\/*.move` matches both\n * `root/x.move` and `root/sources/x.move`)\n * - `**` — any characters including `/` (trailing-segment form)\n * - `*` — any characters except `/` (within one segment)\n * - `?` — one character except `/`\n * Everything else is matched literally. This is the dependency-free stand-in\n * for the architecture's \"minimatch\" matcher — devstack pulls in no glob\n * library (cf. the hand-rolled `collectHashedSources`).\n */\nconst globToRegExp = (glob: string): RegExp => {\n\tlet body = '';\n\tfor (let i = 0; i < glob.length; i += 1) {\n\t\tconst c = glob[i]!;\n\t\tif (c === '*' && glob[i + 1] === '*') {\n\t\t\tif (glob[i + 2] === '/') {\n\t\t\t\tbody += '(?:.*/)?';\n\t\t\t\ti += 2;\n\t\t\t} else {\n\t\t\t\tbody += '.*';\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else if (c === '*') {\n\t\t\tbody += '[^/]*';\n\t\t} else if (c === '?') {\n\t\t\tbody += '[^/]';\n\t\t} else if (REGEXP_SPECIALS.has(c)) {\n\t\t\tbody += `\\\\${c}`;\n\t\t} else {\n\t\t\tbody += c;\n\t\t}\n\t}\n\treturn new RegExp(`^${body}$`);\n};\n\n/** Glob-aware matcher — the production matcher the supervisor wires into\n * `attribute`. Honors `**`, `*`, `?`; everything else is literal. Both\n * sides are normalized to POSIX separators first: the watcher feeds paths\n * from `join(root, filename)`, which is `\\`-separated on Windows, while\n * glob patterns are always `/`-separated. */\nconst toPosix = (p: string): string => p.replace(/\\\\/g, '/');\n\nexport const globMatch = (pattern: string, path: string): boolean =>\n\tglobToRegExp(toPosix(pattern)).test(toPosix(path));\n\n/** Literal directory prefix of a watch glob — the path up to (but not\n * including) the first segment containing a glob metacharacter. Both\n * `root/**\\/*.move` and the exact `root/Move.toml` collapse to `root`,\n * so the L0 watcher places ONE recursive watch per source tree. A\n * pattern whose literal prefix has no directory separator — a bare\n * basename (`Move.toml`), a leading glob (`*.move` ⇒ empty prefix), or a\n * same-segment glob (`src*`) — collapses to `.` (the cwd), never to a\n * bare filename: `fs.watch` must be handed a directory, and `globMatch`\n * still filters the events. */\nconst literalRoot = (pattern: string): string => {\n\tconst metaIdx = pattern.search(/[*?]/);\n\tconst literal = metaIdx === -1 ? pattern : pattern.slice(0, metaIdx);\n\tconst slash = literal.lastIndexOf('/');\n\tif (slash === 0) return '/'; // pattern sits at filesystem root\n\treturn slash > 0 ? literal.slice(0, slash) : '.';\n};\n\n/** Distinct recursive-watch roots for a watch index — the directories the\n * L0 file watcher hands to `fs.watch(root, { recursive: true })`. */\nexport const deriveWatchRoots = (index: ReadonlyArray<WatchEntry>): ReadonlyArray<string> => {\n\tconst roots = new Set<string>();\n\tfor (const entry of index) {\n\t\tfor (const pattern of entry.paths) {\n\t\t\troots.add(literalRoot(pattern));\n\t\t}\n\t}\n\treturn [...roots];\n};\n"],"mappings":";;AA2BA,MAAa,mBACZ,UAC+B;CAC/B,MAAM,MAAoB,CAAC;CAC3B,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO;EAChC,MAAM,QAAQ,KAAK,OAAO;EAC1B,IAAI,UAAU,KAAA,KAAa,MAAM,MAAM,WAAW,GAAG;EACrD,IAAI,KAAK;GACR,WAAW;GACX,OAAO,MAAM;GACb,SAAS,MAAM,WAAW;EAC3B,CAAC;CACF;CACA,OAAO;AACR;;;;;;;;;AAUA,MAAa,aACZ,OACA,WACA,UAC4B;CAC5B,MAAM,sBAAM,IAAI,IAAe;CAC/B,KAAK,MAAM,SAAS,OACnB,KAAK,MAAM,WAAW,MAAM,OAC3B,IAAI,MAAM,SAAS,SAAS,GAAG;EAC9B,IAAI,IAAI,MAAM,SAAS;EACvB;CACD;CAGF,OAAO;AACR;AAEA,MAAM,kBAAkB,IAAI,IAAI,gBAAgB,MAAM,EAAE,CAAC;;;;;;;;;;;;;AAczD,MAAM,gBAAgB,SAAyB;CAC9C,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,GAAG;EACxC,MAAM,IAAI,KAAK;EACf,IAAI,MAAM,OAAO,KAAK,IAAI,OAAO,KAChC,IAAI,KAAK,IAAI,OAAO,KAAK;GACxB,QAAQ;GACR,KAAK;EACN,OAAO;GACN,QAAQ;GACR,KAAK;EACN;OACM,IAAI,MAAM,KAChB,QAAQ;OACF,IAAI,MAAM,KAChB,QAAQ;OACF,IAAI,gBAAgB,IAAI,CAAC,GAC/B,QAAQ,KAAK;OAEb,QAAQ;CAEV;CACA,OAAO,IAAI,OAAO,IAAI,KAAK,EAAE;AAC9B;;;;;;AAOA,MAAM,WAAW,MAAsB,EAAE,QAAQ,OAAO,GAAG;AAE3D,MAAa,aAAa,SAAiB,SAC1C,aAAa,QAAQ,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC;;;;;;;;;;AAWlD,MAAM,eAAe,YAA4B;CAChD,MAAM,UAAU,QAAQ,OAAO,MAAM;CACrC,MAAM,UAAU,YAAY,KAAK,UAAU,QAAQ,MAAM,GAAG,OAAO;CACnE,MAAM,QAAQ,QAAQ,YAAY,GAAG;CACrC,IAAI,UAAU,GAAG,OAAO;CACxB,OAAO,QAAQ,IAAI,QAAQ,MAAM,GAAG,KAAK,IAAI;AAC9C;;;AAIA,MAAa,oBAAoB,UAA4D;CAC5F,MAAM,wBAAQ,IAAI,IAAY;CAC9B,KAAK,MAAM,SAAS,OACnB,KAAK,MAAM,WAAW,MAAM,OAC3B,MAAM,IAAI,YAAY,OAAO,CAAC;CAGhC,OAAO,CAAC,GAAG,KAAK;AACjB"}
@@ -4,7 +4,7 @@ import { Effect, Scope } from "effect";
4
4
 
5
5
  //#region src/substrate/runtime/managed-container.d.ts
6
6
  declare namespace managed_container_d_exports {
7
- export { EnsureManagedContainerOptions, ManagedContainerIdentity, ManagedContainerLabelOptions, PER_APP_SHARED_STACK, ensureManagedContainer, managedContainerLabels };
7
+ export { EnsureManagedContainerOptions, ManagedContainerIdentity, ManagedContainerLabelOptions, PER_APP_SHARED_STACK, ensureManagedContainer, managedContainerLabels, sanitizeAlias };
8
8
  }
9
9
  /** Sentinel `stack` value for containers / volumes / networks that are
10
10
  * shared across a single app's stacks but isolated PER APP — the
@@ -24,6 +24,10 @@ declare namespace managed_container_d_exports {
24
24
  * role }` label tuple — managed-container.ts is the canonical
25
25
  * owner. */
26
26
  declare const PER_APP_SHARED_STACK: "_per-app_";
27
+ /** Coerce a composed string to a Docker network / DNS-alias-safe form
28
+ * (alphanumerics + hyphen). Identity strings are already network-safe;
29
+ * this guards the literal composition (`devstack-${app}-${stack}-…`). */
30
+ declare const sanitizeAlias: (s: string) => string;
27
31
  interface ManagedContainerIdentity {
28
32
  readonly app: string;
29
33
  readonly stack: string;
@@ -1,11 +1,11 @@
1
1
  import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
2
- import { SpanAttr } from "./observability/spans.mjs";
3
2
  import { Effect } from "effect";
4
3
  //#region src/substrate/runtime/managed-container.ts
5
4
  var managed_container_exports = /* @__PURE__ */ __exportAll({
6
5
  PER_APP_SHARED_STACK: () => PER_APP_SHARED_STACK,
7
6
  ensureManagedContainer: () => ensureManagedContainer,
8
- managedContainerLabels: () => managedContainerLabels
7
+ managedContainerLabels: () => managedContainerLabels,
8
+ sanitizeAlias: () => sanitizeAlias
9
9
  });
10
10
  /** Sentinel `stack` value for containers / volumes / networks that are
11
11
  * shared across a single app's stacks but isolated PER APP — the
@@ -25,6 +25,10 @@ var managed_container_exports = /* @__PURE__ */ __exportAll({
25
25
  * role }` label tuple — managed-container.ts is the canonical
26
26
  * owner. */
27
27
  const PER_APP_SHARED_STACK = "_per-app_";
28
+ /** Coerce a composed string to a Docker network / DNS-alias-safe form
29
+ * (alphanumerics + hyphen). Identity strings are already network-safe;
30
+ * this guards the literal composition (`devstack-${app}-${stack}-…`). */
31
+ const sanitizeAlias = (s) => s.replace(/[^a-zA-Z0-9-]/g, "-");
28
32
  const managedContainerLabels = (options) => ({
29
33
  app: options.identity.app,
30
34
  stack: options.identity.stack,
@@ -37,15 +41,9 @@ const ensureManagedContainer = (options) => {
37
41
  return options.runtime.ensureContainer({
38
42
  ...options.spec,
39
43
  labels
40
- }).pipe(Effect.mapError(options.mapError), Effect.withSpan("substrate.managedContainer.ensure", { attributes: {
41
- [SpanAttr.app]: labels.app,
42
- [SpanAttr.stack]: labels.stack,
43
- [SpanAttr.plugin]: labels.plugin,
44
- [SpanAttr.containerRole]: labels.role,
45
- [SpanAttr.containerName]: options.spec.name
46
- } }));
44
+ }).pipe(Effect.mapError(options.mapError));
47
45
  };
48
46
  //#endregion
49
- export { PER_APP_SHARED_STACK, ensureManagedContainer, managed_container_exports };
47
+ export { PER_APP_SHARED_STACK, ensureManagedContainer, managed_container_exports, sanitizeAlias };
50
48
 
51
49
  //# sourceMappingURL=managed-container.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"managed-container.mjs","names":[],"sources":["../../../src/substrate/runtime/managed-container.ts"],"sourcesContent":["import { Effect, type Scope } from 'effect';\n\nimport type {\n\tContainerHandle,\n\tContainerRuntime,\n\tContainerRuntimeError,\n\tEnsureContainerSpec,\n} from '../../contracts/container-runtime.ts';\nimport type { ContainerLabelTuple } from '../../contracts/snapshotable.ts';\nimport { SpanAttr } from './observability/spans.ts';\n\n/** Sentinel `stack` value for containers / volumes / networks that are\n * shared across a single app's stacks but isolated PER APP — the\n * resource lives at app-scope, not stack-scope.\n *\n * Current producer: the per-app sui chain-build container\n * (`plugins/sui/chain-build-container.ts`) reuses one container\n * across multiple stacks of the same app to keep the bind-mounted\n * Move dep cache warm.\n *\n * Lifecycle-prune + the prune CLI compare against this sentinel to\n * decide whether a resource group is shared (pinned while any\n * sibling stack under the same app is live) vs per-stack (pruned\n * with its stack).\n *\n * The vocabulary lives here alongside the `{ app, stack, plugin,\n * role }` label tuple — managed-container.ts is the canonical\n * owner. */\nexport const PER_APP_SHARED_STACK = '_per-app_' as const;\n\nexport interface ManagedContainerIdentity {\n\treadonly app: string;\n\treadonly stack: string;\n}\n\nexport interface ManagedContainerLabelOptions {\n\treadonly identity: ManagedContainerIdentity;\n\treadonly plugin: string;\n\treadonly role: string;\n}\n\nexport const managedContainerLabels = (\n\toptions: ManagedContainerLabelOptions,\n): ContainerLabelTuple => ({\n\tapp: options.identity.app,\n\tstack: options.identity.stack,\n\tplugin: options.plugin,\n\trole: options.role,\n});\n\ntype ManagedContainerLabelInput =\n\t| { readonly labels: ContainerLabelTuple }\n\t| ManagedContainerLabelOptions;\n\nexport type EnsureManagedContainerOptions<E> = ManagedContainerLabelInput & {\n\treadonly runtime: ContainerRuntime;\n\treadonly spec: Omit<EnsureContainerSpec, 'labels'>;\n\treadonly mapError: (cause: ContainerRuntimeError) => E;\n};\n\nconst labelsFrom = (input: ManagedContainerLabelInput): ContainerLabelTuple =>\n\t'labels' in input ? input.labels : managedContainerLabels(input);\n\nexport const ensureManagedContainer = <E>(\n\toptions: EnsureManagedContainerOptions<E>,\n): Effect.Effect<ContainerHandle, E, Scope.Scope> => {\n\tconst labels = labelsFrom(options);\n\treturn options.runtime\n\t\t.ensureContainer({\n\t\t\t...options.spec,\n\t\t\tlabels,\n\t\t})\n\t\t.pipe(\n\t\t\tEffect.mapError(options.mapError),\n\t\t\tEffect.withSpan('substrate.managedContainer.ensure', {\n\t\t\t\tattributes: {\n\t\t\t\t\t[SpanAttr.app]: labels.app,\n\t\t\t\t\t[SpanAttr.stack]: labels.stack,\n\t\t\t\t\t[SpanAttr.plugin]: labels.plugin,\n\t\t\t\t\t[SpanAttr.containerRole]: labels.role,\n\t\t\t\t\t[SpanAttr.containerName]: options.spec.name,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,uBAAuB;AAapC,MAAa,0BACZ,aAC0B;CAC1B,KAAK,QAAQ,SAAS;CACtB,OAAO,QAAQ,SAAS;CACxB,QAAQ,QAAQ;CAChB,MAAM,QAAQ;CACd;AAYD,MAAM,cAAc,UACnB,YAAY,QAAQ,MAAM,SAAS,uBAAuB,MAAM;AAEjE,MAAa,0BACZ,YACoD;CACpD,MAAM,SAAS,WAAW,QAAQ;AAClC,QAAO,QAAQ,QACb,gBAAgB;EAChB,GAAG,QAAQ;EACX;EACA,CAAC,CACD,KACA,OAAO,SAAS,QAAQ,SAAS,EACjC,OAAO,SAAS,qCAAqC,EACpD,YAAY;GACV,SAAS,MAAM,OAAO;GACtB,SAAS,QAAQ,OAAO;GACxB,SAAS,SAAS,OAAO;GACzB,SAAS,gBAAgB,OAAO;GAChC,SAAS,gBAAgB,QAAQ,KAAK;EACvC,EACD,CAAC,CACF"}
1
+ {"version":3,"file":"managed-container.mjs","names":[],"sources":["../../../src/substrate/runtime/managed-container.ts"],"sourcesContent":["import { Effect, type Scope } from 'effect';\n\nimport type {\n\tContainerHandle,\n\tContainerRuntime,\n\tContainerRuntimeError,\n\tEnsureContainerSpec,\n} from '../../contracts/container-runtime.ts';\nimport type { ContainerLabelTuple } from '../../contracts/snapshotable.ts';\n\n/** Sentinel `stack` value for containers / volumes / networks that are\n * shared across a single app's stacks but isolated PER APP — the\n * resource lives at app-scope, not stack-scope.\n *\n * Current producer: the per-app sui chain-build container\n * (`plugins/sui/chain-build-container.ts`) reuses one container\n * across multiple stacks of the same app to keep the bind-mounted\n * Move dep cache warm.\n *\n * Lifecycle-prune + the prune CLI compare against this sentinel to\n * decide whether a resource group is shared (pinned while any\n * sibling stack under the same app is live) vs per-stack (pruned\n * with its stack).\n *\n * The vocabulary lives here alongside the `{ app, stack, plugin,\n * role }` label tuple — managed-container.ts is the canonical\n * owner. */\nexport const PER_APP_SHARED_STACK = '_per-app_' as const;\n\n/** Coerce a composed string to a Docker network / DNS-alias-safe form\n * (alphanumerics + hyphen). Identity strings are already network-safe;\n * this guards the literal composition (`devstack-${app}-${stack}-…`). */\nexport const sanitizeAlias = (s: string): string => s.replace(/[^a-zA-Z0-9-]/g, '-');\n\nexport interface ManagedContainerIdentity {\n\treadonly app: string;\n\treadonly stack: string;\n}\n\nexport interface ManagedContainerLabelOptions {\n\treadonly identity: ManagedContainerIdentity;\n\treadonly plugin: string;\n\treadonly role: string;\n}\n\nexport const managedContainerLabels = (\n\toptions: ManagedContainerLabelOptions,\n): ContainerLabelTuple => ({\n\tapp: options.identity.app,\n\tstack: options.identity.stack,\n\tplugin: options.plugin,\n\trole: options.role,\n});\n\ntype ManagedContainerLabelInput =\n\t| { readonly labels: ContainerLabelTuple }\n\t| ManagedContainerLabelOptions;\n\nexport type EnsureManagedContainerOptions<E> = ManagedContainerLabelInput & {\n\treadonly runtime: ContainerRuntime;\n\treadonly spec: Omit<EnsureContainerSpec, 'labels'>;\n\treadonly mapError: (cause: ContainerRuntimeError) => E;\n};\n\nconst labelsFrom = (input: ManagedContainerLabelInput): ContainerLabelTuple =>\n\t'labels' in input ? input.labels : managedContainerLabels(input);\n\nexport const ensureManagedContainer = <E>(\n\toptions: EnsureManagedContainerOptions<E>,\n): Effect.Effect<ContainerHandle, E, Scope.Scope> => {\n\tconst labels = labelsFrom(options);\n\treturn options.runtime\n\t\t.ensureContainer({\n\t\t\t...options.spec,\n\t\t\tlabels,\n\t\t})\n\t\t.pipe(Effect.mapError(options.mapError));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,uBAAuB;;;;AAKpC,MAAa,iBAAiB,MAAsB,EAAE,QAAQ,kBAAkB,GAAG;AAanF,MAAa,0BACZ,aAC0B;CAC1B,KAAK,QAAQ,SAAS;CACtB,OAAO,QAAQ,SAAS;CACxB,QAAQ,QAAQ;CAChB,MAAM,QAAQ;AACf;AAYA,MAAM,cAAc,UACnB,YAAY,QAAQ,MAAM,SAAS,uBAAuB,KAAK;AAEhE,MAAa,0BACZ,YACoD;CACpD,MAAM,SAAS,WAAW,OAAO;CACjC,OAAO,QAAQ,QACb,gBAAgB;EAChB,GAAG,QAAQ;EACX;CACD,CAAC,CAAC,CACD,KAAK,OAAO,SAAS,QAAQ,QAAQ,CAAC;AACzC"}
@@ -1,54 +1,33 @@
1
- import { atomicWriteFile } from "../atomic-write.mjs";
2
1
  import "../runtime-decode.mjs";
2
+ import { atomicWriteFile } from "../atomic-write.mjs";
3
3
  import "../../manifest.mjs";
4
4
  import { Data, Effect } from "effect";
5
5
  /** One error class for every manifest IO failure. */
6
6
  var ManifestError = class extends Data.TaggedError("ManifestError") {};
7
7
  /**
8
- * Build the envelope from per-plugin contributions. Pure; the writer
8
+ * Build the envelope from endpoint entries + extras. Pure; the writer
9
9
  * calls this and then atomically writes the JSON.
10
10
  *
11
- * `pluginKey` collisions are an error two contributions for the
12
- * same plugin would silently overwrite. Endpoint-key collisions also
13
- * error: every endpoint has a unique `(pluginKey, dispatchId)` digest
14
- * by construction; a duplicate means a substrate bug.
11
+ * Endpoint-key collisions error: every endpoint has a unique
12
+ * `(pluginKey, dispatchId)` digest by construction; a duplicate means
13
+ * a substrate bug.
15
14
  */
16
15
  const buildEnvelope = (input) => Effect.gen(function* () {
17
- const services = {};
18
16
  const endpoints = {};
19
17
  const extras = { ...input.extras };
20
18
  const addEndpoint = (ep) => Effect.gen(function* () {
21
19
  const ek = ep.endpointKey;
22
20
  if (ek in endpoints) return yield* Effect.fail(new ManifestError({
23
- reason: "duplicate-contribution",
21
+ reason: "duplicate-endpoint",
24
22
  path: "(in-memory envelope)",
25
23
  detail: `endpointKey ${ek} contributed twice`
26
24
  }));
27
25
  endpoints[ek] = ep;
28
26
  });
29
- for (const contribution of input.contributions) {
30
- const key = contribution.pluginKey;
31
- if (key in services) return yield* Effect.fail(new ManifestError({
32
- reason: "duplicate-contribution",
33
- path: "(in-memory envelope)",
34
- detail: `pluginKey ${key} contributed twice`
35
- }));
36
- services[key] = contribution.services;
37
- if (contribution.extras !== void 0) for (const [extraKey, extraValue] of Object.entries(contribution.extras)) {
38
- if (extraKey in extras) return yield* Effect.fail(new ManifestError({
39
- reason: "duplicate-contribution",
40
- path: "(in-memory envelope)",
41
- detail: `extras key ${extraKey} contributed twice`
42
- }));
43
- extras[extraKey] = extraValue;
44
- }
45
- for (const ep of contribution.endpoints) yield* addEndpoint(ep);
46
- }
47
27
  for (const ep of input.endpoints ?? []) yield* addEndpoint(ep);
48
28
  return {
49
29
  identity: input.identity,
50
30
  manifestVersion: 1,
51
- services,
52
31
  endpoints,
53
32
  extras,
54
33
  ...input.codegen !== void 0 ? { codegen: input.codegen } : {}
@@ -58,8 +37,7 @@ const buildEnvelope = (input) => Effect.gen(function* () {
58
37
  * Serialize and write the envelope at `path` atomically. Routes
59
38
  * through the canonical `atomicWriteFile` primitive (mkdir-parent →
60
39
  * O_EXCL temp → write → fsync → rename), so the manifest writer
61
- * shares ONE owner of the tempfile dance with the state-store and
62
- * cache.
40
+ * shares ONE owner of the tempfile dance with the cache.
63
41
  */
64
42
  const writeManifest = (envelope, path) => Effect.gen(function* () {
65
43
  const json = serializeEnvelope(envelope);
@@ -69,7 +47,7 @@ const writeManifest = (envelope, path) => Effect.gen(function* () {
69
47
  detail: `atomic write failed at stage ${cause.stage}`,
70
48
  cause
71
49
  })));
72
- }).pipe(Effect.withSpan("Manifest.writeManifest", { attributes: { "devstack.manifest.path": path } }));
50
+ });
73
51
  const serializeEnvelope = (envelope) => JSON.stringify(envelope, null, 2);
74
52
  //#endregion
75
53
  export { ManifestError, buildEnvelope, writeManifest };
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.mjs","names":[],"sources":["../../../../src/substrate/runtime/manifest/manifest.ts"],"sourcesContent":["// Manifest emitter — endpoint-keyed envelope, atomic write.\n//\n// Architecture § Manifest data model. The envelope is L0 (`identity`\n// tuple, `manifestVersion`, `services` slot, `endpoints` lookup,\n// `extras`). The per-service projection lives in each plugin's\n// Codegenable contribution and is consumed by codegen output, not by\n// the manifest envelope itself.\n//\n// The emitter:\n// - Accepts per-plugin contributions through a `contribute` Effect.\n// - Walks endpoint contributions to build the flat `endpoints`\n// lookup keyed by `endpointKey`. Entries still carry the declared\n// endpoint `name` for build-integration lookup.\n// - Writes atomically via tempfile + fsync + rename. The atomic-\n// write primitive lives in L0 (per architecture § Collapsed:\n// \"Three tempfile+rename impls → one atomic-write primitive\").\n// - Validates the envelope against `ManifestEnvelopeSchema` on read.\n// - Pins `manifestVersion` so future-proofing migrations have a\n// compatibility seam. The pinned version is `1` for the post-\n// rewrite envelope. (The old devstack used unversioned manifests\n// plus a hash field; the rewrite's clean break is `version 1`.)\n//\n// Discipline: zero service names. The writer iterates `pluginKey`-\n// indexed contributions and copies the bytes through. The schema\n// validates the envelope shape, not the per-plugin contents (which\n// are `Schema.Unknown`).\n\nimport { Effect } from 'effect';\nimport { Data } from 'effect';\nimport { FileSystem } from 'effect';\n\nimport type { EndpointKey, PluginKey } from '../../brand.ts';\nimport {\n\ttype EndpointEntry,\n\ttype ManifestCodegen,\n\ttype ManifestExtras,\n\ttype ManifestEnvelope,\n\tManifestEnvelopeSchema,\n} from '../../manifest.ts';\nimport { atomicWriteFile } from '../atomic-write.ts';\nimport { decodeJsonText } from '../runtime-decode.ts';\n\n// -----------------------------------------------------------------------------\n// Pinned schema version\n// -----------------------------------------------------------------------------\n\n/**\n * Schema version pinned at the envelope level. Bump only on a\n * breaking shape change to the envelope (NOT to a per-plugin service\n * slice — those carry their own version via Codegenable contribution).\n *\n * Reader policy:\n * - Equal version: accept.\n * - Older version: refuse (advise user to re-run `up`).\n * - Newer version: refuse (build integration is out of date).\n */\nexport const CURRENT_MANIFEST_VERSION = 1 as const;\n\n// -----------------------------------------------------------------------------\n// Errors\n// -----------------------------------------------------------------------------\n\n/** One error class for every manifest IO failure. */\nexport class ManifestError extends Data.TaggedError('ManifestError')<{\n\treadonly reason:\n\t\t| 'write-failed'\n\t\t| 'read-failed'\n\t\t| 'decode-failed'\n\t\t| 'version-mismatch'\n\t\t| 'duplicate-contribution';\n\treadonly path: string;\n\treadonly detail?: string;\n\treadonly cause?: unknown;\n}> {}\n\n// -----------------------------------------------------------------------------\n// Contribution shape\n// -----------------------------------------------------------------------------\n\n/**\n * One plugin's contribution to the manifest. Keyed by `pluginKey`\n * (branded), opaque `services` blob, plus a flat list of endpoint\n * entries the plugin owns.\n *\n * The writer copies `services` through to\n * `envelope.services[pluginKey]`. The renderer of the typed shape\n * lives in the plugin's Codegenable contribution — the manifest\n * doesn't decode it.\n */\nexport interface PluginManifestContribution {\n\treadonly pluginKey: PluginKey;\n\t/** Plugin's structured slice — opaque to the writer. */\n\treadonly services: unknown;\n\t/** Endpoints owned by this plugin. The writer indexes these by\n\t * `endpointKey` into the flat top-level lookup. */\n\treadonly endpoints: ReadonlyArray<EndpointEntry>;\n\t/** Optional app-facing extras merged into the top-level extras slot. */\n\treadonly extras?: ManifestExtras;\n}\n\n// -----------------------------------------------------------------------------\n// Public writer interface\n// -----------------------------------------------------------------------------\n\nexport interface WriteManifestInput {\n\treadonly identity: ManifestEnvelope['identity'];\n\treadonly contributions: ReadonlyArray<PluginManifestContribution>;\n\treadonly endpoints?: ReadonlyArray<EndpointEntry>;\n\treadonly extras?: ManifestExtras;\n\t/** Per-stack codegen metadata (the resolved absolute `generatedDir`).\n\t * Optional + additive — omitting it produces an envelope without the\n\t * `codegen` key, identical to a pre-field manifest. */\n\treadonly codegen?: ManifestCodegen;\n}\n\n/**\n * Build the envelope from per-plugin contributions. Pure; the writer\n * calls this and then atomically writes the JSON.\n *\n * `pluginKey` collisions are an error — two contributions for the\n * same plugin would silently overwrite. Endpoint-key collisions also\n * error: every endpoint has a unique `(pluginKey, dispatchId)` digest\n * by construction; a duplicate means a substrate bug.\n */\nexport const buildEnvelope = (\n\tinput: WriteManifestInput,\n): Effect.Effect<ManifestEnvelope, ManifestError> =>\n\tEffect.gen(function* () {\n\t\tconst services: Record<string, unknown> = {};\n\t\tconst endpoints: Record<string, EndpointEntry> = {};\n\t\tconst extras: Record<string, unknown> = { ...input.extras };\n\n\t\tconst addEndpoint = (ep: EndpointEntry): Effect.Effect<void, ManifestError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst ek = ep.endpointKey as string;\n\t\t\t\tif (ek in endpoints) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\t\treason: 'duplicate-contribution',\n\t\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\t\tdetail: `endpointKey ${ek} contributed twice`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tendpoints[ek] = ep;\n\t\t\t});\n\n\t\tfor (const contribution of input.contributions) {\n\t\t\tconst key = contribution.pluginKey as string;\n\t\t\tif (key in services) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\treason: 'duplicate-contribution',\n\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\tdetail: `pluginKey ${key} contributed twice`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tservices[key] = contribution.services;\n\t\t\tif (contribution.extras !== undefined) {\n\t\t\t\tfor (const [extraKey, extraValue] of Object.entries(contribution.extras)) {\n\t\t\t\t\tif (extraKey in extras) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\t\t\treason: 'duplicate-contribution',\n\t\t\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\t\t\tdetail: `extras key ${extraKey} contributed twice`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\textras[extraKey] = extraValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const ep of contribution.endpoints) {\n\t\t\t\tyield* addEndpoint(ep);\n\t\t\t}\n\t\t}\n\t\tfor (const ep of input.endpoints ?? []) {\n\t\t\tyield* addEndpoint(ep);\n\t\t}\n\n\t\treturn {\n\t\t\tidentity: input.identity,\n\t\t\tmanifestVersion: CURRENT_MANIFEST_VERSION,\n\t\t\tservices,\n\t\t\tendpoints,\n\t\t\textras,\n\t\t\t// Spread only when present so an omitted `codegen` yields the\n\t\t\t// exact same envelope (and serialized bytes) as a pre-field\n\t\t\t// manifest — additive, no churn for stacks that don't record it.\n\t\t\t...(input.codegen !== undefined ? { codegen: input.codegen } : {}),\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Atomic write — delegates to the canonical primitive.\n// -----------------------------------------------------------------------------\n\n/**\n * Serialize and write the envelope at `path` atomically. Routes\n * through the canonical `atomicWriteFile` primitive (mkdir-parent →\n * O_EXCL temp → write → fsync → rename), so the manifest writer\n * shares ONE owner of the tempfile dance with the state-store and\n * cache.\n */\nexport const writeManifest = (\n\tenvelope: ManifestEnvelope,\n\tpath: string,\n): Effect.Effect<void, ManifestError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst json = serializeEnvelope(envelope);\n\t\tconst bytes = new TextEncoder().encode(json);\n\t\tyield* atomicWriteFile(path, bytes).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tdetail: `atomic write failed at stage ${cause.stage}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('Manifest.writeManifest', { attributes: { 'devstack.manifest.path': path } }),\n\t);\n\nconst serializeEnvelope = (envelope: ManifestEnvelope): string =>\n\t// Stable key ordering, deterministic re-emit. `JSON.stringify` with\n\t// 2-space indent is reproducible byte-for-byte given the same\n\t// input object.\n\tJSON.stringify(envelope, null, 2);\n\n// -----------------------------------------------------------------------------\n// Read + decode\n// -----------------------------------------------------------------------------\n\n/**\n * Read and decode the manifest at `path`. Validates against\n * `ManifestEnvelopeSchema` and the pinned `CURRENT_MANIFEST_VERSION`.\n *\n * Used by:\n * - Codegen (architecture §6) — consumes plugin slices off\n * `envelope.services[pluginKey]`.\n * - Build integrations (Vitest, Playwright, generated app code) — consumes\n * `envelope.endpoints` lookup.\n *\n * The reader is read-only; no mutation, no IO beyond the single read.\n */\nexport const readManifest = (\n\tpath: string,\n): Effect.Effect<ManifestEnvelope, ManifestError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst text = yield* fs\n\t\t\t.readFileString(path)\n\t\t\t.pipe(Effect.mapError((cause) => new ManifestError({ reason: 'read-failed', path, cause })));\n\t\tconst decoded = yield* decodeJsonText(ManifestEnvelopeSchema, text, {\n\t\t\tsource: path,\n\t\t\tmkError: (issue) =>\n\t\t\t\tnew ManifestError({ reason: 'decode-failed', path, cause: issue.cause ?? issue }),\n\t\t});\n\t\tif (decoded.manifestVersion !== CURRENT_MANIFEST_VERSION) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ManifestError({\n\t\t\t\t\treason: 'version-mismatch',\n\t\t\t\t\tpath,\n\t\t\t\t\tdetail: `expected ${CURRENT_MANIFEST_VERSION}, got ${decoded.manifestVersion}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn decoded as ManifestEnvelope;\n\t}).pipe(\n\t\tEffect.withSpan('Manifest.readManifest', { attributes: { 'devstack.manifest.path': path } }),\n\t);\n\n// -----------------------------------------------------------------------------\n// Re-export the envelope + endpoint types so downstream substrate\n// modules (codegen, build integrations) don't reach into substrate/\n// directly.\n// -----------------------------------------------------------------------------\n\nexport type { EndpointEntry, EndpointKey, ManifestCodegen, ManifestEnvelope, PluginKey };\nexport { ManifestEnvelopeSchema };\n"],"mappings":";;;;;AA+DA,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAUjE;;;;;;;;;;AAmDH,MAAa,iBACZ,UAEA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAoC,EAAE;CAC5C,MAAM,YAA2C,EAAE;CACnD,MAAM,SAAkC,EAAE,GAAG,MAAM,QAAQ;CAE3D,MAAM,eAAe,OACpB,OAAO,IAAI,aAAa;EACvB,MAAM,KAAK,GAAG;AACd,MAAI,MAAM,UACT,QAAO,OAAO,OAAO,KACpB,IAAI,cAAc;GACjB,QAAQ;GACR,MAAM;GACN,QAAQ,eAAe,GAAG;GAC1B,CAAC,CACF;AAEF,YAAU,MAAM;GACf;AAEH,MAAK,MAAM,gBAAgB,MAAM,eAAe;EAC/C,MAAM,MAAM,aAAa;AACzB,MAAI,OAAO,SACV,QAAO,OAAO,OAAO,KACpB,IAAI,cAAc;GACjB,QAAQ;GACR,MAAM;GACN,QAAQ,aAAa,IAAI;GACzB,CAAC,CACF;AAEF,WAAS,OAAO,aAAa;AAC7B,MAAI,aAAa,WAAW,KAAA,EAC3B,MAAK,MAAM,CAAC,UAAU,eAAe,OAAO,QAAQ,aAAa,OAAO,EAAE;AACzE,OAAI,YAAY,OACf,QAAO,OAAO,OAAO,KACpB,IAAI,cAAc;IACjB,QAAQ;IACR,MAAM;IACN,QAAQ,cAAc,SAAS;IAC/B,CAAC,CACF;AAEF,UAAO,YAAY;;AAGrB,OAAK,MAAM,MAAM,aAAa,UAC7B,QAAO,YAAY,GAAG;;AAGxB,MAAK,MAAM,MAAM,MAAM,aAAa,EAAE,CACrC,QAAO,YAAY,GAAG;AAGvB,QAAO;EACN,UAAU,MAAM;EAChB,iBAAA;EACA;EACA;EACA;EAIA,GAAI,MAAM,YAAY,KAAA,IAAY,EAAE,SAAS,MAAM,SAAS,GAAG,EAAE;EACjE;EACA;;;;;;;;AAaH,MAAa,iBACZ,UACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,kBAAkB,SAAS;AAExC,QAAO,gBAAgB,MADT,IAAI,aAAa,CAAC,OAAO,KACL,CAAC,CAAC,KACnC,OAAO,UACL,UACA,IAAI,cAAc;EACjB,QAAQ;EACR;EACA,QAAQ,gCAAgC,MAAM;EAC9C;EACA,CAAC,CACH,CACD;EACA,CAAC,KACF,OAAO,SAAS,0BAA0B,EAAE,YAAY,EAAE,0BAA0B,MAAM,EAAE,CAAC,CAC7F;AAEF,MAAM,qBAAqB,aAI1B,KAAK,UAAU,UAAU,MAAM,EAAE"}
1
+ {"version":3,"file":"manifest.mjs","names":[],"sources":["../../../../src/substrate/runtime/manifest/manifest.ts"],"sourcesContent":["// Manifest emitter — endpoint-keyed envelope, atomic write.\n//\n// Architecture § Manifest data model. The envelope is L0 (`identity`\n// tuple, `manifestVersion`, `endpoints` lookup, `extras`).\n//\n// The emitter:\n// - Walks endpoint entries to build the flat `endpoints` lookup\n// keyed by `endpointKey`. Entries carry the declared endpoint\n// `name` for build-integration lookup.\n// - Writes atomically via tempfile + fsync + rename. The atomic-\n// write primitive lives in L0 (per architecture § Collapsed:\n// \"Three tempfile+rename impls → one atomic-write primitive\").\n// - Validates the envelope against `ManifestEnvelopeSchema` on read.\n// - Pins `manifestVersion` so future-proofing migrations have a\n// compatibility seam. The pinned version is `1`.\n//\n// Discipline: zero service names. The schema validates the envelope\n// shape, not the per-plugin contents.\n\nimport { Effect } from 'effect';\nimport { Data } from 'effect';\nimport { FileSystem } from 'effect';\n\nimport type { EndpointKey, PluginKey } from '../../brand.ts';\nimport {\n\ttype EndpointEntry,\n\ttype ManifestCodegen,\n\ttype ManifestExtras,\n\ttype ManifestEnvelope,\n\tManifestEnvelopeSchema,\n} from '../../manifest.ts';\nimport { atomicWriteFile } from '../atomic-write.ts';\nimport { decodeJsonText } from '../runtime-decode.ts';\n\n// -----------------------------------------------------------------------------\n// Pinned schema version\n// -----------------------------------------------------------------------------\n\n/**\n * Schema version pinned at the envelope level. Bump only on a\n * breaking shape change to the envelope (NOT to a per-plugin service\n * slice — those carry their own version via Codegenable contribution).\n *\n * Reader policy:\n * - Equal version: accept.\n * - Older version: refuse (advise user to re-run `up`).\n * - Newer version: refuse (build integration is out of date).\n */\nexport const CURRENT_MANIFEST_VERSION = 1 as const;\n\n// -----------------------------------------------------------------------------\n// Errors\n// -----------------------------------------------------------------------------\n\n/** One error class for every manifest IO failure. */\nexport class ManifestError extends Data.TaggedError('ManifestError')<{\n\treadonly reason:\n\t\t| 'write-failed'\n\t\t| 'read-failed'\n\t\t| 'decode-failed'\n\t\t| 'version-mismatch'\n\t\t| 'duplicate-endpoint';\n\treadonly path: string;\n\treadonly detail?: string;\n\treadonly cause?: unknown;\n}> {}\n\n// -----------------------------------------------------------------------------\n// Public writer interface\n// -----------------------------------------------------------------------------\n\nexport interface WriteManifestInput {\n\treadonly identity: ManifestEnvelope['identity'];\n\treadonly endpoints?: ReadonlyArray<EndpointEntry>;\n\treadonly extras?: ManifestExtras;\n\t/** Per-stack codegen metadata (the dev-only `extrasDir` + live\n\t * `idsFile`). Optional + additive — omitting it produces an envelope\n\t * without the `codegen` key, identical to a pre-field manifest. */\n\treadonly codegen?: ManifestCodegen;\n}\n\n/**\n * Build the envelope from endpoint entries + extras. Pure; the writer\n * calls this and then atomically writes the JSON.\n *\n * Endpoint-key collisions error: every endpoint has a unique\n * `(pluginKey, dispatchId)` digest by construction; a duplicate means\n * a substrate bug.\n */\nexport const buildEnvelope = (\n\tinput: WriteManifestInput,\n): Effect.Effect<ManifestEnvelope, ManifestError> =>\n\tEffect.gen(function* () {\n\t\tconst endpoints: Record<string, EndpointEntry> = {};\n\t\tconst extras: Record<string, unknown> = { ...input.extras };\n\n\t\tconst addEndpoint = (ep: EndpointEntry): Effect.Effect<void, ManifestError> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst ek = ep.endpointKey as string;\n\t\t\t\tif (ek in endpoints) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\t\treason: 'duplicate-endpoint',\n\t\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\t\tdetail: `endpointKey ${ek} contributed twice`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tendpoints[ek] = ep;\n\t\t\t});\n\n\t\tfor (const ep of input.endpoints ?? []) {\n\t\t\tyield* addEndpoint(ep);\n\t\t}\n\n\t\treturn {\n\t\t\tidentity: input.identity,\n\t\t\tmanifestVersion: CURRENT_MANIFEST_VERSION,\n\t\t\tendpoints,\n\t\t\textras,\n\t\t\t// Spread only when present so an omitted `codegen` yields the\n\t\t\t// exact same envelope (and serialized bytes) as a pre-field\n\t\t\t// manifest — additive, no churn for stacks that don't record it.\n\t\t\t...(input.codegen !== undefined ? { codegen: input.codegen } : {}),\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Atomic write — delegates to the canonical primitive.\n// -----------------------------------------------------------------------------\n\n/**\n * Serialize and write the envelope at `path` atomically. Routes\n * through the canonical `atomicWriteFile` primitive (mkdir-parent →\n * O_EXCL temp → write → fsync → rename), so the manifest writer\n * shares ONE owner of the tempfile dance with the cache.\n */\nexport const writeManifest = (\n\tenvelope: ManifestEnvelope,\n\tpath: string,\n): Effect.Effect<void, ManifestError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst json = serializeEnvelope(envelope);\n\t\tconst bytes = new TextEncoder().encode(json);\n\t\tyield* atomicWriteFile(path, bytes).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tdetail: `atomic write failed at stage ${cause.stage}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t});\n\nconst serializeEnvelope = (envelope: ManifestEnvelope): string =>\n\t// Stable key ordering, deterministic re-emit. `JSON.stringify` with\n\t// 2-space indent is reproducible byte-for-byte given the same\n\t// input object.\n\tJSON.stringify(envelope, null, 2);\n\n// -----------------------------------------------------------------------------\n// Read + decode\n// -----------------------------------------------------------------------------\n\n/**\n * Read and decode the manifest at `path`. Validates against\n * `ManifestEnvelopeSchema` and the pinned `CURRENT_MANIFEST_VERSION`.\n *\n * Used by:\n * - Build integrations (Vitest, Playwright, generated app code) — consumes\n * `envelope.endpoints` lookup.\n *\n * The reader is read-only; no mutation, no IO beyond the single read.\n */\nexport const readManifest = (\n\tpath: string,\n): Effect.Effect<ManifestEnvelope, ManifestError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst text = yield* fs\n\t\t\t.readFileString(path)\n\t\t\t.pipe(Effect.mapError((cause) => new ManifestError({ reason: 'read-failed', path, cause })));\n\t\tconst decoded = yield* decodeJsonText(ManifestEnvelopeSchema, text, {\n\t\t\tsource: path,\n\t\t\tmkError: (issue) =>\n\t\t\t\tnew ManifestError({ reason: 'decode-failed', path, cause: issue.cause ?? issue }),\n\t\t});\n\t\tif (decoded.manifestVersion !== CURRENT_MANIFEST_VERSION) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ManifestError({\n\t\t\t\t\treason: 'version-mismatch',\n\t\t\t\t\tpath,\n\t\t\t\t\tdetail: `expected ${CURRENT_MANIFEST_VERSION}, got ${decoded.manifestVersion}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn decoded as ManifestEnvelope;\n\t});\n\n// -----------------------------------------------------------------------------\n// Re-export the envelope + endpoint types so downstream substrate\n// modules (codegen, build integrations) don't reach into substrate/\n// directly.\n// -----------------------------------------------------------------------------\n\nexport type { EndpointEntry, EndpointKey, ManifestCodegen, ManifestEnvelope, PluginKey };\nexport { ManifestEnvelopeSchema };\n"],"mappings":";;;;;AAuDA,IAAa,gBAAb,cAAmC,KAAK,YAAY,eAAe,CAAC,CAUjE,CAAC;;;;;;;;;AAwBJ,MAAa,iBACZ,UAEA,OAAO,IAAI,aAAa;CACvB,MAAM,YAA2C,CAAC;CAClD,MAAM,SAAkC,EAAE,GAAG,MAAM,OAAO;CAE1D,MAAM,eAAe,OACpB,OAAO,IAAI,aAAa;EACvB,MAAM,KAAK,GAAG;EACd,IAAI,MAAM,WACT,OAAO,OAAO,OAAO,KACpB,IAAI,cAAc;GACjB,QAAQ;GACR,MAAM;GACN,QAAQ,eAAe,GAAG;EAC3B,CAAC,CACF;EAED,UAAU,MAAM;CACjB,CAAC;CAEF,KAAK,MAAM,MAAM,MAAM,aAAa,CAAC,GACpC,OAAO,YAAY,EAAE;CAGtB,OAAO;EACN,UAAU,MAAM;EAChB,iBAAA;EACA;EACA;EAIA,GAAI,MAAM,YAAY,KAAA,IAAY,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;CACjE;AACD,CAAC;;;;;;;AAYF,MAAa,iBACZ,UACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,kBAAkB,QAAQ;CAEvC,OAAO,gBAAgB,MADT,IAAI,YAAY,CAAC,CAAC,OAAO,IACN,CAAC,CAAC,CAAC,KACnC,OAAO,UACL,UACA,IAAI,cAAc;EACjB,QAAQ;EACR;EACA,QAAQ,gCAAgC,MAAM;EAC9C;CACD,CAAC,CACH,CACD;AACD,CAAC;AAEF,MAAM,qBAAqB,aAI1B,KAAK,UAAU,UAAU,MAAM,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { Schema } from "effect";
2
- import * as _$effect_Cause0 from "effect/Cause";
3
2
 
4
3
  //#region src/substrate/runtime/mode-errors.d.ts
5
4
  declare const ForkIncompatibleError_base: Schema.Class<ForkIncompatibleError, Schema.TaggedStruct<"ForkIncompatibleError", {
@@ -13,7 +12,7 @@ declare const ForkIncompatibleError_base: Schema.Class<ForkIncompatibleError, Sc
13
12
  /** Optional original cause when the refusal wraps an underlying
14
13
  * fault (rare — typical use is a pure factory-time refusal). */
15
14
  readonly cause: Schema.optional<Schema.Defect>;
16
- }>, _$effect_Cause0.YieldableError>;
15
+ }>, import("effect/Cause").YieldableError>;
17
16
  /**
18
17
  * Synchronous factory-time refusal raised by a plugin factory
19
18
  * variant when composed against a network the variant cannot serve
@@ -1 +1 @@
1
- {"version":3,"file":"mode-errors.mjs","names":[],"sources":["../../../src/substrate/runtime/mode-errors.ts"],"sourcesContent":["// Cross-cutting mode-refusal errors.\n//\n// Reviews finding (cross-cutting.md §\"Error model\"): the\n// `ForkIncompatibleError` tag is defined twice today — once in\n// `plugins/walrus/errors.ts`, once in `plugins/seal/errors.ts` — with\n// conflicting field shapes. Two `_tag` literals with the same name\n// but different shapes violate STYLE_GUIDE §2 (\"One `_tag` literal\n// per logical error type across the whole package\").\n//\n// Lift the canonical shape here. Both plugins import from substrate\n// in PR3; this PR does NOT modify the plugin-side error files (per\n// PR1 scope).\n//\n// Shape decision:\n// - `variant` carries the refusing factory name (e.g.\n// `'walrusLocalCluster'`, `'sealLocalKeygen'`). Lets walrus and\n// seal share the shape without losing the call-site distinction.\n// - `network` carries the resolved `*-fork` network string the\n// user passed.\n// - `message` is the imperative one-liner suitable for stderr.\n// - `hint` is the actionable next step (the known-deployment\n// alternative).\n//\n// Substrate is name-blind on the plugin level — these fields are\n// generic (\"which factory variant refused\" + \"which network it\n// refused under\") and do NOT name walrus / seal.\n\nimport { Schema } from 'effect';\n\n/**\n * Synchronous factory-time refusal raised by a plugin factory\n * variant when composed against a network the variant cannot serve\n * (canonically: a `*-fork` chain that doesn't expose the fullnode\n * surface the variant requires).\n *\n * Architecture (Tension 11): primary refusal is TYPE-LEVEL via\n * mode-narrowed factory namespaces — `walrusFor(forkNet).<mode>` only\n * exposes `.known`. This runtime shape is defense-in-depth for\n * callers that bypass the type-level narrowing (env-driven factories,\n * plugin composition through resolved values).\n *\n * Used by walrus (`local-cluster` variant) and seal (`local-keygen`\n * variant) today; future plugin factories refusing on a network\n * predicate share this single shape.\n */\nexport class ForkIncompatibleError extends Schema.TaggedErrorClass<ForkIncompatibleError>()(\n\t'ForkIncompatibleError',\n\t{\n\t\t/** Refusing factory variant — e.g. `'walrusLocalCluster'`,\n\t\t * `'sealLocalKeygen'`. Lets multiple plugin factories share\n\t\t * this shape without losing the call-site distinction. */\n\t\tvariant: Schema.String,\n\t\t/** Resolved network the composition refused under. */\n\t\tnetwork: Schema.String,\n\t\t/** Imperative one-liner suitable for stderr. */\n\t\tmessage: Schema.String,\n\t\t/** Actionable next step (the known-deployment alternative). */\n\t\thint: Schema.optional(Schema.String),\n\t\t/** Optional original cause when the refusal wraps an underlying\n\t\t * fault (rare — typical use is a pure factory-time refusal). */\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n"],"mappings":";AA6C2C,OAAO,kBAAyC,CAC1F,yBACA;;;;CAIC,SAAS,OAAO;;CAEhB,SAAS,OAAO;;CAEhB,SAAS,OAAO;;CAEhB,MAAM,OAAO,SAAS,OAAO,OAAO;;;CAGpC,OAAO,OAAO,SAAS,OAAO,OAAO;CACrC,CACD"}
1
+ {"version":3,"file":"mode-errors.mjs","names":[],"sources":["../../../src/substrate/runtime/mode-errors.ts"],"sourcesContent":["// Cross-cutting mode-refusal errors.\n//\n// Reviews finding (cross-cutting.md §\"Error model\"): the\n// `ForkIncompatibleError` tag is defined twice today — once in\n// `plugins/walrus/errors.ts`, once in `plugins/seal/errors.ts` — with\n// conflicting field shapes. Two `_tag` literals with the same name\n// but different shapes violate STYLE_GUIDE §2 (\"One `_tag` literal\n// per logical error type across the whole package\").\n//\n// Lift the canonical shape here. Both plugins import from substrate\n// in PR3; this PR does NOT modify the plugin-side error files (per\n// PR1 scope).\n//\n// Shape decision:\n// - `variant` carries the refusing factory name (e.g.\n// `'walrusLocalCluster'`, `'sealLocalKeygen'`). Lets walrus and\n// seal share the shape without losing the call-site distinction.\n// - `network` carries the resolved `*-fork` network string the\n// user passed.\n// - `message` is the imperative one-liner suitable for stderr.\n// - `hint` is the actionable next step (the known-deployment\n// alternative).\n//\n// Substrate is name-blind on the plugin level — these fields are\n// generic (\"which factory variant refused\" + \"which network it\n// refused under\") and do NOT name walrus / seal.\n\nimport { Schema } from 'effect';\n\n/**\n * Synchronous factory-time refusal raised by a plugin factory\n * variant when composed against a network the variant cannot serve\n * (canonically: a `*-fork` chain that doesn't expose the fullnode\n * surface the variant requires).\n *\n * Architecture (Tension 11): primary refusal is TYPE-LEVEL via\n * mode-narrowed factory namespaces — `walrusFor(forkNet).<mode>` only\n * exposes `.known`. This runtime shape is defense-in-depth for\n * callers that bypass the type-level narrowing (env-driven factories,\n * plugin composition through resolved values).\n *\n * Used by walrus (`local-cluster` variant) and seal (`local-keygen`\n * variant) today; future plugin factories refusing on a network\n * predicate share this single shape.\n */\nexport class ForkIncompatibleError extends Schema.TaggedErrorClass<ForkIncompatibleError>()(\n\t'ForkIncompatibleError',\n\t{\n\t\t/** Refusing factory variant — e.g. `'walrusLocalCluster'`,\n\t\t * `'sealLocalKeygen'`. Lets multiple plugin factories share\n\t\t * this shape without losing the call-site distinction. */\n\t\tvariant: Schema.String,\n\t\t/** Resolved network the composition refused under. */\n\t\tnetwork: Schema.String,\n\t\t/** Imperative one-liner suitable for stderr. */\n\t\tmessage: Schema.String,\n\t\t/** Actionable next step (the known-deployment alternative). */\n\t\thint: Schema.optional(Schema.String),\n\t\t/** Optional original cause when the refusal wraps an underlying\n\t\t * fault (rare — typical use is a pure factory-time refusal). */\n\t\tcause: Schema.optional(Schema.Defect),\n\t},\n) {}\n"],"mappings":";AA6C2C,OAAO,iBAAwC,CAAC,CAC1F,yBACA;;;;CAIC,SAAS,OAAO;;CAEhB,SAAS,OAAO;;CAEhB,SAAS,OAAO;;CAEhB,MAAM,OAAO,SAAS,OAAO,MAAM;;;CAGnC,OAAO,OAAO,SAAS,OAAO,MAAM;AACrC,CACD"}
@@ -1,9 +1,6 @@
1
1
  import { redactText, redactValue } from "./redaction.mjs";
2
2
  import { Cause } from "effect";
3
3
  //#region src/substrate/runtime/observability/cascade-formatter.ts
4
- /** Empty registry — the formatter falls back to the default
5
- * rendering for every value. */
6
- const emptyFormatterRegistry = /* @__PURE__ */ new Map();
7
4
  const DEFAULT_FIELD_TRUNCATE = 8192;
8
5
  const DEFAULT_MAX_DEPTH = 12;
9
6
  const isTaggedError = (value) => typeof value === "object" && value !== null && typeof value._tag === "string";
@@ -18,7 +15,6 @@ const isTaggedError = (value) => typeof value === "object" && value !== null &&
18
15
  */
19
16
  const formatCause = (cause, options) => {
20
17
  const opts = {
21
- formatters: options?.formatters ?? emptyFormatterRegistry,
22
18
  fieldTruncate: options?.fieldTruncate ?? DEFAULT_FIELD_TRUNCATE,
23
19
  maxDepth: options?.maxDepth ?? DEFAULT_MAX_DEPTH,
24
20
  redactions: options?.redactions ?? []
@@ -37,7 +33,6 @@ const formatCause = (cause, options) => {
37
33
  */
38
34
  const formatValue = (value, options) => {
39
35
  return formatAny(value, {
40
- formatters: options?.formatters ?? emptyFormatterRegistry,
41
36
  fieldTruncate: options?.fieldTruncate ?? DEFAULT_FIELD_TRUNCATE,
42
37
  maxDepth: options?.maxDepth ?? DEFAULT_MAX_DEPTH,
43
38
  redactions: options?.redactions ?? []
@@ -78,11 +73,6 @@ const formatAny = (value, opts, visited, depth) => {
78
73
  }
79
74
  };
80
75
  const formatTagged = (value, opts, visited, depth) => {
81
- const override = opts.formatters.get(value._tag);
82
- if (override) {
83
- const result = override(value, (inner) => formatAny(inner, opts, visited, depth + 1));
84
- if (result !== null) return result;
85
- }
86
76
  const qualifier = typeof value.phase === "string" ? `(${value.phase})` : typeof value.op === "string" ? `(${value.op})` : "";
87
77
  const message = typeof value.message === "string" ? redactText(value.message, opts.redactions) : "";
88
78
  const header = qualifier ? `${value._tag} ${qualifier}: ${message}` : `${value._tag}: ${message}`;
@@ -126,6 +116,6 @@ const safeJson = (value, limit, redactions) => {
126
116
  }
127
117
  };
128
118
  //#endregion
129
- export { emptyFormatterRegistry, formatCause, formatValue, isTaggedError };
119
+ export { formatCause, formatValue, isTaggedError };
130
120
 
131
121
  //# sourceMappingURL=cascade-formatter.mjs.map