@mysten-incubation/devstack 0.0.1 → 0.1.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 (838) hide show
  1. package/README.md +7 -3
  2. package/dashboard-ui/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  3. package/dashboard-ui/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  4. package/dashboard-ui/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  5. package/dashboard-ui/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  6. package/dashboard-ui/assets/geist-mono-cyrillic-ext-wght-normal-I4S5GZfc.woff2 +0 -0
  7. package/dashboard-ui/assets/geist-mono-cyrillic-wght-normal-BmXc_FBt.woff2 +0 -0
  8. package/dashboard-ui/assets/geist-mono-latin-ext-wght-normal-DrnZ1wKl.woff2 +0 -0
  9. package/dashboard-ui/assets/geist-mono-latin-wght-normal-B_7UjwxQ.woff2 +0 -0
  10. package/dashboard-ui/assets/geist-mono-symbols2-wght-normal-GZpp1pK2.woff2 +0 -0
  11. package/dashboard-ui/assets/geist-mono-vietnamese-wght-normal-D8KDMBhC.woff2 +0 -0
  12. package/dashboard-ui/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  13. package/dashboard-ui/assets/index-Bmi1UtAg.js +1356 -0
  14. package/dashboard-ui/assets/index-D5EShVt4.js +3 -0
  15. package/dashboard-ui/assets/index-Deml9drg.css +1 -0
  16. package/dashboard-ui/index.html +13 -0
  17. package/dist/api/define-capabilities.d.mts +14 -3
  18. package/dist/api/define-capabilities.mjs +18 -1
  19. package/dist/api/define-capabilities.mjs.map +1 -1
  20. package/dist/api/define-devstack.d.mts +1 -1
  21. package/dist/api/define-devstack.mjs +6 -26
  22. package/dist/api/define-devstack.mjs.map +1 -1
  23. package/dist/api/define-plugin.d.mts +1 -0
  24. package/dist/api/define-plugin.mjs +2 -0
  25. package/dist/api/inference-network.d.mts +132 -0
  26. package/dist/api/inference-network.mjs +105 -16
  27. package/dist/api/inference-network.mjs.map +1 -1
  28. package/dist/api/plugin-errors.d.mts +7 -0
  29. package/dist/api/run-stack.d.mts +20 -9
  30. package/dist/api/run-stack.mjs +56 -29
  31. package/dist/api/run-stack.mjs.map +1 -1
  32. package/dist/build-integrations/playwright/config.d.mts +6 -4
  33. package/dist/build-integrations/playwright/config.mjs +5 -3
  34. package/dist/build-integrations/playwright/config.mjs.map +1 -1
  35. package/dist/build-integrations/playwright/errors.d.mts +1 -1
  36. package/dist/build-integrations/playwright/global-setup.d.mts +43 -17
  37. package/dist/build-integrations/playwright/global-setup.mjs +250 -13
  38. package/dist/build-integrations/playwright/global-setup.mjs.map +1 -1
  39. package/dist/build-integrations/playwright/index.d.mts +5 -3
  40. package/dist/build-integrations/playwright/index.mjs +4 -2
  41. package/dist/build-integrations/playwright/stack-context.d.mts +0 -1
  42. package/dist/build-integrations/playwright/stack-context.mjs +24 -63
  43. package/dist/build-integrations/playwright/stack-context.mjs.map +1 -1
  44. package/dist/build-integrations/playwright/wallet-context.d.mts +7 -10
  45. package/dist/build-integrations/playwright/wallet-context.mjs +8 -13
  46. package/dist/build-integrations/playwright/wallet-context.mjs.map +1 -1
  47. package/dist/build-integrations/runtime/cold-start-url.d.mts +5 -0
  48. package/dist/build-integrations/runtime/cold-start-url.mjs +4 -3
  49. package/dist/build-integrations/runtime/cold-start-url.mjs.map +1 -1
  50. package/dist/build-integrations/runtime/conventional-routes.d.mts +51 -0
  51. package/dist/build-integrations/runtime/conventional-routes.mjs +92 -0
  52. package/dist/build-integrations/runtime/conventional-routes.mjs.map +1 -0
  53. package/dist/build-integrations/runtime/discover.d.mts +38 -30
  54. package/dist/build-integrations/runtime/discover.mjs +73 -70
  55. package/dist/build-integrations/runtime/discover.mjs.map +1 -1
  56. package/dist/build-integrations/runtime/endpoint-registry.d.mts +3 -1
  57. package/dist/build-integrations/runtime/endpoint-registry.mjs +3 -1
  58. package/dist/build-integrations/runtime/endpoint-registry.mjs.map +1 -1
  59. package/dist/build-integrations/runtime/index.d.mts +7 -2
  60. package/dist/build-integrations/runtime/index.mjs +9 -2
  61. package/dist/build-integrations/runtime/manifest-types.d.mts +2 -0
  62. package/dist/build-integrations/runtime/manifest-types.mjs +3 -0
  63. package/dist/build-integrations/runtime/playwright-stack-context-slot.d.mts +29 -0
  64. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs +10 -0
  65. package/dist/build-integrations/runtime/playwright-stack-context-slot.mjs.map +1 -0
  66. package/dist/build-integrations/runtime/read-stack-context.d.mts +1 -1
  67. package/dist/build-integrations/runtime/read-stack-context.mjs +10 -4
  68. package/dist/build-integrations/runtime/read-stack-context.mjs.map +1 -1
  69. package/dist/build-integrations/runtime/resolve-discovery-env.d.mts +48 -0
  70. package/dist/build-integrations/runtime/resolve-discovery-env.mjs +42 -0
  71. package/dist/build-integrations/runtime/resolve-discovery-env.mjs.map +1 -0
  72. package/dist/build-integrations/runtime/stack-context.d.mts +1 -1
  73. package/dist/build-integrations/runtime/wallet-paths.mjs +2 -0
  74. package/dist/build-integrations/vite/index.d.mts +51 -0
  75. package/dist/build-integrations/vite/index.mjs +73 -0
  76. package/dist/build-integrations/vite/index.mjs.map +1 -0
  77. package/dist/build-integrations/vitest/env.d.mts +4 -3
  78. package/dist/build-integrations/vitest/env.mjs +6 -4
  79. package/dist/build-integrations/vitest/env.mjs.map +1 -1
  80. package/dist/build-integrations/vitest/errors.d.mts +25 -4
  81. package/dist/build-integrations/vitest/errors.mjs +15 -2
  82. package/dist/build-integrations/vitest/errors.mjs.map +1 -1
  83. package/dist/build-integrations/vitest/index.d.mts +2 -2
  84. package/dist/build-integrations/vitest/index.mjs +3 -3
  85. package/dist/build-integrations/vitest/setup.d.mts +4 -2
  86. package/dist/build-integrations/vitest/setup.mjs +2 -2
  87. package/dist/build-integrations/vitest/setup.mjs.map +1 -1
  88. package/dist/build-integrations/vitest/stack-context.d.mts +0 -1
  89. package/dist/build-integrations/vitest/stack-context.mjs +33 -13
  90. package/dist/build-integrations/vitest/stack-context.mjs.map +1 -1
  91. package/dist/cli/bail.mjs +23 -0
  92. package/dist/cli/bail.mjs.map +1 -0
  93. package/dist/{surfaces/cli/commands → cli}/doctor-probes.mjs +26 -16
  94. package/dist/cli/doctor-probes.mjs.map +1 -0
  95. package/dist/cli/main.d.mts +15 -1
  96. package/dist/cli/main.mjs +166 -482
  97. package/dist/cli/main.mjs.map +1 -1
  98. package/dist/cli/prune-direct.mjs +31 -201
  99. package/dist/cli/prune-direct.mjs.map +1 -1
  100. package/dist/cli/snapshot-reader.mjs +14 -11
  101. package/dist/cli/snapshot-reader.mjs.map +1 -1
  102. package/dist/cli/up-lifecycle.mjs +4 -1
  103. package/dist/cli/up-lifecycle.mjs.map +1 -1
  104. package/dist/cli/wirings/apply.mjs +95 -0
  105. package/dist/cli/wirings/apply.mjs.map +1 -0
  106. package/dist/cli/wirings/build-verb-layers.mjs +42 -0
  107. package/dist/cli/wirings/build-verb-layers.mjs.map +1 -0
  108. package/dist/cli/wirings/config-loader.mjs +69 -0
  109. package/dist/cli/wirings/config-loader.mjs.map +1 -0
  110. package/dist/cli/wirings/engine-command.mjs +30 -0
  111. package/dist/cli/wirings/engine-command.mjs.map +1 -0
  112. package/dist/cli/wirings/identity.mjs +72 -0
  113. package/dist/cli/wirings/identity.mjs.map +1 -0
  114. package/dist/cli/wirings/provide-file-system.mjs +7 -0
  115. package/dist/cli/wirings/provide-file-system.mjs.map +1 -0
  116. package/dist/cli/wirings/snapshot.mjs +177 -0
  117. package/dist/cli/wirings/snapshot.mjs.map +1 -0
  118. package/dist/cli/wirings/up.mjs +287 -0
  119. package/dist/cli/wirings/up.mjs.map +1 -0
  120. package/dist/cli/wirings/wipe.mjs +40 -0
  121. package/dist/cli/wirings/wipe.mjs.map +1 -0
  122. package/dist/contracts/capability-decl.d.mts +0 -2
  123. package/dist/contracts/codegenable.d.mts +43 -0
  124. package/dist/contracts/container-runtime.d.mts +26 -1
  125. package/dist/contracts/faucet-strategy.d.mts +25 -0
  126. package/dist/contracts/funding-strategy.d.mts +42 -0
  127. package/dist/contracts/plugin-expander.mjs +60 -0
  128. package/dist/contracts/plugin-expander.mjs.map +1 -0
  129. package/dist/contracts/projection.d.mts +5 -3
  130. package/dist/contracts/renderer.d.mts +23 -0
  131. package/dist/contracts/routable.d.mts +14 -1
  132. package/dist/contracts/snapshotable.d.mts +25 -3
  133. package/dist/contracts/wallet-protocol.d.mts +52 -0
  134. package/dist/contracts/wallet-protocol.mjs +52 -0
  135. package/dist/contracts/wallet-protocol.mjs.map +1 -0
  136. package/dist/index.d.mts +26 -25
  137. package/dist/index.mjs +20 -13
  138. package/dist/{runtime → orchestrators}/built-in-plugin-layers.mjs +10 -5
  139. package/dist/orchestrators/built-in-plugin-layers.mjs.map +1 -0
  140. package/dist/orchestrators/codegen/bindings.d.mts +1 -2
  141. package/dist/orchestrators/codegen/bindings.mjs +52 -186
  142. package/dist/orchestrators/codegen/bindings.mjs.map +1 -1
  143. package/dist/orchestrators/codegen/emit.mjs +19 -1
  144. package/dist/orchestrators/codegen/emit.mjs.map +1 -1
  145. package/dist/orchestrators/codegen/errors.mjs +8 -3
  146. package/dist/orchestrators/codegen/errors.mjs.map +1 -1
  147. package/dist/orchestrators/codegen/format.mjs +47 -39
  148. package/dist/orchestrators/codegen/format.mjs.map +1 -1
  149. package/dist/orchestrators/codegen/gitignore.mjs +3 -1
  150. package/dist/orchestrators/codegen/gitignore.mjs.map +1 -1
  151. package/dist/orchestrators/codegen/output-location.mjs +40 -0
  152. package/dist/orchestrators/codegen/output-location.mjs.map +1 -0
  153. package/dist/orchestrators/codegen/paths.d.mts +1 -1
  154. package/dist/orchestrators/codegen/paths.mjs +40 -14
  155. package/dist/orchestrators/codegen/paths.mjs.map +1 -1
  156. package/dist/orchestrators/codegen/permissions.mjs +3 -1
  157. package/dist/orchestrators/codegen/permissions.mjs.map +1 -1
  158. package/dist/orchestrators/codegen/service.mjs +157 -105
  159. package/dist/orchestrators/codegen/service.mjs.map +1 -1
  160. package/dist/orchestrators/lifecycle-prune/errors.mjs +31 -0
  161. package/dist/orchestrators/lifecycle-prune/errors.mjs.map +1 -0
  162. package/dist/orchestrators/lifecycle-prune/index.mjs +350 -0
  163. package/dist/orchestrators/lifecycle-prune/index.mjs.map +1 -0
  164. package/dist/orchestrators/router/cleanup.mjs +26 -27
  165. package/dist/orchestrators/router/cleanup.mjs.map +1 -1
  166. package/dist/orchestrators/router/entrypoints.mjs +2 -2
  167. package/dist/orchestrators/router/entrypoints.mjs.map +1 -1
  168. package/dist/orchestrators/router/file-provider.mjs +14 -5
  169. package/dist/orchestrators/router/file-provider.mjs.map +1 -1
  170. package/dist/orchestrators/router/hostname.mjs +19 -55
  171. package/dist/orchestrators/router/hostname.mjs.map +1 -1
  172. package/dist/orchestrators/router/index.mjs +11 -0
  173. package/dist/orchestrators/router/profile.mjs +2 -2
  174. package/dist/orchestrators/router/sentinels.mjs +26 -0
  175. package/dist/orchestrators/router/sentinels.mjs.map +1 -0
  176. package/dist/orchestrators/router/service.mjs +40 -37
  177. package/dist/orchestrators/router/service.mjs.map +1 -1
  178. package/dist/orchestrators/router/traefik-container.mjs +27 -16
  179. package/dist/orchestrators/router/traefik-container.mjs.map +1 -1
  180. package/dist/{substrate/runtime → orchestrators}/run.mjs +26 -21
  181. package/dist/orchestrators/run.mjs.map +1 -0
  182. package/dist/orchestrators/runtime-composition.d.mts +1 -1
  183. package/dist/orchestrators/runtime-composition.mjs +123 -39
  184. package/dist/orchestrators/runtime-composition.mjs.map +1 -1
  185. package/dist/orchestrators/snapshot/capture-command.d.mts +1 -0
  186. package/dist/orchestrators/snapshot/capture-command.mjs +25 -0
  187. package/dist/orchestrators/snapshot/capture-command.mjs.map +1 -0
  188. package/dist/orchestrators/snapshot/capture.mjs +42 -28
  189. package/dist/orchestrators/snapshot/capture.mjs.map +1 -1
  190. package/dist/orchestrators/snapshot/descriptor.mjs +35 -10
  191. package/dist/orchestrators/snapshot/descriptor.mjs.map +1 -1
  192. package/dist/orchestrators/snapshot/identity-guard.mjs +1 -1
  193. package/dist/orchestrators/snapshot/index.mjs +13 -0
  194. package/dist/orchestrators/snapshot/integrity.d.mts +1 -1
  195. package/dist/orchestrators/snapshot/integrity.mjs +73 -17
  196. package/dist/orchestrators/snapshot/integrity.mjs.map +1 -1
  197. package/dist/orchestrators/snapshot/pending-marker.d.mts +1 -0
  198. package/dist/orchestrators/snapshot/pending-marker.mjs +99 -0
  199. package/dist/orchestrators/snapshot/pending-marker.mjs.map +1 -0
  200. package/dist/orchestrators/snapshot/phase-error.mjs +23 -0
  201. package/dist/orchestrators/snapshot/phase-error.mjs.map +1 -0
  202. package/dist/orchestrators/snapshot/prune.mjs +20 -55
  203. package/dist/orchestrators/snapshot/prune.mjs.map +1 -1
  204. package/dist/orchestrators/snapshot/recover-pending.d.mts +1 -0
  205. package/dist/orchestrators/snapshot/recover-pending.mjs +223 -0
  206. package/dist/orchestrators/snapshot/recover-pending.mjs.map +1 -0
  207. package/dist/orchestrators/snapshot/restore.mjs +118 -84
  208. package/dist/orchestrators/snapshot/restore.mjs.map +1 -1
  209. package/dist/orchestrators/snapshot/service.mjs +53 -56
  210. package/dist/orchestrators/snapshot/service.mjs.map +1 -1
  211. package/dist/orchestrators/snapshot/state-document.d.mts +1 -0
  212. package/dist/orchestrators/snapshot/state-document.mjs +47 -7
  213. package/dist/orchestrators/snapshot/state-document.mjs.map +1 -1
  214. package/dist/orchestrators/snapshot/wipe.mjs +67 -10
  215. package/dist/orchestrators/snapshot/wipe.mjs.map +1 -1
  216. package/dist/plugins/account/codegen.mjs +9 -8
  217. package/dist/plugins/account/codegen.mjs.map +1 -1
  218. package/dist/plugins/account/errors.d.mts +33 -6
  219. package/dist/plugins/account/errors.mjs.map +1 -1
  220. package/dist/plugins/account/funding.d.mts +29 -19
  221. package/dist/plugins/account/funding.mjs +84 -66
  222. package/dist/plugins/account/funding.mjs.map +1 -1
  223. package/dist/plugins/account/index.d.mts +2 -4
  224. package/dist/plugins/account/index.mjs +64 -31
  225. package/dist/plugins/account/index.mjs.map +1 -1
  226. package/dist/plugins/account/keypair.mjs +6 -9
  227. package/dist/plugins/account/keypair.mjs.map +1 -1
  228. package/dist/plugins/account/lease.mjs +1 -0
  229. package/dist/plugins/account/lease.mjs.map +1 -1
  230. package/dist/plugins/account/registry.d.mts +14 -1
  231. package/dist/plugins/account/registry.mjs +18 -18
  232. package/dist/plugins/account/registry.mjs.map +1 -1
  233. package/dist/plugins/account/service.d.mts +23 -4
  234. package/dist/plugins/account/service.mjs +83 -45
  235. package/dist/plugins/account/service.mjs.map +1 -1
  236. package/dist/plugins/account/snapshot.mjs +2 -5
  237. package/dist/plugins/account/snapshot.mjs.map +1 -1
  238. package/dist/plugins/account/spans.mjs +16 -0
  239. package/dist/plugins/account/spans.mjs.map +1 -0
  240. package/dist/plugins/account/variants/keystore.mjs +6 -8
  241. package/dist/plugins/account/variants/keystore.mjs.map +1 -1
  242. package/dist/plugins/action/build-context.d.mts +3 -2
  243. package/dist/plugins/action/errors.d.mts +16 -12
  244. package/dist/plugins/action/errors.mjs.map +1 -1
  245. package/dist/plugins/action/execute.mjs +65 -103
  246. package/dist/plugins/action/execute.mjs.map +1 -1
  247. package/dist/plugins/action/index.d.mts +0 -2
  248. package/dist/plugins/action/index.mjs +17 -13
  249. package/dist/plugins/action/index.mjs.map +1 -1
  250. package/dist/plugins/action/service.mjs +38 -35
  251. package/dist/plugins/action/service.mjs.map +1 -1
  252. package/dist/plugins/action/spans.mjs +11 -0
  253. package/dist/plugins/action/spans.mjs.map +1 -0
  254. package/dist/plugins/coin/codegen.mjs +9 -8
  255. package/dist/plugins/coin/codegen.mjs.map +1 -1
  256. package/dist/plugins/coin/discovery.mjs +8 -4
  257. package/dist/plugins/coin/discovery.mjs.map +1 -1
  258. package/dist/plugins/coin/index.d.mts +11 -29
  259. package/dist/plugins/coin/index.mjs +56 -27
  260. package/dist/plugins/coin/index.mjs.map +1 -1
  261. package/dist/plugins/coin/metadata.mjs +8 -15
  262. package/dist/plugins/coin/metadata.mjs.map +1 -1
  263. package/dist/plugins/coin/mint.d.mts +30 -11
  264. package/dist/plugins/coin/mint.mjs +78 -74
  265. package/dist/plugins/coin/mint.mjs.map +1 -1
  266. package/dist/plugins/coin/registry.mjs +4 -7
  267. package/dist/plugins/coin/registry.mjs.map +1 -1
  268. package/dist/plugins/coin/service.d.mts +39 -1
  269. package/dist/plugins/coin/service.mjs +11 -4
  270. package/dist/plugins/coin/service.mjs.map +1 -1
  271. package/dist/plugins/coin/spans.mjs +20 -0
  272. package/dist/plugins/coin/spans.mjs.map +1 -0
  273. package/dist/plugins/dashboard/domain.mjs +402 -0
  274. package/dist/plugins/dashboard/domain.mjs.map +1 -0
  275. package/dist/plugins/dashboard/index.d.mts +29 -0
  276. package/dist/plugins/dashboard/index.mjs +91 -0
  277. package/dist/plugins/dashboard/index.mjs.map +1 -0
  278. package/dist/plugins/dashboard/origin-policy.mjs +36 -0
  279. package/dist/plugins/dashboard/origin-policy.mjs.map +1 -0
  280. package/dist/plugins/dashboard/routable.mjs +27 -0
  281. package/dist/plugins/dashboard/routable.mjs.map +1 -0
  282. package/dist/plugins/dashboard/schema/builder.mjs +21 -0
  283. package/dist/plugins/dashboard/schema/builder.mjs.map +1 -0
  284. package/dist/plugins/dashboard/schema/enums.mjs +72 -0
  285. package/dist/plugins/dashboard/schema/enums.mjs.map +1 -0
  286. package/dist/plugins/dashboard/schema/root.mjs +351 -0
  287. package/dist/plugins/dashboard/schema/root.mjs.map +1 -0
  288. package/dist/plugins/dashboard/schema/types.mjs +508 -0
  289. package/dist/plugins/dashboard/schema/types.mjs.map +1 -0
  290. package/dist/plugins/dashboard/schema.mjs +11 -0
  291. package/dist/plugins/dashboard/schema.mjs.map +1 -0
  292. package/dist/plugins/dashboard/server.mjs +166 -0
  293. package/dist/plugins/dashboard/server.mjs.map +1 -0
  294. package/dist/plugins/deepbook/deploy.mjs +53 -115
  295. package/dist/plugins/deepbook/deploy.mjs.map +1 -1
  296. package/dist/plugins/deepbook/errors.mjs +1 -0
  297. package/dist/plugins/deepbook/errors.mjs.map +1 -1
  298. package/dist/plugins/deepbook/faucet-strategy.mjs +47 -34
  299. package/dist/plugins/deepbook/faucet-strategy.mjs.map +1 -1
  300. package/dist/plugins/deepbook/hash.mjs +9 -0
  301. package/dist/plugins/deepbook/hash.mjs.map +1 -0
  302. package/dist/plugins/deepbook/index.d.mts +1 -10
  303. package/dist/plugins/deepbook/index.mjs +25 -22
  304. package/dist/plugins/deepbook/index.mjs.map +1 -1
  305. package/dist/plugins/deepbook/pyth/index.mjs +26 -55
  306. package/dist/plugins/deepbook/pyth/index.mjs.map +1 -1
  307. package/dist/plugins/deepbook/snapshot.mjs +17 -29
  308. package/dist/plugins/deepbook/snapshot.mjs.map +1 -1
  309. package/dist/plugins/deepbook/spans.mjs +18 -0
  310. package/dist/plugins/deepbook/spans.mjs.map +1 -0
  311. package/dist/plugins/deepbook/type-strings.mjs +65 -0
  312. package/dist/plugins/deepbook/type-strings.mjs.map +1 -0
  313. package/dist/plugins/deepbook/types.d.mts +2 -3
  314. package/dist/plugins/deepbook/types.mjs.map +1 -1
  315. package/dist/plugins/faucet/dispatcher.d.mts +21 -2
  316. package/dist/plugins/faucet/dispatcher.mjs +1 -2
  317. package/dist/plugins/faucet/dispatcher.mjs.map +1 -1
  318. package/dist/plugins/faucet/errors.d.mts +11 -24
  319. package/dist/plugins/faucet/errors.mjs.map +1 -1
  320. package/dist/plugins/faucet/http.mjs +33 -14
  321. package/dist/plugins/faucet/http.mjs.map +1 -1
  322. package/dist/plugins/faucet/index.d.mts +15 -5
  323. package/dist/plugins/faucet/index.mjs +3 -0
  324. package/dist/plugins/faucet/index.mjs.map +1 -1
  325. package/dist/plugins/faucet/spans.mjs +12 -0
  326. package/dist/plugins/faucet/spans.mjs.map +1 -0
  327. package/dist/plugins/host-service/errors.d.mts +1 -1
  328. package/dist/plugins/host-service/index.mjs +34 -8
  329. package/dist/plugins/host-service/index.mjs.map +1 -1
  330. package/dist/plugins/host-service/routable.mjs +2 -1
  331. package/dist/plugins/host-service/routable.mjs.map +1 -1
  332. package/dist/plugins/host-service/service.d.mts +21 -0
  333. package/dist/plugins/host-service/service.mjs +136 -81
  334. package/dist/plugins/host-service/service.mjs.map +1 -1
  335. package/dist/plugins/internal/acquire-on-chain-artifact.mjs +23 -0
  336. package/dist/plugins/internal/acquire-on-chain-artifact.mjs.map +1 -0
  337. package/dist/plugins/internal/codegen-helpers.mjs +18 -0
  338. package/dist/plugins/internal/codegen-helpers.mjs.map +1 -0
  339. package/dist/plugins/internal/funding-failure-error.mjs +32 -0
  340. package/dist/plugins/internal/funding-failure-error.mjs.map +1 -0
  341. package/dist/plugins/package/build.mjs +1 -1
  342. package/dist/plugins/package/build.mjs.map +1 -1
  343. package/dist/plugins/package/codegen.mjs +26 -0
  344. package/dist/plugins/package/codegen.mjs.map +1 -1
  345. package/dist/plugins/package/errors.d.mts +16 -6
  346. package/dist/plugins/package/errors.mjs.map +1 -1
  347. package/dist/plugins/package/index.d.mts +0 -4
  348. package/dist/plugins/package/index.mjs +27 -21
  349. package/dist/plugins/package/index.mjs.map +1 -1
  350. package/dist/plugins/package/mode-known.mjs +26 -12
  351. package/dist/plugins/package/mode-known.mjs.map +1 -1
  352. package/dist/plugins/package/mode-local.mjs +47 -41
  353. package/dist/plugins/package/mode-local.mjs.map +1 -1
  354. package/dist/plugins/package/publish-executor.mjs +55 -114
  355. package/dist/plugins/package/publish-executor.mjs.map +1 -1
  356. package/dist/plugins/package/registry.mjs +2 -1
  357. package/dist/plugins/package/registry.mjs.map +1 -1
  358. package/dist/plugins/package/service.mjs.map +1 -1
  359. package/dist/plugins/package/spans.mjs +14 -0
  360. package/dist/plugins/package/spans.mjs.map +1 -0
  361. package/dist/plugins/postgres/db-ensure.mjs +19 -12
  362. package/dist/plugins/postgres/db-ensure.mjs.map +1 -1
  363. package/dist/plugins/postgres/errors.d.mts +5 -0
  364. package/dist/plugins/postgres/errors.mjs.map +1 -1
  365. package/dist/plugins/postgres/index.mjs +10 -17
  366. package/dist/plugins/postgres/index.mjs.map +1 -1
  367. package/dist/plugins/postgres/service.mjs +58 -24
  368. package/dist/plugins/postgres/service.mjs.map +1 -1
  369. package/dist/plugins/postgres/snapshot.mjs.map +1 -1
  370. package/dist/plugins/postgres/spans.mjs +11 -0
  371. package/dist/plugins/postgres/spans.mjs.map +1 -0
  372. package/dist/plugins/router-entrypoints.mjs +4 -4
  373. package/dist/plugins/router-entrypoints.mjs.map +1 -1
  374. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs +15 -13
  375. package/dist/plugins/seal/bootstrap-assets/cargo-image.mjs.map +1 -1
  376. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs +15 -19
  377. package/dist/plugins/seal/bootstrap-assets/source-fetch.mjs.map +1 -1
  378. package/dist/plugins/seal/codegen.d.mts +2 -3
  379. package/dist/plugins/seal/codegen.mjs.map +1 -1
  380. package/dist/plugins/seal/config-render.mjs +35 -8
  381. package/dist/plugins/seal/config-render.mjs.map +1 -1
  382. package/dist/plugins/seal/deploy.mjs +31 -39
  383. package/dist/plugins/seal/deploy.mjs.map +1 -1
  384. package/dist/plugins/seal/errors.d.mts +1 -3
  385. package/dist/plugins/seal/errors.mjs +7 -1
  386. package/dist/plugins/seal/errors.mjs.map +1 -1
  387. package/dist/plugins/seal/index.d.mts +1 -6
  388. package/dist/plugins/seal/index.mjs +40 -14
  389. package/dist/plugins/seal/index.mjs.map +1 -1
  390. package/dist/plugins/seal/key-manager.d.mts +1 -9
  391. package/dist/plugins/seal/key-manager.mjs +2 -18
  392. package/dist/plugins/seal/key-manager.mjs.map +1 -1
  393. package/dist/plugins/seal/key-server.mjs +37 -36
  394. package/dist/plugins/seal/key-server.mjs.map +1 -1
  395. package/dist/plugins/seal/keygen.mjs +16 -17
  396. package/dist/plugins/seal/keygen.mjs.map +1 -1
  397. package/dist/plugins/seal/mode/fork-known.mjs +36 -14
  398. package/dist/plugins/seal/mode/fork-known.mjs.map +1 -1
  399. package/dist/plugins/seal/mode/live.d.mts +6 -4
  400. package/dist/plugins/seal/mode/live.mjs +14 -21
  401. package/dist/plugins/seal/mode/live.mjs.map +1 -1
  402. package/dist/plugins/seal/mode/local-keygen.mjs +57 -21
  403. package/dist/plugins/seal/mode/local-keygen.mjs.map +1 -1
  404. package/dist/plugins/seal/registry-publish.mjs +1 -0
  405. package/dist/plugins/seal/registry-publish.mjs.map +1 -1
  406. package/dist/plugins/seal/routable.mjs.map +1 -1
  407. package/dist/plugins/seal/service.mjs.map +1 -1
  408. package/dist/plugins/seal/spans.mjs +18 -0
  409. package/dist/plugins/seal/spans.mjs.map +1 -0
  410. package/dist/plugins/sui/auto-tick.mjs +17 -23
  411. package/dist/plugins/sui/auto-tick.mjs.map +1 -1
  412. package/dist/plugins/sui/chain-build-container.mjs +18 -0
  413. package/dist/plugins/sui/chain-build-container.mjs.map +1 -0
  414. package/dist/plugins/sui/chain-probe.d.mts +5 -5
  415. package/dist/plugins/sui/chain-probe.mjs +28 -58
  416. package/dist/plugins/sui/chain-probe.mjs.map +1 -1
  417. package/dist/plugins/sui/codegen.mjs +26 -0
  418. package/dist/plugins/sui/codegen.mjs.map +1 -1
  419. package/dist/plugins/sui/errors.d.mts +2 -29
  420. package/dist/plugins/sui/errors.mjs +1 -3
  421. package/dist/plugins/sui/errors.mjs.map +1 -1
  422. package/dist/plugins/sui/fork-faucet-strategy.d.mts +1 -0
  423. package/dist/plugins/sui/fork-faucet-strategy.mjs +55 -0
  424. package/dist/plugins/sui/fork-faucet-strategy.mjs.map +1 -0
  425. package/dist/plugins/sui/fork-orchestration.d.mts +1 -0
  426. package/dist/plugins/sui/fork-orchestration.mjs +170 -2
  427. package/dist/plugins/sui/fork-orchestration.mjs.map +1 -1
  428. package/dist/plugins/sui/fork-transaction.d.mts +2 -0
  429. package/dist/plugins/sui/fork-transaction.mjs +92 -28
  430. package/dist/plugins/sui/fork-transaction.mjs.map +1 -1
  431. package/dist/plugins/sui/index.d.mts +33 -70
  432. package/dist/plugins/sui/index.mjs +58 -35
  433. package/dist/plugins/sui/index.mjs.map +1 -1
  434. package/dist/plugins/{faucet/strategies/sui-local.mjs → sui/local-faucet-strategy.mjs} +10 -7
  435. package/dist/plugins/sui/local-faucet-strategy.mjs.map +1 -0
  436. package/dist/plugins/sui/mode/external.mjs +7 -13
  437. package/dist/plugins/sui/mode/external.mjs.map +1 -1
  438. package/dist/plugins/sui/mode/fork.mjs +136 -59
  439. package/dist/plugins/sui/mode/fork.mjs.map +1 -1
  440. package/dist/plugins/sui/mode/live.mjs +10 -16
  441. package/dist/plugins/sui/mode/live.mjs.map +1 -1
  442. package/dist/plugins/sui/mode/local.mjs +37 -36
  443. package/dist/plugins/sui/mode/local.mjs.map +1 -1
  444. package/dist/plugins/sui/mode/shared-boot.mjs +38 -115
  445. package/dist/plugins/sui/mode/shared-boot.mjs.map +1 -1
  446. package/dist/plugins/sui/mode/shared.d.mts +1 -5
  447. package/dist/plugins/sui/mode/shared.mjs.map +1 -1
  448. package/dist/plugins/sui/mode/spec.d.mts +18 -0
  449. package/dist/plugins/sui/move-summary-runner.mjs +207 -0
  450. package/dist/plugins/sui/move-summary-runner.mjs.map +1 -0
  451. package/dist/plugins/sui/network-resolver.d.mts +4 -3
  452. package/dist/plugins/sui/service.mjs.map +1 -1
  453. package/dist/plugins/sui/snapshot.mjs +3 -0
  454. package/dist/plugins/sui/snapshot.mjs.map +1 -1
  455. package/dist/plugins/sui/spans.mjs +17 -0
  456. package/dist/plugins/sui/spans.mjs.map +1 -0
  457. package/dist/plugins/wallet/codegen.d.mts +0 -1
  458. package/dist/plugins/wallet/codegen.mjs +8 -9
  459. package/dist/plugins/wallet/codegen.mjs.map +1 -1
  460. package/dist/plugins/wallet/index.d.mts +6 -8
  461. package/dist/plugins/wallet/index.mjs +46 -35
  462. package/dist/plugins/wallet/index.mjs.map +1 -1
  463. package/dist/plugins/wallet/origin-policy.mjs +12 -28
  464. package/dist/plugins/wallet/origin-policy.mjs.map +1 -1
  465. package/dist/plugins/wallet/pairing.mjs +6 -4
  466. package/dist/plugins/wallet/pairing.mjs.map +1 -1
  467. package/dist/plugins/wallet/protocol.d.mts +1 -0
  468. package/dist/plugins/wallet/protocol.mjs +5 -44
  469. package/dist/plugins/wallet/protocol.mjs.map +1 -1
  470. package/dist/plugins/wallet/routable.mjs +2 -8
  471. package/dist/plugins/wallet/routable.mjs.map +1 -1
  472. package/dist/plugins/wallet/server.mjs +36 -44
  473. package/dist/plugins/wallet/server.mjs.map +1 -1
  474. package/dist/plugins/wallet/service.d.mts +1 -5
  475. package/dist/plugins/wallet/service.mjs +22 -18
  476. package/dist/plugins/wallet/service.mjs.map +1 -1
  477. package/dist/plugins/wallet/spans.mjs +22 -0
  478. package/dist/plugins/wallet/spans.mjs.map +1 -0
  479. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs +33 -8
  480. package/dist/plugins/walrus/bootstrap-assets/cargo-image.mjs.map +1 -1
  481. package/dist/plugins/walrus/codegen.d.mts +3 -3
  482. package/dist/plugins/walrus/codegen.mjs.map +1 -1
  483. package/dist/plugins/walrus/deploy-paths.mjs +21 -5
  484. package/dist/plugins/walrus/deploy-paths.mjs.map +1 -1
  485. package/dist/plugins/walrus/deploy.mjs +67 -69
  486. package/dist/plugins/walrus/deploy.mjs.map +1 -1
  487. package/dist/plugins/walrus/errors.mjs +1 -0
  488. package/dist/plugins/walrus/errors.mjs.map +1 -1
  489. package/dist/plugins/walrus/faucet-strategy.mjs +12 -7
  490. package/dist/plugins/walrus/faucet-strategy.mjs.map +1 -1
  491. package/dist/plugins/walrus/index.d.mts +2 -13
  492. package/dist/plugins/walrus/index.mjs +18 -23
  493. package/dist/plugins/walrus/index.mjs.map +1 -1
  494. package/dist/plugins/walrus/mode/known-deploy.mjs +7 -5
  495. package/dist/plugins/walrus/mode/known-deploy.mjs.map +1 -1
  496. package/dist/plugins/walrus/mode/local-cluster.mjs +26 -7
  497. package/dist/plugins/walrus/mode/local-cluster.mjs.map +1 -1
  498. package/dist/plugins/walrus/registry-publish.mjs.map +1 -1
  499. package/dist/plugins/walrus/routable.mjs +7 -23
  500. package/dist/plugins/walrus/routable.mjs.map +1 -1
  501. package/dist/plugins/walrus/service.mjs.map +1 -1
  502. package/dist/plugins/walrus/spans.mjs +18 -0
  503. package/dist/plugins/walrus/spans.mjs.map +1 -0
  504. package/dist/plugins/walrus/storage-nodes.d.mts +6 -2
  505. package/dist/plugins/walrus/storage-nodes.mjs +15 -8
  506. package/dist/plugins/walrus/storage-nodes.mjs.map +1 -1
  507. package/dist/plugins/walrus/wal-swap.mjs +58 -15
  508. package/dist/plugins/walrus/wal-swap.mjs.map +1 -1
  509. package/dist/primitives/artifact-publisher.d.mts +1 -1
  510. package/dist/primitives/artifact-publisher.mjs +15 -0
  511. package/dist/primitives/artifact-publisher.mjs.map +1 -0
  512. package/dist/runtime/docker/client.mjs +17 -4
  513. package/dist/runtime/docker/client.mjs.map +1 -1
  514. package/dist/runtime/docker/container.mjs +219 -132
  515. package/dist/runtime/docker/container.mjs.map +1 -1
  516. package/dist/runtime/docker/errors.mjs +0 -6
  517. package/dist/runtime/docker/errors.mjs.map +1 -1
  518. package/dist/runtime/docker/exec.mjs +21 -18
  519. package/dist/runtime/docker/exec.mjs.map +1 -1
  520. package/dist/runtime/docker/image.mjs +36 -13
  521. package/dist/runtime/docker/image.mjs.map +1 -1
  522. package/dist/runtime/docker/index.mjs +14 -0
  523. package/dist/runtime/docker/inspect-and-decode.mjs +51 -0
  524. package/dist/runtime/docker/inspect-and-decode.mjs.map +1 -0
  525. package/dist/runtime/docker/inventory.mjs +14 -11
  526. package/dist/runtime/docker/inventory.mjs.map +1 -1
  527. package/dist/runtime/docker/labels.mjs +38 -5
  528. package/dist/runtime/docker/labels.mjs.map +1 -1
  529. package/dist/runtime/docker/logs.d.mts +1 -1
  530. package/dist/runtime/docker/logs.mjs.map +1 -1
  531. package/dist/runtime/docker/network.mjs +83 -47
  532. package/dist/runtime/docker/network.mjs.map +1 -1
  533. package/dist/runtime/docker/render-run-args.mjs +82 -0
  534. package/dist/runtime/docker/render-run-args.mjs.map +1 -0
  535. package/dist/runtime/docker/service.d.mts +1 -1
  536. package/dist/runtime/docker/service.mjs +12 -7
  537. package/dist/runtime/docker/service.mjs.map +1 -1
  538. package/dist/runtime/docker/sweep.mjs +118 -43
  539. package/dist/runtime/docker/sweep.mjs.map +1 -1
  540. package/dist/runtime/docker/volume.mjs +2 -0
  541. package/dist/runtime/docker/volume.mjs.map +1 -1
  542. package/dist/runtime/docker/wrap.mjs +30 -1
  543. package/dist/runtime/docker/wrap.mjs.map +1 -1
  544. package/dist/substrate/cross-process.mjs +14 -8
  545. package/dist/substrate/cross-process.mjs.map +1 -1
  546. package/dist/substrate/event-time.mjs +33 -0
  547. package/dist/substrate/event-time.mjs.map +1 -0
  548. package/dist/substrate/events.d.mts +28 -8
  549. package/dist/substrate/identity.d.mts +2 -1
  550. package/dist/substrate/manifest.d.mts +68 -5
  551. package/dist/substrate/manifest.mjs +34 -5
  552. package/dist/substrate/manifest.mjs.map +1 -1
  553. package/dist/substrate/network.d.mts +3 -5
  554. package/dist/substrate/options.d.mts +0 -2
  555. package/dist/substrate/plugin.d.mts +13 -0
  556. package/dist/substrate/plugin.mjs +4 -2
  557. package/dist/substrate/plugin.mjs.map +1 -1
  558. package/dist/substrate/projection.d.mts +35 -3
  559. package/dist/substrate/runtime/artifact-publisher/index.mjs +19 -9
  560. package/dist/substrate/runtime/artifact-publisher/index.mjs.map +1 -1
  561. package/dist/substrate/runtime/atomic-write.mjs +97 -32
  562. package/dist/substrate/runtime/atomic-write.mjs.map +1 -1
  563. package/dist/substrate/runtime/cache/index.mjs +3 -0
  564. package/dist/substrate/runtime/cache/schema.mjs +2 -2
  565. package/dist/substrate/runtime/cache/schema.mjs.map +1 -1
  566. package/dist/substrate/runtime/cache/service.mjs +9 -7
  567. package/dist/substrate/runtime/cache/service.mjs.map +1 -1
  568. package/dist/substrate/runtime/capability-sinks/index.d.mts +1 -1
  569. package/dist/substrate/runtime/capability-sinks/index.mjs +3 -0
  570. package/dist/substrate/runtime/capability-sinks/layer.mjs +1 -1
  571. package/dist/substrate/runtime/capability-sinks/service.d.mts +61 -2
  572. package/dist/substrate/runtime/capability-sinks/service.mjs +21 -26
  573. package/dist/substrate/runtime/capability-sinks/service.mjs.map +1 -1
  574. package/dist/substrate/runtime/config-validation.d.mts +1 -13
  575. package/dist/substrate/runtime/config-validation.mjs +2 -91
  576. package/dist/substrate/runtime/config-validation.mjs.map +1 -1
  577. package/dist/substrate/runtime/container-runtime.d.mts +1 -0
  578. package/dist/substrate/runtime/container-runtime.mjs +2 -0
  579. package/dist/substrate/runtime/control-plane/domain.mjs +101 -0
  580. package/dist/substrate/runtime/control-plane/domain.mjs.map +1 -0
  581. package/dist/substrate/runtime/control-plane/service.mjs +7 -0
  582. package/dist/substrate/runtime/control-plane/service.mjs.map +1 -0
  583. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs +46 -19
  584. package/dist/substrate/runtime/cross-process/command-channel/channel.mjs.map +1 -1
  585. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs +30 -12
  586. package/dist/substrate/runtime/cross-process/command-channel/file-channel.mjs.map +1 -1
  587. package/dist/substrate/runtime/cross-process/command-channel/index.mjs +5 -0
  588. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs +11 -2
  589. package/dist/substrate/runtime/cross-process/command-channel/protocol.mjs.map +1 -1
  590. package/dist/substrate/runtime/cross-process/command-channel/runtime-control-lock.mjs +1 -1
  591. package/dist/substrate/runtime/cross-process/index.mjs +11 -0
  592. package/dist/substrate/runtime/cross-process/live-clock.mjs +34 -0
  593. package/dist/substrate/runtime/cross-process/live-clock.mjs.map +1 -0
  594. package/dist/substrate/runtime/cross-process/liveness.mjs +52 -10
  595. package/dist/substrate/runtime/cross-process/liveness.mjs.map +1 -1
  596. package/dist/substrate/runtime/cross-process/lock.d.mts +1 -0
  597. package/dist/substrate/runtime/cross-process/lock.mjs +23 -0
  598. package/dist/substrate/runtime/cross-process/lock.mjs.map +1 -0
  599. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs +64 -0
  600. package/dist/substrate/runtime/cross-process/reclaim-stale-file.mjs.map +1 -0
  601. package/dist/substrate/runtime/cross-process/roster.mjs +97 -83
  602. package/dist/substrate/runtime/cross-process/roster.mjs.map +1 -1
  603. package/dist/substrate/runtime/cross-process/self-pid.mjs +8 -0
  604. package/dist/substrate/runtime/cross-process/self-pid.mjs.map +1 -0
  605. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs +24 -28
  606. package/dist/substrate/runtime/cross-process/snapshot-reservation.mjs.map +1 -1
  607. package/dist/substrate/runtime/cross-process/stack-lock.mjs +41 -20
  608. package/dist/substrate/runtime/cross-process/stack-lock.mjs.map +1 -1
  609. package/dist/substrate/runtime/current-plugin.mjs +2 -2
  610. package/dist/substrate/runtime/current-plugin.mjs.map +1 -1
  611. package/dist/substrate/runtime/errors.mjs +12 -6
  612. package/dist/substrate/runtime/errors.mjs.map +1 -1
  613. package/dist/substrate/runtime/format-unknown-error.mjs +30 -0
  614. package/dist/substrate/runtime/format-unknown-error.mjs.map +1 -0
  615. package/dist/substrate/runtime/host-bind-mount-owner.mjs +10 -0
  616. package/dist/substrate/runtime/host-bind-mount-owner.mjs.map +1 -0
  617. package/dist/substrate/runtime/host-gateway.mjs +20 -0
  618. package/dist/substrate/runtime/host-gateway.mjs.map +1 -0
  619. package/dist/substrate/runtime/host-tree-tar/index.mjs +61 -50
  620. package/dist/substrate/runtime/host-tree-tar/index.mjs.map +1 -1
  621. package/dist/substrate/runtime/http-probe.d.mts +1 -1
  622. package/dist/substrate/runtime/index.mjs +14 -0
  623. package/dist/substrate/runtime/lease-broker/index.d.mts +1 -1
  624. package/dist/substrate/runtime/lease-broker/index.mjs +2 -0
  625. package/dist/substrate/runtime/lease-broker/service.d.mts +1 -64
  626. package/dist/substrate/runtime/lease-broker/service.mjs +1 -1
  627. package/dist/substrate/runtime/lease-broker/service.mjs.map +1 -1
  628. package/dist/substrate/runtime/lifecycle/dep-graph.mjs +22 -3
  629. package/dist/substrate/runtime/lifecycle/dep-graph.mjs.map +1 -1
  630. package/dist/substrate/runtime/lifecycle/index.mjs +9 -0
  631. package/dist/substrate/runtime/lifecycle/lifecycle-fact.mjs.map +1 -1
  632. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs +20 -3
  633. package/dist/substrate/runtime/lifecycle/plugin-registry.mjs.map +1 -1
  634. package/dist/substrate/runtime/lifecycle/selective-restart.mjs +1 -1
  635. package/dist/substrate/runtime/lifecycle/signals.mjs +5 -5
  636. package/dist/substrate/runtime/lifecycle/signals.mjs.map +1 -1
  637. package/dist/substrate/runtime/lifecycle/state-machine.mjs +1 -1
  638. package/dist/substrate/runtime/managed-container.d.mts +19 -1
  639. package/dist/substrate/runtime/managed-container.mjs +20 -1
  640. package/dist/substrate/runtime/managed-container.mjs.map +1 -1
  641. package/dist/substrate/runtime/manifest/index.mjs +3 -0
  642. package/dist/substrate/runtime/manifest/manifest.mjs +15 -11
  643. package/dist/substrate/runtime/manifest/manifest.mjs.map +1 -1
  644. package/dist/substrate/runtime/mode-errors.mjs +20 -0
  645. package/dist/substrate/runtime/mode-errors.mjs.map +1 -0
  646. package/dist/substrate/runtime/observability/cascade-formatter.mjs +9 -13
  647. package/dist/substrate/runtime/observability/cascade-formatter.mjs.map +1 -1
  648. package/dist/substrate/runtime/observability/formatter-registry.mjs +19 -36
  649. package/dist/substrate/runtime/observability/formatter-registry.mjs.map +1 -1
  650. package/dist/substrate/runtime/observability/ignore-with-log.d.mts +1 -0
  651. package/dist/substrate/runtime/observability/ignore-with-log.mjs +17 -0
  652. package/dist/substrate/runtime/observability/ignore-with-log.mjs.map +1 -0
  653. package/dist/substrate/runtime/observability/index.d.mts +1 -1
  654. package/dist/substrate/runtime/observability/index.mjs +13 -0
  655. package/dist/substrate/runtime/observability/log-store.d.mts +1 -0
  656. package/dist/substrate/runtime/observability/log-store.mjs +175 -0
  657. package/dist/substrate/runtime/observability/log-store.mjs.map +1 -0
  658. package/dist/substrate/runtime/observability/logger.d.mts +2 -1
  659. package/dist/substrate/runtime/observability/logger.mjs +5 -9
  660. package/dist/substrate/runtime/observability/logger.mjs.map +1 -1
  661. package/dist/substrate/runtime/observability/output-truncate.mjs +35 -0
  662. package/dist/substrate/runtime/observability/output-truncate.mjs.map +1 -0
  663. package/dist/substrate/runtime/observability/pretty-error.mjs +9 -12
  664. package/dist/substrate/runtime/observability/pretty-error.mjs.map +1 -1
  665. package/dist/substrate/runtime/observability/redaction.d.mts +2 -13
  666. package/dist/substrate/runtime/observability/redaction.mjs +8 -14
  667. package/dist/substrate/runtime/observability/redaction.mjs.map +1 -1
  668. package/dist/substrate/runtime/observability/span-store.d.mts +1 -0
  669. package/dist/substrate/runtime/observability/span-store.mjs +110 -0
  670. package/dist/substrate/runtime/observability/span-store.mjs.map +1 -0
  671. package/dist/substrate/runtime/observability/spans.mjs +14 -14
  672. package/dist/substrate/runtime/observability/spans.mjs.map +1 -1
  673. package/dist/substrate/runtime/observability/subprocess-capture.mjs +1 -1
  674. package/dist/substrate/runtime/passthrough-or-wrap.mjs +33 -0
  675. package/dist/substrate/runtime/passthrough-or-wrap.mjs.map +1 -0
  676. package/dist/substrate/runtime/paths.d.mts +1 -1
  677. package/dist/substrate/runtime/paths.mjs +4 -3
  678. package/dist/substrate/runtime/paths.mjs.map +1 -1
  679. package/dist/substrate/runtime/phase-preserving-produce.mjs +40 -0
  680. package/dist/substrate/runtime/phase-preserving-produce.mjs.map +1 -0
  681. package/dist/substrate/runtime/port-broker/index.mjs +3 -0
  682. package/dist/substrate/runtime/port-broker/service.mjs +170 -126
  683. package/dist/substrate/runtime/port-broker/service.mjs.map +1 -1
  684. package/dist/substrate/runtime/post-acquire-tasks.mjs +1 -1
  685. package/dist/substrate/runtime/post-acquire-tasks.mjs.map +1 -1
  686. package/dist/substrate/runtime/probes.d.mts +7 -5
  687. package/dist/substrate/runtime/probes.mjs +3 -1
  688. package/dist/substrate/runtime/probes.mjs.map +1 -1
  689. package/dist/substrate/runtime/projection/index.mjs +4 -0
  690. package/dist/substrate/runtime/projection/operational-endpoints.mjs +1 -2
  691. package/dist/substrate/runtime/projection/operational-endpoints.mjs.map +1 -1
  692. package/dist/substrate/runtime/projection/persisted.mjs +33 -15
  693. package/dist/substrate/runtime/projection/persisted.mjs.map +1 -1
  694. package/dist/substrate/runtime/projection/state-ref.mjs +26 -2
  695. package/dist/substrate/runtime/projection/state-ref.mjs.map +1 -1
  696. package/dist/substrate/runtime/projection/update.mjs +88 -24
  697. package/dist/substrate/runtime/projection/update.mjs.map +1 -1
  698. package/dist/substrate/runtime/random-suffix.mjs +11 -0
  699. package/dist/substrate/runtime/random-suffix.mjs.map +1 -0
  700. package/dist/substrate/runtime/retry-policy.d.mts +59 -1
  701. package/dist/substrate/runtime/retry-policy.mjs +66 -1
  702. package/dist/substrate/runtime/retry-policy.mjs.map +1 -1
  703. package/dist/substrate/runtime/routed-url.d.mts +1 -0
  704. package/dist/substrate/runtime/routed-url.mjs +79 -0
  705. package/dist/substrate/runtime/routed-url.mjs.map +1 -0
  706. package/dist/substrate/runtime/runtime-decode.d.mts +1 -1
  707. package/dist/substrate/runtime/runtime-decode.mjs.map +1 -1
  708. package/dist/substrate/runtime/scoped-http-server.mjs +2 -3
  709. package/dist/substrate/runtime/scoped-http-server.mjs.map +1 -1
  710. package/dist/substrate/runtime/scoped-multimap/index.mjs +2 -0
  711. package/dist/substrate/runtime/scoped-multimap/service.mjs +52 -0
  712. package/dist/substrate/runtime/scoped-multimap/service.mjs.map +1 -0
  713. package/dist/substrate/runtime/scoped-ref-map/index.mjs +2 -0
  714. package/dist/substrate/runtime/scoped-ref-map/service.mjs +2 -2
  715. package/dist/substrate/runtime/scoped-ref-map/service.mjs.map +1 -1
  716. package/dist/substrate/runtime/stage-and-swap/index.mjs +72 -4
  717. package/dist/substrate/runtime/stage-and-swap/index.mjs.map +1 -1
  718. package/dist/substrate/runtime/state-store/index.d.mts +1 -0
  719. package/dist/substrate/runtime/state-store/index.mjs +3 -0
  720. package/dist/substrate/runtime/state-store/schema.d.mts +1 -0
  721. package/dist/substrate/runtime/state-store/schema.mjs +19 -14
  722. package/dist/substrate/runtime/state-store/schema.mjs.map +1 -1
  723. package/dist/substrate/runtime/state-store/service.d.mts +1 -0
  724. package/dist/substrate/runtime/state-store/service.mjs +145 -0
  725. package/dist/substrate/runtime/state-store/service.mjs.map +1 -0
  726. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.d.mts +1 -0
  727. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs +33 -0
  728. package/dist/substrate/runtime/strategy-registry/chain-keyed-strategy-for.mjs.map +1 -0
  729. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs +1 -1
  730. package/dist/substrate/runtime/strategy-registry/chain-probe-for.mjs.map +1 -1
  731. package/dist/substrate/runtime/strategy-registry/index.mjs +4 -0
  732. package/dist/substrate/runtime/strategy-registry/service.mjs +19 -33
  733. package/dist/substrate/runtime/strategy-registry/service.mjs.map +1 -1
  734. package/dist/substrate/runtime/subnet-broker.mjs +60 -0
  735. package/dist/substrate/runtime/subnet-broker.mjs.map +1 -0
  736. package/dist/substrate/runtime/sui-execute/index.d.mts +21 -1
  737. package/dist/substrate/runtime/sui-execute/index.mjs +84 -20
  738. package/dist/substrate/runtime/sui-execute/index.mjs.map +1 -1
  739. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.d.mts +1 -0
  740. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs +32 -0
  741. package/dist/substrate/runtime/sui-execute/sign-and-dispatch.mjs.map +1 -0
  742. package/dist/substrate/runtime/sui-ledger/object-ref.mjs +32 -0
  743. package/dist/substrate/runtime/sui-ledger/object-ref.mjs.map +1 -0
  744. package/dist/substrate/runtime/sui-move-build/index.mjs +93 -19
  745. package/dist/substrate/runtime/sui-move-build/index.mjs.map +1 -1
  746. package/dist/substrate/runtime/supervisor/acquire-node.mjs +181 -0
  747. package/dist/substrate/runtime/supervisor/acquire-node.mjs.map +1 -0
  748. package/dist/substrate/runtime/supervisor/background-tasks.mjs +144 -0
  749. package/dist/substrate/runtime/supervisor/background-tasks.mjs.map +1 -0
  750. package/dist/substrate/runtime/supervisor/command-loop.mjs +68 -0
  751. package/dist/substrate/runtime/supervisor/command-loop.mjs.map +1 -0
  752. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs +151 -0
  753. package/dist/substrate/runtime/supervisor/dispatch-contributions.mjs.map +1 -0
  754. package/dist/substrate/runtime/supervisor/errors.d.mts +1 -0
  755. package/dist/substrate/runtime/supervisor/errors.mjs +9 -0
  756. package/dist/substrate/runtime/supervisor/errors.mjs.map +1 -0
  757. package/dist/substrate/runtime/supervisor/index.d.mts +1 -0
  758. package/dist/substrate/runtime/supervisor/index.mjs +3 -0
  759. package/dist/substrate/runtime/supervisor/shutdown.mjs +51 -0
  760. package/dist/substrate/runtime/supervisor/shutdown.mjs.map +1 -0
  761. package/dist/substrate/runtime/supervisor/start-supervisor.d.mts +1 -0
  762. package/dist/substrate/runtime/supervisor/start-supervisor.mjs +250 -0
  763. package/dist/substrate/runtime/supervisor/start-supervisor.mjs.map +1 -0
  764. package/dist/substrate/runtime/supervisor/state.d.mts +1 -0
  765. package/dist/substrate/runtime/supervisor/state.mjs +22 -0
  766. package/dist/substrate/runtime/supervisor/state.mjs.map +1 -0
  767. package/dist/substrate/runtime/supervisor/teardown.mjs +57 -0
  768. package/dist/substrate/runtime/supervisor/teardown.mjs.map +1 -0
  769. package/dist/substrate/runtime/supervisor/types.d.mts +1 -0
  770. package/dist/substrate/runtime/supervisor/wiring.mjs +133 -0
  771. package/dist/substrate/runtime/supervisor/wiring.mjs.map +1 -0
  772. package/dist/substrate/runtime/typed-env.mjs +8 -0
  773. package/dist/substrate/runtime/typed-env.mjs.map +1 -0
  774. package/dist/substrate/state-store.d.mts +1 -0
  775. package/dist/substrate/versioned-doc-schema.mjs +17 -0
  776. package/dist/substrate/versioned-doc-schema.mjs.map +1 -0
  777. package/dist/substrate/versioned-doc-sync.mjs +94 -0
  778. package/dist/substrate/versioned-doc-sync.mjs.map +1 -0
  779. package/dist/surfaces/cli/command-tree.mjs.map +1 -1
  780. package/dist/surfaces/cli/commands/index.mjs +9 -0
  781. package/dist/surfaces/cli/commands/prune-picker-entry.mjs +13 -0
  782. package/dist/surfaces/cli/commands/prune-picker-entry.mjs.map +1 -0
  783. package/dist/surfaces/cli/commands/prune-picker.mjs +3 -2
  784. package/dist/surfaces/cli/commands/prune-picker.mjs.map +1 -1
  785. package/dist/surfaces/cli/commands/prune.mjs +34 -17
  786. package/dist/surfaces/cli/commands/prune.mjs.map +1 -1
  787. package/dist/surfaces/cli/commands/status.mjs +2 -2
  788. package/dist/surfaces/cli/commands/status.mjs.map +1 -1
  789. package/dist/surfaces/cli/commands/supervisor-presence.mjs +5 -3
  790. package/dist/surfaces/cli/commands/supervisor-presence.mjs.map +1 -1
  791. package/dist/surfaces/cli/commands/wipe.mjs +38 -4
  792. package/dist/surfaces/cli/commands/wipe.mjs.map +1 -1
  793. package/dist/surfaces/cli/errors.mjs +1 -1
  794. package/dist/surfaces/cli/errors.mjs.map +1 -1
  795. package/dist/surfaces/cli/flags.mjs +0 -1
  796. package/dist/surfaces/cli/flags.mjs.map +1 -1
  797. package/dist/surfaces/cli/index.mjs +98 -18
  798. package/dist/surfaces/cli/index.mjs.map +1 -1
  799. package/dist/surfaces/cli/output.mjs +1 -0
  800. package/dist/surfaces/cli/output.mjs.map +1 -1
  801. package/dist/surfaces/cli/sysexits.mjs +2 -1
  802. package/dist/surfaces/cli/sysexits.mjs.map +1 -1
  803. package/dist/surfaces/tui/app.mjs +25 -3
  804. package/dist/surfaces/tui/app.mjs.map +1 -1
  805. package/dist/surfaces/tui/display-derivation.mjs +23 -74
  806. package/dist/surfaces/tui/display-derivation.mjs.map +1 -1
  807. package/dist/surfaces/tui/event-log.mjs +35 -23
  808. package/dist/surfaces/tui/event-log.mjs.map +1 -1
  809. package/dist/surfaces/tui/input.mjs +5 -1
  810. package/dist/surfaces/tui/input.mjs.map +1 -1
  811. package/dist/surfaces/tui/plain-renderer.mjs +70 -34
  812. package/dist/surfaces/tui/plain-renderer.mjs.map +1 -1
  813. package/package.json +24 -4
  814. package/dist/contracts/liveness-classifier.d.mts +0 -19
  815. package/dist/contracts/network-resolver.d.mts +0 -15
  816. package/dist/contracts/network-resolver.mjs +0 -7
  817. package/dist/contracts/network-resolver.mjs.map +0 -1
  818. package/dist/orchestrators/codegen/extras.mjs +0 -16
  819. package/dist/orchestrators/codegen/extras.mjs.map +0 -1
  820. package/dist/plugins/deepbook/routable.mjs +0 -21
  821. package/dist/plugins/deepbook/routable.mjs.map +0 -1
  822. package/dist/plugins/faucet/service.d.mts +0 -20
  823. package/dist/plugins/faucet/strategies/sui-local.d.mts +0 -23
  824. package/dist/plugins/faucet/strategies/sui-local.mjs.map +0 -1
  825. package/dist/plugins/sui/seed-objects.d.mts +0 -18
  826. package/dist/plugins/sui/seed-objects.mjs +0 -25
  827. package/dist/plugins/sui/seed-objects.mjs.map +0 -1
  828. package/dist/runtime/built-in-plugin-layers.mjs.map +0 -1
  829. package/dist/substrate/runtime/context-helpers.mjs +0 -32
  830. package/dist/substrate/runtime/context-helpers.mjs.map +0 -1
  831. package/dist/substrate/runtime/run.mjs.map +0 -1
  832. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs +0 -30
  833. package/dist/substrate/runtime/strategy-registry/faucet-capability-for.mjs.map +0 -1
  834. package/dist/substrate/runtime/supervisor.d.mts +0 -1
  835. package/dist/substrate/runtime/supervisor.mjs +0 -831
  836. package/dist/substrate/runtime/supervisor.mjs.map +0 -1
  837. package/dist/surfaces/cli/commands/doctor-probes.mjs.map +0 -1
  838. /package/dist/{substrate/runtime/strategy-registry/faucet-capability-for.d.mts → plugins/faucet/http.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/plugins/postgres/snapshot.ts"],"sourcesContent":["// Postgres plugin — Snapshotable contribution.\n//\n// Architecture §3: the snapshot orchestrator captures and restores\n// without naming the plugin. Postgres's contribution is the\n// container's writable layer — image-commit captures PGDATA only\n// because the vendored image relocates `PGDATA` OFF the upstream\n// `VOLUME /var/lib/postgresql/data` (which docker commit excludes).\n//\n// Identity contribution (distilled doc § Postgres-specific concerns +\n// architecture identity-guard pattern): the postgres \"server\n// identifier\" doubles as a guard. On restore we compare the\n// snapshot's stored postgres identity (server name + the set of\n// requested databases) against the resolver's current answer; if\n// the user pointed at a different cluster shape mid-cycle, the\n// identity-guard refuses BEFORE any destructive mutation.\n//\n// Stop-grace (distilled doc § Postgres-specific concerns): the service\n// threads a 20s Docker stop grace into the container spec, matching the\n// sui-indexer-db sidecar for the same image. This file's `quiesce`\n// Effect is intentionally `Effect.void` (the substrate engine pauses the\n// container around `docker commit`); the plugin only contributes the\n// LABEL TUPLE that lets the engine find it.\n\nimport { Effect } from 'effect';\n\nimport type { ContainerLabelTuple, SnapshotableDecl } from '../../contracts/snapshotable.ts';\n\n/** Identity payload contributed to the substrate's identity-guard.\n * The substrate's pre-restore hook reads this; identity mismatch\n * refuses the restore. Server name + ordered database list is the\n * smallest tuple that distinguishes a postgres instance for snapshot\n * purposes — image tag / version is intentionally NOT part of\n * identity (a minor-version bump should restore cleanly). */\nexport interface PostgresIdentityPayload {\n\treadonly kind: 'postgres-server';\n\treadonly name: string;\n\treadonly databases: ReadonlyArray<string>;\n}\n\nexport interface MakeSnapshotableOptions {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly name: string;\n\treadonly databases: ReadonlyArray<string>;\n}\n\n/** Build the Snapshotable contribution.\n *\n * Container-bearing only; no host-side subtree. Postgres's entire\n * state lives in the container's writable layer at the relocated\n * `PGDATA` (see `service.ts` for the image build context). */\nexport const makeSnapshotable = (opts: MakeSnapshotableOptions): SnapshotableDecl => {\n\tconst labels: ContainerLabelTuple = {\n\t\tapp: opts.app,\n\t\tstack: opts.stack,\n\t\tplugin: 'postgres',\n\t\trole: opts.name,\n\t};\n\n\tconst identity: PostgresIdentityPayload = {\n\t\tkind: 'postgres-server',\n\t\tname: opts.name,\n\t\t// Frozen list so the identity payload is structurally stable\n\t\t// across calls — the substrate hashes it for comparison.\n\t\tdatabases: Object.freeze([...opts.databases].sort()) as ReadonlyArray<string>,\n\t};\n\n\treturn {\n\t\tkind: 'snapshotable',\n\t\t// No host-tree subtree — all state lives in the container.\n\t\tsubtrees: [],\n\t\tmanagedContainers: [labels],\n\t\t// Engine-level pause-around-commit handles quiescence; the\n\t\t// plugin's contribution is just the label tuple above.\n\t\tmissingTolerance: 'fine',\n\t\tpreRestore: Effect.succeed(identity),\n\t\tpostRestore: Effect.void,\n\t};\n};\n"],"mappings":";;;;;;;AAmDA,MAAa,oBAAoB,SAAoD;CACpF,MAAM,SAA8B;EACnC,KAAK,KAAK;EACV,OAAO,KAAK;EACZ,QAAQ;EACR,MAAM,KAAK;EACX;CAED,MAAM,WAAoC;EACzC,MAAM;EACN,MAAM,KAAK;EAGX,WAAW,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,CAAC,MAAM,CAAC;EACpD;AAED,QAAO;EACN,MAAM;EAEN,UAAU,EAAE;EACZ,mBAAmB,CAAC,OAAO;EAG3B,kBAAkB;EAClB,YAAY,OAAO,QAAQ,SAAS;EACpC,aAAa,OAAO;EACpB"}
1
+ {"version":3,"file":"snapshot.mjs","names":[],"sources":["../../../src/plugins/postgres/snapshot.ts"],"sourcesContent":["// Postgres plugin — Snapshotable contribution.\n//\n// Architecture §3: the snapshot orchestrator captures and restores\n// without naming the plugin. Postgres's contribution is the\n// container's writable layer — image-commit captures PGDATA only\n// because the vendored image relocates `PGDATA` OFF the upstream\n// `VOLUME /var/lib/postgresql/data` (which docker commit excludes).\n//\n// Identity contribution (distilled doc § Postgres-specific concerns +\n// architecture identity-guard pattern): the postgres \"server\n// identifier\" doubles as a guard. On restore we compare the\n// snapshot's stored postgres identity (server name + the set of\n// requested databases) against the resolver's current answer; if\n// the user pointed at a different cluster shape mid-cycle, the\n// identity-guard refuses BEFORE any destructive mutation.\n//\n// Stop-grace (distilled doc § Postgres-specific concerns): the service\n// threads a 20s Docker stop grace into the container spec, matching the\n// sui-indexer-db sidecar for the same image. This file's `quiesce`\n// Effect is intentionally `Effect.void` (the substrate engine pauses the\n// container around `docker commit`); the plugin only contributes the\n// LABEL TUPLE that lets the engine find it.\n\nimport { Effect } from 'effect';\n\nimport type { ContainerLabelTuple, SnapshotableDecl } from '../../contracts/snapshotable.ts';\n\n/** Identity payload contributed to the substrate's identity-guard.\n * The substrate's pre-restore hook reads this; identity mismatch\n * refuses the restore. Server name + ordered database list is the\n * smallest tuple that distinguishes a postgres instance for snapshot\n * purposes — image tag / version is intentionally NOT part of\n * identity (a minor-version bump should restore cleanly). */\nexport type PostgresIdentityPayload = {\n\treadonly kind: 'postgres-server';\n\treadonly name: string;\n\treadonly databases: ReadonlyArray<string>;\n};\n\nexport interface MakeSnapshotableOptions {\n\treadonly app: string;\n\treadonly stack: string;\n\treadonly name: string;\n\treadonly databases: ReadonlyArray<string>;\n}\n\n/** Build the Snapshotable contribution.\n *\n * Container-bearing only; no host-side subtree. Postgres's entire\n * state lives in the container's writable layer at the relocated\n * `PGDATA` (see `service.ts` for the image build context). */\nexport const makeSnapshotable = (opts: MakeSnapshotableOptions): SnapshotableDecl => {\n\tconst labels: ContainerLabelTuple = {\n\t\tapp: opts.app,\n\t\tstack: opts.stack,\n\t\tplugin: 'postgres',\n\t\trole: opts.name,\n\t};\n\n\tconst identity: PostgresIdentityPayload = {\n\t\tkind: 'postgres-server',\n\t\tname: opts.name,\n\t\t// Frozen list so the identity payload is structurally stable\n\t\t// across calls — the substrate hashes it for comparison.\n\t\tdatabases: Object.freeze([...opts.databases].sort()) as ReadonlyArray<string>,\n\t};\n\n\treturn {\n\t\tkind: 'snapshotable',\n\t\t// No host-tree subtree — all state lives in the container.\n\t\tsubtrees: [],\n\t\tmanagedContainers: [labels],\n\t\t// Engine-level pause-around-commit handles quiescence; the\n\t\t// plugin's contribution is just the label tuple above.\n\t\tmissingTolerance: 'fine',\n\t\tpreRestore: Effect.succeed(identity),\n\t\tpostRestore: Effect.void,\n\t};\n};\n"],"mappings":";;;;;;;AAmDA,MAAa,oBAAoB,SAAoD;CACpF,MAAM,SAA8B;EACnC,KAAK,KAAK;EACV,OAAO,KAAK;EACZ,QAAQ;EACR,MAAM,KAAK;EACX;CAED,MAAM,WAAoC;EACzC,MAAM;EACN,MAAM,KAAK;EAGX,WAAW,OAAO,OAAO,CAAC,GAAG,KAAK,UAAU,CAAC,MAAM,CAAC;EACpD;AAED,QAAO;EACN,MAAM;EAEN,UAAU,EAAE;EACZ,mBAAmB,CAAC,OAAO;EAG3B,kBAAkB;EAClB,YAAY,OAAO,QAAQ,SAAS;EACpC,aAAa,OAAO;EACpB"}
@@ -0,0 +1,11 @@
1
+ //#region src/plugins/postgres/spans.ts
2
+ const PostgresSpans = {
3
+ database: "postgres.database",
4
+ name: "postgres.name",
5
+ timeoutMs: "postgres.timeoutMs",
6
+ version: "postgres.version"
7
+ };
8
+ //#endregion
9
+ export { PostgresSpans };
10
+
11
+ //# sourceMappingURL=spans.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spans.mjs","names":[],"sources":["../../../src/plugins/postgres/spans.ts"],"sourcesContent":["// Postgres plugin span-attribute vocabulary. Plugin-local — substrate's\n// `SpanAttr` carries only engine-dimensional + http/process generic\n// keys; plugin-domain keys live next to the plugin that owns them.\n//\n// Callsite pattern: `Effect.annotateCurrentSpan({ [PostgresSpans.database]:\n// value })`. Free-form string literals are a STYLE_GUIDE §16 violation.\n\nexport const PostgresSpans = {\n\tdatabase: 'postgres.database',\n\tname: 'postgres.name',\n\ttimeoutMs: 'postgres.timeoutMs',\n\tversion: 'postgres.version',\n} as const;\n"],"mappings":";AAOA,MAAa,gBAAgB;CAC5B,UAAU;CACV,MAAM;CACN,WAAW;CACX,SAAS;CACT"}
@@ -1,18 +1,18 @@
1
- import { SUI_ENTRYPOINTS } from "./sui/routable.mjs";
1
+ import { DASHBOARD_ENTRYPOINTS } from "./dashboard/routable.mjs";
2
2
  import { HOST_SERVICE_ENTRYPOINTS } from "./host-service/routable.mjs";
3
- import { WALLET_ENTRYPOINTS } from "./wallet/routable.mjs";
4
- import { DEEPBOOK_ENTRYPOINTS } from "./deepbook/routable.mjs";
5
3
  import { POSTGRES_ENTRYPOINTS } from "./postgres/routable.mjs";
6
4
  import { SEAL_ENTRYPOINTS } from "./seal/routable.mjs";
5
+ import { SUI_ENTRYPOINTS } from "./sui/routable.mjs";
6
+ import { WALLET_ENTRYPOINTS } from "./wallet/routable.mjs";
7
7
  import { WALRUS_ENTRYPOINTS } from "./walrus/routable.mjs";
8
8
  //#region src/plugins/router-entrypoints.ts
9
9
  const BUILT_IN_ENTRYPOINTS = [
10
+ ...DASHBOARD_ENTRYPOINTS,
10
11
  ...SUI_ENTRYPOINTS,
11
12
  ...HOST_SERVICE_ENTRYPOINTS,
12
13
  ...WALLET_ENTRYPOINTS,
13
14
  ...WALRUS_ENTRYPOINTS,
14
15
  ...SEAL_ENTRYPOINTS,
15
- ...DEEPBOOK_ENTRYPOINTS,
16
16
  ...POSTGRES_ENTRYPOINTS
17
17
  ];
18
18
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"router-entrypoints.mjs","names":[],"sources":["../../src/plugins/router-entrypoints.ts"],"sourcesContent":["// Built-in plugin router entrypoints.\n//\n// The router orchestrator owns registry validation and collision checks.\n// Built-in plugins own their public listener names and ports.\n\nimport type { EntrypointDecl } from '../contracts/routable.ts';\nimport { DEEPBOOK_ENTRYPOINTS } from './deepbook/routable.ts';\nimport { HOST_SERVICE_ENTRYPOINTS } from './host-service/routable.ts';\nimport { POSTGRES_ENTRYPOINTS } from './postgres/routable.ts';\nimport { SEAL_ENTRYPOINTS } from './seal/routable.ts';\nimport { SUI_ENTRYPOINTS } from './sui/routable.ts';\nimport { WALLET_ENTRYPOINTS } from './wallet/routable.ts';\nimport { WALRUS_ENTRYPOINTS } from './walrus/routable.ts';\n\nexport const BUILT_IN_ENTRYPOINTS: ReadonlyArray<EntrypointDecl> = [\n\t...SUI_ENTRYPOINTS,\n\t...HOST_SERVICE_ENTRYPOINTS,\n\t...WALLET_ENTRYPOINTS,\n\t...WALRUS_ENTRYPOINTS,\n\t...SEAL_ENTRYPOINTS,\n\t...DEEPBOOK_ENTRYPOINTS,\n\t...POSTGRES_ENTRYPOINTS,\n];\n"],"mappings":";;;;;;;;AAcA,MAAa,uBAAsD;CAClE,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH"}
1
+ {"version":3,"file":"router-entrypoints.mjs","names":[],"sources":["../../src/plugins/router-entrypoints.ts"],"sourcesContent":["// Built-in plugin router entrypoints.\n//\n// The router orchestrator owns registry validation and collision checks.\n// Built-in plugins own their public listener names and ports.\n\nimport type { EntrypointDecl } from '../contracts/routable.ts';\nimport { DASHBOARD_ENTRYPOINTS } from './dashboard/routable.ts';\nimport { HOST_SERVICE_ENTRYPOINTS } from './host-service/routable.ts';\nimport { POSTGRES_ENTRYPOINTS } from './postgres/routable.ts';\nimport { SEAL_ENTRYPOINTS } from './seal/routable.ts';\nimport { SUI_ENTRYPOINTS } from './sui/routable.ts';\nimport { WALLET_ENTRYPOINTS } from './wallet/routable.ts';\nimport { WALRUS_ENTRYPOINTS } from './walrus/routable.ts';\n\nexport const BUILT_IN_ENTRYPOINTS: ReadonlyArray<EntrypointDecl> = [\n\t...DASHBOARD_ENTRYPOINTS,\n\t...SUI_ENTRYPOINTS,\n\t...HOST_SERVICE_ENTRYPOINTS,\n\t...WALLET_ENTRYPOINTS,\n\t...WALRUS_ENTRYPOINTS,\n\t...SEAL_ENTRYPOINTS,\n\t...POSTGRES_ENTRYPOINTS,\n];\n"],"mappings":";;;;;;;;AAcA,MAAa,uBAAsD;CAClE,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH"}
@@ -1,11 +1,10 @@
1
+ import { readEnv } from "../../../substrate/runtime/typed-env.mjs";
1
2
  import { sealError } from "../errors.mjs";
3
+ import { SealSpans } from "../spans.mjs";
2
4
  import { DEFAULT_SEAL_REPO, DEFAULT_SEAL_VERSION } from "./source-fetch.mjs";
3
5
  import { Effect } from "effect";
6
+ import { fileURLToPath } from "node:url";
4
7
  //#region src/plugins/seal/bootstrap-assets/cargo-image.ts
5
- /** Pinned rust toolchain for the upstream seal cargo build. Distilled-
6
- * doc §Configuration defaults block. Pinned to match walrus's default
7
- * so a shared rust:1.93 builder image can fan out builds. */
8
- const DEFAULT_SEAL_RUST_TOOLCHAIN = "1.93";
9
8
  /** Resolve the seal image. Two staged paths:
10
9
  *
11
10
  * (a) `SEAL_CARGO_IMAGE_OVERRIDE` env var — points at a pre-baked
@@ -23,35 +22,38 @@ const DEFAULT_SEAL_RUST_TOOLCHAIN = "1.93";
23
22
  * package them. Build is content-addressed by docker; same
24
23
  * Dockerfile + same SEAL_VERSION → same image hash. */
25
24
  const resolveSealCargoImage = (runtime, inputs) => Effect.gen(function* () {
26
- const override = globalThis.process?.env?.SEAL_CARGO_IMAGE_OVERRIDE;
25
+ const override = readEnv("SEAL_CARGO_IMAGE_OVERRIDE");
27
26
  if (override && override.length > 0) return {
28
27
  digest: override,
29
28
  tag: override
30
29
  };
31
30
  const buildCtx = {
32
- contextPath: new URL("../../../../images/", import.meta.url).pathname,
31
+ contextPath: fileURLToPath(new URL("../../../../images/", import.meta.url)),
33
32
  dockerfile: "seal/Dockerfile",
34
33
  fingerprintPaths: [
35
34
  "seal/Dockerfile",
36
35
  "seal/entrypoint.sh",
37
36
  "_shared/signal-forward.sh"
38
37
  ],
39
- buildArgs: { SEAL_VERSION: inputs.sealRef }
38
+ buildArgs: { SEAL_VERSION: inputs.sealRef },
39
+ owner: {
40
+ app: inputs.owner.app,
41
+ stack: inputs.owner.stack,
42
+ plugin: "seal",
43
+ role: "key-server"
44
+ }
40
45
  };
41
46
  return yield* runtime.ensureImage(buildCtx).pipe(Effect.mapError((cause) => sealError("image", {
42
47
  name: "seal",
43
48
  message: `seal image build failed: ${cause.reason}: ${cause.detail}. SEAL_VERSION=${inputs.sealRef} (from ${inputs.sealRepo}/releases). Set SEAL_CARGO_IMAGE_OVERRIDE=<tag> to bypass the build.`,
44
49
  cause
45
50
  })));
46
- }).pipe(Effect.withSpan("devstack.plugin.seal.cargoImage.resolve", { attributes: {
47
- "seal.ref": inputs.sealRef,
48
- "seal.rustToolchain": inputs.rustToolchain
49
- } }));
51
+ }).pipe(Effect.withSpan("devstack.plugin.seal.cargoImage.resolve", { attributes: { [SealSpans.ref]: inputs.sealRef } }));
50
52
  /** Convenience: resolve via the default inputs. */
51
- const resolveDefaultSealCargoImage = (runtime) => resolveSealCargoImage(runtime, {
53
+ const resolveDefaultSealCargoImage = (runtime, owner) => resolveSealCargoImage(runtime, {
52
54
  sealRepo: DEFAULT_SEAL_REPO,
53
55
  sealRef: DEFAULT_SEAL_VERSION,
54
- rustToolchain: DEFAULT_SEAL_RUST_TOOLCHAIN
56
+ owner
55
57
  });
56
58
  //#endregion
57
59
  export { resolveDefaultSealCargoImage };
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-image.mjs","names":[],"sources":["../../../../src/plugins/seal/bootstrap-assets/cargo-image.ts"],"sourcesContent":["// Seal vendored-Dockerfile docker image.\n//\n// The upstream seal release ships pre-built `seal-cli` + `key-server`\n// binaries per platform, and our vendored Dockerfile at\n// `images/seal/Dockerfile` just fetches and packages them.\n//\n// Resolution paths (mirror walrus's two-stage dispatch — distilled-doc\n// §\"Pinned upstream version\" + §\"Optional pre-built image tag override\"):\n//\n// (a) `SEAL_CARGO_IMAGE_OVERRIDE` env — points at a pre-baked\n// registry tag (or a locally-tagged image like `seal-test-stub:latest`).\n// Skips the docker build entirely. The on-disk image is\n// content-addressed by the registry; we just thread it through.\n//\n// (b) Real build via `runtime.ensureImage({ contextPath,\n// dockerfile: 'Dockerfile', buildArgs: { SEAL_VERSION } })`\n// against the vendored Dockerfile at `images/seal/`. Mirrors\n// the sui plugin's `resolveImage` shape.\n\nimport { Effect, type Scope } from 'effect';\n\nimport type {\n\tContainerBuildContext,\n\tContainerRuntime,\n\tImageRef,\n} from '../../../contracts/container-runtime.ts';\nimport { sealError, type SealError } from '../errors.ts';\nimport { DEFAULT_SEAL_REPO, DEFAULT_SEAL_VERSION } from './source-fetch.ts';\n\n// ---------------------------------------------------------------------------\n/** Pinned rust toolchain for the upstream seal cargo build. Distilled-\n * doc §Configuration defaults block. Pinned to match walrus's default\n * so a shared rust:1.93 builder image can fan out builds. */\nexport const DEFAULT_SEAL_RUST_TOOLCHAIN = '1.93' as const;\n\n/** Inputs to the seal image resolver. */\nexport interface SealCargoImageInputs<Ref extends string = string, RustV extends string = string> {\n\treadonly sealRepo: typeof DEFAULT_SEAL_REPO;\n\treadonly sealRef: Ref;\n\treadonly rustToolchain: RustV;\n}\n\n// ---------------------------------------------------------------------------\n// Runtime resolver\n// ---------------------------------------------------------------------------\n\n/** Resolve the seal image. Two staged paths:\n *\n * (a) `SEAL_CARGO_IMAGE_OVERRIDE` env var — points at a pre-baked\n * registry tag (or a locally-built fixture image like\n * `seal-test-stub:latest`). Skips the docker build entirely\n * and returns a bare `ImageRef` synthesized from the override\n * tag. CI bakes the image once + pins the tag; the local-\n * keygen boot just reads the env.\n *\n * (b) Real build via `runtime.ensureImage` against the vendored\n * Dockerfile at `packages/devstack/images/seal/`. The\n * Dockerfile is a binary-fetch path (NOT a cargo compile) —\n * the seal release workflow ships pre-built per-platform\n * binaries (`seal-cli`, `key-server`) and we just fetch +\n * package them. Build is content-addressed by docker; same\n * Dockerfile + same SEAL_VERSION → same image hash. */\nexport const resolveSealCargoImage = (\n\truntime: ContainerRuntime,\n\tinputs: SealCargoImageInputs,\n): Effect.Effect<ImageRef, SealError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst override = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n\t\t\t.process?.env?.SEAL_CARGO_IMAGE_OVERRIDE;\n\t\tif (override && override.length > 0) {\n\t\t\t// Trust-the-tag path. Compose the resolved shape from the\n\t\t\t// pinned tag — the digest is opaque (substrate's\n\t\t\t// content-addressed cache will re-resolve via `docker\n\t\t\t// inspect` when it materializes the image).\n\t\t\treturn { digest: override, tag: override } satisfies ImageRef;\n\t\t}\n\t\t// Vendored-Dockerfile path. Same shape as sui's `resolveImage`\n\t\t// (plugins/sui/mode/local.ts:resolveImage). Context is `images/`\n\t\t// (NOT `images/seal/`) so the Dockerfile can `COPY` the shared\n\t\t// `_shared/signal-forward.sh` snippet alongside the seal-specific\n\t\t// entrypoint. The Dockerfile builds in two stages: (1) ubuntu\n\t\t// base, fetch + chmod the per-arch binaries from the seal release\n\t\t// URL; (2) debian:bookworm-slim runtime with the signal-\n\t\t// forwarding entrypoint shell wrapped around `key-server`.\n\t\tconst buildCtx: ContainerBuildContext = {\n\t\t\tcontextPath: new URL('../../../../images/', import.meta.url).pathname,\n\t\t\tdockerfile: 'seal/Dockerfile',\n\t\t\tfingerprintPaths: ['seal/Dockerfile', 'seal/entrypoint.sh', '_shared/signal-forward.sh'],\n\t\t\tbuildArgs: { SEAL_VERSION: inputs.sealRef },\n\t\t};\n\t\treturn yield* runtime.ensureImage(buildCtx).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsealError('image', {\n\t\t\t\t\tname: 'seal',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`seal image build failed: ${cause.reason}: ${cause.detail}. ` +\n\t\t\t\t\t\t`SEAL_VERSION=${inputs.sealRef} (from ${inputs.sealRepo}/releases). ` +\n\t\t\t\t\t\t`Set SEAL_CARGO_IMAGE_OVERRIDE=<tag> to bypass the build.`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.seal.cargoImage.resolve', {\n\t\t\tattributes: {\n\t\t\t\t'seal.ref': inputs.sealRef,\n\t\t\t\t'seal.rustToolchain': inputs.rustToolchain,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Convenience: resolve via the default inputs. */\nexport const resolveDefaultSealCargoImage = (\n\truntime: ContainerRuntime,\n): Effect.Effect<ImageRef, SealError, Scope.Scope> =>\n\tresolveSealCargoImage(runtime, {\n\t\tsealRepo: DEFAULT_SEAL_REPO,\n\t\tsealRef: DEFAULT_SEAL_VERSION,\n\t\trustToolchain: DEFAULT_SEAL_RUST_TOOLCHAIN,\n\t});\n"],"mappings":";;;;;;;AAiCA,MAAa,8BAA8B;;;;;;;;;;;;;;;;;AA6B3C,MAAa,yBACZ,SACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAY,WAChB,SAAS,KAAK;AAChB,KAAI,YAAY,SAAS,SAAS,EAKjC,QAAO;EAAE,QAAQ;EAAU,KAAK;EAAU;CAU3C,MAAM,WAAkC;EACvC,aAAa,IAAI,IAAI,uBAAuB,OAAO,KAAK,IAAI,CAAC;EAC7D,YAAY;EACZ,kBAAkB;GAAC;GAAmB;GAAsB;GAA4B;EACxF,WAAW,EAAE,cAAc,OAAO,SAAS;EAC3C;AACD,QAAO,OAAO,QAAQ,YAAY,SAAS,CAAC,KAC3C,OAAO,UAAU,UAChB,UAAU,SAAS;EAClB,MAAM;EACN,SACC,4BAA4B,MAAM,OAAO,IAAI,MAAM,OAAO,iBAC1C,OAAO,QAAQ,SAAS,OAAO,SAAS;EAEzD;EACA,CAAC,CACF,CACD;EACA,CAAC,KACF,OAAO,SAAS,2CAA2C,EAC1D,YAAY;CACX,YAAY,OAAO;CACnB,sBAAsB,OAAO;CAC7B,EACD,CAAC,CACF;;AAGF,MAAa,gCACZ,YAEA,sBAAsB,SAAS;CAC9B,UAAU;CACV,SAAS;CACT,eAAe;CACf,CAAC"}
1
+ {"version":3,"file":"cargo-image.mjs","names":[],"sources":["../../../../src/plugins/seal/bootstrap-assets/cargo-image.ts"],"sourcesContent":["// Seal vendored-Dockerfile docker image.\n//\n// The upstream seal release ships pre-built `seal-cli` + `key-server`\n// binaries per platform, and our vendored Dockerfile at\n// `images/seal/Dockerfile` just fetches and packages them.\n//\n// Resolution paths (mirror walrus's two-stage dispatch — distilled-doc\n// §\"Pinned upstream version\" + §\"Optional pre-built image tag override\"):\n//\n// (a) `SEAL_CARGO_IMAGE_OVERRIDE` env — points at a pre-baked\n// registry tag (or a locally-tagged image like `seal-test-stub:latest`).\n// Skips the docker build entirely. The on-disk image is\n// content-addressed by the registry; we just thread it through.\n//\n// (b) Real build via `runtime.ensureImage({ contextPath,\n// dockerfile: 'Dockerfile', buildArgs: { SEAL_VERSION } })`\n// against the vendored Dockerfile at `images/seal/`. Mirrors\n// the sui plugin's `resolveImage` shape.\n\nimport { Effect, type Scope } from 'effect';\nimport { fileURLToPath } from 'node:url';\n\nimport type {\n\tContainerBuildContext,\n\tContainerRuntime,\n\tImageRef,\n} from '../../../contracts/container-runtime.ts';\nimport { readEnv } from '../../../substrate/runtime/typed-env.ts';\nimport { sealError, type SealError } from '../errors.ts';\nimport { SealSpans } from '../spans.ts';\nimport { DEFAULT_SEAL_REPO, DEFAULT_SEAL_VERSION } from './source-fetch.ts';\n\n// ---------------------------------------------------------------------------\n/** Inputs to the seal image resolver. */\nexport interface SealCargoImageInputs<Ref extends string = string> {\n\treadonly sealRepo: typeof DEFAULT_SEAL_REPO;\n\treadonly sealRef: Ref;\n\t/** Owner identity stamped on the built image so label-driven prune\n\t * finds it. */\n\treadonly owner: {\n\t\treadonly app: string;\n\t\treadonly stack: string;\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Runtime resolver\n// ---------------------------------------------------------------------------\n\n/** Resolve the seal image. Two staged paths:\n *\n * (a) `SEAL_CARGO_IMAGE_OVERRIDE` env var — points at a pre-baked\n * registry tag (or a locally-built fixture image like\n * `seal-test-stub:latest`). Skips the docker build entirely\n * and returns a bare `ImageRef` synthesized from the override\n * tag. CI bakes the image once + pins the tag; the local-\n * keygen boot just reads the env.\n *\n * (b) Real build via `runtime.ensureImage` against the vendored\n * Dockerfile at `packages/devstack/images/seal/`. The\n * Dockerfile is a binary-fetch path (NOT a cargo compile) —\n * the seal release workflow ships pre-built per-platform\n * binaries (`seal-cli`, `key-server`) and we just fetch +\n * package them. Build is content-addressed by docker; same\n * Dockerfile + same SEAL_VERSION → same image hash. */\nexport const resolveSealCargoImage = (\n\truntime: ContainerRuntime,\n\tinputs: SealCargoImageInputs,\n): Effect.Effect<ImageRef, SealError, Scope.Scope> =>\n\tEffect.gen(function* () {\n\t\tconst override = readEnv('SEAL_CARGO_IMAGE_OVERRIDE');\n\t\tif (override && override.length > 0) {\n\t\t\t// Trust-the-tag path. Compose the resolved shape from the\n\t\t\t// pinned tag — the digest is opaque (substrate's\n\t\t\t// content-addressed cache will re-resolve via `docker\n\t\t\t// inspect` when it materializes the image).\n\t\t\treturn { digest: override, tag: override } satisfies ImageRef;\n\t\t}\n\t\t// Vendored-Dockerfile path. Same shape as sui's `resolveImage`\n\t\t// (plugins/sui/mode/local.ts:resolveImage). Context is `images/`\n\t\t// (NOT `images/seal/`) so the Dockerfile can `COPY` the shared\n\t\t// `_shared/signal-forward.sh` snippet alongside the seal-specific\n\t\t// entrypoint. The Dockerfile builds in two stages: (1) ubuntu\n\t\t// base, fetch + chmod the per-arch binaries from the seal release\n\t\t// URL; (2) debian:bookworm-slim runtime with the signal-\n\t\t// forwarding entrypoint shell wrapped around `key-server`.\n\t\tconst buildCtx: ContainerBuildContext = {\n\t\t\t// `fileURLToPath` normalises across platforms (Windows\n\t\t\t// `file:///C:/...` → `C:\\...`; POSIX strips the scheme and\n\t\t\t// percent-decodes). Using `.pathname` directly leaves the\n\t\t\t// leading `/` on Windows drive paths.\n\t\t\tcontextPath: fileURLToPath(new URL('../../../../images/', import.meta.url)),\n\t\t\tdockerfile: 'seal/Dockerfile',\n\t\t\tfingerprintPaths: ['seal/Dockerfile', 'seal/entrypoint.sh', '_shared/signal-forward.sh'],\n\t\t\tbuildArgs: { SEAL_VERSION: inputs.sealRef },\n\t\t\towner: {\n\t\t\t\tapp: inputs.owner.app,\n\t\t\t\tstack: inputs.owner.stack,\n\t\t\t\tplugin: 'seal',\n\t\t\t\trole: 'key-server',\n\t\t\t},\n\t\t};\n\t\treturn yield* runtime.ensureImage(buildCtx).pipe(\n\t\t\tEffect.mapError((cause) =>\n\t\t\t\tsealError('image', {\n\t\t\t\t\tname: 'seal',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`seal image build failed: ${cause.reason}: ${cause.detail}. ` +\n\t\t\t\t\t\t`SEAL_VERSION=${inputs.sealRef} (from ${inputs.sealRepo}/releases). ` +\n\t\t\t\t\t\t`Set SEAL_CARGO_IMAGE_OVERRIDE=<tag> to bypass the build.`,\n\t\t\t\t\tcause,\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.seal.cargoImage.resolve', {\n\t\t\tattributes: {\n\t\t\t\t[SealSpans.ref]: inputs.sealRef,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Convenience: resolve via the default inputs. */\nexport const resolveDefaultSealCargoImage = (\n\truntime: ContainerRuntime,\n\towner: SealCargoImageInputs['owner'],\n): Effect.Effect<ImageRef, SealError, Scope.Scope> =>\n\tresolveSealCargoImage(runtime, {\n\t\tsealRepo: DEFAULT_SEAL_REPO,\n\t\tsealRef: DEFAULT_SEAL_VERSION,\n\t\towner,\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiEA,MAAa,yBACZ,SACA,WAEA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,QAAQ,4BAA4B;AACrD,KAAI,YAAY,SAAS,SAAS,EAKjC,QAAO;EAAE,QAAQ;EAAU,KAAK;EAAU;CAU3C,MAAM,WAAkC;EAKvC,aAAa,cAAc,IAAI,IAAI,uBAAuB,OAAO,KAAK,IAAI,CAAC;EAC3E,YAAY;EACZ,kBAAkB;GAAC;GAAmB;GAAsB;GAA4B;EACxF,WAAW,EAAE,cAAc,OAAO,SAAS;EAC3C,OAAO;GACN,KAAK,OAAO,MAAM;GAClB,OAAO,OAAO,MAAM;GACpB,QAAQ;GACR,MAAM;GACN;EACD;AACD,QAAO,OAAO,QAAQ,YAAY,SAAS,CAAC,KAC3C,OAAO,UAAU,UAChB,UAAU,SAAS;EAClB,MAAM;EACN,SACC,4BAA4B,MAAM,OAAO,IAAI,MAAM,OAAO,iBAC1C,OAAO,QAAQ,SAAS,OAAO,SAAS;EAEzD;EACA,CAAC,CACF,CACD;EACA,CAAC,KACF,OAAO,SAAS,2CAA2C,EAC1D,YAAY,GACV,UAAU,MAAM,OAAO,SACxB,EACD,CAAC,CACF;;AAGF,MAAa,gCACZ,SACA,UAEA,sBAAsB,SAAS;CAC9B,UAAU;CACV,SAAS;CACT;CACA,CAAC"}
@@ -1,5 +1,11 @@
1
+ import { tailOutput } from "../../../substrate/runtime/observability/output-truncate.mjs";
2
+ import "../../../substrate/runtime/observability/index.mjs";
3
+ import { mintRandomSuffix } from "../../../substrate/runtime/random-suffix.mjs";
1
4
  import { stageAndSwap } from "../../../substrate/runtime/stage-and-swap/index.mjs";
5
+ import { hostBindMountOwner } from "../../../substrate/runtime/host-bind-mount-owner.mjs";
6
+ import { readEnv } from "../../../substrate/runtime/typed-env.mjs";
2
7
  import { sealError } from "../errors.mjs";
8
+ import { SealSpans } from "../spans.mjs";
3
9
  import { Effect, FileSystem, Path } from "effect";
4
10
  //#region src/plugins/seal/bootstrap-assets/source-fetch.ts
5
11
  /** Default upstream repo URL — distilled doc §"External" reference. */
@@ -15,33 +21,23 @@ const DEFAULT_SEAL_MOVE_SUBDIR = "move/seal";
15
21
  * `clone`. */
16
22
  const SEAL_SOURCE_FETCH_IMAGE = "alpine/git:2.52.0";
17
23
  const SEAL_SOURCE_FETCH_TIMEOUT_MS = 5 * 6e4;
18
- const env = () => globalThis.process?.env ?? {};
19
- const processId = () => String(globalThis.process?.pid ?? "unknown");
20
- let scratchCounter = 0;
21
24
  const nextScratchPaths = (cacheDir) => {
22
- scratchCounter = scratchCounter + 1;
23
- const suffix = `${processId()}.${scratchCounter}`;
25
+ const suffix = mintRandomSuffix(16);
24
26
  return {
25
27
  stagingPath: `${cacheDir}.staging.${suffix}`,
26
28
  backupPath: `${cacheDir}.backup.${suffix}`
27
29
  };
28
30
  };
29
31
  const sealSourceCacheDir = (ref) => {
30
- return `${env().HOME ?? "/tmp"}/.cache/devstack-rewrite/seal-src/${encodeURIComponent(ref)}`;
32
+ return `${readEnv("HOME") ?? "/tmp"}/.cache/devstack/seal-src/${encodeURIComponent(ref)}`;
31
33
  };
32
34
  const sealSourcePublishLockPath = (ref) => `${sealSourceCacheDir(ref)}.publish.lock`;
33
35
  const sourceImageRef = {
34
36
  digest: SEAL_SOURCE_FETCH_IMAGE,
35
37
  tag: SEAL_SOURCE_FETCH_IMAGE
36
38
  };
37
- const outputTail = (value) => value.slice(-1e3);
38
- const hostCloneUser = () => {
39
- const process = globalThis.process;
40
- if (typeof process?.getuid !== "function" || typeof process.getgid !== "function") return;
41
- return `${process.getuid()}:${process.getgid()}`;
42
- };
43
39
  const resolveSealSource = (runtime, inputs) => Effect.gen(function* () {
44
- const override = env().SEAL_MOVE_SOURCE_OVERRIDE;
40
+ const override = readEnv("SEAL_MOVE_SOURCE_OVERRIDE");
45
41
  if (override && override.length > 0) return {
46
42
  repo: inputs.repo,
47
43
  ref: inputs.ref,
@@ -67,7 +63,7 @@ const resolveSealSource = (runtime, inputs) => Effect.gen(function* () {
67
63
  const result = yield* Effect.scoped(runtime.runOneShot({
68
64
  image: sourceImageRef,
69
65
  entrypoint: "git",
70
- user: hostCloneUser(),
66
+ user: hostBindMountOwner(),
71
67
  argv: [
72
68
  "clone",
73
69
  "--depth",
@@ -91,8 +87,8 @@ const resolveSealSource = (runtime, inputs) => Effect.gen(function* () {
91
87
  name: "seal",
92
88
  message: `seal move-source: git clone exited ${result.exitCode}. Set SEAL_MOVE_SOURCE_OVERRIDE=<path> or pass movePackagePath to bypass.`,
93
89
  exitCode: result.exitCode,
94
- stdout: outputTail(result.stdout),
95
- stderr: outputTail(result.stderr)
90
+ stdout: tailOutput(result.stdout),
91
+ stderr: tailOutput(result.stderr)
96
92
  }));
97
93
  const stagedSubdir = path.join(stagingPath, inputs.subdir);
98
94
  if (!(yield* fs.exists(stagedSubdir).pipe(Effect.catch(() => Effect.succeed(false))))) return yield* Effect.fail(sealError("image", {
@@ -116,9 +112,9 @@ const resolveSealSource = (runtime, inputs) => Effect.gen(function* () {
116
112
  path: subdirPath
117
113
  };
118
114
  }).pipe(Effect.withSpan("devstack.plugin.seal.moveSource.resolve", { attributes: {
119
- "seal.repo": inputs.repo,
120
- "seal.ref": inputs.ref,
121
- "seal.subdir": inputs.subdir
115
+ [SealSpans.repo]: inputs.repo,
116
+ [SealSpans.ref]: inputs.ref,
117
+ [SealSpans.subdir]: inputs.subdir
122
118
  } }));
123
119
  /** Convenience: resolve via the default inputs. */
124
120
  const resolveDefaultSealSource = (runtime) => resolveSealSource(runtime, {
@@ -1 +1 @@
1
- {"version":3,"file":"source-fetch.mjs","names":[],"sources":["../../../../src/plugins/seal/bootstrap-assets/source-fetch.ts"],"sourcesContent":["// Seal git-fetched source tree.\n//\n// Resolution paths (mirror walrus's three-stage dispatch):\n//\n// (a) Caller-pinned `movePackagePath` opt — local-keygen mode\n// short-circuits before calling this resolver.\n//\n// (b) `SEAL_MOVE_SOURCE_OVERRIDE` env var — points at a pre-fetched\n// on-disk path. Trust-the-path; no I/O. Useful in CI where the\n// repo is checked out once and reused.\n//\n// (c) Real git fetch via `runtime.runOneShot({ image: 'alpine/git:2.52.0',\n// mounts: [stagingDir→/out], argv: ['clone',...] })`, staged\n// into the per-host source cache before returning the host\n// `move/seal` subdir.\n\nimport { Effect, FileSystem, Path, type Scope } from 'effect';\n\nimport type { ContainerRuntime } from '../../../contracts/container-runtime.ts';\nimport { stageAndSwap } from '../../../substrate/runtime/stage-and-swap/index.ts';\nimport { sealError, type SealError } from '../errors.ts';\n\n// ---------------------------------------------------------------------------\n// Constants — distilled-doc §\"External / upstream sources\"\n// ---------------------------------------------------------------------------\n\n/** Default upstream repo URL — distilled doc §\"External\" reference. */\nexport const DEFAULT_SEAL_REPO = 'https://github.com/MystenLabs/seal' as const;\n\n/** Pinned default ref. Distilled-doc invariant #11: this MUST match\n * the cargo binary's version (the Dockerfile's `SEAL_VERSION` build\n * arg). They move in lockstep. */\nexport const DEFAULT_SEAL_VERSION = 'seal-v0.6.6' as const;\n\n/** Subdirectory containing the Move package. */\nexport const DEFAULT_SEAL_MOVE_SUBDIR = 'move/seal' as const;\n\n/** Pinned helper image for the git clone one-shot. `alpine/git`\n * uses `git` as its entrypoint, so the clone argv starts at\n * `clone`. */\nexport const SEAL_SOURCE_FETCH_IMAGE = 'alpine/git:2.52.0' as const;\n\nconst SEAL_SOURCE_FETCH_TIMEOUT_MS = 5 * 60_000;\n\n// ---------------------------------------------------------------------------\n// Resolved value\n// ---------------------------------------------------------------------------\n\n/** Resolved value for the cloned `move/seal` subdir. The local-keygen\n * mode's acquire body threads this into `publishSealPackage(...)`. */\nexport interface SealSourceFetchResolved {\n\treadonly repo: string;\n\treadonly ref: string;\n\treadonly subdir: string;\n\treadonly path: string;\n}\n\n// ---------------------------------------------------------------------------\n// Runtime resolver\n// ---------------------------------------------------------------------------\n\n/** Inputs to the source resolver. */\nexport interface SealSourceFetchInputs<Ref extends string = string> {\n\treadonly repo: typeof DEFAULT_SEAL_REPO;\n\treadonly ref: Ref;\n\treadonly subdir: typeof DEFAULT_SEAL_MOVE_SUBDIR;\n}\n\nconst env = (): Record<string, string | undefined> =>\n\t(globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env ?? {};\n\nconst processId = (): string =>\n\tString((globalThis as { process?: { pid?: number } }).process?.pid ?? 'unknown');\n\nlet scratchCounter = 0;\n\nconst nextScratchPaths = (\n\tcacheDir: string,\n): { readonly stagingPath: string; readonly backupPath: string } => {\n\tscratchCounter = scratchCounter + 1;\n\tconst suffix = `${processId()}.${scratchCounter}`;\n\treturn {\n\t\tstagingPath: `${cacheDir}.staging.${suffix}`,\n\t\tbackupPath: `${cacheDir}.backup.${suffix}`,\n\t};\n};\n\nexport const sealSourceCacheDir = (ref: string): string => {\n\tconst home = env().HOME ?? '/tmp';\n\treturn `${home}/.cache/devstack-rewrite/seal-src/${encodeURIComponent(ref)}`;\n};\n\nexport const sealSourcePublishLockPath = (ref: string): string =>\n\t`${sealSourceCacheDir(ref)}.publish.lock`;\n\nconst sourceImageRef = { digest: SEAL_SOURCE_FETCH_IMAGE, tag: SEAL_SOURCE_FETCH_IMAGE } as const;\n\nconst outputTail = (value: string): string => value.slice(-1000);\n\nconst hostCloneUser = (): string | undefined => {\n\tconst process = (\n\t\tglobalThis as {\n\t\t\tprocess?: { getuid?: () => number; getgid?: () => number };\n\t\t}\n\t).process;\n\tif (typeof process?.getuid !== 'function' || typeof process.getgid !== 'function') {\n\t\treturn undefined;\n\t}\n\treturn `${process.getuid()}:${process.getgid()}`;\n};\n\nexport const resolveSealSource = (\n\truntime: ContainerRuntime,\n\tinputs: SealSourceFetchInputs,\n): Effect.Effect<\n\tSealSourceFetchResolved,\n\tSealError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> =>\n\tEffect.gen(function* () {\n\t\tconst override = env().SEAL_MOVE_SOURCE_OVERRIDE;\n\t\tif (override && override.length > 0) {\n\t\t\treturn {\n\t\t\t\trepo: inputs.repo,\n\t\t\t\tref: inputs.ref,\n\t\t\t\tsubdir: inputs.subdir,\n\t\t\t\tpath: override,\n\t\t\t} satisfies SealSourceFetchResolved;\n\t\t}\n\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst path = yield* Path.Path;\n\t\tconst cacheDir = sealSourceCacheDir(inputs.ref);\n\t\tconst subdirPath = path.join(cacheDir, inputs.subdir);\n\t\tconst cached = yield* fs.exists(subdirPath).pipe(Effect.catch(() => Effect.succeed(false)));\n\t\tif (cached) {\n\t\t\treturn {\n\t\t\t\trepo: inputs.repo,\n\t\t\t\tref: inputs.ref,\n\t\t\t\tsubdir: inputs.subdir,\n\t\t\t\tpath: subdirPath,\n\t\t\t} satisfies SealSourceFetchResolved;\n\t\t}\n\n\t\tconst { stagingPath, backupPath } = nextScratchPaths(cacheDir);\n\t\tyield* stageAndSwap({\n\t\t\ttargetPath: cacheDir,\n\t\t\tstagingPath,\n\t\t\tbackupPath,\n\t\t\tbuild: Effect.gen(function* () {\n\t\t\t\tconst result = yield* Effect.scoped(\n\t\t\t\t\truntime\n\t\t\t\t\t\t.runOneShot({\n\t\t\t\t\t\t\timage: sourceImageRef,\n\t\t\t\t\t\t\tentrypoint: 'git',\n\t\t\t\t\t\t\tuser: hostCloneUser(),\n\t\t\t\t\t\t\targv: ['clone', '--depth', '1', '--branch', inputs.ref, inputs.repo, '/out'],\n\t\t\t\t\t\t\tmounts: [{ source: stagingPath, target: '/out' }],\n\t\t\t\t\t\t\ttimeoutMillis: SEAL_SOURCE_FETCH_TIMEOUT_MS,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tEffect.mapError((cause) =>\n\t\t\t\t\t\t\t\tsealError('image', {\n\t\t\t\t\t\t\t\t\tname: 'seal',\n\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t`seal move-source: git clone one-shot failed: ${cause.reason}: ${cause.detail}. ` +\n\t\t\t\t\t\t\t\t\t\t`Set SEAL_MOVE_SOURCE_OVERRIDE=<path> or pass movePackagePath to bypass.`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\tif (result.exitCode !== 0) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tsealError('image', {\n\t\t\t\t\t\t\tname: 'seal',\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`seal move-source: git clone exited ${result.exitCode}. ` +\n\t\t\t\t\t\t\t\t`Set SEAL_MOVE_SOURCE_OVERRIDE=<path> or pass movePackagePath to bypass.`,\n\t\t\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\t\t\tstdout: outputTail(result.stdout),\n\t\t\t\t\t\t\tstderr: outputTail(result.stderr),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst stagedSubdir = path.join(stagingPath, inputs.subdir);\n\t\t\t\tconst stagedSubdirExists = yield* fs\n\t\t\t\t\t.exists(stagedSubdir)\n\t\t\t\t\t.pipe(Effect.catch(() => Effect.succeed(false)));\n\t\t\t\tif (!stagedSubdirExists) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tsealError('image', {\n\t\t\t\t\t\t\tname: 'seal',\n\t\t\t\t\t\t\tmessage: `seal move-source: clone completed but ${inputs.subdir} was missing from ${inputs.repo}@${inputs.ref}.`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t\tpublishLockPath: sealSourcePublishLockPath(inputs.ref),\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause): SealError => {\n\t\t\t\tif (cause._tag === 'SealError') return cause;\n\t\t\t\treturn sealError('image', {\n\t\t\t\t\tname: 'seal',\n\t\t\t\t\tmessage: `seal move-source: cache publish failed at ${cause.stage}`,\n\t\t\t\t\tcause,\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\trepo: inputs.repo,\n\t\t\tref: inputs.ref,\n\t\t\tsubdir: inputs.subdir,\n\t\t\tpath: subdirPath,\n\t\t} satisfies SealSourceFetchResolved;\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.seal.moveSource.resolve', {\n\t\t\tattributes: {\n\t\t\t\t'seal.repo': inputs.repo,\n\t\t\t\t'seal.ref': inputs.ref,\n\t\t\t\t'seal.subdir': inputs.subdir,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Convenience: resolve via the default inputs. */\nexport const resolveDefaultSealSource = (\n\truntime: ContainerRuntime,\n): Effect.Effect<\n\tSealSourceFetchResolved,\n\tSealError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> =>\n\tresolveSealSource(runtime, {\n\t\trepo: DEFAULT_SEAL_REPO,\n\t\tref: DEFAULT_SEAL_VERSION,\n\t\tsubdir: DEFAULT_SEAL_MOVE_SUBDIR,\n\t});\n"],"mappings":";;;;;AA2BA,MAAa,oBAAoB;;;;AAKjC,MAAa,uBAAuB;;AAGpC,MAAa,2BAA2B;;;;AAKxC,MAAa,0BAA0B;AAEvC,MAAM,+BAA+B,IAAI;AA0BzC,MAAM,YACJ,WAA0E,SAAS,OAAO,EAAE;AAE9F,MAAM,kBACL,OAAQ,WAA8C,SAAS,OAAO,UAAU;AAEjF,IAAI,iBAAiB;AAErB,MAAM,oBACL,aACmE;AACnE,kBAAiB,iBAAiB;CAClC,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG;AACjC,QAAO;EACN,aAAa,GAAG,SAAS,WAAW;EACpC,YAAY,GAAG,SAAS,UAAU;EAClC;;AAGF,MAAa,sBAAsB,QAAwB;AAE1D,QAAO,GADM,KAAK,CAAC,QAAQ,OACZ,oCAAoC,mBAAmB,IAAI;;AAG3E,MAAa,6BAA6B,QACzC,GAAG,mBAAmB,IAAI,CAAC;AAE5B,MAAM,iBAAiB;CAAE,QAAQ;CAAyB,KAAK;CAAyB;AAExF,MAAM,cAAc,UAA0B,MAAM,MAAM,KAAM;AAEhE,MAAM,sBAA0C;CAC/C,MAAM,UACL,WAGC;AACF,KAAI,OAAO,SAAS,WAAW,cAAc,OAAO,QAAQ,WAAW,WACtE;AAED,QAAO,GAAG,QAAQ,QAAQ,CAAC,GAAG,QAAQ,QAAQ;;AAG/C,MAAa,qBACZ,SACA,WAMA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,KAAK,CAAC;AACvB,KAAI,YAAY,SAAS,SAAS,EACjC,QAAO;EACN,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,QAAQ,OAAO;EACf,MAAM;EACN;CAGF,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,WAAW,mBAAmB,OAAO,IAAI;CAC/C,MAAM,aAAa,KAAK,KAAK,UAAU,OAAO,OAAO;AAErD,KAAI,OADkB,GAAG,OAAO,WAAW,CAAC,KAAK,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,CAE1F,QAAO;EACN,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,QAAQ,OAAO;EACf,MAAM;EACN;CAGF,MAAM,EAAE,aAAa,eAAe,iBAAiB,SAAS;AAC9D,QAAO,aAAa;EACnB,YAAY;EACZ;EACA;EACA,OAAO,OAAO,IAAI,aAAa;GAC9B,MAAM,SAAS,OAAO,OAAO,OAC5B,QACE,WAAW;IACX,OAAO;IACP,YAAY;IACZ,MAAM,eAAe;IACrB,MAAM;KAAC;KAAS;KAAW;KAAK;KAAY,OAAO;KAAK,OAAO;KAAM;KAAO;IAC5E,QAAQ,CAAC;KAAE,QAAQ;KAAa,QAAQ;KAAQ,CAAC;IACjD,eAAe;IACf,CAAC,CACD,KACA,OAAO,UAAU,UAChB,UAAU,SAAS;IAClB,MAAM;IACN,SACC,gDAAgD,MAAM,OAAO,IAAI,MAAM,OAAO;IAE/E;IACA,CAAC,CACF,CACD,CACF;AAED,OAAI,OAAO,aAAa,EACvB,QAAO,OAAO,OAAO,KACpB,UAAU,SAAS;IAClB,MAAM;IACN,SACC,sCAAsC,OAAO,SAAS;IAEvD,UAAU,OAAO;IACjB,QAAQ,WAAW,OAAO,OAAO;IACjC,QAAQ,WAAW,OAAO,OAAO;IACjC,CAAC,CACF;GAGF,MAAM,eAAe,KAAK,KAAK,aAAa,OAAO,OAAO;AAI1D,OAAI,EAAC,OAH6B,GAChC,OAAO,aAAa,CACpB,KAAK,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,EAEhD,QAAO,OAAO,OAAO,KACpB,UAAU,SAAS;IAClB,MAAM;IACN,SAAS,yCAAyC,OAAO,OAAO,oBAAoB,OAAO,KAAK,GAAG,OAAO,IAAI;IAC9G,CAAC,CACF;IAED;EACF,iBAAiB,0BAA0B,OAAO,IAAI;EACtD,CAAC,CAAC,KACF,OAAO,UAAU,UAAqB;AACrC,MAAI,MAAM,SAAS,YAAa,QAAO;AACvC,SAAO,UAAU,SAAS;GACzB,MAAM;GACN,SAAS,6CAA6C,MAAM;GAC5D;GACA,CAAC;GACD,CACF;AAED,QAAO;EACN,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,QAAQ,OAAO;EACf,MAAM;EACN;EACA,CAAC,KACF,OAAO,SAAS,2CAA2C,EAC1D,YAAY;CACX,aAAa,OAAO;CACpB,YAAY,OAAO;CACnB,eAAe,OAAO;CACtB,EACD,CAAC,CACF;;AAGF,MAAa,4BACZ,YAMA,kBAAkB,SAAS;CAC1B,MAAM;CACN,KAAK;CACL,QAAQ;CACR,CAAC"}
1
+ {"version":3,"file":"source-fetch.mjs","names":[],"sources":["../../../../src/plugins/seal/bootstrap-assets/source-fetch.ts"],"sourcesContent":["// Seal git-fetched source tree.\n//\n// Resolution paths (mirror walrus's three-stage dispatch):\n//\n// (a) Caller-pinned `movePackagePath` opt — local-keygen mode\n// short-circuits before calling this resolver.\n//\n// (b) `SEAL_MOVE_SOURCE_OVERRIDE` env var — points at a pre-fetched\n// on-disk path. Trust-the-path; no I/O. Useful in CI where the\n// repo is checked out once and reused.\n//\n// (c) Real git fetch via `runtime.runOneShot({ image: 'alpine/git:2.52.0',\n// mounts: [stagingDir→/out], argv: ['clone',...] })`, staged\n// into the per-host source cache before returning the host\n// `move/seal` subdir.\n\nimport { Effect, FileSystem, Path, type Scope } from 'effect';\n\nimport type { ContainerRuntime } from '../../../contracts/container-runtime.ts';\nimport { hostBindMountOwner } from '../../../substrate/runtime/host-bind-mount-owner.ts';\nimport { mintRandomSuffix } from '../../../substrate/runtime/random-suffix.ts';\nimport { tailOutput } from '../../../substrate/runtime/observability/index.ts';\nimport { stageAndSwap } from '../../../substrate/runtime/stage-and-swap/index.ts';\nimport { readEnv } from '../../../substrate/runtime/typed-env.ts';\nimport { sealError, type SealError } from '../errors.ts';\nimport { SealSpans } from '../spans.ts';\n\n// ---------------------------------------------------------------------------\n// Constants — distilled-doc §\"External / upstream sources\"\n// ---------------------------------------------------------------------------\n\n/** Default upstream repo URL — distilled doc §\"External\" reference. */\nexport const DEFAULT_SEAL_REPO = 'https://github.com/MystenLabs/seal' as const;\n\n/** Pinned default ref. Distilled-doc invariant #11: this MUST match\n * the cargo binary's version (the Dockerfile's `SEAL_VERSION` build\n * arg). They move in lockstep. */\nexport const DEFAULT_SEAL_VERSION = 'seal-v0.6.6' as const;\n\n/** Subdirectory containing the Move package. */\nexport const DEFAULT_SEAL_MOVE_SUBDIR = 'move/seal' as const;\n\n/** Pinned helper image for the git clone one-shot. `alpine/git`\n * uses `git` as its entrypoint, so the clone argv starts at\n * `clone`. */\nexport const SEAL_SOURCE_FETCH_IMAGE = 'alpine/git:2.52.0' as const;\n\nconst SEAL_SOURCE_FETCH_TIMEOUT_MS = 5 * 60_000;\n\n// ---------------------------------------------------------------------------\n// Resolved value\n// ---------------------------------------------------------------------------\n\n/** Resolved value for the cloned `move/seal` subdir. The local-keygen\n * mode's acquire body threads this into `publishSealPackage(...)`. */\nexport interface SealSourceFetchResolved {\n\treadonly repo: string;\n\treadonly ref: string;\n\treadonly subdir: string;\n\treadonly path: string;\n}\n\n// ---------------------------------------------------------------------------\n// Runtime resolver\n// ---------------------------------------------------------------------------\n\n/** Inputs to the source resolver. */\nexport interface SealSourceFetchInputs<Ref extends string = string> {\n\treadonly repo: typeof DEFAULT_SEAL_REPO;\n\treadonly ref: Ref;\n\treadonly subdir: typeof DEFAULT_SEAL_MOVE_SUBDIR;\n}\n\nconst nextScratchPaths = (\n\tcacheDir: string,\n): { readonly stagingPath: string; readonly backupPath: string } => {\n\t// 16-char crypto suffix (STYLE_GUIDE §17) — the old\n\t// `pid.counter` scheme collided across two concurrent PROCESSES\n\t// fetching the same ref (counters reset per-process, so pid A's\n\t// `.staging.1` and pid B's `.staging.1` differ only by pid, and\n\t// the staging tree corrupts if a pid is reused). A random suffix\n\t// makes overlap cryptographically negligible regardless of pid.\n\tconst suffix = mintRandomSuffix(16);\n\treturn {\n\t\tstagingPath: `${cacheDir}.staging.${suffix}`,\n\t\tbackupPath: `${cacheDir}.backup.${suffix}`,\n\t};\n};\n\nexport const sealSourceCacheDir = (ref: string): string => {\n\tconst home = readEnv('HOME') ?? '/tmp';\n\treturn `${home}/.cache/devstack/seal-src/${encodeURIComponent(ref)}`;\n};\n\nexport const sealSourcePublishLockPath = (ref: string): string =>\n\t`${sealSourceCacheDir(ref)}.publish.lock`;\n\nconst sourceImageRef = { digest: SEAL_SOURCE_FETCH_IMAGE, tag: SEAL_SOURCE_FETCH_IMAGE } as const;\n\nexport const resolveSealSource = (\n\truntime: ContainerRuntime,\n\tinputs: SealSourceFetchInputs,\n): Effect.Effect<\n\tSealSourceFetchResolved,\n\tSealError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> =>\n\tEffect.gen(function* () {\n\t\tconst override = readEnv('SEAL_MOVE_SOURCE_OVERRIDE');\n\t\tif (override && override.length > 0) {\n\t\t\treturn {\n\t\t\t\trepo: inputs.repo,\n\t\t\t\tref: inputs.ref,\n\t\t\t\tsubdir: inputs.subdir,\n\t\t\t\tpath: override,\n\t\t\t} satisfies SealSourceFetchResolved;\n\t\t}\n\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst path = yield* Path.Path;\n\t\tconst cacheDir = sealSourceCacheDir(inputs.ref);\n\t\tconst subdirPath = path.join(cacheDir, inputs.subdir);\n\t\tconst cached = yield* fs.exists(subdirPath).pipe(Effect.catch(() => Effect.succeed(false)));\n\t\tif (cached) {\n\t\t\treturn {\n\t\t\t\trepo: inputs.repo,\n\t\t\t\tref: inputs.ref,\n\t\t\t\tsubdir: inputs.subdir,\n\t\t\t\tpath: subdirPath,\n\t\t\t} satisfies SealSourceFetchResolved;\n\t\t}\n\n\t\tconst { stagingPath, backupPath } = nextScratchPaths(cacheDir);\n\t\tyield* stageAndSwap({\n\t\t\ttargetPath: cacheDir,\n\t\t\tstagingPath,\n\t\t\tbackupPath,\n\t\t\tbuild: Effect.gen(function* () {\n\t\t\t\tconst result = yield* Effect.scoped(\n\t\t\t\t\truntime\n\t\t\t\t\t\t.runOneShot({\n\t\t\t\t\t\t\timage: sourceImageRef,\n\t\t\t\t\t\t\tentrypoint: 'git',\n\t\t\t\t\t\t\tuser: hostBindMountOwner(),\n\t\t\t\t\t\t\targv: ['clone', '--depth', '1', '--branch', inputs.ref, inputs.repo, '/out'],\n\t\t\t\t\t\t\tmounts: [{ source: stagingPath, target: '/out' }],\n\t\t\t\t\t\t\ttimeoutMillis: SEAL_SOURCE_FETCH_TIMEOUT_MS,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tEffect.mapError((cause) =>\n\t\t\t\t\t\t\t\tsealError('image', {\n\t\t\t\t\t\t\t\t\tname: 'seal',\n\t\t\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t\t\t`seal move-source: git clone one-shot failed: ${cause.reason}: ${cause.detail}. ` +\n\t\t\t\t\t\t\t\t\t\t`Set SEAL_MOVE_SOURCE_OVERRIDE=<path> or pass movePackagePath to bypass.`,\n\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t);\n\n\t\t\t\tif (result.exitCode !== 0) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tsealError('image', {\n\t\t\t\t\t\t\tname: 'seal',\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`seal move-source: git clone exited ${result.exitCode}. ` +\n\t\t\t\t\t\t\t\t`Set SEAL_MOVE_SOURCE_OVERRIDE=<path> or pass movePackagePath to bypass.`,\n\t\t\t\t\t\t\texitCode: result.exitCode,\n\t\t\t\t\t\t\tstdout: tailOutput(result.stdout),\n\t\t\t\t\t\t\tstderr: tailOutput(result.stderr),\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst stagedSubdir = path.join(stagingPath, inputs.subdir);\n\t\t\t\tconst stagedSubdirExists = yield* fs\n\t\t\t\t\t.exists(stagedSubdir)\n\t\t\t\t\t.pipe(Effect.catch(() => Effect.succeed(false)));\n\t\t\t\tif (!stagedSubdirExists) {\n\t\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\t\tsealError('image', {\n\t\t\t\t\t\t\tname: 'seal',\n\t\t\t\t\t\t\tmessage: `seal move-source: clone completed but ${inputs.subdir} was missing from ${inputs.repo}@${inputs.ref}.`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t\tpublishLockPath: sealSourcePublishLockPath(inputs.ref),\n\t\t}).pipe(\n\t\t\tEffect.mapError((cause): SealError => {\n\t\t\t\tif (cause._tag === 'SealError') return cause;\n\t\t\t\treturn sealError('image', {\n\t\t\t\t\tname: 'seal',\n\t\t\t\t\tmessage: `seal move-source: cache publish failed at ${cause.stage}`,\n\t\t\t\t\tcause,\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\trepo: inputs.repo,\n\t\t\tref: inputs.ref,\n\t\t\tsubdir: inputs.subdir,\n\t\t\tpath: subdirPath,\n\t\t} satisfies SealSourceFetchResolved;\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.seal.moveSource.resolve', {\n\t\t\tattributes: {\n\t\t\t\t[SealSpans.repo]: inputs.repo,\n\t\t\t\t[SealSpans.ref]: inputs.ref,\n\t\t\t\t[SealSpans.subdir]: inputs.subdir,\n\t\t\t},\n\t\t}),\n\t);\n\n/** Convenience: resolve via the default inputs. */\nexport const resolveDefaultSealSource = (\n\truntime: ContainerRuntime,\n): Effect.Effect<\n\tSealSourceFetchResolved,\n\tSealError,\n\tScope.Scope | FileSystem.FileSystem | Path.Path\n> =>\n\tresolveSealSource(runtime, {\n\t\trepo: DEFAULT_SEAL_REPO,\n\t\tref: DEFAULT_SEAL_VERSION,\n\t\tsubdir: DEFAULT_SEAL_MOVE_SUBDIR,\n\t});\n"],"mappings":";;;;;;;;;;;AAgCA,MAAa,oBAAoB;;;;AAKjC,MAAa,uBAAuB;;AAGpC,MAAa,2BAA2B;;;;AAKxC,MAAa,0BAA0B;AAEvC,MAAM,+BAA+B,IAAI;AA0BzC,MAAM,oBACL,aACmE;CAOnE,MAAM,SAAS,iBAAiB,GAAG;AACnC,QAAO;EACN,aAAa,GAAG,SAAS,WAAW;EACpC,YAAY,GAAG,SAAS,UAAU;EAClC;;AAGF,MAAa,sBAAsB,QAAwB;AAE1D,QAAO,GADM,QAAQ,OAAO,IAAI,OACjB,4BAA4B,mBAAmB,IAAI;;AAGnE,MAAa,6BAA6B,QACzC,GAAG,mBAAmB,IAAI,CAAC;AAE5B,MAAM,iBAAiB;CAAE,QAAQ;CAAyB,KAAK;CAAyB;AAExF,MAAa,qBACZ,SACA,WAMA,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,QAAQ,4BAA4B;AACrD,KAAI,YAAY,SAAS,SAAS,EACjC,QAAO;EACN,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,QAAQ,OAAO;EACf,MAAM;EACN;CAGF,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,WAAW,mBAAmB,OAAO,IAAI;CAC/C,MAAM,aAAa,KAAK,KAAK,UAAU,OAAO,OAAO;AAErD,KAAI,OADkB,GAAG,OAAO,WAAW,CAAC,KAAK,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,CAE1F,QAAO;EACN,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,QAAQ,OAAO;EACf,MAAM;EACN;CAGF,MAAM,EAAE,aAAa,eAAe,iBAAiB,SAAS;AAC9D,QAAO,aAAa;EACnB,YAAY;EACZ;EACA;EACA,OAAO,OAAO,IAAI,aAAa;GAC9B,MAAM,SAAS,OAAO,OAAO,OAC5B,QACE,WAAW;IACX,OAAO;IACP,YAAY;IACZ,MAAM,oBAAoB;IAC1B,MAAM;KAAC;KAAS;KAAW;KAAK;KAAY,OAAO;KAAK,OAAO;KAAM;KAAO;IAC5E,QAAQ,CAAC;KAAE,QAAQ;KAAa,QAAQ;KAAQ,CAAC;IACjD,eAAe;IACf,CAAC,CACD,KACA,OAAO,UAAU,UAChB,UAAU,SAAS;IAClB,MAAM;IACN,SACC,gDAAgD,MAAM,OAAO,IAAI,MAAM,OAAO;IAE/E;IACA,CAAC,CACF,CACD,CACF;AAED,OAAI,OAAO,aAAa,EACvB,QAAO,OAAO,OAAO,KACpB,UAAU,SAAS;IAClB,MAAM;IACN,SACC,sCAAsC,OAAO,SAAS;IAEvD,UAAU,OAAO;IACjB,QAAQ,WAAW,OAAO,OAAO;IACjC,QAAQ,WAAW,OAAO,OAAO;IACjC,CAAC,CACF;GAGF,MAAM,eAAe,KAAK,KAAK,aAAa,OAAO,OAAO;AAI1D,OAAI,EAAC,OAH6B,GAChC,OAAO,aAAa,CACpB,KAAK,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,EAEhD,QAAO,OAAO,OAAO,KACpB,UAAU,SAAS;IAClB,MAAM;IACN,SAAS,yCAAyC,OAAO,OAAO,oBAAoB,OAAO,KAAK,GAAG,OAAO,IAAI;IAC9G,CAAC,CACF;IAED;EACF,iBAAiB,0BAA0B,OAAO,IAAI;EACtD,CAAC,CAAC,KACF,OAAO,UAAU,UAAqB;AACrC,MAAI,MAAM,SAAS,YAAa,QAAO;AACvC,SAAO,UAAU,SAAS;GACzB,MAAM;GACN,SAAS,6CAA6C,MAAM;GAC5D;GACA,CAAC;GACD,CACF;AAED,QAAO;EACN,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,QAAQ,OAAO;EACf,MAAM;EACN;EACA,CAAC,KACF,OAAO,SAAS,2CAA2C,EAC1D,YAAY;EACV,UAAU,OAAO,OAAO;EACxB,UAAU,MAAM,OAAO;EACvB,UAAU,SAAS,OAAO;CAC3B,EACD,CAAC,CACF;;AAGF,MAAa,4BACZ,YAMA,kBAAkB,SAAS;CAC1B,MAAM;CACN,KAAK;CACL,QAAQ;CACR,CAAC"}
@@ -9,9 +9,8 @@ interface SealBindings {
9
9
  readonly objectId: string;
10
10
  readonly keyServerUrl: string;
11
11
  readonly serverConfigs: ReadonlyArray<SealKeyServerEntry>;
12
- /** Mode marker so the bindings file knows whether to surface the
13
- * admin rotate Effect-construction shim (distilled-doc invariant
14
- * #15 — only local-keygen mode produces a manager). */
12
+ /** Mode marker for consumers that branch between local-keygen and
13
+ * known-deployment surfaces. */
15
14
  readonly mode: 'local-keygen' | 'live' | 'fork-known';
16
15
  }
17
16
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/seal/codegen.ts"],"sourcesContent":["// Seal plugin — Codegenable contribution.\n//\n// Distilled-doc §\"Outputs\": the seal plugin contributes ONE codegen\n// emit shape — the `seal-key-server` config the user-facing\n// bindings consume to construct a `SealClient`. The orchestrator\n// reads this contribution + every other plugin's; the heavy\n// codegen substrate (file writing, type-export grouping) lives in\n// the codegen orchestrator (architecture §6).\n//\n// Tag id discipline:\n//\n// - The emitter name `'seal-key-server'` is pinned here so the\n// generated output and orchestrator attribution stay stable.\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { SealKeyServerEntry } from './registry-publish.ts';\n\n// ---------------------------------------------------------------------------\n// Bindings shape\n// ---------------------------------------------------------------------------\n\n/** Codegen-emitted shape for seal. Mirrors the read-side resolved\n * value (sans the per-instance defaults like `weight`). The\n * bindings emitter writes a TypeScript file exporting these. */\nexport interface SealBindings {\n\treadonly name: string;\n\treadonly objectId: string;\n\treadonly keyServerUrl: string;\n\treadonly serverConfigs: ReadonlyArray<SealKeyServerEntry>;\n\t/** Mode marker so the bindings file knows whether to surface the\n\t * admin rotate Effect-construction shim (distilled-doc invariant\n\t * #15 — only local-keygen mode produces a manager). */\n\treadonly mode: 'local-keygen' | 'live' | 'fork-known';\n}\n\n// ---------------------------------------------------------------------------\n// Decl builder\n// ---------------------------------------------------------------------------\n\n/** Build the Codegenable contribution for a seal instance. */\nexport const makeSealCodegenable = (\n\tbindings: SealBindings,\n): CodegenableDecl<'seal-key-server'> => ({\n\tkind: 'codegenable',\n\temitterName: 'seal-key-server',\n\toutputPath: `seal/${bindings.name}.ts`,\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\tctx.exportConst('sealBindings', bindings satisfies SealBindings);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;;AA0CA,MAAa,uBACZ,cACyC;CACzC,MAAM;CACN,aAAa;CACb,YAAY,QAAQ,SAAS,KAAK;CAClC,OAAO,QACN,OAAO,WAAW;AACjB,MAAI,YAAY,gBAAgB,SAAgC;AAChE,SAAO,IAAI,MAAM;GAChB;CACH"}
1
+ {"version":3,"file":"codegen.mjs","names":[],"sources":["../../../src/plugins/seal/codegen.ts"],"sourcesContent":["// Seal plugin — Codegenable contribution.\n//\n// Distilled-doc §\"Outputs\": the seal plugin contributes ONE codegen\n// emit shape — the `seal-key-server` config the user-facing\n// bindings consume to construct a `SealClient`. The orchestrator\n// reads this contribution + every other plugin's; the heavy\n// codegen substrate (file writing, type-export grouping) lives in\n// the codegen orchestrator (architecture §6).\n//\n// Tag id discipline:\n//\n// - The emitter name `'seal-key-server'` is pinned here so the\n// generated output and orchestrator attribution stay stable.\n\nimport { Effect } from 'effect';\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\nimport type { SealKeyServerEntry } from './registry-publish.ts';\n\n// ---------------------------------------------------------------------------\n// Bindings shape\n// ---------------------------------------------------------------------------\n\n/** Codegen-emitted shape for seal. Mirrors the read-side resolved\n * value (sans the per-instance defaults like `weight`). The\n * bindings emitter writes a TypeScript file exporting these. */\nexport interface SealBindings {\n\treadonly name: string;\n\treadonly objectId: string;\n\treadonly keyServerUrl: string;\n\treadonly serverConfigs: ReadonlyArray<SealKeyServerEntry>;\n\t/** Mode marker for consumers that branch between local-keygen and\n\t * known-deployment surfaces. */\n\treadonly mode: 'local-keygen' | 'live' | 'fork-known';\n}\n\n// ---------------------------------------------------------------------------\n// Decl builder\n// ---------------------------------------------------------------------------\n\n/** Build the Codegenable contribution for a seal instance. */\nexport const makeSealCodegenable = (\n\tbindings: SealBindings,\n): CodegenableDecl<'seal-key-server'> => ({\n\tkind: 'codegenable',\n\temitterName: 'seal-key-server',\n\toutputPath: `seal/${bindings.name}.ts`,\n\temit: (ctx) =>\n\t\tEffect.sync(() => {\n\t\t\tctx.exportConst('sealBindings', bindings satisfies SealBindings);\n\t\t\treturn ctx.done();\n\t\t}),\n});\n"],"mappings":";;;AAyCA,MAAa,uBACZ,cACyC;CACzC,MAAM;CACN,aAAa;CACb,YAAY,QAAQ,SAAS,KAAK;CAClC,OAAO,QACN,OAAO,WAAW;AACjB,MAAI,YAAY,gBAAgB,SAAgC;AAChE,SAAO,IAAI,MAAM;GAChB;CACH"}
@@ -1,22 +1,49 @@
1
1
  import { atomicWriteFile } from "../../substrate/runtime/atomic-write.mjs";
2
- import { sealError } from "./errors.mjs";
2
+ import { sealConfigError, sealError } from "./errors.mjs";
3
+ import { SealSpans } from "./spans.mjs";
3
4
  import { KEY_SERVER_CONFIG_BASENAME, MASTER_KEY_ENVFILE_BASENAME } from "./keygen.mjs";
4
5
  import { Effect } from "effect";
5
6
  //#region src/plugins/seal/config-render.ts
6
7
  const DEFAULT_TS_SDK_REQUIREMENT = ">=0.4.5";
8
+ /** Allowed character set for raw interpolation into a YAML double-quoted
9
+ * string. A `"` would close the quote and let downstream characters
10
+ * inject YAML syntax; a backslash would start an escape sequence the
11
+ * parser then chokes on. Sui/Seal object ids + node URLs only need
12
+ * alphanumerics, `:/_.-`, and `0x` — so the conservative whitelist is
13
+ * safe. The `ts_sdk_version_requirement` allows the SemVer comparator
14
+ * characters as well. */
15
+ const YAML_INTERP_FIELD_RE = /^[0-9a-zA-Z:/_.\-]+$/;
16
+ const YAML_INTERP_SEMVER_RE = /^[0-9a-zA-Z:/_.\-<>=^~* |!]+$/;
17
+ const assertYamlSafe = (field, value, pattern) => {
18
+ if (pattern.test(value)) return value;
19
+ throw sealConfigError({
20
+ field,
21
+ message: `seal.config-render: ${field} contains characters that would break YAML quoting`,
22
+ hint: `allowed characters: ${pattern.source}`
23
+ });
24
+ };
7
25
  /** Render the key-server config yaml.
8
26
  *
9
27
  * Distilled-doc invariant #19: `network: !Devnet` is hardcoded.
10
28
  * This is the "custom chain via node_url" discriminator the
11
- * upstream binary expects when devstack supplies its own RPC. */
29
+ * upstream binary expects when devstack supplies its own RPC.
30
+ *
31
+ * Each interpolated value is whitelist-asserted BEFORE rendering — a
32
+ * `"` in any field would close the YAML quoted string and let
33
+ * downstream characters inject syntax. The assertion raises a
34
+ * `SealConfigError({phase: 'config-render'})` naming the offending
35
+ * field so callers see a typed refusal, not silently-broken YAML. */
12
36
  const renderSealKeyServerConfig = (inputs) => {
13
- const tsReq = inputs.tsSdkVersionRequirement ?? DEFAULT_TS_SDK_REQUIREMENT;
37
+ const sealPackageId = assertYamlSafe("sealPackageId", inputs.sealPackageId, YAML_INTERP_FIELD_RE);
38
+ const nodeUrl = assertYamlSafe("nodeUrl", inputs.nodeUrl, YAML_INTERP_FIELD_RE);
39
+ const keyServerObjectId = assertYamlSafe("keyServerObjectId", inputs.keyServerObjectId, YAML_INTERP_FIELD_RE);
40
+ const tsReq = assertYamlSafe("tsSdkVersionRequirement", inputs.tsSdkVersionRequirement ?? DEFAULT_TS_SDK_REQUIREMENT, YAML_INTERP_SEMVER_RE);
14
41
  return [
15
42
  "network: !Devnet",
16
- ` seal_package: "${inputs.sealPackageId}"`,
17
- `node_url: "${inputs.nodeUrl}"`,
43
+ ` seal_package: "${sealPackageId}"`,
44
+ `node_url: "${nodeUrl}"`,
18
45
  "server_mode: !Open",
19
- ` key_server_object_id: "${inputs.keyServerObjectId}"`,
46
+ ` key_server_object_id: "${keyServerObjectId}"`,
20
47
  `ts_sdk_version_requirement: "${tsReq}"`,
21
48
  ""
22
49
  ].join("\n");
@@ -73,8 +100,8 @@ const stageSealConfig = (yamlBody, masterKeyHex, servicePath, name) => Effect.ge
73
100
  masterKeyEnvFile
74
101
  };
75
102
  }).pipe(Effect.withSpan("devstack.plugin.seal.config-render.stage", { attributes: {
76
- "seal.name": name,
77
- "seal.servicePath": servicePath
103
+ [SealSpans.name]: name,
104
+ [SealSpans.servicePath]: servicePath
78
105
  } }));
79
106
  //#endregion
80
107
  export { parseMasterKeyEnvFile, renderSealKeyServerConfig, stageSealConfig };
@@ -1 +1 @@
1
- {"version":3,"file":"config-render.mjs","names":[],"sources":["../../../src/plugins/seal/config-render.ts"],"sourcesContent":["// Seal plugin — key-server-config.yaml renderer.\n//\n// Distilled-doc invariant #19: the `network: !Devnet` discriminator\n// is LOAD-BEARING. Env-only mode silently routes at the public\n// testnet fullnode regardless of `NODE_URL`; going through the\n// config file with the `!Devnet` discriminator binds the daemon to\n// the in-stack sui RPC.\n//\n// Distilled-doc invariant #20: the rendered file MUST land under\n// `runtime/seal/`, NOT a scoped temp dir. The substrate's\n// service-path resolver (`servicePath('seal')`) produces the host\n// path; we land both the yaml and the master-key env-file there.\n//\n// This file declares the renderer + the staging procedure. The\n// renderer is a pure string builder; the staging procedure uses the\n// substrate's atomic-write primitive (FileSystem-backed).\n\nimport { Effect, FileSystem } from 'effect';\n\nimport { atomicWriteFile } from '../../substrate/runtime/atomic-write.ts';\nimport { sealError, type SealError } from './errors.ts';\nimport { KEY_SERVER_CONFIG_BASENAME, MASTER_KEY_ENVFILE_BASENAME } from './keygen.ts';\n\n// ---------------------------------------------------------------------------\n// Render inputs\n// ---------------------------------------------------------------------------\n\n/** Inputs the renderer consumes. The substrate provides the\n * sui node URL (in-container DNS form, e.g. `http://sui-localnet:9000`)\n * + the seal package id + the on-chain key-server object id. */\nexport interface SealKeyServerConfigInputs {\n\t/** Seal Move package id (from publish). */\n\treadonly sealPackageId: string;\n\t/** Sui RPC node URL as seen from inside the container's network. */\n\treadonly nodeUrl: string;\n\t/** On-chain `KeyServer` object id (from register). */\n\treadonly keyServerObjectId: string;\n\t/** Optional ts-sdk version requirement override. Default is the\n\t * pin distilled from v3 (`'>=0.4.5'`); v2 plans expose this so\n\t * consumers running older `@mysten/seal` aren't silently\n\t * rejected. Distilled-doc opportunity #8. */\n\treadonly tsSdkVersionRequirement?: string;\n}\n\nexport interface ParsedSealKeyServerConfig {\n\treadonly sealPackageId: string;\n\treadonly nodeUrl: string;\n\treadonly keyServerObjectId: string;\n}\n\nconst DEFAULT_TS_SDK_REQUIREMENT = '>=0.4.5';\n\n// ---------------------------------------------------------------------------\n// Render — pure string builder\n// ---------------------------------------------------------------------------\n\n/** Render the key-server config yaml.\n *\n * Distilled-doc invariant #19: `network: !Devnet` is hardcoded.\n * This is the \"custom chain via node_url\" discriminator the\n * upstream binary expects when devstack supplies its own RPC. */\nexport const renderSealKeyServerConfig = (inputs: SealKeyServerConfigInputs): string => {\n\tconst tsReq = inputs.tsSdkVersionRequirement ?? DEFAULT_TS_SDK_REQUIREMENT;\n\treturn [\n\t\t'network: !Devnet',\n\t\t` seal_package: \"${inputs.sealPackageId}\"`,\n\t\t`node_url: \"${inputs.nodeUrl}\"`,\n\t\t'server_mode: !Open',\n\t\t` key_server_object_id: \"${inputs.keyServerObjectId}\"`,\n\t\t`ts_sdk_version_requirement: \"${tsReq}\"`,\n\t\t'',\n\t].join('\\n');\n};\n\n// ---------------------------------------------------------------------------\n// Master-key env-file body\n// ---------------------------------------------------------------------------\n\n/** Render the docker `--env-file` body. Single `KEY=value` line.\n * Distilled-doc invariant #3 — this is the ONLY path the master key\n * reaches the container; inline `-e MASTER_KEY=…` would surface\n * the secret in `docker inspect` and host process env. */\nexport const renderMasterKeyEnvFile = (masterKeyHex: string): string =>\n\t`MASTER_KEY=${masterKeyHex}\\n`;\n\nconst readQuotedYamlField = (body: string, field: string): string | null => {\n\tconst escaped = field.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\tconst match = new RegExp(`(?:^|\\\\n)\\\\s*${escaped}:\\\\s*\"([^\"]+)\"\\\\s*(?:\\\\n|$)`).exec(body);\n\treturn match?.[1] ?? null;\n};\n\nexport const parseSealKeyServerConfig = (body: string): ParsedSealKeyServerConfig | null => {\n\tconst sealPackageId = readQuotedYamlField(body, 'seal_package');\n\tconst nodeUrl = readQuotedYamlField(body, 'node_url');\n\tconst keyServerObjectId = readQuotedYamlField(body, 'key_server_object_id');\n\tif (sealPackageId === null || nodeUrl === null || keyServerObjectId === null) {\n\t\treturn null;\n\t}\n\treturn { sealPackageId, nodeUrl, keyServerObjectId };\n};\n\nexport const parseMasterKeyEnvFile = (body: string): string | null => {\n\tconst match = /^MASTER_KEY=(0x)?([0-9a-fA-F]+)\\s*$/m.exec(body);\n\treturn match?.[2] ?? null;\n};\n\n// ---------------------------------------------------------------------------\n// Staging procedure — write yaml + env-file with proper mode bits\n// ---------------------------------------------------------------------------\n\n/** Compose the two writes the local-keygen mode needs.\n *\n * Writes:\n *\n * - `${servicePath}/key-server-config.yaml` (mode 0o644 — public)\n * - `${servicePath}/master-key.env` (mode 0o600 — secret)\n *\n * Parent dir is created with 0o700 (distilled-doc invariant #2).\n * Both writes flow through the substrate's `atomicWriteFile`\n * (tempfile + fsync + rename, never partial-write visible).\n *\n * Distilled-doc invariant #4: `master-key.env` MUST NOT be unlinked\n * on scope close (snapshot → restore round-trip retains the key).\n * We do NOT register a finalizer here.\n *\n * Error surface: `SealError({phase: 'config-render'})` wraps any\n * underlying `AtomicWriteFailed`. The substrate's atomic write owns\n * fsync + rename + cleanup semantics. */\nexport const stageSealConfig = (\n\tyamlBody: string,\n\tmasterKeyHex: string,\n\tservicePath: string,\n\tname: string,\n): Effect.Effect<\n\t{\n\t\treadonly configPath: string;\n\t\treadonly masterKeyEnvFile: string;\n\t},\n\tSealError,\n\tFileSystem.FileSystem\n> =>\n\tEffect.gen(function* () {\n\t\tconst configPath = `${servicePath}/${KEY_SERVER_CONFIG_BASENAME}`;\n\t\tconst masterKeyEnvFile = `${servicePath}/${MASTER_KEY_ENVFILE_BASENAME}`;\n\t\tconst yamlBytes = new TextEncoder().encode(yamlBody);\n\t\tconst envBytes = new TextEncoder().encode(renderMasterKeyEnvFile(masterKeyHex));\n\n\t\t// World-readable yaml (no secrets) inside 0o700 parent — the\n\t\t// daemon process inside the container reads via the bind-mount\n\t\t// so host-side mode bits don't fully matter, but 0o644 is the\n\t\t// least-surprising default for a non-secret config.\n\t\tyield* atomicWriteFile(configPath, yamlBytes, {\n\t\t\tmode: 0o644,\n\t\t\tparentMode: 0o700,\n\t\t}).pipe(\n\t\t\tEffect.catch((cause) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tsealError('config-render', {\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tmessage: `seal.config-render: failed to write ${KEY_SERVER_CONFIG_BASENAME} (${cause.stage})`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\t// SECRET — 0o600 inside the same 0o700 parent. Distilled-doc\n\t\t// §Hard requirements #2.\n\t\tyield* atomicWriteFile(masterKeyEnvFile, envBytes, {\n\t\t\tmode: 0o600,\n\t\t\tparentMode: 0o700,\n\t\t}).pipe(\n\t\t\tEffect.catch((cause) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tsealError('config-render', {\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tmessage: `seal.config-render: failed to write ${MASTER_KEY_ENVFILE_BASENAME} (${cause.stage})`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\treturn { configPath, masterKeyEnvFile };\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.seal.config-render.stage', {\n\t\t\tattributes: { 'seal.name': name, 'seal.servicePath': servicePath },\n\t\t}),\n\t);\n"],"mappings":";;;;;AAkDA,MAAM,6BAA6B;;;;;;AAWnC,MAAa,6BAA6B,WAA8C;CACvF,MAAM,QAAQ,OAAO,2BAA2B;AAChD,QAAO;EACN;EACA,oBAAoB,OAAO,cAAc;EACzC,cAAc,OAAO,QAAQ;EAC7B;EACA,4BAA4B,OAAO,kBAAkB;EACrD,gCAAgC,MAAM;EACtC;EACA,CAAC,KAAK,KAAK;;;;;;AAWb,MAAa,0BAA0B,iBACtC,cAAc,aAAa;AAkB5B,MAAa,yBAAyB,SAAgC;AAErE,QADc,uCAAuC,KAAK,KAC9C,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;AAyBtB,MAAa,mBACZ,UACA,cACA,aACA,SASA,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,GAAG,YAAY,GAAG;CACrC,MAAM,mBAAmB,GAAG,YAAY,GAAG;CAC3C,MAAM,YAAY,IAAI,aAAa,CAAC,OAAO,SAAS;CACpD,MAAM,WAAW,IAAI,aAAa,CAAC,OAAO,uBAAuB,aAAa,CAAC;AAM/E,QAAO,gBAAgB,YAAY,WAAW;EAC7C,MAAM;EACN,YAAY;EACZ,CAAC,CAAC,KACF,OAAO,OAAO,UACb,OAAO,KACN,UAAU,iBAAiB;EAC1B;EACA,SAAS,uCAAuC,2BAA2B,IAAI,MAAM,MAAM;EAC3F;EACA,CAAC,CACF,CACD,CACD;AAID,QAAO,gBAAgB,kBAAkB,UAAU;EAClD,MAAM;EACN,YAAY;EACZ,CAAC,CAAC,KACF,OAAO,OAAO,UACb,OAAO,KACN,UAAU,iBAAiB;EAC1B;EACA,SAAS,uCAAuC,4BAA4B,IAAI,MAAM,MAAM;EAC5F;EACA,CAAC,CACF,CACD,CACD;AAED,QAAO;EAAE;EAAY;EAAkB;EACtC,CAAC,KACF,OAAO,SAAS,4CAA4C,EAC3D,YAAY;CAAE,aAAa;CAAM,oBAAoB;CAAa,EAClE,CAAC,CACF"}
1
+ {"version":3,"file":"config-render.mjs","names":[],"sources":["../../../src/plugins/seal/config-render.ts"],"sourcesContent":["// Seal plugin — key-server-config.yaml renderer.\n//\n// Distilled-doc invariant #19: the `network: !Devnet` discriminator\n// is LOAD-BEARING. Env-only mode silently routes at the public\n// testnet fullnode regardless of `NODE_URL`; going through the\n// config file with the `!Devnet` discriminator binds the daemon to\n// the in-stack sui RPC.\n//\n// Distilled-doc invariant #20: the rendered file MUST land under\n// `runtime/seal/`, NOT a scoped temp dir. The substrate's\n// service-path resolver (`servicePath('seal')`) produces the host\n// path; we land both the yaml and the master-key env-file there.\n//\n// This file declares the renderer + the staging procedure. The\n// renderer is a pure string builder; the staging procedure uses the\n// substrate's atomic-write primitive (FileSystem-backed).\n\nimport { Effect, FileSystem } from 'effect';\n\nimport { atomicWriteFile } from '../../substrate/runtime/atomic-write.ts';\nimport { sealConfigError, sealError, type SealError } from './errors.ts';\nimport { KEY_SERVER_CONFIG_BASENAME, MASTER_KEY_ENVFILE_BASENAME } from './keygen.ts';\nimport { SealSpans } from './spans.ts';\n\n// ---------------------------------------------------------------------------\n// Render inputs\n// ---------------------------------------------------------------------------\n\n/** Inputs the renderer consumes. The substrate provides the\n * sui node URL (in-container DNS form, e.g. `http://sui-localnet:9000`)\n * + the seal package id + the on-chain key-server object id. */\nexport interface SealKeyServerConfigInputs {\n\t/** Seal Move package id (from publish). */\n\treadonly sealPackageId: string;\n\t/** Sui RPC node URL as seen from inside the container's network. */\n\treadonly nodeUrl: string;\n\t/** On-chain `KeyServer` object id (from register). */\n\treadonly keyServerObjectId: string;\n\t/** Optional ts-sdk version requirement override. Default is the\n\t * pin distilled from v3 (`'>=0.4.5'`); v2 plans expose this so\n\t * consumers running older `@mysten/seal` aren't silently\n\t * rejected. Distilled-doc opportunity #8. */\n\treadonly tsSdkVersionRequirement?: string;\n}\n\nexport interface ParsedSealKeyServerConfig {\n\treadonly sealPackageId: string;\n\treadonly nodeUrl: string;\n\treadonly keyServerObjectId: string;\n}\n\nconst DEFAULT_TS_SDK_REQUIREMENT = '>=0.4.5';\n\n// ---------------------------------------------------------------------------\n// Render — pure string builder\n// ---------------------------------------------------------------------------\n\n/** Allowed character set for raw interpolation into a YAML double-quoted\n * string. A `\"` would close the quote and let downstream characters\n * inject YAML syntax; a backslash would start an escape sequence the\n * parser then chokes on. Sui/Seal object ids + node URLs only need\n * alphanumerics, `:/_.-`, and `0x` — so the conservative whitelist is\n * safe. The `ts_sdk_version_requirement` allows the SemVer comparator\n * characters as well. */\nconst YAML_INTERP_FIELD_RE = /^[0-9a-zA-Z:/_.\\-]+$/;\nconst YAML_INTERP_SEMVER_RE = /^[0-9a-zA-Z:/_.\\-<>=^~* |!]+$/;\n\nconst assertYamlSafe = (field: string, value: string, pattern: RegExp): string => {\n\tif (pattern.test(value)) return value;\n\tthrow sealConfigError({\n\t\tfield,\n\t\tmessage: `seal.config-render: ${field} contains characters that would break YAML quoting`,\n\t\thint: `allowed characters: ${pattern.source}`,\n\t});\n};\n\n/** Render the key-server config yaml.\n *\n * Distilled-doc invariant #19: `network: !Devnet` is hardcoded.\n * This is the \"custom chain via node_url\" discriminator the\n * upstream binary expects when devstack supplies its own RPC.\n *\n * Each interpolated value is whitelist-asserted BEFORE rendering — a\n * `\"` in any field would close the YAML quoted string and let\n * downstream characters inject syntax. The assertion raises a\n * `SealConfigError({phase: 'config-render'})` naming the offending\n * field so callers see a typed refusal, not silently-broken YAML. */\nexport const renderSealKeyServerConfig = (inputs: SealKeyServerConfigInputs): string => {\n\tconst sealPackageId = assertYamlSafe('sealPackageId', inputs.sealPackageId, YAML_INTERP_FIELD_RE);\n\tconst nodeUrl = assertYamlSafe('nodeUrl', inputs.nodeUrl, YAML_INTERP_FIELD_RE);\n\tconst keyServerObjectId = assertYamlSafe(\n\t\t'keyServerObjectId',\n\t\tinputs.keyServerObjectId,\n\t\tYAML_INTERP_FIELD_RE,\n\t);\n\tconst tsReq = assertYamlSafe(\n\t\t'tsSdkVersionRequirement',\n\t\tinputs.tsSdkVersionRequirement ?? DEFAULT_TS_SDK_REQUIREMENT,\n\t\tYAML_INTERP_SEMVER_RE,\n\t);\n\treturn [\n\t\t'network: !Devnet',\n\t\t` seal_package: \"${sealPackageId}\"`,\n\t\t`node_url: \"${nodeUrl}\"`,\n\t\t'server_mode: !Open',\n\t\t` key_server_object_id: \"${keyServerObjectId}\"`,\n\t\t`ts_sdk_version_requirement: \"${tsReq}\"`,\n\t\t'',\n\t].join('\\n');\n};\n\n// ---------------------------------------------------------------------------\n// Master-key env-file body\n// ---------------------------------------------------------------------------\n\n/** Render the docker `--env-file` body. Single `KEY=value` line.\n * Distilled-doc invariant #3 — this is the ONLY path the master key\n * reaches the container; inline `-e MASTER_KEY=…` would surface\n * the secret in `docker inspect` and host process env. */\nexport const renderMasterKeyEnvFile = (masterKeyHex: string): string =>\n\t`MASTER_KEY=${masterKeyHex}\\n`;\n\nconst readQuotedYamlField = (body: string, field: string): string | null => {\n\tconst escaped = field.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\t// Anchor to start-of-line: `(?:^|\\n)` plus a whitespace-only run\n\t// (`[ \\t]*` — explicitly excludes `#`) so a commented field\n\t// (`# node_url: \"fake\"`) can never accidentally match. The renderer\n\t// does not emit comments today, but the parser is also used on\n\t// snapshot-restore bodies that may grow comments in future. The\n\t// previous `\\s*` admitted no `#`, but `\\s` includes `\\n` which let\n\t// the regex engine skip past the start-of-line anchor; restricting\n\t// to inline-whitespace makes the line-anchoring strict.\n\tconst match = new RegExp(`(?:^|\\\\n)[ \\\\t]*${escaped}:[ \\\\t]*\"([^\"]+)\"[ \\\\t]*(?:\\\\n|$)`).exec(\n\t\tbody,\n\t);\n\treturn match?.[1] ?? null;\n};\n\nexport const parseSealKeyServerConfig = (body: string): ParsedSealKeyServerConfig | null => {\n\tconst sealPackageId = readQuotedYamlField(body, 'seal_package');\n\tconst nodeUrl = readQuotedYamlField(body, 'node_url');\n\tconst keyServerObjectId = readQuotedYamlField(body, 'key_server_object_id');\n\tif (sealPackageId === null || nodeUrl === null || keyServerObjectId === null) {\n\t\treturn null;\n\t}\n\treturn { sealPackageId, nodeUrl, keyServerObjectId };\n};\n\nexport const parseMasterKeyEnvFile = (body: string): string | null => {\n\tconst match = /^MASTER_KEY=(0x)?([0-9a-fA-F]+)\\s*$/m.exec(body);\n\treturn match?.[2] ?? null;\n};\n\n// ---------------------------------------------------------------------------\n// Staging procedure — write yaml + env-file with proper mode bits\n// ---------------------------------------------------------------------------\n\n/** Compose the two writes the local-keygen mode needs.\n *\n * Writes:\n *\n * - `${servicePath}/key-server-config.yaml` (mode 0o644 — public)\n * - `${servicePath}/master-key.env` (mode 0o600 — secret)\n *\n * Parent dir is created with 0o700 (distilled-doc invariant #2).\n * Both writes flow through the substrate's `atomicWriteFile`\n * (tempfile + fsync + rename, never partial-write visible).\n *\n * Distilled-doc invariant #4: `master-key.env` MUST NOT be unlinked\n * on scope close (snapshot → restore round-trip retains the key).\n * We do NOT register a finalizer here.\n *\n * Error surface: `SealError({phase: 'config-render'})` wraps any\n * underlying `AtomicWriteFailed`. The substrate's atomic write owns\n * fsync + rename + cleanup semantics. */\nexport const stageSealConfig = (\n\tyamlBody: string,\n\tmasterKeyHex: string,\n\tservicePath: string,\n\tname: string,\n): Effect.Effect<\n\t{\n\t\treadonly configPath: string;\n\t\treadonly masterKeyEnvFile: string;\n\t},\n\tSealError,\n\tFileSystem.FileSystem\n> =>\n\tEffect.gen(function* () {\n\t\tconst configPath = `${servicePath}/${KEY_SERVER_CONFIG_BASENAME}`;\n\t\tconst masterKeyEnvFile = `${servicePath}/${MASTER_KEY_ENVFILE_BASENAME}`;\n\t\tconst yamlBytes = new TextEncoder().encode(yamlBody);\n\t\tconst envBytes = new TextEncoder().encode(renderMasterKeyEnvFile(masterKeyHex));\n\n\t\t// World-readable yaml (no secrets) inside 0o700 parent — the\n\t\t// daemon process inside the container reads via the bind-mount\n\t\t// so host-side mode bits don't fully matter, but 0o644 is the\n\t\t// least-surprising default for a non-secret config.\n\t\tyield* atomicWriteFile(configPath, yamlBytes, {\n\t\t\tmode: 0o644,\n\t\t\tparentMode: 0o700,\n\t\t}).pipe(\n\t\t\tEffect.catch((cause) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tsealError('config-render', {\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tmessage: `seal.config-render: failed to write ${KEY_SERVER_CONFIG_BASENAME} (${cause.stage})`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\t// SECRET — 0o600 inside the same 0o700 parent. Distilled-doc\n\t\t// §Hard requirements #2.\n\t\tyield* atomicWriteFile(masterKeyEnvFile, envBytes, {\n\t\t\tmode: 0o600,\n\t\t\tparentMode: 0o700,\n\t\t}).pipe(\n\t\t\tEffect.catch((cause) =>\n\t\t\t\tEffect.fail(\n\t\t\t\t\tsealError('config-render', {\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tmessage: `seal.config-render: failed to write ${MASTER_KEY_ENVFILE_BASENAME} (${cause.stage})`,\n\t\t\t\t\t\tcause,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\t\treturn { configPath, masterKeyEnvFile };\n\t}).pipe(\n\t\tEffect.withSpan('devstack.plugin.seal.config-render.stage', {\n\t\t\tattributes: { [SealSpans.name]: name, [SealSpans.servicePath]: servicePath },\n\t\t}),\n\t);\n"],"mappings":";;;;;;AAmDA,MAAM,6BAA6B;;;;;;;;AAanC,MAAM,uBAAuB;AAC7B,MAAM,wBAAwB;AAE9B,MAAM,kBAAkB,OAAe,OAAe,YAA4B;AACjF,KAAI,QAAQ,KAAK,MAAM,CAAE,QAAO;AAChC,OAAM,gBAAgB;EACrB;EACA,SAAS,uBAAuB,MAAM;EACtC,MAAM,uBAAuB,QAAQ;EACrC,CAAC;;;;;;;;;;;;;AAcH,MAAa,6BAA6B,WAA8C;CACvF,MAAM,gBAAgB,eAAe,iBAAiB,OAAO,eAAe,qBAAqB;CACjG,MAAM,UAAU,eAAe,WAAW,OAAO,SAAS,qBAAqB;CAC/E,MAAM,oBAAoB,eACzB,qBACA,OAAO,mBACP,qBACA;CACD,MAAM,QAAQ,eACb,2BACA,OAAO,2BAA2B,4BAClC,sBACA;AACD,QAAO;EACN;EACA,oBAAoB,cAAc;EAClC,cAAc,QAAQ;EACtB;EACA,4BAA4B,kBAAkB;EAC9C,gCAAgC,MAAM;EACtC;EACA,CAAC,KAAK,KAAK;;;;;;AAWb,MAAa,0BAA0B,iBACtC,cAAc,aAAa;AA4B5B,MAAa,yBAAyB,SAAgC;AAErE,QADc,uCAAuC,KAAK,KAC9C,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;AAyBtB,MAAa,mBACZ,UACA,cACA,aACA,SASA,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,GAAG,YAAY,GAAG;CACrC,MAAM,mBAAmB,GAAG,YAAY,GAAG;CAC3C,MAAM,YAAY,IAAI,aAAa,CAAC,OAAO,SAAS;CACpD,MAAM,WAAW,IAAI,aAAa,CAAC,OAAO,uBAAuB,aAAa,CAAC;AAM/E,QAAO,gBAAgB,YAAY,WAAW;EAC7C,MAAM;EACN,YAAY;EACZ,CAAC,CAAC,KACF,OAAO,OAAO,UACb,OAAO,KACN,UAAU,iBAAiB;EAC1B;EACA,SAAS,uCAAuC,2BAA2B,IAAI,MAAM,MAAM;EAC3F;EACA,CAAC,CACF,CACD,CACD;AAID,QAAO,gBAAgB,kBAAkB,UAAU;EAClD,MAAM;EACN,YAAY;EACZ,CAAC,CAAC,KACF,OAAO,OAAO,UACb,OAAO,KACN,UAAU,iBAAiB;EAC1B;EACA,SAAS,uCAAuC,4BAA4B,IAAI,MAAM,MAAM;EAC5F;EACA,CAAC,CACF,CACD,CACD;AAED,QAAO;EAAE;EAAY;EAAkB;EACtC,CAAC,KACF,OAAO,SAAS,4CAA4C,EAC3D,YAAY;EAAG,UAAU,OAAO;EAAO,UAAU,cAAc;CAAa,EAC5E,CAAC,CACF"}
@@ -1,18 +1,16 @@
1
1
  import { contentHash } from "../../substrate/brand.mjs";
2
2
  import { hashMoveSources, runMoveBuild, scrubLocksHost } from "../../substrate/runtime/sui-move-build/index.mjs";
3
+ import { executeSuiTx, formatExecutedFailure } from "../../substrate/runtime/sui-execute/index.mjs";
4
+ import { artifactPublishError } from "../../primitives/artifact-publisher.mjs";
3
5
  import { sealError } from "./errors.mjs";
4
- import { decodeHex } from "./keygen.mjs";
5
- import { executeSuiTx } from "../../substrate/runtime/sui-execute/index.mjs";
6
+ import { SealSpans } from "./spans.mjs";
6
7
  import { Effect, Schema } from "effect";
7
8
  import { createHash } from "node:crypto";
9
+ import { fromHex } from "@mysten/sui/utils";
8
10
  import { Transaction } from "@mysten/sui/transactions";
9
11
  //#region src/plugins/seal/deploy.ts
10
12
  const KEY_TYPE_BONEH_FRANKLIN_BLS12381 = 0;
11
- const sealProduceFailed = (op, err) => ({
12
- _tag: "ArtifactPublishError",
13
- reason: "produce-failed",
14
- detail: `seal.${op} ${err.phase}: ${err.message}`
15
- });
13
+ const sealProduceFailed = (op, err) => artifactPublishError("produce-failed", `seal.${op} ${err.phase}: ${err.message}`);
16
14
  const moveBuildToSealError = (name, err) => sealError("publish", {
17
15
  name,
18
16
  message: `seal publish ${err.phase} failed for source '${err.sourcePath}': ${err.message}`,
@@ -59,7 +57,7 @@ const projectSealPublishReceipt = (name, receipt) => {
59
57
  });
60
58
  };
61
59
  const runSealPublishTransaction = (inputs) => Effect.gen(function* () {
62
- yield* scrubLocksHost(inputs.movePackagePath, "~/.move", { packageLockFailures: inputs.buildImage !== void 0 ? "best-effort" : "fatal" }).pipe(Effect.mapError((err) => moveBuildToSealError(inputs.name, err)));
60
+ yield* scrubLocksHost(inputs.movePackagePath, "~/.move").pipe(Effect.mapError((err) => moveBuildToSealError(inputs.name, err)));
63
61
  const buildOutput = yield* runMoveBuild({
64
62
  sourcePath: inputs.movePackagePath,
65
63
  packageName: inputs.name,
@@ -67,7 +65,7 @@ const runSealPublishTransaction = (inputs) => Effect.gen(function* () {
67
65
  runtime: inputs.runtime,
68
66
  ...inputs.buildImage !== void 0 ? { buildImage: inputs.buildImage } : {}
69
67
  }).pipe(Effect.mapError((err) => moveBuildToSealError(inputs.name, err)));
70
- const receipt = yield* executeSuiTx({
68
+ const result = yield* executeSuiTx({
71
69
  client: inputs.sdk.client,
72
70
  signer: inputs.signer,
73
71
  build: async () => {
@@ -80,31 +78,28 @@ const runSealPublishTransaction = (inputs) => Effect.gen(function* () {
80
78
  message: `seal publish tx failed for signer '${inputs.signer.name}' (address=${inputs.signer.address}) during ${cause.phase}: ${cause.message}`,
81
79
  cause
82
80
  })));
83
- return yield* projectSealPublishReceipt(inputs.name, receipt);
81
+ if (result.$kind === "FailedTransaction") return yield* Effect.fail(sealError("publish", {
82
+ name: inputs.name,
83
+ message: `seal publish tx executed but on-chain execution failed for signer '${inputs.signer.name}' (address=${inputs.signer.address}) ` + formatExecutedFailure(result.FailedTransaction)
84
+ }));
85
+ return yield* projectSealPublishReceipt(inputs.name, result.Transaction);
84
86
  }).pipe(Effect.withSpan("devstack.plugin.seal.publish.suiTx", { attributes: {
85
- "seal.name": inputs.name,
86
- "seal.signer": inputs.signer.address
87
+ [SealSpans.name]: inputs.name,
88
+ [SealSpans.signer]: inputs.signer.address
87
89
  } }));
88
90
  const publishSealPackage = (publisher, inputs) => Effect.gen(function* () {
89
91
  const inputsHash = sealPackageInputsHash(yield* hashMoveSources(inputs.movePackagePath).pipe(Effect.mapError((err) => moveBuildToSealError(inputs.name, err))), inputs.signer.address);
90
- const result = yield* publisher.publish({
92
+ return { packageId: (yield* publisher.publish({
91
93
  namespace: SEAL_PACKAGE_NAMESPACE,
92
94
  chain: inputs.chain,
93
95
  contentHash: inputsHash,
94
- verifySchema: SealPackageVerifyShape,
95
96
  verify: (cached) => verifyObjectLenient(inputs.chainProbe, cached.packageId, SealPackageVerifyShape),
96
97
  produce: runSealPublishTransaction(inputs).pipe(Effect.mapError((err) => sealProduceFailed("publish", err))),
97
98
  register: () => Effect.void
98
- });
99
- const packageId = "packageId" in result ? result.packageId : result.objectId;
100
- if (!packageId) return yield* Effect.fail(sealError("publish", {
101
- name: inputs.name,
102
- message: "seal.deploy.publishSealPackage: publisher returned no package id"
103
- }));
104
- return { packageId };
99
+ })).packageId };
105
100
  }).pipe(Effect.withSpan("devstack.plugin.seal.publish", { attributes: {
106
- "seal.name": inputs.name,
107
- "seal.chain": inputs.chain
101
+ [SealSpans.name]: inputs.name,
102
+ [SealSpans.chain]: inputs.chain
108
103
  } }));
109
104
  const SEAL_KEY_SERVER_NAMESPACE = "seal/key-server-id";
110
105
  const SealKeyServerVerifyShape = Schema.Struct({
@@ -131,7 +126,7 @@ const registerTransactionBuilder = (tx) => ({
131
126
  })
132
127
  });
133
128
  const buildRegisterKeyServerMoveCall = (tx, inputs, signerAddress) => {
134
- const pkBytes = decodeHex(inputs.publicKeyHex);
129
+ const pkBytes = fromHex(inputs.publicKeyHex);
135
130
  tx.setSender(signerAddress);
136
131
  tx.moveCall({
137
132
  target: `${inputs.sealPackageId}::key_server::create_and_transfer_v2_independent_server`,
@@ -153,7 +148,7 @@ const projectRegisterKeyServerReceipt = (name, receipt) => {
153
148
  return Effect.succeed({ objectId });
154
149
  };
155
150
  const runRegisterKeyServerTransaction = (sdk, signer, inputs) => Effect.gen(function* () {
156
- const receipt = yield* executeSuiTx({
151
+ const result = yield* executeSuiTx({
157
152
  client: sdk.client,
158
153
  signer,
159
154
  build: async () => {
@@ -166,31 +161,28 @@ const runRegisterKeyServerTransaction = (sdk, signer, inputs) => Effect.gen(func
166
161
  message: `seal register tx failed for signer '${signer.name}' (address=${signer.address}) during ${cause.phase}: ${cause.message}`,
167
162
  cause
168
163
  })));
169
- return yield* projectRegisterKeyServerReceipt(inputs.name, receipt);
164
+ if (result.$kind === "FailedTransaction") return yield* Effect.fail(sealError("register", {
165
+ name: inputs.name,
166
+ message: `seal register tx executed but on-chain execution failed for signer '${signer.name}' (address=${signer.address}) ` + formatExecutedFailure(result.FailedTransaction)
167
+ }));
168
+ return yield* projectRegisterKeyServerReceipt(inputs.name, result.Transaction);
170
169
  }).pipe(Effect.withSpan("devstack.plugin.seal.register.suiTx", { attributes: {
171
- "seal.name": inputs.name,
172
- "seal.url": inputs.keyServerUrl
170
+ [SealSpans.name]: inputs.name,
171
+ [SealSpans.url]: inputs.keyServerUrl
173
172
  } }));
174
173
  const registerKeyServer = (publisher, inputs) => Effect.gen(function* () {
175
174
  const inputsHash = sealRegisterInputsHash(inputs, inputs.signer.address);
176
- const result = yield* publisher.publish({
175
+ return { objectId: (yield* publisher.publish({
177
176
  namespace: SEAL_KEY_SERVER_NAMESPACE,
178
177
  chain: inputs.chain,
179
178
  contentHash: inputsHash,
180
- verifySchema: SealKeyServerVerifyShape,
181
179
  verify: (cached) => verifyObjectLenient(inputs.chainProbe, cached.objectId, SealKeyServerVerifyShape),
182
180
  produce: runRegisterKeyServerTransaction(inputs.sdk, inputs.signer, inputs).pipe(Effect.mapError((err) => sealProduceFailed("register", err))),
183
181
  register: () => Effect.void
184
- });
185
- const objectId = "objectId" in result ? result.objectId : void 0;
186
- if (!objectId) return yield* Effect.fail(sealError("register", {
187
- name: inputs.name,
188
- message: "seal.deploy.registerKeyServer: publisher returned no objectId"
189
- }));
190
- return { objectId };
182
+ })).objectId };
191
183
  }).pipe(Effect.withSpan("devstack.plugin.seal.register", { attributes: {
192
- "seal.name": inputs.name,
193
- "seal.url": inputs.keyServerUrl
184
+ [SealSpans.name]: inputs.name,
185
+ [SealSpans.url]: inputs.keyServerUrl
194
186
  } }));
195
187
  //#endregion
196
188
  export { publishSealPackage, registerKeyServer };