@mysten-incubation/devstack 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (858) hide show
  1. package/README.md +6 -3
  2. package/dashboard-ui/assets/grpc-a4usE3Nk.js +3 -0
  3. package/dashboard-ui/assets/index-B82Bh84P.css +1 -0
  4. package/dashboard-ui/assets/index-CRYJ4pru.js +1277 -0
  5. package/dashboard-ui/index.html +2 -2
  6. package/dist/api/define-capabilities.d.mts +1 -20
  7. package/dist/api/define-capabilities.mjs +15 -22
  8. package/dist/api/define-capabilities.mjs.map +1 -1
  9. package/dist/api/define-devstack-with.d.mts +7 -1
  10. package/dist/api/define-devstack-with.mjs.map +1 -1
  11. package/dist/api/define-devstack.mjs.map +1 -1
  12. package/dist/api/define-plugin.d.mts +2 -1
  13. package/dist/api/inference-network.d.mts +31 -17
  14. package/dist/api/inference-network.mjs +40 -43
  15. package/dist/api/inference-network.mjs.map +1 -1
  16. package/dist/api/load-config.mjs +88 -0
  17. package/dist/api/load-config.mjs.map +1 -0
  18. package/dist/api/mode-narrowed-factory.d.mts +1 -1
  19. package/dist/api/mode-narrowed-factory.mjs.map +1 -1
  20. package/dist/api/run-stack-internal.mjs +202 -0
  21. package/dist/api/run-stack-internal.mjs.map +1 -0
  22. package/dist/api/run-stack.d.mts +82 -31
  23. package/dist/api/run-stack.mjs +22 -141
  24. package/dist/api/run-stack.mjs.map +1 -1
  25. package/dist/build-integrations/dapp-kit/index.d.mts +61 -0
  26. package/dist/build-integrations/dapp-kit/index.mjs +58 -0
  27. package/dist/build-integrations/dapp-kit/index.mjs.map +1 -0
  28. package/dist/build-integrations/playwright/config.d.mts +1 -30
  29. package/dist/build-integrations/playwright/config.mjs +1 -27
  30. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  31. package/dist/build-integrations/playwright/errors.d.mts +4 -7
  32. package/dist/build-integrations/playwright/errors.mjs.map +1 -1
  33. package/dist/build-integrations/playwright/global-setup.d.mts +42 -71
  34. package/dist/build-integrations/playwright/global-setup.mjs +142 -218
  35. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  36. package/dist/build-integrations/playwright/index.d.mts +2 -2
  37. package/dist/build-integrations/playwright/index.mjs +2 -2
  38. package/dist/build-integrations/playwright/stack-context.d.mts +3 -1
  39. package/dist/build-integrations/playwright/stack-context.mjs +4 -2
  40. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  41. package/dist/build-integrations/playwright/wallet-context.mjs +44 -19
  42. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  44. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -1
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -1
  46. package/dist/build-integrations/runtime/discover.d.mts +6 -4
  47. package/dist/build-integrations/runtime/discover.mjs +15 -4
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  49. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/errors.mjs.map +1 -1
  51. package/dist/build-integrations/runtime/read-stack-context.mjs +3 -3
  52. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  53. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +23 -7
  54. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +25 -12
  55. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/stack-context.d.mts +2 -2
  57. package/dist/build-integrations/vite/index.d.mts +84 -19
  58. package/dist/build-integrations/vite/index.mjs +203 -28
  59. package/dist/build-integrations/vite/index.mjs.map +1 -1
  60. package/dist/build-integrations/vitest/config.d.mts +20 -2
  61. package/dist/build-integrations/vitest/config.mjs +16 -4
  62. package/dist/build-integrations/vitest/config.mjs.map +1 -1
  63. package/dist/build-integrations/vitest/env.d.mts +18 -10
  64. package/dist/build-integrations/vitest/env.mjs +11 -10
  65. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  66. package/dist/build-integrations/vitest/errors.d.mts +7 -11
  67. package/dist/build-integrations/vitest/errors.mjs +3 -4
  68. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  69. package/dist/build-integrations/vitest/global-setup.d.mts +35 -0
  70. package/dist/build-integrations/vitest/global-setup.mjs +156 -0
  71. package/dist/build-integrations/vitest/global-setup.mjs.map +1 -0
  72. package/dist/build-integrations/vitest/index.d.mts +3 -2
  73. package/dist/build-integrations/vitest/index.mjs +3 -2
  74. package/dist/build-integrations/vitest/setup.mjs +2 -2
  75. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  76. package/dist/build-integrations/vitest/stack-context.d.mts +5 -3
  77. package/dist/build-integrations/vitest/stack-context.mjs +3 -2
  78. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  79. package/dist/cli/bail.mjs.map +1 -1
  80. package/dist/cli/doctor-probes.mjs +1 -3
  81. package/dist/cli/doctor-probes.mjs.map +1 -1
  82. package/dist/cli/main.d.mts +23 -1
  83. package/dist/cli/main.mjs +63 -8
  84. package/dist/cli/main.mjs.map +1 -1
  85. package/dist/cli/prune-direct.mjs.map +1 -1
  86. package/dist/cli/snapshot-reader.mjs.map +1 -1
  87. package/dist/cli/up-lifecycle.mjs.map +1 -1
  88. package/dist/cli/wirings/apply.mjs +28 -21
  89. package/dist/cli/wirings/apply.mjs.map +1 -1
  90. package/dist/cli/wirings/codegen.mjs +108 -0
  91. package/dist/cli/wirings/codegen.mjs.map +1 -0
  92. package/dist/cli/wirings/config-loader.mjs +12 -62
  93. package/dist/cli/wirings/config-loader.mjs.map +1 -1
  94. package/dist/cli/wirings/dump-ids.mjs +86 -0
  95. package/dist/cli/wirings/dump-ids.mjs.map +1 -0
  96. package/dist/cli/wirings/engine-command.mjs +1 -1
  97. package/dist/cli/wirings/engine-command.mjs.map +1 -1
  98. package/dist/cli/wirings/identity.mjs +2 -2
  99. package/dist/cli/wirings/identity.mjs.map +1 -1
  100. package/dist/cli/wirings/provide-file-system.mjs.map +1 -1
  101. package/dist/cli/wirings/read-devstack-version.mjs +17 -0
  102. package/dist/cli/wirings/read-devstack-version.mjs.map +1 -0
  103. package/dist/cli/wirings/snapshot.mjs +27 -34
  104. package/dist/cli/wirings/snapshot.mjs.map +1 -1
  105. package/dist/cli/wirings/up-ipc.mjs +147 -0
  106. package/dist/cli/wirings/up-ipc.mjs.map +1 -0
  107. package/dist/cli/wirings/up.mjs +218 -198
  108. package/dist/cli/wirings/up.mjs.map +1 -1
  109. package/dist/cli/wirings/wipe.mjs +1 -1
  110. package/dist/cli/wirings/wipe.mjs.map +1 -1
  111. package/dist/contracts/chain-probe.d.mts +1 -1
  112. package/dist/contracts/chain-probe.mjs +1 -1
  113. package/dist/contracts/chain-probe.mjs.map +1 -1
  114. package/dist/contracts/codegenable.d.mts +60 -6
  115. package/dist/contracts/codegenable.mjs +28 -0
  116. package/dist/contracts/codegenable.mjs.map +1 -0
  117. package/dist/contracts/config-bindings.mjs +162 -0
  118. package/dist/contracts/config-bindings.mjs.map +1 -0
  119. package/dist/contracts/container-runtime.d.mts +23 -17
  120. package/dist/contracts/plugin-expander.mjs.map +1 -1
  121. package/dist/contracts/snapshotable.d.mts +5 -7
  122. package/dist/contracts/wallet-protocol.d.mts +2 -5
  123. package/dist/contracts/wallet-protocol.mjs +2 -5
  124. package/dist/contracts/wallet-protocol.mjs.map +1 -1
  125. package/dist/index.d.mts +21 -26
  126. package/dist/index.mjs +8 -9
  127. package/dist/orchestrators/boot.d.mts +28 -0
  128. package/dist/orchestrators/boot.mjs +440 -0
  129. package/dist/orchestrators/boot.mjs.map +1 -0
  130. package/dist/orchestrators/codegen/bindings.d.mts +13 -1
  131. package/dist/orchestrators/codegen/bindings.mjs +23 -9
  132. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  133. package/dist/orchestrators/codegen/config-runtime.mjs +208 -0
  134. package/dist/orchestrators/codegen/config-runtime.mjs.map +1 -0
  135. package/dist/orchestrators/codegen/emit.mjs +1 -1
  136. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  137. package/dist/orchestrators/codegen/errors.mjs +21 -1
  138. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  139. package/dist/orchestrators/codegen/format.mjs +2 -0
  140. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  141. package/dist/orchestrators/codegen/gitignore.mjs +30 -11
  142. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/id-config.mjs +107 -0
  144. package/dist/orchestrators/codegen/id-config.mjs.map +1 -0
  145. package/dist/orchestrators/codegen/output-location.mjs +23 -32
  146. package/dist/orchestrators/codegen/output-location.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/paths.mjs +8 -1
  148. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  150. package/dist/orchestrators/codegen/service.mjs +286 -58
  151. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  152. package/dist/orchestrators/layers.mjs +31 -0
  153. package/dist/orchestrators/layers.mjs.map +1 -0
  154. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -1
  155. package/dist/orchestrators/lifecycle-prune/index.mjs +8 -10
  156. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -1
  157. package/dist/orchestrators/network-options.d.mts +52 -0
  158. package/dist/orchestrators/network-options.mjs +43 -0
  159. package/dist/orchestrators/network-options.mjs.map +1 -0
  160. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  161. package/dist/orchestrators/router/cors.mjs.map +1 -1
  162. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  163. package/dist/orchestrators/router/errors.mjs.map +1 -1
  164. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  165. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  166. package/dist/orchestrators/router/profile.mjs +1 -1
  167. package/dist/orchestrators/router/profile.mjs.map +1 -1
  168. package/dist/orchestrators/router/service.d.mts +2 -2
  169. package/dist/orchestrators/router/service.mjs +12 -27
  170. package/dist/orchestrators/router/service.mjs.map +1 -1
  171. package/dist/orchestrators/router/traefik-container.mjs +1 -1
  172. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  173. package/dist/orchestrators/snapshot/capture.mjs +171 -195
  174. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  175. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -1
  176. package/dist/orchestrators/snapshot/descriptor.mjs +53 -11
  177. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  178. package/dist/orchestrators/snapshot/identity-guard.mjs +3 -5
  179. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -1
  180. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +32 -101
  181. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -1
  182. package/dist/orchestrators/snapshot/index.mjs +1 -4
  183. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  184. package/dist/orchestrators/snapshot/interrupted-restore.mjs +116 -0
  185. package/dist/orchestrators/snapshot/interrupted-restore.mjs.map +1 -0
  186. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -1
  187. package/dist/orchestrators/snapshot/prune.mjs +40 -31
  188. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  189. package/dist/orchestrators/snapshot/restore.mjs +221 -196
  190. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  191. package/dist/orchestrators/snapshot/service.mjs +72 -62
  192. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  193. package/dist/orchestrators/snapshot/wipe.mjs +67 -56
  194. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  195. package/dist/plugins/account/codegen.mjs +3 -0
  196. package/dist/plugins/account/codegen.mjs.map +1 -1
  197. package/dist/plugins/account/errors.d.mts +2 -2
  198. package/dist/plugins/account/errors.mjs +1 -4
  199. package/dist/plugins/account/errors.mjs.map +1 -1
  200. package/dist/plugins/account/funding.mjs +3 -27
  201. package/dist/plugins/account/funding.mjs.map +1 -1
  202. package/dist/plugins/account/index.d.mts +3 -8
  203. package/dist/plugins/account/index.mjs +71 -35
  204. package/dist/plugins/account/index.mjs.map +1 -1
  205. package/dist/plugins/account/keypair.d.mts +8 -7
  206. package/dist/plugins/account/keypair.mjs +5 -18
  207. package/dist/plugins/account/keypair.mjs.map +1 -1
  208. package/dist/plugins/account/lease.mjs.map +1 -1
  209. package/dist/plugins/account/registry.d.mts +1 -46
  210. package/dist/plugins/account/registry.mjs.map +1 -1
  211. package/dist/plugins/account/service.d.mts +43 -34
  212. package/dist/plugins/account/service.mjs +9 -54
  213. package/dist/plugins/account/service.mjs.map +1 -1
  214. package/dist/plugins/account/snapshot.mjs.map +1 -1
  215. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -1
  216. package/dist/plugins/account/variants/impersonate.mjs.map +1 -1
  217. package/dist/plugins/account/variants/signer.mjs.map +1 -1
  218. package/dist/plugins/action/discriminator.mjs.map +1 -1
  219. package/dist/plugins/action/errors.mjs +1 -4
  220. package/dist/plugins/action/errors.mjs.map +1 -1
  221. package/dist/plugins/action/execute.mjs +3 -4
  222. package/dist/plugins/action/execute.mjs.map +1 -1
  223. package/dist/plugins/action/index.d.mts +2 -2
  224. package/dist/plugins/action/index.mjs +7 -11
  225. package/dist/plugins/action/index.mjs.map +1 -1
  226. package/dist/plugins/action/service.d.mts +5 -7
  227. package/dist/plugins/action/service.mjs +2 -16
  228. package/dist/plugins/action/service.mjs.map +1 -1
  229. package/dist/plugins/coin/address-resolution.mjs.map +1 -1
  230. package/dist/plugins/coin/codegen.mjs +97 -16
  231. package/dist/plugins/coin/codegen.mjs.map +1 -1
  232. package/dist/plugins/coin/discovery.mjs.map +1 -1
  233. package/dist/plugins/coin/errors.mjs +1 -4
  234. package/dist/plugins/coin/errors.mjs.map +1 -1
  235. package/dist/plugins/coin/index.d.mts +4 -34
  236. package/dist/plugins/coin/index.mjs +47 -28
  237. package/dist/plugins/coin/index.mjs.map +1 -1
  238. package/dist/plugins/coin/metadata.d.mts +1 -0
  239. package/dist/plugins/coin/metadata.mjs +8 -9
  240. package/dist/plugins/coin/metadata.mjs.map +1 -1
  241. package/dist/plugins/coin/mint.mjs +7 -21
  242. package/dist/plugins/coin/mint.mjs.map +1 -1
  243. package/dist/plugins/coin/registry.mjs +33 -20
  244. package/dist/plugins/coin/registry.mjs.map +1 -1
  245. package/dist/plugins/coin/service.d.mts +1 -1
  246. package/dist/plugins/coin/service.mjs +1 -8
  247. package/dist/plugins/coin/service.mjs.map +1 -1
  248. package/dist/plugins/coin/snapshot.mjs.map +1 -1
  249. package/dist/plugins/coin/type-strings.mjs.map +1 -1
  250. package/dist/plugins/dashboard/domain.mjs +106 -167
  251. package/dist/plugins/dashboard/domain.mjs.map +1 -1
  252. package/dist/plugins/dashboard/index.mjs +13 -13
  253. package/dist/plugins/dashboard/index.mjs.map +1 -1
  254. package/dist/plugins/dashboard/origin-policy.mjs +3 -3
  255. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -1
  256. package/dist/plugins/dashboard/routable.mjs.map +1 -1
  257. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -1
  258. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -1
  259. package/dist/plugins/dashboard/schema/root.mjs +23 -44
  260. package/dist/plugins/dashboard/schema/root.mjs.map +1 -1
  261. package/dist/plugins/dashboard/schema/types.mjs +37 -91
  262. package/dist/plugins/dashboard/schema/types.mjs.map +1 -1
  263. package/dist/plugins/dashboard/schema.mjs.map +1 -1
  264. package/dist/plugins/dashboard/server.mjs.map +1 -1
  265. package/dist/plugins/deepbook/codegen.d.mts +12 -11
  266. package/dist/plugins/deepbook/codegen.mjs +108 -11
  267. package/dist/plugins/deepbook/codegen.mjs.map +1 -1
  268. package/dist/plugins/deepbook/deploy.mjs +7 -14
  269. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  270. package/dist/plugins/deepbook/errors.mjs +4 -2
  271. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  272. package/dist/plugins/deepbook/faucet-strategy.mjs +4 -10
  273. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  274. package/dist/plugins/deepbook/hash.mjs.map +1 -1
  275. package/dist/plugins/deepbook/index.d.mts +38 -34
  276. package/dist/plugins/deepbook/index.mjs +133 -64
  277. package/dist/plugins/deepbook/index.mjs.map +1 -1
  278. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -1
  279. package/dist/plugins/deepbook/pyth/index.mjs +4 -8
  280. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  281. package/dist/plugins/deepbook/snapshot.mjs +0 -1
  282. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  283. package/dist/plugins/deepbook/type-strings.mjs.map +1 -1
  284. package/dist/plugins/deepbook/types.d.mts +2 -1
  285. package/dist/plugins/deepbook/types.mjs.map +1 -1
  286. package/dist/plugins/faucet/dispatcher.d.mts +3 -3
  287. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  288. package/dist/plugins/faucet/errors.mjs.map +1 -1
  289. package/dist/plugins/faucet/http.mjs +2 -10
  290. package/dist/plugins/faucet/http.mjs.map +1 -1
  291. package/dist/plugins/faucet/index.mjs +0 -1
  292. package/dist/plugins/faucet/index.mjs.map +1 -1
  293. package/dist/plugins/host-service/errors.d.mts +1 -3
  294. package/dist/plugins/host-service/errors.mjs +1 -2
  295. package/dist/plugins/host-service/errors.mjs.map +1 -1
  296. package/dist/plugins/host-service/index.d.mts +1 -2
  297. package/dist/plugins/host-service/index.mjs +11 -11
  298. package/dist/plugins/host-service/index.mjs.map +1 -1
  299. package/dist/plugins/host-service/routable.mjs.map +1 -1
  300. package/dist/plugins/host-service/service.mjs +13 -13
  301. package/dist/plugins/host-service/service.mjs.map +1 -1
  302. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -1
  303. package/dist/plugins/internal/codegen-helpers.mjs +2 -0
  304. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -1
  305. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -1
  306. package/dist/plugins/{postgres → internal/postgres-sidecar}/connection.mjs +1 -1
  307. package/dist/plugins/internal/postgres-sidecar/connection.mjs.map +1 -0
  308. package/dist/plugins/{postgres → internal/postgres-sidecar}/db-ensure.mjs +30 -16
  309. package/dist/plugins/internal/postgres-sidecar/db-ensure.mjs.map +1 -0
  310. package/dist/plugins/internal/postgres-sidecar/errors.mjs +21 -0
  311. package/dist/plugins/internal/postgres-sidecar/errors.mjs.map +1 -0
  312. package/dist/{substrate/runtime/scoped-multimap → plugins/internal/postgres-sidecar}/index.mjs +1 -0
  313. package/dist/plugins/internal/postgres-sidecar/service.mjs +121 -0
  314. package/dist/plugins/internal/postgres-sidecar/service.mjs.map +1 -0
  315. package/dist/plugins/package/build.mjs +2 -2
  316. package/dist/plugins/package/build.mjs.map +1 -1
  317. package/dist/plugins/package/codegen.d.mts +7 -14
  318. package/dist/plugins/package/codegen.mjs +187 -59
  319. package/dist/plugins/package/codegen.mjs.map +1 -1
  320. package/dist/plugins/package/dep-resolution.mjs +51 -3
  321. package/dist/plugins/package/dep-resolution.mjs.map +1 -1
  322. package/dist/plugins/package/errors.mjs +1 -4
  323. package/dist/plugins/package/errors.mjs.map +1 -1
  324. package/dist/plugins/package/git-source.d.mts +18 -0
  325. package/dist/plugins/package/git-source.mjs +119 -0
  326. package/dist/plugins/package/git-source.mjs.map +1 -0
  327. package/dist/plugins/package/index.d.mts +28 -19
  328. package/dist/plugins/package/index.mjs +107 -32
  329. package/dist/plugins/package/index.mjs.map +1 -1
  330. package/dist/plugins/package/mode-known.mjs +2 -2
  331. package/dist/plugins/package/mode-known.mjs.map +1 -1
  332. package/dist/plugins/package/mode-local.mjs +18 -35
  333. package/dist/plugins/package/mode-local.mjs.map +1 -1
  334. package/dist/plugins/package/publish-executor.mjs +13 -8
  335. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  336. package/dist/plugins/package/publish-output.d.mts +1 -11
  337. package/dist/plugins/package/publish-output.mjs +1 -9
  338. package/dist/plugins/package/publish-output.mjs.map +1 -1
  339. package/dist/plugins/package/registry.d.mts +1 -1
  340. package/dist/plugins/package/registry.mjs +26 -14
  341. package/dist/plugins/package/registry.mjs.map +1 -1
  342. package/dist/plugins/package/service.mjs.map +1 -1
  343. package/dist/plugins/package/snapshot.mjs.map +1 -1
  344. package/dist/plugins/router-entrypoints.mjs +1 -3
  345. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  346. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +1 -2
  347. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  348. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +1 -6
  349. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  350. package/dist/plugins/seal/codegen.d.mts +1 -5
  351. package/dist/plugins/seal/codegen.mjs +83 -12
  352. package/dist/plugins/seal/codegen.mjs.map +1 -1
  353. package/dist/plugins/seal/config-render.mjs +2 -6
  354. package/dist/plugins/seal/config-render.mjs.map +1 -1
  355. package/dist/plugins/seal/deploy.mjs +18 -29
  356. package/dist/plugins/seal/deploy.mjs.map +1 -1
  357. package/dist/plugins/seal/errors.d.mts +4 -5
  358. package/dist/plugins/seal/errors.mjs +1 -8
  359. package/dist/plugins/seal/errors.mjs.map +1 -1
  360. package/dist/plugins/seal/index.d.mts +7 -28
  361. package/dist/plugins/seal/index.mjs +69 -47
  362. package/dist/plugins/seal/index.mjs.map +1 -1
  363. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  364. package/dist/plugins/seal/key-server.mjs +1 -6
  365. package/dist/plugins/seal/key-server.mjs.map +1 -1
  366. package/dist/plugins/seal/keygen.mjs +2 -3
  367. package/dist/plugins/seal/keygen.mjs.map +1 -1
  368. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  369. package/dist/plugins/seal/mode/live.mjs +1 -1
  370. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  371. package/dist/plugins/seal/mode/local-keygen.mjs +4 -10
  372. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  373. package/dist/plugins/seal/plugin-key.mjs.map +1 -1
  374. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  375. package/dist/plugins/seal/routable.mjs.map +1 -1
  376. package/dist/plugins/seal/service.mjs.map +1 -1
  377. package/dist/plugins/seal/snapshot.mjs +1 -2
  378. package/dist/plugins/seal/snapshot.mjs.map +1 -1
  379. package/dist/plugins/sui/auto-tick.mjs +5 -5
  380. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  381. package/dist/plugins/sui/chain-build-container.mjs +2 -2
  382. package/dist/plugins/sui/chain-build-container.mjs.map +1 -1
  383. package/dist/plugins/sui/chain-probe.mjs +4 -4
  384. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  385. package/dist/plugins/sui/codegen.d.mts +9 -7
  386. package/dist/plugins/sui/codegen.mjs +49 -46
  387. package/dist/plugins/sui/codegen.mjs.map +1 -1
  388. package/dist/plugins/sui/errors.d.mts +1 -1
  389. package/dist/plugins/sui/errors.mjs +1 -9
  390. package/dist/plugins/sui/errors.mjs.map +1 -1
  391. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.d.mts +1 -1
  392. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/index.mjs +3 -7
  393. package/dist/plugins/sui/exec/index.mjs.map +1 -0
  394. package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.mjs +1 -1
  395. package/dist/plugins/sui/exec/sign-and-dispatch.mjs.map +1 -0
  396. package/dist/plugins/sui/fork-faucet-strategy.mjs +2 -6
  397. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -1
  398. package/dist/plugins/sui/fork-orchestration.mjs +13 -23
  399. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  400. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  401. package/dist/plugins/sui/index.d.mts +34 -83
  402. package/dist/plugins/sui/index.mjs +200 -68
  403. package/dist/plugins/sui/index.mjs.map +1 -1
  404. package/dist/{substrate/runtime/sui-ledger → plugins/sui/ledger}/object-ref.mjs +1 -1
  405. package/dist/plugins/sui/ledger/object-ref.mjs.map +1 -0
  406. package/dist/plugins/sui/local-faucet-strategy.mjs +1 -5
  407. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -1
  408. package/dist/plugins/sui/log-attrs.mjs +11 -0
  409. package/dist/plugins/sui/log-attrs.mjs.map +1 -0
  410. package/dist/plugins/sui/mode/external.mjs +4 -12
  411. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  412. package/dist/plugins/sui/mode/fork.mjs +19 -16
  413. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  414. package/dist/plugins/sui/mode/live.mjs +4 -17
  415. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  416. package/dist/plugins/sui/mode/local.d.mts +1 -0
  417. package/dist/plugins/sui/mode/local.mjs +203 -61
  418. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  419. package/dist/plugins/sui/mode/shared-boot.mjs +18 -23
  420. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  421. package/dist/plugins/sui/mode/shared.d.mts +6 -7
  422. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  423. package/dist/plugins/sui/mode/spec.d.mts +23 -6
  424. package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.mjs +28 -30
  425. package/dist/plugins/sui/move/index.mjs.map +1 -0
  426. package/dist/plugins/sui/move-summary-runner.mjs +8 -4
  427. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -1
  428. package/dist/{substrate/network.d.mts → plugins/sui/network-config.d.mts} +11 -10
  429. package/dist/plugins/sui/network-resolver.d.mts +6 -6
  430. package/dist/plugins/sui/routable.mjs.map +1 -1
  431. package/dist/plugins/sui/service.mjs +10 -6
  432. package/dist/plugins/sui/service.mjs.map +1 -1
  433. package/dist/plugins/sui/snapshot.mjs +10 -5
  434. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  435. package/dist/plugins/wallet/codegen.d.mts +8 -6
  436. package/dist/plugins/wallet/codegen.mjs +4 -10
  437. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  438. package/dist/plugins/wallet/errors.mjs +1 -4
  439. package/dist/plugins/wallet/errors.mjs.map +1 -1
  440. package/dist/plugins/wallet/index.d.mts +3 -6
  441. package/dist/plugins/wallet/index.mjs +16 -21
  442. package/dist/plugins/wallet/index.mjs.map +1 -1
  443. package/dist/plugins/wallet/origin-policy.mjs +3 -3
  444. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  445. package/dist/plugins/wallet/pairing.mjs +6 -24
  446. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  447. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  448. package/dist/plugins/wallet/routable.mjs.map +1 -1
  449. package/dist/plugins/wallet/server.mjs +17 -24
  450. package/dist/plugins/wallet/server.mjs.map +1 -1
  451. package/dist/plugins/wallet/service.d.mts +2 -2
  452. package/dist/plugins/wallet/service.mjs +4 -15
  453. package/dist/plugins/wallet/service.mjs.map +1 -1
  454. package/dist/plugins/wallet/snapshot.mjs.map +1 -1
  455. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +1 -5
  456. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  457. package/dist/plugins/walrus/codegen.d.mts +2 -13
  458. package/dist/plugins/walrus/codegen.mjs +93 -28
  459. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  460. package/dist/plugins/walrus/deploy-paths.mjs +2 -3
  461. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  462. package/dist/plugins/walrus/deploy.mjs +26 -19
  463. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  464. package/dist/plugins/walrus/errors.mjs +1 -8
  465. package/dist/plugins/walrus/errors.mjs.map +1 -1
  466. package/dist/plugins/walrus/faucet-strategy.mjs +15 -1
  467. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  468. package/dist/plugins/walrus/index.d.mts +13 -44
  469. package/dist/plugins/walrus/index.mjs +119 -122
  470. package/dist/plugins/walrus/index.mjs.map +1 -1
  471. package/dist/plugins/walrus/mode/known-deploy.mjs +6 -6
  472. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  473. package/dist/plugins/walrus/mode/local-cluster.d.mts +2 -2
  474. package/dist/plugins/walrus/mode/local-cluster.mjs +2 -10
  475. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  476. package/dist/plugins/walrus/plugin-key.mjs.map +1 -1
  477. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  478. package/dist/plugins/walrus/routable.mjs.map +1 -1
  479. package/dist/plugins/walrus/service.mjs.map +1 -1
  480. package/dist/plugins/walrus/snapshot.mjs +3 -3
  481. package/dist/plugins/walrus/snapshot.mjs.map +1 -1
  482. package/dist/plugins/walrus/storage-nodes.mjs +53 -14
  483. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  484. package/dist/plugins/walrus/wal-swap.mjs +4 -8
  485. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  486. package/dist/primitives/artifact-publisher.mjs.map +1 -1
  487. package/dist/primitives/cache.d.mts +1 -1
  488. package/dist/runtime/docker/client.mjs +47 -3
  489. package/dist/runtime/docker/client.mjs.map +1 -1
  490. package/dist/runtime/docker/container.mjs +37 -57
  491. package/dist/runtime/docker/container.mjs.map +1 -1
  492. package/dist/runtime/docker/errors.mjs.map +1 -1
  493. package/dist/runtime/docker/exec.mjs +2 -2
  494. package/dist/runtime/docker/exec.mjs.map +1 -1
  495. package/dist/runtime/docker/image.mjs +10 -11
  496. package/dist/runtime/docker/image.mjs.map +1 -1
  497. package/dist/runtime/docker/index.mjs +0 -1
  498. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -1
  499. package/dist/runtime/docker/inventory.mjs +9 -9
  500. package/dist/runtime/docker/inventory.mjs.map +1 -1
  501. package/dist/runtime/docker/labels.mjs +12 -1
  502. package/dist/runtime/docker/labels.mjs.map +1 -1
  503. package/dist/runtime/docker/network.mjs +6 -6
  504. package/dist/runtime/docker/network.mjs.map +1 -1
  505. package/dist/runtime/docker/render-run-args.mjs.map +1 -1
  506. package/dist/runtime/docker/service.mjs +31 -45
  507. package/dist/runtime/docker/service.mjs.map +1 -1
  508. package/dist/runtime/docker/sweep.mjs +14 -64
  509. package/dist/runtime/docker/sweep.mjs.map +1 -1
  510. package/dist/runtime/docker/volume.mjs +1 -1
  511. package/dist/runtime/docker/volume.mjs.map +1 -1
  512. package/dist/runtime/docker/wrap.mjs +14 -2
  513. package/dist/runtime/docker/wrap.mjs.map +1 -1
  514. package/dist/substrate/brand.d.mts +2 -5
  515. package/dist/substrate/brand.mjs +3 -2
  516. package/dist/substrate/brand.mjs.map +1 -1
  517. package/dist/substrate/cross-process.mjs +2 -16
  518. package/dist/substrate/cross-process.mjs.map +1 -1
  519. package/dist/substrate/event-time.mjs +0 -2
  520. package/dist/substrate/event-time.mjs.map +1 -1
  521. package/dist/substrate/events.d.mts +46 -16
  522. package/dist/substrate/identity.d.mts +11 -5
  523. package/dist/substrate/manifest.d.mts +33 -26
  524. package/dist/substrate/manifest.mjs +8 -3
  525. package/dist/substrate/manifest.mjs.map +1 -1
  526. package/dist/substrate/options.d.mts +33 -4
  527. package/dist/substrate/plugin-ctx.d.mts +70 -0
  528. package/dist/substrate/plugin-ctx.mjs +66 -0
  529. package/dist/substrate/plugin-ctx.mjs.map +1 -0
  530. package/dist/substrate/plugin.d.mts +46 -38
  531. package/dist/substrate/plugin.mjs +13 -9
  532. package/dist/substrate/plugin.mjs.map +1 -1
  533. package/dist/substrate/projection.d.mts +1 -1
  534. package/dist/substrate/runtime/atomic-write.mjs +3 -4
  535. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  536. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  537. package/dist/substrate/runtime/cache/service.mjs +50 -20
  538. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  539. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  540. package/dist/substrate/runtime/control-plane/domain.mjs +34 -12
  541. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -1
  542. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -1
  543. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +14 -17
  544. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  545. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  546. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  547. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -1
  548. package/dist/substrate/runtime/cross-process/index.mjs +0 -2
  549. package/dist/substrate/runtime/cross-process/live-clock.mjs +1 -1
  550. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -1
  551. package/dist/substrate/runtime/cross-process/liveness.mjs +11 -18
  552. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  553. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +2 -2
  554. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -1
  555. package/dist/substrate/runtime/cross-process/roster.mjs +17 -127
  556. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  557. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -1
  558. package/dist/substrate/runtime/cross-process/stack-lock.mjs +29 -28
  559. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  560. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  561. package/dist/substrate/runtime/errors.mjs +1 -13
  562. package/dist/substrate/runtime/errors.mjs.map +1 -1
  563. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -1
  564. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -1
  565. package/dist/substrate/runtime/host-gateway.mjs.map +1 -1
  566. package/dist/substrate/runtime/host-tree-tar/index.mjs +15 -163
  567. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  568. package/dist/substrate/runtime/http-probe.d.mts +1 -3
  569. package/dist/substrate/runtime/http-probe.mjs.map +1 -1
  570. package/dist/substrate/runtime/index.mjs +1 -6
  571. package/dist/substrate/runtime/lease-broker/service.mjs +5 -23
  572. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  573. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +3 -3
  574. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  575. package/dist/substrate/runtime/lifecycle/graph-input-id.d.mts +1 -0
  576. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs +133 -0
  577. package/dist/substrate/runtime/lifecycle/graph-input-id.mjs.map +1 -0
  578. package/dist/substrate/runtime/lifecycle/index.mjs +2 -2
  579. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -1
  580. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +22 -1
  581. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  582. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +2 -15
  583. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -1
  584. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +29 -25
  585. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -1
  586. package/dist/substrate/runtime/lifecycle/signals.mjs +1 -1
  587. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  588. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -1
  589. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -1
  590. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +0 -1
  591. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -1
  592. package/dist/substrate/runtime/managed-container.d.mts +5 -1
  593. package/dist/substrate/runtime/managed-container.mjs +8 -10
  594. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  595. package/dist/substrate/runtime/manifest/manifest.mjs +8 -30
  596. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  597. package/dist/substrate/runtime/mode-errors.d.mts +1 -2
  598. package/dist/substrate/runtime/mode-errors.mjs.map +1 -1
  599. package/dist/substrate/runtime/observability/cascade-formatter.mjs +1 -11
  600. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  601. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -1
  602. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  603. package/dist/substrate/runtime/observability/index.mjs +4 -6
  604. package/dist/substrate/runtime/observability/log-attrs.mjs +46 -0
  605. package/dist/substrate/runtime/observability/log-attrs.mjs.map +1 -0
  606. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -1
  607. package/dist/substrate/runtime/observability/logger.mjs +3 -3
  608. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  609. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -1
  610. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  611. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -1
  612. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  613. package/dist/substrate/runtime/observability/subprocess-capture.mjs +2 -2
  614. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -1
  615. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -1
  616. package/dist/substrate/runtime/paths.mjs +27 -9
  617. package/dist/substrate/runtime/paths.mjs.map +1 -1
  618. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -1
  619. package/dist/substrate/runtime/port-broker/service.mjs +10 -27
  620. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  621. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  622. package/dist/substrate/runtime/probes.d.mts +2 -3
  623. package/dist/substrate/runtime/probes.mjs.map +1 -1
  624. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -1
  625. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  626. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  627. package/dist/substrate/runtime/projection/update.mjs +87 -11
  628. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  629. package/dist/substrate/runtime/random-suffix.mjs.map +1 -1
  630. package/dist/substrate/runtime/reconcile/fs-plan.mjs +146 -0
  631. package/dist/substrate/runtime/reconcile/fs-plan.mjs.map +1 -0
  632. package/dist/substrate/runtime/reconcile/graph.mjs +19 -0
  633. package/dist/substrate/runtime/reconcile/graph.mjs.map +1 -0
  634. package/dist/substrate/runtime/reconcile/index.mjs +5 -0
  635. package/dist/substrate/runtime/reconcile/label.mjs +41 -0
  636. package/dist/substrate/runtime/reconcile/label.mjs.map +1 -0
  637. package/dist/substrate/runtime/reconcile/spec.mjs +15 -0
  638. package/dist/substrate/runtime/reconcile/spec.mjs.map +1 -0
  639. package/dist/substrate/runtime/retry-policy.d.mts +2 -3
  640. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  641. package/dist/substrate/runtime/routed-url.mjs.map +1 -1
  642. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  643. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  644. package/dist/substrate/runtime/stage-and-swap/index.mjs +49 -12
  645. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  646. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -1
  647. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  648. package/dist/substrate/runtime/strategy-registry/service.mjs +29 -17
  649. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  650. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -1
  651. package/dist/substrate/runtime/supervisor/acquire-node.mjs +188 -56
  652. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -1
  653. package/dist/substrate/runtime/supervisor/background-tasks.mjs +79 -65
  654. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -1
  655. package/dist/substrate/runtime/supervisor/command-loop.mjs +82 -23
  656. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -1
  657. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs +16 -0
  658. package/dist/substrate/runtime/supervisor/contribution-dispatcher.mjs.map +1 -0
  659. package/dist/substrate/runtime/supervisor/errors.mjs +11 -2
  660. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -1
  661. package/dist/substrate/runtime/supervisor/index.mjs +2 -0
  662. package/dist/substrate/runtime/supervisor/shutdown.mjs +6 -6
  663. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -1
  664. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +60 -70
  665. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -1
  666. package/dist/substrate/runtime/supervisor/state.d.mts +1 -1
  667. package/dist/substrate/runtime/supervisor/state.mjs +1 -1
  668. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -1
  669. package/dist/substrate/runtime/supervisor/teardown.mjs +10 -9
  670. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -1
  671. package/dist/substrate/runtime/supervisor/wiring.mjs +6 -20
  672. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -1
  673. package/dist/substrate/runtime/tar/reader.mjs +216 -0
  674. package/dist/substrate/runtime/tar/reader.mjs.map +1 -0
  675. package/dist/substrate/runtime/typed-env.mjs.map +1 -1
  676. package/dist/substrate/versioned-doc-schema.mjs.map +1 -1
  677. package/dist/substrate/versioned-doc-sync.mjs +5 -5
  678. package/dist/substrate/versioned-doc-sync.mjs.map +1 -1
  679. package/dist/surfaces/cli/command-tree.mjs +49 -7
  680. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  681. package/dist/surfaces/cli/commands/config.mjs +1 -1
  682. package/dist/surfaces/cli/commands/config.mjs.map +1 -1
  683. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -1
  684. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -1
  685. package/dist/surfaces/cli/commands/doctor.mjs +1 -1
  686. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -1
  687. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -1
  688. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  689. package/dist/surfaces/cli/commands/prune.mjs +1 -1
  690. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  691. package/dist/surfaces/cli/commands/snapshot.mjs +1 -1
  692. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -1
  693. package/dist/surfaces/cli/commands/status.mjs +1 -1
  694. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  695. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  696. package/dist/surfaces/cli/commands/wipe.mjs +3 -4
  697. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  698. package/dist/surfaces/cli/envelope.mjs.map +1 -1
  699. package/dist/surfaces/cli/errors.mjs.map +1 -1
  700. package/dist/surfaces/cli/flags.mjs.map +1 -1
  701. package/dist/surfaces/cli/index.mjs +45 -14
  702. package/dist/surfaces/cli/index.mjs.map +1 -1
  703. package/dist/surfaces/cli/output.mjs.map +1 -1
  704. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  705. package/dist/surfaces/tui/app.mjs +0 -21
  706. package/dist/surfaces/tui/app.mjs.map +1 -1
  707. package/dist/surfaces/tui/dashboard.mjs +0 -48
  708. package/dist/surfaces/tui/dashboard.mjs.map +1 -1
  709. package/dist/surfaces/tui/display-derivation.mjs +80 -16
  710. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  711. package/dist/surfaces/tui/errors.mjs.map +1 -1
  712. package/dist/surfaces/tui/event-log.mjs +0 -9
  713. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  714. package/dist/surfaces/tui/heartbeat.mjs.map +1 -1
  715. package/dist/surfaces/tui/index.mjs +2 -2
  716. package/dist/surfaces/tui/index.mjs.map +1 -1
  717. package/dist/surfaces/tui/input.mjs.map +1 -1
  718. package/dist/surfaces/tui/mode-detect.mjs.map +1 -1
  719. package/dist/surfaces/tui/mount-ink.mjs.map +1 -1
  720. package/dist/surfaces/tui/plain-renderer.mjs +26 -19
  721. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  722. package/dist/surfaces/tui/resource-table.mjs +8 -10
  723. package/dist/surfaces/tui/resource-table.mjs.map +1 -1
  724. package/images/postgres/Dockerfile +0 -1
  725. package/images/sui/Dockerfile +27 -54
  726. package/images/sui/entrypoint.sh +17 -179
  727. package/package.json +23 -15
  728. package/dashboard-ui/assets/index-Bmi1UtAg.js +0 -1356
  729. package/dashboard-ui/assets/index-D5EShVt4.js +0 -3
  730. package/dashboard-ui/assets/index-Deml9drg.css +0 -1
  731. package/dist/api/plugin-errors.d.mts +0 -7
  732. package/dist/api/plugin-errors.mjs +0 -10
  733. package/dist/api/plugin-errors.mjs.map +0 -1
  734. package/dist/cli/wirings/build-verb-layers.mjs +0 -42
  735. package/dist/cli/wirings/build-verb-layers.mjs.map +0 -1
  736. package/dist/contracts/capability-decl.d.mts +0 -40
  737. package/dist/orchestrators/built-in-plugin-layers.mjs +0 -54
  738. package/dist/orchestrators/built-in-plugin-layers.mjs.map +0 -1
  739. package/dist/orchestrators/run.mjs +0 -91
  740. package/dist/orchestrators/run.mjs.map +0 -1
  741. package/dist/orchestrators/runtime-composition.d.mts +0 -10
  742. package/dist/orchestrators/runtime-composition.mjs +0 -252
  743. package/dist/orchestrators/runtime-composition.mjs.map +0 -1
  744. package/dist/orchestrators/snapshot/capture-command.d.mts +0 -1
  745. package/dist/orchestrators/snapshot/capture-command.mjs +0 -25
  746. package/dist/orchestrators/snapshot/capture-command.mjs.map +0 -1
  747. package/dist/orchestrators/snapshot/pending-marker.mjs +0 -99
  748. package/dist/orchestrators/snapshot/pending-marker.mjs.map +0 -1
  749. package/dist/orchestrators/snapshot/recover-pending.mjs +0 -223
  750. package/dist/orchestrators/snapshot/recover-pending.mjs.map +0 -1
  751. package/dist/orchestrators/snapshot/state-document.d.mts +0 -1
  752. package/dist/orchestrators/snapshot/state-document.mjs +0 -58
  753. package/dist/orchestrators/snapshot/state-document.mjs.map +0 -1
  754. package/dist/plugins/account/spans.mjs +0 -16
  755. package/dist/plugins/account/spans.mjs.map +0 -1
  756. package/dist/plugins/account/variants/env.mjs +0 -24
  757. package/dist/plugins/account/variants/env.mjs.map +0 -1
  758. package/dist/plugins/account/variants/inline.mjs +0 -13
  759. package/dist/plugins/account/variants/inline.mjs.map +0 -1
  760. package/dist/plugins/account/variants/keystore.mjs +0 -91
  761. package/dist/plugins/account/variants/keystore.mjs.map +0 -1
  762. package/dist/plugins/action/spans.mjs +0 -11
  763. package/dist/plugins/action/spans.mjs.map +0 -1
  764. package/dist/plugins/coin/spans.mjs +0 -20
  765. package/dist/plugins/coin/spans.mjs.map +0 -1
  766. package/dist/plugins/deepbook/spans.mjs +0 -18
  767. package/dist/plugins/deepbook/spans.mjs.map +0 -1
  768. package/dist/plugins/faucet/spans.mjs +0 -12
  769. package/dist/plugins/faucet/spans.mjs.map +0 -1
  770. package/dist/plugins/package/spans.mjs +0 -14
  771. package/dist/plugins/package/spans.mjs.map +0 -1
  772. package/dist/plugins/postgres/codegen.mjs +0 -42
  773. package/dist/plugins/postgres/codegen.mjs.map +0 -1
  774. package/dist/plugins/postgres/connection.d.mts +0 -33
  775. package/dist/plugins/postgres/connection.mjs.map +0 -1
  776. package/dist/plugins/postgres/db-ensure.mjs.map +0 -1
  777. package/dist/plugins/postgres/errors.d.mts +0 -60
  778. package/dist/plugins/postgres/errors.mjs +0 -29
  779. package/dist/plugins/postgres/errors.mjs.map +0 -1
  780. package/dist/plugins/postgres/index.d.mts +0 -37
  781. package/dist/plugins/postgres/index.mjs +0 -68
  782. package/dist/plugins/postgres/index.mjs.map +0 -1
  783. package/dist/plugins/postgres/routable.mjs +0 -33
  784. package/dist/plugins/postgres/routable.mjs.map +0 -1
  785. package/dist/plugins/postgres/service.d.mts +0 -50
  786. package/dist/plugins/postgres/service.mjs +0 -179
  787. package/dist/plugins/postgres/service.mjs.map +0 -1
  788. package/dist/plugins/postgres/snapshot.mjs +0 -32
  789. package/dist/plugins/postgres/snapshot.mjs.map +0 -1
  790. package/dist/plugins/postgres/spans.mjs +0 -11
  791. package/dist/plugins/postgres/spans.mjs.map +0 -1
  792. package/dist/plugins/seal/spans.mjs +0 -18
  793. package/dist/plugins/seal/spans.mjs.map +0 -1
  794. package/dist/plugins/sui/spans.mjs +0 -17
  795. package/dist/plugins/sui/spans.mjs.map +0 -1
  796. package/dist/plugins/wallet/spans.mjs +0 -22
  797. package/dist/plugins/wallet/spans.mjs.map +0 -1
  798. package/dist/plugins/walrus/registry-publish.d.mts +0 -24
  799. package/dist/plugins/walrus/spans.mjs +0 -18
  800. package/dist/plugins/walrus/spans.mjs.map +0 -1
  801. package/dist/runtime/docker/logs.d.mts +0 -1
  802. package/dist/runtime/docker/logs.mjs +0 -34
  803. package/dist/runtime/docker/logs.mjs.map +0 -1
  804. package/dist/substrate/runtime/artifact-publisher/index.mjs +0 -86
  805. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +0 -1
  806. package/dist/substrate/runtime/capability-sinks/index.d.mts +0 -1
  807. package/dist/substrate/runtime/capability-sinks/index.mjs +0 -3
  808. package/dist/substrate/runtime/capability-sinks/layer.d.mts +0 -1
  809. package/dist/substrate/runtime/capability-sinks/layer.mjs +0 -31
  810. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +0 -1
  811. package/dist/substrate/runtime/capability-sinks/service.d.mts +0 -95
  812. package/dist/substrate/runtime/capability-sinks/service.mjs +0 -69
  813. package/dist/substrate/runtime/capability-sinks/service.mjs.map +0 -1
  814. package/dist/substrate/runtime/cross-process/lock.d.mts +0 -1
  815. package/dist/substrate/runtime/cross-process/lock.mjs +0 -23
  816. package/dist/substrate/runtime/cross-process/lock.mjs.map +0 -1
  817. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +0 -113
  818. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +0 -1
  819. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +0 -31
  820. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +0 -1
  821. package/dist/substrate/runtime/observability/formatter-registry.d.mts +0 -1
  822. package/dist/substrate/runtime/observability/formatter-registry.mjs +0 -48
  823. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +0 -1
  824. package/dist/substrate/runtime/observability/span-store.d.mts +0 -1
  825. package/dist/substrate/runtime/observability/span-store.mjs +0 -110
  826. package/dist/substrate/runtime/observability/span-store.mjs.map +0 -1
  827. package/dist/substrate/runtime/observability/spans.d.mts +0 -1
  828. package/dist/substrate/runtime/observability/spans.mjs +0 -87
  829. package/dist/substrate/runtime/observability/spans.mjs.map +0 -1
  830. package/dist/substrate/runtime/projection/index.mjs +0 -4
  831. package/dist/substrate/runtime/projection/persisted.mjs +0 -213
  832. package/dist/substrate/runtime/projection/persisted.mjs.map +0 -1
  833. package/dist/substrate/runtime/scoped-multimap/service.mjs +0 -52
  834. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +0 -1
  835. package/dist/substrate/runtime/scoped-ref-map/index.mjs +0 -2
  836. package/dist/substrate/runtime/scoped-ref-map/service.mjs +0 -83
  837. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +0 -1
  838. package/dist/substrate/runtime/state-store/index.mjs +0 -3
  839. package/dist/substrate/runtime/state-store/schema.d.mts +0 -1
  840. package/dist/substrate/runtime/state-store/schema.mjs +0 -41
  841. package/dist/substrate/runtime/state-store/schema.mjs.map +0 -1
  842. package/dist/substrate/runtime/state-store/service.d.mts +0 -1
  843. package/dist/substrate/runtime/state-store/service.mjs +0 -145
  844. package/dist/substrate/runtime/state-store/service.mjs.map +0 -1
  845. package/dist/substrate/runtime/sui-execute/index.mjs.map +0 -1
  846. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +0 -1
  847. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +0 -1
  848. package/dist/substrate/runtime/sui-move-build/index.mjs.map +0 -1
  849. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +0 -151
  850. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +0 -1
  851. package/dist/substrate/state-store.d.mts +0 -1
  852. /package/dist/orchestrators/{snapshot/pending-marker.d.mts → codegen/id-config.d.mts} +0 -0
  853. /package/dist/orchestrators/snapshot/{recover-pending.d.mts → interrupted-restore.d.mts} +0 -0
  854. /package/dist/{substrate/runtime/sui-execute → plugins/sui/exec}/sign-and-dispatch.d.mts +0 -0
  855. /package/dist/plugins/{postgres/snapshot.d.mts → sui/ledger/object-ref.d.mts} +0 -0
  856. /package/dist/{substrate/runtime/sui-move-build → plugins/sui/move}/index.d.mts +0 -0
  857. /package/dist/substrate/runtime/{state-store/index.d.mts → reconcile/graph.d.mts} +0 -0
  858. /package/dist/substrate/runtime/{cross-process/snapshot-reservation.d.mts → supervisor/contribution-dispatcher.d.mts} +0 -0
@@ -1,179 +0,0 @@
1
- import { ensureManagedContainer } from "../../substrate/runtime/managed-container.mjs";
2
- import { credentialedUrl, plainUrl, withDatabase } from "./connection.mjs";
3
- import { postgresConfigError, postgresPluginError } from "./errors.mjs";
4
- import { PostgresSpans } from "./spans.mjs";
5
- import { awaitReady, ensureDatabases } from "./db-ensure.mjs";
6
- import { Effect } from "effect";
7
- import { createHash } from "node:crypto";
8
- import { fileURLToPath } from "node:url";
9
- //#region src/plugins/postgres/service.ts
10
- const DEFAULT_VERSION = "17-alpine";
11
- const DEFAULT_USER = "devstack";
12
- const DEFAULT_DATABASES = ["devstack"];
13
- const DEFAULT_READY_TIMEOUT_MS = 3e4;
14
- const DEFAULT_STOP_GRACE_SECONDS = 20;
15
- const POSTGRES_PORT = 5432;
16
- /** Deterministic dev password from `(app, stack, stackRoot)`. Tradeoff
17
- * documented in the distilled doc § Postgres-specific concerns:
18
- * fine for a single-user dev tool, foot-gun if `hostPort` is set in
19
- * a multi-user environment. The user-supplied `password` override on
20
- * `PostgresServiceOptions` is the escape hatch.
21
- *
22
- * The short hash + separator disambiguate three collision classes:
23
- * - (app, stack) pairs whose sanitized concatenation would collide
24
- * (e.g. `("my-app", "dev")` vs `("my", "appdev")` both sanitize to
25
- * the same body, but the hash binds the unambiguous boundary).
26
- * - Two checkouts of the SAME `(app, stack)` on the same machine
27
- * (different working directories) — folding `stackRoot` into the
28
- * hash means each checkout's postgres password is distinct. (Note:
29
- * the `pg_isready` liveness probe does NOT authenticate, so this
30
- * does not gate the probe.) The benefit is that the per-checkout
31
- * CREDENTIALED endpoint URL — and any `psql`/`createdb` that
32
- * actually authenticates — differs per checkout, so one checkout's
33
- * connection string cannot silently land on the other's container.
34
- * - The `\x1f` (US, ASCII 31) separator between fields is unambiguous
35
- * because identity strings and absolute paths cannot legally
36
- * contain it. */
37
- const derivePassword = (app, stack, stackRoot) => {
38
- return `pg-${(app + stack).replace(/[^a-zA-Z0-9]/g, "")}-${createHash("sha256").update(`${app}\x1f${stack}\x1f${stackRoot}`).digest("hex").slice(0, 8)}`;
39
- };
40
- const sanitizeAlias = (s) => s.replace(/[^a-zA-Z0-9-]/g, "-");
41
- /** Resolve user-supplied options against defaults + identity-derived
42
- * values. Pure; safe to call before the Effect body runs. */
43
- const resolveOptions = (identity, stackRoot, opts) => {
44
- const name = opts.name ?? "postgres";
45
- const databases = opts.databases ?? DEFAULT_DATABASES;
46
- if (!Array.isArray(databases) || databases.length === 0) throw postgresConfigError({
47
- field: "databases",
48
- message: "postgres(): `databases` must be non-empty"
49
- });
50
- return {
51
- name,
52
- version: opts.version ?? DEFAULT_VERSION,
53
- user: opts.user ?? DEFAULT_USER,
54
- password: opts.password ?? derivePassword(identity.app, identity.stack, stackRoot),
55
- databases,
56
- hostPort: opts.hostPort,
57
- extraNetworks: opts.extraNetworks ?? [],
58
- readyTimeoutMs: opts.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS,
59
- stopGraceSeconds: opts.stopGraceSeconds ?? DEFAULT_STOP_GRACE_SECONDS
60
- };
61
- };
62
- /** Resolve the vendored Dockerfile context path for THIS package.
63
- *
64
- * The build context is the directory containing the Dockerfile
65
- * (`<package>/images/postgres/`). We resolve it relative to this
66
- * source file via `import.meta.url`, which works in both source
67
- * (tsx) and built (.js) form because the layout is preserved.
68
- *
69
- * Distilled doc § Open questions: long-term, this should move to
70
- * the substrate's L1 image-build helper so all plugins resolve
71
- * their build contexts the same way. For now, the resolution is
72
- * local to the plugin. */
73
- const resolveImageContextPath = () => {
74
- const here = new URL(import.meta.url);
75
- return fileURLToPath(new URL("../../../images/postgres/", here));
76
- };
77
- /** Build a `ContainerExec` view bound to a specific container handle.
78
- * Thin adapter from the runtime's contract surface to the plugin's
79
- * local exec seam. The runtime never promotes non-zero exit to
80
- * failure here — the caller (pg_isready retry loop, createdb
81
- * existence-check) decides.
82
- *
83
- * Daemon-level failures (no such container, daemon unreachable)
84
- * surface as a typed `PostgresPluginError({phase: 'container-start'})`
85
- * rather than a fabricated `exitCode: 255` ExecResult. STYLE_GUIDE
86
- * §16 — typed errors must carry the actual failure shape, not lie
87
- * about it being a tx-level non-zero exit. The retry loops in
88
- * `awaitReady` / `ensureDatabase` treat the typed failure as
89
- * retryable via `waitForProbe`'s default retry behavior; the
90
- * underlying cause is preserved on the timeout error's `lastError`
91
- * field for the cause walker. */
92
- const containerExec = (runtime, handle) => ({ run: (argv) => runtime.exec(handle, argv).pipe(Effect.catch((err) => Effect.fail(postgresPluginError("container-start", `runtime.exec failed: ${err.reason} — ${err.detail}`, err)))) });
93
- /** Boot the postgres service. The barrel composes this with the
94
- * capability decls. */
95
- const bootPostgresService = (runtime, identity, stackRoot, opts) => Effect.gen(function* () {
96
- const resolved = yield* Effect.try({
97
- try: () => resolveOptions(identity, stackRoot, opts),
98
- catch: (cause) => cause
99
- });
100
- const networkAlias = sanitizeAlias(`${resolved.name}-${identity.stack}`);
101
- const containerNetwork = sanitizeAlias(`devstack-${identity.app}-${identity.stack}-postgres`);
102
- yield* runtime.ensureNetwork({
103
- name: containerNetwork,
104
- app: identity.app,
105
- stack: identity.stack
106
- }).pipe(Effect.catch((cause) => Effect.fail(postgresPluginError("network-create", `failed to ensure postgres network '${containerNetwork}'`, cause))));
107
- const imageRef = yield* runtime.ensureImage({
108
- contextPath: resolveImageContextPath(),
109
- dockerfile: "Dockerfile",
110
- buildArgs: { POSTGRES_VERSION: resolved.version },
111
- owner: {
112
- app: identity.app,
113
- stack: identity.stack,
114
- plugin: "postgres",
115
- role: "db"
116
- }
117
- }).pipe(Effect.catch((cause) => Effect.fail(postgresPluginError("image-build", `failed to build postgres image (${resolved.version})`, cause))));
118
- const containerHandle = yield* ensureManagedContainer({
119
- runtime,
120
- identity,
121
- plugin: "postgres",
122
- role: resolved.name,
123
- spec: {
124
- name: `${identity.app}-${identity.stack}-${resolved.name}`,
125
- image: imageRef,
126
- recreate: "on-config-change",
127
- env: {
128
- POSTGRES_USER: resolved.user,
129
- POSTGRES_PASSWORD: resolved.password,
130
- POSTGRES_DB: resolved.databases[0]
131
- },
132
- ports: resolved.hostPort !== void 0 ? [{
133
- containerPort: POSTGRES_PORT,
134
- hostPort: resolved.hostPort
135
- }] : void 0,
136
- stopGraceSeconds: resolved.stopGraceSeconds,
137
- networkAttach: [{
138
- name: containerNetwork,
139
- aliases: [networkAlias]
140
- }, ...resolved.extraNetworks]
141
- },
142
- mapError: (cause) => postgresPluginError("container-start", `failed to start postgres container '${resolved.name}'`, cause)
143
- });
144
- const exec = containerExec(runtime, containerHandle);
145
- yield* awaitReady(exec, resolved.user, resolved.databases[0], resolved.readyTimeoutMs);
146
- yield* ensureDatabases(exec, resolved.user, resolved.databases);
147
- const dnsName = `${identity.app}-${identity.stack}-${resolved.name}`;
148
- const endpoint = credentialedUrl({
149
- user: resolved.user,
150
- password: resolved.password,
151
- host: dnsName,
152
- port: POSTGRES_PORT
153
- });
154
- const plainEndpoint = plainUrl(dnsName, POSTGRES_PORT);
155
- return {
156
- resolved,
157
- handle: {
158
- name: resolved.name,
159
- user: resolved.user,
160
- password: resolved.password,
161
- host: dnsName,
162
- port: POSTGRES_PORT,
163
- databases: resolved.databases,
164
- endpoint,
165
- plainEndpoint,
166
- url: (db) => withDatabase(endpoint, db),
167
- containerNetwork,
168
- networkAlias
169
- },
170
- containerHandle
171
- };
172
- }).pipe(Effect.withSpan("devstack.plugin.postgres.boot", { attributes: {
173
- [PostgresSpans.name]: opts.name ?? "postgres",
174
- [PostgresSpans.version]: opts.version ?? DEFAULT_VERSION
175
- } }));
176
- //#endregion
177
- export { bootPostgresService };
178
-
179
- //# sourceMappingURL=service.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.mjs","names":[],"sources":["../../../src/plugins/postgres/service.ts"],"sourcesContent":["// Postgres plugin — service body (real boot).\n//\n// Lifecycle (distilled doc § Lifecycle states):\n// 1. Pre-start: identity (app + stack) resolved, deterministic\n// strings (network name, alias, default password) computed.\n// 2. Per-stack docker network ensured (idempotent; survives the\n// cycle that creates it).\n// 3. Vendored image ensured. The Dockerfile at\n// `<package>/images/postgres/Dockerfile` does ONE thing:\n// `ENV PGDATA=/var/lib/postgresql/data-devstack` so writes land in\n// the container's writable layer rather than the upstream\n// `VOLUME /var/lib/postgresql/data` path (which `docker commit`\n// excludes). This is the single load-bearing invariant for\n// snapshot integrity.\n// 4. Container started with `POSTGRES_USER` / `POSTGRES_PASSWORD` /\n// `POSTGRES_DB` env. Joined to the per-stack network under a\n// deterministic alias. Optional host-port publication.\n// 5. `pg_isready` retry loop runs against the bootstrap database\n// via `runtime.exec`, bounded by `readyTimeoutMs`.\n// 6. Subsequent databases ensured idempotently via `psql -tAc`\n// existence-check + `createdb`.\n// 7. Resolved `Postgres` handle returned. The substrate's outer\n// machinery publishes the manifest projection (plain URL only).\n//\n// What this file does NOT do:\n// - Pause/unpause around `docker commit` — engine-level (snapshot\n// orchestrator walks `managedContainers` labels emitted by\n// `snapshot.ts` and pauses them).\n// - Manage schema migrations or run init SQL — schema is plugin-\n// owned by consumers (distilled doc § Generic database-service\n// requirements: \"no migrations, no init SQL, no schema\n// management\").\n// - Register the stop finalizer — `ContainerRuntime.ensureContainer`\n// owns the container's scope finalizer. The 20s WAL-flush grace is\n// threaded into the container spec so Docker does not escalate busy\n// databases at the runtime default.\n\nimport { Duration, Effect, type Scope } from 'effect';\nimport { createHash } from 'node:crypto';\nimport { fileURLToPath } from 'node:url';\n\nimport type { ContainerHandle, ContainerRuntime } from '../../contracts/container-runtime.ts';\nimport type { Identity } from '../../substrate/identity.ts';\nimport { ensureManagedContainer } from '../../substrate/runtime/managed-container.ts';\nimport {\n\tcredentialedUrl,\n\tplainUrl,\n\twithDatabase,\n\ttype PostgresConnectionParts,\n} from './connection.ts';\nimport { awaitReady, ensureDatabases, type ContainerExec } from './db-ensure.ts';\nimport {\n\tpostgresPluginError,\n\tpostgresConfigError,\n\ttype DatabaseCreateFailed,\n\ttype PostgresConfigError,\n\ttype PostgresConnectionTimeout,\n\ttype PostgresPluginError,\n} from './errors.ts';\nimport { PostgresSpans } from './spans.ts';\n\n/** Resolved Postgres handle — the tag's resolved value.\n *\n * Distilled doc § Outputs: consumers read this to compose\n * `DATABASE_URL` strings. `url(db)` is the per-database composer;\n * `endpoint` is the cluster-level credentialed URL; `plainEndpoint`\n * is the manifest-safe URL (no password). */\nexport interface Postgres {\n\treadonly name: string;\n\treadonly user: string;\n\t/** Credential. Held in-memory on the resolved value; manifest\n\t * projection strips it. Logging convention: never `console.log`\n\t * the entire handle — log `plainEndpoint` instead. */\n\treadonly password: string;\n\treadonly host: string;\n\treadonly port: number;\n\treadonly databases: ReadonlyArray<string>;\n\t/** Cluster-level credentialed URL. */\n\treadonly endpoint: string;\n\t/** Cluster-level no-credentials URL. Manifest-safe. */\n\treadonly plainEndpoint: string;\n\t/** Per-database credentialed URL composer. */\n\treadonly url: (db: string) => string;\n\t/** Per-stack docker network the container is joined to. */\n\treadonly containerNetwork: string;\n\t/** In-network DNS alias siblings dial. */\n\treadonly networkAlias: string;\n}\n\n/** Service options. Defaults track distilled-doc recommendations:\n * postgres 17-alpine is the latest LTS-stable at the time of writing\n * (one major up from the v3 service's 16-alpine pin). */\nexport interface PostgresServiceOptions {\n\treadonly name?: string;\n\treadonly version?: string;\n\treadonly user?: string;\n\treadonly password?: string;\n\treadonly databases?: ReadonlyArray<string>;\n\treadonly hostPort?: number;\n\treadonly extraNetworks?: ReadonlyArray<string>;\n\treadonly readyTimeoutMs?: number;\n\t/** WAL-flush budget on `docker stop`. Default 20s (matches the\n\t * sui-indexer-db sidecar in v3). 10s (docker default) risks\n\t * SIGKILL on busy DBs → recovery mode on next boot. */\n\treadonly stopGraceSeconds?: number;\n}\n\n/** Internal canonicalised options after defaults applied. */\nexport interface ResolvedPostgresOptions {\n\treadonly name: string;\n\treadonly version: string;\n\treadonly user: string;\n\treadonly password: string;\n\treadonly databases: ReadonlyArray<string>;\n\treadonly hostPort: number | undefined;\n\treadonly extraNetworks: ReadonlyArray<string>;\n\treadonly readyTimeoutMs: number;\n\treadonly stopGraceSeconds: number;\n}\n\nconst DEFAULT_VERSION = '17-alpine';\nconst DEFAULT_USER = 'devstack';\nconst DEFAULT_DATABASES = ['devstack'] as const;\nconst DEFAULT_READY_TIMEOUT_MS = 30_000;\nconst DEFAULT_STOP_GRACE_SECONDS = 20;\nconst POSTGRES_PORT = 5432;\n\n/** Deterministic dev password from `(app, stack, stackRoot)`. Tradeoff\n * documented in the distilled doc § Postgres-specific concerns:\n * fine for a single-user dev tool, foot-gun if `hostPort` is set in\n * a multi-user environment. The user-supplied `password` override on\n * `PostgresServiceOptions` is the escape hatch.\n *\n * The short hash + separator disambiguate three collision classes:\n * - (app, stack) pairs whose sanitized concatenation would collide\n * (e.g. `(\"my-app\", \"dev\")` vs `(\"my\", \"appdev\")` both sanitize to\n * the same body, but the hash binds the unambiguous boundary).\n * - Two checkouts of the SAME `(app, stack)` on the same machine\n * (different working directories) — folding `stackRoot` into the\n * hash means each checkout's postgres password is distinct. (Note:\n * the `pg_isready` liveness probe does NOT authenticate, so this\n * does not gate the probe.) The benefit is that the per-checkout\n * CREDENTIALED endpoint URL — and any `psql`/`createdb` that\n * actually authenticates — differs per checkout, so one checkout's\n * connection string cannot silently land on the other's container.\n * - The `\\x1f` (US, ASCII 31) separator between fields is unambiguous\n * because identity strings and absolute paths cannot legally\n * contain it. */\nexport const derivePassword = (app: string, stack: string, stackRoot: string): string => {\n\tconst body = (app + stack).replace(/[^a-zA-Z0-9]/g, '');\n\tconst fingerprint = createHash('sha256')\n\t\t.update(`${app}\\x1f${stack}\\x1f${stackRoot}`)\n\t\t.digest('hex')\n\t\t.slice(0, 8);\n\treturn `pg-${body}-${fingerprint}`;\n};\n\nconst sanitizeAlias = (s: string): string => s.replace(/[^a-zA-Z0-9-]/g, '-');\n\n/** Resolve user-supplied options against defaults + identity-derived\n * values. Pure; safe to call before the Effect body runs. */\nexport const resolveOptions = (\n\tidentity: Identity,\n\tstackRoot: string,\n\topts: PostgresServiceOptions,\n): ResolvedPostgresOptions => {\n\tconst name = opts.name ?? 'postgres';\n\tconst databases = opts.databases ?? DEFAULT_DATABASES;\n\tif (!Array.isArray(databases) || databases.length === 0) {\n\t\tthrow postgresConfigError({\n\t\t\tfield: 'databases',\n\t\t\tmessage: 'postgres(): `databases` must be non-empty',\n\t\t});\n\t}\n\treturn {\n\t\tname,\n\t\tversion: opts.version ?? DEFAULT_VERSION,\n\t\tuser: opts.user ?? DEFAULT_USER,\n\t\tpassword: opts.password ?? derivePassword(identity.app, identity.stack, stackRoot),\n\t\tdatabases,\n\t\thostPort: opts.hostPort,\n\t\textraNetworks: opts.extraNetworks ?? [],\n\t\treadyTimeoutMs: opts.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS,\n\t\tstopGraceSeconds: opts.stopGraceSeconds ?? DEFAULT_STOP_GRACE_SECONDS,\n\t};\n};\n\n/** Bundled boot result for the barrel. The dynamic-capability factory\n * projects resolved options + identity-derived strings onto the\n * snapshot + codegen decls. */\nexport interface PostgresBootResult {\n\treadonly resolved: ResolvedPostgresOptions;\n\treadonly handle: Postgres;\n\treadonly containerHandle: ContainerHandle;\n}\n\n/** Resolve the vendored Dockerfile context path for THIS package.\n *\n * The build context is the directory containing the Dockerfile\n * (`<package>/images/postgres/`). We resolve it relative to this\n * source file via `import.meta.url`, which works in both source\n * (tsx) and built (.js) form because the layout is preserved.\n *\n * Distilled doc § Open questions: long-term, this should move to\n * the substrate's L1 image-build helper so all plugins resolve\n * their build contexts the same way. For now, the resolution is\n * local to the plugin. */\nconst resolveImageContextPath = (): string => {\n\t// `import.meta.url` is the URL of this module file. From\n\t// `<pkg>/src/plugins/postgres/service.ts` we walk up three\n\t// directories (`plugins/`, `src/`, `<pkg>/`) and then down into\n\t// `images/postgres/`.\n\tconst here = new URL(import.meta.url);\n\tconst ctxUrl = new URL('../../../images/postgres/', here);\n\t// `fileURLToPath` handles the platform-specific decode (the\n\t// `file:///C:/...` → `C:\\...` round-trip on Windows, plus\n\t// percent-decoding everywhere). `decodeURIComponent(pathname)`\n\t// would leave the leading `/` on Windows paths.\n\treturn fileURLToPath(ctxUrl);\n};\n\n/** Build a `ContainerExec` view bound to a specific container handle.\n * Thin adapter from the runtime's contract surface to the plugin's\n * local exec seam. The runtime never promotes non-zero exit to\n * failure here — the caller (pg_isready retry loop, createdb\n * existence-check) decides.\n *\n * Daemon-level failures (no such container, daemon unreachable)\n * surface as a typed `PostgresPluginError({phase: 'container-start'})`\n * rather than a fabricated `exitCode: 255` ExecResult. STYLE_GUIDE\n * §16 — typed errors must carry the actual failure shape, not lie\n * about it being a tx-level non-zero exit. The retry loops in\n * `awaitReady` / `ensureDatabase` treat the typed failure as\n * retryable via `waitForProbe`'s default retry behavior; the\n * underlying cause is preserved on the timeout error's `lastError`\n * field for the cause walker. */\nconst containerExec = (runtime: ContainerRuntime, handle: ContainerHandle): ContainerExec => ({\n\trun: (argv) =>\n\t\truntime.exec(handle, argv).pipe(\n\t\t\tEffect.catch((err) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tpostgresPluginError(\n\t\t\t\t\t\t'container-start',\n\t\t\t\t\t\t`runtime.exec failed: ${err.reason} — ${err.detail}`,\n\t\t\t\t\t\terr,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n});\n\n/** Boot the postgres service. The barrel composes this with the\n * capability decls. */\nexport const bootPostgresService = (\n\truntime: ContainerRuntime,\n\tidentity: Identity,\n\tstackRoot: string,\n\topts: PostgresServiceOptions,\n): Effect.Effect<\n\tPostgresBootResult,\n\tPostgresPluginError | PostgresConfigError | PostgresConnectionTimeout | DatabaseCreateFailed,\n\tScope.Scope\n> =>\n\tEffect.gen(function* () {\n\t\tconst resolved = yield* Effect.try({\n\t\t\ttry: () => resolveOptions(identity, stackRoot, opts),\n\t\t\tcatch: (cause) => cause as PostgresConfigError,\n\t\t});\n\n\t\t// Identity-derived strings. The naming pattern must match what\n\t\t// snapshot label-discovery uses — both call sites converge on\n\t\t// `(app, stack, plugin='postgres', role=<name>)`.\n\t\tconst networkAlias = sanitizeAlias(`${resolved.name}-${identity.stack}`);\n\t\tconst containerNetwork = sanitizeAlias(`devstack-${identity.app}-${identity.stack}-postgres`);\n\n\t\t// 1. Ensure the per-stack docker network. Idempotent — no-op\n\t\t// if the network already exists (warm resume).\n\t\tyield* runtime\n\t\t\t.ensureNetwork({\n\t\t\t\tname: containerNetwork,\n\t\t\t\tapp: identity.app,\n\t\t\t\tstack: identity.stack,\n\t\t\t})\n\t\t\t.pipe(\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\tpostgresPluginError(\n\t\t\t\t\t\t\t'network-create',\n\t\t\t\t\t\t\t`failed to ensure postgres network '${containerNetwork}'`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t// 2. Ensure the vendored image. The Dockerfile sets PGDATA off\n\t\t// the upstream VOLUME path so the writable layer captures\n\t\t// PGDATA — the single load-bearing snapshot invariant\n\t\t// (distilled doc § Postgres-specific concerns).\n\t\tconst imageRef = yield* runtime\n\t\t\t.ensureImage({\n\t\t\t\tcontextPath: resolveImageContextPath(),\n\t\t\t\tdockerfile: 'Dockerfile',\n\t\t\t\tbuildArgs: { POSTGRES_VERSION: resolved.version },\n\t\t\t\towner: { app: identity.app, stack: identity.stack, plugin: 'postgres', role: 'db' },\n\t\t\t})\n\t\t\t.pipe(\n\t\t\t\tEffect.catch((cause) =>\n\t\t\t\t\tEffect.fail(\n\t\t\t\t\t\tpostgresPluginError(\n\t\t\t\t\t\t\t'image-build',\n\t\t\t\t\t\t\t`failed to build postgres image (${resolved.version})`,\n\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\n\t\t// 3. Start container. `networkAttach`'s first entry becomes the\n\t\t// `--network` flag on `docker run -d`; subsequent entries\n\t\t// are attached post-start with IP-readback (runtime owns\n\t\t// that detail). The first attach carries the per-network\n\t\t// DNS alias (`networkAlias`) — Docker registers it as a\n\t\t// secondary DNS name on the per-stack network so siblings\n\t\t// can dial by the parallel-stack-stable alias rather than\n\t\t// the per-stack container name.\n\t\tconst containerHandle = yield* ensureManagedContainer({\n\t\t\truntime,\n\t\t\tidentity,\n\t\t\tplugin: 'postgres',\n\t\t\trole: resolved.name,\n\t\t\tspec: {\n\t\t\t\tname: `${identity.app}-${identity.stack}-${resolved.name}`,\n\t\t\t\timage: imageRef,\n\t\t\t\trecreate: 'on-config-change',\n\t\t\t\tenv: {\n\t\t\t\t\tPOSTGRES_USER: resolved.user,\n\t\t\t\t\tPOSTGRES_PASSWORD: resolved.password,\n\t\t\t\t\tPOSTGRES_DB: resolved.databases[0]!,\n\t\t\t\t},\n\t\t\t\tports:\n\t\t\t\t\tresolved.hostPort !== undefined\n\t\t\t\t\t\t? [{ containerPort: POSTGRES_PORT, hostPort: resolved.hostPort }]\n\t\t\t\t\t\t: undefined,\n\t\t\t\tstopGraceSeconds: resolved.stopGraceSeconds,\n\t\t\t\tnetworkAttach: [\n\t\t\t\t\t{ name: containerNetwork, aliases: [networkAlias] },\n\t\t\t\t\t...resolved.extraNetworks,\n\t\t\t\t],\n\t\t\t},\n\t\t\tmapError: (cause) =>\n\t\t\t\tpostgresPluginError(\n\t\t\t\t\t'container-start',\n\t\t\t\t\t`failed to start postgres container '${resolved.name}'`,\n\t\t\t\t\tcause,\n\t\t\t\t),\n\t\t});\n\n\t\t// 4. Probe readiness via `pg_isready` against the bootstrap\n\t\t// database. Server-aware probe — distilled doc § Postgres-\n\t\t// specific concerns: TCP-listener readiness alone is\n\t\t// insufficient (postgres opens the port before accepting\n\t\t// queries).\n\t\tconst exec = containerExec(runtime, containerHandle);\n\t\tyield* awaitReady(exec, resolved.user, resolved.databases[0]!, resolved.readyTimeoutMs);\n\n\t\t// 5. Ensure subsequent databases idempotently. The bootstrap\n\t\t// database (index 0) is image-entrypoint-created via\n\t\t// POSTGRES_DB and skipped by `ensureDatabases`.\n\t\tyield* ensureDatabases(exec, resolved.user, resolved.databases);\n\n\t\t// 6. Resolve the handle. Host for in-stack siblings is the\n\t\t// container DNS name (always resolves on the attached\n\t\t// network). The per-stack `networkAlias` is registered via\n\t\t// `--network-alias` on the primary attach (see step 3) and\n\t\t// is the parallel-stack-portable DNS name; codegen consumes\n\t\t// it through `index.ts`.\n\t\tconst dnsName = `${identity.app}-${identity.stack}-${resolved.name}`;\n\t\tconst parts: PostgresConnectionParts = {\n\t\t\tuser: resolved.user,\n\t\t\tpassword: resolved.password,\n\t\t\thost: dnsName,\n\t\t\tport: POSTGRES_PORT,\n\t\t};\n\t\tconst endpoint = credentialedUrl(parts);\n\t\tconst plainEndpoint = plainUrl(dnsName, POSTGRES_PORT);\n\n\t\tconst handle: Postgres = {\n\t\t\tname: resolved.name,\n\t\t\tuser: resolved.user,\n\t\t\tpassword: resolved.password,\n\t\t\thost: dnsName,\n\t\t\tport: POSTGRES_PORT,\n\t\t\tdatabases: resolved.databases,\n\t\t\tendpoint,\n\t\t\tplainEndpoint,\n\t\t\turl: (db) => withDatabase(endpoint, db),\n\t\t\tcontainerNetwork,\n\t\t\tnetworkAlias,\n\t\t};\n\n\t\treturn { resolved, handle, containerHandle };\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.postgres.boot', {\n\t\t\tattributes: {\n\t\t\t\t[PostgresSpans.name]: opts.name ?? 'postgres',\n\t\t\t\t[PostgresSpans.version]: opts.version ?? DEFAULT_VERSION,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Stop-grace duration. The substrate's finalizer plumbing reads this\n * to set the docker-stop SIGTERM→SIGKILL window. 20s default avoids\n * busy-DB SIGKILL → recovery-mode on next boot. */\nexport const stopGrace = (resolved: ResolvedPostgresOptions): Duration.Duration =>\n\tDuration.seconds(resolved.stopGraceSeconds);\n"],"mappings":";;;;;;;;;AAwHA,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,oBAAoB,CAAC,WAAW;AACtC,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AACnC,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AAuBtB,MAAa,kBAAkB,KAAa,OAAe,cAA8B;AAMxF,QAAO,OALO,MAAM,OAAO,QAAQ,iBAAiB,GAKnC,CAAC,GAJE,WAAW,SAAS,CACtC,OAAO,GAAG,IAAI,MAAM,MAAM,MAAM,YAAY,CAC5C,OAAO,MAAM,CACb,MAAM,GAAG,EACqB;;AAGjC,MAAM,iBAAiB,MAAsB,EAAE,QAAQ,kBAAkB,IAAI;;;AAI7E,MAAa,kBACZ,UACA,WACA,SAC6B;CAC7B,MAAM,OAAO,KAAK,QAAQ;CAC1B,MAAM,YAAY,KAAK,aAAa;AACpC,KAAI,CAAC,MAAM,QAAQ,UAAU,IAAI,UAAU,WAAW,EACrD,OAAM,oBAAoB;EACzB,OAAO;EACP,SAAS;EACT,CAAC;AAEH,QAAO;EACN;EACA,SAAS,KAAK,WAAW;EACzB,MAAM,KAAK,QAAQ;EACnB,UAAU,KAAK,YAAY,eAAe,SAAS,KAAK,SAAS,OAAO,UAAU;EAClF;EACA,UAAU,KAAK;EACf,eAAe,KAAK,iBAAiB,EAAE;EACvC,gBAAgB,KAAK,kBAAkB;EACvC,kBAAkB,KAAK,oBAAoB;EAC3C;;;;;;;;;;;;;AAuBF,MAAM,gCAAwC;CAK7C,MAAM,OAAO,IAAI,IAAI,OAAO,KAAK,IAAI;AAMrC,QAAO,cAAc,IALF,IAAI,6BAA6B,KAKzB,CAAC;;;;;;;;;;;;;;;;;AAkB7B,MAAM,iBAAiB,SAA2B,YAA4C,EAC7F,MAAM,SACL,QAAQ,KAAK,QAAQ,KAAK,CAAC,KAC1B,OAAO,OAAO,QACb,OAAO,KACN,oBACC,mBACA,wBAAwB,IAAI,OAAO,KAAK,IAAI,UAC5C,IACA,CACD,CACD,CACD,EACF;;;AAID,MAAa,uBACZ,SACA,UACA,WACA,SAMA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,OAAO,OAAO,IAAI;EAClC,WAAW,eAAe,UAAU,WAAW,KAAK;EACpD,QAAQ,UAAU;EAClB,CAAC;CAKF,MAAM,eAAe,cAAc,GAAG,SAAS,KAAK,GAAG,SAAS,QAAQ;CACxE,MAAM,mBAAmB,cAAc,YAAY,SAAS,IAAI,GAAG,SAAS,MAAM,WAAW;AAI7F,QAAO,QACL,cAAc;EACd,MAAM;EACN,KAAK,SAAS;EACd,OAAO,SAAS;EAChB,CAAC,CACD,KACA,OAAO,OAAO,UACb,OAAO,KACN,oBACC,kBACA,sCAAsC,iBAAiB,IACvD,MACA,CACD,CACD,CACD;CAMF,MAAM,WAAW,OAAO,QACtB,YAAY;EACZ,aAAa,yBAAyB;EACtC,YAAY;EACZ,WAAW,EAAE,kBAAkB,SAAS,SAAS;EACjD,OAAO;GAAE,KAAK,SAAS;GAAK,OAAO,SAAS;GAAO,QAAQ;GAAY,MAAM;GAAM;EACnF,CAAC,CACD,KACA,OAAO,OAAO,UACb,OAAO,KACN,oBACC,eACA,mCAAmC,SAAS,QAAQ,IACpD,MACA,CACD,CACD,CACD;CAUF,MAAM,kBAAkB,OAAO,uBAAuB;EACrD;EACA;EACA,QAAQ;EACR,MAAM,SAAS;EACf,MAAM;GACL,MAAM,GAAG,SAAS,IAAI,GAAG,SAAS,MAAM,GAAG,SAAS;GACpD,OAAO;GACP,UAAU;GACV,KAAK;IACJ,eAAe,SAAS;IACxB,mBAAmB,SAAS;IAC5B,aAAa,SAAS,UAAU;IAChC;GACD,OACC,SAAS,aAAa,KAAA,IACnB,CAAC;IAAE,eAAe;IAAe,UAAU,SAAS;IAAU,CAAC,GAC/D,KAAA;GACJ,kBAAkB,SAAS;GAC3B,eAAe,CACd;IAAE,MAAM;IAAkB,SAAS,CAAC,aAAa;IAAE,EACnD,GAAG,SAAS,cACZ;GACD;EACD,WAAW,UACV,oBACC,mBACA,uCAAuC,SAAS,KAAK,IACrD,MACA;EACF,CAAC;CAOF,MAAM,OAAO,cAAc,SAAS,gBAAgB;AACpD,QAAO,WAAW,MAAM,SAAS,MAAM,SAAS,UAAU,IAAK,SAAS,eAAe;AAKvF,QAAO,gBAAgB,MAAM,SAAS,MAAM,SAAS,UAAU;CAQ/D,MAAM,UAAU,GAAG,SAAS,IAAI,GAAG,SAAS,MAAM,GAAG,SAAS;CAO9D,MAAM,WAAW,gBAAgB;EALhC,MAAM,SAAS;EACf,UAAU,SAAS;EACnB,MAAM;EACN,MAAM;EAE+B,CAAC;CACvC,MAAM,gBAAgB,SAAS,SAAS,cAAc;AAgBtD,QAAO;EAAE;EAAU,QAAA;GAblB,MAAM,SAAS;GACf,MAAM,SAAS;GACf,UAAU,SAAS;GACnB,MAAM;GACN,MAAM;GACN,WAAW,SAAS;GACpB;GACA;GACA,MAAM,OAAO,aAAa,UAAU,GAAG;GACvC;GACA;GAGwB;EAAE;EAAiB;EAC3C,CAAC,KACF,OAAO,SAAS,iCAAiC,EAChD,YAAY;EACV,cAAc,OAAO,KAAK,QAAQ;EAClC,cAAc,UAAU,KAAK,WAAW;CACzC,EACD,CAAC,CACF"}
@@ -1,32 +0,0 @@
1
- import { Effect } from "effect";
2
- //#region src/plugins/postgres/snapshot.ts
3
- /** Build the Snapshotable contribution.
4
- *
5
- * Container-bearing only; no host-side subtree. Postgres's entire
6
- * state lives in the container's writable layer at the relocated
7
- * `PGDATA` (see `service.ts` for the image build context). */
8
- const makeSnapshotable = (opts) => {
9
- const labels = {
10
- app: opts.app,
11
- stack: opts.stack,
12
- plugin: "postgres",
13
- role: opts.name
14
- };
15
- const identity = {
16
- kind: "postgres-server",
17
- name: opts.name,
18
- databases: Object.freeze([...opts.databases].sort())
19
- };
20
- return {
21
- kind: "snapshotable",
22
- subtrees: [],
23
- managedContainers: [labels],
24
- missingTolerance: "fine",
25
- preRestore: Effect.succeed(identity),
26
- postRestore: Effect.void
27
- };
28
- };
29
- //#endregion
30
- export { makeSnapshotable };
31
-
32
- //# sourceMappingURL=snapshot.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/plugins/postgres/snapshot.ts"],"sourcesContent":["// Postgres plugin — Snapshotable contribution.\n//\n// Architecture §3: the snapshot orchestrator captures and restores\n// without naming the plugin. Postgres's contribution is the\n// container's writable layer — image-commit captures PGDATA only\n// because the vendored image relocates `PGDATA` OFF the upstream\n// `VOLUME /var/lib/postgresql/data` (which docker commit excludes).\n//\n// Identity contribution (distilled doc § Postgres-specific concerns +\n// architecture identity-guard pattern): the postgres \"server\n// identifier\" doubles as a guard. On restore we compare the\n// snapshot's stored postgres identity (server name + the set of\n// requested databases) against the resolver's current answer; if\n// the user pointed at a different cluster shape mid-cycle, the\n// identity-guard refuses BEFORE any destructive mutation.\n//\n// Stop-grace (distilled doc § Postgres-specific concerns): the service\n// threads a 20s Docker stop grace into the container spec, matching the\n// sui-indexer-db sidecar for the same image. This file's `quiesce`\n// Effect is intentionally `Effect.void` (the substrate engine pauses the\n// container around `docker commit`); the plugin only contributes the\n// LABEL TUPLE that lets the engine find it.\n\nimport { Effect } from 'effect';\n\nimport type { ContainerLabelTuple, SnapshotableDecl } from '../../contracts/snapshotable.ts';\n\n/** Identity payload contributed to the substrate's identity-guard.\n * The substrate's pre-restore hook reads this; identity mismatch\n * refuses the restore. Server name + ordered database list is the\n * smallest tuple that distinguishes a postgres instance for snapshot\n * purposes — image tag / version is intentionally NOT part of\n * identity (a minor-version bump should restore cleanly). */\nexport type PostgresIdentityPayload = {\n\treadonly kind: 'postgres-server';\n\treadonly name: string;\n\treadonly databases: ReadonlyArray<string>;\n};\n\nexport interface MakeSnapshotableOptions {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly name: string;\n\treadonly databases: ReadonlyArray<string>;\n}\n\n/** Build the Snapshotable contribution.\n *\n * Container-bearing only; no host-side subtree. Postgres's entire\n * state lives in the container's writable layer at the relocated\n * `PGDATA` (see `service.ts` for the image build context). */\nexport const makeSnapshotable = (opts: MakeSnapshotableOptions): SnapshotableDecl => {\n\tconst labels: ContainerLabelTuple = {\n\t\tapp: opts.app,\n\t\tstack: opts.stack,\n\t\tplugin: 'postgres',\n\t\trole: opts.name,\n\t};\n\n\tconst identity: PostgresIdentityPayload = {\n\t\tkind: 'postgres-server',\n\t\tname: opts.name,\n\t\t// Frozen list so the identity payload is structurally stable\n\t\t// across calls — the substrate hashes it for comparison.\n\t\tdatabases: Object.freeze([...opts.databases].sort()) as ReadonlyArray<string>,\n\t};\n\n\treturn {\n\t\tkind: 'snapshotable',\n\t\t// No host-tree subtree — all state lives in the container.\n\t\tsubtrees: [],\n\t\tmanagedContainers: [labels],\n\t\t// Engine-level pause-around-commit handles quiescence; the\n\t\t// plugin's contribution is just the label tuple above.\n\t\tmissingTolerance: 'fine',\n\t\tpreRestore: Effect.succeed(identity),\n\t\tpostRestore: Effect.void,\n\t};\n};\n"],"mappings":";;;;;;;AAmDA,MAAa,oBAAoB,SAAoD;CACpF,MAAM,SAA8B;EACnC,KAAK,KAAK;EACV,OAAO,KAAK;EACZ,QAAQ;EACR,MAAM,KAAK;EACX;CAED,MAAM,WAAoC;EACzC,MAAM;EACN,MAAM,KAAK;EAGX,WAAW,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,CAAC,MAAM,CAAC;EACpD;AAED,QAAO;EACN,MAAM;EAEN,UAAU,EAAE;EACZ,mBAAmB,CAAC,OAAO;EAG3B,kBAAkB;EAClB,YAAY,OAAO,QAAQ,SAAS;EACpC,aAAa,OAAO;EACpB"}
@@ -1,11 +0,0 @@
1
- //#region src/plugins/postgres/spans.ts
2
- const PostgresSpans = {
3
- database: "postgres.database",
4
- name: "postgres.name",
5
- timeoutMs: "postgres.timeoutMs",
6
- version: "postgres.version"
7
- };
8
- //#endregion
9
- export { PostgresSpans };
10
-
11
- //# sourceMappingURL=spans.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/postgres/spans.ts"],"sourcesContent":["// Postgres plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [PostgresSpans.database]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const PostgresSpans = {\n\tdatabase: 'postgres.database',\n\tname: 'postgres.name',\n\ttimeoutMs: 'postgres.timeoutMs',\n\tversion: 'postgres.version',\n} as const;\n"],"mappings":";AAOA,MAAa,gBAAgB;CAC5B,UAAU;CACV,MAAM;CACN,WAAW;CACX,SAAS;CACT"}
@@ -1,18 +0,0 @@
1
- //#region src/plugins/seal/spans.ts
2
- const SealSpans = {
3
- chain: "seal.chain",
4
- containerName: "seal.containerName",
5
- name: "seal.name",
6
- ref: "seal.ref",
7
- repo: "seal.repo",
8
- routedUrl: "seal.routedUrl",
9
- servicePath: "seal.servicePath",
10
- signer: "seal.signer",
11
- subdir: "seal.subdir",
12
- url: "seal.url",
13
- version: "seal.version"
14
- };
15
- //#endregion
16
- export { SealSpans };
17
-
18
- //# sourceMappingURL=spans.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/seal/spans.ts"],"sourcesContent":["// Seal plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [SealSpans.name]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const SealSpans = {\n\tchain: 'seal.chain',\n\tcontainerName: 'seal.containerName',\n\tname: 'seal.name',\n\tref: 'seal.ref',\n\trepo: 'seal.repo',\n\troutedUrl: 'seal.routedUrl',\n\tservicePath: 'seal.servicePath',\n\tsigner: 'seal.signer',\n\tsubdir: 'seal.subdir',\n\turl: 'seal.url',\n\tversion: 'seal.version',\n} as const;\n"],"mappings":";AAOA,MAAa,YAAY;CACxB,OAAO;CACP,eAAe;CACf,MAAM;CACN,KAAK;CACL,MAAM;CACN,WAAW;CACX,aAAa;CACb,QAAQ;CACR,QAAQ;CACR,KAAK;CACL,SAAS;CACT"}
@@ -1,17 +0,0 @@
1
- //#region src/plugins/sui/spans.ts
2
- const SuiSpans = {
3
- autoTickIntervalMs: "sui.autoTick.intervalMs",
4
- chain: "sui.chain",
5
- container: "sui.container",
6
- localFaucetLeaseKey: "faucet.lease.key",
7
- localFaucetLeaseOwner: "faucet.lease.owner",
8
- forkFaucetWhale: "sui.fork.faucet.whale",
9
- liveFaucetUrl: "sui.live.faucetUrl",
10
- liveNetwork: "sui.live.network",
11
- liveRpcUrl: "sui.live.rpcUrl",
12
- mode: "sui.mode"
13
- };
14
- //#endregion
15
- export { SuiSpans };
16
-
17
- //# sourceMappingURL=spans.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/sui/spans.ts"],"sourcesContent":["// Sui plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [SuiSpans.mode]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const SuiSpans = {\n\tautoTickIntervalMs: 'sui.autoTick.intervalMs',\n\tchain: 'sui.chain',\n\tcontainer: 'sui.container',\n\t// Local-faucet lease-broker serialization keys. Owned here because\n\t// the sui plugin owns the local-faucet container + its lease shape;\n\t// the faucet plugin only sees the strategy dispatch.\n\tlocalFaucetLeaseKey: 'faucet.lease.key',\n\tlocalFaucetLeaseOwner: 'faucet.lease.owner',\n\t// Fork-faucet impersonation source (the \"whale\" address).\n\tforkFaucetWhale: 'sui.fork.faucet.whale',\n\tliveFaucetUrl: 'sui.live.faucetUrl',\n\tliveNetwork: 'sui.live.network',\n\tliveRpcUrl: 'sui.live.rpcUrl',\n\tmode: 'sui.mode',\n} as const;\n"],"mappings":";AAOA,MAAa,WAAW;CACvB,oBAAoB;CACpB,OAAO;CACP,WAAW;CAIX,qBAAqB;CACrB,uBAAuB;CAEvB,iBAAiB;CACjB,eAAe;CACf,aAAa;CACb,YAAY;CACZ,MAAM;CACN"}
@@ -1,22 +0,0 @@
1
- //#region src/plugins/wallet/spans.ts
2
- const WalletSpans = {
3
- accountCount: "wallet.accountCount",
4
- app: "wallet.app",
5
- bearerValid: "wallet.auth.bearerValid",
6
- chain: "wallet.chain",
7
- codegenPairUrl: "wallet.codegen.pairUrl",
8
- codegenWalletUrl: "wallet.codegen.walletUrl",
9
- localPort: "wallet.localPort",
10
- origin: "wallet.origin",
11
- requestId: "wallet.request.id",
12
- requestMethod: "wallet.request.method",
13
- requestUrl: "wallet.request.url",
14
- stack: "wallet.stack",
15
- token: "wallet.token",
16
- tokenFile: "wallet.tokenFile",
17
- url: "wallet.url"
18
- };
19
- //#endregion
20
- export { WalletSpans };
21
-
22
- //# sourceMappingURL=spans.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/wallet/spans.ts"],"sourcesContent":["// Wallet plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [WalletSpans.token]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const WalletSpans = {\n\taccountCount: 'wallet.accountCount',\n\tapp: 'wallet.app',\n\tbearerValid: 'wallet.auth.bearerValid',\n\tchain: 'wallet.chain',\n\tcodegenPairUrl: 'wallet.codegen.pairUrl',\n\tcodegenWalletUrl: 'wallet.codegen.walletUrl',\n\tlocalPort: 'wallet.localPort',\n\torigin: 'wallet.origin',\n\trequestId: 'wallet.request.id',\n\trequestMethod: 'wallet.request.method',\n\trequestUrl: 'wallet.request.url',\n\tstack: 'wallet.stack',\n\ttoken: 'wallet.token',\n\ttokenFile: 'wallet.tokenFile',\n\turl: 'wallet.url',\n} as const;\n"],"mappings":";AAOA,MAAa,cAAc;CAC1B,cAAc;CACd,KAAK;CACL,aAAa;CACb,OAAO;CACP,gBAAgB;CAChB,kBAAkB;CAClB,WAAW;CACX,QAAQ;CACR,WAAW;CACX,eAAe;CACf,YAAY;CACZ,OAAO;CACP,OAAO;CACP,WAAW;CACX,KAAK;CACL"}
@@ -1,24 +0,0 @@
1
- //#region src/plugins/walrus/registry-publish.d.ts
2
- /** Local-cluster's state registry entry. The `name` field is the
3
- * factory's `name` option (default: `'walrus'`); two walrus
4
- * instances in one stack publish under disjoint names. */
5
- interface WalrusLocalStateEntry {
6
- readonly name: string;
7
- readonly systemObjectId: string;
8
- readonly stakingObjectId: string;
9
- readonly walrusPackageId: string;
10
- readonly exchangeObjectId?: string;
11
- }
12
- /** Known-deployment's state registry entry. The `name` is always
13
- * `'walrusKnownDeployment'` (distilled-doc invariant: this factory
14
- * does not vary by user-supplied name). */
15
- interface WalrusKnownStateEntry {
16
- readonly name: 'walrusKnownDeployment';
17
- readonly systemObjectId: string;
18
- readonly stakingObjectId: string;
19
- readonly chain: string;
20
- }
21
- type WalrusStateEntry = WalrusLocalStateEntry | WalrusKnownStateEntry;
22
- //#endregion
23
- export { WalrusKnownStateEntry, WalrusLocalStateEntry, WalrusStateEntry };
24
- //# sourceMappingURL=registry-publish.d.mts.map
@@ -1,18 +0,0 @@
1
- //#region src/plugins/walrus/spans.ts
2
- const WalrusSpans = {
3
- chain: "walrus.chain",
4
- committeeSize: "walrus.committeeSize",
5
- fundAccount: "walrus.fund.account",
6
- fundAddress: "walrus.fund.address",
7
- fundExchange: "walrus.fund.exchange",
8
- name: "walrus.name",
9
- node: "walrus.node",
10
- nodeCount: "walrus.nodeCount",
11
- ref: "walrus.ref",
12
- shards: "walrus.shards",
13
- suiVersion: "walrus.suiVersion"
14
- };
15
- //#endregion
16
- export { WalrusSpans };
17
-
18
- //# sourceMappingURL=spans.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/walrus/spans.ts"],"sourcesContent":["// Walrus plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [WalrusSpans.name]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const WalrusSpans = {\n\tchain: 'walrus.chain',\n\tcommitteeSize: 'walrus.committeeSize',\n\tfundAccount: 'walrus.fund.account',\n\tfundAddress: 'walrus.fund.address',\n\tfundExchange: 'walrus.fund.exchange',\n\tname: 'walrus.name',\n\tnode: 'walrus.node',\n\tnodeCount: 'walrus.nodeCount',\n\tref: 'walrus.ref',\n\tshards: 'walrus.shards',\n\tsuiVersion: 'walrus.suiVersion',\n} as const;\n"],"mappings":";AAOA,MAAa,cAAc;CAC1B,OAAO;CACP,eAAe;CACf,aAAa;CACb,aAAa;CACb,cAAc;CACd,MAAM;CACN,MAAM;CACN,WAAW;CACX,KAAK;CACL,QAAQ;CACR,YAAY;CACZ"}
@@ -1 +0,0 @@
1
- import { Stream } from "effect";
@@ -1,34 +0,0 @@
1
- import { splitUtf8Lines } from "../../substrate/runtime/observability/process-lines.mjs";
2
- import { DockerHost, DockerSpawner, dockerCommand } from "./client.mjs";
3
- import { DaemonUnreachable } from "./errors.mjs";
4
- import { Effect, Stream } from "effect";
5
- //#region src/runtime/docker/logs.ts
6
- /** `docker logs --follow --timestamps <id>` projected to a per-line
7
- * Stream. Combined stdout+stderr (docker writes both to the same
8
- * follow stream).
9
- *
10
- * IMPORTANT: the stream completes when the container exits (docker
11
- * closes the pipe). Consumers that want to re-follow after a restart
12
- * must re-call this. */
13
- const followLogs = (containerNameOrId, opts = {}) => {
14
- const args = ["--follow", "--timestamps"];
15
- if (opts.since !== void 0) args.push("--since", opts.since);
16
- if (opts.tail !== void 0) args.push("--tail", String(opts.tail));
17
- args.push(containerNameOrId);
18
- const mapSpawnError = (cause) => new DaemonUnreachable({
19
- op: "docker.logs",
20
- detail: "logs follow stream failed",
21
- cause
22
- });
23
- return Stream.unwrap(Effect.gen(function* () {
24
- const host = yield* DockerHost;
25
- const spawner = yield* DockerSpawner;
26
- const cmd = dockerCommand(host, "logs", args);
27
- const handle = yield* spawner.spawn(cmd).pipe(Effect.mapError(mapSpawnError));
28
- return splitUtf8Lines(Stream.merge(handle.stdout, handle.stderr)).pipe(Stream.mapError(mapSpawnError));
29
- }));
30
- };
31
- //#endregion
32
- export { followLogs };
33
-
34
- //# sourceMappingURL=logs.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logs.mjs","names":[],"sources":["../../../src/runtime/docker/logs.ts"],"sourcesContent":["// `docker logs --follow` as an Effect Stream.\n//\n// Architecture invariant: per-line `Stream<string, …>` so consumers\n// can filter / promote levels / dedupe followers across hot-restart\n// cycles via the L1 per-line sink.\n//\n// We DON'T solve the process-global follower-dedupe problem here; the\n// supervisor's per-container-key registry is where dedupe lives.\n// This stream is the raw substrate.\n\nimport { Effect, Stream } from 'effect';\n\nimport { splitUtf8Lines } from '../../substrate/runtime/observability/process-lines.ts';\nimport { DockerHost, DockerSpawner } from './client.ts';\nimport { DaemonUnreachable, type DockerRuntimeError } from './errors.ts';\nimport { dockerCommand } from './client.ts';\n\nexport interface FollowLogsOptions {\n\treadonly since?: string;\n\treadonly tail?: number;\n}\n\n/** `docker logs --follow --timestamps <id>` projected to a per-line\n * Stream. Combined stdout+stderr (docker writes both to the same\n * follow stream).\n *\n * IMPORTANT: the stream completes when the container exits (docker\n * closes the pipe). Consumers that want to re-follow after a restart\n * must re-call this. */\nexport const followLogs = (\n\tcontainerNameOrId: string,\n\topts: FollowLogsOptions = {},\n): Stream.Stream<string, DockerRuntimeError, DockerHost | DockerSpawner> => {\n\tconst args: Array<string> = ['--follow', '--timestamps'];\n\tif (opts.since !== undefined) args.push('--since', opts.since);\n\tif (opts.tail !== undefined) args.push('--tail', String(opts.tail));\n\targs.push(containerNameOrId);\n\tconst mapSpawnError = (cause: unknown): DockerRuntimeError =>\n\t\tnew DaemonUnreachable({ op: 'docker.logs', detail: 'logs follow stream failed', cause });\n\treturn Stream.unwrap(\n\t\tEffect.gen(function* () {\n\t\t\tconst host = yield* DockerHost;\n\t\t\tconst spawner = yield* DockerSpawner;\n\t\t\tconst cmd = dockerCommand(host, 'logs', args);\n\t\t\tconst handle = yield* spawner.spawn(cmd).pipe(Effect.mapError(mapSpawnError));\n\t\t\t// Merge stdout + stderr so caller sees the unified follow stream;\n\t\t\t// docker prefixes each line with its source via --timestamps.\n\t\t\tconst lineStream = splitUtf8Lines(Stream.merge(handle.stdout, handle.stderr)).pipe(\n\t\t\t\tStream.mapError(mapSpawnError),\n\t\t\t);\n\t\t\treturn lineStream;\n\t\t}),\n\t);\n};\n\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAa,cACZ,mBACA,OAA0B,EAAE,KAC+C;CAC3E,MAAM,OAAsB,CAAC,YAAY,eAAe;AACxD,KAAI,KAAK,UAAU,KAAA,EAAW,MAAK,KAAK,WAAW,KAAK,MAAM;AAC9D,KAAI,KAAK,SAAS,KAAA,EAAW,MAAK,KAAK,UAAU,OAAO,KAAK,KAAK,CAAC;AACnE,MAAK,KAAK,kBAAkB;CAC5B,MAAM,iBAAiB,UACtB,IAAI,kBAAkB;EAAE,IAAI;EAAe,QAAQ;EAA6B;EAAO,CAAC;AACzF,QAAO,OAAO,OACb,OAAO,IAAI,aAAa;EACvB,MAAM,OAAO,OAAO;EACpB,MAAM,UAAU,OAAO;EACvB,MAAM,MAAM,cAAc,MAAM,QAAQ,KAAK;EAC7C,MAAM,SAAS,OAAO,QAAQ,MAAM,IAAI,CAAC,KAAK,OAAO,SAAS,cAAc,CAAC;AAM7E,SAHmB,eAAe,OAAO,MAAM,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,KAC7E,OAAO,SAAS,cAAc,CAEd;GAChB,CACF"}
@@ -1,86 +0,0 @@
1
- import { SpanAttr } from "../observability/spans.mjs";
2
- import { parseJsonTextSync } from "../runtime-decode.mjs";
3
- import { CacheService } from "../cache/service.mjs";
4
- import "../cache/index.mjs";
5
- import { setCurrentPluginPhase } from "../current-plugin.mjs";
6
- import { Context, Effect, Layer } from "effect";
7
- //#region src/substrate/runtime/artifact-publisher/index.ts
8
- /**
9
- * Substrate-level service projecting the
10
- * `ArtifactPublisher` primitive. Plugins yield this tag in
11
- * their acquire body; the supervisor's `pluginContext` carries it.
12
- *
13
- * The service is constructed once per stack (Layer-driven) and
14
- * closes over the per-stack Cache + StrategyRegistry. Parallel
15
- * stacks isolate by construction — each stack's Layer build is
16
- * independent.
17
- */
18
- var ArtifactPublisherService = class extends Context.Service()("@devstack/substrate/ArtifactPublisher") {};
19
- const encode = (value) => new TextEncoder().encode(JSON.stringify(value));
20
- const decode = (bytes) => {
21
- try {
22
- return parseJsonTextSync(new TextDecoder().decode(bytes), {
23
- source: "artifact-publisher cache payload",
24
- mkError: (issue) => issue
25
- });
26
- } catch {
27
- return null;
28
- }
29
- };
30
- const makePublisher = (cache) => ({ publish: (spec) => Effect.gen(function* () {
31
- yield* Effect.annotateCurrentSpan({
32
- [SpanAttr.artifactPublisherNamespace]: spec.namespace,
33
- [SpanAttr.artifactPublisherChain]: spec.chain,
34
- [SpanAttr.artifactPublisherContentHash]: spec.contentHash
35
- });
36
- const hit = yield* cache.lookup({
37
- namespace: spec.namespace,
38
- chain: spec.chain,
39
- contentHash: spec.contentHash
40
- }).pipe(Effect.catch(() => Effect.succeed(null)));
41
- if (hit !== null) {
42
- const cached = decode(hit.bytes);
43
- if (cached !== null) {
44
- if ((yield* spec.verify(cached)) !== null) {
45
- yield* spec.register(cached);
46
- yield* Effect.annotateCurrentSpan({ [SpanAttr.artifactPublisherPath]: "hit" });
47
- yield* Effect.logDebug(`artifact-publisher: reusing cached '${spec.namespace}' on chain ${spec.chain} (cache hit; no re-deploy).`);
48
- return cached;
49
- }
50
- }
51
- }
52
- if (hit === null) {
53
- yield* Effect.annotateCurrentSpan({ [SpanAttr.artifactPublisherPath]: "miss" });
54
- yield* Effect.logInfo(`artifact-publisher: producing '${spec.namespace}' on chain ${spec.chain} — no cached artifact for this chain + content hash (first deploy on this chain, fresh genesis after a restart, or changed inputs).`);
55
- } else {
56
- yield* Effect.annotateCurrentSpan({ [SpanAttr.artifactPublisherPath]: "verify-failed" });
57
- yield* Effect.logWarning(`artifact-publisher: re-deploying '${spec.namespace}' on chain ${spec.chain} — a cached artifact existed but failed on-chain verification (object missing, or RPC unavailable during restart); a new id will replace the prior deployment.`);
58
- yield* setCurrentPluginPhase(`re-deploying ${spec.namespace} (cached artifact failed verification on restart)`);
59
- }
60
- const produced = yield* spec.produce;
61
- yield* cache.write({
62
- namespace: spec.namespace,
63
- chain: spec.chain,
64
- contentHash: spec.contentHash
65
- }, encode(produced)).pipe(Effect.catch(() => Effect.void));
66
- yield* spec.register(produced);
67
- return produced;
68
- }).pipe(Effect.withSpan("substrate.artifactPublisher.publish")) });
69
- /**
70
- * Layer that materializes the publisher from the substrate's
71
- * Cache service. Plugins yield `ArtifactPublisherService`;
72
- * the supervisor provides it via `pluginContext`.
73
- *
74
- * The publisher is service-name-blind: it reaches `CacheService`
75
- * via the Context, NOT through a hard-coded import edge with any
76
- * plugin. Chain-probe lookup is the caller's concern — the spec's
77
- * `verify` Effect closes over the probe.
78
- */
79
- const layerArtifactPublisher = Layer.effect(ArtifactPublisherService, Effect.gen(function* () {
80
- const cache = yield* CacheService;
81
- return ArtifactPublisherService.of(makePublisher(cache));
82
- }));
83
- //#endregion
84
- export { ArtifactPublisherService, layerArtifactPublisher };
85
-
86
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/substrate/runtime/artifact-publisher/index.ts"],"sourcesContent":["// ArtifactPublisher — substrate-level service.\n//\n// Architecture §10: substrate primitive that orchestrates the\n// `cache → verify → produce → register` cycle every on-chain\n// produce/verify plugin (package, coin, walrus deploy, seal deploy,\n// deepbook deploy, etc.) flows through.\n//\n// Plugins call `publisher.publish(spec)` with their per-cycle\n// `ArtifactSpec<Produced, Verified>` (namespace, chain,\n// contentHash, verify, produce, register). The\n// substrate handles:\n//\n// 1. `cache.lookup({namespace, chain, contentHash})`. Hit AND\n// `spec.verify` returns a non-null value → `register`(decoded\n// cached payload) and return.\n// 2. Miss OR verify-returned-null → run `spec.produce` under the\n// caller's Scope; on success, write the produced payload to\n// the cache (best-effort, errors logged but not propagated);\n// then `register(produced)`.\n//\n// The substrate carries the cache + chain-probe seams via Layers\n// (CacheService, StrategyRegistryService). Plugins yield this\n// service from their acquire body; the supervisor injects it via\n// pluginContext.\n//\n// Cache payload codec: we serialize `Produced` as JSON. The artifact publisher\n// spec doesn't bake a codec in (`Produced` is generic); JSON\n// round-trip matches existing plugin call sites\n// (`CachedPackageEntry`, `CachedMint`, etc. are JSON-shaped).\n\nimport { Context, Effect, Layer, Scope } from 'effect';\n\nimport type {\n\tArtifactPublishError,\n\tArtifactPublisher,\n\tArtifactSpec,\n} from '../../../primitives/artifact-publisher.ts';\nimport { CacheService } from '../cache/index.ts';\nimport { setCurrentPluginPhase } from '../current-plugin.ts';\nimport { SpanAttr } from '../observability/spans.ts';\nimport { parseJsonTextSync } from '../runtime-decode.ts';\n\n// ---------------------------------------------------------------------------\n// Service tag\n// ---------------------------------------------------------------------------\n\n/**\n * Substrate-level service projecting the\n * `ArtifactPublisher` primitive. Plugins yield this tag in\n * their acquire body; the supervisor's `pluginContext` carries it.\n *\n * The service is constructed once per stack (Layer-driven) and\n * closes over the per-stack Cache + StrategyRegistry. Parallel\n * stacks isolate by construction — each stack's Layer build is\n * independent.\n */\nexport class ArtifactPublisherService extends Context.Service<\n\tArtifactPublisherService,\n\tArtifactPublisher\n>()('@devstack/substrate/ArtifactPublisher') {}\n\n// ---------------------------------------------------------------------------\n// Encode / decode the cached payload\n// ---------------------------------------------------------------------------\n\nconst encode = (value: unknown): Uint8Array => new TextEncoder().encode(JSON.stringify(value));\n\nconst decode = <Produced>(bytes: Uint8Array): Produced | null => {\n\ttry {\n\t\treturn parseJsonTextSync(new TextDecoder().decode(bytes), {\n\t\t\tsource: 'artifact-publisher cache payload',\n\t\t\tmkError: (issue) => issue,\n\t\t}) as Produced;\n\t} catch {\n\t\treturn null;\n\t}\n};\n\n// ---------------------------------------------------------------------------\n// Publish: cache → verify → produce → register\n// ---------------------------------------------------------------------------\n\nconst makePublisher = (cache: typeof CacheService.Service): ArtifactPublisher => ({\n\tpublish: <Produced, Verified>(\n\t\tspec: ArtifactSpec<Produced, Verified>,\n\t): Effect.Effect<Produced, ArtifactPublishError, Scope.Scope> =>\n\t\tEffect.gen(function* () {\n\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t[SpanAttr.artifactPublisherNamespace]: spec.namespace,\n\t\t\t\t[SpanAttr.artifactPublisherChain]: spec.chain,\n\t\t\t\t[SpanAttr.artifactPublisherContentHash]: spec.contentHash,\n\t\t\t});\n\n\t\t\t// 1. Cache lookup. Best-effort: a CacheError on lookup\n\t\t\t// surfaces as `cache-corrupt`; the substrate's contract\n\t\t\t// is \"re-produce is always safe\", so we coerce read\n\t\t\t// failures to a miss rather than abort the cycle.\n\t\t\tconst hit = yield* cache\n\t\t\t\t.lookup({\n\t\t\t\t\tnamespace: spec.namespace,\n\t\t\t\t\tchain: spec.chain,\n\t\t\t\t\tcontentHash: spec.contentHash,\n\t\t\t\t})\n\t\t\t\t.pipe(Effect.catch(() => Effect.succeed(null)));\n\n\t\t\tif (hit !== null) {\n\t\t\t\t// Decode the cached `Produced` BEFORE verify so the\n\t\t\t\t// plugin's verify Effect can key its on-chain probe\n\t\t\t\t// off a field of the cached payload (e.g. action's\n\t\t\t\t// `digest`, package's `packageId`). A decode failure\n\t\t\t\t// here is \"cache corruption\" — drop through to\n\t\t\t\t// re-produce so the cycle is still safe.\n\t\t\t\tconst cached = decode<Produced>(hit.bytes);\n\t\t\t\tif (cached !== null) {\n\t\t\t\t\t// 2. Verify (lenient — returns null on transient\n\t\t\t\t\t// failure or not-found). Architecture §10:\n\t\t\t\t\t// verify-on-hit covers chain-state drift.\n\t\t\t\t\tconst verified = yield* spec.verify(cached);\n\t\t\t\t\tif (verified !== null) {\n\t\t\t\t\t\t// The substrate always returns the decoded\n\t\t\t\t\t\t// `Produced` payload — the `Verified` shape is a\n\t\t\t\t\t\t// probe-only signal that never escapes. Callers\n\t\t\t\t\t\t// therefore type-narrow trivially against `Produced`.\n\t\t\t\t\t\tyield* spec.register(cached);\n\t\t\t\t\t\tyield* Effect.annotateCurrentSpan({ [SpanAttr.artifactPublisherPath]: 'hit' });\n\t\t\t\t\t\t// Reuse is the quiet, expected warm-restart path — debug\n\t\t\t\t\t\t// only. The interesting (and noisy) case is a *re-run*,\n\t\t\t\t\t\t// logged below.\n\t\t\t\t\t\tyield* Effect.logDebug(\n\t\t\t\t\t\t\t`artifact-publisher: reusing cached '${spec.namespace}' on chain ${spec.chain} ` +\n\t\t\t\t\t\t\t\t`(cache hit; no re-deploy).`,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn cached;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 3. Miss or verify-failed → produce. State WHEN and WHY loudly:\n\t\t\t// on a restart this is the line that explains why an on-chain\n\t\t\t// id is about to change. A fresh chain genesis misses every\n\t\t\t// cache key (keyed by chain id), so packages / key servers /\n\t\t\t// walrus all get brand-new ids, and content bound to the old\n\t\t\t// ids (e.g. Seal-encrypted blobs) can no longer be resolved.\n\t\t\tif (hit === null) {\n\t\t\t\tyield* Effect.annotateCurrentSpan({ [SpanAttr.artifactPublisherPath]: 'miss' });\n\t\t\t\tyield* Effect.logInfo(\n\t\t\t\t\t`artifact-publisher: producing '${spec.namespace}' on chain ${spec.chain} — ` +\n\t\t\t\t\t\t`no cached artifact for this chain + content hash ` +\n\t\t\t\t\t\t`(first deploy on this chain, fresh genesis after a restart, or changed inputs).`,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tyield* Effect.annotateCurrentSpan({\n\t\t\t\t\t[SpanAttr.artifactPublisherPath]: 'verify-failed',\n\t\t\t\t});\n\t\t\t\tyield* Effect.logWarning(\n\t\t\t\t\t`artifact-publisher: re-deploying '${spec.namespace}' on chain ${spec.chain} — ` +\n\t\t\t\t\t\t`a cached artifact existed but failed on-chain verification ` +\n\t\t\t\t\t\t`(object missing, or RPC unavailable during restart); a new id will replace ` +\n\t\t\t\t\t\t`the prior deployment.`,\n\t\t\t\t);\n\t\t\t\t// Effect logs are dropped under the `up` TUI (Logger.layer([])).\n\t\t\t\t// The verify-failed re-deploy is the anomalous restart case — a\n\t\t\t\t// cached id existed but is no longer resolvable — so narrate it\n\t\t\t\t// on the supervised plugin's row, the channel the TUI renders.\n\t\t\t\t// (A plain cache miss stays quiet here: on a cold boot every\n\t\t\t\t// artifact misses, and the plugin narrates its own publish.)\n\t\t\t\tyield* setCurrentPluginPhase(\n\t\t\t\t\t`re-deploying ${spec.namespace} (cached artifact failed verification on restart)`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst produced = yield* spec.produce;\n\n\t\t\t// 4. Cache write — best-effort. Architecture: a write\n\t\t\t// failure must NOT roll back the on-chain effect.\n\t\t\tyield* cache\n\t\t\t\t.write(\n\t\t\t\t\t{\n\t\t\t\t\t\tnamespace: spec.namespace,\n\t\t\t\t\t\tchain: spec.chain,\n\t\t\t\t\t\tcontentHash: spec.contentHash,\n\t\t\t\t\t},\n\t\t\t\t\tencode(produced),\n\t\t\t\t)\n\t\t\t\t.pipe(Effect.catch(() => Effect.void));\n\n\t\t\t// 5. Register — fires on EVERY cycle (architecture §10).\n\t\t\tyield* spec.register(produced);\n\t\t\treturn produced;\n\t\t}).pipe(Effect.withSpan('substrate.artifactPublisher.publish')),\n});\n\n// ---------------------------------------------------------------------------\n// Layer\n// ---------------------------------------------------------------------------\n\n/**\n * Layer that materializes the publisher from the substrate's\n * Cache service. Plugins yield `ArtifactPublisherService`;\n * the supervisor provides it via `pluginContext`.\n *\n * The publisher is service-name-blind: it reaches `CacheService`\n * via the Context, NOT through a hard-coded import edge with any\n * plugin. Chain-probe lookup is the caller's concern — the spec's\n * `verify` Effect closes over the probe.\n */\nexport const layerArtifactPublisher: Layer.Layer<ArtifactPublisherService, never, CacheService> =\n\tLayer.effect(\n\t\tArtifactPublisherService,\n\t\tEffect.gen(function* () {\n\t\t\tconst cache = yield* CacheService;\n\t\t\treturn ArtifactPublisherService.of(makePublisher(cache));\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;AAwDA,IAAa,2BAAb,cAA8C,QAAQ,SAGnD,CAAC,wCAAwC,CAAC;AAM7C,MAAM,UAAU,UAA+B,IAAI,aAAa,CAAC,OAAO,KAAK,UAAU,MAAM,CAAC;AAE9F,MAAM,UAAoB,UAAuC;AAChE,KAAI;AACH,SAAO,kBAAkB,IAAI,aAAa,CAAC,OAAO,MAAM,EAAE;GACzD,QAAQ;GACR,UAAU,UAAU;GACpB,CAAC;SACK;AACP,SAAO;;;AAQT,MAAM,iBAAiB,WAA2D,EACjF,UACC,SAEA,OAAO,IAAI,aAAa;AACvB,QAAO,OAAO,oBAAoB;GAChC,SAAS,6BAA6B,KAAK;GAC3C,SAAS,yBAAyB,KAAK;GACvC,SAAS,+BAA+B,KAAK;EAC9C,CAAC;CAMF,MAAM,MAAM,OAAO,MACjB,OAAO;EACP,WAAW,KAAK;EAChB,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,CAAC,CACD,KAAK,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC;AAEhD,KAAI,QAAQ,MAAM;EAOjB,MAAM,SAAS,OAAiB,IAAI,MAAM;AAC1C,MAAI,WAAW;QAKV,OADoB,KAAK,OAAO,OAAO,MAC1B,MAAM;AAKtB,WAAO,KAAK,SAAS,OAAO;AAC5B,WAAO,OAAO,oBAAoB,GAAG,SAAS,wBAAwB,OAAO,CAAC;AAI9E,WAAO,OAAO,SACb,uCAAuC,KAAK,UAAU,aAAa,KAAK,MAAM,6BAE9E;AACD,WAAO;;;;AAWV,KAAI,QAAQ,MAAM;AACjB,SAAO,OAAO,oBAAoB,GAAG,SAAS,wBAAwB,QAAQ,CAAC;AAC/E,SAAO,OAAO,QACb,kCAAkC,KAAK,UAAU,aAAa,KAAK,MAAM,qIAGzE;QACK;AACN,SAAO,OAAO,oBAAoB,GAChC,SAAS,wBAAwB,iBAClC,CAAC;AACF,SAAO,OAAO,WACb,qCAAqC,KAAK,UAAU,aAAa,KAAK,MAAM,gKAI5E;AAOD,SAAO,sBACN,gBAAgB,KAAK,UAAU,mDAC/B;;CAEF,MAAM,WAAW,OAAO,KAAK;AAI7B,QAAO,MACL,MACA;EACC,WAAW,KAAK;EAChB,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,EACD,OAAO,SAAS,CAChB,CACA,KAAK,OAAO,YAAY,OAAO,KAAK,CAAC;AAGvC,QAAO,KAAK,SAAS,SAAS;AAC9B,QAAO;EACN,CAAC,KAAK,OAAO,SAAS,sCAAsC,CAAC,EAChE;;;;;;;;;;;AAgBD,MAAa,yBACZ,MAAM,OACL,0BACA,OAAO,IAAI,aAAa;CACvB,MAAM,QAAQ,OAAO;AACrB,QAAO,yBAAyB,GAAG,cAAc,MAAM,CAAC;EACvD,CACF"}
@@ -1 +0,0 @@
1
- import { AnyContribution, CapabilitySink, CapabilitySinksService, CapabilitySinksShape, ContributionKind, ContributionSinkFailed, HarvestContext, UnknownContributionKind } from "./service.mjs";
@@ -1,3 +0,0 @@
1
- import "./service.mjs";
2
- import "./layer.mjs";
3
- export {};
@@ -1 +0,0 @@
1
- import { Context, Layer } from "effect";
@@ -1,31 +0,0 @@
1
- import { CapabilitySinksService, layerCapabilitySinks } from "./service.mjs";
2
- import { FormatterRegistryService, layerFormatterRegistry } from "../observability/formatter-registry.mjs";
3
- import { Effect, Layer } from "effect";
4
- //#region src/substrate/runtime/capability-sinks/layer.ts
5
- const errorContributionSink = (formatters) => ({
6
- kind: "error-contribution",
7
- accept: (contribution, _ctx) => formatters.register(contribution)
8
- });
9
- /**
10
- * Build the substrate's default CapabilitySinks layer. It supplies the
11
- * error-contribution sink and registers the caller's capability sinks
12
- * by kind. Unknown contribution kinds remain no-ops at the supervisor
13
- * call site unless a sink is registered.
14
- *
15
- * Plugin-author extension: provide an additional Layer that yields
16
- * `CapabilitySinksService` and calls `registerSink({ kind: 'my-kind', ... })`
17
- * before the supervisor starts harvesting. Last-write-wins on duplicate
18
- * kinds, with scope-bound restore — the built-in sink comes back when
19
- * the override's scope closes.
20
- */
21
- const layerCapabilitySinksDefault = (orchestrator = []) => {
22
- return Layer.effectDiscard(Effect.gen(function* () {
23
- const sinks = yield* CapabilitySinksService;
24
- const defaults = [errorContributionSink(yield* FormatterRegistryService), ...orchestrator];
25
- for (const sink of defaults) yield* sinks.registerSink(sink);
26
- })).pipe(Layer.provideMerge(layerCapabilitySinks), Layer.provideMerge(layerFormatterRegistry));
27
- };
28
- //#endregion
29
- export { layerCapabilitySinksDefault };
30
-
31
- //# sourceMappingURL=layer.mjs.map