@mysten-incubation/devstack 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (833) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +94 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +13 -0
  4. package/dist/api/define-capabilities.d.mts +25 -0
  5. package/dist/api/define-capabilities.mjs +19 -0
  6. package/dist/api/define-capabilities.mjs.map +1 -0
  7. package/dist/api/define-devstack-with.d.mts +41 -0
  8. package/dist/api/define-devstack-with.mjs +24 -0
  9. package/dist/api/define-devstack-with.mjs.map +1 -0
  10. package/dist/api/define-devstack.d.mts +62 -0
  11. package/dist/api/define-devstack.mjs +108 -0
  12. package/dist/api/define-devstack.mjs.map +1 -0
  13. package/dist/api/define-plugin.d.mts +1 -0
  14. package/dist/api/inference-network.mjs +122 -0
  15. package/dist/api/inference-network.mjs.map +1 -0
  16. package/dist/api/mode-narrowed-factory.d.mts +26 -0
  17. package/dist/api/mode-narrowed-factory.mjs +8 -0
  18. package/dist/api/mode-narrowed-factory.mjs.map +1 -0
  19. package/dist/api/plugin-errors.mjs +10 -0
  20. package/dist/api/plugin-errors.mjs.map +1 -0
  21. package/dist/api/run-stack.d.mts +82 -0
  22. package/dist/api/run-stack.mjs +127 -0
  23. package/dist/api/run-stack.mjs.map +1 -0
  24. package/dist/build-integrations/playwright/config.d.mts +92 -0
  25. package/dist/build-integrations/playwright/config.mjs +71 -0
  26. package/dist/build-integrations/playwright/config.mjs.map +1 -0
  27. package/dist/build-integrations/playwright/errors.d.mts +82 -0
  28. package/dist/build-integrations/playwright/errors.mjs +43 -0
  29. package/dist/build-integrations/playwright/errors.mjs.map +1 -0
  30. package/dist/build-integrations/playwright/global-setup.d.mts +64 -0
  31. package/dist/build-integrations/playwright/global-setup.mjs +44 -0
  32. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -0
  33. package/dist/build-integrations/playwright/index.d.mts +6 -0
  34. package/dist/build-integrations/playwright/index.mjs +6 -0
  35. package/dist/build-integrations/playwright/stack-context.d.mts +95 -0
  36. package/dist/build-integrations/playwright/stack-context.mjs +277 -0
  37. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -0
  38. package/dist/build-integrations/playwright/wallet-context.d.mts +87 -0
  39. package/dist/build-integrations/playwright/wallet-context.mjs +148 -0
  40. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -0
  41. package/dist/build-integrations/runtime/cold-start-url.d.mts +67 -0
  42. package/dist/build-integrations/runtime/cold-start-url.mjs +56 -0
  43. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -0
  44. package/dist/build-integrations/runtime/dapp-kit-slot.mjs +10 -0
  45. package/dist/build-integrations/runtime/dapp-kit-slot.mjs.map +1 -0
  46. package/dist/build-integrations/runtime/discover.d.mts +78 -0
  47. package/dist/build-integrations/runtime/discover.mjs +124 -0
  48. package/dist/build-integrations/runtime/discover.mjs.map +1 -0
  49. package/dist/build-integrations/runtime/endpoint-registry.d.mts +26 -0
  50. package/dist/build-integrations/runtime/endpoint-registry.mjs +41 -0
  51. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -0
  52. package/dist/build-integrations/runtime/errors.d.mts +64 -0
  53. package/dist/build-integrations/runtime/errors.mjs +51 -0
  54. package/dist/build-integrations/runtime/errors.mjs.map +1 -0
  55. package/dist/build-integrations/runtime/index.d.mts +7 -0
  56. package/dist/build-integrations/runtime/index.mjs +6 -0
  57. package/dist/build-integrations/runtime/read-stack-context.d.mts +38 -0
  58. package/dist/build-integrations/runtime/read-stack-context.mjs +130 -0
  59. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -0
  60. package/dist/build-integrations/runtime/stack-context.d.mts +53 -0
  61. package/dist/build-integrations/vitest/config.d.mts +62 -0
  62. package/dist/build-integrations/vitest/config.mjs +80 -0
  63. package/dist/build-integrations/vitest/config.mjs.map +1 -0
  64. package/dist/build-integrations/vitest/env.d.mts +48 -0
  65. package/dist/build-integrations/vitest/env.mjs +50 -0
  66. package/dist/build-integrations/vitest/env.mjs.map +1 -0
  67. package/dist/build-integrations/vitest/errors.d.mts +44 -0
  68. package/dist/build-integrations/vitest/errors.mjs +18 -0
  69. package/dist/build-integrations/vitest/errors.mjs.map +1 -0
  70. package/dist/build-integrations/vitest/index.d.mts +6 -0
  71. package/dist/build-integrations/vitest/index.mjs +6 -0
  72. package/dist/build-integrations/vitest/setup.d.mts +53 -0
  73. package/dist/build-integrations/vitest/setup.mjs +56 -0
  74. package/dist/build-integrations/vitest/setup.mjs.map +1 -0
  75. package/dist/build-integrations/vitest/stack-context.d.mts +58 -0
  76. package/dist/build-integrations/vitest/stack-context.mjs +67 -0
  77. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -0
  78. package/dist/cli/main.d.mts +5 -0
  79. package/dist/cli/main.mjs +586 -0
  80. package/dist/cli/main.mjs.map +1 -0
  81. package/dist/cli/prune-direct.mjs +216 -0
  82. package/dist/cli/prune-direct.mjs.map +1 -0
  83. package/dist/cli/snapshot-reader.mjs +73 -0
  84. package/dist/cli/snapshot-reader.mjs.map +1 -0
  85. package/dist/cli/up-lifecycle.mjs +28 -0
  86. package/dist/cli/up-lifecycle.mjs.map +1 -0
  87. package/dist/contracts/capability-decl.d.mts +42 -0
  88. package/dist/contracts/chain-probe.d.mts +26 -0
  89. package/dist/contracts/chain-probe.mjs +8 -0
  90. package/dist/contracts/chain-probe.mjs.map +1 -0
  91. package/dist/contracts/codegenable.d.mts +43 -0
  92. package/dist/contracts/container-runtime.d.mts +245 -0
  93. package/dist/contracts/liveness-classifier.d.mts +19 -0
  94. package/dist/contracts/network-resolver.d.mts +15 -0
  95. package/dist/contracts/network-resolver.mjs +7 -0
  96. package/dist/contracts/network-resolver.mjs.map +1 -0
  97. package/dist/contracts/projection.d.mts +15 -0
  98. package/dist/contracts/routable.d.mts +53 -0
  99. package/dist/contracts/snapshotable.d.mts +39 -0
  100. package/dist/contracts/strategy-contributor.d.mts +26 -0
  101. package/dist/index.d.mts +89 -0
  102. package/dist/index.mjs +37 -0
  103. package/dist/orchestrators/codegen/bindings.d.mts +2 -0
  104. package/dist/orchestrators/codegen/bindings.mjs +340 -0
  105. package/dist/orchestrators/codegen/bindings.mjs.map +1 -0
  106. package/dist/orchestrators/codegen/emit.mjs +56 -0
  107. package/dist/orchestrators/codegen/emit.mjs.map +1 -0
  108. package/dist/orchestrators/codegen/errors.d.mts +1 -0
  109. package/dist/orchestrators/codegen/errors.mjs +66 -0
  110. package/dist/orchestrators/codegen/errors.mjs.map +1 -0
  111. package/dist/orchestrators/codegen/extras.mjs +16 -0
  112. package/dist/orchestrators/codegen/extras.mjs.map +1 -0
  113. package/dist/orchestrators/codegen/format.mjs +109 -0
  114. package/dist/orchestrators/codegen/format.mjs.map +1 -0
  115. package/dist/orchestrators/codegen/gitignore.mjs +67 -0
  116. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -0
  117. package/dist/orchestrators/codegen/paths.d.mts +1 -0
  118. package/dist/orchestrators/codegen/paths.mjs +33 -0
  119. package/dist/orchestrators/codegen/paths.mjs.map +1 -0
  120. package/dist/orchestrators/codegen/permissions.mjs +6 -0
  121. package/dist/orchestrators/codegen/permissions.mjs.map +1 -0
  122. package/dist/orchestrators/codegen/service.d.mts +1 -0
  123. package/dist/orchestrators/codegen/service.mjs +276 -0
  124. package/dist/orchestrators/codegen/service.mjs.map +1 -0
  125. package/dist/orchestrators/router/cleanup.mjs +58 -0
  126. package/dist/orchestrators/router/cleanup.mjs.map +1 -0
  127. package/dist/orchestrators/router/cors.mjs +31 -0
  128. package/dist/orchestrators/router/cors.mjs.map +1 -0
  129. package/dist/orchestrators/router/entrypoints.d.mts +1 -0
  130. package/dist/orchestrators/router/entrypoints.mjs +80 -0
  131. package/dist/orchestrators/router/entrypoints.mjs.map +1 -0
  132. package/dist/orchestrators/router/errors.d.mts +1 -0
  133. package/dist/orchestrators/router/errors.mjs +103 -0
  134. package/dist/orchestrators/router/errors.mjs.map +1 -0
  135. package/dist/orchestrators/router/file-provider.d.mts +1 -0
  136. package/dist/orchestrators/router/file-provider.mjs +320 -0
  137. package/dist/orchestrators/router/file-provider.mjs.map +1 -0
  138. package/dist/orchestrators/router/hostname.d.mts +1 -0
  139. package/dist/orchestrators/router/hostname.mjs +107 -0
  140. package/dist/orchestrators/router/hostname.mjs.map +1 -0
  141. package/dist/orchestrators/router/index.d.mts +1 -0
  142. package/dist/orchestrators/router/profile.d.mts +1 -0
  143. package/dist/orchestrators/router/profile.mjs +109 -0
  144. package/dist/orchestrators/router/profile.mjs.map +1 -0
  145. package/dist/orchestrators/router/service.d.mts +3 -0
  146. package/dist/orchestrators/router/service.mjs +421 -0
  147. package/dist/orchestrators/router/service.mjs.map +1 -0
  148. package/dist/orchestrators/router/traefik-container.d.mts +1 -0
  149. package/dist/orchestrators/router/traefik-container.mjs +229 -0
  150. package/dist/orchestrators/router/traefik-container.mjs.map +1 -0
  151. package/dist/orchestrators/runtime-composition.d.mts +10 -0
  152. package/dist/orchestrators/runtime-composition.mjs +168 -0
  153. package/dist/orchestrators/runtime-composition.mjs.map +1 -0
  154. package/dist/orchestrators/snapshot/capture.d.mts +1 -0
  155. package/dist/orchestrators/snapshot/capture.mjs +350 -0
  156. package/dist/orchestrators/snapshot/capture.mjs.map +1 -0
  157. package/dist/orchestrators/snapshot/descriptor.d.mts +1 -0
  158. package/dist/orchestrators/snapshot/descriptor.mjs +109 -0
  159. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -0
  160. package/dist/orchestrators/snapshot/identity-guard.d.mts +1 -0
  161. package/dist/orchestrators/snapshot/identity-guard.mjs +132 -0
  162. package/dist/orchestrators/snapshot/identity-guard.mjs.map +1 -0
  163. package/dist/orchestrators/snapshot/image-bundle-tags.mjs +207 -0
  164. package/dist/orchestrators/snapshot/image-bundle-tags.mjs.map +1 -0
  165. package/dist/orchestrators/snapshot/index.d.mts +1 -0
  166. package/dist/orchestrators/snapshot/integrity.d.mts +1 -0
  167. package/dist/orchestrators/snapshot/integrity.mjs +74 -0
  168. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -0
  169. package/dist/orchestrators/snapshot/prune.d.mts +1 -0
  170. package/dist/orchestrators/snapshot/prune.mjs +110 -0
  171. package/dist/orchestrators/snapshot/prune.mjs.map +1 -0
  172. package/dist/orchestrators/snapshot/restore.d.mts +1 -0
  173. package/dist/orchestrators/snapshot/restore.mjs +404 -0
  174. package/dist/orchestrators/snapshot/restore.mjs.map +1 -0
  175. package/dist/orchestrators/snapshot/service.d.mts +1 -0
  176. package/dist/orchestrators/snapshot/service.mjs +296 -0
  177. package/dist/orchestrators/snapshot/service.mjs.map +1 -0
  178. package/dist/orchestrators/snapshot/state-document.mjs +18 -0
  179. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -0
  180. package/dist/orchestrators/snapshot/wipe.d.mts +1 -0
  181. package/dist/orchestrators/snapshot/wipe.mjs +59 -0
  182. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -0
  183. package/dist/plugins/account/codegen.d.mts +12 -0
  184. package/dist/plugins/account/codegen.mjs +22 -0
  185. package/dist/plugins/account/codegen.mjs.map +1 -0
  186. package/dist/plugins/account/errors.d.mts +44 -0
  187. package/dist/plugins/account/errors.mjs +16 -0
  188. package/dist/plugins/account/errors.mjs.map +1 -0
  189. package/dist/plugins/account/funding.d.mts +94 -0
  190. package/dist/plugins/account/funding.mjs +199 -0
  191. package/dist/plugins/account/funding.mjs.map +1 -0
  192. package/dist/plugins/account/index.d.mts +54 -0
  193. package/dist/plugins/account/index.mjs +151 -0
  194. package/dist/plugins/account/index.mjs.map +1 -0
  195. package/dist/plugins/account/keypair.d.mts +32 -0
  196. package/dist/plugins/account/keypair.mjs +99 -0
  197. package/dist/plugins/account/keypair.mjs.map +1 -0
  198. package/dist/plugins/account/lease.mjs +21 -0
  199. package/dist/plugins/account/lease.mjs.map +1 -0
  200. package/dist/plugins/account/registry.d.mts +33 -0
  201. package/dist/plugins/account/registry.mjs +36 -0
  202. package/dist/plugins/account/registry.mjs.map +1 -0
  203. package/dist/plugins/account/service.d.mts +104 -0
  204. package/dist/plugins/account/service.mjs +405 -0
  205. package/dist/plugins/account/service.mjs.map +1 -0
  206. package/dist/plugins/account/snapshot.mjs +33 -0
  207. package/dist/plugins/account/snapshot.mjs.map +1 -0
  208. package/dist/plugins/account/variants/env.mjs +24 -0
  209. package/dist/plugins/account/variants/env.mjs.map +1 -0
  210. package/dist/plugins/account/variants/ephemeral.mjs +72 -0
  211. package/dist/plugins/account/variants/ephemeral.mjs.map +1 -0
  212. package/dist/plugins/account/variants/impersonate.d.mts +16 -0
  213. package/dist/plugins/account/variants/impersonate.mjs +48 -0
  214. package/dist/plugins/account/variants/impersonate.mjs.map +1 -0
  215. package/dist/plugins/account/variants/inline.mjs +13 -0
  216. package/dist/plugins/account/variants/inline.mjs.map +1 -0
  217. package/dist/plugins/account/variants/keystore.mjs +93 -0
  218. package/dist/plugins/account/variants/keystore.mjs.map +1 -0
  219. package/dist/plugins/account/variants/signer.mjs +31 -0
  220. package/dist/plugins/account/variants/signer.mjs.map +1 -0
  221. package/dist/plugins/action/build-context.d.mts +41 -0
  222. package/dist/plugins/action/discriminator.d.mts +20 -0
  223. package/dist/plugins/action/discriminator.mjs +13 -0
  224. package/dist/plugins/action/discriminator.mjs.map +1 -0
  225. package/dist/plugins/action/errors.d.mts +31 -0
  226. package/dist/plugins/action/errors.mjs +13 -0
  227. package/dist/plugins/action/errors.mjs.map +1 -0
  228. package/dist/plugins/action/execute.d.mts +2 -0
  229. package/dist/plugins/action/execute.mjs +145 -0
  230. package/dist/plugins/action/execute.mjs.map +1 -0
  231. package/dist/plugins/action/index.d.mts +56 -0
  232. package/dist/plugins/action/index.mjs +82 -0
  233. package/dist/plugins/action/index.mjs.map +1 -0
  234. package/dist/plugins/action/service.d.mts +26 -0
  235. package/dist/plugins/action/service.mjs +84 -0
  236. package/dist/plugins/action/service.mjs.map +1 -0
  237. package/dist/plugins/coin/address-resolution.d.mts +34 -0
  238. package/dist/plugins/coin/address-resolution.mjs +80 -0
  239. package/dist/plugins/coin/address-resolution.mjs.map +1 -0
  240. package/dist/plugins/coin/codegen.d.mts +16 -0
  241. package/dist/plugins/coin/codegen.mjs +21 -0
  242. package/dist/plugins/coin/codegen.mjs.map +1 -0
  243. package/dist/plugins/coin/discovery.d.mts +26 -0
  244. package/dist/plugins/coin/discovery.mjs +112 -0
  245. package/dist/plugins/coin/discovery.mjs.map +1 -0
  246. package/dist/plugins/coin/errors.d.mts +48 -0
  247. package/dist/plugins/coin/errors.mjs +13 -0
  248. package/dist/plugins/coin/errors.mjs.map +1 -0
  249. package/dist/plugins/coin/index.d.mts +95 -0
  250. package/dist/plugins/coin/index.mjs +172 -0
  251. package/dist/plugins/coin/index.mjs.map +1 -0
  252. package/dist/plugins/coin/metadata.d.mts +15 -0
  253. package/dist/plugins/coin/metadata.mjs +99 -0
  254. package/dist/plugins/coin/metadata.mjs.map +1 -0
  255. package/dist/plugins/coin/mint.d.mts +34 -0
  256. package/dist/plugins/coin/mint.mjs +164 -0
  257. package/dist/plugins/coin/mint.mjs.map +1 -0
  258. package/dist/plugins/coin/registry.d.mts +1 -0
  259. package/dist/plugins/coin/registry.mjs +37 -0
  260. package/dist/plugins/coin/registry.mjs.map +1 -0
  261. package/dist/plugins/coin/service.d.mts +47 -0
  262. package/dist/plugins/coin/service.mjs +51 -0
  263. package/dist/plugins/coin/service.mjs.map +1 -0
  264. package/dist/plugins/coin/snapshot.mjs +19 -0
  265. package/dist/plugins/coin/snapshot.mjs.map +1 -0
  266. package/dist/plugins/coin/type-strings.mjs +49 -0
  267. package/dist/plugins/coin/type-strings.mjs.map +1 -0
  268. package/dist/plugins/deepbook/codegen.d.mts +39 -0
  269. package/dist/plugins/deepbook/codegen.mjs +15 -0
  270. package/dist/plugins/deepbook/codegen.mjs.map +1 -0
  271. package/dist/plugins/deepbook/deploy.mjs +437 -0
  272. package/dist/plugins/deepbook/deploy.mjs.map +1 -0
  273. package/dist/plugins/deepbook/errors.d.mts +29 -0
  274. package/dist/plugins/deepbook/errors.mjs +26 -0
  275. package/dist/plugins/deepbook/errors.mjs.map +1 -0
  276. package/dist/plugins/deepbook/faucet-strategy.d.mts +8 -0
  277. package/dist/plugins/deepbook/faucet-strategy.mjs +81 -0
  278. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -0
  279. package/dist/plugins/deepbook/index.d.mts +171 -0
  280. package/dist/plugins/deepbook/index.mjs +359 -0
  281. package/dist/plugins/deepbook/index.mjs.map +1 -0
  282. package/dist/plugins/deepbook/plugin-key.mjs +7 -0
  283. package/dist/plugins/deepbook/plugin-key.mjs.map +1 -0
  284. package/dist/plugins/deepbook/pyth/index.mjs +226 -0
  285. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -0
  286. package/dist/plugins/deepbook/routable.mjs +21 -0
  287. package/dist/plugins/deepbook/routable.mjs.map +1 -0
  288. package/dist/plugins/deepbook/snapshot.mjs +49 -0
  289. package/dist/plugins/deepbook/snapshot.mjs.map +1 -0
  290. package/dist/plugins/deepbook/types.d.mts +125 -0
  291. package/dist/plugins/deepbook/types.mjs +12 -0
  292. package/dist/plugins/deepbook/types.mjs.map +1 -0
  293. package/dist/plugins/faucet/dispatcher.d.mts +9 -0
  294. package/dist/plugins/faucet/dispatcher.mjs +13 -0
  295. package/dist/plugins/faucet/dispatcher.mjs.map +1 -0
  296. package/dist/plugins/faucet/errors.d.mts +86 -0
  297. package/dist/plugins/faucet/errors.mjs +19 -0
  298. package/dist/plugins/faucet/errors.mjs.map +1 -0
  299. package/dist/plugins/faucet/http.mjs +127 -0
  300. package/dist/plugins/faucet/http.mjs.map +1 -0
  301. package/dist/plugins/faucet/index.d.mts +43 -0
  302. package/dist/plugins/faucet/index.mjs +42 -0
  303. package/dist/plugins/faucet/index.mjs.map +1 -0
  304. package/dist/plugins/faucet/service.d.mts +20 -0
  305. package/dist/plugins/faucet/strategies/sui-local.d.mts +23 -0
  306. package/dist/plugins/faucet/strategies/sui-local.mjs +29 -0
  307. package/dist/plugins/faucet/strategies/sui-local.mjs.map +1 -0
  308. package/dist/plugins/host-service/errors.d.mts +27 -0
  309. package/dist/plugins/host-service/errors.mjs +14 -0
  310. package/dist/plugins/host-service/errors.mjs.map +1 -0
  311. package/dist/plugins/host-service/index.d.mts +10 -0
  312. package/dist/plugins/host-service/index.mjs +48 -0
  313. package/dist/plugins/host-service/index.mjs.map +1 -0
  314. package/dist/plugins/host-service/routable.mjs +24 -0
  315. package/dist/plugins/host-service/routable.mjs.map +1 -0
  316. package/dist/plugins/host-service/service.d.mts +49 -0
  317. package/dist/plugins/host-service/service.mjs +375 -0
  318. package/dist/plugins/host-service/service.mjs.map +1 -0
  319. package/dist/plugins/package/build.d.mts +1 -0
  320. package/dist/plugins/package/build.mjs +24 -0
  321. package/dist/plugins/package/build.mjs.map +1 -0
  322. package/dist/plugins/package/codegen.d.mts +19 -0
  323. package/dist/plugins/package/codegen.mjs +41 -0
  324. package/dist/plugins/package/codegen.mjs.map +1 -0
  325. package/dist/plugins/package/dep-resolution.mjs +10 -0
  326. package/dist/plugins/package/dep-resolution.mjs.map +1 -0
  327. package/dist/plugins/package/errors.d.mts +34 -0
  328. package/dist/plugins/package/errors.mjs +13 -0
  329. package/dist/plugins/package/errors.mjs.map +1 -0
  330. package/dist/plugins/package/index.d.mts +109 -0
  331. package/dist/plugins/package/index.mjs +207 -0
  332. package/dist/plugins/package/index.mjs.map +1 -0
  333. package/dist/plugins/package/mode-known.mjs +41 -0
  334. package/dist/plugins/package/mode-known.mjs.map +1 -0
  335. package/dist/plugins/package/mode-local.d.mts +1 -0
  336. package/dist/plugins/package/mode-local.mjs +183 -0
  337. package/dist/plugins/package/mode-local.mjs.map +1 -0
  338. package/dist/plugins/package/publish-executor.mjs +202 -0
  339. package/dist/plugins/package/publish-executor.mjs.map +1 -0
  340. package/dist/plugins/package/publish-output.d.mts +28 -0
  341. package/dist/plugins/package/publish-output.mjs +45 -0
  342. package/dist/plugins/package/publish-output.mjs.map +1 -0
  343. package/dist/plugins/package/registry.d.mts +25 -0
  344. package/dist/plugins/package/registry.mjs +30 -0
  345. package/dist/plugins/package/registry.mjs.map +1 -0
  346. package/dist/plugins/package/service.mjs +20 -0
  347. package/dist/plugins/package/service.mjs.map +1 -0
  348. package/dist/plugins/package/snapshot.mjs +25 -0
  349. package/dist/plugins/package/snapshot.mjs.map +1 -0
  350. package/dist/plugins/postgres/codegen.mjs +42 -0
  351. package/dist/plugins/postgres/codegen.mjs.map +1 -0
  352. package/dist/plugins/postgres/connection.d.mts +33 -0
  353. package/dist/plugins/postgres/connection.mjs +19 -0
  354. package/dist/plugins/postgres/connection.mjs.map +1 -0
  355. package/dist/plugins/postgres/db-ensure.mjs +100 -0
  356. package/dist/plugins/postgres/db-ensure.mjs.map +1 -0
  357. package/dist/plugins/postgres/errors.d.mts +55 -0
  358. package/dist/plugins/postgres/errors.mjs +29 -0
  359. package/dist/plugins/postgres/errors.mjs.map +1 -0
  360. package/dist/plugins/postgres/index.d.mts +37 -0
  361. package/dist/plugins/postgres/index.mjs +75 -0
  362. package/dist/plugins/postgres/index.mjs.map +1 -0
  363. package/dist/plugins/postgres/routable.mjs +33 -0
  364. package/dist/plugins/postgres/routable.mjs.map +1 -0
  365. package/dist/plugins/postgres/service.d.mts +50 -0
  366. package/dist/plugins/postgres/service.mjs +145 -0
  367. package/dist/plugins/postgres/service.mjs.map +1 -0
  368. package/dist/plugins/postgres/snapshot.d.mts +1 -0
  369. package/dist/plugins/postgres/snapshot.mjs +32 -0
  370. package/dist/plugins/postgres/snapshot.mjs.map +1 -0
  371. package/dist/plugins/router-entrypoints.mjs +21 -0
  372. package/dist/plugins/router-entrypoints.mjs.map +1 -0
  373. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +59 -0
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -0
  375. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +132 -0
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -0
  377. package/dist/plugins/seal/codegen.d.mts +19 -0
  378. package/dist/plugins/seal/codegen.mjs +16 -0
  379. package/dist/plugins/seal/codegen.mjs.map +1 -0
  380. package/dist/plugins/seal/config-render.mjs +82 -0
  381. package/dist/plugins/seal/config-render.mjs.map +1 -0
  382. package/dist/plugins/seal/deploy.mjs +198 -0
  383. package/dist/plugins/seal/deploy.mjs.map +1 -0
  384. package/dist/plugins/seal/errors.d.mts +52 -0
  385. package/dist/plugins/seal/errors.mjs +19 -0
  386. package/dist/plugins/seal/errors.mjs.map +1 -0
  387. package/dist/plugins/seal/index.d.mts +161 -0
  388. package/dist/plugins/seal/index.mjs +235 -0
  389. package/dist/plugins/seal/index.mjs.map +1 -0
  390. package/dist/plugins/seal/key-manager.d.mts +22 -0
  391. package/dist/plugins/seal/key-manager.mjs +22 -0
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -0
  393. package/dist/plugins/seal/key-server.mjs +175 -0
  394. package/dist/plugins/seal/key-server.mjs.map +1 -0
  395. package/dist/plugins/seal/keygen.mjs +96 -0
  396. package/dist/plugins/seal/keygen.mjs.map +1 -0
  397. package/dist/plugins/seal/mode/fork-known.d.mts +8 -0
  398. package/dist/plugins/seal/mode/fork-known.mjs +23 -0
  399. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -0
  400. package/dist/plugins/seal/mode/live.d.mts +18 -0
  401. package/dist/plugins/seal/mode/live.mjs +64 -0
  402. package/dist/plugins/seal/mode/live.mjs.map +1 -0
  403. package/dist/plugins/seal/mode/local-keygen.mjs +180 -0
  404. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -0
  405. package/dist/plugins/seal/plugin-key.mjs +7 -0
  406. package/dist/plugins/seal/plugin-key.mjs.map +1 -0
  407. package/dist/plugins/seal/registry-publish.d.mts +43 -0
  408. package/dist/plugins/seal/registry-publish.mjs +9 -0
  409. package/dist/plugins/seal/registry-publish.mjs.map +1 -0
  410. package/dist/plugins/seal/routable.mjs +57 -0
  411. package/dist/plugins/seal/routable.mjs.map +1 -0
  412. package/dist/plugins/seal/service.mjs +17 -0
  413. package/dist/plugins/seal/service.mjs.map +1 -0
  414. package/dist/plugins/seal/snapshot.mjs +51 -0
  415. package/dist/plugins/seal/snapshot.mjs.map +1 -0
  416. package/dist/plugins/sui/auto-tick.mjs +45 -0
  417. package/dist/plugins/sui/auto-tick.mjs.map +1 -0
  418. package/dist/plugins/sui/chain-build-container.d.mts +1 -0
  419. package/dist/plugins/sui/chain-probe.d.mts +85 -0
  420. package/dist/plugins/sui/chain-probe.mjs +104 -0
  421. package/dist/plugins/sui/chain-probe.mjs.map +1 -0
  422. package/dist/plugins/sui/codegen.d.mts +14 -0
  423. package/dist/plugins/sui/codegen.mjs +26 -0
  424. package/dist/plugins/sui/codegen.mjs.map +1 -0
  425. package/dist/plugins/sui/errors.d.mts +74 -0
  426. package/dist/plugins/sui/errors.mjs +28 -0
  427. package/dist/plugins/sui/errors.mjs.map +1 -0
  428. package/dist/plugins/sui/fork-orchestration.mjs +24 -0
  429. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -0
  430. package/dist/plugins/sui/fork-transaction.mjs +96 -0
  431. package/dist/plugins/sui/fork-transaction.mjs.map +1 -0
  432. package/dist/plugins/sui/index.d.mts +318 -0
  433. package/dist/plugins/sui/index.mjs +182 -0
  434. package/dist/plugins/sui/index.mjs.map +1 -0
  435. package/dist/plugins/sui/mode/external.mjs +60 -0
  436. package/dist/plugins/sui/mode/external.mjs.map +1 -0
  437. package/dist/plugins/sui/mode/fork.mjs +283 -0
  438. package/dist/plugins/sui/mode/fork.mjs.map +1 -0
  439. package/dist/plugins/sui/mode/live.mjs +103 -0
  440. package/dist/plugins/sui/mode/live.mjs.map +1 -0
  441. package/dist/plugins/sui/mode/local.mjs +293 -0
  442. package/dist/plugins/sui/mode/local.mjs.map +1 -0
  443. package/dist/plugins/sui/mode/shared-boot.mjs +254 -0
  444. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -0
  445. package/dist/plugins/sui/mode/shared.d.mts +103 -0
  446. package/dist/plugins/sui/mode/shared.mjs +12 -0
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -0
  448. package/dist/plugins/sui/mode/spec.d.mts +94 -0
  449. package/dist/plugins/sui/network-resolver.d.mts +23 -0
  450. package/dist/plugins/sui/routable.mjs +88 -0
  451. package/dist/plugins/sui/routable.mjs.map +1 -0
  452. package/dist/plugins/sui/seed-objects.d.mts +18 -0
  453. package/dist/plugins/sui/seed-objects.mjs +25 -0
  454. package/dist/plugins/sui/seed-objects.mjs.map +1 -0
  455. package/dist/plugins/sui/service.mjs +38 -0
  456. package/dist/plugins/sui/service.mjs.map +1 -0
  457. package/dist/plugins/sui/snapshot.mjs +53 -0
  458. package/dist/plugins/sui/snapshot.mjs.map +1 -0
  459. package/dist/plugins/wallet/codegen.d.mts +33 -0
  460. package/dist/plugins/wallet/codegen.mjs +34 -0
  461. package/dist/plugins/wallet/codegen.mjs.map +1 -0
  462. package/dist/plugins/wallet/errors.d.mts +66 -0
  463. package/dist/plugins/wallet/errors.mjs +16 -0
  464. package/dist/plugins/wallet/errors.mjs.map +1 -0
  465. package/dist/plugins/wallet/index.d.mts +63 -0
  466. package/dist/plugins/wallet/index.mjs +126 -0
  467. package/dist/plugins/wallet/index.mjs.map +1 -0
  468. package/dist/plugins/wallet/origin-policy.d.mts +1 -0
  469. package/dist/plugins/wallet/origin-policy.mjs +65 -0
  470. package/dist/plugins/wallet/origin-policy.mjs.map +1 -0
  471. package/dist/plugins/wallet/pairing.d.mts +11 -0
  472. package/dist/plugins/wallet/pairing.mjs +125 -0
  473. package/dist/plugins/wallet/pairing.mjs.map +1 -0
  474. package/dist/plugins/wallet/protocol.d.mts +1 -0
  475. package/dist/plugins/wallet/protocol.mjs +96 -0
  476. package/dist/plugins/wallet/protocol.mjs.map +1 -0
  477. package/dist/plugins/wallet/routable.mjs +32 -0
  478. package/dist/plugins/wallet/routable.mjs.map +1 -0
  479. package/dist/plugins/wallet/server.d.mts +12 -0
  480. package/dist/plugins/wallet/server.mjs +317 -0
  481. package/dist/plugins/wallet/server.mjs.map +1 -0
  482. package/dist/plugins/wallet/service.d.mts +68 -0
  483. package/dist/plugins/wallet/service.mjs +97 -0
  484. package/dist/plugins/wallet/service.mjs.map +1 -0
  485. package/dist/plugins/wallet/snapshot.d.mts +1 -0
  486. package/dist/plugins/wallet/snapshot.mjs +14 -0
  487. package/dist/plugins/wallet/snapshot.mjs.map +1 -0
  488. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +42 -0
  489. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -0
  490. package/dist/plugins/walrus/codegen.d.mts +38 -0
  491. package/dist/plugins/walrus/codegen.mjs +34 -0
  492. package/dist/plugins/walrus/codegen.mjs.map +1 -0
  493. package/dist/plugins/walrus/deploy-paths.mjs +14 -0
  494. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -0
  495. package/dist/plugins/walrus/deploy.d.mts +1 -0
  496. package/dist/plugins/walrus/deploy.mjs +224 -0
  497. package/dist/plugins/walrus/deploy.mjs.map +1 -0
  498. package/dist/plugins/walrus/errors.d.mts +38 -0
  499. package/dist/plugins/walrus/errors.mjs +26 -0
  500. package/dist/plugins/walrus/errors.mjs.map +1 -0
  501. package/dist/plugins/walrus/faucet-strategy.d.mts +12 -0
  502. package/dist/plugins/walrus/faucet-strategy.mjs +62 -0
  503. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -0
  504. package/dist/plugins/walrus/index.d.mts +177 -0
  505. package/dist/plugins/walrus/index.mjs +284 -0
  506. package/dist/plugins/walrus/index.mjs.map +1 -0
  507. package/dist/plugins/walrus/mode/known-deploy.d.mts +25 -0
  508. package/dist/plugins/walrus/mode/known-deploy.mjs +71 -0
  509. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -0
  510. package/dist/plugins/walrus/mode/local-cluster.d.mts +34 -0
  511. package/dist/plugins/walrus/mode/local-cluster.mjs +153 -0
  512. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -0
  513. package/dist/plugins/walrus/plugin-key.mjs +7 -0
  514. package/dist/plugins/walrus/plugin-key.mjs.map +1 -0
  515. package/dist/plugins/walrus/registry-publish.d.mts +24 -0
  516. package/dist/plugins/walrus/registry-publish.mjs +7 -0
  517. package/dist/plugins/walrus/registry-publish.mjs.map +1 -0
  518. package/dist/plugins/walrus/routable.mjs +99 -0
  519. package/dist/plugins/walrus/routable.mjs.map +1 -0
  520. package/dist/plugins/walrus/service.mjs +20 -0
  521. package/dist/plugins/walrus/service.mjs.map +1 -0
  522. package/dist/plugins/walrus/snapshot.mjs +53 -0
  523. package/dist/plugins/walrus/snapshot.mjs.map +1 -0
  524. package/dist/plugins/walrus/storage-nodes.d.mts +15 -0
  525. package/dist/plugins/walrus/storage-nodes.mjs +154 -0
  526. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -0
  527. package/dist/plugins/walrus/wal-swap.d.mts +2 -0
  528. package/dist/plugins/walrus/wal-swap.mjs +58 -0
  529. package/dist/plugins/walrus/wal-swap.mjs.map +1 -0
  530. package/dist/primitives/artifact-publisher.d.mts +12 -0
  531. package/dist/primitives/cache.d.mts +1 -0
  532. package/dist/runtime/built-in-plugin-layers.mjs +49 -0
  533. package/dist/runtime/built-in-plugin-layers.mjs.map +1 -0
  534. package/dist/runtime/docker/client.d.mts +2 -0
  535. package/dist/runtime/docker/client.mjs +54 -0
  536. package/dist/runtime/docker/client.mjs.map +1 -0
  537. package/dist/runtime/docker/container.d.mts +1 -0
  538. package/dist/runtime/docker/container.mjs +562 -0
  539. package/dist/runtime/docker/container.mjs.map +1 -0
  540. package/dist/runtime/docker/errors.d.mts +1 -0
  541. package/dist/runtime/docker/errors.mjs +187 -0
  542. package/dist/runtime/docker/errors.mjs.map +1 -0
  543. package/dist/runtime/docker/exec.d.mts +1 -0
  544. package/dist/runtime/docker/exec.mjs +63 -0
  545. package/dist/runtime/docker/exec.mjs.map +1 -0
  546. package/dist/runtime/docker/image.d.mts +1 -0
  547. package/dist/runtime/docker/image.mjs +278 -0
  548. package/dist/runtime/docker/image.mjs.map +1 -0
  549. package/dist/runtime/docker/index.d.mts +1 -0
  550. package/dist/runtime/docker/inventory.d.mts +1 -0
  551. package/dist/runtime/docker/inventory.mjs +167 -0
  552. package/dist/runtime/docker/inventory.mjs.map +1 -0
  553. package/dist/runtime/docker/labels.d.mts +1 -0
  554. package/dist/runtime/docker/labels.mjs +97 -0
  555. package/dist/runtime/docker/labels.mjs.map +1 -0
  556. package/dist/runtime/docker/logs.d.mts +1 -0
  557. package/dist/runtime/docker/logs.mjs +34 -0
  558. package/dist/runtime/docker/logs.mjs.map +1 -0
  559. package/dist/runtime/docker/network.d.mts +1 -0
  560. package/dist/runtime/docker/network.mjs +168 -0
  561. package/dist/runtime/docker/network.mjs.map +1 -0
  562. package/dist/runtime/docker/service.d.mts +9 -0
  563. package/dist/runtime/docker/service.mjs +266 -0
  564. package/dist/runtime/docker/service.mjs.map +1 -0
  565. package/dist/runtime/docker/sweep.d.mts +1 -0
  566. package/dist/runtime/docker/sweep.mjs +220 -0
  567. package/dist/runtime/docker/sweep.mjs.map +1 -0
  568. package/dist/runtime/docker/volume.d.mts +1 -0
  569. package/dist/runtime/docker/volume.mjs +24 -0
  570. package/dist/runtime/docker/volume.mjs.map +1 -0
  571. package/dist/runtime/docker/wrap.d.mts +1 -0
  572. package/dist/runtime/docker/wrap.mjs +131 -0
  573. package/dist/runtime/docker/wrap.mjs.map +1 -0
  574. package/dist/substrate/brand.d.mts +24 -0
  575. package/dist/substrate/brand.mjs +14 -0
  576. package/dist/substrate/brand.mjs.map +1 -0
  577. package/dist/substrate/cross-process.d.mts +1 -0
  578. package/dist/substrate/cross-process.mjs +28 -0
  579. package/dist/substrate/cross-process.mjs.map +1 -0
  580. package/dist/substrate/events.d.mts +117 -0
  581. package/dist/substrate/identity.d.mts +13 -0
  582. package/dist/substrate/lifecycle.d.mts +12 -0
  583. package/dist/substrate/manifest.d.mts +39 -0
  584. package/dist/substrate/manifest.mjs +33 -0
  585. package/dist/substrate/manifest.mjs.map +1 -0
  586. package/dist/substrate/network.d.mts +34 -0
  587. package/dist/substrate/options.d.mts +23 -0
  588. package/dist/substrate/plugin.d.mts +101 -0
  589. package/dist/substrate/plugin.mjs +61 -0
  590. package/dist/substrate/plugin.mjs.map +1 -0
  591. package/dist/substrate/projection.d.mts +100 -0
  592. package/dist/substrate/runtime/artifact-publisher/index.mjs +76 -0
  593. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -0
  594. package/dist/substrate/runtime/atomic-write.mjs +106 -0
  595. package/dist/substrate/runtime/atomic-write.mjs.map +1 -0
  596. package/dist/substrate/runtime/cache/index.d.mts +1 -0
  597. package/dist/substrate/runtime/cache/schema.d.mts +1 -0
  598. package/dist/substrate/runtime/cache/schema.mjs +22 -0
  599. package/dist/substrate/runtime/cache/schema.mjs.map +1 -0
  600. package/dist/substrate/runtime/cache/service.d.mts +1 -0
  601. package/dist/substrate/runtime/cache/service.mjs +89 -0
  602. package/dist/substrate/runtime/cache/service.mjs.map +1 -0
  603. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -0
  604. package/dist/substrate/runtime/capability-sinks/layer.d.mts +1 -0
  605. package/dist/substrate/runtime/capability-sinks/layer.mjs +31 -0
  606. package/dist/substrate/runtime/capability-sinks/layer.mjs.map +1 -0
  607. package/dist/substrate/runtime/capability-sinks/service.d.mts +36 -0
  608. package/dist/substrate/runtime/capability-sinks/service.mjs +74 -0
  609. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -0
  610. package/dist/substrate/runtime/config-validation.d.mts +38 -0
  611. package/dist/substrate/runtime/config-validation.mjs +137 -0
  612. package/dist/substrate/runtime/config-validation.mjs.map +1 -0
  613. package/dist/substrate/runtime/context-helpers.mjs +32 -0
  614. package/dist/substrate/runtime/context-helpers.mjs.map +1 -0
  615. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +128 -0
  616. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -0
  617. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +136 -0
  618. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -0
  619. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +49 -0
  620. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -0
  621. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +9 -0
  622. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs.map +1 -0
  623. package/dist/substrate/runtime/cross-process/liveness.mjs +119 -0
  624. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -0
  625. package/dist/substrate/runtime/cross-process/roster.mjs +275 -0
  626. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -0
  627. package/dist/substrate/runtime/cross-process/snapshot-reservation.d.mts +1 -0
  628. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +117 -0
  629. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -0
  630. package/dist/substrate/runtime/cross-process/stack-lock.d.mts +1 -0
  631. package/dist/substrate/runtime/cross-process/stack-lock.mjs +142 -0
  632. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -0
  633. package/dist/substrate/runtime/current-plugin.mjs +15 -0
  634. package/dist/substrate/runtime/current-plugin.mjs.map +1 -0
  635. package/dist/substrate/runtime/errors.d.mts +1 -0
  636. package/dist/substrate/runtime/errors.mjs +76 -0
  637. package/dist/substrate/runtime/errors.mjs.map +1 -0
  638. package/dist/substrate/runtime/host-tree-tar/index.mjs +364 -0
  639. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -0
  640. package/dist/substrate/runtime/http-probe.d.mts +35 -0
  641. package/dist/substrate/runtime/http-probe.mjs +65 -0
  642. package/dist/substrate/runtime/http-probe.mjs.map +1 -0
  643. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -0
  644. package/dist/substrate/runtime/lease-broker/service.d.mts +64 -0
  645. package/dist/substrate/runtime/lease-broker/service.mjs +155 -0
  646. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -0
  647. package/dist/substrate/runtime/lifecycle/dep-graph.d.mts +1 -0
  648. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +138 -0
  649. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -0
  650. package/dist/substrate/runtime/lifecycle/index.d.mts +1 -0
  651. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs +31 -0
  652. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -0
  653. package/dist/substrate/runtime/lifecycle/plugin-registry.d.mts +1 -0
  654. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +133 -0
  655. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -0
  656. package/dist/substrate/runtime/lifecycle/ready-gate.d.mts +1 -0
  657. package/dist/substrate/runtime/lifecycle/ready-gate.mjs +34 -0
  658. package/dist/substrate/runtime/lifecycle/ready-gate.mjs.map +1 -0
  659. package/dist/substrate/runtime/lifecycle/selective-restart.d.mts +1 -0
  660. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +43 -0
  661. package/dist/substrate/runtime/lifecycle/selective-restart.mjs.map +1 -0
  662. package/dist/substrate/runtime/lifecycle/signals.d.mts +1 -0
  663. package/dist/substrate/runtime/lifecycle/signals.mjs +64 -0
  664. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -0
  665. package/dist/substrate/runtime/lifecycle/state-machine.d.mts +1 -0
  666. package/dist/substrate/runtime/lifecycle/state-machine.mjs +38 -0
  667. package/dist/substrate/runtime/lifecycle/state-machine.mjs.map +1 -0
  668. package/dist/substrate/runtime/lifecycle/watch-attribution.d.mts +1 -0
  669. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs +27 -0
  670. package/dist/substrate/runtime/lifecycle/watch-attribution.mjs.map +1 -0
  671. package/dist/substrate/runtime/managed-container.d.mts +30 -0
  672. package/dist/substrate/runtime/managed-container.mjs +32 -0
  673. package/dist/substrate/runtime/managed-container.mjs.map +1 -0
  674. package/dist/substrate/runtime/manifest/manifest.mjs +73 -0
  675. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -0
  676. package/dist/substrate/runtime/mode-errors.d.mts +36 -0
  677. package/dist/substrate/runtime/observability/cascade-formatter.d.mts +1 -0
  678. package/dist/substrate/runtime/observability/cascade-formatter.mjs +135 -0
  679. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -0
  680. package/dist/substrate/runtime/observability/formatter-registry.d.mts +1 -0
  681. package/dist/substrate/runtime/observability/formatter-registry.mjs +65 -0
  682. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -0
  683. package/dist/substrate/runtime/observability/index.d.mts +3 -0
  684. package/dist/substrate/runtime/observability/logger.d.mts +58 -0
  685. package/dist/substrate/runtime/observability/logger.mjs +89 -0
  686. package/dist/substrate/runtime/observability/logger.mjs.map +1 -0
  687. package/dist/substrate/runtime/observability/pretty-error.d.mts +1 -0
  688. package/dist/substrate/runtime/observability/pretty-error.mjs +119 -0
  689. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -0
  690. package/dist/substrate/runtime/observability/process-lines.d.mts +31 -0
  691. package/dist/substrate/runtime/observability/process-lines.mjs +40 -0
  692. package/dist/substrate/runtime/observability/process-lines.mjs.map +1 -0
  693. package/dist/substrate/runtime/observability/redaction.d.mts +28 -0
  694. package/dist/substrate/runtime/observability/redaction.mjs +45 -0
  695. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -0
  696. package/dist/substrate/runtime/observability/spans.d.mts +1 -0
  697. package/dist/substrate/runtime/observability/spans.mjs +87 -0
  698. package/dist/substrate/runtime/observability/spans.mjs.map +1 -0
  699. package/dist/substrate/runtime/observability/subprocess-capture.d.mts +2 -0
  700. package/dist/substrate/runtime/observability/subprocess-capture.mjs +82 -0
  701. package/dist/substrate/runtime/observability/subprocess-capture.mjs.map +1 -0
  702. package/dist/substrate/runtime/paths.d.mts +17 -0
  703. package/dist/substrate/runtime/paths.mjs +61 -0
  704. package/dist/substrate/runtime/paths.mjs.map +1 -0
  705. package/dist/substrate/runtime/port-broker/index.d.mts +1 -0
  706. package/dist/substrate/runtime/port-broker/service.d.mts +1 -0
  707. package/dist/substrate/runtime/port-broker/service.mjs +319 -0
  708. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -0
  709. package/dist/substrate/runtime/post-acquire-tasks.d.mts +1 -0
  710. package/dist/substrate/runtime/post-acquire-tasks.mjs +34 -0
  711. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -0
  712. package/dist/substrate/runtime/probes.d.mts +51 -0
  713. package/dist/substrate/runtime/probes.mjs +84 -0
  714. package/dist/substrate/runtime/probes.mjs.map +1 -0
  715. package/dist/substrate/runtime/process-supervisor.d.mts +57 -0
  716. package/dist/substrate/runtime/process-supervisor.mjs +73 -0
  717. package/dist/substrate/runtime/process-supervisor.mjs.map +1 -0
  718. package/dist/substrate/runtime/projection/operational-endpoints.mjs +44 -0
  719. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -0
  720. package/dist/substrate/runtime/projection/persisted.mjs +195 -0
  721. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -0
  722. package/dist/substrate/runtime/projection/state-ref.mjs +48 -0
  723. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -0
  724. package/dist/substrate/runtime/projection/update.mjs +200 -0
  725. package/dist/substrate/runtime/projection/update.mjs.map +1 -0
  726. package/dist/substrate/runtime/retry-policy.d.mts +18 -0
  727. package/dist/substrate/runtime/retry-policy.mjs +16 -0
  728. package/dist/substrate/runtime/retry-policy.mjs.map +1 -0
  729. package/dist/substrate/runtime/run.mjs +86 -0
  730. package/dist/substrate/runtime/run.mjs.map +1 -0
  731. package/dist/substrate/runtime/runtime-decode.d.mts +32 -0
  732. package/dist/substrate/runtime/runtime-decode.mjs +53 -0
  733. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -0
  734. package/dist/substrate/runtime/scoped-http-server.mjs +36 -0
  735. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -0
  736. package/dist/substrate/runtime/scoped-ref-map/service.mjs +83 -0
  737. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -0
  738. package/dist/substrate/runtime/stage-and-swap/index.d.mts +1 -0
  739. package/dist/substrate/runtime/stage-and-swap/index.mjs +131 -0
  740. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -0
  741. package/dist/substrate/runtime/state-store/schema.mjs +36 -0
  742. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -0
  743. package/dist/substrate/runtime/strategy-registry/chain-probe-for.d.mts +1 -0
  744. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +22 -0
  745. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -0
  746. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.d.mts +1 -0
  747. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +30 -0
  748. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +1 -0
  749. package/dist/substrate/runtime/strategy-registry/index.d.mts +1 -0
  750. package/dist/substrate/runtime/strategy-registry/service.d.mts +1 -0
  751. package/dist/substrate/runtime/strategy-registry/service.mjs +67 -0
  752. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -0
  753. package/dist/substrate/runtime/sui-execute/index.d.mts +11 -0
  754. package/dist/substrate/runtime/sui-execute/index.mjs +144 -0
  755. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -0
  756. package/dist/substrate/runtime/sui-move-build/index.d.mts +1 -0
  757. package/dist/substrate/runtime/sui-move-build/index.mjs +283 -0
  758. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -0
  759. package/dist/substrate/runtime/supervisor.d.mts +1 -0
  760. package/dist/substrate/runtime/supervisor.mjs +831 -0
  761. package/dist/substrate/runtime/supervisor.mjs.map +1 -0
  762. package/dist/surfaces/cli/command-tree.mjs +276 -0
  763. package/dist/surfaces/cli/command-tree.mjs.map +1 -0
  764. package/dist/surfaces/cli/commands/config.mjs +31 -0
  765. package/dist/surfaces/cli/commands/config.mjs.map +1 -0
  766. package/dist/surfaces/cli/commands/confirm-node.mjs +26 -0
  767. package/dist/surfaces/cli/commands/confirm-node.mjs.map +1 -0
  768. package/dist/surfaces/cli/commands/confirm.mjs +26 -0
  769. package/dist/surfaces/cli/commands/confirm.mjs.map +1 -0
  770. package/dist/surfaces/cli/commands/doctor-probes.mjs +452 -0
  771. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +1 -0
  772. package/dist/surfaces/cli/commands/doctor.mjs +38 -0
  773. package/dist/surfaces/cli/commands/doctor.mjs.map +1 -0
  774. package/dist/surfaces/cli/commands/prune-picker.mjs +347 -0
  775. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -0
  776. package/dist/surfaces/cli/commands/prune.mjs +178 -0
  777. package/dist/surfaces/cli/commands/prune.mjs.map +1 -0
  778. package/dist/surfaces/cli/commands/snapshot.mjs +141 -0
  779. package/dist/surfaces/cli/commands/snapshot.mjs.map +1 -0
  780. package/dist/surfaces/cli/commands/status.mjs +95 -0
  781. package/dist/surfaces/cli/commands/status.mjs.map +1 -0
  782. package/dist/surfaces/cli/commands/supervisor-presence.mjs +33 -0
  783. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -0
  784. package/dist/surfaces/cli/commands/wipe.mjs +28 -0
  785. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -0
  786. package/dist/surfaces/cli/envelope.mjs +43 -0
  787. package/dist/surfaces/cli/envelope.mjs.map +1 -0
  788. package/dist/surfaces/cli/errors.mjs +110 -0
  789. package/dist/surfaces/cli/errors.mjs.map +1 -0
  790. package/dist/surfaces/cli/flags.mjs +56 -0
  791. package/dist/surfaces/cli/flags.mjs.map +1 -0
  792. package/dist/surfaces/cli/index.mjs +418 -0
  793. package/dist/surfaces/cli/index.mjs.map +1 -0
  794. package/dist/surfaces/cli/output.mjs +115 -0
  795. package/dist/surfaces/cli/output.mjs.map +1 -0
  796. package/dist/surfaces/cli/sysexits.mjs +139 -0
  797. package/dist/surfaces/cli/sysexits.mjs.map +1 -0
  798. package/dist/surfaces/tui/app.mjs +104 -0
  799. package/dist/surfaces/tui/app.mjs.map +1 -0
  800. package/dist/surfaces/tui/dashboard.mjs +261 -0
  801. package/dist/surfaces/tui/dashboard.mjs.map +1 -0
  802. package/dist/surfaces/tui/display-derivation.mjs +395 -0
  803. package/dist/surfaces/tui/display-derivation.mjs.map +1 -0
  804. package/dist/surfaces/tui/errors.mjs +11 -0
  805. package/dist/surfaces/tui/errors.mjs.map +1 -0
  806. package/dist/surfaces/tui/event-log.mjs +155 -0
  807. package/dist/surfaces/tui/event-log.mjs.map +1 -0
  808. package/dist/surfaces/tui/heartbeat.mjs +33 -0
  809. package/dist/surfaces/tui/heartbeat.mjs.map +1 -0
  810. package/dist/surfaces/tui/index.mjs +50 -0
  811. package/dist/surfaces/tui/index.mjs.map +1 -0
  812. package/dist/surfaces/tui/input.mjs +104 -0
  813. package/dist/surfaces/tui/input.mjs.map +1 -0
  814. package/dist/surfaces/tui/mode-detect.mjs +32 -0
  815. package/dist/surfaces/tui/mode-detect.mjs.map +1 -0
  816. package/dist/surfaces/tui/mount-ink.mjs +31 -0
  817. package/dist/surfaces/tui/mount-ink.mjs.map +1 -0
  818. package/dist/surfaces/tui/plain-renderer.mjs +170 -0
  819. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -0
  820. package/dist/surfaces/tui/resource-table.mjs +507 -0
  821. package/dist/surfaces/tui/resource-table.mjs.map +1 -0
  822. package/images/_shared/signal-forward.sh +77 -0
  823. package/images/postgres/Dockerfile +32 -0
  824. package/images/seal/Dockerfile +68 -0
  825. package/images/seal/entrypoint.sh +65 -0
  826. package/images/sui/Dockerfile +73 -0
  827. package/images/sui/entrypoint.sh +244 -0
  828. package/images/sui-fork/Dockerfile +53 -0
  829. package/images/sui-fork/entrypoint.sh +51 -0
  830. package/images/walrus/Dockerfile +122 -0
  831. package/images/walrus/deploy-walrus.sh +305 -0
  832. package/images/walrus/run-walrus.sh +53 -0
  833. package/package.json +94 -0
@@ -0,0 +1,73 @@
1
+ import { atomicWriteFile } from "../atomic-write.mjs";
2
+ import "../../manifest.mjs";
3
+ import { Data, Effect } from "effect";
4
+ /** One error class for every manifest IO failure. */
5
+ var ManifestError = class extends Data.TaggedError("ManifestError") {};
6
+ /**
7
+ * Build the envelope from per-plugin contributions. Pure; the writer
8
+ * calls this and then atomically writes the JSON.
9
+ *
10
+ * `pluginKey` collisions are an error — two contributions for the
11
+ * same plugin would silently overwrite. Endpoint-key collisions also
12
+ * error: every endpoint has a unique `(pluginKey, dispatchId)` digest
13
+ * by construction; a duplicate means a substrate bug.
14
+ */
15
+ const buildEnvelope = (input) => Effect.gen(function* () {
16
+ const services = {};
17
+ const endpoints = {};
18
+ const extras = { ...input.extras };
19
+ for (const contribution of input.contributions) {
20
+ const key = contribution.pluginKey;
21
+ if (key in services) return yield* Effect.fail(new ManifestError({
22
+ reason: "duplicate-contribution",
23
+ path: "(in-memory envelope)",
24
+ detail: `pluginKey ${key} contributed twice`
25
+ }));
26
+ services[key] = contribution.services;
27
+ if (contribution.extras !== void 0) for (const [extraKey, extraValue] of Object.entries(contribution.extras)) {
28
+ if (extraKey in extras) return yield* Effect.fail(new ManifestError({
29
+ reason: "duplicate-contribution",
30
+ path: "(in-memory envelope)",
31
+ detail: `extras key ${extraKey} contributed twice`
32
+ }));
33
+ extras[extraKey] = extraValue;
34
+ }
35
+ for (const ep of contribution.endpoints) {
36
+ const ek = ep.endpointKey;
37
+ if (ek in endpoints) return yield* Effect.fail(new ManifestError({
38
+ reason: "duplicate-contribution",
39
+ path: "(in-memory envelope)",
40
+ detail: `endpointKey ${ek} contributed twice`
41
+ }));
42
+ endpoints[ek] = ep;
43
+ }
44
+ }
45
+ return {
46
+ identity: input.identity,
47
+ manifestVersion: 1,
48
+ services,
49
+ endpoints,
50
+ extras
51
+ };
52
+ });
53
+ /**
54
+ * Serialize and write the envelope at `path` atomically. Routes
55
+ * through the canonical `atomicWriteFile` primitive (mkdir-parent →
56
+ * O_EXCL temp → write → fsync → rename), so the manifest writer
57
+ * shares ONE owner of the tempfile dance with the state-store and
58
+ * cache.
59
+ */
60
+ const writeManifest = (envelope, path) => Effect.gen(function* () {
61
+ const json = serializeEnvelope(envelope);
62
+ yield* atomicWriteFile(path, new TextEncoder().encode(json)).pipe(Effect.mapError((cause) => new ManifestError({
63
+ reason: "write-failed",
64
+ path,
65
+ detail: `atomic write failed at stage ${cause.stage}`,
66
+ cause
67
+ })));
68
+ }).pipe(Effect.withSpan("Manifest.writeManifest", { attributes: { "devstack.manifest.path": path } }));
69
+ const serializeEnvelope = (envelope) => JSON.stringify(envelope, null, 2);
70
+ //#endregion
71
+ export { buildEnvelope, writeManifest };
72
+
73
+ //# sourceMappingURL=manifest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.mjs","names":[],"sources":["../../../../src/substrate/runtime/manifest/manifest.ts"],"sourcesContent":["// Manifest emitter — endpoint-keyed envelope, atomic write.\n//\n// Architecture § Manifest data model. The envelope is L0 (`identity`\n// tuple, `manifestVersion`, `services` slot, `endpoints` lookup,\n// `extras`). The per-service projection lives in each plugin's\n// Codegenable contribution and is consumed by codegen output, not by\n// the manifest envelope itself.\n//\n// The emitter:\n// - Accepts per-plugin contributions through a `contribute` Effect.\n// - Walks endpoint contributions to build the flat `endpoints`\n// lookup keyed by `endpointKey`. Entries still carry the declared\n// endpoint `name` for build-integration lookup.\n// - Writes atomically via tempfile + fsync + rename. The atomic-\n// write primitive lives in L0 (per architecture § Collapsed:\n// \"Three tempfile+rename impls → one atomic-write primitive\").\n// - Validates the envelope against `ManifestEnvelopeSchema` on read.\n// - Pins `manifestVersion` so future-proofing migrations have a\n// compatibility seam. The pinned version is `1` for the post-\n// rewrite envelope. (The old devstack used unversioned manifests\n// plus a hash field; the rewrite's clean break is `version 1`.)\n//\n// Discipline: zero service names. The writer iterates `pluginKey`-\n// indexed contributions and copies the bytes through. The schema\n// validates the envelope shape, not the per-plugin contents (which\n// are `Schema.Unknown`).\n\nimport { Effect } from 'effect';\nimport { Data } from 'effect';\nimport { FileSystem } from 'effect';\n\nimport type { EndpointKey, PluginKey } from '../../brand.ts';\nimport {\n\ttype EndpointEntry,\n\ttype ManifestExtras,\n\ttype ManifestEnvelope,\n\tManifestEnvelopeSchema,\n} from '../../manifest.ts';\nimport { atomicWriteFile } from '../atomic-write.ts';\nimport { decodeJsonText } from '../runtime-decode.ts';\n\n// -----------------------------------------------------------------------------\n// Pinned schema version\n// -----------------------------------------------------------------------------\n\n/**\n * Schema version pinned at the envelope level. Bump only on a\n * breaking shape change to the envelope (NOT to a per-plugin service\n * slice — those carry their own version via Codegenable contribution).\n *\n * Reader policy:\n * - Equal version: accept.\n * - Older version: refuse (advise user to re-run `up`).\n * - Newer version: refuse (build integration is out of date).\n */\nexport const CURRENT_MANIFEST_VERSION = 1 as const;\n\n// -----------------------------------------------------------------------------\n// Errors\n// -----------------------------------------------------------------------------\n\n/** One error class for every manifest IO failure. */\nexport class ManifestError extends Data.TaggedError('ManifestError')<{\n\treadonly reason:\n\t\t| 'write-failed'\n\t\t| 'read-failed'\n\t\t| 'decode-failed'\n\t\t| 'version-mismatch'\n\t\t| 'duplicate-contribution';\n\treadonly path: string;\n\treadonly detail?: string;\n\treadonly cause?: unknown;\n}> {}\n\n// -----------------------------------------------------------------------------\n// Contribution shape\n// -----------------------------------------------------------------------------\n\n/**\n * One plugin's contribution to the manifest. Keyed by `pluginKey`\n * (branded), opaque `services` blob, plus a flat list of endpoint\n * entries the plugin owns.\n *\n * The writer copies `services` through to\n * `envelope.services[pluginKey]`. The renderer of the typed shape\n * lives in the plugin's Codegenable contribution — the manifest\n * doesn't decode it.\n */\nexport interface PluginManifestContribution {\n\treadonly pluginKey: PluginKey;\n\t/** Plugin's structured slice — opaque to the writer. */\n\treadonly services: unknown;\n\t/** Endpoints owned by this plugin. The writer indexes these by\n\t * `endpointKey` into the flat top-level lookup. */\n\treadonly endpoints: ReadonlyArray<EndpointEntry>;\n\t/** Optional app-facing extras merged into the top-level extras slot. */\n\treadonly extras?: ManifestExtras;\n}\n\n// -----------------------------------------------------------------------------\n// Public writer interface\n// -----------------------------------------------------------------------------\n\nexport interface WriteManifestInput {\n\treadonly identity: ManifestEnvelope['identity'];\n\treadonly contributions: ReadonlyArray<PluginManifestContribution>;\n\treadonly extras?: ManifestExtras;\n}\n\n/**\n * Build the envelope from per-plugin contributions. Pure; the writer\n * calls this and then atomically writes the JSON.\n *\n * `pluginKey` collisions are an error — two contributions for the\n * same plugin would silently overwrite. Endpoint-key collisions also\n * error: every endpoint has a unique `(pluginKey, dispatchId)` digest\n * by construction; a duplicate means a substrate bug.\n */\nexport const buildEnvelope = (\n\tinput: WriteManifestInput,\n): Effect.Effect<ManifestEnvelope, ManifestError> =>\n\tEffect.gen(function* () {\n\t\tconst services: Record<string, unknown> = {};\n\t\tconst endpoints: Record<string, EndpointEntry> = {};\n\t\tconst extras: Record<string, unknown> = { ...input.extras };\n\n\t\tfor (const contribution of input.contributions) {\n\t\t\tconst key = contribution.pluginKey as string;\n\t\t\tif (key in services) {\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\treason: 'duplicate-contribution',\n\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\tdetail: `pluginKey ${key} contributed twice`,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tservices[key] = contribution.services;\n\t\t\tif (contribution.extras !== undefined) {\n\t\t\t\tfor (const [extraKey, extraValue] of Object.entries(contribution.extras)) {\n\t\t\t\t\tif (extraKey in extras) {\n\t\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\t\t\treason: 'duplicate-contribution',\n\t\t\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\t\t\tdetail: `extras key ${extraKey} contributed twice`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\textras[extraKey] = extraValue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const ep of contribution.endpoints) {\n\t\t\t\tconst ek = ep.endpointKey as string;\n\t\t\t\tif (ek in endpoints) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\t\treason: 'duplicate-contribution',\n\t\t\t\t\t\t\tpath: '(in-memory envelope)',\n\t\t\t\t\t\t\tdetail: `endpointKey ${ek} contributed twice`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tendpoints[ek] = ep;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tidentity: input.identity,\n\t\t\tmanifestVersion: CURRENT_MANIFEST_VERSION,\n\t\t\tservices,\n\t\t\tendpoints,\n\t\t\textras,\n\t\t};\n\t});\n\n// -----------------------------------------------------------------------------\n// Atomic write — delegates to the canonical primitive.\n// -----------------------------------------------------------------------------\n\n/**\n * Serialize and write the envelope at `path` atomically. Routes\n * through the canonical `atomicWriteFile` primitive (mkdir-parent →\n * O_EXCL temp → write → fsync → rename), so the manifest writer\n * shares ONE owner of the tempfile dance with the state-store and\n * cache.\n */\nexport const writeManifest = (\n\tenvelope: ManifestEnvelope,\n\tpath: string,\n): Effect.Effect<void, ManifestError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst json = serializeEnvelope(envelope);\n\t\tconst bytes = new TextEncoder().encode(json);\n\t\tyield* atomicWriteFile(path, bytes).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(cause) =>\n\t\t\t\t\tnew ManifestError({\n\t\t\t\t\t\treason: 'write-failed',\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tdetail: `atomic write failed at stage ${cause.stage}`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('Manifest.writeManifest', { attributes: { 'devstack.manifest.path': path } }),\n\t);\n\nconst serializeEnvelope = (envelope: ManifestEnvelope): string =>\n\t// Stable key ordering, deterministic re-emit. `JSON.stringify` with\n\t// 2-space indent is reproducible byte-for-byte given the same\n\t// input object.\n\tJSON.stringify(envelope, null, 2);\n\n// -----------------------------------------------------------------------------\n// Read + decode\n// -----------------------------------------------------------------------------\n\n/**\n * Read and decode the manifest at `path`. Validates against\n * `ManifestEnvelopeSchema` and the pinned `CURRENT_MANIFEST_VERSION`.\n *\n * Used by:\n * - Codegen (architecture §6) — consumes plugin slices off\n * `envelope.services[pluginKey]`.\n * - Build integrations (Vitest, Playwright, generated app code) — consumes\n * `envelope.endpoints` lookup.\n *\n * The reader is read-only; no mutation, no IO beyond the single read.\n */\nexport const readManifest = (\n\tpath: string,\n): Effect.Effect<ManifestEnvelope, ManifestError, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst text = yield* fs\n\t\t\t.readFileString(path)\n\t\t\t.pipe(Effect.mapError((cause) => new ManifestError({ reason: 'read-failed', path, cause })));\n\t\tconst decoded = yield* decodeJsonText(ManifestEnvelopeSchema, text, {\n\t\t\tsource: path,\n\t\t\tmkError: (issue) =>\n\t\t\t\tnew ManifestError({ reason: 'decode-failed', path, cause: issue.cause ?? issue }),\n\t\t});\n\t\tif (decoded.manifestVersion !== CURRENT_MANIFEST_VERSION) {\n\t\t\treturn yield* Effect.fail(\n\t\t\t\tnew ManifestError({\n\t\t\t\t\treason: 'version-mismatch',\n\t\t\t\t\tpath,\n\t\t\t\t\tdetail: `expected ${CURRENT_MANIFEST_VERSION}, got ${decoded.manifestVersion}`,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\treturn decoded as ManifestEnvelope;\n\t}).pipe(\n\t\tEffect.withSpan('Manifest.readManifest', { attributes: { 'devstack.manifest.path': path } }),\n\t);\n\n// -----------------------------------------------------------------------------\n// Re-export the envelope + endpoint types so downstream substrate\n// modules (codegen, build integrations) don't reach into substrate/\n// directly.\n// -----------------------------------------------------------------------------\n\nexport type { EndpointEntry, EndpointKey, ManifestEnvelope, PluginKey };\nexport { ManifestEnvelopeSchema };\n"],"mappings":";;;;AA8DA,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAUjE;;;;;;;;;;AA8CH,MAAa,iBACZ,UAEA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAoC,EAAE;CAC5C,MAAM,YAA2C,EAAE;CACnD,MAAM,SAAkC,EAAE,GAAG,MAAM,QAAQ;AAE3D,MAAK,MAAM,gBAAgB,MAAM,eAAe;EAC/C,MAAM,MAAM,aAAa;AACzB,MAAI,OAAO,SACV,QAAO,OAAO,OAAO,KACpB,IAAI,cAAc;GACjB,QAAQ;GACR,MAAM;GACN,QAAQ,aAAa,IAAI;GACzB,CAAC,CACF;AAEF,WAAS,OAAO,aAAa;AAC7B,MAAI,aAAa,WAAW,KAAA,EAC3B,MAAK,MAAM,CAAC,UAAU,eAAe,OAAO,QAAQ,aAAa,OAAO,EAAE;AACzE,OAAI,YAAY,OACf,QAAO,OAAO,OAAO,KACpB,IAAI,cAAc;IACjB,QAAQ;IACR,MAAM;IACN,QAAQ,cAAc,SAAS;IAC/B,CAAC,CACF;AAEF,UAAO,YAAY;;AAGrB,OAAK,MAAM,MAAM,aAAa,WAAW;GACxC,MAAM,KAAK,GAAG;AACd,OAAI,MAAM,UACT,QAAO,OAAO,OAAO,KACpB,IAAI,cAAc;IACjB,QAAQ;IACR,MAAM;IACN,QAAQ,eAAe,GAAG;IAC1B,CAAC,CACF;AAEF,aAAU,MAAM;;;AAIlB,QAAO;EACN,UAAU,MAAM;EAChB,iBAAA;EACA;EACA;EACA;EACA;EACA;;;;;;;;AAaH,MAAa,iBACZ,UACA,SAEA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,kBAAkB,SAAS;AAExC,QAAO,gBAAgB,MADT,IAAI,aAAa,CAAC,OAAO,KACL,CAAC,CAAC,KACnC,OAAO,UACL,UACA,IAAI,cAAc;EACjB,QAAQ;EACR;EACA,QAAQ,gCAAgC,MAAM;EAC9C;EACA,CAAC,CACH,CACD;EACA,CAAC,KACF,OAAO,SAAS,0BAA0B,EAAE,YAAY,EAAE,0BAA0B,MAAM,EAAE,CAAC,CAC7F;AAEF,MAAM,qBAAqB,aAI1B,KAAK,UAAU,UAAU,MAAM,EAAE"}
@@ -0,0 +1,36 @@
1
+ import { Schema } from "effect";
2
+ import * as _$effect_Cause0 from "effect/Cause";
3
+
4
+ //#region src/substrate/runtime/mode-errors.d.ts
5
+ declare const ForkIncompatibleError_base: Schema.Class<ForkIncompatibleError, Schema.TaggedStruct<"ForkIncompatibleError", {
6
+ /** Refusing factory variant — e.g. `'walrusLocalCluster'`,
7
+ * `'sealLocalKeygen'`. Lets multiple plugin factories share
8
+ * this shape without losing the call-site distinction. */
9
+ readonly variant: Schema.String; /** Resolved network the composition refused under. */
10
+ readonly network: Schema.String; /** Imperative one-liner suitable for stderr. */
11
+ readonly message: Schema.String; /** Actionable next step (the known-deployment alternative). */
12
+ readonly hint: Schema.optional<Schema.String>;
13
+ /** Optional original cause when the refusal wraps an underlying
14
+ * fault (rare — typical use is a pure factory-time refusal). */
15
+ readonly cause: Schema.optional<Schema.Defect>;
16
+ }>, _$effect_Cause0.YieldableError>;
17
+ /**
18
+ * Synchronous factory-time refusal raised by a plugin factory
19
+ * variant when composed against a network the variant cannot serve
20
+ * (canonically: a `*-fork` chain that doesn't expose the fullnode
21
+ * surface the variant requires).
22
+ *
23
+ * Architecture (Tension 11): primary refusal is TYPE-LEVEL via
24
+ * mode-narrowed factory namespaces — `walrusFor(forkNet).<mode>` only
25
+ * exposes `.known`. This runtime shape is defense-in-depth for
26
+ * callers that bypass the type-level narrowing (env-driven factories,
27
+ * plugin composition through resolved values).
28
+ *
29
+ * Used by walrus (`local-cluster` variant) and seal (`local-keygen`
30
+ * variant) today; future plugin factories refusing on a network
31
+ * predicate share this single shape.
32
+ */
33
+ declare class ForkIncompatibleError extends ForkIncompatibleError_base {}
34
+ //#endregion
35
+ export { ForkIncompatibleError };
36
+ //# sourceMappingURL=mode-errors.d.mts.map
@@ -0,0 +1 @@
1
+ import { Cause } from "effect";
@@ -0,0 +1,135 @@
1
+ import { redactText, redactValue } from "./redaction.mjs";
2
+ //#region src/substrate/runtime/observability/cascade-formatter.ts
3
+ /** Empty registry — the formatter falls back to the default
4
+ * rendering for every value. */
5
+ const emptyFormatterRegistry = /* @__PURE__ */ new Map();
6
+ const DEFAULT_FIELD_TRUNCATE = 8192;
7
+ const DEFAULT_MAX_DEPTH = 12;
8
+ const isTaggedError = (value) => typeof value === "object" && value !== null && typeof value._tag === "string";
9
+ const isCauseLike = (value) => typeof value === "object" && value !== null && Array.isArray(value.reasons);
10
+ /**
11
+ * Format an Effect `Cause<E>` as a multi-line cascade string. Pure.
12
+ *
13
+ * Multiple `Fail` reasons render as separate blocks joined by
14
+ * `--- (also)` so parallel failures are visible. Defects render with
15
+ * a `DEFECT` prefix. Interrupts render with `INTERRUPT[<fiberId>]`.
16
+ *
17
+ * Cyclic `cause` chains are broken with `…[cycle]`.
18
+ */
19
+ const formatCause = (cause, options) => {
20
+ const opts = {
21
+ formatters: options?.formatters ?? emptyFormatterRegistry,
22
+ fieldTruncate: options?.fieldTruncate ?? DEFAULT_FIELD_TRUNCATE,
23
+ maxDepth: options?.maxDepth ?? DEFAULT_MAX_DEPTH,
24
+ redactions: options?.redactions ?? []
25
+ };
26
+ const visited = /* @__PURE__ */ new WeakSet();
27
+ const reasons = cause.reasons;
28
+ if (reasons.length === 0) return "(empty cause)";
29
+ return reasons.map((reason) => formatReason(reason, opts, visited, 0)).join("\n--- (also)\n");
30
+ };
31
+ /**
32
+ * Format an arbitrary value (a `Cause`, a tagged error, a plain
33
+ * `Error`, or anything else) using the cascade rules. Pure.
34
+ *
35
+ * The pretty-error renderer (`pretty-error.ts`) is a thin wrapper
36
+ * over this — it just sets the IO conventions (where to write,
37
+ * what to truncate per-context). The formatting logic lives here.
38
+ */
39
+ const formatValue = (value, options) => {
40
+ return formatAny(value, {
41
+ formatters: options?.formatters ?? emptyFormatterRegistry,
42
+ fieldTruncate: options?.fieldTruncate ?? DEFAULT_FIELD_TRUNCATE,
43
+ maxDepth: options?.maxDepth ?? DEFAULT_MAX_DEPTH,
44
+ redactions: options?.redactions ?? []
45
+ }, /* @__PURE__ */ new WeakSet(), 0);
46
+ };
47
+ const truncate = (s, limit, redactions) => {
48
+ const redacted = redactText(s, redactions);
49
+ return redacted.length > limit ? `${redacted.slice(0, limit)}…[truncated]` : redacted;
50
+ };
51
+ const indent = (s, prefix) => s.split("\n").map((line) => `${prefix}${line}`).join("\n");
52
+ const formatReason = (reason, opts, visited, depth) => {
53
+ switch (reason._tag) {
54
+ case "Fail": return formatAny(reason.error, opts, visited, depth);
55
+ case "Die": return `DEFECT:\n${indent(formatAny(reason.defect, opts, visited, depth), " ")}`;
56
+ case "Interrupt": return `INTERRUPT[${reason.fiberId ?? "unknown"}]`;
57
+ }
58
+ };
59
+ const formatAny = (value, opts, visited, depth) => {
60
+ if (value === void 0 || value === null) return "";
61
+ if (depth > opts.maxDepth) return "…[max depth]";
62
+ if (typeof value === "object") {
63
+ if (visited.has(value)) return "…[cycle]";
64
+ visited.add(value);
65
+ }
66
+ if (isCauseLike(value)) {
67
+ const rs = value.reasons;
68
+ if (rs.length === 0) return "(empty cause)";
69
+ return rs.map((r) => formatReason(r, opts, visited, depth)).join("\n--- (also)\n");
70
+ }
71
+ if (isTaggedError(value)) return formatTagged(value, opts, visited, depth);
72
+ if (value instanceof Error) {
73
+ const header = `${value.name}: ${value.message}`;
74
+ if (value.stack && value.stack !== header) return value.stack;
75
+ return header;
76
+ }
77
+ if (typeof value === "string") return redactText(value, opts.redactions);
78
+ try {
79
+ return JSON.stringify(redactValue(value, opts.redactions));
80
+ } catch {
81
+ return String(value);
82
+ }
83
+ };
84
+ const formatTagged = (value, opts, visited, depth) => {
85
+ const override = opts.formatters.get(value._tag);
86
+ if (override) {
87
+ const result = override(value, (inner) => formatAny(inner, opts, visited, depth + 1));
88
+ if (result !== null) return result;
89
+ }
90
+ const qualifier = typeof value.phase === "string" ? `(${value.phase})` : typeof value.op === "string" ? `(${value.op})` : "";
91
+ const message = typeof value.message === "string" ? redactText(value.message, opts.redactions) : "";
92
+ const header = qualifier ? `${value._tag} ${qualifier}: ${message}` : `${value._tag}: ${message}`;
93
+ const lines = [header];
94
+ if (typeof value.exitCode === "number") lines.push(` exitCode: ${value.exitCode}`);
95
+ if (typeof value.stderr === "string" && value.stderr.trim().length > 0) lines.push(` stderr: ${truncate(value.stderr.trim(), opts.fieldTruncate, opts.redactions)}`);
96
+ if (typeof value.stdout === "string" && value.stdout.trim().length > 0) lines.push(` stdout: ${truncate(value.stdout.trim(), opts.fieldTruncate, opts.redactions)}`);
97
+ if (typeof value.detail === "string" && value.detail.trim().length > 0) lines.push(` detail: ${truncate(value.detail.trim(), opts.fieldTruncate, opts.redactions)}`);
98
+ const conventional = new Set([
99
+ "_tag",
100
+ "message",
101
+ "cause",
102
+ "phase",
103
+ "stderr",
104
+ "stdout",
105
+ "exitCode",
106
+ "detail",
107
+ "op"
108
+ ]);
109
+ for (const key of Object.keys(value)) {
110
+ if (conventional.has(key)) continue;
111
+ const v = value[key];
112
+ if (v === void 0 || v === null) continue;
113
+ const rendered = typeof v === "string" ? truncate(v, opts.fieldTruncate, opts.redactions) : typeof v === "number" || typeof v === "boolean" ? String(v) : safeJson(v, opts.fieldTruncate, opts.redactions);
114
+ lines.push(` ${key}: ${rendered}`);
115
+ }
116
+ if (value.cause !== void 0 && value.cause !== null) {
117
+ const rendered = formatAny(value.cause, opts, visited, depth + 1);
118
+ if (rendered.trim().length > 0 && rendered.trim() !== header.trim()) {
119
+ lines.push(" caused by:");
120
+ lines.push(indent(rendered, " "));
121
+ }
122
+ }
123
+ return lines.join("\n");
124
+ };
125
+ const safeJson = (value, limit, redactions) => {
126
+ try {
127
+ return truncate(JSON.stringify(redactValue(value, redactions)), limit, redactions);
128
+ } catch {
129
+ return "[unserializable]";
130
+ }
131
+ };
132
+ //#endregion
133
+ export { emptyFormatterRegistry, formatCause, formatValue, isTaggedError };
134
+
135
+ //# sourceMappingURL=cascade-formatter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascade-formatter.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/cascade-formatter.ts"],"sourcesContent":["// L0 cascade formatter.\n//\n// Architecture § Substrate violations § \"C2 — relocate cause walker\n// from the renderer\". The cascade formatter walks an Effect `Cause`\n// and returns a stringified cascade of taxonomy-aware lines. Called\n// from CLI, TUI, prune — anywhere a failure surfaces.\n//\n// Hard rules:\n// - PURE. No IO, no Effect, no clocks. Input → string.\n// - No service names: the formatter inspects `_tag` strings and\n// structured fields verbatim, never branches on a specific\n// concrete plugin error class.\n// - Pluggable per-error-class formatters via a `formatters` map\n// keyed by `_tag`. The default formatter handles tagged errors,\n// plain `Error`, defects, and Interrupts.\n//\n// Output shape:\n//\n// <Tag> (<phase?>): <message>\n// exitCode: <n>\n// stderr: <text…[truncated]>\n// <field>: <value>\n// caused by:\n// <recursive render, indented by 2 spaces>\n//\n// Multi-`Fail` causes (parallel failures) render with a `--- (also)`\n// separator. Defects (`Die`) render with `DEFECT (<tag>?)` prefix so\n// the operator can tell programmer errors from typed failures at a\n// glance. Interrupts render as `INTERRUPT[<fiberId>]`.\n\nimport type { Cause } from 'effect';\n\nimport { redactText, redactValue, type RedactionRule } from './redaction.ts';\n\n// `Cause` is a namespace in effect v4; the actual cause type is\n// `Cause.Cause<E>`. We re-alias here so call sites read naturally.\ntype CauseT<E> = Cause.Cause<E>;\n\n// -----------------------------------------------------------------------------\n// Plug-in formatter API\n// -----------------------------------------------------------------------------\n\n/**\n * Per-tag formatter override. Receives the tagged-error-like value\n * and the default formatter (so a plugin formatter can recurse on a\n * nested `cause` field without re-implementing the walk).\n *\n * Return `null` to fall back to the default rendering.\n *\n * Architecture: the formatter registry is keyed by `_tag` string —\n * the substrate never imports a concrete plugin error class. Plugins\n * register their custom renderer via the supervisor harvest loop over\n * `errorContributions` (see `substrate/plugin.ts:PluginErrorContribution`).\n */\nexport type TagFormatter = (\n\tvalue: TaggedErrorLike,\n\trecurse: (inner: unknown) => string,\n) => string | null;\n\n/** Per-tag formatter map. */\nexport type FormatterRegistry = ReadonlyMap<string, TagFormatter>;\n\n/** Empty registry — the formatter falls back to the default\n * rendering for every value. */\nexport const emptyFormatterRegistry: FormatterRegistry = new Map();\n\n// -----------------------------------------------------------------------------\n// Render budget\n// -----------------------------------------------------------------------------\n\nconst DEFAULT_FIELD_TRUNCATE = 8192;\nconst DEFAULT_MAX_DEPTH = 12;\n\nexport interface FormatOptions {\n\t/** Per-tag override registry. Defaults to the empty registry. */\n\treadonly formatters?: FormatterRegistry;\n\t/** Truncate individual fields (stderr/stdout/detail) past this\n\t * length. Default 8 KiB. */\n\treadonly fieldTruncate?: number;\n\t/** Hard recursion cap. Cyclic graphs are detected separately by\n\t * visit-set; this guards against pathological cause chains.\n\t * Default 12. */\n\treadonly maxDepth?: number;\n\t/** Optional redaction rules applied before rendering string fields. */\n\treadonly redactions?: ReadonlyArray<RedactionRule>;\n}\n\n// -----------------------------------------------------------------------------\n// Type guards (structural — no imports of concrete classes)\n// -----------------------------------------------------------------------------\n\n/** Shape of a `Schema.TaggedError` / `Data.TaggedError` instance.\n * The cascade formatter never imports a concrete class — it dispatches\n * on `_tag`. */\nexport interface TaggedErrorLike {\n\treadonly _tag: string;\n\treadonly message?: unknown;\n\treadonly cause?: unknown;\n\treadonly phase?: unknown;\n\treadonly stderr?: unknown;\n\treadonly stdout?: unknown;\n\treadonly exitCode?: unknown;\n\treadonly [key: string]: unknown;\n\treadonly detail?: unknown;\n\treadonly op?: unknown;\n}\n\nexport const isTaggedError = (value: unknown): value is TaggedErrorLike =>\n\ttypeof value === 'object' &&\n\tvalue !== null &&\n\ttypeof (value as { _tag?: unknown })._tag === 'string';\n\ninterface CauseLike {\n\treadonly reasons: ReadonlyArray<ReasonLike>;\n}\n\ninterface FailReasonLike {\n\treadonly _tag: 'Fail';\n\treadonly error: unknown;\n}\ninterface DieReasonLike {\n\treadonly _tag: 'Die';\n\treadonly defect: unknown;\n}\ninterface InterruptReasonLike {\n\treadonly _tag: 'Interrupt';\n\treadonly fiberId: number | undefined;\n}\ntype ReasonLike = FailReasonLike | DieReasonLike | InterruptReasonLike;\n\nconst isCauseLike = (value: unknown): value is CauseLike =>\n\ttypeof value === 'object' &&\n\tvalue !== null &&\n\tArray.isArray((value as { reasons?: unknown }).reasons);\n\n// -----------------------------------------------------------------------------\n// Public entry points\n// -----------------------------------------------------------------------------\n\n/**\n * Format an Effect `Cause<E>` as a multi-line cascade string. Pure.\n *\n * Multiple `Fail` reasons render as separate blocks joined by\n * `--- (also)` so parallel failures are visible. Defects render with\n * a `DEFECT` prefix. Interrupts render with `INTERRUPT[<fiberId>]`.\n *\n * Cyclic `cause` chains are broken with `…[cycle]`.\n */\nexport const formatCause = <E>(cause: CauseT<E>, options?: FormatOptions): string => {\n\tconst opts: Required<FormatOptions> = {\n\t\tformatters: options?.formatters ?? emptyFormatterRegistry,\n\t\tfieldTruncate: options?.fieldTruncate ?? DEFAULT_FIELD_TRUNCATE,\n\t\tmaxDepth: options?.maxDepth ?? DEFAULT_MAX_DEPTH,\n\t\tredactions: options?.redactions ?? [],\n\t};\n\tconst visited = new WeakSet<object>();\n\tconst reasons = (cause as unknown as CauseLike).reasons;\n\tif (reasons.length === 0) return '(empty cause)';\n\tconst rendered = reasons.map((reason) => formatReason(reason, opts, visited, 0));\n\treturn rendered.join('\\n--- (also)\\n');\n};\n\n/**\n * Format an arbitrary value (a `Cause`, a tagged error, a plain\n * `Error`, or anything else) using the cascade rules. Pure.\n *\n * The pretty-error renderer (`pretty-error.ts`) is a thin wrapper\n * over this — it just sets the IO conventions (where to write,\n * what to truncate per-context). The formatting logic lives here.\n */\nexport const formatValue = (value: unknown, options?: FormatOptions): string => {\n\tconst opts: Required<FormatOptions> = {\n\t\tformatters: options?.formatters ?? emptyFormatterRegistry,\n\t\tfieldTruncate: options?.fieldTruncate ?? DEFAULT_FIELD_TRUNCATE,\n\t\tmaxDepth: options?.maxDepth ?? DEFAULT_MAX_DEPTH,\n\t\tredactions: options?.redactions ?? [],\n\t};\n\treturn formatAny(value, opts, new WeakSet(), 0);\n};\n\n// -----------------------------------------------------------------------------\n// Internals\n// -----------------------------------------------------------------------------\n\nconst truncate = (s: string, limit: number, redactions: ReadonlyArray<RedactionRule>): string => {\n\tconst redacted = redactText(s, redactions);\n\treturn redacted.length > limit ? `${redacted.slice(0, limit)}…[truncated]` : redacted;\n};\n\nconst indent = (s: string, prefix: string): string =>\n\ts\n\t\t.split('\\n')\n\t\t.map((line) => `${prefix}${line}`)\n\t\t.join('\\n');\n\nconst formatReason = (\n\treason: ReasonLike,\n\topts: Required<FormatOptions>,\n\tvisited: WeakSet<object>,\n\tdepth: number,\n): string => {\n\tswitch (reason._tag) {\n\t\tcase 'Fail':\n\t\t\treturn formatAny(reason.error, opts, visited, depth);\n\t\tcase 'Die': {\n\t\t\tconst inner = formatAny(reason.defect, opts, visited, depth);\n\t\t\treturn `DEFECT:\\n${indent(inner, ' ')}`;\n\t\t}\n\t\tcase 'Interrupt':\n\t\t\treturn `INTERRUPT[${reason.fiberId ?? 'unknown'}]`;\n\t}\n};\n\nconst formatAny = (\n\tvalue: unknown,\n\topts: Required<FormatOptions>,\n\tvisited: WeakSet<object>,\n\tdepth: number,\n): string => {\n\tif (value === undefined || value === null) return '';\n\tif (depth > opts.maxDepth) return '…[max depth]';\n\tif (typeof value === 'object') {\n\t\tif (visited.has(value as object)) return '…[cycle]';\n\t\tvisited.add(value as object);\n\t}\n\tif (isCauseLike(value)) {\n\t\tconst rs = value.reasons;\n\t\tif (rs.length === 0) return '(empty cause)';\n\t\treturn rs.map((r) => formatReason(r, opts, visited, depth)).join('\\n--- (also)\\n');\n\t}\n\tif (isTaggedError(value)) {\n\t\treturn formatTagged(value, opts, visited, depth);\n\t}\n\tif (value instanceof Error) {\n\t\tconst header = `${value.name}: ${value.message}`;\n\t\tif (value.stack && value.stack !== header) return value.stack;\n\t\treturn header;\n\t}\n\tif (typeof value === 'string') return redactText(value, opts.redactions);\n\ttry {\n\t\treturn JSON.stringify(redactValue(value, opts.redactions));\n\t} catch {\n\t\treturn String(value);\n\t}\n};\n\nconst formatTagged = (\n\tvalue: TaggedErrorLike,\n\topts: Required<FormatOptions>,\n\tvisited: WeakSet<object>,\n\tdepth: number,\n): string => {\n\tconst override = opts.formatters.get(value._tag);\n\tif (override) {\n\t\tconst result = override(value, (inner) => formatAny(inner, opts, visited, depth + 1));\n\t\tif (result !== null) return result;\n\t}\n\n\tconst qualifier =\n\t\ttypeof value.phase === 'string'\n\t\t\t? `(${value.phase})`\n\t\t\t: typeof value.op === 'string'\n\t\t\t\t? `(${value.op})`\n\t\t\t\t: '';\n\tconst message =\n\t\ttypeof value.message === 'string' ? redactText(value.message, opts.redactions) : '';\n\tconst header = qualifier ? `${value._tag} ${qualifier}: ${message}` : `${value._tag}: ${message}`;\n\n\tconst lines: Array<string> = [header];\n\tif (typeof value.exitCode === 'number') lines.push(` exitCode: ${value.exitCode}`);\n\tif (typeof value.stderr === 'string' && value.stderr.trim().length > 0) {\n\t\tlines.push(` stderr: ${truncate(value.stderr.trim(), opts.fieldTruncate, opts.redactions)}`);\n\t}\n\tif (typeof value.stdout === 'string' && value.stdout.trim().length > 0) {\n\t\tlines.push(` stdout: ${truncate(value.stdout.trim(), opts.fieldTruncate, opts.redactions)}`);\n\t}\n\tif (typeof value.detail === 'string' && value.detail.trim().length > 0) {\n\t\tlines.push(` detail: ${truncate(value.detail.trim(), opts.fieldTruncate, opts.redactions)}`);\n\t}\n\n\t// Surface any extra plain-data fields the tagged error carries.\n\t// We skip the conventional ones already rendered above plus `_tag`,\n\t// `cause`. This makes the formatter discover-by-shape: a plugin\n\t// adding `path` or `kind` to its error gets it rendered for free.\n\tconst conventional = new Set([\n\t\t'_tag',\n\t\t'message',\n\t\t'cause',\n\t\t'phase',\n\t\t'stderr',\n\t\t'stdout',\n\t\t'exitCode',\n\t\t'detail',\n\t\t'op',\n\t]);\n\tfor (const key of Object.keys(value)) {\n\t\tif (conventional.has(key)) continue;\n\t\tconst v = (value as unknown as Record<string, unknown>)[key];\n\t\tif (v === undefined || v === null) continue;\n\t\tconst rendered =\n\t\t\ttypeof v === 'string'\n\t\t\t\t? truncate(v, opts.fieldTruncate, opts.redactions)\n\t\t\t\t: typeof v === 'number' || typeof v === 'boolean'\n\t\t\t\t\t? String(v)\n\t\t\t\t\t: safeJson(v, opts.fieldTruncate, opts.redactions);\n\t\tlines.push(` ${key}: ${rendered}`);\n\t}\n\n\tif (value.cause !== undefined && value.cause !== null) {\n\t\tconst rendered = formatAny(value.cause, opts, visited, depth + 1);\n\t\tif (rendered.trim().length > 0 && rendered.trim() !== header.trim()) {\n\t\t\tlines.push(' caused by:');\n\t\t\tlines.push(indent(rendered, ' '));\n\t\t}\n\t}\n\treturn lines.join('\\n');\n};\n\nconst safeJson = (\n\tvalue: unknown,\n\tlimit: number,\n\tredactions: ReadonlyArray<RedactionRule>,\n): string => {\n\ttry {\n\t\treturn truncate(JSON.stringify(redactValue(value, redactions)), limit, redactions);\n\t} catch {\n\t\treturn '[unserializable]';\n\t}\n};\n"],"mappings":";;;;AAgEA,MAAa,yCAA4C,IAAI,KAAK;AAMlE,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB;AAoC1B,MAAa,iBAAiB,UAC7B,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAoB/C,MAAM,eAAe,UACpB,OAAO,UAAU,YACjB,UAAU,QACV,MAAM,QAAS,MAAgC,QAAQ;;;;;;;;;;AAexD,MAAa,eAAkB,OAAkB,YAAoC;CACpF,MAAM,OAAgC;EACrC,YAAY,SAAS,cAAc;EACnC,eAAe,SAAS,iBAAiB;EACzC,UAAU,SAAS,YAAY;EAC/B,YAAY,SAAS,cAAc,EAAE;EACrC;CACD,MAAM,0BAAU,IAAI,SAAiB;CACrC,MAAM,UAAW,MAA+B;AAChD,KAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,QADiB,QAAQ,KAAK,WAAW,aAAa,QAAQ,MAAM,SAAS,EAAE,CAChE,CAAC,KAAK,iBAAiB;;;;;;;;;;AAWvC,MAAa,eAAe,OAAgB,YAAoC;AAO/E,QAAO,UAAU,OAAO;EALvB,YAAY,SAAS,cAAc;EACnC,eAAe,SAAS,iBAAiB;EACzC,UAAU,SAAS,YAAY;EAC/B,YAAY,SAAS,cAAc,EAAE;EAEV,kBAAE,IAAI,SAAS,EAAE,EAAE;;AAOhD,MAAM,YAAY,GAAW,OAAe,eAAqD;CAChG,MAAM,WAAW,WAAW,GAAG,WAAW;AAC1C,QAAO,SAAS,SAAS,QAAQ,GAAG,SAAS,MAAM,GAAG,MAAM,CAAC,gBAAgB;;AAG9E,MAAM,UAAU,GAAW,WAC1B,EACE,MAAM,KAAK,CACX,KAAK,SAAS,GAAG,SAAS,OAAO,CACjC,KAAK,KAAK;AAEb,MAAM,gBACL,QACA,MACA,SACA,UACY;AACZ,SAAQ,OAAO,MAAf;EACC,KAAK,OACJ,QAAO,UAAU,OAAO,OAAO,MAAM,SAAS,MAAM;EACrD,KAAK,MAEJ,QAAO,YAAY,OADL,UAAU,OAAO,QAAQ,MAAM,SAAS,MACvB,EAAE,KAAK;EAEvC,KAAK,YACJ,QAAO,aAAa,OAAO,WAAW,UAAU;;;AAInD,MAAM,aACL,OACA,MACA,SACA,UACY;AACZ,KAAI,UAAU,KAAA,KAAa,UAAU,KAAM,QAAO;AAClD,KAAI,QAAQ,KAAK,SAAU,QAAO;AAClC,KAAI,OAAO,UAAU,UAAU;AAC9B,MAAI,QAAQ,IAAI,MAAgB,CAAE,QAAO;AACzC,UAAQ,IAAI,MAAgB;;AAE7B,KAAI,YAAY,MAAM,EAAE;EACvB,MAAM,KAAK,MAAM;AACjB,MAAI,GAAG,WAAW,EAAG,QAAO;AAC5B,SAAO,GAAG,KAAK,MAAM,aAAa,GAAG,MAAM,SAAS,MAAM,CAAC,CAAC,KAAK,iBAAiB;;AAEnF,KAAI,cAAc,MAAM,CACvB,QAAO,aAAa,OAAO,MAAM,SAAS,MAAM;AAEjD,KAAI,iBAAiB,OAAO;EAC3B,MAAM,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM;AACvC,MAAI,MAAM,SAAS,MAAM,UAAU,OAAQ,QAAO,MAAM;AACxD,SAAO;;AAER,KAAI,OAAO,UAAU,SAAU,QAAO,WAAW,OAAO,KAAK,WAAW;AACxE,KAAI;AACH,SAAO,KAAK,UAAU,YAAY,OAAO,KAAK,WAAW,CAAC;SACnD;AACP,SAAO,OAAO,MAAM;;;AAItB,MAAM,gBACL,OACA,MACA,SACA,UACY;CACZ,MAAM,WAAW,KAAK,WAAW,IAAI,MAAM,KAAK;AAChD,KAAI,UAAU;EACb,MAAM,SAAS,SAAS,QAAQ,UAAU,UAAU,OAAO,MAAM,SAAS,QAAQ,EAAE,CAAC;AACrF,MAAI,WAAW,KAAM,QAAO;;CAG7B,MAAM,YACL,OAAO,MAAM,UAAU,WACpB,IAAI,MAAM,MAAM,KAChB,OAAO,MAAM,OAAO,WACnB,IAAI,MAAM,GAAG,KACb;CACL,MAAM,UACL,OAAO,MAAM,YAAY,WAAW,WAAW,MAAM,SAAS,KAAK,WAAW,GAAG;CAClF,MAAM,SAAS,YAAY,GAAG,MAAM,KAAK,GAAG,UAAU,IAAI,YAAY,GAAG,MAAM,KAAK,IAAI;CAExF,MAAM,QAAuB,CAAC,OAAO;AACrC,KAAI,OAAO,MAAM,aAAa,SAAU,OAAM,KAAK,eAAe,MAAM,WAAW;AACnF,KAAI,OAAO,MAAM,WAAW,YAAY,MAAM,OAAO,MAAM,CAAC,SAAS,EACpE,OAAM,KAAK,aAAa,SAAS,MAAM,OAAO,MAAM,EAAE,KAAK,eAAe,KAAK,WAAW,GAAG;AAE9F,KAAI,OAAO,MAAM,WAAW,YAAY,MAAM,OAAO,MAAM,CAAC,SAAS,EACpE,OAAM,KAAK,aAAa,SAAS,MAAM,OAAO,MAAM,EAAE,KAAK,eAAe,KAAK,WAAW,GAAG;AAE9F,KAAI,OAAO,MAAM,WAAW,YAAY,MAAM,OAAO,MAAM,CAAC,SAAS,EACpE,OAAM,KAAK,aAAa,SAAS,MAAM,OAAO,MAAM,EAAE,KAAK,eAAe,KAAK,WAAW,GAAG;CAO9F,MAAM,eAAe,IAAI,IAAI;EAC5B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,CAAC;AACF,MAAK,MAAM,OAAO,OAAO,KAAK,MAAM,EAAE;AACrC,MAAI,aAAa,IAAI,IAAI,CAAE;EAC3B,MAAM,IAAK,MAA6C;AACxD,MAAI,MAAM,KAAA,KAAa,MAAM,KAAM;EACnC,MAAM,WACL,OAAO,MAAM,WACV,SAAS,GAAG,KAAK,eAAe,KAAK,WAAW,GAChD,OAAO,MAAM,YAAY,OAAO,MAAM,YACrC,OAAO,EAAE,GACT,SAAS,GAAG,KAAK,eAAe,KAAK,WAAW;AACrD,QAAM,KAAK,KAAK,IAAI,IAAI,WAAW;;AAGpC,KAAI,MAAM,UAAU,KAAA,KAAa,MAAM,UAAU,MAAM;EACtD,MAAM,WAAW,UAAU,MAAM,OAAO,MAAM,SAAS,QAAQ,EAAE;AACjE,MAAI,SAAS,MAAM,CAAC,SAAS,KAAK,SAAS,MAAM,KAAK,OAAO,MAAM,EAAE;AACpE,SAAM,KAAK,eAAe;AAC1B,SAAM,KAAK,OAAO,UAAU,OAAO,CAAC;;;AAGtC,QAAO,MAAM,KAAK,KAAK;;AAGxB,MAAM,YACL,OACA,OACA,eACY;AACZ,KAAI;AACH,SAAO,SAAS,KAAK,UAAU,YAAY,OAAO,WAAW,CAAC,EAAE,OAAO,WAAW;SAC3E;AACP,SAAO"}
@@ -0,0 +1 @@
1
+ import { Context, Effect, Layer, Scope } from "effect";
@@ -0,0 +1,65 @@
1
+ import { emptyFormatterRegistry } from "./cascade-formatter.mjs";
2
+ import { Context, Effect, Layer, Ref } from "effect";
3
+ //#region src/substrate/runtime/observability/formatter-registry.ts
4
+ var FormatterRegistryService = class extends Context.Service()("@devstack-rewrite/substrate/FormatterRegistry") {};
5
+ /** Layer constructing the per-stack formatter registry. Stateful;
6
+ * the substrate provides one per supervisor scope. */
7
+ const layerFormatterRegistry = Layer.effect(FormatterRegistryService, Effect.gen(function* () {
8
+ const state = yield* Ref.make(/* @__PURE__ */ new Map());
9
+ const seqRef = yield* Ref.make(0);
10
+ const register = (contribution) => Effect.gen(function* () {
11
+ const baseSeq = yield* Ref.updateAndGet(seqRef, (n) => n + 1);
12
+ const fmt = contribution.formatter !== void 0 ? (value, recurse) => contribution.formatter(value, recurse) : null;
13
+ const newEntries = contribution.errorTags.map((tag) => ({
14
+ tag,
15
+ formatter: fmt,
16
+ seq: baseSeq
17
+ }));
18
+ yield* Ref.update(state, (current) => {
19
+ const next = new Map(current);
20
+ for (const e of newEntries) {
21
+ const existing = next.get(e.tag) ?? [];
22
+ next.set(e.tag, [...existing, e]);
23
+ }
24
+ return next;
25
+ });
26
+ yield* Effect.addFinalizer((_exit) => Ref.update(state, (current) => {
27
+ const next = new Map(current);
28
+ for (const e of newEntries) {
29
+ const existing = next.get(e.tag);
30
+ if (!existing) continue;
31
+ const filtered = existing.filter((x) => x.seq !== e.seq);
32
+ if (filtered.length === 0) next.delete(e.tag);
33
+ else next.set(e.tag, filtered);
34
+ }
35
+ return next;
36
+ }));
37
+ }).pipe(Effect.withSpan("substrate.formatterRegistry.register"));
38
+ const snapshot = Effect.gen(function* () {
39
+ const current = yield* Ref.get(state);
40
+ if (current.size === 0) return emptyFormatterRegistry;
41
+ const out = /* @__PURE__ */ new Map();
42
+ for (const [tag, entries] of current) {
43
+ let chosen = null;
44
+ let chosenSeq = -1;
45
+ for (const e of entries) if (e.formatter !== null && e.seq > chosenSeq) {
46
+ chosen = e.formatter;
47
+ chosenSeq = e.seq;
48
+ }
49
+ if (chosen !== null) out.set(tag, chosen);
50
+ }
51
+ return out;
52
+ });
53
+ const tags = Effect.gen(function* () {
54
+ return [...(yield* Ref.get(state)).keys()];
55
+ });
56
+ return FormatterRegistryService.of({
57
+ register,
58
+ snapshot,
59
+ tags
60
+ });
61
+ }));
62
+ //#endregion
63
+ export { FormatterRegistryService, layerFormatterRegistry };
64
+
65
+ //# sourceMappingURL=formatter-registry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter-registry.mjs","names":[],"sources":["../../../../src/substrate/runtime/observability/formatter-registry.ts"],"sourcesContent":["// Formatter registry service.\n//\n// Architecture § L0 Observability: the cascade formatter consults a\n// per-tag `FormatterRegistry` for custom renderers. The registry is\n// substrate-owned and populated by the supervisor's harvest loop from\n// each acquired plugin's `errorContributions` field. The substrate\n// stays name-blind: it dispatches on `_tag` strings the plugins\n// declare, never on plugin identifiers.\n//\n// Two surfaces:\n// - `register(contribution)` — adds tags + optional formatter for a\n// single `PluginErrorContribution`. Idempotent on the tag set\n// when no formatter is provided; last-write-wins on the formatter\n// slot when one is.\n// - `snapshot()` — returns an immutable `FormatterRegistry` the\n// cascade formatter consumes.\n//\n// Scope-bound: callers `register` inside a plugin's scope so the\n// contribution dies with the plugin (selective restart, shutdown).\n// The supervisor uses `Effect.addFinalizer` at the dispatch site;\n// this service exposes the unregister side as a complement.\n\nimport { Context, Effect, Layer, Ref, Scope } from 'effect';\n\nimport type { PluginErrorContribution } from '../../plugin.ts';\nimport {\n\temptyFormatterRegistry,\n\ttype FormatterRegistry,\n\ttype TagFormatter,\n} from './cascade-formatter.ts';\n\n/** Public shape of the formatter-registry service. */\nexport interface FormatterRegistryShape {\n\t/** Register a plugin's contribution. Scope-bound: the contribution\n\t * is reaped when the surrounding `Scope` closes. The supervisor\n\t * calls this inside each plugin's scope so selective-restart\n\t * cleans up the plugin's formatters automatically. */\n\treadonly register: (\n\t\tcontribution: PluginErrorContribution,\n\t) => Effect.Effect<void, never, Scope.Scope>;\n\t/** Snapshot the live registry as an immutable `FormatterRegistry`\n\t * the cascade formatter consumes. */\n\treadonly snapshot: Effect.Effect<FormatterRegistry>;\n\t/** Diagnostic: list every tag the registry currently tracks. */\n\treadonly tags: Effect.Effect<ReadonlyArray<string>>;\n}\n\nexport class FormatterRegistryService extends Context.Service<\n\tFormatterRegistryService,\n\tFormatterRegistryShape\n>()('@devstack-rewrite/substrate/FormatterRegistry') {}\n\n/** Per-tag entry. The registry may track a tag with no formatter\n * (default rendering is enough) — that's why `formatter` is\n * optional. We keep a sequence number so multi-plugin registrations\n * for the same tag can dedup deterministically on scope close. */\ninterface Entry {\n\treadonly tag: string;\n\treadonly formatter: TagFormatter | null;\n\treadonly seq: number;\n}\n\ntype State = ReadonlyMap<string, ReadonlyArray<Entry>>;\n\n/** Layer constructing the per-stack formatter registry. Stateful;\n * the substrate provides one per supervisor scope. */\nexport const layerFormatterRegistry: Layer.Layer<FormatterRegistryService> = Layer.effect(\n\tFormatterRegistryService,\n\tEffect.gen(function* () {\n\t\tconst state = yield* Ref.make<State>(new Map());\n\t\tconst seqRef = yield* Ref.make(0);\n\n\t\tconst register = (\n\t\t\tcontribution: PluginErrorContribution,\n\t\t): Effect.Effect<void, never, Scope.Scope> =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst baseSeq = yield* Ref.updateAndGet(seqRef, (n) => n + 1);\n\t\t\t\t// Wrap the optional formatter so the cascade-formatter's\n\t\t\t\t// `TagFormatter` shape is consistent regardless of whether\n\t\t\t\t// the plugin provided one.\n\t\t\t\tconst fmt: TagFormatter | null =\n\t\t\t\t\tcontribution.formatter !== undefined\n\t\t\t\t\t\t? (value, recurse) => contribution.formatter!(value, recurse)\n\t\t\t\t\t\t: null;\n\t\t\t\tconst newEntries: ReadonlyArray<Entry> = contribution.errorTags.map((tag) => ({\n\t\t\t\t\ttag,\n\t\t\t\t\tformatter: fmt,\n\t\t\t\t\tseq: baseSeq,\n\t\t\t\t}));\n\t\t\t\tyield* Ref.update(state, (current) => {\n\t\t\t\t\tconst next = new Map(current);\n\t\t\t\t\tfor (const e of newEntries) {\n\t\t\t\t\t\tconst existing = next.get(e.tag) ?? [];\n\t\t\t\t\t\tnext.set(e.tag, [...existing, e]);\n\t\t\t\t\t}\n\t\t\t\t\treturn next;\n\t\t\t\t});\n\t\t\t\t// Scope finalizer: drop these entries on scope close.\n\t\t\t\t// Sequence-number match keeps parallel plugin\n\t\t\t\t// registrations isolated — we only drop the entries this\n\t\t\t\t// registration added.\n\t\t\t\tyield* Effect.addFinalizer((_exit) =>\n\t\t\t\t\tRef.update(state, (current) => {\n\t\t\t\t\t\tconst next = new Map(current);\n\t\t\t\t\t\tfor (const e of newEntries) {\n\t\t\t\t\t\t\tconst existing = next.get(e.tag);\n\t\t\t\t\t\t\tif (!existing) continue;\n\t\t\t\t\t\t\tconst filtered = existing.filter((x) => x.seq !== e.seq);\n\t\t\t\t\t\t\tif (filtered.length === 0) next.delete(e.tag);\n\t\t\t\t\t\t\telse next.set(e.tag, filtered);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}).pipe(Effect.withSpan('substrate.formatterRegistry.register'));\n\n\t\tconst snapshot: Effect.Effect<FormatterRegistry> = Effect.gen(function* () {\n\t\t\tconst current = yield* Ref.get(state);\n\t\t\tif (current.size === 0) return emptyFormatterRegistry;\n\t\t\tconst out = new Map<string, TagFormatter>();\n\t\t\tfor (const [tag, entries] of current) {\n\t\t\t\t// Last registration wins on the formatter slot — tags\n\t\t\t\t// without a custom formatter are still tracked so callers\n\t\t\t\t// can introspect via `tags()` even when no override is\n\t\t\t\t// registered.\n\t\t\t\tlet chosen: TagFormatter | null = null;\n\t\t\t\tlet chosenSeq = -1;\n\t\t\t\tfor (const e of entries) {\n\t\t\t\t\tif (e.formatter !== null && e.seq > chosenSeq) {\n\t\t\t\t\t\tchosen = e.formatter;\n\t\t\t\t\t\tchosenSeq = e.seq;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (chosen !== null) out.set(tag, chosen);\n\t\t\t}\n\t\t\treturn out as FormatterRegistry;\n\t\t});\n\n\t\tconst tags: Effect.Effect<ReadonlyArray<string>> = Effect.gen(function* () {\n\t\t\tconst current = yield* Ref.get(state);\n\t\t\treturn [...current.keys()];\n\t\t});\n\n\t\treturn FormatterRegistryService.of({ register, snapshot, tags });\n\t}),\n);\n"],"mappings":";;;AA+CA,IAAa,2BAAb,cAA8C,QAAQ,SAGnD,CAAC,gDAAgD,CAAC;;;AAgBrD,MAAa,yBAAgE,MAAM,OAClF,0BACA,OAAO,IAAI,aAAa;CACvB,MAAM,QAAQ,OAAO,IAAI,qBAAY,IAAI,KAAK,CAAC;CAC/C,MAAM,SAAS,OAAO,IAAI,KAAK,EAAE;CAEjC,MAAM,YACL,iBAEA,OAAO,IAAI,aAAa;EACvB,MAAM,UAAU,OAAO,IAAI,aAAa,SAAS,MAAM,IAAI,EAAE;EAI7D,MAAM,MACL,aAAa,cAAc,KAAA,KACvB,OAAO,YAAY,aAAa,UAAW,OAAO,QAAQ,GAC3D;EACJ,MAAM,aAAmC,aAAa,UAAU,KAAK,SAAS;GAC7E;GACA,WAAW;GACX,KAAK;GACL,EAAE;AACH,SAAO,IAAI,OAAO,QAAQ,YAAY;GACrC,MAAM,OAAO,IAAI,IAAI,QAAQ;AAC7B,QAAK,MAAM,KAAK,YAAY;IAC3B,MAAM,WAAW,KAAK,IAAI,EAAE,IAAI,IAAI,EAAE;AACtC,SAAK,IAAI,EAAE,KAAK,CAAC,GAAG,UAAU,EAAE,CAAC;;AAElC,UAAO;IACN;AAKF,SAAO,OAAO,cAAc,UAC3B,IAAI,OAAO,QAAQ,YAAY;GAC9B,MAAM,OAAO,IAAI,IAAI,QAAQ;AAC7B,QAAK,MAAM,KAAK,YAAY;IAC3B,MAAM,WAAW,KAAK,IAAI,EAAE,IAAI;AAChC,QAAI,CAAC,SAAU;IACf,MAAM,WAAW,SAAS,QAAQ,MAAM,EAAE,QAAQ,EAAE,IAAI;AACxD,QAAI,SAAS,WAAW,EAAG,MAAK,OAAO,EAAE,IAAI;QACxC,MAAK,IAAI,EAAE,KAAK,SAAS;;AAE/B,UAAO;IACN,CACF;GACA,CAAC,KAAK,OAAO,SAAS,uCAAuC,CAAC;CAEjE,MAAM,WAA6C,OAAO,IAAI,aAAa;EAC1E,MAAM,UAAU,OAAO,IAAI,IAAI,MAAM;AACrC,MAAI,QAAQ,SAAS,EAAG,QAAO;EAC/B,MAAM,sBAAM,IAAI,KAA2B;AAC3C,OAAK,MAAM,CAAC,KAAK,YAAY,SAAS;GAKrC,IAAI,SAA8B;GAClC,IAAI,YAAY;AAChB,QAAK,MAAM,KAAK,QACf,KAAI,EAAE,cAAc,QAAQ,EAAE,MAAM,WAAW;AAC9C,aAAS,EAAE;AACX,gBAAY,EAAE;;AAGhB,OAAI,WAAW,KAAM,KAAI,IAAI,KAAK,OAAO;;AAE1C,SAAO;GACN;CAEF,MAAM,OAA6C,OAAO,IAAI,aAAa;AAE1E,SAAO,CAAC,IAAG,OADY,IAAI,IAAI,MAAM,EAClB,MAAM,CAAC;GACzB;AAEF,QAAO,yBAAyB,GAAG;EAAE;EAAU;EAAU;EAAM,CAAC;EAC/D,CACF"}
@@ -0,0 +1,3 @@
1
+ import { RedactionRule, Redactor, RedactorShape, layerRedactor, redactText, redactValue } from "./redaction.mjs";
2
+ import { LogLevel, LogLine, LogPayload, Logger, LoggerShape, TagBuffer } from "./logger.mjs";
3
+ import { ObserveProcessLinesOptions, ObservedProcessLine, ProcessByteStream, ProcessOutputStream, observeProcessLines, readableToByteStream, splitUtf8Lines } from "./process-lines.mjs";
@@ -0,0 +1,58 @@
1
+ import { PluginKey } from "../../brand.mjs";
2
+ import { Context, Effect, Layer } from "effect";
3
+ //#region src/substrate/runtime/observability/logger.d.ts
4
+ /** Closed level set. Mirrors the projection's row.logTail.level
5
+ * vocabulary, plus `debug` / `trace` for lifecycle diagnostics that
6
+ * should stay in buffers / Effect logs rather than the renderer's
7
+ * operator event stream. */
8
+ type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
9
+ /** A buffered log line. Plain data; the projection's `Row.logTail`
10
+ * derives from this. Structured fields live in `fields` for
11
+ * observability consumers that want richer than a string. */
12
+ interface LogLine {
13
+ readonly tag: string;
14
+ readonly pluginKey: PluginKey | null;
15
+ readonly level: LogLevel;
16
+ readonly message: string;
17
+ readonly fields: Readonly<Record<string, unknown>>;
18
+ readonly at: number;
19
+ }
20
+ interface LogPayload {
21
+ readonly level: LogLevel;
22
+ readonly message: string;
23
+ readonly fields?: Readonly<Record<string, unknown>>;
24
+ }
25
+ /** Bounded ring-buffer for a single tag. */
26
+ interface TagBuffer {
27
+ readonly lines: ReadonlyArray<LogLine>;
28
+ readonly truncated: boolean;
29
+ }
30
+ /**
31
+ * Structured per-tag logger. One instance per stack (or per process —
32
+ * provided via `layerLogger`). Plugins acquire it from Context.
33
+ *
34
+ * Discipline:
35
+ * - The tag is the only thing the logger discriminates on. It is
36
+ * not a service name; it's whatever the publishing fiber picked
37
+ * (typically `pluginKey + '/' + sub-tag`).
38
+ * - Atomic per-tag writes: `Ref.update` on a `ReadonlyMap` of
39
+ * `tag → TagBuffer`. Two fibers logging to the same tag interleave
40
+ * by Ref linearization, not by lost updates.
41
+ * - Structured fields: anything serializable. The cascade formatter
42
+ * (see `cascade-formatter.ts`) renders the fields verbatim.
43
+ */
44
+ /**
45
+ * Public shape of the Logger service. Plugins / supervisor depend on
46
+ * this interface; the concrete Layer below builds an instance.
47
+ */
48
+ interface LoggerShape {
49
+ readonly log: (tag: string, pluginKey: PluginKey | null, payload: LogPayload) => Effect.Effect<void>;
50
+ readonly readTag: (tag: string) => Effect.Effect<TagBuffer>;
51
+ readonly readAll: Effect.Effect<ReadonlyMap<string, TagBuffer>>;
52
+ readonly clearTag: (tag: string) => Effect.Effect<void>;
53
+ }
54
+ declare const Logger_base: Context.ServiceClass<Logger$1, "@devstack-rewrite/substrate/Logger", LoggerShape>;
55
+ declare class Logger$1 extends Logger_base {}
56
+ //#endregion
57
+ export { LogLevel, LogLine, LogPayload, Logger$1 as Logger, LoggerShape, TagBuffer };
58
+ //# sourceMappingURL=logger.d.mts.map
@@ -0,0 +1,89 @@
1
+ import { SpanAttr } from "./spans.mjs";
2
+ import { Redactor, redactValue } from "./redaction.mjs";
3
+ import { Context, Data, Effect, Layer, Ref } from "effect";
4
+ Data.TaggedError("LoggerError");
5
+ /** Hard cap on a single log line in bytes (UTF-8). Lines past this
6
+ * are truncated with an ellipsis. */
7
+ const MAX_LINE_BYTES = 16 * 1024;
8
+ var Logger$1 = class extends Context.Service()("@devstack-rewrite/substrate/Logger") {};
9
+ /** Layer that constructs the per-stack Logger. Stateful (holds the
10
+ * per-tag ring buffers in a Ref); the substrate provides one per
11
+ * stack-scope. */
12
+ const layerLogger = Layer.effect(Logger$1, Effect.gen(function* () {
13
+ const redactor = yield* Redactor;
14
+ const buffers = yield* Ref.make(/* @__PURE__ */ new Map());
15
+ const truncateLine = (s) => s.length > 16384 ? `${s.slice(0, MAX_LINE_BYTES)}…[truncated]` : s;
16
+ const appendInternal = (line) => Ref.update(buffers, (map) => {
17
+ const prev = map.get(line.tag) ?? {
18
+ lines: [],
19
+ truncated: false
20
+ };
21
+ const nextLines = [...prev.lines, line];
22
+ const overflow = nextLines.length > 100;
23
+ const trimmed = overflow ? nextLines.slice(-100) : nextLines;
24
+ const nextMap = new Map(map);
25
+ nextMap.set(line.tag, {
26
+ lines: trimmed,
27
+ truncated: prev.truncated || overflow
28
+ });
29
+ return nextMap;
30
+ });
31
+ /** Log a line under `tag`. Atomic per-tag. */
32
+ const log = Effect.fn("Logger.log")(function* (tag, pluginKey, payload) {
33
+ const redactionRules = yield* redactor.rules;
34
+ const line = {
35
+ tag,
36
+ pluginKey,
37
+ level: payload.level,
38
+ message: truncateLine(yield* redactor.redact(payload.message)),
39
+ fields: redactValue(payload.fields ?? {}, redactionRules),
40
+ at: Date.now()
41
+ };
42
+ yield* appendInternal(line);
43
+ yield* logViaEffect(line);
44
+ });
45
+ /** Read the current snapshot of a single tag's buffer. Used by
46
+ * the projection updater when a row is created mid-stack. */
47
+ const readTag = (tag) => Ref.get(buffers).pipe(Effect.map((map) => map.get(tag) ?? {
48
+ lines: [],
49
+ truncated: false
50
+ }));
51
+ /** Read every tag's current snapshot. Used by snapshot capture
52
+ * + diagnostics. Bounded by aggregate retention. */
53
+ const readAll = Ref.get(buffers);
54
+ /** Drop the buffer for a tag. Used when a plugin row is removed. */
55
+ const clearTag = (tag) => Ref.update(buffers, (map) => {
56
+ if (!map.has(tag)) return map;
57
+ const next = new Map(map);
58
+ next.delete(tag);
59
+ return next;
60
+ });
61
+ return Logger$1.of({
62
+ log,
63
+ readTag,
64
+ readAll,
65
+ clearTag
66
+ });
67
+ }));
68
+ const logViaEffect = (line) => {
69
+ const annotated = Effect.annotateLogs({
70
+ [SpanAttr.logTag]: line.tag,
71
+ [SpanAttr.plugin]: line.pluginKey ?? "(none)",
72
+ ...line.fields
73
+ });
74
+ switch (line.level) {
75
+ case "trace": return Effect.logTrace(line.message).pipe(annotated);
76
+ case "debug": return Effect.logDebug(line.message).pipe(annotated);
77
+ case "info": return Effect.logInfo(line.message).pipe(annotated);
78
+ case "warn": return Effect.logWarning(line.message).pipe(annotated);
79
+ case "error": return Effect.logError(line.message).pipe(annotated);
80
+ case "fatal": return Effect.logFatal(line.message).pipe(annotated);
81
+ default:
82
+ line.level;
83
+ return Effect.void;
84
+ }
85
+ };
86
+ //#endregion
87
+ export { Logger$1 as Logger, layerLogger };
88
+
89
+ //# sourceMappingURL=logger.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.mjs","names":["Logger"],"sources":["../../../../src/substrate/runtime/observability/logger.ts"],"sourcesContent":["// Structured per-tag log buffer.\n//\n// Architecture § L0 Observability primitives: \"structured log buffer,\n// span/annotation conventions, cause walker (shared with renderers,\n// not duplicated)\".\n//\n// Replaces the ad-hoc `appendTagLog` shape on the legacy `EngineHandle`\n// with a typed Service. Plugins acquire a `Logger` and publish lines;\n// the substrate keeps each line in a bounded per-tag ring buffer and\n// mirrors it into Effect's structured logging via `Effect.log*`.\n// Operator-level lines are also projected into the typed event stream\n// by the supervisor wrapper.\n//\n// Per-tag atomicity is guaranteed by `Ref.update` on the per-tag\n// buffer — single-fiber updates are linearizable and the buffer\n// reads are snapshot-consistent. Cross-process atomicity (when the\n// same log lands in two devstack processes via a shared file)\n// is delegated to the cross-process lock primitive in\n// `../cross-process-lock.ts`.\n\nimport { Context, Effect, Layer, Ref } from 'effect';\nimport { Data } from 'effect';\n\nimport type { PluginKey } from '../../brand.ts';\nimport { Redactor, redactValue } from './redaction.ts';\nimport { SpanAttr } from './spans.ts';\n\n// -----------------------------------------------------------------------------\n// Errors\n// -----------------------------------------------------------------------------\n\n/** Single tagged error class for every logger failure mode.\n *\n * The architecture says service-specific errors do NOT live in L0\n * (§ L0). `LoggerError` is engine-level — the only failure modes are\n * buffer-write contention (defected up) and over-large lines that\n * the bounded buffer refused to truncate. */\nexport class LoggerError extends Data.TaggedError('LoggerError')<{\n\treadonly reason: 'buffer-write-failed' | 'line-too-large';\n\treadonly tag: string;\n\treadonly cause?: unknown;\n}> {}\n\n// -----------------------------------------------------------------------------\n// Public types\n// -----------------------------------------------------------------------------\n\n/** Closed level set. Mirrors the projection's row.logTail.level\n * vocabulary, plus `debug` / `trace` for lifecycle diagnostics that\n * should stay in buffers / Effect logs rather than the renderer's\n * operator event stream. */\nexport type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';\n\n/** A buffered log line. Plain data; the projection's `Row.logTail`\n * derives from this. Structured fields live in `fields` for\n * observability consumers that want richer than a string. */\nexport interface LogLine {\n\treadonly tag: string;\n\treadonly pluginKey: PluginKey | null;\n\treadonly level: LogLevel;\n\treadonly message: string;\n\treadonly fields: Readonly<Record<string, unknown>>;\n\treadonly at: number;\n}\n\nexport interface LogPayload {\n\treadonly level: LogLevel;\n\treadonly message: string;\n\treadonly fields?: Readonly<Record<string, unknown>>;\n}\n\n/** Bounded ring-buffer for a single tag. */\nexport interface TagBuffer {\n\treadonly lines: ReadonlyArray<LogLine>;\n\treadonly truncated: boolean;\n}\n\n// -----------------------------------------------------------------------------\n// Capacity policy\n// -----------------------------------------------------------------------------\n\n/** Per-tag retention. Matches the projection's\n * `MAX_ROW_LOG_LINES` default. */\nexport const DEFAULT_MAX_LINES_PER_TAG = 100;\n\n/** Hard cap on a single log line in bytes (UTF-8). Lines past this\n * are truncated with an ellipsis. */\nexport const MAX_LINE_BYTES = 16 * 1024;\n\n// -----------------------------------------------------------------------------\n// Logger service\n// -----------------------------------------------------------------------------\n\n/**\n * Structured per-tag logger. One instance per stack (or per process —\n * provided via `layerLogger`). Plugins acquire it from Context.\n *\n * Discipline:\n * - The tag is the only thing the logger discriminates on. It is\n * not a service name; it's whatever the publishing fiber picked\n * (typically `pluginKey + '/' + sub-tag`).\n * - Atomic per-tag writes: `Ref.update` on a `ReadonlyMap` of\n * `tag → TagBuffer`. Two fibers logging to the same tag interleave\n * by Ref linearization, not by lost updates.\n * - Structured fields: anything serializable. The cascade formatter\n * (see `cascade-formatter.ts`) renders the fields verbatim.\n */\n/**\n * Public shape of the Logger service. Plugins / supervisor depend on\n * this interface; the concrete Layer below builds an instance.\n */\nexport interface LoggerShape {\n\treadonly log: (\n\t\ttag: string,\n\t\tpluginKey: PluginKey | null,\n\t\tpayload: LogPayload,\n\t) => Effect.Effect<void>;\n\treadonly readTag: (tag: string) => Effect.Effect<TagBuffer>;\n\treadonly readAll: Effect.Effect<ReadonlyMap<string, TagBuffer>>;\n\treadonly clearTag: (tag: string) => Effect.Effect<void>;\n}\n\nexport class Logger extends Context.Service<Logger, LoggerShape>()(\n\t'@devstack-rewrite/substrate/Logger',\n) {}\n\n/** Layer that constructs the per-stack Logger. Stateful (holds the\n * per-tag ring buffers in a Ref); the substrate provides one per\n * stack-scope. */\nexport const layerLogger: Layer.Layer<Logger, never, Redactor> = Layer.effect(\n\tLogger,\n\tEffect.gen(function* () {\n\t\tconst redactor = yield* Redactor;\n\t\tconst buffers = yield* Ref.make<ReadonlyMap<string, TagBuffer>>(new Map());\n\n\t\tconst truncateLine = (s: string): string =>\n\t\t\ts.length > MAX_LINE_BYTES ? `${s.slice(0, MAX_LINE_BYTES)}…[truncated]` : s;\n\n\t\tconst appendInternal = (line: LogLine): Effect.Effect<void> =>\n\t\t\tRef.update(buffers, (map) => {\n\t\t\t\tconst prev = map.get(line.tag) ?? { lines: [], truncated: false };\n\t\t\t\tconst nextLines = [...prev.lines, line];\n\t\t\t\tconst overflow = nextLines.length > DEFAULT_MAX_LINES_PER_TAG;\n\t\t\t\tconst trimmed = overflow ? nextLines.slice(-DEFAULT_MAX_LINES_PER_TAG) : nextLines;\n\t\t\t\tconst nextMap = new Map(map);\n\t\t\t\tnextMap.set(line.tag, { lines: trimmed, truncated: prev.truncated || overflow });\n\t\t\t\treturn nextMap;\n\t\t\t});\n\n\t\t/** Log a line under `tag`. Atomic per-tag. */\n\t\tconst log = Effect.fn('Logger.log')(function* (\n\t\t\ttag: string,\n\t\t\tpluginKey: PluginKey | null,\n\t\t\tpayload: LogPayload,\n\t\t) {\n\t\t\tconst redactionRules = yield* redactor.rules;\n\t\t\tconst line: LogLine = {\n\t\t\t\ttag,\n\t\t\t\tpluginKey,\n\t\t\t\tlevel: payload.level,\n\t\t\t\tmessage: truncateLine(yield* redactor.redact(payload.message)),\n\t\t\t\tfields: redactValue(payload.fields ?? {}, redactionRules) as Readonly<\n\t\t\t\t\tRecord<string, unknown>\n\t\t\t\t>,\n\t\t\t\tat: Date.now(),\n\t\t\t};\n\t\t\tyield* appendInternal(line);\n\t\t\t// Mirror to Effect's structured logger so OTEL exporters see\n\t\t\t// the line too. The bounded buffer is the renderer-facing\n\t\t\t// surface; Effect's logger is the observability-pipeline\n\t\t\t// surface.\n\t\t\tyield* logViaEffect(line);\n\t\t});\n\n\t\t/** Read the current snapshot of a single tag's buffer. Used by\n\t\t * the projection updater when a row is created mid-stack. */\n\t\tconst readTag = (tag: string): Effect.Effect<TagBuffer> =>\n\t\t\tRef.get(buffers).pipe(Effect.map((map) => map.get(tag) ?? { lines: [], truncated: false }));\n\n\t\t/** Read every tag's current snapshot. Used by snapshot capture\n\t\t * + diagnostics. Bounded by aggregate retention. */\n\t\tconst readAll = Ref.get(buffers);\n\n\t\t/** Drop the buffer for a tag. Used when a plugin row is removed. */\n\t\tconst clearTag = (tag: string): Effect.Effect<void> =>\n\t\t\tRef.update(buffers, (map) => {\n\t\t\t\tif (!map.has(tag)) return map;\n\t\t\t\tconst next = new Map(map);\n\t\t\t\tnext.delete(tag);\n\t\t\t\treturn next;\n\t\t\t});\n\n\t\treturn Logger.of({ log, readTag, readAll, clearTag });\n\t}),\n);\n\n// -----------------------------------------------------------------------------\n// Effect-logger bridge\n// -----------------------------------------------------------------------------\n\nconst logViaEffect = (line: LogLine): Effect.Effect<void> => {\n\tconst annotated = Effect.annotateLogs({\n\t\t[SpanAttr.logTag]: line.tag,\n\t\t[SpanAttr.plugin]: line.pluginKey ?? '(none)',\n\t\t...line.fields,\n\t});\n\tswitch (line.level) {\n\t\tcase 'trace':\n\t\t\treturn Effect.logTrace(line.message).pipe(annotated);\n\t\tcase 'debug':\n\t\t\treturn Effect.logDebug(line.message).pipe(annotated);\n\t\tcase 'info':\n\t\t\treturn Effect.logInfo(line.message).pipe(annotated);\n\t\tcase 'warn':\n\t\t\treturn Effect.logWarning(line.message).pipe(annotated);\n\t\tcase 'error':\n\t\t\treturn Effect.logError(line.message).pipe(annotated);\n\t\tcase 'fatal':\n\t\t\treturn Effect.logFatal(line.message).pipe(annotated);\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = line.level;\n\t\t\tvoid _exhaustive;\n\t\t\treturn Effect.void;\n\t\t}\n\t}\n};\n"],"mappings":";;;AAqCiC,KAAK,YAAY,cAAc;;;AAkDhE,MAAa,iBAAiB,KAAK;AAmCnC,IAAaA,WAAb,cAA4B,QAAQ,SAA8B,CACjE,qCACA,CAAC;;;;AAKF,MAAa,cAAoD,MAAM,OACtEA,UACA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,OAAO;CACxB,MAAM,UAAU,OAAO,IAAI,qBAAqC,IAAI,KAAK,CAAC;CAE1E,MAAM,gBAAgB,MACrB,EAAE,SAAA,QAA0B,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC,gBAAgB;CAE3E,MAAM,kBAAkB,SACvB,IAAI,OAAO,UAAU,QAAQ;EAC5B,MAAM,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI;GAAE,OAAO,EAAE;GAAE,WAAW;GAAO;EACjE,MAAM,YAAY,CAAC,GAAG,KAAK,OAAO,KAAK;EACvC,MAAM,WAAW,UAAU,SAAA;EAC3B,MAAM,UAAU,WAAW,UAAU,MAAM,KAA2B,GAAG;EACzE,MAAM,UAAU,IAAI,IAAI,IAAI;AAC5B,UAAQ,IAAI,KAAK,KAAK;GAAE,OAAO;GAAS,WAAW,KAAK,aAAa;GAAU,CAAC;AAChF,SAAO;GACN;;CAGH,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,WACnC,KACA,WACA,SACC;EACD,MAAM,iBAAiB,OAAO,SAAS;EACvC,MAAM,OAAgB;GACrB;GACA;GACA,OAAO,QAAQ;GACf,SAAS,aAAa,OAAO,SAAS,OAAO,QAAQ,QAAQ,CAAC;GAC9D,QAAQ,YAAY,QAAQ,UAAU,EAAE,EAAE,eAAe;GAGzD,IAAI,KAAK,KAAK;GACd;AACD,SAAO,eAAe,KAAK;AAK3B,SAAO,aAAa,KAAK;GACxB;;;CAIF,MAAM,WAAW,QAChB,IAAI,IAAI,QAAQ,CAAC,KAAK,OAAO,KAAK,QAAQ,IAAI,IAAI,IAAI,IAAI;EAAE,OAAO,EAAE;EAAE,WAAW;EAAO,CAAC,CAAC;;;CAI5F,MAAM,UAAU,IAAI,IAAI,QAAQ;;CAGhC,MAAM,YAAY,QACjB,IAAI,OAAO,UAAU,QAAQ;AAC5B,MAAI,CAAC,IAAI,IAAI,IAAI,CAAE,QAAO;EAC1B,MAAM,OAAO,IAAI,IAAI,IAAI;AACzB,OAAK,OAAO,IAAI;AAChB,SAAO;GACN;AAEH,QAAOA,SAAO,GAAG;EAAE;EAAK;EAAS;EAAS;EAAU,CAAC;EACpD,CACF;AAMD,MAAM,gBAAgB,SAAuC;CAC5D,MAAM,YAAY,OAAO,aAAa;GACpC,SAAS,SAAS,KAAK;GACvB,SAAS,SAAS,KAAK,aAAa;EACrC,GAAG,KAAK;EACR,CAAC;AACF,SAAQ,KAAK,OAAb;EACC,KAAK,QACJ,QAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,KAAK,UAAU;EACrD,KAAK,QACJ,QAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,KAAK,UAAU;EACrD,KAAK,OACJ,QAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,KAAK,UAAU;EACpD,KAAK,OACJ,QAAO,OAAO,WAAW,KAAK,QAAQ,CAAC,KAAK,UAAU;EACvD,KAAK,QACJ,QAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,KAAK,UAAU;EACrD,KAAK,QACJ,QAAO,OAAO,SAAS,KAAK,QAAQ,CAAC,KAAK,UAAU;EACrD;AAC4B,QAAK;AAEhC,UAAO,OAAO"}
@@ -0,0 +1 @@
1
+ import { Cause } from "effect";