@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,30 @@
1
+ import { defineScopedRefMap } from "../../substrate/runtime/scoped-ref-map/service.mjs";
2
+ import { Context, Effect, Layer } from "effect";
3
+ //#region src/plugins/package/registry.ts
4
+ const PackageRefMap = defineScopedRefMap("PackageRegistry");
5
+ const wrapRefMap = (refMap) => ({
6
+ set: refMap.set,
7
+ find: refMap.find,
8
+ has: refMap.has,
9
+ entries: refMap.entries,
10
+ changes: refMap.changes
11
+ });
12
+ /** Context.Service tag for the per-stack `PackageRegistry`. Plugins
13
+ * yield this in their acquire body. */
14
+ var PackageRegistryService = class extends Context.Service()("@devstack-rewrite/plugins/package/PackageRegistry") {};
15
+ /** Scope-bound Layer materializing one `PackageRegistry` per stack
16
+ * scope. Boot wiring (CLI / e2e) provides this once per stack;
17
+ * every package/coin/wallet/faucet plugin in the stack yields the
18
+ * SAME instance via Context. */
19
+ const layerPackageRegistry = Layer.effect(PackageRegistryService, Effect.gen(function* () {
20
+ const refMap = yield* PackageRefMap.Service;
21
+ return PackageRegistryService.of(wrapRefMap(refMap));
22
+ })).pipe(Layer.provide(PackageRefMap.layer));
23
+ /** Capability-key constant for the per-stack registry — siblings
24
+ * (Coin, Action, manifest emitter, faucet strategies) look it up
25
+ * through the StrategyContributor registry. */
26
+ const PACKAGE_REGISTRY_CAPABILITY_KEY = "package-registry";
27
+ //#endregion
28
+ export { PACKAGE_REGISTRY_CAPABILITY_KEY, PackageRegistryService, layerPackageRegistry };
29
+
30
+ //# sourceMappingURL=registry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.mjs","names":[],"sources":["../../../src/plugins/package/registry.ts"],"sourcesContent":["// Per-stack PackageRegistry — owned by the L2 Package plugin.\n//\n// Architecture (ARCHITECTURE.md § Substrate name-blindness): the\n// substrate exposes ONLY the generic `defineScopedRefMap<K, V>` factory;\n// the package-domain shape (`ResolvedLocalPackage` / `ResolvedKnownPackage`)\n// lives here at L2 where it belongs. Two `localPackage(...)` calls in\n// the same stack see the same Service instance (one per stack scope),\n// so cross-plugin lookups stay consistent and warm-restart verify can\n// use the previously-resolved `packageId` as a hint.\n//\n// Wrapper-service pattern (STYLE_GUIDE §6 / \"L2 wrapper-service around\n// defineScopedRefMap\"): the module-private inner `PackageRefMap` is the\n// raw substrate primitive; the publicly-exported `PackageRegistryService`\n// is the L2 wrapper that the rest of the plugin (and external siblings)\n// yield. Today the wrapper only re-exposes the four substrate ops\n// (`set` / `find` / `has` / `entries` + `changes`), but the shape\n// matches Coin's wrapper so future plugin-specific lookups (e.g.\n// `byPublisher`, `byPackageId`) land in one place instead of every\n// consumer reaching into the raw map.\n\nimport { Context, Effect, Layer, type Stream } from 'effect';\n\nimport {\n\tdefineScopedRefMap,\n\ttype ScopedRefMap,\n} from '../../substrate/runtime/scoped-ref-map/index.ts';\n\n/** Resolved package handle for a local (built + published) package. */\nexport interface ResolvedLocalPackage {\n\treadonly kind: 'local';\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly sourcePath: string;\n\treadonly mvrPlaceholder: string;\n\t/** Captured object ids — keyed by user-declared name. */\n\treadonly captured: Readonly<Record<string, string>>;\n}\n\n/** Resolved package handle for a known (verify-only) package. */\nexport interface ResolvedKnownPackage {\n\treadonly kind: 'known';\n\treadonly name: string;\n\treadonly packageId: string;\n\treadonly upgradeCapId?: string;\n\treadonly mvrPlaceholder: string;\n}\n\nexport type ResolvedPackage = ResolvedLocalPackage | ResolvedKnownPackage;\n\n/** Registry key — the user-declared symbolic package name. Kept as a\n * type alias (not a brand) because the same string flows verbatim\n * through `localPackage(name, ...)` / `knownPackage(name, ...)` and\n * out via `entries()` to consumers (codegen, snapshot identity). */\nexport type PackageKey = string;\n\n/** L2 wrapper shape — the operations exposed on `PackageRegistryService`.\n * Today these are a 1:1 re-projection of the substrate primitive's\n * generic `ScopedRefMap<K, V>`; future plugin-specific lookups land\n * here without forcing every consumer to learn a new shape. */\nexport interface PackageRegistry {\n\treadonly set: (key: PackageKey, value: ResolvedPackage) => Effect.Effect<void>;\n\treadonly find: (key: PackageKey) => Effect.Effect<ResolvedPackage | null>;\n\treadonly has: (key: PackageKey) => Effect.Effect<boolean>;\n\treadonly entries: () => Effect.Effect<ReadonlyArray<readonly [PackageKey, ResolvedPackage]>>;\n\treadonly changes: Stream.Stream<ReadonlyArray<readonly [PackageKey, ResolvedPackage]>>;\n}\n\n// Module-private inner substrate primitive — instantiated once per\n// logical registry. The service identity is namespaced by the `name`\n// argument; substrate stays name-blind (it sees only `K` and `V`).\nconst PackageRefMap = defineScopedRefMap<PackageKey, ResolvedPackage>('PackageRegistry');\n\nconst wrapRefMap = (refMap: ScopedRefMap<PackageKey, ResolvedPackage>): PackageRegistry => ({\n\tset: refMap.set,\n\tfind: refMap.find,\n\thas: refMap.has,\n\tentries: refMap.entries,\n\tchanges: refMap.changes,\n});\n\n/** Context.Service tag for the per-stack `PackageRegistry`. Plugins\n * yield this in their acquire body. */\nexport class PackageRegistryService extends Context.Service<\n\tPackageRegistryService,\n\tPackageRegistry\n>()('@devstack-rewrite/plugins/package/PackageRegistry') {}\n\n/** Scope-bound Layer materializing one `PackageRegistry` per stack\n * scope. Boot wiring (CLI / e2e) provides this once per stack;\n * every package/coin/wallet/faucet plugin in the stack yields the\n * SAME instance via Context. */\nexport const layerPackageRegistry: Layer.Layer<PackageRegistryService> = Layer.effect(\n\tPackageRegistryService,\n\tEffect.gen(function* () {\n\t\tconst refMap = yield* PackageRefMap.Service;\n\t\treturn PackageRegistryService.of(wrapRefMap(refMap));\n\t}),\n).pipe(Layer.provide(PackageRefMap.layer));\n\n/** Capability-key constant for the per-stack registry — siblings\n * (Coin, Action, manifest emitter, faucet strategies) look it up\n * through the StrategyContributor registry. */\nexport const PACKAGE_REGISTRY_CAPABILITY_KEY = 'package-registry' as const;\n"],"mappings":";;;AAuEA,MAAM,gBAAgB,mBAAgD,kBAAkB;AAExF,MAAM,cAAc,YAAwE;CAC3F,KAAK,OAAO;CACZ,MAAM,OAAO;CACb,KAAK,OAAO;CACZ,SAAS,OAAO;CAChB,SAAS,OAAO;CAChB;;;AAID,IAAa,yBAAb,cAA4C,QAAQ,SAGjD,CAAC,oDAAoD,CAAC;;;;;AAMzD,MAAa,uBAA4D,MAAM,OAC9E,wBACA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,cAAc;AACpC,QAAO,uBAAuB,GAAG,WAAW,OAAO,CAAC;EACnD,CACF,CAAC,KAAK,MAAM,QAAQ,cAAc,MAAM,CAAC;;;;AAK1C,MAAa,kCAAkC"}
@@ -0,0 +1,20 @@
1
+ import { acquireKnown } from "./mode-known.mjs";
2
+ import { acquireLocal } from "./mode-local.mjs";
3
+ import { Effect } from "effect";
4
+ //#region src/plugins/package/service.ts
5
+ function bootPackageService(publisher, probe, registry, opts) {
6
+ switch (opts.mode) {
7
+ case "local": return acquireLocal(publisher, probe, registry, opts).pipe(Effect.map(({ resolved, output }) => ({
8
+ resolved,
9
+ output
10
+ })));
11
+ case "known": return acquireKnown(probe, registry, opts).pipe(Effect.map(({ resolved }) => ({
12
+ resolved,
13
+ output: null
14
+ })));
15
+ }
16
+ }
17
+ //#endregion
18
+ export { bootPackageService };
19
+
20
+ //# sourceMappingURL=service.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/package/service.ts"],"sourcesContent":["// Package plugin — main acquire body.\n//\n// Dispatch on `opts.mode` ∈ {local, known} and delegate to the\n// per-mode acquire. This file is INTENTIONALLY thin: the substrate\n// concerns (cache key, verify, produce, register) live inside the\n// ArtifactPublisher primitive; the toolchain concerns (build,\n// scrub) live in `build.ts`. We just route.\n//\n// Substrate dependencies arrive via `definePlugin({ dependsOn })`:\n//\n// - suiResource — resolved SuiClient + chainId\n// - publisher account — publisher address + sign-and-execute\n//\n// And via the StrategyContributor registry (by capability key):\n//\n// - chain-probe:<chainId> — ChainProbe<SuiProbeKey>\n// - artifact-publisher — the ArtifactPublisher (substrate\n// primitive, available everywhere)\n//\n// And via the plugin-owned PackageRegistry service (instantiated from\n// the substrate's generic ScopedRefMap primitive — see `registry.ts`).\n//\n// The wiring of these lookups happens at the barrel (`index.ts`); this\n// file accepts them as parameters so it stays testable.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n} from '../../primitives/artifact-publisher.ts';\nimport type { ChainProbe } from '../../contracts/chain-probe.ts';\nimport type { SuiProbeKey } from '../sui/chain-probe.ts';\nimport { acquireKnown, type KnownModeInputs } from './mode-known.ts';\nimport { acquireLocal, type LocalModeInputs } from './mode-local.ts';\nimport type {\n\tPackageRegistry,\n\tResolvedKnownPackage,\n\tResolvedLocalPackage,\n\tResolvedPackage,\n} from './registry.ts';\nimport type { LocalPackagePublishOutput } from './publish-output.ts';\nimport type { PublishError } from './errors.ts';\n\n/** Discriminated mode union — mirrors the public factory shape\n * (`localPackage(...)` and `knownPackage(...)`). The barrel\n * constructs ONE of these per declared package and the body below\n * routes. */\nexport type PackageMode =\n\t| ({ readonly mode: 'local' } & LocalModeInputs)\n\t| ({ readonly mode: 'known' } & KnownModeInputs);\n\nexport interface BootPackageResult {\n\treadonly resolved: ResolvedPackage;\n\t/** Fresh publish output — populated on cache MISS (the produce\n\t * path ran), `null` on cache hit (verify path). Threaded out so\n\t * the barrel can fan out coin auto-discovery (and any other\n\t * output-consuming siblings) once per fresh publish.\n\t *\n\t * Known mode never publishes, so this is always `null` there. */\n\treadonly output: LocalPackagePublishOutput | null;\n}\n\nexport interface BootLocalPackageResult {\n\treadonly resolved: ResolvedLocalPackage;\n\treadonly output: LocalPackagePublishOutput | null;\n}\n\nexport interface BootKnownPackageResult {\n\treadonly resolved: ResolvedKnownPackage;\n\treadonly output: null;\n}\n\n/** Dispatch on the typed mode. */\nexport function bootPackageService(\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tregistry: PackageRegistry,\n\topts: { readonly mode: 'local' } & LocalModeInputs,\n): Effect.Effect<BootLocalPackageResult, PublishError | ArtifactPublishError, Scope.Scope>;\nexport function bootPackageService(\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tregistry: PackageRegistry,\n\topts: { readonly mode: 'known' } & KnownModeInputs,\n): Effect.Effect<BootKnownPackageResult, PublishError | ArtifactPublishError, Scope.Scope>;\nexport function bootPackageService(\n\tpublisher: ArtifactPublisher,\n\tprobe: ChainProbe<SuiProbeKey>,\n\tregistry: PackageRegistry,\n\topts: PackageMode,\n): Effect.Effect<BootPackageResult, PublishError | ArtifactPublishError, Scope.Scope> {\n\tswitch (opts.mode) {\n\t\tcase 'local':\n\t\t\treturn acquireLocal(publisher, probe, registry, opts).pipe(\n\t\t\t\tEffect.map(({ resolved, output }) => ({ resolved, output })),\n\t\t\t);\n\t\tcase 'known':\n\t\t\treturn acquireKnown(probe, registry, opts).pipe(\n\t\t\t\tEffect.map(({ resolved }) => ({ resolved, output: null })),\n\t\t\t);\n\t}\n}\n"],"mappings":";;;;AAsFA,SAAgB,mBACf,WACA,OACA,UACA,MACqF;AACrF,SAAQ,KAAK,MAAb;EACC,KAAK,QACJ,QAAO,aAAa,WAAW,OAAO,UAAU,KAAK,CAAC,KACrD,OAAO,KAAK,EAAE,UAAU,cAAc;GAAE;GAAU;GAAQ,EAAE,CAC5D;EACF,KAAK,QACJ,QAAO,aAAa,OAAO,UAAU,KAAK,CAAC,KAC1C,OAAO,KAAK,EAAE,gBAAgB;GAAE;GAAU,QAAQ;GAAM,EAAE,CAC1D"}
@@ -0,0 +1,25 @@
1
+ import { Effect } from "effect";
2
+ //#region src/plugins/package/snapshot.ts
3
+ /** Build the Snapshotable contribution.
4
+ *
5
+ * Identity guard: contributes the package's symbolic name + content
6
+ * hash to the pre-restore identity record. A snapshot taken under
7
+ * source-hash A restored against source-hash A is OK (verify probe
8
+ * re-confirms); a mismatch lets the substrate decide (typically:
9
+ * also OK — re-publish). The identity guard is mostly informational
10
+ * here. */
11
+ const makeSnapshotable = (packageName, sourceHash) => ({
12
+ kind: "snapshotable",
13
+ subtrees: [],
14
+ missingTolerance: "fine",
15
+ preRestore: Effect.succeed({
16
+ kind: "package",
17
+ name: packageName,
18
+ sourceHash
19
+ }),
20
+ postRestore: Effect.void
21
+ });
22
+ //#endregion
23
+ export { makeSnapshotable };
24
+
25
+ //# sourceMappingURL=snapshot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/plugins/package/snapshot.ts"],"sourcesContent":["// Package plugin — Snapshotable contribution.\n//\n// Distilled doc §Cross-component references §snapshot: \"persisted\n// Package cache entries survive snapshot save/restore; the chain\n// containers are tarred separately and on restore the verify probe\n// re-confirms.\"\n//\n// The Package plugin OWNS the publishMove cache entries in the\n// StateStore — those land under the substrate's runtime-dir root\n// at `state-store/<plugin-key>/...` and are auto-captured by the\n// substrate without an explicit subtree decl. We declare a\n// `missingTolerance: 'fine'` shape because:\n//\n// - A restored stack with a missing cache entry simply re-publishes\n// (cache miss). No data loss.\n// - A restored stack with a present cache entry runs the lenient\n// verify probe; if the chain snapshot also restored, the probe\n// resolves the cached id; otherwise it misses and re-publishes.\n//\n// No managed containers — the build container belongs to the Sui\n// plugin (per-app, declared there). The Move build cache lives at\n// `~/.move/git` on the host (NOT in a container) and is intentionally\n// NOT captured: distilled doc §Cross-component references — vendored\n// deps are content-addressed by sui-cli, re-fetched on demand.\n\nimport { Effect } from 'effect';\n\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\n\n/** Build the Snapshotable contribution.\n *\n * Identity guard: contributes the package's symbolic name + content\n * hash to the pre-restore identity record. A snapshot taken under\n * source-hash A restored against source-hash A is OK (verify probe\n * re-confirms); a mismatch lets the substrate decide (typically:\n * also OK — re-publish). The identity guard is mostly informational\n * here. */\nexport const makeSnapshotable = (packageName: string, sourceHash: string): SnapshotableDecl => ({\n\tkind: 'snapshotable',\n\tsubtrees: [],\n\tmissingTolerance: 'fine',\n\tpreRestore: Effect.succeed({\n\t\tkind: 'package' as const,\n\t\tname: packageName,\n\t\tsourceHash,\n\t}),\n\tpostRestore: Effect.void,\n});\n"],"mappings":";;;;;;;;;;AAqCA,MAAa,oBAAoB,aAAqB,gBAA0C;CAC/F,MAAM;CACN,UAAU,EAAE;CACZ,kBAAkB;CAClB,YAAY,OAAO,QAAQ;EAC1B,MAAM;EACN,MAAM;EACN;EACA,CAAC;CACF,aAAa,OAAO;CACpB"}
@@ -0,0 +1,42 @@
1
+ import { credentialedUrl, plainUrl } from "./connection.mjs";
2
+ import { Effect } from "effect";
3
+ //#region src/plugins/postgres/codegen.ts
4
+ /** Construct the Codegenable contribution. Emit is byte-deterministic
5
+ * on unchanged input (architecture: no mtime churn on no-op cycles).
6
+ *
7
+ * The emitted shape carries both the credentialed URL (for in-app
8
+ * dialers) and the plain URL (for code paths that log or persist the
9
+ * endpoint). */
10
+ const makeCodegenable = (opts) => {
11
+ const parts = {
12
+ user: opts.user,
13
+ password: opts.password,
14
+ host: opts.host,
15
+ port: opts.port
16
+ };
17
+ return {
18
+ kind: "codegenable",
19
+ emitterName: "postgres-connection",
20
+ outputPath: `postgres/${opts.name}.ts`,
21
+ sensitive: true,
22
+ emit: (ctx) => Effect.sync(() => {
23
+ const bindings = {
24
+ name: opts.name,
25
+ host: opts.host,
26
+ port: opts.port,
27
+ user: opts.user,
28
+ password: opts.password,
29
+ databases: opts.databases,
30
+ url: credentialedUrl(parts),
31
+ plainUrl: plainUrl(opts.host, opts.port),
32
+ database: opts.databases[0]
33
+ };
34
+ ctx.exportConst("postgresConnection", bindings);
35
+ return ctx.done();
36
+ })
37
+ };
38
+ };
39
+ //#endregion
40
+ export { makeCodegenable };
41
+
42
+ //# sourceMappingURL=codegen.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/postgres/codegen.ts"],"sourcesContent":["// Postgres plugin — Codegenable contribution.\n//\n// Architecture §6: plugins emit typed `CodegenableDecl`s; the codegen\n// orchestrator stages files into the user's source tree WITHOUT\n// naming the plugin. Postgres's contribution is the connection\n// surface — credentialed URL + parsed parts so downstream user-app\n// code can construct `DATABASE_URL` strings (or feed a typed\n// connection record into a pg client) without re-deriving creds.\n//\n// Sensitive flag: the emitted file carries the password, so the\n// codegen orchestrator marks it 0o600 inside its parent (0o700). The\n// manifest projection (separate from codegen) strips the password\n// via the substrate's secret-redactor pattern.\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport {\n\tcredentialedUrl,\n\tplainUrl,\n\ttype PostgresConnectionBindings,\n\ttype PostgresConnectionParts,\n} from './connection.ts';\n\nexport interface MakeCodegenableOptions {\n\treadonly name: string;\n\treadonly user: string;\n\treadonly password: string;\n\treadonly host: string;\n\treadonly port: number;\n\treadonly databases: ReadonlyArray<string>;\n}\n\n/** Construct the Codegenable contribution. Emit is byte-deterministic\n * on unchanged input (architecture: no mtime churn on no-op cycles).\n *\n * The emitted shape carries both the credentialed URL (for in-app\n * dialers) and the plain URL (for code paths that log or persist the\n * endpoint). */\nexport const makeCodegenable = (\n\topts: MakeCodegenableOptions,\n): CodegenableDecl<'postgres-connection'> => {\n\tconst parts: PostgresConnectionParts = {\n\t\tuser: opts.user,\n\t\tpassword: opts.password,\n\t\thost: opts.host,\n\t\tport: opts.port,\n\t};\n\n\treturn {\n\t\tkind: 'codegenable',\n\t\temitterName: 'postgres-connection',\n\t\t// One file per postgres instance. Multiple postgres()\n\t\t// instances on the same stack would collide here — distilled\n\t\t// doc § Edge cases notes this as a name-collision foot-gun;\n\t\t// the substrate's codegen layer detects the collision and\n\t\t// fails with a typed error before write.\n\t\toutputPath: `postgres/${opts.name}.ts`,\n\t\tsensitive: true,\n\t\temit: (ctx) =>\n\t\t\tEffect.sync(() => {\n\t\t\t\tconst bindings: PostgresConnectionBindings = {\n\t\t\t\t\tname: opts.name,\n\t\t\t\t\thost: opts.host,\n\t\t\t\t\tport: opts.port,\n\t\t\t\t\tuser: opts.user,\n\t\t\t\t\tpassword: opts.password,\n\t\t\t\t\tdatabases: opts.databases,\n\t\t\t\t\turl: credentialedUrl(parts),\n\t\t\t\t\tplainUrl: plainUrl(opts.host, opts.port),\n\t\t\t\t\tdatabase: opts.databases[0]!,\n\t\t\t\t};\n\t\t\t\tctx.exportConst('postgresConnection', bindings);\n\t\t\t\treturn ctx.done();\n\t\t\t}),\n\t};\n};\n"],"mappings":";;;;;;;;;AAuCA,MAAa,mBACZ,SAC4C;CAC5C,MAAM,QAAiC;EACtC,MAAM,KAAK;EACX,UAAU,KAAK;EACf,MAAM,KAAK;EACX,MAAM,KAAK;EACX;AAED,QAAO;EACN,MAAM;EACN,aAAa;EAMb,YAAY,YAAY,KAAK,KAAK;EAClC,WAAW;EACX,OAAO,QACN,OAAO,WAAW;GACjB,MAAM,WAAuC;IAC5C,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,MAAM,KAAK;IACX,UAAU,KAAK;IACf,WAAW,KAAK;IAChB,KAAK,gBAAgB,MAAM;IAC3B,UAAU,SAAS,KAAK,MAAM,KAAK,KAAK;IACxC,UAAU,KAAK,UAAU;IACzB;AACD,OAAI,YAAY,sBAAsB,SAAS;AAC/C,UAAO,IAAI,MAAM;IAChB;EACH"}
@@ -0,0 +1,33 @@
1
+ //#region src/plugins/postgres/connection.d.ts
2
+ /** Components of a postgres connection. The plugin keeps these in
3
+ * one record so URL construction is a single function call. */
4
+ interface PostgresConnectionParts {
5
+ readonly user: string;
6
+ readonly password: string;
7
+ readonly host: string;
8
+ readonly port: number;
9
+ }
10
+ /** Public typed shape emitted into codegen.
11
+ *
12
+ * The credentialed URL is INCLUDED so consumers in the same user
13
+ * app process can dial. The manifest projection (substrate-level)
14
+ * strips it via the secret-redactor pattern — codegen and manifest
15
+ * are different artifacts. */
16
+ interface PostgresConnectionBindings {
17
+ readonly name: string;
18
+ readonly host: string;
19
+ readonly port: number;
20
+ readonly user: string;
21
+ /** Sensitive — never crosses to the on-disk manifest. */
22
+ readonly password: string;
23
+ readonly databases: ReadonlyArray<string>;
24
+ /** Cluster-level URL with credentials. */
25
+ readonly url: string;
26
+ /** Cluster-level URL without credentials — manifest-safe. */
27
+ readonly plainUrl: string;
28
+ /** First (bootstrap) database name. Convenience for single-DB apps. */
29
+ readonly database: string;
30
+ }
31
+ //#endregion
32
+ export { PostgresConnectionBindings, PostgresConnectionParts };
33
+ //# sourceMappingURL=connection.d.mts.map
@@ -0,0 +1,19 @@
1
+ //#region src/plugins/postgres/connection.ts
2
+ /** Build the credentialed URL.
3
+ *
4
+ * Caller convention: this URL MUST NOT be logged or persisted to
5
+ * disk. The substrate's observability redactor strips it on best-
6
+ * effort; the structural cure is to use `plainUrl` everywhere the
7
+ * password isn't needed. */
8
+ const credentialedUrl = (parts) => {
9
+ const { user, password, host, port } = parts;
10
+ return `postgres://${encodeURIComponent(user)}:${encodeURIComponent(password)}@${host}:${port}`;
11
+ };
12
+ /** Build the no-credentials URL. Manifest-safe by construction. */
13
+ const plainUrl = (host, port) => `postgres://${host}:${port}`;
14
+ /** Compose a database segment onto a base URL. */
15
+ const withDatabase = (baseUrl, db) => `${baseUrl}/${encodeURIComponent(db)}`;
16
+ //#endregion
17
+ export { credentialedUrl, plainUrl, withDatabase };
18
+
19
+ //# sourceMappingURL=connection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.mjs","names":[],"sources":["../../../src/plugins/postgres/connection.ts"],"sourcesContent":["// Postgres connection-string builders + the public typed shape used\n// by codegen and consumers.\n//\n// Distilled-doc § Postgres-specific concerns: two URL shapes must exit\n// the plugin —\n//\n// 1. CREDENTIALED form (`postgres://<user>:<pw>@<host>:<port>`) for\n// in-process / in-stack dialers that need to issue real queries.\n// 2. PLAIN form (`postgres://<host>:<port>`) for the on-disk manifest\n// and for the flat-endpoint registry. NEVER carries the password.\n//\n// Both shapes can be extended with a database name segment via\n// `withDatabase`. The plain form's existence is the structural cure\n// for the \"credentialed URL leaks via console.log\" foot-gun called\n// out in the distilled doc's learnings — the manifest projection\n// refuses anything but the plain form.\n\n/** Components of a postgres connection. The plugin keeps these in\n * one record so URL construction is a single function call. */\nexport interface PostgresConnectionParts {\n\treadonly user: string;\n\treadonly password: string;\n\treadonly host: string;\n\treadonly port: number;\n}\n\n/** Build the credentialed URL.\n *\n * Caller convention: this URL MUST NOT be logged or persisted to\n * disk. The substrate's observability redactor strips it on best-\n * effort; the structural cure is to use `plainUrl` everywhere the\n * password isn't needed. */\nexport const credentialedUrl = (parts: PostgresConnectionParts): string => {\n\tconst { user, password, host, port } = parts;\n\treturn `postgres://${encodeURIComponent(user)}:${encodeURIComponent(password)}@${host}:${port}`;\n};\n\n/** Build the no-credentials URL. Manifest-safe by construction. */\nexport const plainUrl = (host: string, port: number): string => `postgres://${host}:${port}`;\n\n/** Compose a database segment onto a base URL. */\nexport const withDatabase = (baseUrl: string, db: string): string =>\n\t`${baseUrl}/${encodeURIComponent(db)}`;\n\n/** Public typed shape emitted into codegen.\n *\n * The credentialed URL is INCLUDED so consumers in the same user\n * app process can dial. The manifest projection (substrate-level)\n * strips it via the secret-redactor pattern — codegen and manifest\n * are different artifacts. */\nexport interface PostgresConnectionBindings {\n\treadonly name: string;\n\treadonly host: string;\n\treadonly port: number;\n\treadonly user: string;\n\t/** Sensitive — never crosses to the on-disk manifest. */\n\treadonly password: string;\n\treadonly databases: ReadonlyArray<string>;\n\t/** Cluster-level URL with credentials. */\n\treadonly url: string;\n\t/** Cluster-level URL without credentials — manifest-safe. */\n\treadonly plainUrl: string;\n\t/** First (bootstrap) database name. Convenience for single-DB apps. */\n\treadonly database: string;\n\t/** Per-database credentialed URL composer is NOT included on the\n\t * emitted shape — codegen output is a static record, not a closure.\n\t * Consumers compose `${url}/${db}` themselves, or import the helper\n\t * from the plugin's runtime surface. */\n}\n"],"mappings":";;;;;;;AAgCA,MAAa,mBAAmB,UAA2C;CAC1E,MAAM,EAAE,MAAM,UAAU,MAAM,SAAS;AACvC,QAAO,cAAc,mBAAmB,KAAK,CAAC,GAAG,mBAAmB,SAAS,CAAC,GAAG,KAAK,GAAG;;;AAI1F,MAAa,YAAY,MAAc,SAAyB,cAAc,KAAK,GAAG;;AAGtF,MAAa,gBAAgB,SAAiB,OAC7C,GAAG,QAAQ,GAAG,mBAAmB,GAAG"}
@@ -0,0 +1,100 @@
1
+ import { ProbeTimeoutError, exitCodeProbeResult, waitForProbe } from "../../substrate/runtime/probes.mjs";
2
+ import { databaseCreateFailed, postgresConnectionTimeout } from "./errors.mjs";
3
+ import { Effect } from "effect";
4
+ //#region src/plugins/postgres/db-ensure.ts
5
+ const READY_PROBE_INTERVAL_MS = 500;
6
+ /** Wait until `pg_isready -U <user> -d <db>` exits zero or the
7
+ * overall deadline elapses.
8
+ *
9
+ * Distilled doc § "Postgres-specific concerns" — server-aware probe;
10
+ * TCP-listener readiness alone is insufficient (postgres opens the
11
+ * port before it accepts queries). */
12
+ const awaitReady = (exec, user, database, timeoutMs) => Effect.gen(function* () {
13
+ let attempts = 0;
14
+ let lastResult;
15
+ const startedAt = Date.now();
16
+ return yield* waitForProbe({
17
+ label: `postgres:${database}`,
18
+ timeoutMs,
19
+ intervalMs: READY_PROBE_INTERVAL_MS,
20
+ probe: () => Effect.gen(function* () {
21
+ attempts += 1;
22
+ const result = yield* exec.run([
23
+ "pg_isready",
24
+ "-U",
25
+ user,
26
+ "-d",
27
+ database
28
+ ]);
29
+ lastResult = result;
30
+ return exitCodeProbeResult(result);
31
+ })
32
+ }).pipe(Effect.mapError((cause) => postgresConnectionTimeout({
33
+ database,
34
+ attempts: cause instanceof ProbeTimeoutError ? cause.attempts : attempts,
35
+ elapsedMs: Date.now() - startedAt,
36
+ lastExitCode: lastResult?.exitCode,
37
+ lastStdout: lastResult?.stdout,
38
+ lastStderr: lastResult?.stderr
39
+ })), Effect.withSpan("postgres.awaitReady", { attributes: {
40
+ "postgres.database": database,
41
+ "postgres.timeoutMs": timeoutMs
42
+ } }));
43
+ });
44
+ /** Idempotently ensure a logical database exists.
45
+ *
46
+ * Algorithm:
47
+ * 1. `psql -tAc "SELECT 1 FROM pg_database WHERE datname = '<db>'"`.
48
+ * Exit 0 + non-empty stdout => exists, return.
49
+ * Exit != 0 => DatabaseCreateFailed(exists-check).
50
+ * 2. `createdb -U <user> <db>`.
51
+ * Exit 0 => done.
52
+ * Exit != 0 => DatabaseCreateFailed(createdb).
53
+ *
54
+ * Identifier quoting note: this implementation passes the database
55
+ * name as a CLI argument (createdb) and as a SQL string literal
56
+ * (the existence query). Postgres folds unquoted identifiers; if
57
+ * the caller passes `MyDB`, postgres stores it as `mydb`. The
58
+ * current plugin contract doesn't quote — distilled doc § Edge
59
+ * cases flags this as a known foot-gun, and the recommended cure
60
+ * is "use lowercase names". */
61
+ const ensureDatabase = (exec, user, dbName) => Effect.gen(function* () {
62
+ const exists = yield* exec.run([
63
+ "psql",
64
+ "-U",
65
+ user,
66
+ "-tAc",
67
+ `SELECT 1 FROM pg_database WHERE datname = '${dbName}'`
68
+ ]);
69
+ if (exists.exitCode !== 0) return yield* Effect.fail(databaseCreateFailed({
70
+ database: dbName,
71
+ op: "exists-check",
72
+ exitCode: exists.exitCode,
73
+ stdout: exists.stdout,
74
+ stderr: exists.stderr
75
+ }));
76
+ if (exists.stdout.trim().length > 0) return;
77
+ const created = yield* exec.run([
78
+ "createdb",
79
+ "-U",
80
+ user,
81
+ dbName
82
+ ]);
83
+ if (created.exitCode !== 0) return yield* Effect.fail(databaseCreateFailed({
84
+ database: dbName,
85
+ op: "createdb",
86
+ exitCode: created.exitCode,
87
+ stdout: created.stdout,
88
+ stderr: created.stderr
89
+ }));
90
+ }).pipe(Effect.withSpan("postgres.ensureDatabase", { attributes: { "postgres.database": dbName } }));
91
+ /** Sequentially ensure every non-bootstrap database exists. The
92
+ * bootstrap (first entry) is created by `POSTGRES_DB` at image
93
+ * entrypoint and MUST be skipped here. */
94
+ const ensureDatabases = (exec, user, databases) => Effect.gen(function* () {
95
+ for (let i = 1; i < databases.length; i++) yield* ensureDatabase(exec, user, databases[i]);
96
+ });
97
+ //#endregion
98
+ export { awaitReady, ensureDatabases };
99
+
100
+ //# sourceMappingURL=db-ensure.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-ensure.mjs","names":[],"sources":["../../../src/plugins/postgres/db-ensure.ts"],"sourcesContent":["// Postgres plugin — idempotent logical-database creation via\n// `docker exec ... psql`.\n//\n// Why exec, not a TS pg client:\n// - Production path keeps a zero-runtime-dep posture (distilled doc\n// § Postgres-specific concerns: \"avoids carrying a TS `pg` runtime\n// dependency in the production path\").\n// - The probe binary already lives inside the image; the dev\n// machine doesn't need a libpq install.\n// - The same machinery serves `pg_isready` (readiness probe) and\n// `psql` (existence check + createdb), so one exec primitive\n// covers both side-channels.\n//\n// Idempotency contract:\n// - The first database is bootstrapped by the upstream image's\n// entrypoint via `POSTGRES_DB`. The plugin's acquire body MUST\n// skip it here — passing it through `ensureDatabase` is harmless\n// (we short-circuit on existence) but wastes a round-trip.\n// - Subsequent databases land via SELECT 1 / createdb. SELECT 1\n// against `pg_database WHERE datname = '<name>'` returns \"1\\n\" on\n// hit; we treat any non-empty trimmed stdout as a hit so a\n// trailing newline doesn't trigger a duplicate-createdb path.\n//\n// The `ContainerExec` capability is consumed via the plugin's service\n// body (`service.ts:containerExec`), which thin-wraps the\n// `ContainerRuntime.exec` contract surface. Daemon-level failures\n// project to a synthetic non-zero `ExecResult` so the retry loop\n// observes them and the typed timeout error carries the captured\n// streams.\n\nimport { Effect } from 'effect';\n\nimport {\n\tdatabaseCreateFailed,\n\tpostgresConnectionTimeout,\n\ttype DatabaseCreateFailed,\n\ttype PostgresConnectionTimeout,\n} from './errors.ts';\nimport {\n\tProbeTimeoutError,\n\texitCodeProbeResult,\n\twaitForProbe,\n} from '../../substrate/runtime/probes.ts';\n\n/** One captured exec invocation. Mirrors the shape returned by\n * `docker exec` (stdout + stderr + exit code), without naming docker\n * — any container runtime that supports an exec primitive can\n * satisfy this. */\nexport interface ExecResult {\n\treadonly exitCode: number;\n\treadonly stdout: string;\n\treadonly stderr: string;\n}\n\n/** Exec callable injected by the plugin's service body. Wraps\n * `ContainerRuntime.exec` (see contract) into the local seam shape so\n * the retry / existence-check loops here stay runtime-agnostic. */\nexport interface ContainerExec {\n\treadonly run: (argv: ReadonlyArray<string>) => Effect.Effect<ExecResult>;\n}\n\nconst READY_PROBE_INTERVAL_MS = 500;\n\n/** Wait until `pg_isready -U <user> -d <db>` exits zero or the\n * overall deadline elapses.\n *\n * Distilled doc § \"Postgres-specific concerns\" — server-aware probe;\n * TCP-listener readiness alone is insufficient (postgres opens the\n * port before it accepts queries). */\nexport const awaitReady = (\n\texec: ContainerExec,\n\tuser: string,\n\tdatabase: string,\n\ttimeoutMs: number,\n): Effect.Effect<void, PostgresConnectionTimeout> =>\n\tEffect.gen(function* () {\n\t\tlet attempts = 0;\n\t\tlet lastResult: ExecResult | undefined;\n\t\tconst startedAt = Date.now();\n\n\t\treturn yield* waitForProbe({\n\t\t\tlabel: `postgres:${database}`,\n\t\t\ttimeoutMs,\n\t\t\tintervalMs: READY_PROBE_INTERVAL_MS,\n\t\t\tprobe: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tattempts += 1;\n\t\t\t\t\tconst result = yield* exec.run(['pg_isready', '-U', user, '-d', database]);\n\t\t\t\t\tlastResult = result;\n\t\t\t\t\treturn exitCodeProbeResult(result);\n\t\t\t\t}),\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tpostgresConnectionTimeout({\n\t\t\t\t\tdatabase,\n\t\t\t\t\tattempts: cause instanceof ProbeTimeoutError ? cause.attempts : attempts,\n\t\t\t\t\telapsedMs: Date.now() - startedAt,\n\t\t\t\t\tlastExitCode: lastResult?.exitCode,\n\t\t\t\t\tlastStdout: lastResult?.stdout,\n\t\t\t\t\tlastStderr: lastResult?.stderr,\n\t\t\t\t}),\n\t\t\t),\n\t\t\tEffect.withSpan('postgres.awaitReady', {\n\t\t\t\tattributes: { 'postgres.database': database, 'postgres.timeoutMs': timeoutMs },\n\t\t\t}),\n\t\t);\n\t});\n\n/** Idempotently ensure a logical database exists.\n *\n * Algorithm:\n * 1. `psql -tAc \"SELECT 1 FROM pg_database WHERE datname = '<db>'\"`.\n * Exit 0 + non-empty stdout => exists, return.\n * Exit != 0 => DatabaseCreateFailed(exists-check).\n * 2. `createdb -U <user> <db>`.\n * Exit 0 => done.\n * Exit != 0 => DatabaseCreateFailed(createdb).\n *\n * Identifier quoting note: this implementation passes the database\n * name as a CLI argument (createdb) and as a SQL string literal\n * (the existence query). Postgres folds unquoted identifiers; if\n * the caller passes `MyDB`, postgres stores it as `mydb`. The\n * current plugin contract doesn't quote — distilled doc § Edge\n * cases flags this as a known foot-gun, and the recommended cure\n * is \"use lowercase names\". */\nexport const ensureDatabase = (\n\texec: ContainerExec,\n\tuser: string,\n\tdbName: string,\n): Effect.Effect<void, DatabaseCreateFailed> =>\n\tEffect.gen(function* () {\n\t\tconst exists = yield* exec.run([\n\t\t\t'psql',\n\t\t\t'-U',\n\t\t\tuser,\n\t\t\t'-tAc',\n\t\t\t`SELECT 1 FROM pg_database WHERE datname = '${dbName}'`,\n\t\t]);\n\t\tif (exists.exitCode !== 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tdatabaseCreateFailed({\n\t\t\t\t\tdatabase: dbName,\n\t\t\t\t\top: 'exists-check',\n\t\t\t\t\texitCode: exists.exitCode,\n\t\t\t\t\tstdout: exists.stdout,\n\t\t\t\t\tstderr: exists.stderr,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tif (exists.stdout.trim().length > 0) {\n\t\t\treturn; // already present\n\t\t}\n\n\t\tconst created = yield* exec.run(['createdb', '-U', user, dbName]);\n\t\tif (created.exitCode !== 0) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tdatabaseCreateFailed({\n\t\t\t\t\tdatabase: dbName,\n\t\t\t\t\top: 'createdb',\n\t\t\t\t\texitCode: created.exitCode,\n\t\t\t\t\tstdout: created.stdout,\n\t\t\t\t\tstderr: created.stderr,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}).pipe(\n\t\tEffect.withSpan('postgres.ensureDatabase', {\n\t\t\tattributes: { 'postgres.database': dbName },\n\t\t}),\n\t);\n\n/** Sequentially ensure every non-bootstrap database exists. The\n * bootstrap (first entry) is created by `POSTGRES_DB` at image\n * entrypoint and MUST be skipped here. */\nexport const ensureDatabases = (\n\texec: ContainerExec,\n\tuser: string,\n\tdatabases: ReadonlyArray<string>,\n): Effect.Effect<void, DatabaseCreateFailed> =>\n\tEffect.gen(function* () {\n\t\tfor (let i = 1; i < databases.length; i++) {\n\t\t\tyield* ensureDatabase(exec, user, databases[i]!);\n\t\t}\n\t});\n"],"mappings":";;;;AA6DA,MAAM,0BAA0B;;;;;;;AAQhC,MAAa,cACZ,MACA,MACA,UACA,cAEA,OAAO,IAAI,aAAa;CACvB,IAAI,WAAW;CACf,IAAI;CACJ,MAAM,YAAY,KAAK,KAAK;AAE5B,QAAO,OAAO,aAAa;EAC1B,OAAO,YAAY;EACnB;EACA,YAAY;EACZ,aACC,OAAO,IAAI,aAAa;AACvB,eAAY;GACZ,MAAM,SAAS,OAAO,KAAK,IAAI;IAAC;IAAc;IAAM;IAAM;IAAM;IAAS,CAAC;AAC1E,gBAAa;AACb,UAAO,oBAAoB,OAAO;IACjC;EACH,CAAC,CAAC,KACF,OAAO,UAAU,UAChB,0BAA0B;EACzB;EACA,UAAU,iBAAiB,oBAAoB,MAAM,WAAW;EAChE,WAAW,KAAK,KAAK,GAAG;EACxB,cAAc,YAAY;EAC1B,YAAY,YAAY;EACxB,YAAY,YAAY;EACxB,CAAC,CACF,EACD,OAAO,SAAS,uBAAuB,EACtC,YAAY;EAAE,qBAAqB;EAAU,sBAAsB;EAAW,EAC9E,CAAC,CACF;EACA;;;;;;;;;;;;;;;;;;AAmBH,MAAa,kBACZ,MACA,MACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,KAAK,IAAI;EAC9B;EACA;EACA;EACA;EACA,8CAA8C,OAAO;EACrD,CAAC;AACF,KAAI,OAAO,aAAa,EACvB,QAAO,OAAO,OAAO,KACpB,qBAAqB;EACpB,UAAU;EACV,IAAI;EACJ,UAAU,OAAO;EACjB,QAAQ,OAAO;EACf,QAAQ,OAAO;EACf,CAAC,CACF;AAEF,KAAI,OAAO,OAAO,MAAM,CAAC,SAAS,EACjC;CAGD,MAAM,UAAU,OAAO,KAAK,IAAI;EAAC;EAAY;EAAM;EAAM;EAAO,CAAC;AACjE,KAAI,QAAQ,aAAa,EACxB,QAAO,OAAO,OAAO,KACpB,qBAAqB;EACpB,UAAU;EACV,IAAI;EACJ,UAAU,QAAQ;EAClB,QAAQ,QAAQ;EAChB,QAAQ,QAAQ;EAChB,CAAC,CACF;EAED,CAAC,KACF,OAAO,SAAS,2BAA2B,EAC1C,YAAY,EAAE,qBAAqB,QAAQ,EAC3C,CAAC,CACF;;;;AAKF,MAAa,mBACZ,MACA,MACA,cAEA,OAAO,IAAI,aAAa;AACvB,MAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,IACrC,QAAO,eAAe,MAAM,MAAM,UAAU,GAAI;EAEhD"}
@@ -0,0 +1,55 @@
1
+ import { ConfigIssue } from "../../substrate/runtime/config-validation.mjs";
2
+
3
+ //#region src/plugins/postgres/errors.d.ts
4
+ /** Phases for `PostgresPluginError`. Closed sum — additions land in
5
+ * the distilled-doc catalog first. */
6
+ type PostgresPhase = 'network-create' | 'image-build' | 'container-start' | 'ready-probe' | 'db-ensure' | 'unknown';
7
+ /** Generic plugin error. Most failure surfaces collapse onto this
8
+ * shape; specific failure modes that warrant their own catchable
9
+ * tag (timeout, createdb-collision) get their own type below. */
10
+ interface PostgresPluginError {
11
+ readonly _tag: 'PostgresPluginError';
12
+ readonly phase: PostgresPhase;
13
+ readonly message: string;
14
+ readonly cause?: unknown;
15
+ }
16
+ interface PostgresConfigError extends ConfigIssue {
17
+ readonly _tag: 'PostgresConfigError';
18
+ }
19
+ /** `pg_isready` returned non-zero past the deadline. Carries the
20
+ * database name + last exit code + captured streams so the cause
21
+ * walker can render an actionable hint (slow disk, port mismatch,
22
+ * perms on data dir).
23
+ *
24
+ * Distilled-doc § Edge cases: this is the most common "what went
25
+ * wrong" failure during first boot of a freshly-built image; it
26
+ * deserves its own tag so the renderer can show a slow-disk hint
27
+ * before users guess. */
28
+ interface PostgresConnectionTimeout {
29
+ readonly _tag: 'PostgresConnectionTimeout';
30
+ readonly database: string;
31
+ readonly attempts: number;
32
+ readonly elapsedMs: number;
33
+ readonly lastExitCode?: number;
34
+ readonly lastStdout?: string;
35
+ readonly lastStderr?: string;
36
+ }
37
+ /** Logical-database creation failed. Distinct from a network /
38
+ * container / probe failure because the typical root cause is
39
+ * case-sensitivity collision in postgres identifier folding —
40
+ * surfaced explicitly via its own tag so consumers can render a
41
+ * "quote the identifier" hint. */
42
+ interface DatabaseCreateFailed {
43
+ readonly _tag: 'DatabaseCreateFailed';
44
+ readonly database: string;
45
+ readonly op: 'exists-check' | 'createdb';
46
+ readonly exitCode?: number;
47
+ readonly stdout?: string;
48
+ readonly stderr?: string;
49
+ readonly cause?: unknown;
50
+ }
51
+ /** Union of every error a Postgres-plugin caller may encounter. */
52
+ type PostgresError = PostgresPluginError | PostgresConfigError | PostgresConnectionTimeout | DatabaseCreateFailed;
53
+ //#endregion
54
+ export { DatabaseCreateFailed, PostgresConfigError, PostgresConnectionTimeout, PostgresError, PostgresPhase, PostgresPluginError };
55
+ //# sourceMappingURL=errors.d.mts.map
@@ -0,0 +1,29 @@
1
+ import { defineConfigError } from "../../substrate/runtime/config-validation.mjs";
2
+ //#region src/plugins/postgres/errors.ts
3
+ const postgresPluginError = (phase, message, cause) => ({
4
+ _tag: "PostgresPluginError",
5
+ phase,
6
+ message,
7
+ cause
8
+ });
9
+ const postgresConfigError = defineConfigError("PostgresConfigError");
10
+ const postgresConnectionTimeout = (parts) => ({
11
+ _tag: "PostgresConnectionTimeout",
12
+ ...parts
13
+ });
14
+ const databaseCreateFailed = (parts) => ({
15
+ _tag: "DatabaseCreateFailed",
16
+ ...parts
17
+ });
18
+ /** Error tags this plugin contributes — surfaced to the cause walker
19
+ * via `PluginErrorContribution`. */
20
+ const POSTGRES_ERROR_TAGS = [
21
+ "PostgresPluginError",
22
+ "PostgresConfigError",
23
+ "PostgresConnectionTimeout",
24
+ "DatabaseCreateFailed"
25
+ ];
26
+ //#endregion
27
+ export { POSTGRES_ERROR_TAGS, databaseCreateFailed, postgresConfigError, postgresConnectionTimeout, postgresPluginError };
28
+
29
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/plugins/postgres/errors.ts"],"sourcesContent":["// Postgres plugin — typed errors.\n//\n// Per-plugin tagged errors (architecture § Effect; substrate-redesign\n// directive: errors live with the plugin that raises and consumes\n// them). Postgres is a topological leaf — every raise site AND every\n// consumer is inside `src/plugins/postgres/`, so this file owns the\n// complete error surface.\n//\n// Phase tags mirror the lifecycle states from the distilled doc\n// (10-postgres § Lifecycle states): one phase per failure boundary\n// so the cause walker / TUI / regression tests can pin behaviour by\n// label rather than by message-substring matching.\n//\n// Effect v4: errors are plain interfaces with a `_tag` discriminator.\n// `Effect.catchTag` / `catchTags` match on the `_tag` literal — we do\n// NOT subclass an Effect base class. See architecture § Effect.\n\nimport { defineConfigError, type ConfigIssue } from '../../substrate/runtime/config-validation.ts';\n\n/** Phases for `PostgresPluginError`. Closed sum — additions land in\n * the distilled-doc catalog first. */\nexport type PostgresPhase =\n\t| 'network-create'\n\t| 'image-build'\n\t| 'container-start'\n\t| 'ready-probe'\n\t| 'db-ensure'\n\t| 'unknown';\n\n/** Generic plugin error. Most failure surfaces collapse onto this\n * shape; specific failure modes that warrant their own catchable\n * tag (timeout, createdb-collision) get their own type below. */\nexport interface PostgresPluginError {\n\treadonly _tag: 'PostgresPluginError';\n\treadonly phase: PostgresPhase;\n\treadonly message: string;\n\treadonly cause?: unknown;\n}\n\nexport const postgresPluginError = (\n\tphase: PostgresPhase,\n\tmessage: string,\n\tcause?: unknown,\n): PostgresPluginError => ({ _tag: 'PostgresPluginError', phase, message, cause });\n\nexport interface PostgresConfigError extends ConfigIssue {\n\treadonly _tag: 'PostgresConfigError';\n}\n\nexport const postgresConfigError = defineConfigError('PostgresConfigError');\n\n/** `pg_isready` returned non-zero past the deadline. Carries the\n * database name + last exit code + captured streams so the cause\n * walker can render an actionable hint (slow disk, port mismatch,\n * perms on data dir).\n *\n * Distilled-doc § Edge cases: this is the most common \"what went\n * wrong\" failure during first boot of a freshly-built image; it\n * deserves its own tag so the renderer can show a slow-disk hint\n * before users guess. */\nexport interface PostgresConnectionTimeout {\n\treadonly _tag: 'PostgresConnectionTimeout';\n\treadonly database: string;\n\treadonly attempts: number;\n\treadonly elapsedMs: number;\n\treadonly lastExitCode?: number;\n\treadonly lastStdout?: string;\n\treadonly lastStderr?: string;\n}\n\nexport const postgresConnectionTimeout = (\n\tparts: Omit<PostgresConnectionTimeout, '_tag'>,\n): PostgresConnectionTimeout => ({ _tag: 'PostgresConnectionTimeout', ...parts });\n\n/** Logical-database creation failed. Distinct from a network /\n * container / probe failure because the typical root cause is\n * case-sensitivity collision in postgres identifier folding —\n * surfaced explicitly via its own tag so consumers can render a\n * \"quote the identifier\" hint. */\nexport interface DatabaseCreateFailed {\n\treadonly _tag: 'DatabaseCreateFailed';\n\treadonly database: string;\n\treadonly op: 'exists-check' | 'createdb';\n\treadonly exitCode?: number;\n\treadonly stdout?: string;\n\treadonly stderr?: string;\n\treadonly cause?: unknown;\n}\n\nexport const databaseCreateFailed = (\n\tparts: Omit<DatabaseCreateFailed, '_tag'>,\n): DatabaseCreateFailed => ({ _tag: 'DatabaseCreateFailed', ...parts });\n\n/** Union of every error a Postgres-plugin caller may encounter. */\nexport type PostgresError =\n\t| PostgresPluginError\n\t| PostgresConfigError\n\t| PostgresConnectionTimeout\n\t| DatabaseCreateFailed;\n\n/** Error tags this plugin contributes — surfaced to the cause walker\n * via `PluginErrorContribution`. */\nexport const POSTGRES_ERROR_TAGS: ReadonlyArray<PostgresError['_tag']> = [\n\t'PostgresPluginError',\n\t'PostgresConfigError',\n\t'PostgresConnectionTimeout',\n\t'DatabaseCreateFailed',\n] as const;\n"],"mappings":";;AAuCA,MAAa,uBACZ,OACA,SACA,WAC0B;CAAE,MAAM;CAAuB;CAAO;CAAS;CAAO;AAMjF,MAAa,sBAAsB,kBAAkB,sBAAsB;AAqB3E,MAAa,6BACZ,WACgC;CAAE,MAAM;CAA6B,GAAG;CAAO;AAiBhF,MAAa,wBACZ,WAC2B;CAAE,MAAM;CAAwB,GAAG;CAAO;;;AAWtE,MAAa,sBAA4D;CACxE;CACA;CACA;CACA;CACA"}
@@ -0,0 +1,37 @@
1
+ import { CodegenableDecl } from "../../contracts/codegenable.mjs";
2
+ import { RoutableDecl } from "../../contracts/routable.mjs";
3
+ import { SnapshotableDecl } from "../../contracts/snapshotable.mjs";
4
+ import { Plugin } from "../../substrate/plugin.mjs";
5
+ import { DatabaseCreateFailed, PostgresConfigError, PostgresConnectionTimeout, PostgresError, PostgresPhase, PostgresPluginError } from "./errors.mjs";
6
+ import { Postgres, PostgresServiceOptions } from "./service.mjs";
7
+ import { PostgresConnectionBindings, PostgresConnectionParts } from "./connection.mjs";
8
+ //#region src/plugins/postgres/index.d.ts
9
+ type PostgresCapabilities = readonly [SnapshotableDecl, CodegenableDecl<'postgres-connection'>] | readonly [SnapshotableDecl, CodegenableDecl<'postgres-connection'>, RoutableDecl];
10
+ /** User-facing options on top of the service options — currently just
11
+ * the routable opt-in. We split this out so the service body's
12
+ * `PostgresServiceOptions` stays focused on container/boot knobs and
13
+ * the plugin-level surface owns capability gating. */
14
+ interface PostgresPluginOptions extends PostgresServiceOptions {
15
+ /** When `true`, the plugin contributes a `wireProtocol: 'tcp'`
16
+ * Routable decl that fronts the postgres container on the
17
+ * `postgres-tcp` entrypoint (host port 5432 by default). Default
18
+ * `false` — parallel stacks coexist via the in-network DNS alias
19
+ * and the optional `hostPort` mapping, neither of which involves
20
+ * the router.
21
+ *
22
+ * Architecture parallel-stack note: TCP entrypoints serve ONE
23
+ * backend at a time (no Host-header fan-out), so only one stack
24
+ * on the host may set `route: true` at a given moment. The router
25
+ * orchestrator's collision detector fails fast on the second
26
+ * contribution. */
27
+ readonly route?: boolean;
28
+ }
29
+ /** Postgres-as-a-container plugin. One per `(stack, name)` pair.
30
+ *
31
+ * Single-mode: only local container exists today. The plain-endpoint
32
+ * shape anticipates a future "live" mode (Cloud SQL / Neon / RDS)
33
+ * that emits the same endpoint shape without spawning. */
34
+ declare const postgres: (opts?: PostgresPluginOptions) => Plugin<"postgres", Postgres, readonly [], PostgresCapabilities>;
35
+ //#endregion
36
+ export { PostgresPluginOptions, postgres };
37
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,75 @@
1
+ import { definePlugin, resource } from "../../substrate/plugin.mjs";
2
+ import { pluginErrorContributions } from "../../api/plugin-errors.mjs";
3
+ import { IdentityContext } from "../../substrate/runtime/paths.mjs";
4
+ import { ContainerRuntimeService } from "../../runtime/docker/service.mjs";
5
+ import { expectNonEmptyArray } from "../../substrate/runtime/config-validation.mjs";
6
+ import { makePostgresRoutable } from "./routable.mjs";
7
+ import "./connection.mjs";
8
+ import { makeCodegenable } from "./codegen.mjs";
9
+ import { POSTGRES_ERROR_TAGS, postgresConfigError, postgresPluginError } from "./errors.mjs";
10
+ import { bootPostgresService } from "./service.mjs";
11
+ import { makeSnapshotable } from "./snapshot.mjs";
12
+ import { Effect } from "effect";
13
+ //#region src/plugins/postgres/index.ts
14
+ /** The Postgres plugin's resource identity. */
15
+ const postgresResource = resource("postgres");
16
+ const postgresErrorContributions = pluginErrorContributions(POSTGRES_ERROR_TAGS);
17
+ const buildPlugin = (opts) => {
18
+ const name = opts.name ?? "postgres";
19
+ const databases = expectNonEmptyArray(opts.databases ?? ["devstack"], {
20
+ field: "databases",
21
+ message: "postgres(): `databases` must be non-empty",
22
+ mkError: postgresConfigError
23
+ });
24
+ return definePlugin({
25
+ id: postgresResource.id,
26
+ role: "service",
27
+ start: () => Effect.gen(function* () {
28
+ const { handle } = yield* bootPostgresService(yield* ContainerRuntimeService, yield* IdentityContext, opts);
29
+ return handle;
30
+ }).pipe(Effect.catchTags({
31
+ PostgresPluginError: Effect.fail,
32
+ PostgresConfigError: Effect.fail,
33
+ PostgresConnectionTimeout: Effect.fail,
34
+ DatabaseCreateFailed: Effect.fail
35
+ }), Effect.catch((cause) => Effect.fail(postgresPluginError("unknown", `postgres(${name}): unknown failure`, cause)))),
36
+ errorContributions: postgresErrorContributions,
37
+ capabilities: ({ value, runtime }) => {
38
+ const snap = makeSnapshotable({
39
+ app: runtime.identity.app,
40
+ stack: runtime.identity.stack,
41
+ name,
42
+ databases
43
+ });
44
+ const codegen = makeCodegenable({
45
+ name,
46
+ user: value.user,
47
+ password: value.password,
48
+ host: value.networkAlias,
49
+ port: value.port,
50
+ databases: value.databases
51
+ });
52
+ const routable = opts.route ? makePostgresRoutable({
53
+ app: runtime.identity.app,
54
+ stack: runtime.identity.stack,
55
+ name,
56
+ containerName: `${runtime.identity.app}-${runtime.identity.stack}-${name}`
57
+ }) : null;
58
+ return routable === null ? [snap, codegen] : [
59
+ snap,
60
+ codegen,
61
+ routable
62
+ ];
63
+ }
64
+ });
65
+ };
66
+ /** Postgres-as-a-container plugin. One per `(stack, name)` pair.
67
+ *
68
+ * Single-mode: only local container exists today. The plain-endpoint
69
+ * shape anticipates a future "live" mode (Cloud SQL / Neon / RDS)
70
+ * that emits the same endpoint shape without spawning. */
71
+ const postgres = (opts = {}) => buildPlugin(opts);
72
+ //#endregion
73
+ export { postgres };
74
+
75
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugins/postgres/index.ts"],"sourcesContent":["// Postgres plugin — barrel + `postgres(opts?)` factory.\n//\n// Architecture: Postgres is a topological leaf (no upstream service\n// dependencies) and a single-mode service (local container only;\n// \"live\" modes — Cloud SQL / Neon / RDS — are a deferred decision in\n// the distilled doc, anticipated by the plain-endpoint shape but not\n// implemented). One factory; no mode-narrowed namespace.\n//\n// Capabilities emitted:\n// 1. Snapshotable — container's writable layer (PGDATA-relocated),\n// identity guard contributes server name + ordered db list.\n// 2. Codegenable — typed connection bindings for user-app code.\n// 3. Routable (TCP, optional) — gated by `opts.route`. When true,\n// the postgres container fronts the `postgres-tcp` Traefik\n// entrypoint (host port 5432 by default). Disabled by default to\n// preserve the existing parallel-stack story (TCP has no Host\n// header, so an entrypoint serves one backend at a time).\n// Stacks that want host-side reachability can set `route: true`\n// OR set `hostPort` directly (the two are mutually exclusive\n// escape hatches — `route: true` is recommended for in-network\n// composition with traefik, `hostPort` for direct host-port\n// publication).\n//\n// Substrate wiring:\n// - `ContainerRuntimeService` yielded in the acquire body for the\n// container + image + exec contract.\n// - `IdentityContext` yielded for the app/stack identity strings.\n// - `errorContributions` declares POSTGRES_ERROR_TAGS so the\n// supervisor's harvest loop registers them with the\n// FormatterRegistry.\n\nimport { Effect } from 'effect';\n\nimport { definePlugin, resource } from '../../api/define-plugin.ts';\nimport { pluginErrorContributions } from '../../api/plugin-errors.ts';\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { RoutableDecl } from '../../contracts/routable.ts';\nimport type { SnapshotableDecl } from '../../contracts/snapshotable.ts';\nimport { ContainerRuntimeService } from '../../runtime/docker/service.ts';\nimport { expectNonEmptyArray } from '../../substrate/runtime/config-validation.ts';\nimport { IdentityContext } from '../../substrate/runtime/paths.ts';\n\nimport { makeCodegenable } from './codegen.ts';\nimport { POSTGRES_ERROR_TAGS, postgresConfigError, postgresPluginError } from './errors.ts';\nimport { makePostgresRoutable } from './routable.ts';\nimport { bootPostgresService, type Postgres, type PostgresServiceOptions } from './service.ts';\nimport { makeSnapshotable } from './snapshot.ts';\n\ntype PostgresCapabilities =\n\t| readonly [SnapshotableDecl, CodegenableDecl<'postgres-connection'>]\n\t| readonly [SnapshotableDecl, CodegenableDecl<'postgres-connection'>, RoutableDecl];\n\n// ---------------------------------------------------------------------------\n// Resource identity\n// ---------------------------------------------------------------------------\n\n/** The Postgres plugin's resource identity. */\nconst postgresResource = resource<'postgres', Postgres>('postgres');\nconst postgresErrorContributions = pluginErrorContributions(POSTGRES_ERROR_TAGS);\n\n// ---------------------------------------------------------------------------\n// Plugin construction\n// ---------------------------------------------------------------------------\n\n/** User-facing options on top of the service options — currently just\n * the routable opt-in. We split this out so the service body's\n * `PostgresServiceOptions` stays focused on container/boot knobs and\n * the plugin-level surface owns capability gating. */\nexport interface PostgresPluginOptions extends PostgresServiceOptions {\n\t/** When `true`, the plugin contributes a `wireProtocol: 'tcp'`\n\t * Routable decl that fronts the postgres container on the\n\t * `postgres-tcp` entrypoint (host port 5432 by default). Default\n\t * `false` — parallel stacks coexist via the in-network DNS alias\n\t * and the optional `hostPort` mapping, neither of which involves\n\t * the router.\n\t *\n\t * Architecture parallel-stack note: TCP entrypoints serve ONE\n\t * backend at a time (no Host-header fan-out), so only one stack\n\t * on the host may set `route: true` at a given moment. The router\n\t * orchestrator's collision detector fails fast on the second\n\t * contribution. */\n\treadonly route?: boolean;\n}\n\nconst buildPlugin = (opts: PostgresPluginOptions) => {\n\tconst name = opts.name ?? 'postgres';\n\tconst databases = expectNonEmptyArray(opts.databases ?? ['devstack'], {\n\t\tfield: 'databases',\n\t\tmessage: 'postgres(): `databases` must be non-empty',\n\t\tmkError: postgresConfigError,\n\t});\n\n\treturn definePlugin({\n\t\tid: postgresResource.id,\n\t\trole: 'service',\n\t\tstart: () =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\t// Substrate-context plumbing supplies real\n\t\t\t\t// `ContainerRuntime` + `Identity` instances; the\n\t\t\t\t// supervisor's plugin acquisition path provides these\n\t\t\t\t// before this body runs.\n\t\t\t\tconst runtime = yield* ContainerRuntimeService;\n\t\t\t\tconst identity = yield* IdentityContext;\n\t\t\t\tconst { handle } = yield* bootPostgresService(runtime, identity, opts);\n\t\t\t\treturn handle;\n\t\t\t}).pipe(\n\t\t\t\t// Distilled-doc § Invariants: already-typed errors must\n\t\t\t\t// NOT be re-wrapped by the catch-all unknown handler.\n\t\t\t\t// `catchTag` runs first; anything unknown falls into the\n\t\t\t\t// catch-all and surfaces as `phase: 'unknown'`.\n\t\t\t\tEffect.catchTags({\n\t\t\t\t\tPostgresPluginError: Effect.fail,\n\t\t\t\t\tPostgresConfigError: Effect.fail,\n\t\t\t\t\tPostgresConnectionTimeout: Effect.fail,\n\t\t\t\t\tDatabaseCreateFailed: Effect.fail,\n\t\t\t\t}),\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tEffect.fail(postgresPluginError('unknown', `postgres(${name}): unknown failure`, cause)),\n\t\t\t\t),\n\t\t\t),\n\t\terrorContributions: postgresErrorContributions,\n\t\t// Dynamic capability factory: receives the resolved\n\t\t// `Postgres` handle + acquire context. Stamps the REAL\n\t\t// app/stack into the snapshot decl and the REAL\n\t\t// networkAlias + derived password into the codegen\n\t\t// bindings — the static-form placeholders (`<app>`,\n\t\t// `<stack>`, `<network-alias>`, `<derived-at-acquire>`)\n\t\t// are gone.\n\t\tcapabilities: ({ value, runtime }): PostgresCapabilities => {\n\t\t\tconst snap = makeSnapshotable({\n\t\t\t\tapp: runtime.identity.app,\n\t\t\t\tstack: runtime.identity.stack,\n\t\t\t\tname,\n\t\t\t\tdatabases,\n\t\t\t});\n\t\t\tconst codegen = makeCodegenable({\n\t\t\t\tname,\n\t\t\t\tuser: value.user,\n\t\t\t\tpassword: value.password,\n\t\t\t\thost: value.networkAlias,\n\t\t\t\tport: value.port,\n\t\t\t\tdatabases: value.databases,\n\t\t\t});\n\t\t\tconst routable = opts.route\n\t\t\t\t? makePostgresRoutable({\n\t\t\t\t\t\tapp: runtime.identity.app,\n\t\t\t\t\t\tstack: runtime.identity.stack,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tcontainerName: `${runtime.identity.app}-${runtime.identity.stack}-${name}`,\n\t\t\t\t\t})\n\t\t\t\t: null;\n\t\t\treturn routable === null ? ([snap, codegen] as const) : ([snap, codegen, routable] as const);\n\t\t},\n\t});\n};\n\n// ---------------------------------------------------------------------------\n// User-facing factory\n// ---------------------------------------------------------------------------\n\n/** Postgres-as-a-container plugin. One per `(stack, name)` pair.\n *\n * Single-mode: only local container exists today. The plain-endpoint\n * shape anticipates a future \"live\" mode (Cloud SQL / Neon / RDS)\n * that emits the same endpoint shape without spawning. */\nexport const postgres = (opts: PostgresPluginOptions = {}) => buildPlugin(opts);\n\n// Re-export the canonical TCP endpoint name for downstream consumers\n// (codegen lookups, doctor / inventory rendering, etc.).\nexport { POSTGRES_TCP_ENDPOINT_NAME } from './routable.ts';\n\n// ---------------------------------------------------------------------------\n// Re-exports for consumers + sibling plugins\n// ---------------------------------------------------------------------------\n\nexport type { Postgres, PostgresServiceOptions } from './service.ts';\nexport type { PostgresConnectionBindings, PostgresConnectionParts } from './connection.ts';\nexport type {\n\tPostgresError,\n\tPostgresPluginError,\n\tPostgresConfigError,\n\tPostgresConnectionTimeout,\n\tDatabaseCreateFailed,\n\tPostgresPhase,\n} from './errors.ts';\nexport { POSTGRES_ERROR_TAGS } from './errors.ts';\nexport type { PostgresIdentityPayload } from './snapshot.ts';\n\n// Connection-string builders — exposed for downstream consumers that\n// need to compose URLs without the resolved handle (e.g. user-app\n// code that reads the codegen output and builds a per-database URL\n// at runtime).\nexport { credentialedUrl, plainUrl, withDatabase } from './connection.ts';\n"],"mappings":";;;;;;;;;;;;;;AAyDA,MAAM,mBAAmB,SAA+B,WAAW;AACnE,MAAM,6BAA6B,yBAAyB,oBAAoB;AA0BhF,MAAM,eAAe,SAAgC;CACpD,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,YAAY,oBAAoB,KAAK,aAAa,CAAC,WAAW,EAAE;EACrE,OAAO;EACP,SAAS;EACT,SAAS;EACT,CAAC;AAEF,QAAO,aAAa;EACnB,IAAI,iBAAiB;EACrB,MAAM;EACN,aACC,OAAO,IAAI,aAAa;GAOvB,MAAM,EAAE,WAAW,OAAO,oBAAoB,OAFvB,yBAEgC,OAD/B,iBACyC,KAAK;AACtE,UAAO;IACN,CAAC,KAKF,OAAO,UAAU;GAChB,qBAAqB,OAAO;GAC5B,qBAAqB,OAAO;GAC5B,2BAA2B,OAAO;GAClC,sBAAsB,OAAO;GAC7B,CAAC,EACF,OAAO,OAAO,UACb,OAAO,KAAK,oBAAoB,WAAW,YAAY,KAAK,qBAAqB,MAAM,CAAC,CACxF,CACD;EACF,oBAAoB;EAQpB,eAAe,EAAE,OAAO,cAAoC;GAC3D,MAAM,OAAO,iBAAiB;IAC7B,KAAK,QAAQ,SAAS;IACtB,OAAO,QAAQ,SAAS;IACxB;IACA;IACA,CAAC;GACF,MAAM,UAAU,gBAAgB;IAC/B;IACA,MAAM,MAAM;IACZ,UAAU,MAAM;IAChB,MAAM,MAAM;IACZ,MAAM,MAAM;IACZ,WAAW,MAAM;IACjB,CAAC;GACF,MAAM,WAAW,KAAK,QACnB,qBAAqB;IACrB,KAAK,QAAQ,SAAS;IACtB,OAAO,QAAQ,SAAS;IACxB;IACA,eAAe,GAAG,QAAQ,SAAS,IAAI,GAAG,QAAQ,SAAS,MAAM,GAAG;IACpE,CAAC,GACD;AACH,UAAO,aAAa,OAAQ,CAAC,MAAM,QAAQ,GAAc;IAAC;IAAM;IAAS;IAAS;;EAEnF,CAAC;;;;;;;AAYH,MAAa,YAAY,OAA8B,EAAE,KAAK,YAAY,KAAK"}
@@ -0,0 +1,33 @@
1
+ //#region src/plugins/postgres/routable.ts
2
+ /** Canonical endpoint name — matches this plugin's router entrypoint. */
3
+ const POSTGRES_TCP_ENDPOINT_NAME = "postgres-tcp";
4
+ const POSTGRES_TCP_ENTRYPOINT_PORT = 5432;
5
+ const POSTGRES_ENTRYPOINTS = [{
6
+ name: POSTGRES_TCP_ENDPOINT_NAME,
7
+ port: POSTGRES_TCP_ENTRYPOINT_PORT,
8
+ protocol: "tcp"
9
+ }];
10
+ /** Construct the Postgres TCP Routable decl.
11
+ *
12
+ * The `containerName` is whatever name the postgres `ensureContainer`
13
+ * call uses for its container — the router's upstream resolver maps
14
+ * the key back to the container's shared-network IP at dispatch-file
15
+ * write time. */
16
+ const makePostgresRoutable = (parts) => ({
17
+ kind: "routable",
18
+ endpointName: POSTGRES_TCP_ENDPOINT_NAME,
19
+ dispatchId: {
20
+ serviceKey: `postgres.${parts.app}.${parts.stack}.${parts.name}`,
21
+ role: parts.name
22
+ },
23
+ upstream: {
24
+ type: "container",
25
+ containerName: parts.containerName,
26
+ containerPort: POSTGRES_TCP_ENTRYPOINT_PORT
27
+ },
28
+ wireProtocol: "tcp"
29
+ });
30
+ //#endregion
31
+ export { POSTGRES_ENTRYPOINTS, POSTGRES_TCP_ENDPOINT_NAME, makePostgresRoutable };
32
+
33
+ //# sourceMappingURL=routable.mjs.map