@mysten-incubation/devstack 0.0.1 → 0.1.1

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 +8 -4
  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 +41 -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
@@ -12,8 +12,17 @@ const SENSITIVE_HEADER = [
12
12
  "// credentials, or user extras). The output directory ships a .gitignore",
13
13
  "// covering it; this banner is a belt-and-braces reminder."
14
14
  ].join("\n");
15
- /** Render an emitted file to a TS source string. Throws a tagged
16
- * error class when the value is unserialisable. */
15
+ const renderErr = (input, detail) => ({
16
+ ok: false,
17
+ error: new CodegenRenderError({
18
+ emitterName: input.emitterName,
19
+ outputPath: input.outputPath,
20
+ detail
21
+ })
22
+ });
23
+ /** Render an emitted file to a TS source string. Returns a discriminated
24
+ * `RenderResult` — `{ok: true, text}` on success, `{ok: false, error}`
25
+ * when the value is unserialisable or imports forbidden paths. */
17
26
  const renderFile = (input) => {
18
27
  const lines = [];
19
28
  lines.push(GENERATED_HEADER);
@@ -24,11 +33,7 @@ const renderFile = (input) => {
24
33
  lines.push("");
25
34
  if (input.imports && input.imports.length > 0) {
26
35
  for (const imp of input.imports) {
27
- if (isForbiddenGeneratedImport(imp)) return new CodegenRenderError({
28
- emitterName: input.emitterName,
29
- outputPath: input.outputPath,
30
- detail: `generated files must not import devstack source: ${imp}`
31
- });
36
+ if (isForbiddenGeneratedImport(imp)) return renderErr(input, `generated files must not import devstack source: ${imp}`);
32
37
  lines.push(imp);
33
38
  }
34
39
  lines.push("");
@@ -37,68 +42,71 @@ const renderFile = (input) => {
37
42
  for (const key of keys) {
38
43
  const value = input.exports[key];
39
44
  const rendered = tryRender(value, /* @__PURE__ */ new Set());
40
- if (rendered instanceof Error) return new CodegenRenderError({
41
- emitterName: input.emitterName,
42
- outputPath: input.outputPath,
43
- detail: `export '${key}': ${rendered.message}`
44
- });
45
- if (!isIdentifier(key)) return new CodegenRenderError({
46
- emitterName: input.emitterName,
47
- outputPath: input.outputPath,
48
- detail: `export key '${key}' is not a valid TS identifier`
49
- });
50
- lines.push(`export const ${key} = ${rendered} as const;`);
45
+ if (!rendered.ok) return renderErr(input, `export '${key}': ${rendered.detail}`);
46
+ if (!isIdentifier(key)) return renderErr(input, `export key '${key}' is not a valid TS identifier`);
47
+ lines.push(`export const ${key} = ${rendered.text} as const;`);
51
48
  lines.push("");
52
49
  }
53
50
  while (lines.length > 1 && lines[lines.length - 1] === "" && lines[lines.length - 2] === "") lines.pop();
54
- return lines.join("\n") + (lines[lines.length - 1] === "" ? "" : "\n");
51
+ return {
52
+ ok: true,
53
+ text: lines.join("\n") + (lines[lines.length - 1] === "" ? "" : "\n")
54
+ };
55
55
  };
56
56
  const INDENT = " ";
57
+ const tryOk = (text) => ({
58
+ ok: true,
59
+ text
60
+ });
61
+ const tryErr = (detail) => ({
62
+ ok: false,
63
+ detail
64
+ });
57
65
  const tryRender = (value, seen, depth = 1) => {
58
- if (value === null) return "null";
59
- if (value === void 0) return /* @__PURE__ */ new Error("undefined is not serialisable — emit null instead");
66
+ if (value === null) return tryOk("null");
67
+ if (value === void 0) return tryErr("undefined is not serialisable — emit null instead");
60
68
  const t = typeof value;
61
- if (t === "string") return JSON.stringify(value);
69
+ if (t === "string") return tryOk(JSON.stringify(value));
62
70
  if (t === "number") {
63
- if (!Number.isFinite(value)) return /* @__PURE__ */ new Error("non-finite number");
64
- return String(value);
71
+ if (!Number.isFinite(value)) return tryErr("non-finite number");
72
+ return tryOk(String(value));
65
73
  }
66
- if (t === "boolean") return String(value);
67
- if (t === "bigint") return JSON.stringify(value.toString());
68
- if (t === "function" || t === "symbol") return /* @__PURE__ */ new Error(`${t} is not serialisable`);
74
+ if (t === "boolean") return tryOk(String(value));
75
+ if (t === "bigint") return tryOk(JSON.stringify(value.toString()));
76
+ if (t === "function" || t === "symbol") return tryErr(`${t} is not serialisable`);
69
77
  if (Array.isArray(value)) {
70
- if (seen.has(value)) return /* @__PURE__ */ new Error("circular reference");
78
+ if (seen.has(value)) return tryErr("circular reference");
71
79
  seen.add(value);
72
- if (value.length === 0) return "[]";
80
+ if (value.length === 0) return tryOk("[]");
73
81
  const inner = [];
74
82
  for (const item of value) {
75
83
  const r = tryRender(item, seen, depth + 1);
76
- if (r instanceof Error) return r;
77
- inner.push(INDENT.repeat(depth) + r);
84
+ if (!r.ok) return r;
85
+ inner.push(INDENT.repeat(depth) + r.text);
78
86
  }
79
87
  seen.delete(value);
80
- return `[\n${inner.join(",\n")},\n${INDENT.repeat(depth - 1)}]`;
88
+ return tryOk(`[\n${inner.join(",\n")},\n${INDENT.repeat(depth - 1)}]`);
81
89
  }
82
90
  if (t === "object") {
83
91
  const obj = value;
84
- if (seen.has(obj)) return /* @__PURE__ */ new Error("circular reference");
92
+ if (seen.has(obj)) return tryErr("circular reference");
85
93
  seen.add(obj);
86
94
  const keys = Object.keys(obj).sort();
87
- if (keys.length === 0) return "{}";
95
+ if (keys.length === 0) return tryOk("{}");
88
96
  const lines = [];
89
97
  for (const k of keys) {
90
98
  const v = obj[k];
91
99
  if (v === void 0) continue;
92
100
  const r = tryRender(v, seen, depth + 1);
93
- if (r instanceof Error) return r;
101
+ if (!r.ok) return r;
94
102
  const keyText = isIdentifier(k) ? k : JSON.stringify(k);
95
- lines.push(`${INDENT.repeat(depth)}${keyText}: ${r}`);
103
+ lines.push(`${INDENT.repeat(depth)}${keyText}: ${r.text}`);
96
104
  }
97
105
  seen.delete(obj);
98
- if (lines.length === 0) return "{}";
99
- return `{\n${lines.join(",\n")},\n${INDENT.repeat(depth - 1)}}`;
106
+ if (lines.length === 0) return tryOk("{}");
107
+ return tryOk(`{\n${lines.join(",\n")},\n${INDENT.repeat(depth - 1)}}`);
100
108
  }
101
- return /* @__PURE__ */ new Error(`unsupported value type ${t}`);
109
+ return tryErr(`unsupported value type ${t}`);
102
110
  };
103
111
  const IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
104
112
  const isIdentifier = (s) => IDENT_RE.test(s);
@@ -1 +1 @@
1
- {"version":3,"file":"format.mjs","names":[],"sources":["../../../src/orchestrators/codegen/format.ts"],"sourcesContent":["// TypeScript source rendering for codegen-emitted files.\n//\n// Distilled-doc § \"Hand-rolled TS-object-literal rendering ... drifts\n// subtly between emitters; a small shared renderer would absorb the\n// variation and own the bigint policy in one place.\" This module IS\n// that shared renderer.\n//\n// Output shape (one emitted file):\n//\n// <generated-header>\n// <do-not-commit-banner if sensitive>\n// <imports?>\n// <one `export const <name> = <literal> as const;` per export>\n// <trailing newline>\n//\n// The renderer:\n// - sorts object keys (deterministic re-emit, distilled-doc\n// invariant \"Deterministic re-emit\"),\n// - quotes identifier-unsafe keys with double-quoted strings,\n// - serialises bigints as quoted decimal strings for\n// `BigInt(<string>)` consumers,\n// - refuses functions / symbols / undefined / circular refs with a\n// typed render error,\n// - emits arrays and records as readonly literal forms.\n//\n// The renderer does NOT format with prettier; it aims for\n// prettier-compatible spacing (two-space indent, trailing commas,\n// double-quoted strings, semicolons) so a prettier-on-write user\n// hook is a no-op on emitted bytes — that's load-bearing for the\n// \"no mtime touch on identical content\" idempotency invariant.\n\nimport { CodegenRenderError } from './errors.ts';\n\n// -----------------------------------------------------------------------------\n// Headers\n// -----------------------------------------------------------------------------\n\nconst GENERATED_HEADER = [\n\t'// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'// Do not edit by hand — your changes will be overwritten on the next',\n\t'// `devstack up` cycle. Apps consume codegen output; codegen output never',\n\t'// imports from devstack.',\n].join('\\n');\n\nconst SENSITIVE_HEADER = [\n\t'// !!! DO NOT COMMIT THIS FILE !!!',\n\t'// This file carries sensitive material (wallet pair token, database',\n\t'// credentials, or user extras). The output directory ships a .gitignore',\n\t'// covering it; this banner is a belt-and-braces reminder.',\n].join('\\n');\n\n// -----------------------------------------------------------------------------\n// Public render entry\n// -----------------------------------------------------------------------------\n\nexport interface RenderInput {\n\treadonly emitterName: string;\n\treadonly outputPath: string;\n\treadonly sensitive: boolean;\n\t/** The declarations written by `Codegenable.emit(ctx)`. Each entry\n\t * becomes one `export const <key> = <literal> as const;`. */\n\treadonly exports: { readonly [key: string]: unknown };\n\t/** Optional import lines the emitter wants prepended (e.g. a\n\t * type import from `@mysten/dapp-kit` for the wallet config).\n\t * Each entry is a raw import statement string. */\n\treadonly imports?: ReadonlyArray<string>;\n}\n\n/** Render an emitted file to a TS source string. Throws a tagged\n * error class when the value is unserialisable. */\nexport const renderFile = (input: RenderInput): string | CodegenRenderError => {\n\tconst lines: Array<string> = [];\n\tlines.push(GENERATED_HEADER);\n\tif (input.sensitive) {\n\t\tlines.push('');\n\t\tlines.push(SENSITIVE_HEADER);\n\t}\n\tlines.push('');\n\tif (input.imports && input.imports.length > 0) {\n\t\tfor (const imp of input.imports) {\n\t\t\tif (isForbiddenGeneratedImport(imp)) {\n\t\t\t\treturn new CodegenRenderError({\n\t\t\t\t\temitterName: input.emitterName,\n\t\t\t\t\toutputPath: input.outputPath,\n\t\t\t\t\tdetail: `generated files must not import devstack source: ${imp}`,\n\t\t\t\t});\n\t\t\t}\n\t\t\tlines.push(imp);\n\t\t}\n\t\tlines.push('');\n\t}\n\t// Stable export order: keys lexicographically sorted.\n\tconst keys = Object.keys(input.exports).sort();\n\tfor (const key of keys) {\n\t\tconst value = input.exports[key];\n\t\tconst rendered = tryRender(value, new Set());\n\t\tif (rendered instanceof Error) {\n\t\t\treturn new CodegenRenderError({\n\t\t\t\temitterName: input.emitterName,\n\t\t\t\toutputPath: input.outputPath,\n\t\t\t\tdetail: `export '${key}': ${rendered.message}`,\n\t\t\t});\n\t\t}\n\t\tif (!isIdentifier(key)) {\n\t\t\treturn new CodegenRenderError({\n\t\t\t\temitterName: input.emitterName,\n\t\t\t\toutputPath: input.outputPath,\n\t\t\t\tdetail: `export key '${key}' is not a valid TS identifier`,\n\t\t\t});\n\t\t}\n\t\tlines.push(`export const ${key} = ${rendered} as const;`);\n\t\tlines.push('');\n\t}\n\t// Single trailing newline; never two.\n\twhile (lines.length > 1 && lines[lines.length - 1] === '' && lines[lines.length - 2] === '') {\n\t\tlines.pop();\n\t}\n\treturn lines.join('\\n') + (lines[lines.length - 1] === '' ? '' : '\\n');\n};\n\n// -----------------------------------------------------------------------------\n// Value rendering\n// -----------------------------------------------------------------------------\n\nconst INDENT = '\\t';\n\nconst tryRender = (value: unknown, seen: Set<object>, depth = 1): string | Error => {\n\tif (value === null) return 'null';\n\tif (value === undefined) {\n\t\treturn new Error('undefined is not serialisable — emit null instead');\n\t}\n\tconst t = typeof value;\n\tif (t === 'string') return JSON.stringify(value);\n\tif (t === 'number') {\n\t\tif (!Number.isFinite(value as number)) {\n\t\t\treturn new Error('non-finite number');\n\t\t}\n\t\treturn String(value);\n\t}\n\tif (t === 'boolean') return String(value);\n\tif (t === 'bigint') {\n\t\treturn JSON.stringify(value.toString());\n\t}\n\tif (t === 'function' || t === 'symbol') {\n\t\treturn new Error(`${t} is not serialisable`);\n\t}\n\tif (Array.isArray(value)) {\n\t\tif (seen.has(value)) return new Error('circular reference');\n\t\tseen.add(value);\n\t\tif (value.length === 0) return '[]';\n\t\tconst inner: Array<string> = [];\n\t\tfor (const item of value) {\n\t\t\tconst r = tryRender(item, seen, depth + 1);\n\t\t\tif (r instanceof Error) return r;\n\t\t\tinner.push(INDENT.repeat(depth) + r);\n\t\t}\n\t\tseen.delete(value);\n\t\treturn `[\\n${inner.join(',\\n')},\\n${INDENT.repeat(depth - 1)}]`;\n\t}\n\tif (t === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tif (seen.has(obj)) return new Error('circular reference');\n\t\tseen.add(obj);\n\t\tconst keys = Object.keys(obj).sort();\n\t\tif (keys.length === 0) return '{}';\n\t\tconst lines: Array<string> = [];\n\t\tfor (const k of keys) {\n\t\t\tconst v = obj[k];\n\t\t\tif (v === undefined) continue; // drop undefined props (distilled-doc skip-emit-explicit)\n\t\t\tconst r = tryRender(v, seen, depth + 1);\n\t\t\tif (r instanceof Error) return r;\n\t\t\tconst keyText = isIdentifier(k) ? k : JSON.stringify(k);\n\t\t\tlines.push(`${INDENT.repeat(depth)}${keyText}: ${r}`);\n\t\t}\n\t\tseen.delete(obj);\n\t\tif (lines.length === 0) return '{}';\n\t\treturn `{\\n${lines.join(',\\n')},\\n${INDENT.repeat(depth - 1)}}`;\n\t}\n\treturn new Error(`unsupported value type ${t}`);\n};\n\nconst IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\nconst isIdentifier = (s: string): boolean => IDENT_RE.test(s);\n\nconst isForbiddenGeneratedImport = (line: string): boolean =>\n\t/\\bfrom\\s+[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bfrom\\s+[\"'][./][^\"']*\\/src\\//.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"'][./][^\"']*\\/src\\//.test(line);\n"],"mappings":"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"}
1
+ {"version":3,"file":"format.mjs","names":[],"sources":["../../../src/orchestrators/codegen/format.ts"],"sourcesContent":["// TypeScript source rendering for codegen-emitted files.\n//\n// Distilled-doc § \"Hand-rolled TS-object-literal rendering ... drifts\n// subtly between emitters; a small shared renderer would absorb the\n// variation and own the bigint policy in one place.\" This module IS\n// that shared renderer.\n//\n// Output shape (one emitted file):\n//\n// <generated-header>\n// <do-not-commit-banner if sensitive>\n// <imports?>\n// <one `export const <name> = <literal> as const;` per export>\n// <trailing newline>\n//\n// The renderer:\n// - sorts object keys (deterministic re-emit, distilled-doc\n// invariant \"Deterministic re-emit\"),\n// - quotes identifier-unsafe keys with double-quoted strings,\n// - serialises bigints as quoted decimal strings for\n// `BigInt(<string>)` consumers,\n// - refuses functions / symbols / undefined / circular refs with a\n// typed render error,\n// - emits arrays and records as readonly literal forms.\n//\n// The renderer does NOT format with prettier; it aims for\n// prettier-compatible spacing (two-space indent, trailing commas,\n// double-quoted strings, semicolons) so a prettier-on-write user\n// hook is a no-op on emitted bytes — that's load-bearing for the\n// \"no mtime touch on identical content\" idempotency invariant.\n\nimport { CodegenRenderError } from './errors.ts';\n\n// -----------------------------------------------------------------------------\n// Headers\n// -----------------------------------------------------------------------------\n\nconst GENERATED_HEADER = [\n\t'// THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'// Do not edit by hand — your changes will be overwritten on the next',\n\t'// `devstack up` cycle. Apps consume codegen output; codegen output never',\n\t'// imports from devstack.',\n].join('\\n');\n\nconst SENSITIVE_HEADER = [\n\t'// !!! DO NOT COMMIT THIS FILE !!!',\n\t'// This file carries sensitive material (wallet pair token, database',\n\t'// credentials, or user extras). The output directory ships a .gitignore',\n\t'// covering it; this banner is a belt-and-braces reminder.',\n].join('\\n');\n\n// -----------------------------------------------------------------------------\n// Public render entry\n// -----------------------------------------------------------------------------\n\nexport interface RenderInput {\n\treadonly emitterName: string;\n\treadonly outputPath: string;\n\treadonly sensitive: boolean;\n\t/** The declarations written by `Codegenable.emit(ctx)`. Each entry\n\t * becomes one `export const <key> = <literal> as const;`. */\n\treadonly exports: { readonly [key: string]: unknown };\n\t/** Optional import lines the emitter wants prepended (e.g. a\n\t * type import from `@mysten/dapp-kit` for the wallet config).\n\t * Each entry is a raw import statement string. */\n\treadonly imports?: ReadonlyArray<string>;\n}\n\n/** Result of a render attempt. Discriminated so callers can dispatch\n * on `ok` without resorting to `instanceof` checks (STYLE_GUIDE §2). */\nexport type RenderResult =\n\t| { readonly ok: true; readonly text: string }\n\t| { readonly ok: false; readonly error: CodegenRenderError };\n\nconst renderErr = (\n\tinput: RenderInput,\n\tdetail: string,\n): { readonly ok: false; readonly error: CodegenRenderError } => ({\n\tok: false,\n\terror: new CodegenRenderError({\n\t\temitterName: input.emitterName,\n\t\toutputPath: input.outputPath,\n\t\tdetail,\n\t}),\n});\n\n/** Render an emitted file to a TS source string. Returns a discriminated\n * `RenderResult` — `{ok: true, text}` on success, `{ok: false, error}`\n * when the value is unserialisable or imports forbidden paths. */\nexport const renderFile = (input: RenderInput): RenderResult => {\n\tconst lines: Array<string> = [];\n\tlines.push(GENERATED_HEADER);\n\tif (input.sensitive) {\n\t\tlines.push('');\n\t\tlines.push(SENSITIVE_HEADER);\n\t}\n\tlines.push('');\n\tif (input.imports && input.imports.length > 0) {\n\t\tfor (const imp of input.imports) {\n\t\t\tif (isForbiddenGeneratedImport(imp)) {\n\t\t\t\treturn renderErr(input, `generated files must not import devstack source: ${imp}`);\n\t\t\t}\n\t\t\tlines.push(imp);\n\t\t}\n\t\tlines.push('');\n\t}\n\t// Stable export order: keys lexicographically sorted.\n\tconst keys = Object.keys(input.exports).sort();\n\tfor (const key of keys) {\n\t\tconst value = input.exports[key];\n\t\tconst rendered = tryRender(value, new Set());\n\t\tif (!rendered.ok) {\n\t\t\treturn renderErr(input, `export '${key}': ${rendered.detail}`);\n\t\t}\n\t\tif (!isIdentifier(key)) {\n\t\t\treturn renderErr(input, `export key '${key}' is not a valid TS identifier`);\n\t\t}\n\t\tlines.push(`export const ${key} = ${rendered.text} as const;`);\n\t\tlines.push('');\n\t}\n\t// Single trailing newline; never two.\n\twhile (lines.length > 1 && lines[lines.length - 1] === '' && lines[lines.length - 2] === '') {\n\t\tlines.pop();\n\t}\n\treturn {\n\t\tok: true,\n\t\ttext: lines.join('\\n') + (lines[lines.length - 1] === '' ? '' : '\\n'),\n\t};\n};\n\n// -----------------------------------------------------------------------------\n// Value rendering\n// -----------------------------------------------------------------------------\n\nconst INDENT = '\\t';\n\ntype TryRenderResult =\n\t| { readonly ok: true; readonly text: string }\n\t| { readonly ok: false; readonly detail: string };\n\nconst tryOk = (text: string): TryRenderResult => ({ ok: true, text });\nconst tryErr = (detail: string): TryRenderResult => ({ ok: false, detail });\n\nconst tryRender = (value: unknown, seen: Set<object>, depth = 1): TryRenderResult => {\n\tif (value === null) return tryOk('null');\n\tif (value === undefined) return tryErr('undefined is not serialisable — emit null instead');\n\tconst t = typeof value;\n\tif (t === 'string') return tryOk(JSON.stringify(value));\n\tif (t === 'number') {\n\t\tif (!Number.isFinite(value as number)) return tryErr('non-finite number');\n\t\treturn tryOk(String(value));\n\t}\n\tif (t === 'boolean') return tryOk(String(value));\n\tif (t === 'bigint') return tryOk(JSON.stringify(value.toString()));\n\tif (t === 'function' || t === 'symbol') return tryErr(`${t} is not serialisable`);\n\tif (Array.isArray(value)) {\n\t\tif (seen.has(value)) return tryErr('circular reference');\n\t\tseen.add(value);\n\t\tif (value.length === 0) return tryOk('[]');\n\t\tconst inner: Array<string> = [];\n\t\tfor (const item of value) {\n\t\t\tconst r = tryRender(item, seen, depth + 1);\n\t\t\tif (!r.ok) return r;\n\t\t\tinner.push(INDENT.repeat(depth) + r.text);\n\t\t}\n\t\tseen.delete(value);\n\t\treturn tryOk(`[\\n${inner.join(',\\n')},\\n${INDENT.repeat(depth - 1)}]`);\n\t}\n\tif (t === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tif (seen.has(obj)) return tryErr('circular reference');\n\t\tseen.add(obj);\n\t\tconst keys = Object.keys(obj).sort();\n\t\tif (keys.length === 0) return tryOk('{}');\n\t\tconst lines: Array<string> = [];\n\t\tfor (const k of keys) {\n\t\t\tconst v = obj[k];\n\t\t\tif (v === undefined) continue; // drop undefined props (distilled-doc skip-emit-explicit)\n\t\t\tconst r = tryRender(v, seen, depth + 1);\n\t\t\tif (!r.ok) return r;\n\t\t\tconst keyText = isIdentifier(k) ? k : JSON.stringify(k);\n\t\t\tlines.push(`${INDENT.repeat(depth)}${keyText}: ${r.text}`);\n\t\t}\n\t\tseen.delete(obj);\n\t\tif (lines.length === 0) return tryOk('{}');\n\t\treturn tryOk(`{\\n${lines.join(',\\n')},\\n${INDENT.repeat(depth - 1)}}`);\n\t}\n\treturn tryErr(`unsupported value type ${t}`);\n};\n\nconst IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\nconst isIdentifier = (s: string): boolean => IDENT_RE.test(s);\n\nconst isForbiddenGeneratedImport = (line: string): boolean =>\n\t/\\bfrom\\s+[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"']@mysten-incubation\\/devstack(?:-rewrite)?(?:\\/|[\"'])/.test(line) ||\n\t/\\bfrom\\s+[\"'][./][^\"']*\\/src\\//.test(line) ||\n\t/\\bimport\\s*\\(\\s*[\"'][./][^\"']*\\/src\\//.test(line);\n"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  import { CodegenWriteFailed } from "./errors.mjs";
2
2
  import { emitOne } from "./emit.mjs";
3
+ import "./permissions.mjs";
3
4
  import { Effect, FileSystem } from "effect";
4
5
  //#region src/orchestrators/codegen/gitignore.ts
5
6
  const USER_BLOCK_START = "# user: customisations below preserved across re-emits";
@@ -46,7 +47,8 @@ const writeGitignore = (input) => Effect.gen(function* () {
46
47
  yield* emitOne({
47
48
  path: input.path,
48
49
  content,
49
- mode: 420
50
+ mode: 420,
51
+ parentMode: input.parentMode ?? 493
50
52
  }).pipe(Effect.mapError((e) => new CodegenWriteFailed({
51
53
  outputPath: input.path,
52
54
  stage: "gitignore",
@@ -1 +1 @@
1
- {"version":3,"file":"gitignore.mjs","names":[],"sources":["../../../src/orchestrators/codegen/gitignore.ts"],"sourcesContent":["// .gitignore emission for the codegen output directory.\n//\n// Distilled-doc §\"Boundary helpers\": \"A `.gitignore` inside the\n// output directory, covering sensitive emitted files by default and\n// preserving user customizations.\" Two design points:\n//\n// 1. The entire output directory is engine-managed and the\n// pragmatic default is \"ignore everything emitted here\". The\n// `*` line lives at the top of the file with a comment\n// explaining the policy.\n// 2. Sensitive files get an explicit second mention so the\n// `.gitignore` reads as documentation in addition to enforcing\n// the policy.\n// 3. User customisations land in a tracked `# user:` block — any\n// content the user adds between the `# user:` and `# /user:`\n// markers is preserved verbatim across re-emits.\n//\n// The `.gitignore` is emitted with the same per-file atomic writer as\n// the rest of the codegen tree.\n\nimport { Effect, FileSystem } from 'effect';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenWriteFailed } from './errors.ts';\nimport { NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\nconst USER_BLOCK_START = '# user: customisations below preserved across re-emits';\nconst USER_BLOCK_END = '# /user: do not edit below this line';\n\nconst DEFAULT_USER_BLOCK = `${USER_BLOCK_START}\\n${USER_BLOCK_END}`;\n\nconst HEADER = [\n\t'# THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'# The codegen output directory is engine-managed; the whole tree is',\n\t'# ignored from git by default. Sensitive files have an explicit mention',\n\t'# below for documentation. Add user customisations inside the `# user:`',\n\t'# block; the rest is rewritten on every emit cycle.',\n].join('\\n');\n\nexport interface GitignoreInput {\n\treadonly path: string;\n\t/** Relative paths inside the output dir that are sensitive — get\n\t * an explicit gitignore line. Sorted lexicographically. */\n\treadonly sensitivePaths: ReadonlyArray<string>;\n}\n\n/**\n * Compose the gitignore content, preserving any user customisations\n * between the `# user:` markers in any existing file at `path`.\n */\nexport const composeGitignore = (existing: string | null, input: GitignoreInput): string => {\n\tconst userBlock = existing !== null ? extractUserBlock(existing) : null;\n\tconst sortedSensitive = [...input.sensitivePaths].sort();\n\tconst lines: Array<string> = [];\n\tlines.push(HEADER);\n\tlines.push('');\n\tlines.push('# default policy: ignore the whole output directory.');\n\tlines.push('*');\n\tlines.push('# but keep this .gitignore tracked so cloners get the policy.');\n\tlines.push('!.gitignore');\n\tif (sortedSensitive.length > 0) {\n\t\tlines.push('');\n\t\tlines.push('# sensitive files — never commit even if you override the `*` above.');\n\t\tfor (const p of sortedSensitive) lines.push(p);\n\t}\n\tlines.push('');\n\tlines.push(userBlock !== null ? userBlock : DEFAULT_USER_BLOCK);\n\treturn lines.join('\\n') + '\\n';\n};\n\n/**\n * Write the gitignore. Idempotent via `emitOne`'s no-touch path.\n */\nexport const writeGitignore = (\n\tinput: GitignoreInput,\n): Effect.Effect<void, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst existing = yield* fs.readFileString(input.path).pipe(\n\t\t\tEffect.match({\n\t\t\t\tonSuccess: (text) => text,\n\t\t\t\tonFailure: () => null,\n\t\t\t}),\n\t\t);\n\t\tconst content = composeGitignore(existing, input);\n\t\tyield* emitOne({\n\t\t\tpath: input.path,\n\t\t\tcontent,\n\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t}).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(e) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: input.path,\n\t\t\t\t\t\tstage: 'gitignore',\n\t\t\t\t\t\tcause: e,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('codegen.writeGitignore', {\n\t\t\tattributes: { 'codegen.path': input.path },\n\t\t}),\n\t);\n\nconst extractUserBlock = (text: string): string | null => {\n\tconst startIdx = text.indexOf(USER_BLOCK_START);\n\tconst endIdx = text.indexOf(USER_BLOCK_END);\n\tif (startIdx === -1 || endIdx === -1 || endIdx < startIdx) return null;\n\t// Include both markers in the returned block.\n\tconst endLineEnd = text.indexOf('\\n', endIdx);\n\tconst stop = endLineEnd === -1 ? text.length : endLineEnd;\n\treturn text.slice(startIdx, stop);\n};\n"],"mappings":";;;;AA0BA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AAEvB,MAAM,qBAAqB,GAAG,iBAAiB,IAAI;AAEnD,MAAM,SAAS;CACd;CACA;CACA;CACA;CACA;CACA,CAAC,KAAK,KAAK;;;;;AAaZ,MAAa,oBAAoB,UAAyB,UAAkC;CAC3F,MAAM,YAAY,aAAa,OAAO,iBAAiB,SAAS,GAAG;CACnE,MAAM,kBAAkB,CAAC,GAAG,MAAM,eAAe,CAAC,MAAM;CACxD,MAAM,QAAuB,EAAE;AAC/B,OAAM,KAAK,OAAO;AAClB,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,uDAAuD;AAClE,OAAM,KAAK,IAAI;AACf,OAAM,KAAK,gEAAgE;AAC3E,OAAM,KAAK,cAAc;AACzB,KAAI,gBAAgB,SAAS,GAAG;AAC/B,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,uEAAuE;AAClF,OAAK,MAAM,KAAK,gBAAiB,OAAM,KAAK,EAAE;;AAE/C,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,cAAc,OAAO,YAAY,mBAAmB;AAC/D,QAAO,MAAM,KAAK,KAAK,GAAG;;;;;AAM3B,MAAa,kBACZ,UAEA,OAAO,IAAI,aAAa;CAQvB,MAAM,UAAU,iBAAiB,QANT,OADN,WAAW,YACF,eAAe,MAAM,KAAK,CAAC,KACrD,OAAO,MAAM;EACZ,YAAY,SAAS;EACrB,iBAAiB;EACjB,CAAC,CACF,EAC0C,MAAM;AACjD,QAAO,QAAQ;EACd,MAAM,MAAM;EACZ;EACA,MAAA;EACA,CAAC,CAAC,KACF,OAAO,UACL,MACA,IAAI,mBAAmB;EACtB,YAAY,MAAM;EAClB,OAAO;EACP,OAAO;EACP,CAAC,CACH,CACD;EACA,CAAC,KACF,OAAO,SAAS,0BAA0B,EACzC,YAAY,EAAE,gBAAgB,MAAM,MAAM,EAC1C,CAAC,CACF;AAEF,MAAM,oBAAoB,SAAgC;CACzD,MAAM,WAAW,KAAK,QAAQ,iBAAiB;CAC/C,MAAM,SAAS,KAAK,QAAQ,eAAe;AAC3C,KAAI,aAAa,MAAM,WAAW,MAAM,SAAS,SAAU,QAAO;CAElE,MAAM,aAAa,KAAK,QAAQ,MAAM,OAAO;CAC7C,MAAM,OAAO,eAAe,KAAK,KAAK,SAAS;AAC/C,QAAO,KAAK,MAAM,UAAU,KAAK"}
1
+ {"version":3,"file":"gitignore.mjs","names":[],"sources":["../../../src/orchestrators/codegen/gitignore.ts"],"sourcesContent":["// .gitignore emission for the codegen output directory.\n//\n// Distilled-doc §\"Boundary helpers\": \"A `.gitignore` inside the\n// output directory, covering sensitive emitted files by default and\n// preserving user customizations.\" Two design points:\n//\n// 1. The entire output directory is engine-managed and the\n// pragmatic default is \"ignore everything emitted here\". The\n// `*` line lives at the top of the file with a comment\n// explaining the policy.\n// 2. Sensitive files get an explicit second mention so the\n// `.gitignore` reads as documentation in addition to enforcing\n// the policy.\n// 3. User customisations land in a tracked `# user:` block — any\n// content the user adds between the `# user:` and `# /user:`\n// markers is preserved verbatim across re-emits.\n//\n// The `.gitignore` is emitted with the same per-file atomic writer as\n// the rest of the codegen tree.\n\nimport { Effect, FileSystem } from 'effect';\n\nimport { emitOne } from './emit.ts';\nimport { CodegenWriteFailed } from './errors.ts';\nimport { NON_SENSITIVE_DIR_MODE, NON_SENSITIVE_FILE_MODE } from './permissions.ts';\n\nconst USER_BLOCK_START = '# user: customisations below preserved across re-emits';\nconst USER_BLOCK_END = '# /user: do not edit below this line';\n\nconst DEFAULT_USER_BLOCK = `${USER_BLOCK_START}\\n${USER_BLOCK_END}`;\n\nconst HEADER = [\n\t'# THIS FILE IS AUTO-GENERATED BY @mysten/devstack.',\n\t'# The codegen output directory is engine-managed; the whole tree is',\n\t'# ignored from git by default. Sensitive files have an explicit mention',\n\t'# below for documentation. Add user customisations inside the `# user:`',\n\t'# block; the rest is rewritten on every emit cycle.',\n].join('\\n');\n\nexport interface GitignoreInput {\n\treadonly path: string;\n\treadonly parentMode?: number;\n\t/** Relative paths inside the output dir that are sensitive — get\n\t * an explicit gitignore line. Sorted lexicographically. */\n\treadonly sensitivePaths: ReadonlyArray<string>;\n}\n\n/**\n * Compose the gitignore content, preserving any user customisations\n * between the `# user:` markers in any existing file at `path`.\n */\nexport const composeGitignore = (existing: string | null, input: GitignoreInput): string => {\n\tconst userBlock = existing !== null ? extractUserBlock(existing) : null;\n\tconst sortedSensitive = [...input.sensitivePaths].sort();\n\tconst lines: Array<string> = [];\n\tlines.push(HEADER);\n\tlines.push('');\n\tlines.push('# default policy: ignore the whole output directory.');\n\tlines.push('*');\n\tlines.push('# but keep this .gitignore tracked so cloners get the policy.');\n\tlines.push('!.gitignore');\n\tif (sortedSensitive.length > 0) {\n\t\tlines.push('');\n\t\tlines.push('# sensitive files — never commit even if you override the `*` above.');\n\t\tfor (const p of sortedSensitive) lines.push(p);\n\t}\n\tlines.push('');\n\tlines.push(userBlock !== null ? userBlock : DEFAULT_USER_BLOCK);\n\treturn lines.join('\\n') + '\\n';\n};\n\n/**\n * Write the gitignore. Idempotent via `emitOne`'s no-touch path.\n */\nexport const writeGitignore = (\n\tinput: GitignoreInput,\n): Effect.Effect<void, CodegenWriteFailed, FileSystem.FileSystem> =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst existing = yield* fs.readFileString(input.path).pipe(\n\t\t\tEffect.match({\n\t\t\t\tonSuccess: (text) => text,\n\t\t\t\tonFailure: () => null,\n\t\t\t}),\n\t\t);\n\t\tconst content = composeGitignore(existing, input);\n\t\tyield* emitOne({\n\t\t\tpath: input.path,\n\t\t\tcontent,\n\t\t\tmode: NON_SENSITIVE_FILE_MODE,\n\t\t\tparentMode: input.parentMode ?? NON_SENSITIVE_DIR_MODE,\n\t\t}).pipe(\n\t\t\tEffect.mapError(\n\t\t\t\t(e) =>\n\t\t\t\t\tnew CodegenWriteFailed({\n\t\t\t\t\t\toutputPath: input.path,\n\t\t\t\t\t\tstage: 'gitignore',\n\t\t\t\t\t\tcause: e,\n\t\t\t\t\t}),\n\t\t\t),\n\t\t);\n\t}).pipe(\n\t\tEffect.withSpan('codegen.writeGitignore', {\n\t\t\tattributes: { 'codegen.path': input.path },\n\t\t}),\n\t);\n\nconst extractUserBlock = (text: string): string | null => {\n\tconst startIdx = text.indexOf(USER_BLOCK_START);\n\tconst endIdx = text.indexOf(USER_BLOCK_END);\n\tif (startIdx === -1 || endIdx === -1 || endIdx < startIdx) return null;\n\t// Include both markers in the returned block.\n\tconst endLineEnd = text.indexOf('\\n', endIdx);\n\tconst stop = endLineEnd === -1 ? text.length : endLineEnd;\n\treturn text.slice(startIdx, stop);\n};\n"],"mappings":";;;;;AA0BA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AAEvB,MAAM,qBAAqB,GAAG,iBAAiB,IAAI;AAEnD,MAAM,SAAS;CACd;CACA;CACA;CACA;CACA;CACA,CAAC,KAAK,KAAK;;;;;AAcZ,MAAa,oBAAoB,UAAyB,UAAkC;CAC3F,MAAM,YAAY,aAAa,OAAO,iBAAiB,SAAS,GAAG;CACnE,MAAM,kBAAkB,CAAC,GAAG,MAAM,eAAe,CAAC,MAAM;CACxD,MAAM,QAAuB,EAAE;AAC/B,OAAM,KAAK,OAAO;AAClB,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,uDAAuD;AAClE,OAAM,KAAK,IAAI;AACf,OAAM,KAAK,gEAAgE;AAC3E,OAAM,KAAK,cAAc;AACzB,KAAI,gBAAgB,SAAS,GAAG;AAC/B,QAAM,KAAK,GAAG;AACd,QAAM,KAAK,uEAAuE;AAClF,OAAK,MAAM,KAAK,gBAAiB,OAAM,KAAK,EAAE;;AAE/C,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,cAAc,OAAO,YAAY,mBAAmB;AAC/D,QAAO,MAAM,KAAK,KAAK,GAAG;;;;;AAM3B,MAAa,kBACZ,UAEA,OAAO,IAAI,aAAa;CAQvB,MAAM,UAAU,iBAAiB,QANT,OADN,WAAW,YACF,eAAe,MAAM,KAAK,CAAC,KACrD,OAAO,MAAM;EACZ,YAAY,SAAS;EACrB,iBAAiB;EACjB,CAAC,CACF,EAC0C,MAAM;AACjD,QAAO,QAAQ;EACd,MAAM,MAAM;EACZ;EACA,MAAA;EACA,YAAY,MAAM,cAAA;EAClB,CAAC,CAAC,KACF,OAAO,UACL,MACA,IAAI,mBAAmB;EACtB,YAAY,MAAM;EAClB,OAAO;EACP,OAAO;EACP,CAAC,CACH,CACD;EACA,CAAC,KACF,OAAO,SAAS,0BAA0B,EACzC,YAAY,EAAE,gBAAgB,MAAM,MAAM,EAC1C,CAAC,CACF;AAEF,MAAM,oBAAoB,SAAgC;CACzD,MAAM,WAAW,KAAK,QAAQ,iBAAiB;CAC/C,MAAM,SAAS,KAAK,QAAQ,eAAe;AAC3C,KAAI,aAAa,MAAM,WAAW,MAAM,SAAS,SAAU,QAAO;CAElE,MAAM,aAAa,KAAK,QAAQ,MAAM,OAAO;CAC7C,MAAM,OAAO,eAAe,KAAK,KAAK,SAAS;AAC/C,QAAO,KAAK,MAAM,UAAU,KAAK"}
@@ -0,0 +1,41 @@
1
+ import { isAbsolute, resolve } from "node:path";
2
+ //#region src/orchestrators/codegen/output-location.ts
3
+ /** Default primary-stack output dir (relative to `appRoot`). */
4
+ const PRIMARY_OUTPUT_SUBPATH = "src/generated";
5
+ /** Resolve `<appRoot>/.devstack/stacks/<stack>/generated` for a
6
+ * secondary stack — sibling of that stack's manifest. */
7
+ const secondaryOutputDir = (appRoot, stack) => resolve(appRoot, ".devstack", "stacks", stack, "generated");
8
+ /**
9
+ * Resolve the codegen output location for a stack. See the module
10
+ * header for the rule. Pure — same inputs always yield the same
11
+ * absolute paths.
12
+ *
13
+ * Precedence:
14
+ * 1. Explicit `defineDevstack({ codegen.outputDir })` → honored
15
+ * verbatim (relative → resolved against `appRoot`). The explicit
16
+ * `stackSubdir` rides along.
17
+ * 2. Primary stack (`effectiveStack === primaryStack`, or no
18
+ * `primaryStack` declared) → `<appRoot>/src/generated`,
19
+ * `stackSubdir: null`.
20
+ * 3. Secondary stack → `<appRoot>/.devstack/stacks/<effectiveStack>/generated`,
21
+ * `stackSubdir: null`.
22
+ */
23
+ const resolveCodegenOutput = (input) => {
24
+ const { appRoot, effectiveStack, primaryStack } = input;
25
+ const explicitStackSubdir = input.explicitStackSubdir ?? null;
26
+ if (input.explicitOutputDir !== void 0) {
27
+ const target = input.explicitOutputDir;
28
+ return {
29
+ outputDir: isAbsolute(target) ? target : resolve(appRoot, target),
30
+ stackSubdir: explicitStackSubdir
31
+ };
32
+ }
33
+ return {
34
+ outputDir: effectiveStack === (primaryStack ?? effectiveStack) ? resolve(appRoot, PRIMARY_OUTPUT_SUBPATH) : secondaryOutputDir(appRoot, effectiveStack),
35
+ stackSubdir: null
36
+ };
37
+ };
38
+ //#endregion
39
+ export { resolveCodegenOutput };
40
+
41
+ //# sourceMappingURL=output-location.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-location.mjs","names":[],"sources":["../../../src/orchestrators/codegen/output-location.ts"],"sourcesContent":["// Per-stack codegen output-location resolver.\n//\n// notes/per-stack-codegen-design.md §\"Output-location rule\": two stacks\n// of the same app must not emit Move codegen into the SAME\n// `src/generated/` dir — the second stack's `codegen.emitted` would\n// clobber the first's package-id / wallet-pair-token literals and break\n// the already-running app. This pure function is the single decision\n// point: it maps (appRoot, effective stack, primary stack) → the output\n// dir codegen owns for THIS stack.\n//\n// - Primary stack (`effectiveStack === primaryStack`, no explicit\n// `--stack`/`$DEVSTACK_STACK` override) → `<appRoot>/src/generated`\n// (canonical, unchanged, committed-ignored).\n// - Secondary stack (`test`/`e2e`/`demo`/...) →\n// `<appRoot>/.devstack/stacks/<effectiveStack>/generated` — a\n// sibling of that stack's manifest at\n// `.devstack/stacks/<stack>/manifest.json`, already gitignored +\n// tsconfig-excluded.\n// - An app that sets `codegen.outputDir` / `codegen.stackSubdir`\n// explicitly (`defineDevstack({ codegen })`) keeps that behavior\n// verbatim (back-compat escape hatch); per-stack isolation is then\n// the app's responsibility.\n//\n// The decision is made ONCE here, at the boot seam where both the\n// primary and effective stack names are in scope, and the resolved\n// absolute `outputDir` is then recorded in the per-stack manifest\n// (`codegen.generatedDir`) so the reader (the Vite plugin) consults the\n// SAME location the writer chose — read and write are gated by one\n// decision, not two. Pure + unit-testable; no `process.env`, no I/O.\n\nimport { isAbsolute, resolve } from 'node:path';\n\nexport interface ResolveCodegenOutputInput {\n\t/** The user application root — codegen output is resolved against\n\t * it. */\n\treadonly appRoot: string;\n\t/** The stack the supervisor is actually running (the resolved\n\t * identity's stack: explicit `--stack`/`$DEVSTACK_STACK` >\n\t * `config.stackName` > inferred). */\n\treadonly effectiveStack: string;\n\t/** The config's declared `stackName` (`stack.options.stackName`) —\n\t * the primary stack. `undefined` when the config declares none —\n\t * then there is no override to diverge from, so the run is treated\n\t * as primary. */\n\treadonly primaryStack: string | undefined;\n\t/** Explicit `defineDevstack({ codegen: { outputDir } })` value, if\n\t * the app pinned one. Honored verbatim (back-compat) — relative\n\t * paths resolve against `appRoot`. */\n\treadonly explicitOutputDir?: string | undefined;\n\t/** Explicit `defineDevstack({ codegen: { stackSubdir } })` value, if\n\t * the app pinned one. Passed through unchanged. */\n\treadonly explicitStackSubdir?: string | null | undefined;\n}\n\nexport interface ResolvedCodegenOutput {\n\t/** Absolute path to the directory codegen owns and overwrites for\n\t * THIS stack. Recorded in the manifest as `codegen.generatedDir`. */\n\treadonly outputDir: string;\n\t/** Per-stack subdirectory under `outputDir`, threaded through to\n\t * `CodegenRoot.stackSubdir` unchanged. `null` for the\n\t * primary/secondary default rules (the `.devstack/stacks/<stack>`\n\t * location already isolates per stack, so no extra subdir is\n\t * needed); only an explicit `defineDevstack({ codegen.stackSubdir })`\n\t * populates it. */\n\treadonly stackSubdir: string | null;\n}\n\n/** Default primary-stack output dir (relative to `appRoot`). */\nconst PRIMARY_OUTPUT_SUBPATH = 'src/generated';\n\n/** Resolve `<appRoot>/.devstack/stacks/<stack>/generated` for a\n * secondary stack — sibling of that stack's manifest. */\nconst secondaryOutputDir = (appRoot: string, stack: string): string =>\n\tresolve(appRoot, '.devstack', 'stacks', stack, 'generated');\n\n/**\n * Resolve the codegen output location for a stack. See the module\n * header for the rule. Pure — same inputs always yield the same\n * absolute paths.\n *\n * Precedence:\n * 1. Explicit `defineDevstack({ codegen.outputDir })` → honored\n * verbatim (relative → resolved against `appRoot`). The explicit\n * `stackSubdir` rides along.\n * 2. Primary stack (`effectiveStack === primaryStack`, or no\n * `primaryStack` declared) → `<appRoot>/src/generated`,\n * `stackSubdir: null`.\n * 3. Secondary stack → `<appRoot>/.devstack/stacks/<effectiveStack>/generated`,\n * `stackSubdir: null`.\n */\nexport const resolveCodegenOutput = (input: ResolveCodegenOutputInput): ResolvedCodegenOutput => {\n\tconst { appRoot, effectiveStack, primaryStack } = input;\n\tconst explicitStackSubdir = input.explicitStackSubdir ?? null;\n\n\t// (1) Explicit override wins — back-compat escape hatch. Per-stack\n\t// isolation is the app's responsibility once it pins `outputDir`.\n\tif (input.explicitOutputDir !== undefined) {\n\t\tconst target = input.explicitOutputDir;\n\t\treturn {\n\t\t\toutputDir: isAbsolute(target) ? target : resolve(appRoot, target),\n\t\t\tstackSubdir: explicitStackSubdir,\n\t\t};\n\t}\n\n\t// `primaryStack === undefined` means the config declared no `stackName`,\n\t// so there is no config value for `effectiveStack` to diverge from —\n\t// the run is the primary run by definition (it falls through to the\n\t// inferred/default stack with no explicit override). Collapse it to\n\t// `effectiveStack` so the equality below reads `true`.\n\tconst isPrimary = effectiveStack === (primaryStack ?? effectiveStack);\n\n\t// (2) Primary → canonical `src/generated`. (3) Secondary → per-stack\n\t// `.devstack/stacks/<stack>/generated`. Neither uses `stackSubdir`\n\t// (the `.devstack` path already isolates per stack); an explicit\n\t// `stackSubdir` only rides the explicit-outputDir branch above.\n\treturn {\n\t\toutputDir: isPrimary\n\t\t\t? resolve(appRoot, PRIMARY_OUTPUT_SUBPATH)\n\t\t\t: secondaryOutputDir(appRoot, effectiveStack),\n\t\tstackSubdir: null,\n\t};\n};\n"],"mappings":";;;AAoEA,MAAM,yBAAyB;;;AAI/B,MAAM,sBAAsB,SAAiB,UAC5C,QAAQ,SAAS,aAAa,UAAU,OAAO,YAAY;;;;;;;;;;;;;;;;AAiB5D,MAAa,wBAAwB,UAA4D;CAChG,MAAM,EAAE,SAAS,gBAAgB,iBAAiB;CAClD,MAAM,sBAAsB,MAAM,uBAAuB;AAIzD,KAAI,MAAM,sBAAsB,KAAA,GAAW;EAC1C,MAAM,SAAS,MAAM;AACrB,SAAO;GACN,WAAW,WAAW,OAAO,GAAG,SAAS,QAAQ,SAAS,OAAO;GACjE,aAAa;GACb;;AAcF,QAAO;EACN,WAPiB,oBAAoB,gBAAgB,kBAQlD,QAAQ,SAAS,uBAAuB,GACxC,mBAAmB,SAAS,eAAe;EAC9C,aAAa;EACb"}
@@ -1 +1 @@
1
- import { Context, Layer, Path } from "effect";
1
+ import { Context, Effect, Layer, Path } from "effect";
@@ -1,9 +1,29 @@
1
+ import { CodegenPathConflict } from "./errors.mjs";
1
2
  import { Context, Effect, Layer, Path } from "effect";
2
3
  //#region src/orchestrators/codegen/paths.ts
3
- var CodegenRoot = class extends Context.Service()("@devstack-rewrite/orchestrator/CodegenRoot") {};
4
+ /** Guard plugin-authored `CodegenableDecl.outputPath` against `..`
5
+ * traversal and absolute paths. Fails with a typed
6
+ * `CodegenPathConflict({kind:'non-relative'})` — defense-in-depth
7
+ * for the file-layout invariants. Called once inside `buildAt` so
8
+ * both the root bundle and any `withRoot`-rebased view enforce the
9
+ * same `..`-rejecting `resolve` discipline.
10
+ *
11
+ * POSIX-only: devstack runs on POSIX filesystems (substrate paths
12
+ * are POSIX-shaped throughout), so this check intentionally inspects
13
+ * only `/`-rooted absolutes and the `..` substring. A Windows-style
14
+ * `'foo/bar\\..\\baz'` would slip past — that's accepted because
15
+ * devstack never executes on a Windows runtime.
16
+ *
17
+ * STYLE_GUIDE §2 rule 5 — orchestrator failures are typed. */
18
+ const assertRelativeCodegenOutputPath = (outputPath) => outputPath.includes("..") || outputPath.startsWith("/") ? Effect.fail(new CodegenPathConflict({
19
+ kind: "non-relative",
20
+ outputPath,
21
+ emitters: []
22
+ })) : Effect.void;
23
+ var CodegenRoot = class extends Context.Service()("@devstack/orchestrator/CodegenRoot") {};
4
24
  /** Build a `CodegenRoot` layer pinned to a literal path. */
5
25
  const layerCodegenRoot = (root) => Layer.succeed(CodegenRoot)(root);
6
- var CodegenPathsService = class extends Context.Service()("@devstack-rewrite/orchestrator/CodegenPaths") {};
26
+ var CodegenPathsService = class extends Context.Service()("@devstack/orchestrator/CodegenPaths") {};
7
27
  /**
8
28
  * Materialize the resolver from `CodegenRoot` + Effect's `Path`
9
29
  * service. Stack subdir, if present, is appended:
@@ -13,19 +33,25 @@ const layerCodegenPaths = Layer.effect(CodegenPathsService, Effect.gen(function*
13
33
  const root = yield* CodegenRoot;
14
34
  const path = yield* Path.Path;
15
35
  const outputDir = root.stackSubdir ? path.join(root.outputDir, root.stackSubdir) : root.outputDir;
16
- const bindingsDir = path.join(outputDir, "bindings");
17
- const resolve = (outputPath) => {
18
- if (outputPath.includes("..") || outputPath.startsWith("/")) throw new Error(`codegen.outputPath must be a relative path without '..'; got '${outputPath}'`);
19
- return path.join(outputDir, outputPath);
36
+ const codegenLockFile = `${outputDir}.codegen.lock`;
37
+ const buildAt = (atRoot) => {
38
+ const bindingsDir = path.join(atRoot, "bindings");
39
+ const resolve = (outputPath) => Effect.gen(function* () {
40
+ yield* assertRelativeCodegenOutputPath(outputPath);
41
+ return path.join(atRoot, outputPath);
42
+ });
43
+ const resolveBindingsPackage = (packageName) => path.join(bindingsDir, packageName);
44
+ return {
45
+ outputDir: atRoot,
46
+ gitignoreFile: path.join(atRoot, ".gitignore"),
47
+ bindingsDir,
48
+ codegenLockFile,
49
+ resolve,
50
+ resolveBindingsPackage,
51
+ withRoot: (newRoot) => buildAt(newRoot)
52
+ };
20
53
  };
21
- const resolveBindingsPackage = (packageName) => path.join(bindingsDir, packageName);
22
- return CodegenPathsService.of({
23
- outputDir,
24
- gitignoreFile: path.join(outputDir, ".gitignore"),
25
- bindingsDir,
26
- resolve,
27
- resolveBindingsPackage
28
- });
54
+ return CodegenPathsService.of(buildAt(outputDir));
29
55
  }));
30
56
  //#endregion
31
57
  export { CodegenPathsService, layerCodegenPaths, layerCodegenRoot };
@@ -1 +1 @@
1
- {"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/orchestrators/codegen/paths.ts"],"sourcesContent":["// Codegen output-path layout.\n//\n// Distilled-doc § \"All outputs land under a single user-chosen\n// directory (default `./src/generated/`)\" + §\"Stable output paths\".\n// One file owns the layout so emitters never assemble paths by hand.\n//\n// Default root is `<appRoot>/src/generated/`. Tests and parallel\n// stacks pin a per-test root; the substrate's `RuntimeRoot` is for\n// engine-private state (~/.devstack/...), NOT for codegen output.\n// Codegen output lives in the USER's source tree.\n\nimport { Context, Effect, Layer, Path } from 'effect';\n\n/**\n * Codegen output root — the directory codegen owns and overwrites.\n * Pinned at boot time from the user's `defineDevstack` options\n * (default `./src/generated/` resolved against the app's cwd).\n *\n * Held as a service so emitters can yield it without a function\n * argument; mirrors the substrate's `RuntimeRoot` pattern.\n */\nexport interface CodegenRootShape {\n\t/** Absolute path to the output directory. The orchestrator\n\t * manages it; the user never writes here. */\n\treadonly outputDir: string;\n\t/** Optional per-stack subdirectory under `outputDir`. When set,\n\t * parallel stacks emit into sibling directories under the same\n\t * output root (distilled-doc §\"per-stack subdirectory\"). */\n\treadonly stackSubdir: string | null;\n}\n\nexport class CodegenRoot extends Context.Service<CodegenRoot, CodegenRootShape>()(\n\t'@devstack-rewrite/orchestrator/CodegenRoot',\n) {}\n\n/** Build a `CodegenRoot` layer pinned to a literal path. */\nexport const layerCodegenRoot = (root: CodegenRootShape): Layer.Layer<CodegenRoot> =>\n\tLayer.succeed(CodegenRoot)(root);\n\n/** Closed bundle the resolver returns. Mirrors substrate `StackPaths`. */\nexport interface CodegenPaths {\n\t/** The directory the orchestrator emits into (after applying\n\t * per-stack subdirectory if configured). The watcher MUST\n\t * exclude this directory. */\n\treadonly outputDir: string;\n\t/** Path to the `.gitignore` inside `outputDir`. Written every\n\t * emit (the dir is gitignored). */\n\treadonly gitignoreFile: string;\n\t/** Subtree where Move-to-TS bindings land. */\n\treadonly bindingsDir: string;\n\t/** Helper: resolve an emitter's `outputPath` (e.g. `sui/network.ts`)\n\t * against the output root. */\n\treadonly resolve: (outputPath: string) => string;\n\t/** Helper: resolve a per-package bindings subtree path. */\n\treadonly resolveBindingsPackage: (packageName: string) => string;\n}\n\nexport class CodegenPathsService extends Context.Service<CodegenPathsService, CodegenPaths>()(\n\t'@devstack-rewrite/orchestrator/CodegenPaths',\n) {}\n\n/**\n * Materialize the resolver from `CodegenRoot` + Effect's `Path`\n * service. Stack subdir, if present, is appended:\n * `<outputDir>` or `<outputDir>/<stackSubdir>`.\n */\nexport const layerCodegenPaths: Layer.Layer<CodegenPathsService, never, CodegenRoot | Path.Path> =\n\tLayer.effect(\n\t\tCodegenPathsService,\n\t\tEffect.gen(function* () {\n\t\t\tconst root = yield* CodegenRoot;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst outputDir = root.stackSubdir\n\t\t\t\t? path.join(root.outputDir, root.stackSubdir)\n\t\t\t\t: root.outputDir;\n\t\t\tconst bindingsDir = path.join(outputDir, 'bindings');\n\t\t\tconst resolve = (outputPath: string): string => {\n\t\t\t\t// Defense-in-depth: refuse `..` traversal so an emitter\n\t\t\t\t// can't write outside its declared output dir. The\n\t\t\t\t// declared `CodegenableDecl.outputPath` is plugin-authored\n\t\t\t\t// and trusted but the check costs nothing.\n\t\t\t\tif (outputPath.includes('..') || outputPath.startsWith('/')) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`codegen.outputPath must be a relative path without '..'; got '${outputPath}'`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn path.join(outputDir, outputPath);\n\t\t\t};\n\t\t\tconst resolveBindingsPackage = (packageName: string): string =>\n\t\t\t\tpath.join(bindingsDir, packageName);\n\t\t\treturn CodegenPathsService.of({\n\t\t\t\toutputDir,\n\t\t\t\tgitignoreFile: path.join(outputDir, '.gitignore'),\n\t\t\t\tbindingsDir,\n\t\t\t\tresolve,\n\t\t\t\tresolveBindingsPackage,\n\t\t\t});\n\t\t}),\n\t);\n"],"mappings":";;AA+BA,IAAa,cAAb,cAAiC,QAAQ,SAAwC,CAChF,6CACA,CAAC;;AAGF,MAAa,oBAAoB,SAChC,MAAM,QAAQ,YAAY,CAAC,KAAK;AAoBjC,IAAa,sBAAb,cAAyC,QAAQ,SAA4C,CAC5F,8CACA,CAAC;;;;;;AAOF,MAAa,oBACZ,MAAM,OACL,qBACA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;CACpB,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,YAAY,KAAK,cACpB,KAAK,KAAK,KAAK,WAAW,KAAK,YAAY,GAC3C,KAAK;CACR,MAAM,cAAc,KAAK,KAAK,WAAW,WAAW;CACpD,MAAM,WAAW,eAA+B;AAK/C,MAAI,WAAW,SAAS,KAAK,IAAI,WAAW,WAAW,IAAI,CAC1D,OAAM,IAAI,MACT,iEAAiE,WAAW,GAC5E;AAEF,SAAO,KAAK,KAAK,WAAW,WAAW;;CAExC,MAAM,0BAA0B,gBAC/B,KAAK,KAAK,aAAa,YAAY;AACpC,QAAO,oBAAoB,GAAG;EAC7B;EACA,eAAe,KAAK,KAAK,WAAW,aAAa;EACjD;EACA;EACA;EACA,CAAC;EACD,CACF"}
1
+ {"version":3,"file":"paths.mjs","names":[],"sources":["../../../src/orchestrators/codegen/paths.ts"],"sourcesContent":["// Codegen output-path layout.\n//\n// Distilled-doc § \"All outputs land under a single user-chosen\n// directory (default `./src/generated/`)\" + §\"Stable output paths\".\n// One file owns the layout so emitters never assemble paths by hand.\n//\n// Default root is `<appRoot>/src/generated/`. Tests and parallel\n// stacks pin a per-test root; the substrate's `RuntimeRoot` is for\n// engine-private state (~/.devstack/...), NOT for codegen output.\n// Codegen output lives in the USER's source tree.\n\nimport { Context, Effect, Layer, Path } from 'effect';\n\nimport { CodegenPathConflict } from './errors.ts';\n\n/** Guard plugin-authored `CodegenableDecl.outputPath` against `..`\n * traversal and absolute paths. Fails with a typed\n * `CodegenPathConflict({kind:'non-relative'})` — defense-in-depth\n * for the file-layout invariants. Called once inside `buildAt` so\n * both the root bundle and any `withRoot`-rebased view enforce the\n * same `..`-rejecting `resolve` discipline.\n *\n * POSIX-only: devstack runs on POSIX filesystems (substrate paths\n * are POSIX-shaped throughout), so this check intentionally inspects\n * only `/`-rooted absolutes and the `..` substring. A Windows-style\n * `'foo/bar\\\\..\\\\baz'` would slip past — that's accepted because\n * devstack never executes on a Windows runtime.\n *\n * STYLE_GUIDE §2 rule 5 — orchestrator failures are typed. */\nexport const assertRelativeCodegenOutputPath = (\n\toutputPath: string,\n): Effect.Effect<void, CodegenPathConflict> =>\n\toutputPath.includes('..') || outputPath.startsWith('/')\n\t\t? Effect.fail(\n\t\t\t\tnew CodegenPathConflict({\n\t\t\t\t\tkind: 'non-relative',\n\t\t\t\t\toutputPath,\n\t\t\t\t\temitters: [],\n\t\t\t\t}),\n\t\t\t)\n\t\t: Effect.void;\n\n/**\n * Codegen output root — the directory codegen owns and overwrites.\n * Pinned at boot time from the user's `defineDevstack` options\n * (default `./src/generated/` resolved against the app's cwd).\n *\n * Held as a service so emitters can yield it without a function\n * argument; mirrors the substrate's `RuntimeRoot` pattern.\n */\nexport interface CodegenRootShape {\n\t/** Absolute path to the output directory. The orchestrator\n\t * manages it; the user never writes here. */\n\treadonly outputDir: string;\n\t/** Optional per-stack subdirectory under `outputDir`. When set,\n\t * parallel stacks emit into sibling directories under the same\n\t * output root (distilled-doc §\"per-stack subdirectory\"). */\n\treadonly stackSubdir: string | null;\n}\n\nexport class CodegenRoot extends Context.Service<CodegenRoot, CodegenRootShape>()(\n\t'@devstack/orchestrator/CodegenRoot',\n) {}\n\n/** Build a `CodegenRoot` layer pinned to a literal path. */\nexport const layerCodegenRoot = (root: CodegenRootShape): Layer.Layer<CodegenRoot> =>\n\tLayer.succeed(CodegenRoot)(root);\n\n/** Closed bundle the resolver returns. Mirrors substrate `StackPaths`. */\nexport interface CodegenPaths {\n\t/** The directory the orchestrator emits into (after applying\n\t * per-stack subdirectory if configured). The watcher MUST\n\t * exclude this directory. */\n\treadonly outputDir: string;\n\t/** Path to the `.gitignore` inside `outputDir`. Written every\n\t * emit (the dir is gitignored). */\n\treadonly gitignoreFile: string;\n\t/** Subtree where Move-to-TS bindings land. */\n\treadonly bindingsDir: string;\n\t/** Per-process lock file gating `runEmitCycle`. Sibling to\n\t * `outputDir` so concurrent invocations (e.g. CLI direct-callers\n\t * racing the supervisor) serialize cleanly without blocking the\n\t * short-section substrate `stack.lock`. Codegen cycles can be\n\t * file-system heavy (multi-emitter, Move-bindings compilation);\n\t * the substrate lock is reserved for short sections per the\n\t * cross-process safety protocol. */\n\treadonly codegenLockFile: string;\n\t/** Helper: resolve an emitter's `outputPath` (e.g. `sui/network.ts`)\n\t * against the output root. Fails with `CodegenPathConflict({kind:\n\t * 'non-relative'})` if the supplied path escapes the root. */\n\treadonly resolve: (outputPath: string) => Effect.Effect<string, CodegenPathConflict>;\n\t/** Helper: resolve a per-package bindings subtree path. */\n\treadonly resolveBindingsPackage: (packageName: string) => string;\n\t/** Data-driven rebase: re-root the entire bundle at `newRoot`.\n\t * Preserves the layout (bindings under `<root>/bindings`, gitignore\n\t * at `<root>/.gitignore`) and the `..`-rejecting `resolve`\n\t * discipline; only the prefix changes. Used by the stage-and-swap\n\t * build to redirect the emit pipeline at the staging directory\n\t * WITHOUT string-surgery in the caller.\n\t *\n\t * Note: `codegenLockFile` is preserved verbatim — the lock is\n\t * acquired ONCE outside the staging build, so the rebased view\n\t * must still name the real lock path. */\n\treadonly withRoot: (newRoot: string) => CodegenPaths;\n}\n\nexport class CodegenPathsService extends Context.Service<CodegenPathsService, CodegenPaths>()(\n\t'@devstack/orchestrator/CodegenPaths',\n) {}\n\n/**\n * Materialize the resolver from `CodegenRoot` + Effect's `Path`\n * service. Stack subdir, if present, is appended:\n * `<outputDir>` or `<outputDir>/<stackSubdir>`.\n */\nexport const layerCodegenPaths: Layer.Layer<CodegenPathsService, never, CodegenRoot | Path.Path> =\n\tLayer.effect(\n\t\tCodegenPathsService,\n\t\tEffect.gen(function* () {\n\t\t\tconst root = yield* CodegenRoot;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst outputDir = root.stackSubdir\n\t\t\t\t? path.join(root.outputDir, root.stackSubdir)\n\t\t\t\t: root.outputDir;\n\t\t\t// Sibling of `outputDir` (NOT inside it) so the stage-and-swap\n\t\t\t// rename never sees the lock file as part of the output tree.\n\t\t\t// Captured once at boot `withRoot` re-roots the rest of the\n\t\t\t// bundle but preserves the original lock path so the rebased\n\t\t\t// view names the real cross-process lock (the lock is acquired\n\t\t\t// ONCE outside the staging build).\n\t\t\tconst codegenLockFile = `${outputDir}.codegen.lock`;\n\t\t\tconst buildAt = (atRoot: string): CodegenPaths => {\n\t\t\t\tconst bindingsDir = path.join(atRoot, 'bindings');\n\t\t\t\tconst resolve = (outputPath: string): Effect.Effect<string, CodegenPathConflict> =>\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tyield* assertRelativeCodegenOutputPath(outputPath);\n\t\t\t\t\t\treturn path.join(atRoot, outputPath);\n\t\t\t\t\t});\n\t\t\t\tconst resolveBindingsPackage = (packageName: string): string =>\n\t\t\t\t\tpath.join(bindingsDir, packageName);\n\t\t\t\tconst bundle: CodegenPaths = {\n\t\t\t\t\toutputDir: atRoot,\n\t\t\t\t\tgitignoreFile: path.join(atRoot, '.gitignore'),\n\t\t\t\t\tbindingsDir,\n\t\t\t\t\tcodegenLockFile,\n\t\t\t\t\tresolve,\n\t\t\t\t\tresolveBindingsPackage,\n\t\t\t\t\twithRoot: (newRoot: string) => buildAt(newRoot),\n\t\t\t\t};\n\t\t\t\treturn bundle;\n\t\t\t};\n\t\t\treturn CodegenPathsService.of(buildAt(outputDir));\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,mCACZ,eAEA,WAAW,SAAS,KAAK,IAAI,WAAW,WAAW,IAAI,GACpD,OAAO,KACP,IAAI,oBAAoB;CACvB,MAAM;CACN;CACA,UAAU,EAAE;CACZ,CAAC,CACF,GACA,OAAO;AAoBX,IAAa,cAAb,cAAiC,QAAQ,SAAwC,CAChF,qCACA,CAAC;;AAGF,MAAa,oBAAoB,SAChC,MAAM,QAAQ,YAAY,CAAC,KAAK;AAwCjC,IAAa,sBAAb,cAAyC,QAAQ,SAA4C,CAC5F,sCACA,CAAC;;;;;;AAOF,MAAa,oBACZ,MAAM,OACL,qBACA,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAO;CACpB,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,YAAY,KAAK,cACpB,KAAK,KAAK,KAAK,WAAW,KAAK,YAAY,GAC3C,KAAK;CAOR,MAAM,kBAAkB,GAAG,UAAU;CACrC,MAAM,WAAW,WAAiC;EACjD,MAAM,cAAc,KAAK,KAAK,QAAQ,WAAW;EACjD,MAAM,WAAW,eAChB,OAAO,IAAI,aAAa;AACvB,UAAO,gCAAgC,WAAW;AAClD,UAAO,KAAK,KAAK,QAAQ,WAAW;IACnC;EACH,MAAM,0BAA0B,gBAC/B,KAAK,KAAK,aAAa,YAAY;AAUpC,SAAO;GARN,WAAW;GACX,eAAe,KAAK,KAAK,QAAQ,aAAa;GAC9C;GACA;GACA;GACA;GACA,WAAW,YAAoB,QAAQ,QAAQ;GAEnC;;AAEd,QAAO,oBAAoB,GAAG,QAAQ,UAAU,CAAC;EAChD,CACF"}
@@ -1,6 +1,8 @@
1
1
  /** File mode for one codegen contribution. */
2
2
  const modeFor = (decl) => decl.sensitive === true ? 384 : 420;
3
+ /** Parent-directory mode given a set of contributions inside it. */
4
+ const dirModeFor = (decls) => decls.some((d) => d.sensitive === true) ? 448 : 493;
3
5
  //#endregion
4
- export { modeFor };
6
+ export { dirModeFor, modeFor };
5
7
 
6
8
  //# sourceMappingURL=permissions.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"permissions.mjs","names":[],"sources":["../../../src/orchestrators/codegen/permissions.ts"],"sourcesContent":["// Permission policy for codegen-emitted files.\n//\n// Distilled-doc § \"Sensitive emitted files have restrictive\n// filesystem permissions, re-applied on every emit (not just on\n// create) to recover from manual chmods\". The orchestrator hands the\n// emit/swap layer the mode it should apply.\n//\n// Two-axis policy:\n// - `sensitive: true` → 0o600 (rw user only).\n// - `sensitive: false` → 0o644 (rw user, r world).\n// The parent directory the emit lives in inherits the strictest\n// sensitivity of any file inside it — 0o700 when any file is\n// sensitive, 0o755 otherwise. The orchestrator applies parent mode\n// at swap time, separate from per-file modes.\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nexport const SENSITIVE_FILE_MODE = 0o600;\nexport const NON_SENSITIVE_FILE_MODE = 0o644;\nexport const SENSITIVE_DIR_MODE = 0o700;\nexport const NON_SENSITIVE_DIR_MODE = 0o755;\n\n/** File mode for one codegen contribution. */\nexport const modeFor = (decl: Pick<CodegenableDecl, 'sensitive'>): number =>\n\tdecl.sensitive === true ? SENSITIVE_FILE_MODE : NON_SENSITIVE_FILE_MODE;\n\n/** Parent-directory mode given a set of contributions inside it. */\nexport const dirModeFor = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): number =>\n\tdecls.some((d) => d.sensitive === true) ? SENSITIVE_DIR_MODE : NON_SENSITIVE_DIR_MODE;\n\n/** True if ANY contribution in the set is sensitive — gates the\n * `.gitignore` \"cover by default\" rule and the parent-mode policy. */\nexport const anySensitive = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): boolean =>\n\tdecls.some((d) => d.sensitive === true);\n"],"mappings":";AAuBA,MAAa,WAAW,SACvB,KAAK,cAAc,OAAA,MAAA"}
1
+ {"version":3,"file":"permissions.mjs","names":[],"sources":["../../../src/orchestrators/codegen/permissions.ts"],"sourcesContent":["// Permission policy for codegen-emitted files.\n//\n// Distilled-doc § \"Sensitive emitted files have restrictive\n// filesystem permissions, re-applied on every emit (not just on\n// create) to recover from manual chmods\". The orchestrator hands the\n// emit/swap layer the mode it should apply.\n//\n// Two-axis policy:\n// - `sensitive: true` → 0o600 (rw user only).\n// - `sensitive: false` → 0o644 (rw user, r world).\n// The parent directory the emit lives in inherits the strictest\n// sensitivity of any file inside it — 0o700 when any file is\n// sensitive, 0o755 otherwise. The orchestrator applies parent mode\n// at swap time, separate from per-file modes.\n\nimport type { CodegenableDecl } from '../../contracts/codegenable.ts';\n\nexport const SENSITIVE_FILE_MODE = 0o600;\nexport const NON_SENSITIVE_FILE_MODE = 0o644;\nexport const SENSITIVE_DIR_MODE = 0o700;\nexport const NON_SENSITIVE_DIR_MODE = 0o755;\n\n/** File mode for one codegen contribution. */\nexport const modeFor = (decl: Pick<CodegenableDecl, 'sensitive'>): number =>\n\tdecl.sensitive === true ? SENSITIVE_FILE_MODE : NON_SENSITIVE_FILE_MODE;\n\n/** Parent-directory mode given a set of contributions inside it. */\nexport const dirModeFor = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): number =>\n\tdecls.some((d) => d.sensitive === true) ? SENSITIVE_DIR_MODE : NON_SENSITIVE_DIR_MODE;\n\n/** True if ANY contribution in the set is sensitive — gates the\n * `.gitignore` \"cover by default\" rule and the parent-mode policy. */\nexport const anySensitive = (decls: ReadonlyArray<Pick<CodegenableDecl, 'sensitive'>>): boolean =>\n\tdecls.some((d) => d.sensitive === true);\n"],"mappings":";AAuBA,MAAa,WAAW,SACvB,KAAK,cAAc,OAAA,MAAA;;AAGpB,MAAa,cAAc,UAC1B,MAAM,MAAM,MAAM,EAAE,cAAc,KAAK,GAAA,MAAA"}