@mysten-incubation/devstack 0.0.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 (833) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +94 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +13 -0
  4. package/dist/api/define-capabilities.d.mts +25 -0
  5. package/dist/api/define-capabilities.mjs +19 -0
  6. package/dist/api/define-capabilities.mjs.map +1 -0
  7. package/dist/api/define-devstack-with.d.mts +41 -0
  8. package/dist/api/define-devstack-with.mjs +24 -0
  9. package/dist/api/define-devstack-with.mjs.map +1 -0
  10. package/dist/api/define-devstack.d.mts +62 -0
  11. package/dist/api/define-devstack.mjs +108 -0
  12. package/dist/api/define-devstack.mjs.map +1 -0
  13. package/dist/api/define-plugin.d.mts +1 -0
  14. package/dist/api/inference-network.mjs +122 -0
  15. package/dist/api/inference-network.mjs.map +1 -0
  16. package/dist/api/mode-narrowed-factory.d.mts +26 -0
  17. package/dist/api/mode-narrowed-factory.mjs +8 -0
  18. package/dist/api/mode-narrowed-factory.mjs.map +1 -0
  19. package/dist/api/plugin-errors.mjs +10 -0
  20. package/dist/api/plugin-errors.mjs.map +1 -0
  21. package/dist/api/run-stack.d.mts +82 -0
  22. package/dist/api/run-stack.mjs +127 -0
  23. package/dist/api/run-stack.mjs.map +1 -0
  24. package/dist/build-integrations/playwright/config.d.mts +92 -0
  25. package/dist/build-integrations/playwright/config.mjs +71 -0
  26. package/dist/build-integrations/playwright/config.mjs.map +1 -0
  27. package/dist/build-integrations/playwright/errors.d.mts +82 -0
  28. package/dist/build-integrations/playwright/errors.mjs +43 -0
  29. package/dist/build-integrations/playwright/errors.mjs.map +1 -0
  30. package/dist/build-integrations/playwright/global-setup.d.mts +64 -0
  31. package/dist/build-integrations/playwright/global-setup.mjs +44 -0
  32. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -0
  33. package/dist/build-integrations/playwright/index.d.mts +6 -0
  34. package/dist/build-integrations/playwright/index.mjs +6 -0
  35. package/dist/build-integrations/playwright/stack-context.d.mts +95 -0
  36. package/dist/build-integrations/playwright/stack-context.mjs +277 -0
  37. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -0
  38. package/dist/build-integrations/playwright/wallet-context.d.mts +87 -0
  39. package/dist/build-integrations/playwright/wallet-context.mjs +148 -0
  40. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -0
  41. package/dist/build-integrations/runtime/cold-start-url.d.mts +67 -0
  42. package/dist/build-integrations/runtime/cold-start-url.mjs +56 -0
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -0
  44. package/dist/build-integrations/runtime/dapp-kit-slot.mjs +10 -0
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -0
  46. package/dist/build-integrations/runtime/discover.d.mts +78 -0
  47. package/dist/build-integrations/runtime/discover.mjs +124 -0
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -0
  49. package/dist/build-integrations/runtime/endpoint-registry.d.mts +26 -0
  50. package/dist/build-integrations/runtime/endpoint-registry.mjs +41 -0
  51. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -0
  52. package/dist/build-integrations/runtime/errors.d.mts +64 -0
  53. package/dist/build-integrations/runtime/errors.mjs +51 -0
  54. package/dist/build-integrations/runtime/errors.mjs.map +1 -0
  55. package/dist/build-integrations/runtime/index.d.mts +7 -0
  56. package/dist/build-integrations/runtime/index.mjs +6 -0
  57. package/dist/build-integrations/runtime/read-stack-context.d.mts +38 -0
  58. package/dist/build-integrations/runtime/read-stack-context.mjs +130 -0
  59. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -0
  60. package/dist/build-integrations/runtime/stack-context.d.mts +53 -0
  61. package/dist/build-integrations/vitest/config.d.mts +62 -0
  62. package/dist/build-integrations/vitest/config.mjs +80 -0
  63. package/dist/build-integrations/vitest/config.mjs.map +1 -0
  64. package/dist/build-integrations/vitest/env.d.mts +48 -0
  65. package/dist/build-integrations/vitest/env.mjs +50 -0
  66. package/dist/build-integrations/vitest/env.mjs.map +1 -0
  67. package/dist/build-integrations/vitest/errors.d.mts +44 -0
  68. package/dist/build-integrations/vitest/errors.mjs +18 -0
  69. package/dist/build-integrations/vitest/errors.mjs.map +1 -0
  70. package/dist/build-integrations/vitest/index.d.mts +6 -0
  71. package/dist/build-integrations/vitest/index.mjs +6 -0
  72. package/dist/build-integrations/vitest/setup.d.mts +53 -0
  73. package/dist/build-integrations/vitest/setup.mjs +56 -0
  74. package/dist/build-integrations/vitest/setup.mjs.map +1 -0
  75. package/dist/build-integrations/vitest/stack-context.d.mts +58 -0
  76. package/dist/build-integrations/vitest/stack-context.mjs +67 -0
  77. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -0
  78. package/dist/cli/main.d.mts +5 -0
  79. package/dist/cli/main.mjs +586 -0
  80. package/dist/cli/main.mjs.map +1 -0
  81. package/dist/cli/prune-direct.mjs +216 -0
  82. package/dist/cli/prune-direct.mjs.map +1 -0
  83. package/dist/cli/snapshot-reader.mjs +73 -0
  84. package/dist/cli/snapshot-reader.mjs.map +1 -0
  85. package/dist/cli/up-lifecycle.mjs +28 -0
  86. package/dist/cli/up-lifecycle.mjs.map +1 -0
  87. package/dist/contracts/capability-decl.d.mts +42 -0
  88. package/dist/contracts/chain-probe.d.mts +26 -0
  89. package/dist/contracts/chain-probe.mjs +8 -0
  90. package/dist/contracts/chain-probe.mjs.map +1 -0
  91. package/dist/contracts/codegenable.d.mts +43 -0
  92. package/dist/contracts/container-runtime.d.mts +245 -0
  93. package/dist/contracts/liveness-classifier.d.mts +19 -0
  94. package/dist/contracts/network-resolver.d.mts +15 -0
  95. package/dist/contracts/network-resolver.mjs +7 -0
  96. package/dist/contracts/network-resolver.mjs.map +1 -0
  97. package/dist/contracts/projection.d.mts +15 -0
  98. package/dist/contracts/routable.d.mts +53 -0
  99. package/dist/contracts/snapshotable.d.mts +39 -0
  100. package/dist/contracts/strategy-contributor.d.mts +26 -0
  101. package/dist/index.d.mts +89 -0
  102. package/dist/index.mjs +37 -0
  103. package/dist/orchestrators/codegen/bindings.d.mts +2 -0
  104. package/dist/orchestrators/codegen/bindings.mjs +340 -0
  105. package/dist/orchestrators/codegen/bindings.mjs.map +1 -0
  106. package/dist/orchestrators/codegen/emit.mjs +56 -0
  107. package/dist/orchestrators/codegen/emit.mjs.map +1 -0
  108. package/dist/orchestrators/codegen/errors.d.mts +1 -0
  109. package/dist/orchestrators/codegen/errors.mjs +66 -0
  110. package/dist/orchestrators/codegen/errors.mjs.map +1 -0
  111. package/dist/orchestrators/codegen/extras.mjs +16 -0
  112. package/dist/orchestrators/codegen/extras.mjs.map +1 -0
  113. package/dist/orchestrators/codegen/format.mjs +109 -0
  114. package/dist/orchestrators/codegen/format.mjs.map +1 -0
  115. package/dist/orchestrators/codegen/gitignore.mjs +67 -0
  116. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -0
  117. package/dist/orchestrators/codegen/paths.d.mts +1 -0
  118. package/dist/orchestrators/codegen/paths.mjs +33 -0
  119. package/dist/orchestrators/codegen/paths.mjs.map +1 -0
  120. package/dist/orchestrators/codegen/permissions.mjs +6 -0
  121. package/dist/orchestrators/codegen/permissions.mjs.map +1 -0
  122. package/dist/orchestrators/codegen/service.d.mts +1 -0
  123. package/dist/orchestrators/codegen/service.mjs +276 -0
  124. package/dist/orchestrators/codegen/service.mjs.map +1 -0
  125. package/dist/orchestrators/router/cleanup.mjs +58 -0
  126. package/dist/orchestrators/router/cleanup.mjs.map +1 -0
  127. package/dist/orchestrators/router/cors.mjs +31 -0
  128. package/dist/orchestrators/router/cors.mjs.map +1 -0
  129. package/dist/orchestrators/router/entrypoints.d.mts +1 -0
  130. package/dist/orchestrators/router/entrypoints.mjs +80 -0
  131. package/dist/orchestrators/router/entrypoints.mjs.map +1 -0
  132. package/dist/orchestrators/router/errors.d.mts +1 -0
  133. package/dist/orchestrators/router/errors.mjs +103 -0
  134. package/dist/orchestrators/router/errors.mjs.map +1 -0
  135. package/dist/orchestrators/router/file-provider.d.mts +1 -0
  136. package/dist/orchestrators/router/file-provider.mjs +320 -0
  137. package/dist/orchestrators/router/file-provider.mjs.map +1 -0
  138. package/dist/orchestrators/router/hostname.d.mts +1 -0
  139. package/dist/orchestrators/router/hostname.mjs +107 -0
  140. package/dist/orchestrators/router/hostname.mjs.map +1 -0
  141. package/dist/orchestrators/router/index.d.mts +1 -0
  142. package/dist/orchestrators/router/profile.d.mts +1 -0
  143. package/dist/orchestrators/router/profile.mjs +109 -0
  144. package/dist/orchestrators/router/profile.mjs.map +1 -0
  145. package/dist/orchestrators/router/service.d.mts +3 -0
  146. package/dist/orchestrators/router/service.mjs +421 -0
  147. package/dist/orchestrators/router/service.mjs.map +1 -0
  148. package/dist/orchestrators/router/traefik-container.d.mts +1 -0
  149. package/dist/orchestrators/router/traefik-container.mjs +229 -0
  150. package/dist/orchestrators/router/traefik-container.mjs.map +1 -0
  151. package/dist/orchestrators/runtime-composition.d.mts +10 -0
  152. package/dist/orchestrators/runtime-composition.mjs +168 -0
  153. package/dist/orchestrators/runtime-composition.mjs.map +1 -0
  154. package/dist/orchestrators/snapshot/capture.d.mts +1 -0
  155. package/dist/orchestrators/snapshot/capture.mjs +350 -0
  156. package/dist/orchestrators/snapshot/capture.mjs.map +1 -0
  157. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -0
  158. package/dist/orchestrators/snapshot/descriptor.mjs +109 -0
  159. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -0
  160. package/dist/orchestrators/snapshot/identity-guard.d.mts +1 -0
  161. package/dist/orchestrators/snapshot/identity-guard.mjs +132 -0
  162. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -0
  163. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +207 -0
  164. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -0
  165. package/dist/orchestrators/snapshot/index.d.mts +1 -0
  166. package/dist/orchestrators/snapshot/integrity.d.mts +1 -0
  167. package/dist/orchestrators/snapshot/integrity.mjs +74 -0
  168. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -0
  169. package/dist/orchestrators/snapshot/prune.d.mts +1 -0
  170. package/dist/orchestrators/snapshot/prune.mjs +110 -0
  171. package/dist/orchestrators/snapshot/prune.mjs.map +1 -0
  172. package/dist/orchestrators/snapshot/restore.d.mts +1 -0
  173. package/dist/orchestrators/snapshot/restore.mjs +404 -0
  174. package/dist/orchestrators/snapshot/restore.mjs.map +1 -0
  175. package/dist/orchestrators/snapshot/service.d.mts +1 -0
  176. package/dist/orchestrators/snapshot/service.mjs +296 -0
  177. package/dist/orchestrators/snapshot/service.mjs.map +1 -0
  178. package/dist/orchestrators/snapshot/state-document.mjs +18 -0
  179. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -0
  180. package/dist/orchestrators/snapshot/wipe.d.mts +1 -0
  181. package/dist/orchestrators/snapshot/wipe.mjs +59 -0
  182. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -0
  183. package/dist/plugins/account/codegen.d.mts +12 -0
  184. package/dist/plugins/account/codegen.mjs +22 -0
  185. package/dist/plugins/account/codegen.mjs.map +1 -0
  186. package/dist/plugins/account/errors.d.mts +44 -0
  187. package/dist/plugins/account/errors.mjs +16 -0
  188. package/dist/plugins/account/errors.mjs.map +1 -0
  189. package/dist/plugins/account/funding.d.mts +94 -0
  190. package/dist/plugins/account/funding.mjs +199 -0
  191. package/dist/plugins/account/funding.mjs.map +1 -0
  192. package/dist/plugins/account/index.d.mts +54 -0
  193. package/dist/plugins/account/index.mjs +151 -0
  194. package/dist/plugins/account/index.mjs.map +1 -0
  195. package/dist/plugins/account/keypair.d.mts +32 -0
  196. package/dist/plugins/account/keypair.mjs +99 -0
  197. package/dist/plugins/account/keypair.mjs.map +1 -0
  198. package/dist/plugins/account/lease.mjs +21 -0
  199. package/dist/plugins/account/lease.mjs.map +1 -0
  200. package/dist/plugins/account/registry.d.mts +33 -0
  201. package/dist/plugins/account/registry.mjs +36 -0
  202. package/dist/plugins/account/registry.mjs.map +1 -0
  203. package/dist/plugins/account/service.d.mts +104 -0
  204. package/dist/plugins/account/service.mjs +405 -0
  205. package/dist/plugins/account/service.mjs.map +1 -0
  206. package/dist/plugins/account/snapshot.mjs +33 -0
  207. package/dist/plugins/account/snapshot.mjs.map +1 -0
  208. package/dist/plugins/account/variants/env.mjs +24 -0
  209. package/dist/plugins/account/variants/env.mjs.map +1 -0
  210. package/dist/plugins/account/variants/ephemeral.mjs +72 -0
  211. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -0
  212. package/dist/plugins/account/variants/impersonate.d.mts +16 -0
  213. package/dist/plugins/account/variants/impersonate.mjs +48 -0
  214. package/dist/plugins/account/variants/impersonate.mjs.map +1 -0
  215. package/dist/plugins/account/variants/inline.mjs +13 -0
  216. package/dist/plugins/account/variants/inline.mjs.map +1 -0
  217. package/dist/plugins/account/variants/keystore.mjs +93 -0
  218. package/dist/plugins/account/variants/keystore.mjs.map +1 -0
  219. package/dist/plugins/account/variants/signer.mjs +31 -0
  220. package/dist/plugins/account/variants/signer.mjs.map +1 -0
  221. package/dist/plugins/action/build-context.d.mts +41 -0
  222. package/dist/plugins/action/discriminator.d.mts +20 -0
  223. package/dist/plugins/action/discriminator.mjs +13 -0
  224. package/dist/plugins/action/discriminator.mjs.map +1 -0
  225. package/dist/plugins/action/errors.d.mts +31 -0
  226. package/dist/plugins/action/errors.mjs +13 -0
  227. package/dist/plugins/action/errors.mjs.map +1 -0
  228. package/dist/plugins/action/execute.d.mts +2 -0
  229. package/dist/plugins/action/execute.mjs +145 -0
  230. package/dist/plugins/action/execute.mjs.map +1 -0
  231. package/dist/plugins/action/index.d.mts +56 -0
  232. package/dist/plugins/action/index.mjs +82 -0
  233. package/dist/plugins/action/index.mjs.map +1 -0
  234. package/dist/plugins/action/service.d.mts +26 -0
  235. package/dist/plugins/action/service.mjs +84 -0
  236. package/dist/plugins/action/service.mjs.map +1 -0
  237. package/dist/plugins/coin/address-resolution.d.mts +34 -0
  238. package/dist/plugins/coin/address-resolution.mjs +80 -0
  239. package/dist/plugins/coin/address-resolution.mjs.map +1 -0
  240. package/dist/plugins/coin/codegen.d.mts +16 -0
  241. package/dist/plugins/coin/codegen.mjs +21 -0
  242. package/dist/plugins/coin/codegen.mjs.map +1 -0
  243. package/dist/plugins/coin/discovery.d.mts +26 -0
  244. package/dist/plugins/coin/discovery.mjs +112 -0
  245. package/dist/plugins/coin/discovery.mjs.map +1 -0
  246. package/dist/plugins/coin/errors.d.mts +48 -0
  247. package/dist/plugins/coin/errors.mjs +13 -0
  248. package/dist/plugins/coin/errors.mjs.map +1 -0
  249. package/dist/plugins/coin/index.d.mts +95 -0
  250. package/dist/plugins/coin/index.mjs +172 -0
  251. package/dist/plugins/coin/index.mjs.map +1 -0
  252. package/dist/plugins/coin/metadata.d.mts +15 -0
  253. package/dist/plugins/coin/metadata.mjs +99 -0
  254. package/dist/plugins/coin/metadata.mjs.map +1 -0
  255. package/dist/plugins/coin/mint.d.mts +34 -0
  256. package/dist/plugins/coin/mint.mjs +164 -0
  257. package/dist/plugins/coin/mint.mjs.map +1 -0
  258. package/dist/plugins/coin/registry.d.mts +1 -0
  259. package/dist/plugins/coin/registry.mjs +37 -0
  260. package/dist/plugins/coin/registry.mjs.map +1 -0
  261. package/dist/plugins/coin/service.d.mts +47 -0
  262. package/dist/plugins/coin/service.mjs +51 -0
  263. package/dist/plugins/coin/service.mjs.map +1 -0
  264. package/dist/plugins/coin/snapshot.mjs +19 -0
  265. package/dist/plugins/coin/snapshot.mjs.map +1 -0
  266. package/dist/plugins/coin/type-strings.mjs +49 -0
  267. package/dist/plugins/coin/type-strings.mjs.map +1 -0
  268. package/dist/plugins/deepbook/codegen.d.mts +39 -0
  269. package/dist/plugins/deepbook/codegen.mjs +15 -0
  270. package/dist/plugins/deepbook/codegen.mjs.map +1 -0
  271. package/dist/plugins/deepbook/deploy.mjs +437 -0
  272. package/dist/plugins/deepbook/deploy.mjs.map +1 -0
  273. package/dist/plugins/deepbook/errors.d.mts +29 -0
  274. package/dist/plugins/deepbook/errors.mjs +26 -0
  275. package/dist/plugins/deepbook/errors.mjs.map +1 -0
  276. package/dist/plugins/deepbook/faucet-strategy.d.mts +8 -0
  277. package/dist/plugins/deepbook/faucet-strategy.mjs +81 -0
  278. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -0
  279. package/dist/plugins/deepbook/index.d.mts +171 -0
  280. package/dist/plugins/deepbook/index.mjs +359 -0
  281. package/dist/plugins/deepbook/index.mjs.map +1 -0
  282. package/dist/plugins/deepbook/plugin-key.mjs +7 -0
  283. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -0
  284. package/dist/plugins/deepbook/pyth/index.mjs +226 -0
  285. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -0
  286. package/dist/plugins/deepbook/routable.mjs +21 -0
  287. package/dist/plugins/deepbook/routable.mjs.map +1 -0
  288. package/dist/plugins/deepbook/snapshot.mjs +49 -0
  289. package/dist/plugins/deepbook/snapshot.mjs.map +1 -0
  290. package/dist/plugins/deepbook/types.d.mts +125 -0
  291. package/dist/plugins/deepbook/types.mjs +12 -0
  292. package/dist/plugins/deepbook/types.mjs.map +1 -0
  293. package/dist/plugins/faucet/dispatcher.d.mts +9 -0
  294. package/dist/plugins/faucet/dispatcher.mjs +13 -0
  295. package/dist/plugins/faucet/dispatcher.mjs.map +1 -0
  296. package/dist/plugins/faucet/errors.d.mts +86 -0
  297. package/dist/plugins/faucet/errors.mjs +19 -0
  298. package/dist/plugins/faucet/errors.mjs.map +1 -0
  299. package/dist/plugins/faucet/http.mjs +127 -0
  300. package/dist/plugins/faucet/http.mjs.map +1 -0
  301. package/dist/plugins/faucet/index.d.mts +43 -0
  302. package/dist/plugins/faucet/index.mjs +42 -0
  303. package/dist/plugins/faucet/index.mjs.map +1 -0
  304. package/dist/plugins/faucet/service.d.mts +20 -0
  305. package/dist/plugins/faucet/strategies/sui-local.d.mts +23 -0
  306. package/dist/plugins/faucet/strategies/sui-local.mjs +29 -0
  307. package/dist/plugins/faucet/strategies/sui-local.mjs.map +1 -0
  308. package/dist/plugins/host-service/errors.d.mts +27 -0
  309. package/dist/plugins/host-service/errors.mjs +14 -0
  310. package/dist/plugins/host-service/errors.mjs.map +1 -0
  311. package/dist/plugins/host-service/index.d.mts +10 -0
  312. package/dist/plugins/host-service/index.mjs +48 -0
  313. package/dist/plugins/host-service/index.mjs.map +1 -0
  314. package/dist/plugins/host-service/routable.mjs +24 -0
  315. package/dist/plugins/host-service/routable.mjs.map +1 -0
  316. package/dist/plugins/host-service/service.d.mts +49 -0
  317. package/dist/plugins/host-service/service.mjs +375 -0
  318. package/dist/plugins/host-service/service.mjs.map +1 -0
  319. package/dist/plugins/package/build.d.mts +1 -0
  320. package/dist/plugins/package/build.mjs +24 -0
  321. package/dist/plugins/package/build.mjs.map +1 -0
  322. package/dist/plugins/package/codegen.d.mts +19 -0
  323. package/dist/plugins/package/codegen.mjs +41 -0
  324. package/dist/plugins/package/codegen.mjs.map +1 -0
  325. package/dist/plugins/package/dep-resolution.mjs +10 -0
  326. package/dist/plugins/package/dep-resolution.mjs.map +1 -0
  327. package/dist/plugins/package/errors.d.mts +34 -0
  328. package/dist/plugins/package/errors.mjs +13 -0
  329. package/dist/plugins/package/errors.mjs.map +1 -0
  330. package/dist/plugins/package/index.d.mts +109 -0
  331. package/dist/plugins/package/index.mjs +207 -0
  332. package/dist/plugins/package/index.mjs.map +1 -0
  333. package/dist/plugins/package/mode-known.mjs +41 -0
  334. package/dist/plugins/package/mode-known.mjs.map +1 -0
  335. package/dist/plugins/package/mode-local.d.mts +1 -0
  336. package/dist/plugins/package/mode-local.mjs +183 -0
  337. package/dist/plugins/package/mode-local.mjs.map +1 -0
  338. package/dist/plugins/package/publish-executor.mjs +202 -0
  339. package/dist/plugins/package/publish-executor.mjs.map +1 -0
  340. package/dist/plugins/package/publish-output.d.mts +28 -0
  341. package/dist/plugins/package/publish-output.mjs +45 -0
  342. package/dist/plugins/package/publish-output.mjs.map +1 -0
  343. package/dist/plugins/package/registry.d.mts +25 -0
  344. package/dist/plugins/package/registry.mjs +30 -0
  345. package/dist/plugins/package/registry.mjs.map +1 -0
  346. package/dist/plugins/package/service.mjs +20 -0
  347. package/dist/plugins/package/service.mjs.map +1 -0
  348. package/dist/plugins/package/snapshot.mjs +25 -0
  349. package/dist/plugins/package/snapshot.mjs.map +1 -0
  350. package/dist/plugins/postgres/codegen.mjs +42 -0
  351. package/dist/plugins/postgres/codegen.mjs.map +1 -0
  352. package/dist/plugins/postgres/connection.d.mts +33 -0
  353. package/dist/plugins/postgres/connection.mjs +19 -0
  354. package/dist/plugins/postgres/connection.mjs.map +1 -0
  355. package/dist/plugins/postgres/db-ensure.mjs +100 -0
  356. package/dist/plugins/postgres/db-ensure.mjs.map +1 -0
  357. package/dist/plugins/postgres/errors.d.mts +55 -0
  358. package/dist/plugins/postgres/errors.mjs +29 -0
  359. package/dist/plugins/postgres/errors.mjs.map +1 -0
  360. package/dist/plugins/postgres/index.d.mts +37 -0
  361. package/dist/plugins/postgres/index.mjs +75 -0
  362. package/dist/plugins/postgres/index.mjs.map +1 -0
  363. package/dist/plugins/postgres/routable.mjs +33 -0
  364. package/dist/plugins/postgres/routable.mjs.map +1 -0
  365. package/dist/plugins/postgres/service.d.mts +50 -0
  366. package/dist/plugins/postgres/service.mjs +145 -0
  367. package/dist/plugins/postgres/service.mjs.map +1 -0
  368. package/dist/plugins/postgres/snapshot.d.mts +1 -0
  369. package/dist/plugins/postgres/snapshot.mjs +32 -0
  370. package/dist/plugins/postgres/snapshot.mjs.map +1 -0
  371. package/dist/plugins/router-entrypoints.mjs +21 -0
  372. package/dist/plugins/router-entrypoints.mjs.map +1 -0
  373. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +59 -0
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -0
  375. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +132 -0
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -0
  377. package/dist/plugins/seal/codegen.d.mts +19 -0
  378. package/dist/plugins/seal/codegen.mjs +16 -0
  379. package/dist/plugins/seal/codegen.mjs.map +1 -0
  380. package/dist/plugins/seal/config-render.mjs +82 -0
  381. package/dist/plugins/seal/config-render.mjs.map +1 -0
  382. package/dist/plugins/seal/deploy.mjs +198 -0
  383. package/dist/plugins/seal/deploy.mjs.map +1 -0
  384. package/dist/plugins/seal/errors.d.mts +52 -0
  385. package/dist/plugins/seal/errors.mjs +19 -0
  386. package/dist/plugins/seal/errors.mjs.map +1 -0
  387. package/dist/plugins/seal/index.d.mts +161 -0
  388. package/dist/plugins/seal/index.mjs +235 -0
  389. package/dist/plugins/seal/index.mjs.map +1 -0
  390. package/dist/plugins/seal/key-manager.d.mts +22 -0
  391. package/dist/plugins/seal/key-manager.mjs +22 -0
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -0
  393. package/dist/plugins/seal/key-server.mjs +175 -0
  394. package/dist/plugins/seal/key-server.mjs.map +1 -0
  395. package/dist/plugins/seal/keygen.mjs +96 -0
  396. package/dist/plugins/seal/keygen.mjs.map +1 -0
  397. package/dist/plugins/seal/mode/fork-known.d.mts +8 -0
  398. package/dist/plugins/seal/mode/fork-known.mjs +23 -0
  399. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -0
  400. package/dist/plugins/seal/mode/live.d.mts +18 -0
  401. package/dist/plugins/seal/mode/live.mjs +64 -0
  402. package/dist/plugins/seal/mode/live.mjs.map +1 -0
  403. package/dist/plugins/seal/mode/local-keygen.mjs +180 -0
  404. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -0
  405. package/dist/plugins/seal/plugin-key.mjs +7 -0
  406. package/dist/plugins/seal/plugin-key.mjs.map +1 -0
  407. package/dist/plugins/seal/registry-publish.d.mts +43 -0
  408. package/dist/plugins/seal/registry-publish.mjs +9 -0
  409. package/dist/plugins/seal/registry-publish.mjs.map +1 -0
  410. package/dist/plugins/seal/routable.mjs +57 -0
  411. package/dist/plugins/seal/routable.mjs.map +1 -0
  412. package/dist/plugins/seal/service.mjs +17 -0
  413. package/dist/plugins/seal/service.mjs.map +1 -0
  414. package/dist/plugins/seal/snapshot.mjs +51 -0
  415. package/dist/plugins/seal/snapshot.mjs.map +1 -0
  416. package/dist/plugins/sui/auto-tick.mjs +45 -0
  417. package/dist/plugins/sui/auto-tick.mjs.map +1 -0
  418. package/dist/plugins/sui/chain-build-container.d.mts +1 -0
  419. package/dist/plugins/sui/chain-probe.d.mts +85 -0
  420. package/dist/plugins/sui/chain-probe.mjs +104 -0
  421. package/dist/plugins/sui/chain-probe.mjs.map +1 -0
  422. package/dist/plugins/sui/codegen.d.mts +14 -0
  423. package/dist/plugins/sui/codegen.mjs +26 -0
  424. package/dist/plugins/sui/codegen.mjs.map +1 -0
  425. package/dist/plugins/sui/errors.d.mts +74 -0
  426. package/dist/plugins/sui/errors.mjs +28 -0
  427. package/dist/plugins/sui/errors.mjs.map +1 -0
  428. package/dist/plugins/sui/fork-orchestration.mjs +24 -0
  429. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -0
  430. package/dist/plugins/sui/fork-transaction.mjs +96 -0
  431. package/dist/plugins/sui/fork-transaction.mjs.map +1 -0
  432. package/dist/plugins/sui/index.d.mts +318 -0
  433. package/dist/plugins/sui/index.mjs +182 -0
  434. package/dist/plugins/sui/index.mjs.map +1 -0
  435. package/dist/plugins/sui/mode/external.mjs +60 -0
  436. package/dist/plugins/sui/mode/external.mjs.map +1 -0
  437. package/dist/plugins/sui/mode/fork.mjs +283 -0
  438. package/dist/plugins/sui/mode/fork.mjs.map +1 -0
  439. package/dist/plugins/sui/mode/live.mjs +103 -0
  440. package/dist/plugins/sui/mode/live.mjs.map +1 -0
  441. package/dist/plugins/sui/mode/local.mjs +293 -0
  442. package/dist/plugins/sui/mode/local.mjs.map +1 -0
  443. package/dist/plugins/sui/mode/shared-boot.mjs +254 -0
  444. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -0
  445. package/dist/plugins/sui/mode/shared.d.mts +103 -0
  446. package/dist/plugins/sui/mode/shared.mjs +12 -0
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -0
  448. package/dist/plugins/sui/mode/spec.d.mts +94 -0
  449. package/dist/plugins/sui/network-resolver.d.mts +23 -0
  450. package/dist/plugins/sui/routable.mjs +88 -0
  451. package/dist/plugins/sui/routable.mjs.map +1 -0
  452. package/dist/plugins/sui/seed-objects.d.mts +18 -0
  453. package/dist/plugins/sui/seed-objects.mjs +25 -0
  454. package/dist/plugins/sui/seed-objects.mjs.map +1 -0
  455. package/dist/plugins/sui/service.mjs +38 -0
  456. package/dist/plugins/sui/service.mjs.map +1 -0
  457. package/dist/plugins/sui/snapshot.mjs +53 -0
  458. package/dist/plugins/sui/snapshot.mjs.map +1 -0
  459. package/dist/plugins/wallet/codegen.d.mts +33 -0
  460. package/dist/plugins/wallet/codegen.mjs +34 -0
  461. package/dist/plugins/wallet/codegen.mjs.map +1 -0
  462. package/dist/plugins/wallet/errors.d.mts +66 -0
  463. package/dist/plugins/wallet/errors.mjs +16 -0
  464. package/dist/plugins/wallet/errors.mjs.map +1 -0
  465. package/dist/plugins/wallet/index.d.mts +63 -0
  466. package/dist/plugins/wallet/index.mjs +126 -0
  467. package/dist/plugins/wallet/index.mjs.map +1 -0
  468. package/dist/plugins/wallet/origin-policy.d.mts +1 -0
  469. package/dist/plugins/wallet/origin-policy.mjs +65 -0
  470. package/dist/plugins/wallet/origin-policy.mjs.map +1 -0
  471. package/dist/plugins/wallet/pairing.d.mts +11 -0
  472. package/dist/plugins/wallet/pairing.mjs +125 -0
  473. package/dist/plugins/wallet/pairing.mjs.map +1 -0
  474. package/dist/plugins/wallet/protocol.d.mts +1 -0
  475. package/dist/plugins/wallet/protocol.mjs +96 -0
  476. package/dist/plugins/wallet/protocol.mjs.map +1 -0
  477. package/dist/plugins/wallet/routable.mjs +32 -0
  478. package/dist/plugins/wallet/routable.mjs.map +1 -0
  479. package/dist/plugins/wallet/server.d.mts +12 -0
  480. package/dist/plugins/wallet/server.mjs +317 -0
  481. package/dist/plugins/wallet/server.mjs.map +1 -0
  482. package/dist/plugins/wallet/service.d.mts +68 -0
  483. package/dist/plugins/wallet/service.mjs +97 -0
  484. package/dist/plugins/wallet/service.mjs.map +1 -0
  485. package/dist/plugins/wallet/snapshot.d.mts +1 -0
  486. package/dist/plugins/wallet/snapshot.mjs +14 -0
  487. package/dist/plugins/wallet/snapshot.mjs.map +1 -0
  488. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +42 -0
  489. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -0
  490. package/dist/plugins/walrus/codegen.d.mts +38 -0
  491. package/dist/plugins/walrus/codegen.mjs +34 -0
  492. package/dist/plugins/walrus/codegen.mjs.map +1 -0
  493. package/dist/plugins/walrus/deploy-paths.mjs +14 -0
  494. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -0
  495. package/dist/plugins/walrus/deploy.d.mts +1 -0
  496. package/dist/plugins/walrus/deploy.mjs +224 -0
  497. package/dist/plugins/walrus/deploy.mjs.map +1 -0
  498. package/dist/plugins/walrus/errors.d.mts +38 -0
  499. package/dist/plugins/walrus/errors.mjs +26 -0
  500. package/dist/plugins/walrus/errors.mjs.map +1 -0
  501. package/dist/plugins/walrus/faucet-strategy.d.mts +12 -0
  502. package/dist/plugins/walrus/faucet-strategy.mjs +62 -0
  503. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -0
  504. package/dist/plugins/walrus/index.d.mts +177 -0
  505. package/dist/plugins/walrus/index.mjs +284 -0
  506. package/dist/plugins/walrus/index.mjs.map +1 -0
  507. package/dist/plugins/walrus/mode/known-deploy.d.mts +25 -0
  508. package/dist/plugins/walrus/mode/known-deploy.mjs +71 -0
  509. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -0
  510. package/dist/plugins/walrus/mode/local-cluster.d.mts +34 -0
  511. package/dist/plugins/walrus/mode/local-cluster.mjs +153 -0
  512. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -0
  513. package/dist/plugins/walrus/plugin-key.mjs +7 -0
  514. package/dist/plugins/walrus/plugin-key.mjs.map +1 -0
  515. package/dist/plugins/walrus/registry-publish.d.mts +24 -0
  516. package/dist/plugins/walrus/registry-publish.mjs +7 -0
  517. package/dist/plugins/walrus/registry-publish.mjs.map +1 -0
  518. package/dist/plugins/walrus/routable.mjs +99 -0
  519. package/dist/plugins/walrus/routable.mjs.map +1 -0
  520. package/dist/plugins/walrus/service.mjs +20 -0
  521. package/dist/plugins/walrus/service.mjs.map +1 -0
  522. package/dist/plugins/walrus/snapshot.mjs +53 -0
  523. package/dist/plugins/walrus/snapshot.mjs.map +1 -0
  524. package/dist/plugins/walrus/storage-nodes.d.mts +15 -0
  525. package/dist/plugins/walrus/storage-nodes.mjs +154 -0
  526. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -0
  527. package/dist/plugins/walrus/wal-swap.d.mts +2 -0
  528. package/dist/plugins/walrus/wal-swap.mjs +58 -0
  529. package/dist/plugins/walrus/wal-swap.mjs.map +1 -0
  530. package/dist/primitives/artifact-publisher.d.mts +12 -0
  531. package/dist/primitives/cache.d.mts +1 -0
  532. package/dist/runtime/built-in-plugin-layers.mjs +49 -0
  533. package/dist/runtime/built-in-plugin-layers.mjs.map +1 -0
  534. package/dist/runtime/docker/client.d.mts +2 -0
  535. package/dist/runtime/docker/client.mjs +54 -0
  536. package/dist/runtime/docker/client.mjs.map +1 -0
  537. package/dist/runtime/docker/container.d.mts +1 -0
  538. package/dist/runtime/docker/container.mjs +562 -0
  539. package/dist/runtime/docker/container.mjs.map +1 -0
  540. package/dist/runtime/docker/errors.d.mts +1 -0
  541. package/dist/runtime/docker/errors.mjs +187 -0
  542. package/dist/runtime/docker/errors.mjs.map +1 -0
  543. package/dist/runtime/docker/exec.d.mts +1 -0
  544. package/dist/runtime/docker/exec.mjs +63 -0
  545. package/dist/runtime/docker/exec.mjs.map +1 -0
  546. package/dist/runtime/docker/image.d.mts +1 -0
  547. package/dist/runtime/docker/image.mjs +278 -0
  548. package/dist/runtime/docker/image.mjs.map +1 -0
  549. package/dist/runtime/docker/index.d.mts +1 -0
  550. package/dist/runtime/docker/inventory.d.mts +1 -0
  551. package/dist/runtime/docker/inventory.mjs +167 -0
  552. package/dist/runtime/docker/inventory.mjs.map +1 -0
  553. package/dist/runtime/docker/labels.d.mts +1 -0
  554. package/dist/runtime/docker/labels.mjs +97 -0
  555. package/dist/runtime/docker/labels.mjs.map +1 -0
  556. package/dist/runtime/docker/logs.d.mts +1 -0
  557. package/dist/runtime/docker/logs.mjs +34 -0
  558. package/dist/runtime/docker/logs.mjs.map +1 -0
  559. package/dist/runtime/docker/network.d.mts +1 -0
  560. package/dist/runtime/docker/network.mjs +168 -0
  561. package/dist/runtime/docker/network.mjs.map +1 -0
  562. package/dist/runtime/docker/service.d.mts +9 -0
  563. package/dist/runtime/docker/service.mjs +266 -0
  564. package/dist/runtime/docker/service.mjs.map +1 -0
  565. package/dist/runtime/docker/sweep.d.mts +1 -0
  566. package/dist/runtime/docker/sweep.mjs +220 -0
  567. package/dist/runtime/docker/sweep.mjs.map +1 -0
  568. package/dist/runtime/docker/volume.d.mts +1 -0
  569. package/dist/runtime/docker/volume.mjs +24 -0
  570. package/dist/runtime/docker/volume.mjs.map +1 -0
  571. package/dist/runtime/docker/wrap.d.mts +1 -0
  572. package/dist/runtime/docker/wrap.mjs +131 -0
  573. package/dist/runtime/docker/wrap.mjs.map +1 -0
  574. package/dist/substrate/brand.d.mts +24 -0
  575. package/dist/substrate/brand.mjs +14 -0
  576. package/dist/substrate/brand.mjs.map +1 -0
  577. package/dist/substrate/cross-process.d.mts +1 -0
  578. package/dist/substrate/cross-process.mjs +28 -0
  579. package/dist/substrate/cross-process.mjs.map +1 -0
  580. package/dist/substrate/events.d.mts +117 -0
  581. package/dist/substrate/identity.d.mts +13 -0
  582. package/dist/substrate/lifecycle.d.mts +12 -0
  583. package/dist/substrate/manifest.d.mts +39 -0
  584. package/dist/substrate/manifest.mjs +33 -0
  585. package/dist/substrate/manifest.mjs.map +1 -0
  586. package/dist/substrate/network.d.mts +34 -0
  587. package/dist/substrate/options.d.mts +23 -0
  588. package/dist/substrate/plugin.d.mts +101 -0
  589. package/dist/substrate/plugin.mjs +61 -0
  590. package/dist/substrate/plugin.mjs.map +1 -0
  591. package/dist/substrate/projection.d.mts +100 -0
  592. package/dist/substrate/runtime/artifact-publisher/index.mjs +76 -0
  593. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -0
  594. package/dist/substrate/runtime/atomic-write.mjs +106 -0
  595. package/dist/substrate/runtime/atomic-write.mjs.map +1 -0
  596. package/dist/substrate/runtime/cache/index.d.mts +1 -0
  597. package/dist/substrate/runtime/cache/schema.d.mts +1 -0
  598. package/dist/substrate/runtime/cache/schema.mjs +22 -0
  599. package/dist/substrate/runtime/cache/schema.mjs.map +1 -0
  600. package/dist/substrate/runtime/cache/service.d.mts +1 -0
  601. package/dist/substrate/runtime/cache/service.mjs +89 -0
  602. package/dist/substrate/runtime/cache/service.mjs.map +1 -0
  603. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -0
  604. package/dist/substrate/runtime/capability-sinks/layer.d.mts +1 -0
  605. package/dist/substrate/runtime/capability-sinks/layer.mjs +31 -0
  606. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +1 -0
  607. package/dist/substrate/runtime/capability-sinks/service.d.mts +36 -0
  608. package/dist/substrate/runtime/capability-sinks/service.mjs +74 -0
  609. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -0
  610. package/dist/substrate/runtime/config-validation.d.mts +38 -0
  611. package/dist/substrate/runtime/config-validation.mjs +137 -0
  612. package/dist/substrate/runtime/config-validation.mjs.map +1 -0
  613. package/dist/substrate/runtime/context-helpers.mjs +32 -0
  614. package/dist/substrate/runtime/context-helpers.mjs.map +1 -0
  615. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +128 -0
  616. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -0
  617. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +136 -0
  618. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -0
  619. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +49 -0
  620. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -0
  621. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +9 -0
  622. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -0
  623. package/dist/substrate/runtime/cross-process/liveness.mjs +119 -0
  624. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -0
  625. package/dist/substrate/runtime/cross-process/roster.mjs +275 -0
  626. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -0
  627. package/dist/substrate/runtime/cross-process/snapshot-reservation.d.mts +1 -0
  628. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +117 -0
  629. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -0
  630. package/dist/substrate/runtime/cross-process/stack-lock.d.mts +1 -0
  631. package/dist/substrate/runtime/cross-process/stack-lock.mjs +142 -0
  632. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -0
  633. package/dist/substrate/runtime/current-plugin.mjs +15 -0
  634. package/dist/substrate/runtime/current-plugin.mjs.map +1 -0
  635. package/dist/substrate/runtime/errors.d.mts +1 -0
  636. package/dist/substrate/runtime/errors.mjs +76 -0
  637. package/dist/substrate/runtime/errors.mjs.map +1 -0
  638. package/dist/substrate/runtime/host-tree-tar/index.mjs +364 -0
  639. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -0
  640. package/dist/substrate/runtime/http-probe.d.mts +35 -0
  641. package/dist/substrate/runtime/http-probe.mjs +65 -0
  642. package/dist/substrate/runtime/http-probe.mjs.map +1 -0
  643. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -0
  644. package/dist/substrate/runtime/lease-broker/service.d.mts +64 -0
  645. package/dist/substrate/runtime/lease-broker/service.mjs +155 -0
  646. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -0
  647. package/dist/substrate/runtime/lifecycle/dep-graph.d.mts +1 -0
  648. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +138 -0
  649. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -0
  650. package/dist/substrate/runtime/lifecycle/index.d.mts +1 -0
  651. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +31 -0
  652. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -0
  653. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -0
  654. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +133 -0
  655. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -0
  656. package/dist/substrate/runtime/lifecycle/ready-gate.d.mts +1 -0
  657. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +34 -0
  658. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -0
  659. package/dist/substrate/runtime/lifecycle/selective-restart.d.mts +1 -0
  660. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +43 -0
  661. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -0
  662. package/dist/substrate/runtime/lifecycle/signals.d.mts +1 -0
  663. package/dist/substrate/runtime/lifecycle/signals.mjs +64 -0
  664. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -0
  665. package/dist/substrate/runtime/lifecycle/state-machine.d.mts +1 -0
  666. package/dist/substrate/runtime/lifecycle/state-machine.mjs +38 -0
  667. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -0
  668. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -0
  669. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +27 -0
  670. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -0
  671. package/dist/substrate/runtime/managed-container.d.mts +30 -0
  672. package/dist/substrate/runtime/managed-container.mjs +32 -0
  673. package/dist/substrate/runtime/managed-container.mjs.map +1 -0
  674. package/dist/substrate/runtime/manifest/manifest.mjs +73 -0
  675. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -0
  676. package/dist/substrate/runtime/mode-errors.d.mts +36 -0
  677. package/dist/substrate/runtime/observability/cascade-formatter.d.mts +1 -0
  678. package/dist/substrate/runtime/observability/cascade-formatter.mjs +135 -0
  679. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -0
  680. package/dist/substrate/runtime/observability/formatter-registry.d.mts +1 -0
  681. package/dist/substrate/runtime/observability/formatter-registry.mjs +65 -0
  682. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -0
  683. package/dist/substrate/runtime/observability/index.d.mts +3 -0
  684. package/dist/substrate/runtime/observability/logger.d.mts +58 -0
  685. package/dist/substrate/runtime/observability/logger.mjs +89 -0
  686. package/dist/substrate/runtime/observability/logger.mjs.map +1 -0
  687. package/dist/substrate/runtime/observability/pretty-error.d.mts +1 -0
  688. package/dist/substrate/runtime/observability/pretty-error.mjs +119 -0
  689. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -0
  690. package/dist/substrate/runtime/observability/process-lines.d.mts +31 -0
  691. package/dist/substrate/runtime/observability/process-lines.mjs +40 -0
  692. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -0
  693. package/dist/substrate/runtime/observability/redaction.d.mts +28 -0
  694. package/dist/substrate/runtime/observability/redaction.mjs +45 -0
  695. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -0
  696. package/dist/substrate/runtime/observability/spans.d.mts +1 -0
  697. package/dist/substrate/runtime/observability/spans.mjs +87 -0
  698. package/dist/substrate/runtime/observability/spans.mjs.map +1 -0
  699. package/dist/substrate/runtime/observability/subprocess-capture.d.mts +2 -0
  700. package/dist/substrate/runtime/observability/subprocess-capture.mjs +82 -0
  701. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -0
  702. package/dist/substrate/runtime/paths.d.mts +17 -0
  703. package/dist/substrate/runtime/paths.mjs +61 -0
  704. package/dist/substrate/runtime/paths.mjs.map +1 -0
  705. package/dist/substrate/runtime/port-broker/index.d.mts +1 -0
  706. package/dist/substrate/runtime/port-broker/service.d.mts +1 -0
  707. package/dist/substrate/runtime/port-broker/service.mjs +319 -0
  708. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -0
  709. package/dist/substrate/runtime/post-acquire-tasks.d.mts +1 -0
  710. package/dist/substrate/runtime/post-acquire-tasks.mjs +34 -0
  711. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -0
  712. package/dist/substrate/runtime/probes.d.mts +51 -0
  713. package/dist/substrate/runtime/probes.mjs +84 -0
  714. package/dist/substrate/runtime/probes.mjs.map +1 -0
  715. package/dist/substrate/runtime/process-supervisor.d.mts +57 -0
  716. package/dist/substrate/runtime/process-supervisor.mjs +73 -0
  717. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -0
  718. package/dist/substrate/runtime/projection/operational-endpoints.mjs +44 -0
  719. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -0
  720. package/dist/substrate/runtime/projection/persisted.mjs +195 -0
  721. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -0
  722. package/dist/substrate/runtime/projection/state-ref.mjs +48 -0
  723. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -0
  724. package/dist/substrate/runtime/projection/update.mjs +200 -0
  725. package/dist/substrate/runtime/projection/update.mjs.map +1 -0
  726. package/dist/substrate/runtime/retry-policy.d.mts +18 -0
  727. package/dist/substrate/runtime/retry-policy.mjs +16 -0
  728. package/dist/substrate/runtime/retry-policy.mjs.map +1 -0
  729. package/dist/substrate/runtime/run.mjs +86 -0
  730. package/dist/substrate/runtime/run.mjs.map +1 -0
  731. package/dist/substrate/runtime/runtime-decode.d.mts +32 -0
  732. package/dist/substrate/runtime/runtime-decode.mjs +53 -0
  733. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -0
  734. package/dist/substrate/runtime/scoped-http-server.mjs +36 -0
  735. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -0
  736. package/dist/substrate/runtime/scoped-ref-map/service.mjs +83 -0
  737. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -0
  738. package/dist/substrate/runtime/stage-and-swap/index.d.mts +1 -0
  739. package/dist/substrate/runtime/stage-and-swap/index.mjs +131 -0
  740. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -0
  741. package/dist/substrate/runtime/state-store/schema.mjs +36 -0
  742. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -0
  743. package/dist/substrate/runtime/strategy-registry/chain-probe-for.d.mts +1 -0
  744. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +22 -0
  745. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -0
  746. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.d.mts +1 -0
  747. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +30 -0
  748. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +1 -0
  749. package/dist/substrate/runtime/strategy-registry/index.d.mts +1 -0
  750. package/dist/substrate/runtime/strategy-registry/service.d.mts +1 -0
  751. package/dist/substrate/runtime/strategy-registry/service.mjs +67 -0
  752. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -0
  753. package/dist/substrate/runtime/sui-execute/index.d.mts +11 -0
  754. package/dist/substrate/runtime/sui-execute/index.mjs +144 -0
  755. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -0
  756. package/dist/substrate/runtime/sui-move-build/index.d.mts +1 -0
  757. package/dist/substrate/runtime/sui-move-build/index.mjs +283 -0
  758. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -0
  759. package/dist/substrate/runtime/supervisor.d.mts +1 -0
  760. package/dist/substrate/runtime/supervisor.mjs +831 -0
  761. package/dist/substrate/runtime/supervisor.mjs.map +1 -0
  762. package/dist/surfaces/cli/command-tree.mjs +276 -0
  763. package/dist/surfaces/cli/command-tree.mjs.map +1 -0
  764. package/dist/surfaces/cli/commands/config.mjs +31 -0
  765. package/dist/surfaces/cli/commands/config.mjs.map +1 -0
  766. package/dist/surfaces/cli/commands/confirm-node.mjs +26 -0
  767. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -0
  768. package/dist/surfaces/cli/commands/confirm.mjs +26 -0
  769. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -0
  770. package/dist/surfaces/cli/commands/doctor-probes.mjs +452 -0
  771. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +1 -0
  772. package/dist/surfaces/cli/commands/doctor.mjs +38 -0
  773. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -0
  774. package/dist/surfaces/cli/commands/prune-picker.mjs +347 -0
  775. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -0
  776. package/dist/surfaces/cli/commands/prune.mjs +178 -0
  777. package/dist/surfaces/cli/commands/prune.mjs.map +1 -0
  778. package/dist/surfaces/cli/commands/snapshot.mjs +141 -0
  779. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -0
  780. package/dist/surfaces/cli/commands/status.mjs +95 -0
  781. package/dist/surfaces/cli/commands/status.mjs.map +1 -0
  782. package/dist/surfaces/cli/commands/supervisor-presence.mjs +33 -0
  783. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -0
  784. package/dist/surfaces/cli/commands/wipe.mjs +28 -0
  785. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -0
  786. package/dist/surfaces/cli/envelope.mjs +43 -0
  787. package/dist/surfaces/cli/envelope.mjs.map +1 -0
  788. package/dist/surfaces/cli/errors.mjs +110 -0
  789. package/dist/surfaces/cli/errors.mjs.map +1 -0
  790. package/dist/surfaces/cli/flags.mjs +56 -0
  791. package/dist/surfaces/cli/flags.mjs.map +1 -0
  792. package/dist/surfaces/cli/index.mjs +418 -0
  793. package/dist/surfaces/cli/index.mjs.map +1 -0
  794. package/dist/surfaces/cli/output.mjs +115 -0
  795. package/dist/surfaces/cli/output.mjs.map +1 -0
  796. package/dist/surfaces/cli/sysexits.mjs +139 -0
  797. package/dist/surfaces/cli/sysexits.mjs.map +1 -0
  798. package/dist/surfaces/tui/app.mjs +104 -0
  799. package/dist/surfaces/tui/app.mjs.map +1 -0
  800. package/dist/surfaces/tui/dashboard.mjs +261 -0
  801. package/dist/surfaces/tui/dashboard.mjs.map +1 -0
  802. package/dist/surfaces/tui/display-derivation.mjs +395 -0
  803. package/dist/surfaces/tui/display-derivation.mjs.map +1 -0
  804. package/dist/surfaces/tui/errors.mjs +11 -0
  805. package/dist/surfaces/tui/errors.mjs.map +1 -0
  806. package/dist/surfaces/tui/event-log.mjs +155 -0
  807. package/dist/surfaces/tui/event-log.mjs.map +1 -0
  808. package/dist/surfaces/tui/heartbeat.mjs +33 -0
  809. package/dist/surfaces/tui/heartbeat.mjs.map +1 -0
  810. package/dist/surfaces/tui/index.mjs +50 -0
  811. package/dist/surfaces/tui/index.mjs.map +1 -0
  812. package/dist/surfaces/tui/input.mjs +104 -0
  813. package/dist/surfaces/tui/input.mjs.map +1 -0
  814. package/dist/surfaces/tui/mode-detect.mjs +32 -0
  815. package/dist/surfaces/tui/mode-detect.mjs.map +1 -0
  816. package/dist/surfaces/tui/mount-ink.mjs +31 -0
  817. package/dist/surfaces/tui/mount-ink.mjs.map +1 -0
  818. package/dist/surfaces/tui/plain-renderer.mjs +170 -0
  819. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -0
  820. package/dist/surfaces/tui/resource-table.mjs +507 -0
  821. package/dist/surfaces/tui/resource-table.mjs.map +1 -0
  822. package/images/_shared/signal-forward.sh +77 -0
  823. package/images/postgres/Dockerfile +32 -0
  824. package/images/seal/Dockerfile +68 -0
  825. package/images/seal/entrypoint.sh +65 -0
  826. package/images/sui/Dockerfile +73 -0
  827. package/images/sui/entrypoint.sh +244 -0
  828. package/images/sui-fork/Dockerfile +53 -0
  829. package/images/sui-fork/entrypoint.sh +51 -0
  830. package/images/walrus/Dockerfile +122 -0
  831. package/images/walrus/deploy-walrus.sh +305 -0
  832. package/images/walrus/run-walrus.sh +53 -0
  833. package/package.json +94 -0
@@ -0,0 +1,31 @@
1
+ //#region src/substrate/runtime/lifecycle/lifecycle-fact.ts
2
+ /** Project a lifecycle-shaped `EngineEvent` into a per-plugin delta.
3
+ * Returns `null` for events that don't carry lifecycle information so
4
+ * the reducer can short-circuit. The substrate stays event-name-blind
5
+ * by routing through this single mapping table. */
6
+ const factFromEvent = (event) => {
7
+ switch (event.tag) {
8
+ case "lifecycle.statusChanged": return {
9
+ pluginKey: event.pluginKey,
10
+ delta: { status: event.to }
11
+ };
12
+ case "lifecycle.phaseSet": return {
13
+ pluginKey: event.pluginKey,
14
+ delta: { phase: event.phase }
15
+ };
16
+ default: return null;
17
+ }
18
+ };
19
+ /** Apply a fact delta to a row. Pure. Fields not in the delta are
20
+ * preserved verbatim — the merge-not-replace shape `LifecycleFact`
21
+ * promises. */
22
+ const applyLifecycleFact = (row, delta) => ({
23
+ ...row,
24
+ ...delta.status !== void 0 ? { status: delta.status } : {},
25
+ ...delta.phase !== void 0 ? { phase: delta.phase } : {},
26
+ ...delta.selectiveRestartHighlight !== void 0 ? { selectiveRestartHighlight: delta.selectiveRestartHighlight } : {}
27
+ });
28
+ //#endregion
29
+ export { applyLifecycleFact, factFromEvent };
30
+
31
+ //# sourceMappingURL=lifecycle-fact.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-fact.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/lifecycle-fact.ts"],"sourcesContent":["// LifecycleFact bridge.\n//\n// `substrate/lifecycle.ts` declares `LifecycleFact` — the merge-not-\n// replace per-plugin lifecycle slice the projection consumes. Until\n// now the projection updater consumed raw `EngineEvent` cases directly\n// and the `LifecycleFact` type was orphan.\n//\n// This module is the typed bridge: it projects an `EngineEvent` into a\n// `LifecycleFact` delta (when the event represents a lifecycle change)\n// and exposes a single applier `applyLifecycleFact(row, fact)` the\n// projection updater calls instead of writing out each\n// status / phase / restart field independently. The reducer for non-\n// lifecycle events is unchanged.\n\nimport type { Row } from '../../projection.ts';\nimport type { LifecycleFact, LifecycleStatus } from '../../lifecycle.ts';\nimport type { EngineEvent } from '../../events.ts';\n\n/** Per-plugin fact delta. Each field is optional — only the fields the\n * source event carries are populated. The projection's `applyLifecycleFact`\n * merges a delta into the existing `Row`. */\nexport interface LifecycleFactDelta {\n\treadonly status?: LifecycleStatus;\n\treadonly phase?: LifecycleFact['phase'];\n\treadonly selectiveRestartHighlight?: boolean;\n}\n\n/** Project a lifecycle-shaped `EngineEvent` into a per-plugin delta.\n * Returns `null` for events that don't carry lifecycle information so\n * the reducer can short-circuit. The substrate stays event-name-blind\n * by routing through this single mapping table. */\nexport const factFromEvent = (\n\tevent: EngineEvent,\n): { readonly pluginKey: string; readonly delta: LifecycleFactDelta } | null => {\n\tswitch (event.tag) {\n\t\tcase 'lifecycle.statusChanged':\n\t\t\treturn {\n\t\t\t\tpluginKey: event.pluginKey,\n\t\t\t\tdelta: { status: event.to },\n\t\t\t};\n\t\tcase 'lifecycle.phaseSet':\n\t\t\treturn {\n\t\t\t\tpluginKey: event.pluginKey,\n\t\t\t\tdelta: { phase: event.phase },\n\t\t\t};\n\t\tdefault:\n\t\t\t// `restart.requested` ALSO updates cycle.phase + clears\n\t\t\t// other rows' highlights — that's a multi-row reducer\n\t\t\t// concern the projection handles directly. We deliberately\n\t\t\t// keep the bridge scoped to the closed `LifecycleFact`\n\t\t\t// shape (status / phase / selectiveRestartHighlight) so\n\t\t\t// callers can derive per-plugin facts without rebuilding\n\t\t\t// the cycle phase too.\n\t\t\treturn null;\n\t}\n};\n\n/** Apply a fact delta to a row. Pure. Fields not in the delta are\n * preserved verbatim — the merge-not-replace shape `LifecycleFact`\n * promises. */\nexport const applyLifecycleFact = (row: Row, delta: LifecycleFactDelta): Row => ({\n\t...row,\n\t...(delta.status !== undefined ? { status: delta.status } : {}),\n\t...(delta.phase !== undefined ? { phase: delta.phase } : {}),\n\t...(delta.selectiveRestartHighlight !== undefined\n\t\t? { selectiveRestartHighlight: delta.selectiveRestartHighlight }\n\t\t: {}),\n});\n\n/** Reconstruct the closed `LifecycleFact` shape from a `Row`. Used by\n * diagnostic surfaces that want the typed fact instead of the wider\n * display Row. */\nexport const factFromRow = (row: Row): LifecycleFact => ({\n\tstatus: row.status,\n\tphase: row.phase,\n\tselectiveRestartHighlight: row.selectiveRestartHighlight,\n});\n"],"mappings":";;;;;AA+BA,MAAa,iBACZ,UAC+E;AAC/E,SAAQ,MAAM,KAAd;EACC,KAAK,0BACJ,QAAO;GACN,WAAW,MAAM;GACjB,OAAO,EAAE,QAAQ,MAAM,IAAI;GAC3B;EACF,KAAK,qBACJ,QAAO;GACN,WAAW,MAAM;GACjB,OAAO,EAAE,OAAO,MAAM,OAAO;GAC7B;EACF,QAQC,QAAO;;;;;;AAOV,MAAa,sBAAsB,KAAU,WAAoC;CAChF,GAAG;CACH,GAAI,MAAM,WAAW,KAAA,IAAY,EAAE,QAAQ,MAAM,QAAQ,GAAG,EAAE;CAC9D,GAAI,MAAM,UAAU,KAAA,IAAY,EAAE,OAAO,MAAM,OAAO,GAAG,EAAE;CAC3D,GAAI,MAAM,8BAA8B,KAAA,IACrC,EAAE,2BAA2B,MAAM,2BAA2B,GAC9D,EAAE;CACL"}
@@ -0,0 +1 @@
1
+ import { Deferred, Effect, Ref, Scope } from "effect";
@@ -0,0 +1,133 @@
1
+ import { assertTransition } from "./state-machine.mjs";
2
+ import { Data, Deferred, Effect, Ref, Scope } from "effect";
3
+ //#region src/substrate/runtime/lifecycle/plugin-registry.ts
4
+ /** Tagged failure: a plugin's `start` rejected. Carries the cause and
5
+ * the failing plugin's key so the cause walker / cascade formatter can
6
+ * attribute it. */
7
+ var PluginAcquireFailed = class extends Data.TaggedError("PluginAcquireFailed") {};
8
+ /** Tagged failure: a downstream plugin tried to read a resolved value
9
+ * whose entry isn't registered or hasn't reached `ready`. Programmer-
10
+ * level error class — the dep-graph guarantees this can't happen on
11
+ * the supervisor's own scheduling path. Surfaced when a plugin author
12
+ * reaches outside their declared dependencies. */
13
+ var UnknownDependency = class extends Data.TaggedError("UnknownDependency") {};
14
+ /** Build a fresh entry for `node`. Caller still owns the entry — the
15
+ * registry below holds a `ReadonlyMap` of these. */
16
+ const makeEntry = (node, parentScope) => Effect.gen(function* () {
17
+ return {
18
+ node,
19
+ statusRef: yield* Ref.make("pending"),
20
+ readyGate: yield* Deferred.make(),
21
+ scope: yield* Scope.fork(parentScope)
22
+ };
23
+ });
24
+ /** Build a registry from a map of entries. The `onTransition` callback
25
+ * is the supervisor's published event sink — every status change
26
+ * flows through here. */
27
+ const makeRegistry = (entries, onTransition) => {
28
+ const mutableEntries = new Map(entries);
29
+ const resolved = /* @__PURE__ */ new Map();
30
+ const getEntry = (key) => {
31
+ const entry = mutableEntries.get(key);
32
+ if (entry === void 0) return Effect.fail(new UnknownDependency({
33
+ pluginKey: key,
34
+ requestedResourceId: ""
35
+ }));
36
+ return Effect.succeed(entry);
37
+ };
38
+ return {
39
+ entries: mutableEntries,
40
+ __resolved: resolved,
41
+ getStatus: (key) => Effect.gen(function* () {
42
+ const entry = yield* getEntry(key);
43
+ return yield* Ref.get(entry.statusRef);
44
+ }),
45
+ transition: (key, to) => Effect.gen(function* () {
46
+ const entry = yield* getEntry(key);
47
+ const from = yield* Ref.get(entry.statusRef);
48
+ yield* assertTransition(from, to);
49
+ yield* Ref.set(entry.statusRef, to);
50
+ yield* onTransition(key, from, to);
51
+ return {
52
+ from,
53
+ to
54
+ };
55
+ }),
56
+ markReady: (key, value) => Effect.gen(function* () {
57
+ const entry = yield* getEntry(key);
58
+ const from = yield* Ref.get(entry.statusRef);
59
+ resolved.set(key, value);
60
+ if (from !== "ready") if (from === "pending") {
61
+ yield* assertTransition(from, "acquiring");
62
+ yield* Ref.set(entry.statusRef, "acquiring");
63
+ yield* onTransition(key, from, "acquiring");
64
+ yield* assertTransition("acquiring", "ready");
65
+ yield* Ref.set(entry.statusRef, "ready");
66
+ yield* onTransition(key, "acquiring", "ready");
67
+ } else {
68
+ yield* assertTransition(from, "ready");
69
+ yield* Ref.set(entry.statusRef, "ready");
70
+ yield* onTransition(key, from, "ready");
71
+ }
72
+ yield* Deferred.succeed(entry.readyGate, value);
73
+ }),
74
+ markFailed: (key, cause) => Effect.gen(function* () {
75
+ const entry = yield* getEntry(key);
76
+ const from = yield* Ref.get(entry.statusRef);
77
+ resolved.delete(key);
78
+ yield* assertTransition(from, "failed");
79
+ yield* Ref.set(entry.statusRef, "failed");
80
+ yield* onTransition(key, from, "failed");
81
+ yield* Deferred.fail(entry.readyGate, new PluginAcquireFailed({
82
+ pluginKey: key,
83
+ cause
84
+ }));
85
+ }),
86
+ resetForRestart: (key, parentScope) => Effect.gen(function* () {
87
+ const entry = yield* getEntry(key);
88
+ resolved.delete(key);
89
+ const readyGate = yield* Deferred.make();
90
+ const scope = yield* Scope.fork(parentScope);
91
+ mutableEntries.set(key, {
92
+ node: entry.node,
93
+ statusRef: entry.statusRef,
94
+ readyGate,
95
+ scope
96
+ });
97
+ }),
98
+ awaitReady: (key) => Effect.gen(function* () {
99
+ const entry = yield* getEntry(key);
100
+ return yield* Deferred.await(entry.readyGate);
101
+ })
102
+ };
103
+ };
104
+ /** Synchronous accessor: snapshot the resolved value for `key`.
105
+ * Returns `undefined` if the plugin isn't ready yet OR isn't
106
+ * registered. The supervisor guarantees readiness before any
107
+ * consumer calls this; it's the ONLY synchronous path. */
108
+ const readResolvedSync = (registry, key) => {
109
+ return registry.__resolved?.get(key);
110
+ };
111
+ /**
112
+ * Build a synchronous dependency reader over the registry for one
113
+ * plugin. The upstream key must already be `ready`; the supervisor
114
+ * ensures this by awaiting upstream ready-gates before invoking start.
115
+ */
116
+ const buildDependencyReaderFor = (registry, node) => {
117
+ const resourceIdToKey = /* @__PURE__ */ new Map();
118
+ node.upstreamResources.forEach((resource, i) => {
119
+ const upstream = node.upstreamKeys[i];
120
+ if (upstream !== void 0) resourceIdToKey.set(resource.id, upstream);
121
+ });
122
+ return (resource) => {
123
+ const key = resourceIdToKey.get(resource.id);
124
+ if (key === void 0) throw new Error(`DependencyReader: resource '${resource.id}' not in this plugin's declared dependencies`);
125
+ const value = readResolvedSync(registry, key);
126
+ if (value === void 0) throw new Error(`DependencyReader: upstream '${key}' has no resolved value yet — supervisor must mark the entry ready before downstream acquire.`);
127
+ return value;
128
+ };
129
+ };
130
+ //#endregion
131
+ export { buildDependencyReaderFor, makeEntry, makeRegistry, readResolvedSync };
132
+
133
+ //# sourceMappingURL=plugin-registry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-registry.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/plugin-registry.ts"],"sourcesContent":["// Per-plugin lifecycle bookkeeping.\n//\n// One `PluginEntry` per node in the resolved dep-graph. The entry\n// holds:\n// - the live `LifecycleStatus` (Ref, single-fiber linearizable),\n// - the resolved value (set when status transitions to `ready`),\n// - the scope owning the plugin's `start` finalizers,\n// - a `Deferred` that downstream consumers await for the ready gate.\n//\n// The registry tracks per-key lifecycle only; projection concerns stay\n// in the supervisor and reducer.\n\nimport { Data, Deferred, Effect, Ref, Scope } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport type { LifecycleStatus } from '../../lifecycle.ts';\nimport type { DepNode } from './dep-graph.ts';\nimport { assertTransition } from './state-machine.ts';\n\n/** Per-registry side channel: synchronously-readable resolved values.\n * Keyed by plugin key. Populated by `markReady`; consulted by the\n * synchronous dependency reader. We can't put the value on the\n * `Deferred` itself in a publicly-supported way, and plugin start\n * receives dependency values synchronously; this is the safe escape hatch.\n *\n * Module-private; only `makeRegistry` writes into the map it\n * allocates. */\ntype ResolvedMap = Map<PluginKey, ResolvedValue>;\n\n// -----------------------------------------------------------------------------\n// Resolved-value shape\n// -----------------------------------------------------------------------------\n\n/** Erased resolved value held in the registry. The supervisor casts\n * back to the concrete type at the boundary where it threads the\n * value into a downstream plugin's resolved dependency object. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ResolvedValue = any;\n\n// -----------------------------------------------------------------------------\n// Per-plugin entry\n// -----------------------------------------------------------------------------\n\n/** Mutable lifecycle state for one plugin instance. */\nexport interface PluginEntry {\n\treadonly node: DepNode;\n\treadonly statusRef: Ref.Ref<LifecycleStatus>;\n\t/** Resolved when the plugin reaches `ready`. Downstream consumers\n\t * await this in the ready-gate. Failure is propagated by interruption\n\t * via `Deferred.fail` to keep the error chain in the cause walker. */\n\treadonly readyGate: Deferred.Deferred<ResolvedValue, PluginAcquireFailed>;\n\t/** Per-plugin Scope. Closing it runs the `start` finalizers. */\n\treadonly scope: Scope.Closeable;\n}\n\n/** Tagged failure: a plugin's `start` rejected. Carries the cause and\n * the failing plugin's key so the cause walker / cascade formatter can\n * attribute it. */\nexport class PluginAcquireFailed extends Data.TaggedError('PluginAcquireFailed')<{\n\treadonly pluginKey: PluginKey;\n\treadonly cause: unknown;\n}> {}\n\n/** Tagged failure: a downstream plugin tried to read a resolved value\n * whose entry isn't registered or hasn't reached `ready`. Programmer-\n * level error class — the dep-graph guarantees this can't happen on\n * the supervisor's own scheduling path. Surfaced when a plugin author\n * reaches outside their declared dependencies. */\nexport class UnknownDependency extends Data.TaggedError('UnknownDependency')<{\n\treadonly pluginKey: PluginKey;\n\treadonly requestedResourceId: string;\n}> {}\n\n// -----------------------------------------------------------------------------\n// Registry\n// -----------------------------------------------------------------------------\n\n/** Build a fresh entry for `node`. Caller still owns the entry — the\n * registry below holds a `ReadonlyMap` of these. */\nexport const makeEntry = (\n\tnode: DepNode,\n\tparentScope: Scope.Scope,\n): Effect.Effect<PluginEntry, never, never> =>\n\tEffect.gen(function* () {\n\t\tconst statusRef = yield* Ref.make<LifecycleStatus>('pending');\n\t\tconst readyGate = yield* Deferred.make<ResolvedValue, PluginAcquireFailed>();\n\t\tconst scope = yield* Scope.fork(parentScope);\n\t\treturn { node, statusRef, readyGate, scope } satisfies PluginEntry;\n\t});\n\n/** The lifecycle registry. Holds one entry per dep-graph node. */\nexport interface PluginRegistry {\n\treadonly entries: ReadonlyMap<PluginKey, PluginEntry>;\n\t/** Read a plugin's current status. */\n\treadonly getStatus: (key: PluginKey) => Effect.Effect<LifecycleStatus, UnknownDependency>;\n\t/** Transition a plugin to a new status. Validates against the\n\t * transition table; emits via `onTransition`. */\n\treadonly transition: (\n\t\tkey: PluginKey,\n\t\tto: LifecycleStatus,\n\t) => Effect.Effect<\n\t\t{ readonly from: LifecycleStatus; readonly to: LifecycleStatus },\n\t\tUnknownDependency\n\t>;\n\t/** Mark a plugin ready with its resolved value. */\n\treadonly markReady: (\n\t\tkey: PluginKey,\n\t\tvalue: ResolvedValue,\n\t) => Effect.Effect<void, UnknownDependency>;\n\t/** Mark a plugin failed. */\n\treadonly markFailed: (key: PluginKey, cause: unknown) => Effect.Effect<void, UnknownDependency>;\n\t/** Prepare a previously torn-down entry for hot restart. Plugin\n\t * scopes and ready gates are single-use: once a scope has been closed,\n\t * any finalizer registered during a later acquire would run\n\t * immediately, and an already-resolved ready gate would leak the old\n\t * value to downstream consumers. */\n\treadonly resetForRestart: (\n\t\tkey: PluginKey,\n\t\tparentScope: Scope.Scope,\n\t) => Effect.Effect<void, UnknownDependency>;\n\t/** Await `ready` for `key`. Suspends until the plugin's `readyGate`\n\t * resolves. The deferred's failure channel propagates a\n\t * `PluginAcquireFailed` so the supervisor's outer error path picks\n\t * it up. */\n\treadonly awaitReady: (\n\t\tkey: PluginKey,\n\t) => Effect.Effect<ResolvedValue, PluginAcquireFailed | UnknownDependency>;\n}\n\n/** Build a registry from a map of entries. The `onTransition` callback\n * is the supervisor's published event sink — every status change\n * flows through here. */\nexport const makeRegistry = (\n\tentries: ReadonlyMap<PluginKey, PluginEntry>,\n\tonTransition: (key: PluginKey, from: LifecycleStatus, to: LifecycleStatus) => Effect.Effect<void>,\n): PluginRegistry => {\n\tconst mutableEntries = new Map(entries);\n\tconst resolved: ResolvedMap = new Map();\n\n\tconst getEntry = (key: PluginKey): Effect.Effect<PluginEntry, UnknownDependency> => {\n\t\tconst entry = mutableEntries.get(key);\n\t\tif (entry === undefined) {\n\t\t\treturn Effect.fail(new UnknownDependency({ pluginKey: key, requestedResourceId: '' }));\n\t\t}\n\t\treturn Effect.succeed(entry);\n\t};\n\n\tconst reg: PluginRegistry & { __resolved: ResolvedMap } = {\n\t\tentries: mutableEntries,\n\t\t__resolved: resolved,\n\t\tgetStatus: (key) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry = yield* getEntry(key);\n\t\t\t\treturn yield* Ref.get(entry.statusRef);\n\t\t\t}),\n\t\ttransition: (key, to) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry = yield* getEntry(key);\n\t\t\t\tconst from = yield* Ref.get(entry.statusRef);\n\t\t\t\tyield* assertTransition(from, to);\n\t\t\t\tyield* Ref.set(entry.statusRef, to);\n\t\t\t\tyield* onTransition(key, from, to);\n\t\t\t\treturn { from, to };\n\t\t\t}),\n\t\tmarkReady: (key, value) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry = yield* getEntry(key);\n\t\t\t\tconst from = yield* Ref.get(entry.statusRef);\n\t\t\t\tresolved.set(key, value);\n\t\t\t\tif (from !== 'ready') {\n\t\t\t\t\t// `pending → ready` is off-table — the state machine\n\t\t\t\t\t// requires the intermediate `acquiring` hop. Bridge it\n\t\t\t\t\t// here so callers reaching `markReady` from a `pending`\n\t\t\t\t\t// entry (test fixtures, callers that mark a synthetic\n\t\t\t\t\t// already-resolved value) don't have to pre-walk the\n\t\t\t\t\t// machine. Both transitions still emit through\n\t\t\t\t\t// `onTransition` so subscribers see the full path.\n\t\t\t\t\tif (from === 'pending') {\n\t\t\t\t\t\tyield* assertTransition(from, 'acquiring');\n\t\t\t\t\t\tyield* Ref.set(entry.statusRef, 'acquiring');\n\t\t\t\t\t\tyield* onTransition(key, from, 'acquiring');\n\t\t\t\t\t\tyield* assertTransition('acquiring', 'ready');\n\t\t\t\t\t\tyield* Ref.set(entry.statusRef, 'ready');\n\t\t\t\t\t\tyield* onTransition(key, 'acquiring', 'ready');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tyield* assertTransition(from, 'ready');\n\t\t\t\t\t\tyield* Ref.set(entry.statusRef, 'ready');\n\t\t\t\t\t\tyield* onTransition(key, from, 'ready');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tyield* Deferred.succeed(entry.readyGate, value);\n\t\t\t}),\n\t\tmarkFailed: (key, cause) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry = yield* getEntry(key);\n\t\t\t\tconst from = yield* Ref.get(entry.statusRef);\n\t\t\t\tresolved.delete(key);\n\t\t\t\tyield* assertTransition(from, 'failed');\n\t\t\t\tyield* Ref.set(entry.statusRef, 'failed');\n\t\t\t\tyield* onTransition(key, from, 'failed');\n\t\t\t\tyield* Deferred.fail(entry.readyGate, new PluginAcquireFailed({ pluginKey: key, cause }));\n\t\t\t}),\n\t\tresetForRestart: (key, parentScope) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry = yield* getEntry(key);\n\t\t\t\tresolved.delete(key);\n\t\t\t\tconst readyGate = yield* Deferred.make<ResolvedValue, PluginAcquireFailed>();\n\t\t\t\tconst scope = yield* Scope.fork(parentScope);\n\t\t\t\tmutableEntries.set(key, {\n\t\t\t\t\tnode: entry.node,\n\t\t\t\t\tstatusRef: entry.statusRef,\n\t\t\t\t\treadyGate,\n\t\t\t\t\tscope,\n\t\t\t\t});\n\t\t\t}),\n\t\tawaitReady: (key) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst entry = yield* getEntry(key);\n\t\t\t\treturn yield* Deferred.await(entry.readyGate);\n\t\t\t}),\n\t};\n\treturn reg;\n};\n\n/** Synchronous accessor: snapshot the resolved value for `key`.\n * Returns `undefined` if the plugin isn't ready yet OR isn't\n * registered. The supervisor guarantees readiness before any\n * consumer calls this; it's the ONLY synchronous path. */\nexport const readResolvedSync = (\n\tregistry: PluginRegistry,\n\tkey: PluginKey,\n): ResolvedValue | undefined => {\n\tconst resolved = (registry as PluginRegistry & { __resolved?: ResolvedMap }).__resolved;\n\treturn resolved?.get(key);\n};\n\n// -----------------------------------------------------------------------------\n// Dependency reader over the registry\n// -----------------------------------------------------------------------------\n\n/**\n * Build a synchronous dependency reader over the registry for one\n * plugin. The upstream key must already be `ready`; the supervisor\n * ensures this by awaiting upstream ready-gates before invoking start.\n */\nexport const buildDependencyReaderFor = (\n\tregistry: PluginRegistry,\n\tnode: DepNode,\n): ((resource: { readonly id: string }) => unknown) => {\n\t// Pre-build a resource-id → upstream-key index for this node so the\n\t// lookups are O(1) instead of scanning dependencies.\n\tconst resourceIdToKey = new Map<string, PluginKey>();\n\tnode.upstreamResources.forEach((resource, i) => {\n\t\tconst upstream = node.upstreamKeys[i];\n\t\tif (upstream !== undefined) resourceIdToKey.set(resource.id, upstream);\n\t});\n\treturn (resource): unknown => {\n\t\tconst key = resourceIdToKey.get(resource.id);\n\t\tif (key === undefined) {\n\t\t\t// Programmer error: the plugin reached outside its declared\n\t\t\t// dependencies. The type system normally rules this out — defending\n\t\t\t// here keeps the runtime honest in the face of cast escapes.\n\t\t\tthrow new Error(\n\t\t\t\t`DependencyReader: resource '${resource.id}' not in this plugin's declared dependencies`,\n\t\t\t);\n\t\t}\n\t\tconst value = readResolvedSync(registry, key);\n\t\tif (value === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t`DependencyReader: upstream '${key}' has no resolved value yet — ` +\n\t\t\t\t\t'supervisor must mark the entry ready before downstream acquire.',\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t};\n};\n"],"mappings":";;;;;;AA0DA,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAG7E;;;;;;AAOH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAGzE;;;AAQH,MAAa,aACZ,MACA,gBAEA,OAAO,IAAI,aAAa;AAIvB,QAAO;EAAE;EAAM,WAAA,OAHU,IAAI,KAAsB,UAAU;EAGnC,WAAA,OAFD,SAAS,MAA0C;EAEvC,OAAA,OADhB,MAAM,KAAK,YAAY;EACA;EAC3C;;;;AA4CH,MAAa,gBACZ,SACA,iBACoB;CACpB,MAAM,iBAAiB,IAAI,IAAI,QAAQ;CACvC,MAAM,2BAAwB,IAAI,KAAK;CAEvC,MAAM,YAAY,QAAkE;EACnF,MAAM,QAAQ,eAAe,IAAI,IAAI;AACrC,MAAI,UAAU,KAAA,EACb,QAAO,OAAO,KAAK,IAAI,kBAAkB;GAAE,WAAW;GAAK,qBAAqB;GAAI,CAAC,CAAC;AAEvF,SAAO,OAAO,QAAQ,MAAM;;AA6E7B,QAAO;EAzEN,SAAS;EACT,YAAY;EACZ,YAAY,QACX,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,SAAS,IAAI;AAClC,UAAO,OAAO,IAAI,IAAI,MAAM,UAAU;IACrC;EACH,aAAa,KAAK,OACjB,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,SAAS,IAAI;GAClC,MAAM,OAAO,OAAO,IAAI,IAAI,MAAM,UAAU;AAC5C,UAAO,iBAAiB,MAAM,GAAG;AACjC,UAAO,IAAI,IAAI,MAAM,WAAW,GAAG;AACnC,UAAO,aAAa,KAAK,MAAM,GAAG;AAClC,UAAO;IAAE;IAAM;IAAI;IAClB;EACH,YAAY,KAAK,UAChB,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,SAAS,IAAI;GAClC,MAAM,OAAO,OAAO,IAAI,IAAI,MAAM,UAAU;AAC5C,YAAS,IAAI,KAAK,MAAM;AACxB,OAAI,SAAS,QAQZ,KAAI,SAAS,WAAW;AACvB,WAAO,iBAAiB,MAAM,YAAY;AAC1C,WAAO,IAAI,IAAI,MAAM,WAAW,YAAY;AAC5C,WAAO,aAAa,KAAK,MAAM,YAAY;AAC3C,WAAO,iBAAiB,aAAa,QAAQ;AAC7C,WAAO,IAAI,IAAI,MAAM,WAAW,QAAQ;AACxC,WAAO,aAAa,KAAK,aAAa,QAAQ;UACxC;AACN,WAAO,iBAAiB,MAAM,QAAQ;AACtC,WAAO,IAAI,IAAI,MAAM,WAAW,QAAQ;AACxC,WAAO,aAAa,KAAK,MAAM,QAAQ;;AAGzC,UAAO,SAAS,QAAQ,MAAM,WAAW,MAAM;IAC9C;EACH,aAAa,KAAK,UACjB,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,SAAS,IAAI;GAClC,MAAM,OAAO,OAAO,IAAI,IAAI,MAAM,UAAU;AAC5C,YAAS,OAAO,IAAI;AACpB,UAAO,iBAAiB,MAAM,SAAS;AACvC,UAAO,IAAI,IAAI,MAAM,WAAW,SAAS;AACzC,UAAO,aAAa,KAAK,MAAM,SAAS;AACxC,UAAO,SAAS,KAAK,MAAM,WAAW,IAAI,oBAAoB;IAAE,WAAW;IAAK;IAAO,CAAC,CAAC;IACxF;EACH,kBAAkB,KAAK,gBACtB,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,SAAS,IAAI;AAClC,YAAS,OAAO,IAAI;GACpB,MAAM,YAAY,OAAO,SAAS,MAA0C;GAC5E,MAAM,QAAQ,OAAO,MAAM,KAAK,YAAY;AAC5C,kBAAe,IAAI,KAAK;IACvB,MAAM,MAAM;IACZ,WAAW,MAAM;IACjB;IACA;IACA,CAAC;IACD;EACH,aAAa,QACZ,OAAO,IAAI,aAAa;GACvB,MAAM,QAAQ,OAAO,SAAS,IAAI;AAClC,UAAO,OAAO,SAAS,MAAM,MAAM,UAAU;IAC5C;EAEM;;;;;;AAOX,MAAa,oBACZ,UACA,QAC+B;AAE/B,QADkB,SAA2D,YAC5D,IAAI,IAAI;;;;;;;AAY1B,MAAa,4BACZ,UACA,SACsD;CAGtD,MAAM,kCAAkB,IAAI,KAAwB;AACpD,MAAK,kBAAkB,SAAS,UAAU,MAAM;EAC/C,MAAM,WAAW,KAAK,aAAa;AACnC,MAAI,aAAa,KAAA,EAAW,iBAAgB,IAAI,SAAS,IAAI,SAAS;GACrE;AACF,SAAQ,aAAsB;EAC7B,MAAM,MAAM,gBAAgB,IAAI,SAAS,GAAG;AAC5C,MAAI,QAAQ,KAAA,EAIX,OAAM,IAAI,MACT,+BAA+B,SAAS,GAAG,8CAC3C;EAEF,MAAM,QAAQ,iBAAiB,UAAU,IAAI;AAC7C,MAAI,UAAU,KAAA,EACb,OAAM,IAAI,MACT,+BAA+B,IAAI,+FAEnC;AAEF,SAAO"}
@@ -0,0 +1 @@
1
+ import { Effect } from "effect";
@@ -0,0 +1,34 @@
1
+ import { Effect } from "effect";
2
+ //#region src/substrate/runtime/lifecycle/ready-gate.ts
3
+ /**
4
+ * Wait for every upstream of `node` to reach `ready`. Returns when
5
+ * they all have; short-circuits on the first upstream failure (the
6
+ * failed deferred propagates `PluginAcquireFailed`).
7
+ *
8
+ * Architecture § Scheduling: "When all upstream keys are `ready`,
9
+ * the node begins `acquiring`."
10
+ */
11
+ const awaitUpstreams = (registry, node) => Effect.gen(function* () {
12
+ yield* Effect.annotateCurrentSpan({
13
+ "devstack.plugin.key": node.key,
14
+ "devstack.plugin.upstreamCount": node.upstreamKeys.length
15
+ });
16
+ if (node.upstreamKeys.length === 0) return;
17
+ yield* Effect.all(node.upstreamKeys.map((key) => registry.awaitReady(key)), {
18
+ concurrency: "unbounded",
19
+ discard: true
20
+ });
21
+ }).pipe(Effect.withSpan("lifecycle.ready-gate.awaitUpstreams"));
22
+ /**
23
+ * Wait for every plugin in `keys` to reach `ready`. Used by the
24
+ * supervisor's "stack is ready" gate after the level-batched parallel
25
+ * acquire completes.
26
+ */
27
+ const awaitAll = (registry, keys) => Effect.all(keys.map((key) => registry.awaitReady(key)), {
28
+ concurrency: "unbounded",
29
+ discard: true
30
+ }).pipe(Effect.withSpan("lifecycle.ready-gate.awaitAll"));
31
+ //#endregion
32
+ export { awaitAll, awaitUpstreams };
33
+
34
+ //# sourceMappingURL=ready-gate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ready-gate.mjs","names":[],"sources":["../../../../src/substrate/runtime/lifecycle/ready-gate.ts"],"sourcesContent":["// Ready-gate composition over `PluginRegistry`.\n//\n// Architecture § Plugin lifecycle within a stack § Ready gate:\n// \"Plugin's acquire procedure returns the resolved value + capability\n// decls. Substrate writes them to the typed registries. Plugin\n// transitions to `ready`. Downstream consumers are unblocked.\"\n//\n// This module provides the small `awaitAllReady` / `awaitUpstreams`\n// helpers the supervisor's acquire loop calls. The actual `Deferred`\n// machinery lives on `PluginRegistry`; here we just compose them with\n// span instrumentation and short-circuit on the first upstream\n// failure.\n\nimport { Effect } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport type { DepNode } from './dep-graph.ts';\nimport type { PluginAcquireFailed, PluginRegistry, UnknownDependency } from './plugin-registry.ts';\n\n/**\n * Wait for every upstream of `node` to reach `ready`. Returns when\n * they all have; short-circuits on the first upstream failure (the\n * failed deferred propagates `PluginAcquireFailed`).\n *\n * Architecture § Scheduling: \"When all upstream keys are `ready`,\n * the node begins `acquiring`.\"\n */\nexport const awaitUpstreams = (\n\tregistry: PluginRegistry,\n\tnode: DepNode,\n): Effect.Effect<void, PluginAcquireFailed | UnknownDependency> =>\n\tEffect.gen(function* () {\n\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t'devstack.plugin.key': node.key,\n\t\t\t'devstack.plugin.upstreamCount': node.upstreamKeys.length,\n\t\t});\n\t\tif (node.upstreamKeys.length === 0) return;\n\t\t// Parallelize the awaits — every upstream's ready-gate resolves\n\t\t// once (or fails once); racing them is the right shape.\n\t\tyield* Effect.all(\n\t\t\tnode.upstreamKeys.map((key) => registry.awaitReady(key)),\n\t\t\t{ concurrency: 'unbounded', discard: true },\n\t\t);\n\t}).pipe(Effect.withSpan('lifecycle.ready-gate.awaitUpstreams'));\n\n/**\n * Wait for every plugin in `keys` to reach `ready`. Used by the\n * supervisor's \"stack is ready\" gate after the level-batched parallel\n * acquire completes.\n */\nexport const awaitAll = (\n\tregistry: PluginRegistry,\n\tkeys: ReadonlyArray<PluginKey>,\n): Effect.Effect<void, PluginAcquireFailed | UnknownDependency> =>\n\tEffect.all(\n\t\tkeys.map((key) => registry.awaitReady(key)),\n\t\t{ concurrency: 'unbounded', discard: true },\n\t).pipe(Effect.withSpan('lifecycle.ready-gate.awaitAll'));\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,kBACZ,UACA,SAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB;EACjC,uBAAuB,KAAK;EAC5B,iCAAiC,KAAK,aAAa;EACnD,CAAC;AACF,KAAI,KAAK,aAAa,WAAW,EAAG;AAGpC,QAAO,OAAO,IACb,KAAK,aAAa,KAAK,QAAQ,SAAS,WAAW,IAAI,CAAC,EACxD;EAAE,aAAa;EAAa,SAAS;EAAM,CAC3C;EACA,CAAC,KAAK,OAAO,SAAS,sCAAsC,CAAC;;;;;;AAOhE,MAAa,YACZ,UACA,SAEA,OAAO,IACN,KAAK,KAAK,QAAQ,SAAS,WAAW,IAAI,CAAC,EAC3C;CAAE,aAAa;CAAa,SAAS;CAAM,CAC3C,CAAC,KAAK,OAAO,SAAS,gCAAgC,CAAC"}
@@ -0,0 +1 @@
1
+ import { Effect } from "effect";
@@ -0,0 +1,43 @@
1
+ import { downstreamClosure, orderByLevel } from "./dep-graph.mjs";
2
+ import { Data, Effect } from "effect";
3
+ //#region src/substrate/runtime/lifecycle/selective-restart.ts
4
+ /** Tagged error: a restart was requested for a key that isn't in the
5
+ * graph. The supervisor lifts this from `attribute()` callers that
6
+ * somehow produced a stale key — defensive. */
7
+ var RestartTargetMissing = class extends Data.TaggedError("RestartTargetMissing") {};
8
+ /**
9
+ * Build a restart plan from a set of root invalidation targets. Each
10
+ * root contributes its full downstream closure to the slice.
11
+ */
12
+ const planRestart = (graph, roots) => Effect.gen(function* () {
13
+ yield* Effect.annotateCurrentSpan({ "devstack.restart.rootCount": roots.size });
14
+ for (const root of roots) if (!graph.nodes.has(root)) return yield* Effect.fail(new RestartTargetMissing({ pluginKey: root }));
15
+ const slice = /* @__PURE__ */ new Set();
16
+ for (const root of roots) for (const key of downstreamClosure(graph, root)) slice.add(key);
17
+ return {
18
+ slice,
19
+ teardownOrder: orderByLevel(graph, slice, "reverse"),
20
+ acquireOrder: orderByLevel(graph, slice, "forward")
21
+ };
22
+ }).pipe(Effect.withSpan("lifecycle.selective-restart.plan"));
23
+ /**
24
+ * Drain plan — for `stack.stop` and graceful shutdown. All keys in
25
+ * dep-graph order, reverse. Architecture § Stack lifecycle:
26
+ * "shutdown.requested → parallel teardown (max grace, not sum grace)"
27
+ *
28
+ * The "parallel within a level" semantics live in the supervisor's
29
+ * execution loop; this planner just produces the level batches in
30
+ * reverse.
31
+ */
32
+ const planFullDrain = (graph) => {
33
+ const slice = new Set(graph.nodes.keys());
34
+ return {
35
+ slice,
36
+ teardownOrder: orderByLevel(graph, slice, "reverse"),
37
+ acquireOrder: orderByLevel(graph, slice, "forward")
38
+ };
39
+ };
40
+ //#endregion
41
+ export { planFullDrain, planRestart };
42
+
43
+ //# sourceMappingURL=selective-restart.mjs.map
@@ -0,0 +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"}
@@ -0,0 +1 @@
1
+ import { Effect, Queue, Scope } from "effect";
@@ -0,0 +1,64 @@
1
+ import { Effect, Queue } from "effect";
2
+ //#region src/substrate/runtime/lifecycle/signals.ts
3
+ /** Signals the supervisor handles. SIGHUP intentionally omitted —
4
+ * reconfigure is a command-channel concern, not a signal one. */
5
+ const HANDLED_SIGNALS = ["SIGINT", "SIGTERM"];
6
+ /** Map a signal to the exit code POSIX clients expect — 128 + N. */
7
+ const exitCodeForSignal = (signal) => {
8
+ switch (signal) {
9
+ case "SIGINT": return 130;
10
+ case "SIGTERM": return 143;
11
+ }
12
+ };
13
+ const scheduleProcessExit = (exitCode) => {
14
+ setImmediate(() => {
15
+ process.exit(exitCode);
16
+ });
17
+ };
18
+ /**
19
+ * Install signal handlers that publish `shutdown.requested` (first
20
+ * signal) and `shutdown.hardKillRequested` before scheduling process
21
+ * exit (second handled signal).
22
+ *
23
+ * Returns an Effect that runs forever in its Scope; the supervisor
24
+ * forks it via `Effect.forkScoped`. Scope close unregisters the
25
+ * listeners — Node's `process` listeners persist past the scope
26
+ * otherwise, leading to "ghost" handlers from prior test boots.
27
+ */
28
+ const installSignalHandler = (commands, options = {}) => Effect.gen(function* () {
29
+ const scheduleExit = options.scheduleExit ?? scheduleProcessExit;
30
+ let shutdownRequested = false;
31
+ const handlers = [];
32
+ for (const signal of HANDLED_SIGNALS) {
33
+ const listener = () => {
34
+ const exitCode = exitCodeForSignal(signal);
35
+ if (shutdownRequested) {
36
+ const offerEffect = Queue.offer(commands, {
37
+ tag: "shutdown.hardKillRequested",
38
+ signal,
39
+ exitCode,
40
+ at: Date.now()
41
+ }).pipe(Effect.andThen(Effect.sync(() => scheduleExit(exitCode))));
42
+ Effect.runFork(offerEffect);
43
+ return;
44
+ }
45
+ shutdownRequested = true;
46
+ process.exitCode ??= exitCode;
47
+ const offerEffect = Queue.offer(commands, { tag: "shutdown.requested" });
48
+ Effect.runFork(offerEffect);
49
+ };
50
+ process.on(signal, listener);
51
+ handlers.push({
52
+ signal,
53
+ listener
54
+ });
55
+ }
56
+ yield* Effect.addFinalizer(() => Effect.sync(() => {
57
+ for (const { signal, listener } of handlers) process.removeListener(signal, listener);
58
+ }));
59
+ return yield* Effect.never;
60
+ }).pipe(Effect.withSpan("lifecycle.signals.installSignalHandler"));
61
+ //#endregion
62
+ export { installSignalHandler };
63
+
64
+ //# sourceMappingURL=signals.mjs.map
@@ -0,0 +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\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\tEffect.runFork(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// process's default runtime. `runFork` returns a fiber but we\n\t\t\t\t// don't track it — the queue is bounded by the supervisor's\n\t\t\t\t// lifetime.\n\t\t\t\tEffect.runFork(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;CAC7C,IAAI,oBAAoB;CAExB,MAAM,WAGD,EAAE;AAEP,MAAK,MAAM,UAAU,iBAAiB;EACrC,MAAM,iBAAyC;GAC9C,MAAM,WAAW,kBAAkB,OAAO;AAC1C,OAAI,mBAAmB;IACtB,MAAM,cAAc,MAAM,MAAM,UAAU;KACzC,KAAK;KACL;KACA;KACA,IAAI,KAAK,KAAK;KACd,CAAyB,CAAC,KAC1B,OAAO,QAAQ,OAAO,WAAW,aAAa,SAAS,CAAC,CAAC,CACzD;AACD,WAAO,QAAQ,YAAY;AAC3B;;AAED,uBAAoB;AACpB,WAAQ,aAAa;GAIrB,MAAM,cAAc,MAAM,MAAM,UAAU,EACzC,KAAK,sBACL,CAAyB;AAK1B,UAAO,QAAQ,YAAY;;AAE5B,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"}
@@ -0,0 +1 @@
1
+ import { Effect } from "effect";
@@ -0,0 +1,38 @@
1
+ import { Data, Effect } from "effect";
2
+ //#region src/substrate/runtime/lifecycle/state-machine.ts
3
+ /** Off-table transition — programmer error. Surfaced as a defect via
4
+ * `Effect.die` so the renderer / cause walker sees the impossible
5
+ * transition rather than silently corrupting the projection. */
6
+ var InvalidLifecycleTransition = class extends Data.TaggedError("InvalidLifecycleTransition") {};
7
+ /** Canonical transition table — mirrors the type-level
8
+ * `LifecycleTransition` from `substrate/lifecycle.ts` exactly. Adding
9
+ * a transition requires updating BOTH (the type-level union AND this
10
+ * table). */
11
+ const ALLOWED = new Map([
12
+ ["pending", new Set(["acquiring", "failed"])],
13
+ ["acquiring", new Set(["ready", "failed"])],
14
+ ["ready", new Set([
15
+ "stopping",
16
+ "failed",
17
+ "done"
18
+ ])],
19
+ ["stopping", new Set(["stopped", "failed"])],
20
+ ["failed", new Set(["pending"])],
21
+ ["stopped", new Set(["pending"])],
22
+ ["done", new Set(["pending", "failed"])]
23
+ ]);
24
+ /** Returns true iff `from → to` is on the allowed-transition table. */
25
+ const isAllowedTransition = (from, to) => ALLOWED.get(from)?.has(to) ?? false;
26
+ /** Effect-flavored transition assertion. Returns the new status on
27
+ * success; dies with `InvalidLifecycleTransition` otherwise. */
28
+ const assertTransition = (from, to) => isAllowedTransition(from, to) ? Effect.succeed(to) : Effect.die(new InvalidLifecycleTransition({
29
+ from,
30
+ to
31
+ }));
32
+ /** Statuses that count toward "stack is ready" — every plugin must be
33
+ * in one of these for the stack to surface `running`. */
34
+ const isReadyOrTerminal = (status) => status === "ready" || status === "done";
35
+ //#endregion
36
+ export { assertTransition, isReadyOrTerminal };
37
+
38
+ //# sourceMappingURL=state-machine.mjs.map
@@ -0,0 +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"}
@@ -0,0 +1 @@
1
+ import { Effect } from "effect";
@@ -0,0 +1,27 @@
1
+ import "effect";
2
+ //#region src/substrate/runtime/lifecycle/watch-attribution.ts
3
+ /** Build the watch index from a resolved dep-graph's nodes. */
4
+ const buildWatchIndex = (nodes) => {
5
+ const out = [];
6
+ for (const [key, node] of nodes) {
7
+ const watch = node.member.watch;
8
+ if (watch === void 0 || watch.paths.length === 0) continue;
9
+ out.push({
10
+ pluginKey: key,
11
+ paths: watch.paths,
12
+ cascade: watch.cascade ?? true
13
+ });
14
+ }
15
+ return out;
16
+ };
17
+ /**
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.
22
+ */
23
+ const exactPrefixMatch = (pattern, path) => path === pattern || path.startsWith(pattern.replace(/\*+$/, ""));
24
+ //#endregion
25
+ export { buildWatchIndex, exactPrefixMatch };
26
+
27
+ //# sourceMappingURL=watch-attribution.mjs.map
@@ -0,0 +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 wrapper — span-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"}
@@ -0,0 +1,30 @@
1
+ import { ContainerLabelTuple } from "../../contracts/snapshotable.mjs";
2
+ import { ContainerHandle, ContainerRuntime, ContainerRuntimeError, EnsureContainerSpec } from "../../contracts/container-runtime.mjs";
3
+ import { Effect, Scope } from "effect";
4
+
5
+ //#region src/substrate/runtime/managed-container.d.ts
6
+ declare namespace managed_container_d_exports {
7
+ export { EnsureManagedContainerOptions, ManagedContainerIdentity, ManagedContainerLabelOptions, ensureManagedContainer, managedContainerLabels };
8
+ }
9
+ interface ManagedContainerIdentity {
10
+ readonly app: string;
11
+ readonly stack: string;
12
+ }
13
+ interface ManagedContainerLabelOptions {
14
+ readonly identity: ManagedContainerIdentity;
15
+ readonly plugin: string;
16
+ readonly role: string;
17
+ }
18
+ declare const managedContainerLabels: (options: ManagedContainerLabelOptions) => ContainerLabelTuple;
19
+ type ManagedContainerLabelInput = {
20
+ readonly labels: ContainerLabelTuple;
21
+ } | ManagedContainerLabelOptions;
22
+ type EnsureManagedContainerOptions<E> = ManagedContainerLabelInput & {
23
+ readonly runtime: ContainerRuntime;
24
+ readonly spec: Omit<EnsureContainerSpec, 'labels'>;
25
+ readonly mapError: (cause: ContainerRuntimeError) => E;
26
+ };
27
+ declare const ensureManagedContainer: <E>(options: EnsureManagedContainerOptions<E>) => Effect.Effect<ContainerHandle, E, Scope.Scope>;
28
+ //#endregion
29
+ export { managed_container_d_exports };
30
+ //# sourceMappingURL=managed-container.d.mts.map
@@ -0,0 +1,32 @@
1
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
2
+ import { SpanAttr } from "./observability/spans.mjs";
3
+ import { Effect } from "effect";
4
+ //#region src/substrate/runtime/managed-container.ts
5
+ var managed_container_exports = /* @__PURE__ */ __exportAll({
6
+ ensureManagedContainer: () => ensureManagedContainer,
7
+ managedContainerLabels: () => managedContainerLabels
8
+ });
9
+ const managedContainerLabels = (options) => ({
10
+ app: options.identity.app,
11
+ stack: options.identity.stack,
12
+ plugin: options.plugin,
13
+ role: options.role
14
+ });
15
+ const labelsFrom = (input) => "labels" in input ? input.labels : managedContainerLabels(input);
16
+ const ensureManagedContainer = (options) => {
17
+ const labels = labelsFrom(options);
18
+ return options.runtime.ensureContainer({
19
+ ...options.spec,
20
+ labels
21
+ }).pipe(Effect.mapError(options.mapError), Effect.withSpan("substrate.managedContainer.ensure", { attributes: {
22
+ [SpanAttr.app]: labels.app,
23
+ [SpanAttr.stack]: labels.stack,
24
+ [SpanAttr.plugin]: labels.plugin,
25
+ [SpanAttr.containerRole]: labels.role,
26
+ [SpanAttr.containerName]: options.spec.name
27
+ } }));
28
+ };
29
+ //#endregion
30
+ export { ensureManagedContainer, managed_container_exports };
31
+
32
+ //# sourceMappingURL=managed-container.mjs.map
@@ -0,0 +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\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":";;;;;;;;AAsBA,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"}