everything-dev 1.53.2 → 2.0.0-rc.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 (713) hide show
  1. package/README.md +2 -11
  2. package/dist/_virtual/_rolldown/runtime.cjs +17 -2
  3. package/dist/_virtual/_rolldown/runtime.mjs +36 -0
  4. package/dist/api/auth-middleware.cjs +161 -0
  5. package/dist/api/auth-middleware.cjs.map +1 -0
  6. package/dist/api/auth-middleware.d.cts +69 -0
  7. package/dist/api/auth-middleware.d.mts +69 -0
  8. package/dist/api/auth-middleware.mjs +160 -0
  9. package/dist/api/auth-middleware.mjs.map +1 -0
  10. package/dist/api-contract.cjs +250 -62
  11. package/dist/api-contract.cjs.map +1 -1
  12. package/dist/api-contract.mjs +246 -65
  13. package/dist/api-contract.mjs.map +1 -1
  14. package/dist/app.cjs +99 -26
  15. package/dist/app.cjs.map +1 -1
  16. package/dist/app.d.cts +3 -0
  17. package/dist/app.d.mts +3 -0
  18. package/dist/app.mjs +100 -27
  19. package/dist/app.mjs.map +1 -1
  20. package/dist/auth-login.cjs +163 -0
  21. package/dist/auth-login.cjs.map +1 -0
  22. package/dist/auth-login.mjs +162 -0
  23. package/dist/auth-login.mjs.map +1 -0
  24. package/dist/auth-session.cjs +64 -0
  25. package/dist/auth-session.cjs.map +1 -0
  26. package/dist/auth-session.mjs +58 -0
  27. package/dist/auth-session.mjs.map +1 -0
  28. package/dist/auth-types-gen.cjs +0 -1
  29. package/dist/auth-types-gen.cjs.map +1 -1
  30. package/dist/build.cjs +37 -173
  31. package/dist/build.cjs.map +1 -1
  32. package/dist/build.mjs +37 -171
  33. package/dist/build.mjs.map +1 -1
  34. package/dist/bundle-cache.cjs +74 -0
  35. package/dist/bundle-cache.cjs.map +1 -0
  36. package/dist/bundle-cache.d.cts +27 -0
  37. package/dist/bundle-cache.d.mts +27 -0
  38. package/dist/bundle-cache.mjs +68 -0
  39. package/dist/bundle-cache.mjs.map +1 -0
  40. package/dist/bundle-fs-resolve.cjs +209 -0
  41. package/dist/bundle-fs-resolve.cjs.map +1 -0
  42. package/dist/bundle-fs-resolve.d.cts +76 -0
  43. package/dist/bundle-fs-resolve.d.mts +76 -0
  44. package/dist/bundle-fs-resolve.mjs +202 -0
  45. package/dist/bundle-fs-resolve.mjs.map +1 -0
  46. package/dist/cdn-deploy.cjs +126 -0
  47. package/dist/cdn-deploy.cjs.map +1 -0
  48. package/dist/cdn-deploy.mjs +124 -0
  49. package/dist/cdn-deploy.mjs.map +1 -0
  50. package/dist/cli/db-doctor.cjs +19 -19
  51. package/dist/cli/db-doctor.cjs.map +1 -1
  52. package/dist/cli/db-doctor.mjs +18 -18
  53. package/dist/cli/db-doctor.mjs.map +1 -1
  54. package/dist/cli/db-repair.cjs +9 -32
  55. package/dist/cli/db-repair.cjs.map +1 -1
  56. package/dist/cli/db-repair.mjs +9 -32
  57. package/dist/cli/db-repair.mjs.map +1 -1
  58. package/dist/cli/framework-version.cjs +7 -3
  59. package/dist/cli/framework-version.cjs.map +1 -1
  60. package/dist/cli/framework-version.mjs +7 -3
  61. package/dist/cli/framework-version.mjs.map +1 -1
  62. package/dist/cli/infra.cjs +159 -251
  63. package/dist/cli/infra.cjs.map +1 -1
  64. package/dist/cli/infra.mjs +154 -242
  65. package/dist/cli/infra.mjs.map +1 -1
  66. package/dist/cli/init.cjs +627 -199
  67. package/dist/cli/init.cjs.map +1 -1
  68. package/dist/cli/init.d.cts +61 -8
  69. package/dist/cli/init.d.mts +61 -8
  70. package/dist/cli/init.mjs +616 -197
  71. package/dist/cli/init.mjs.map +1 -1
  72. package/dist/cli/parse.cjs +8 -7
  73. package/dist/cli/parse.cjs.map +1 -1
  74. package/dist/cli/parse.mjs +9 -7
  75. package/dist/cli/parse.mjs.map +1 -1
  76. package/dist/cli/prompts.cjs +14 -1
  77. package/dist/cli/prompts.cjs.map +1 -1
  78. package/dist/cli/prompts.mjs +14 -1
  79. package/dist/cli/prompts.mjs.map +1 -1
  80. package/dist/cli/prune.cjs +220 -0
  81. package/dist/cli/prune.cjs.map +1 -0
  82. package/dist/cli/prune.mjs +220 -0
  83. package/dist/cli/prune.mjs.map +1 -0
  84. package/dist/cli/snapshot.cjs +2 -1
  85. package/dist/cli/snapshot.cjs.map +1 -1
  86. package/dist/cli/snapshot.mjs +2 -1
  87. package/dist/cli/snapshot.mjs.map +1 -1
  88. package/dist/cli/status.cjs +5 -4
  89. package/dist/cli/status.cjs.map +1 -1
  90. package/dist/cli/status.mjs +6 -5
  91. package/dist/cli/status.mjs.map +1 -1
  92. package/dist/cli/sync.cjs +156 -58
  93. package/dist/cli/sync.cjs.map +1 -1
  94. package/dist/cli/sync.mjs +158 -63
  95. package/dist/cli/sync.mjs.map +1 -1
  96. package/dist/cli/timing.cjs +0 -1
  97. package/dist/cli/timing.cjs.map +1 -1
  98. package/dist/cli/upgrade.cjs +95 -69
  99. package/dist/cli/upgrade.cjs.map +1 -1
  100. package/dist/cli/upgrade.mjs +97 -72
  101. package/dist/cli/upgrade.mjs.map +1 -1
  102. package/dist/cli/utils/helpers.cjs.map +1 -1
  103. package/dist/cli.cjs +320 -72
  104. package/dist/cli.cjs.map +1 -1
  105. package/dist/cli.mjs +316 -68
  106. package/dist/cli.mjs.map +1 -1
  107. package/dist/code-artifacts.cjs +76 -8
  108. package/dist/code-artifacts.cjs.map +1 -1
  109. package/dist/code-artifacts.mjs +76 -10
  110. package/dist/code-artifacts.mjs.map +1 -1
  111. package/dist/commands/build.cjs +65 -0
  112. package/dist/commands/build.cjs.map +1 -0
  113. package/dist/commands/build.mjs +65 -0
  114. package/dist/commands/build.mjs.map +1 -0
  115. package/dist/commands/config.cjs +77 -0
  116. package/dist/commands/config.cjs.map +1 -0
  117. package/dist/commands/config.d.cts +8 -0
  118. package/dist/commands/config.d.mts +8 -0
  119. package/dist/commands/config.mjs +74 -0
  120. package/dist/commands/config.mjs.map +1 -0
  121. package/dist/commands/db.cjs +107 -0
  122. package/dist/commands/db.cjs.map +1 -0
  123. package/dist/commands/db.mjs +107 -0
  124. package/dist/commands/db.mjs.map +1 -0
  125. package/dist/commands/deploy.cjs +336 -0
  126. package/dist/commands/deploy.cjs.map +1 -0
  127. package/dist/commands/deploy.mjs +334 -0
  128. package/dist/commands/deploy.mjs.map +1 -0
  129. package/dist/commands/dev.cjs +75 -0
  130. package/dist/commands/dev.cjs.map +1 -0
  131. package/dist/commands/dev.mjs +73 -0
  132. package/dist/commands/dev.mjs.map +1 -0
  133. package/dist/commands/init.cjs +234 -0
  134. package/dist/commands/init.cjs.map +1 -0
  135. package/dist/commands/init.mjs +231 -0
  136. package/dist/commands/init.mjs.map +1 -0
  137. package/dist/commands/keys.cjs +255 -0
  138. package/dist/commands/keys.cjs.map +1 -0
  139. package/dist/commands/keys.mjs +253 -0
  140. package/dist/commands/keys.mjs.map +1 -0
  141. package/dist/commands/ops.cjs +199 -0
  142. package/dist/commands/ops.cjs.map +1 -0
  143. package/dist/commands/ops.mjs +197 -0
  144. package/dist/commands/ops.mjs.map +1 -0
  145. package/dist/commands/plugins.cjs +211 -0
  146. package/dist/commands/plugins.cjs.map +1 -0
  147. package/dist/commands/plugins.mjs +211 -0
  148. package/dist/commands/plugins.mjs.map +1 -0
  149. package/dist/commands/shared.cjs +8 -0
  150. package/dist/commands/shared.cjs.map +1 -0
  151. package/dist/commands/shared.d.cts +6 -0
  152. package/dist/commands/shared.d.mts +6 -0
  153. package/dist/commands/shared.mjs +8 -0
  154. package/dist/commands/shared.mjs.map +1 -0
  155. package/dist/commands/upgrade.cjs +325 -0
  156. package/dist/commands/upgrade.cjs.map +1 -0
  157. package/dist/commands/upgrade.mjs +323 -0
  158. package/dist/commands/upgrade.mjs.map +1 -0
  159. package/dist/components/dev-render.cjs +340 -0
  160. package/dist/components/dev-render.cjs.map +1 -0
  161. package/dist/components/dev-render.mjs +332 -0
  162. package/dist/components/dev-render.mjs.map +1 -0
  163. package/dist/config.cjs +460 -221
  164. package/dist/config.cjs.map +1 -1
  165. package/dist/config.d.cts +491 -48
  166. package/dist/config.d.mts +491 -48
  167. package/dist/config.mjs +439 -212
  168. package/dist/config.mjs.map +1 -1
  169. package/dist/contract.cjs +327 -50
  170. package/dist/contract.cjs.map +1 -1
  171. package/dist/contract.d.cts +1951 -1062
  172. package/dist/contract.d.mts +1951 -1062
  173. package/dist/contract.meta.cjs +107 -12
  174. package/dist/contract.meta.cjs.map +1 -1
  175. package/dist/contract.meta.d.cts +166 -8
  176. package/dist/contract.meta.d.mts +166 -8
  177. package/dist/contract.meta.mjs +107 -11
  178. package/dist/contract.meta.mjs.map +1 -1
  179. package/dist/contract.mjs +580 -327
  180. package/dist/contract.mjs.map +1 -1
  181. package/dist/dag.cjs +5 -3
  182. package/dist/dag.cjs.map +1 -1
  183. package/dist/dag.mjs +6 -3
  184. package/dist/dag.mjs.map +1 -1
  185. package/dist/db/binding.cjs +80 -0
  186. package/dist/db/binding.cjs.map +1 -0
  187. package/dist/db/binding.d.cts +39 -0
  188. package/dist/db/binding.d.mts +39 -0
  189. package/dist/db/binding.mjs +78 -0
  190. package/dist/db/binding.mjs.map +1 -0
  191. package/dist/db/bindings.cjs +78 -0
  192. package/dist/db/bindings.cjs.map +1 -0
  193. package/dist/db/bindings.d.cts +34 -0
  194. package/dist/db/bindings.d.mts +34 -0
  195. package/dist/db/bindings.mjs +76 -0
  196. package/dist/db/bindings.mjs.map +1 -0
  197. package/dist/db/core.cjs +204 -0
  198. package/dist/db/core.cjs.map +1 -0
  199. package/dist/db/core.d.cts +69 -0
  200. package/dist/db/core.d.mts +69 -0
  201. package/dist/db/core.mjs +192 -0
  202. package/dist/db/core.mjs.map +1 -0
  203. package/dist/db/driver.cjs +167 -0
  204. package/dist/db/driver.cjs.map +1 -0
  205. package/dist/db/driver.d.cts +50 -0
  206. package/dist/db/driver.d.mts +50 -0
  207. package/dist/db/driver.mjs +165 -0
  208. package/dist/db/driver.mjs.map +1 -0
  209. package/dist/db/drizzle-kit.cjs +177 -0
  210. package/dist/db/drizzle-kit.cjs.map +1 -0
  211. package/dist/db/drizzle-kit.d.cts +25 -0
  212. package/dist/db/drizzle-kit.d.mts +25 -0
  213. package/dist/db/drizzle-kit.mjs +175 -0
  214. package/dist/db/drizzle-kit.mjs.map +1 -0
  215. package/dist/db/errors.cjs +27 -0
  216. package/dist/db/errors.cjs.map +1 -0
  217. package/dist/db/errors.d.cts +16 -0
  218. package/dist/db/errors.d.mts +16 -0
  219. package/dist/db/errors.mjs +26 -0
  220. package/dist/db/errors.mjs.map +1 -0
  221. package/dist/db/identity.cjs +55 -0
  222. package/dist/db/identity.cjs.map +1 -0
  223. package/dist/db/identity.d.cts +40 -0
  224. package/dist/db/identity.d.mts +40 -0
  225. package/dist/db/identity.mjs +53 -0
  226. package/dist/db/identity.mjs.map +1 -0
  227. package/dist/db/index.cjs +43 -0
  228. package/dist/db/index.d.cts +9 -0
  229. package/dist/db/index.d.mts +9 -0
  230. package/dist/db/index.mjs +10 -0
  231. package/dist/db/run-migrations.cjs +343 -0
  232. package/dist/db/run-migrations.cjs.map +1 -0
  233. package/dist/db/run-migrations.d.cts +87 -0
  234. package/dist/db/run-migrations.d.mts +87 -0
  235. package/dist/db/run-migrations.mjs +341 -0
  236. package/dist/db/run-migrations.mjs.map +1 -0
  237. package/dist/delegate-signer.cjs +85 -0
  238. package/dist/delegate-signer.cjs.map +1 -0
  239. package/dist/delegate-signer.mjs +84 -0
  240. package/dist/delegate-signer.mjs.map +1 -0
  241. package/dist/deploy-diff.cjs +119 -0
  242. package/dist/deploy-diff.cjs.map +1 -0
  243. package/dist/deploy-diff.mjs +109 -0
  244. package/dist/deploy-diff.mjs.map +1 -0
  245. package/dist/descriptor/constructors.cjs +49 -0
  246. package/dist/descriptor/constructors.cjs.map +1 -0
  247. package/dist/descriptor/constructors.d.cts +27 -0
  248. package/dist/descriptor/constructors.d.mts +27 -0
  249. package/dist/descriptor/constructors.mjs +45 -0
  250. package/dist/descriptor/constructors.mjs.map +1 -0
  251. package/dist/descriptor/index.cjs +24 -0
  252. package/dist/descriptor/index.d.cts +5 -0
  253. package/dist/descriptor/index.d.mts +5 -0
  254. package/dist/descriptor/index.mjs +6 -0
  255. package/dist/descriptor/resolve.cjs +258 -0
  256. package/dist/descriptor/resolve.cjs.map +1 -0
  257. package/dist/descriptor/resolve.d.cts +50 -0
  258. package/dist/descriptor/resolve.d.mts +50 -0
  259. package/dist/descriptor/resolve.mjs +252 -0
  260. package/dist/descriptor/resolve.mjs.map +1 -0
  261. package/dist/descriptor/schema.cjs +109 -0
  262. package/dist/descriptor/schema.cjs.map +1 -0
  263. package/dist/descriptor/schema.d.cts +217 -0
  264. package/dist/descriptor/schema.d.mts +217 -0
  265. package/dist/descriptor/schema.mjs +102 -0
  266. package/dist/descriptor/schema.mjs.map +1 -0
  267. package/dist/descriptor/serialize.cjs +45 -0
  268. package/dist/descriptor/serialize.cjs.map +1 -0
  269. package/dist/descriptor/serialize.d.cts +7 -0
  270. package/dist/descriptor/serialize.d.mts +7 -0
  271. package/dist/descriptor/serialize.mjs +45 -0
  272. package/dist/descriptor/serialize.mjs.map +1 -0
  273. package/dist/dev-log-pipeline.cjs +273 -0
  274. package/dist/dev-log-pipeline.cjs.map +1 -0
  275. package/dist/dev-log-pipeline.mjs +267 -0
  276. package/dist/dev-log-pipeline.mjs.map +1 -0
  277. package/dist/dev-logs.cjs +39 -8
  278. package/dist/dev-logs.cjs.map +1 -1
  279. package/dist/dev-logs.mjs +37 -9
  280. package/dist/dev-logs.mjs.map +1 -1
  281. package/dist/dev-program.cjs +405 -0
  282. package/dist/dev-program.cjs.map +1 -0
  283. package/dist/dev-program.d.cts +10 -0
  284. package/dist/dev-program.d.mts +10 -0
  285. package/dist/dev-program.mjs +395 -0
  286. package/dist/dev-program.mjs.map +1 -0
  287. package/dist/dev-session-data.d.cts +27 -0
  288. package/dist/dev-session-data.d.mts +27 -0
  289. package/dist/dev-session.cjs +178 -105
  290. package/dist/dev-session.cjs.map +1 -1
  291. package/dist/dev-session.mjs +180 -105
  292. package/dist/dev-session.mjs.map +1 -1
  293. package/dist/env/process-env.cjs +16 -0
  294. package/dist/env/process-env.cjs.map +1 -0
  295. package/dist/env/process-env.mjs +13 -0
  296. package/dist/env/process-env.mjs.map +1 -0
  297. package/dist/env/project-env.cjs +144 -0
  298. package/dist/env/project-env.cjs.map +1 -0
  299. package/dist/env/project-env.d.cts +1 -0
  300. package/dist/env/project-env.d.mts +1 -0
  301. package/dist/env/project-env.mjs +132 -0
  302. package/dist/env/project-env.mjs.map +1 -0
  303. package/dist/fastkv.cjs +59 -12
  304. package/dist/fastkv.cjs.map +1 -1
  305. package/dist/fastkv.d.cts +42 -6
  306. package/dist/fastkv.d.mts +42 -6
  307. package/dist/fastkv.mjs +58 -13
  308. package/dist/fastkv.mjs.map +1 -1
  309. package/dist/fingerprint.cjs +57 -0
  310. package/dist/fingerprint.cjs.map +1 -0
  311. package/dist/fingerprint.d.cts +14 -0
  312. package/dist/fingerprint.d.mts +14 -0
  313. package/dist/fingerprint.mjs +55 -0
  314. package/dist/fingerprint.mjs.map +1 -0
  315. package/dist/http-client.cjs +17 -17
  316. package/dist/http-client.cjs.map +1 -1
  317. package/dist/http-client.mjs +17 -17
  318. package/dist/http-client.mjs.map +1 -1
  319. package/dist/image-deploy.cjs +186 -0
  320. package/dist/image-deploy.cjs.map +1 -0
  321. package/dist/image-deploy.mjs +182 -0
  322. package/dist/image-deploy.mjs.map +1 -0
  323. package/dist/index.cjs +66 -18
  324. package/dist/index.d.cts +8 -7
  325. package/dist/index.d.mts +8 -7
  326. package/dist/index.mjs +6 -5
  327. package/dist/infra/docker.cjs +77 -0
  328. package/dist/infra/docker.cjs.map +1 -0
  329. package/dist/infra/docker.d.cts +10 -0
  330. package/dist/infra/docker.d.mts +10 -0
  331. package/dist/infra/docker.mjs +69 -0
  332. package/dist/infra/docker.mjs.map +1 -0
  333. package/dist/infra/materializer.cjs +74 -0
  334. package/dist/infra/materializer.cjs.map +1 -0
  335. package/dist/infra/materializer.mjs +70 -0
  336. package/dist/infra/materializer.mjs.map +1 -0
  337. package/dist/infra/planner.cjs +135 -103
  338. package/dist/infra/planner.cjs.map +1 -1
  339. package/dist/infra/planner.mjs +137 -104
  340. package/dist/infra/planner.mjs.map +1 -1
  341. package/dist/infra/port-ownership.cjs +57 -0
  342. package/dist/infra/port-ownership.cjs.map +1 -0
  343. package/dist/infra/port-ownership.mjs +57 -0
  344. package/dist/infra/port-ownership.mjs.map +1 -0
  345. package/dist/infra/preflight.cjs +45 -33
  346. package/dist/infra/preflight.cjs.map +1 -1
  347. package/dist/infra/preflight.d.cts +1 -0
  348. package/dist/infra/preflight.d.mts +1 -0
  349. package/dist/infra/preflight.mjs +46 -34
  350. package/dist/infra/preflight.mjs.map +1 -1
  351. package/dist/infra/types.cjs.map +1 -1
  352. package/dist/infra/types.d.cts +2 -0
  353. package/dist/infra/types.d.mts +2 -0
  354. package/dist/infra/types.mjs.map +1 -1
  355. package/dist/integrity.cjs +50 -61
  356. package/dist/integrity.cjs.map +1 -1
  357. package/dist/integrity.d.cts +16 -10
  358. package/dist/integrity.d.mts +16 -10
  359. package/dist/integrity.mjs +50 -59
  360. package/dist/integrity.mjs.map +1 -1
  361. package/dist/internal/manifest-normalizer.cjs +8 -2
  362. package/dist/internal/manifest-normalizer.cjs.map +1 -1
  363. package/dist/internal/manifest-normalizer.mjs +9 -3
  364. package/dist/internal/manifest-normalizer.mjs.map +1 -1
  365. package/dist/merge.cjs +19 -1
  366. package/dist/merge.cjs.map +1 -1
  367. package/dist/merge.d.cts +1 -1
  368. package/dist/merge.d.mts +1 -1
  369. package/dist/merge.mjs +19 -2
  370. package/dist/merge.mjs.map +1 -1
  371. package/dist/mf.cjs +190 -3
  372. package/dist/mf.cjs.map +1 -1
  373. package/dist/mf.d.cts +24 -2
  374. package/dist/mf.d.mts +24 -2
  375. package/dist/mf.mjs +189 -4
  376. package/dist/mf.mjs.map +1 -1
  377. package/dist/near-cli.cjs +59 -91
  378. package/dist/near-cli.cjs.map +1 -1
  379. package/dist/near-cli.mjs +58 -90
  380. package/dist/near-cli.mjs.map +1 -1
  381. package/dist/near-signer.cjs +73 -0
  382. package/dist/near-signer.cjs.map +1 -0
  383. package/dist/near-signer.mjs +70 -0
  384. package/dist/near-signer.mjs.map +1 -0
  385. package/dist/network.cjs +0 -1
  386. package/dist/network.cjs.map +1 -1
  387. package/dist/orchestrator.cjs +256 -87
  388. package/dist/orchestrator.cjs.map +1 -1
  389. package/dist/orchestrator.mjs +248 -87
  390. package/dist/orchestrator.mjs.map +1 -1
  391. package/dist/platform-deploy.cjs +81 -0
  392. package/dist/platform-deploy.cjs.map +1 -0
  393. package/dist/platform-deploy.mjs +80 -0
  394. package/dist/platform-deploy.mjs.map +1 -0
  395. package/dist/plugin.cjs +54 -1389
  396. package/dist/plugin.cjs.map +1 -1
  397. package/dist/plugin.d.cts +6 -896
  398. package/dist/plugin.d.mts +6 -896
  399. package/dist/plugin.mjs +53 -1387
  400. package/dist/plugin.mjs.map +1 -1
  401. package/dist/process-kill.cjs +44 -0
  402. package/dist/process-kill.cjs.map +1 -0
  403. package/dist/process-kill.mjs +43 -0
  404. package/dist/process-kill.mjs.map +1 -0
  405. package/dist/process-registry.cjs +64 -9
  406. package/dist/process-registry.cjs.map +1 -1
  407. package/dist/process-registry.mjs +61 -10
  408. package/dist/process-registry.mjs.map +1 -1
  409. package/dist/progress.cjs +45 -0
  410. package/dist/progress.cjs.map +1 -0
  411. package/dist/progress.d.cts +13 -0
  412. package/dist/progress.d.mts +13 -0
  413. package/dist/progress.mjs +42 -0
  414. package/dist/progress.mjs.map +1 -0
  415. package/dist/publish.cjs +513 -79
  416. package/dist/publish.cjs.map +1 -1
  417. package/dist/publish.mjs +515 -82
  418. package/dist/publish.mjs.map +1 -1
  419. package/dist/registry-use.cjs +41 -0
  420. package/dist/registry-use.cjs.map +1 -0
  421. package/dist/registry-use.mjs +40 -0
  422. package/dist/registry-use.mjs.map +1 -0
  423. package/dist/resolution/session.cjs +335 -0
  424. package/dist/resolution/session.cjs.map +1 -0
  425. package/dist/resolution/session.d.cts +105 -0
  426. package/dist/resolution/session.d.mts +105 -0
  427. package/dist/resolution/session.mjs +331 -0
  428. package/dist/resolution/session.mjs.map +1 -0
  429. package/dist/rollback.cjs +131 -0
  430. package/dist/rollback.cjs.map +1 -0
  431. package/dist/rollback.mjs +128 -0
  432. package/dist/rollback.mjs.map +1 -0
  433. package/dist/sdk.cjs +7 -7
  434. package/dist/sdk.d.cts +3 -3
  435. package/dist/sdk.d.mts +3 -3
  436. package/dist/sdk.mjs +2 -2
  437. package/dist/service-descriptor.cjs +67 -34
  438. package/dist/service-descriptor.cjs.map +1 -1
  439. package/dist/service-descriptor.d.cts +4 -1
  440. package/dist/service-descriptor.d.mts +3 -0
  441. package/dist/service-descriptor.mjs +63 -35
  442. package/dist/service-descriptor.mjs.map +1 -1
  443. package/dist/shared-deps.cjs +17 -16
  444. package/dist/shared-deps.cjs.map +1 -1
  445. package/dist/shared-deps.mjs +17 -16
  446. package/dist/shared-deps.mjs.map +1 -1
  447. package/dist/start-config-source.cjs +24 -0
  448. package/dist/start-config-source.cjs.map +1 -0
  449. package/dist/start-config-source.d.cts +29 -0
  450. package/dist/start-config-source.d.mts +29 -0
  451. package/dist/start-config-source.mjs +22 -0
  452. package/dist/start-config-source.mjs.map +1 -0
  453. package/dist/storage-upload.cjs +145 -0
  454. package/dist/storage-upload.cjs.map +1 -0
  455. package/dist/storage-upload.mjs +143 -0
  456. package/dist/storage-upload.mjs.map +1 -0
  457. package/dist/types.cjs +126 -20
  458. package/dist/types.cjs.map +1 -1
  459. package/dist/types.d.cts +867 -585
  460. package/dist/types.d.mts +867 -585
  461. package/dist/types.mjs +307 -208
  462. package/dist/types.mjs.map +1 -1
  463. package/dist/ui/api.cjs +105 -0
  464. package/dist/ui/api.cjs.map +1 -0
  465. package/dist/ui/api.d.cts +31 -0
  466. package/dist/ui/api.d.mts +31 -0
  467. package/dist/ui/api.mjs +99 -0
  468. package/dist/ui/api.mjs.map +1 -0
  469. package/dist/ui/auth-guards.cjs +50 -0
  470. package/dist/ui/auth-guards.cjs.map +1 -0
  471. package/dist/ui/auth-guards.d.cts +39 -0
  472. package/dist/ui/auth-guards.d.mts +39 -0
  473. package/dist/ui/auth-guards.mjs +48 -0
  474. package/dist/ui/auth-guards.mjs.map +1 -0
  475. package/dist/ui/auth.cjs +197 -0
  476. package/dist/ui/auth.cjs.map +1 -0
  477. package/dist/ui/auth.d.cts +56 -0
  478. package/dist/ui/auth.d.mts +56 -0
  479. package/dist/ui/auth.mjs +179 -0
  480. package/dist/ui/auth.mjs.map +1 -0
  481. package/dist/ui/entry.cjs +16 -0
  482. package/dist/ui/entry.cjs.map +1 -0
  483. package/dist/ui/entry.d.cts +12 -0
  484. package/dist/ui/entry.d.mts +12 -0
  485. package/dist/ui/entry.mjs +15 -0
  486. package/dist/ui/entry.mjs.map +1 -0
  487. package/dist/ui/head.cjs +14 -7
  488. package/dist/ui/head.cjs.map +1 -1
  489. package/dist/ui/head.mjs +15 -7
  490. package/dist/ui/head.mjs.map +1 -1
  491. package/dist/ui/hydrate.cjs +265 -0
  492. package/dist/ui/hydrate.cjs.map +1 -0
  493. package/dist/ui/hydrate.d.cts +48 -0
  494. package/dist/ui/hydrate.d.mts +48 -0
  495. package/dist/ui/hydrate.mjs +263 -0
  496. package/dist/ui/hydrate.mjs.map +1 -0
  497. package/dist/ui/i18n.cjs +153 -0
  498. package/dist/ui/i18n.cjs.map +1 -0
  499. package/dist/ui/i18n.d.cts +29 -0
  500. package/dist/ui/i18n.d.mts +29 -0
  501. package/dist/ui/i18n.mjs +140 -0
  502. package/dist/ui/i18n.mjs.map +1 -0
  503. package/dist/ui/index.cjs +19 -1
  504. package/dist/ui/index.d.cts +6 -3
  505. package/dist/ui/index.d.mts +6 -3
  506. package/dist/ui/index.mjs +5 -2
  507. package/dist/ui/locale.cjs +53 -0
  508. package/dist/ui/locale.cjs.map +1 -0
  509. package/dist/ui/locale.d.cts +18 -0
  510. package/dist/ui/locale.d.mts +18 -0
  511. package/dist/ui/locale.mjs +49 -0
  512. package/dist/ui/locale.mjs.map +1 -0
  513. package/dist/ui/manifest/index.cjs +25 -0
  514. package/dist/ui/manifest/index.cjs.map +1 -0
  515. package/dist/ui/manifest/index.d.cts +9 -0
  516. package/dist/ui/manifest/index.d.mts +9 -0
  517. package/dist/ui/manifest/index.mjs +13 -0
  518. package/dist/ui/manifest/index.mjs.map +1 -0
  519. package/dist/ui/manifest-generator.cjs +8 -0
  520. package/dist/ui/manifest-generator.d.cts +1 -0
  521. package/dist/ui/manifest-generator.d.mts +1 -0
  522. package/dist/ui/manifest-generator.mjs +3 -0
  523. package/dist/ui/message-catalogs.cjs +8 -0
  524. package/dist/ui/message-catalogs.cjs.map +1 -0
  525. package/dist/ui/message-catalogs.d.cts +5 -0
  526. package/dist/ui/message-catalogs.d.mts +5 -0
  527. package/dist/ui/message-catalogs.mjs +8 -0
  528. package/dist/ui/message-catalogs.mjs.map +1 -0
  529. package/dist/ui/metadata.cjs +0 -1
  530. package/dist/ui/metadata.cjs.map +1 -1
  531. package/dist/ui/metadata.d.cts +1 -1
  532. package/dist/ui/metadata.d.mts +1 -1
  533. package/dist/ui/plugin-path.cjs +37 -0
  534. package/dist/ui/plugin-path.cjs.map +1 -0
  535. package/dist/ui/plugin-path.d.cts +25 -0
  536. package/dist/ui/plugin-path.d.mts +25 -0
  537. package/dist/ui/plugin-path.mjs +35 -0
  538. package/dist/ui/plugin-path.mjs.map +1 -0
  539. package/dist/ui/router-client.cjs +61 -0
  540. package/dist/ui/router-client.cjs.map +1 -0
  541. package/dist/ui/router-client.d.cts +20 -0
  542. package/dist/ui/router-client.d.mts +20 -0
  543. package/dist/ui/router-client.mjs +60 -0
  544. package/dist/ui/router-client.mjs.map +1 -0
  545. package/dist/ui/router-defaults.cjs +48 -0
  546. package/dist/ui/router-defaults.cjs.map +1 -0
  547. package/dist/ui/router-defaults.d.cts +8 -0
  548. package/dist/ui/router-defaults.d.mts +8 -0
  549. package/dist/ui/router-defaults.mjs +45 -0
  550. package/dist/ui/router-defaults.mjs.map +1 -0
  551. package/dist/ui/router-error.cjs +70 -0
  552. package/dist/ui/router-error.cjs.map +1 -0
  553. package/dist/ui/router-error.d.cts +19 -0
  554. package/dist/ui/router-error.d.mts +19 -0
  555. package/dist/ui/router-error.mjs +69 -0
  556. package/dist/ui/router-error.mjs.map +1 -0
  557. package/dist/ui/router-server.cjs +153 -0
  558. package/dist/ui/router-server.cjs.map +1 -0
  559. package/dist/ui/router-server.d.cts +38 -0
  560. package/dist/ui/router-server.d.mts +38 -0
  561. package/dist/ui/router-server.mjs +152 -0
  562. package/dist/ui/router-server.mjs.map +1 -0
  563. package/dist/ui/router.cjs +4 -16
  564. package/dist/ui/router.cjs.map +1 -1
  565. package/dist/ui/router.mjs +4 -15
  566. package/dist/ui/router.mjs.map +1 -1
  567. package/dist/ui/runtime.cjs +5 -1
  568. package/dist/ui/runtime.cjs.map +1 -1
  569. package/dist/ui/runtime.d.cts +2 -1
  570. package/dist/ui/runtime.d.mts +2 -1
  571. package/dist/ui/runtime.mjs +5 -1
  572. package/dist/ui/runtime.mjs.map +1 -1
  573. package/dist/ui/slot.cjs +34 -0
  574. package/dist/ui/slot.cjs.map +1 -0
  575. package/dist/ui/slot.d.cts +43 -0
  576. package/dist/ui/slot.d.mts +43 -0
  577. package/dist/ui/slot.mjs +34 -0
  578. package/dist/ui/slot.mjs.map +1 -0
  579. package/dist/ui/tenant.cjs +300 -0
  580. package/dist/ui/tenant.cjs.map +1 -0
  581. package/dist/ui/tenant.d.cts +122 -0
  582. package/dist/ui/tenant.d.mts +122 -0
  583. package/dist/ui/tenant.mjs +279 -0
  584. package/dist/ui/tenant.mjs.map +1 -0
  585. package/dist/ui/types.d.cts +32 -2
  586. package/dist/ui/types.d.mts +32 -2
  587. package/dist/ui/version-check.cjs +47 -0
  588. package/dist/ui/version-check.cjs.map +1 -0
  589. package/dist/ui/version-check.d.cts +23 -0
  590. package/dist/ui/version-check.d.mts +23 -0
  591. package/dist/ui/version-check.mjs +46 -0
  592. package/dist/ui/version-check.mjs.map +1 -0
  593. package/dist/utils/banner.cjs +2 -2
  594. package/dist/utils/banner.cjs.map +1 -1
  595. package/dist/utils/banner.mjs +2 -2
  596. package/dist/utils/banner.mjs.map +1 -1
  597. package/dist/utils/linkify.cjs +1 -1
  598. package/dist/utils/linkify.cjs.map +1 -1
  599. package/dist/utils/linkify.mjs +1 -0
  600. package/dist/utils/linkify.mjs.map +1 -1
  601. package/dist/utils/run.cjs +6 -6
  602. package/dist/utils/run.cjs.map +1 -1
  603. package/dist/utils/run.mjs +6 -6
  604. package/dist/utils/run.mjs.map +1 -1
  605. package/dist/utils/save-config.cjs +12 -0
  606. package/dist/utils/save-config.cjs.map +1 -1
  607. package/dist/utils/save-config.mjs +12 -0
  608. package/dist/utils/save-config.mjs.map +1 -1
  609. package/dist/utils/snapshot-hash.cjs +10 -0
  610. package/dist/utils/snapshot-hash.cjs.map +1 -0
  611. package/dist/utils/snapshot-hash.mjs +10 -0
  612. package/dist/utils/snapshot-hash.mjs.map +1 -0
  613. package/dist/utils/string.cjs +0 -1
  614. package/dist/utils/string.cjs.map +1 -1
  615. package/dist/utils/theme.cjs +30 -12
  616. package/dist/utils/theme.cjs.map +1 -1
  617. package/dist/utils/theme.mjs +30 -11
  618. package/dist/utils/theme.mjs.map +1 -1
  619. package/dist/version-manifest-deploy.cjs +50 -0
  620. package/dist/version-manifest-deploy.cjs.map +1 -0
  621. package/dist/version-manifest-deploy.mjs +49 -0
  622. package/dist/version-manifest-deploy.mjs.map +1 -0
  623. package/dist/version-manifest-resolve.cjs +42 -0
  624. package/dist/version-manifest-resolve.cjs.map +1 -0
  625. package/dist/version-manifest-resolve.d.cts +38 -0
  626. package/dist/version-manifest-resolve.d.mts +38 -0
  627. package/dist/version-manifest-resolve.mjs +40 -0
  628. package/dist/version-manifest-resolve.mjs.map +1 -0
  629. package/dist/version-status.cjs +18 -0
  630. package/dist/version-status.cjs.map +1 -0
  631. package/dist/version-status.d.cts +22 -0
  632. package/dist/version-status.d.mts +22 -0
  633. package/dist/version-status.mjs +17 -0
  634. package/dist/version-status.mjs.map +1 -0
  635. package/dist/workspace-catalog.cjs +53 -0
  636. package/dist/workspace-catalog.cjs.map +1 -0
  637. package/dist/workspace-catalog.mjs +51 -0
  638. package/dist/workspace-catalog.mjs.map +1 -0
  639. package/dist/workspace.cjs +237 -0
  640. package/dist/workspace.cjs.map +1 -0
  641. package/dist/workspace.mjs +233 -0
  642. package/dist/workspace.mjs.map +1 -0
  643. package/package.json +179 -27
  644. package/skills/add-a-route/SKILL.md +132 -0
  645. package/skills/api-and-auth/SKILL.md +87 -21
  646. package/skills/api-and-auth/references/middleware.md +1 -1
  647. package/skills/cli-reference/SKILL.md +48 -21
  648. package/skills/code-style/SKILL.md +8 -0
  649. package/skills/dev-workflow/SKILL.md +50 -26
  650. package/skills/extends-config/SKILL.md +31 -19
  651. package/skills/init-upgrade/SKILL.md +29 -16
  652. package/skills/plugin-development/SKILL.md +46 -112
  653. package/skills/plugin-development/references/database.md +82 -0
  654. package/skills/plugin-development/references/request-context.md +67 -0
  655. package/skills/publish-sync/SKILL.md +99 -22
  656. package/skills/registry/SKILL.md +82 -0
  657. package/skills/super-app/SKILL.md +25 -15
  658. package/skills/talk-to-the-app/SKILL.md +138 -0
  659. package/skills/ui-integration/SKILL.md +93 -11
  660. package/dist/cli/db-studio.cjs +0 -131
  661. package/dist/cli/db-studio.cjs.map +0 -1
  662. package/dist/cli/db-studio.mjs +0 -127
  663. package/dist/cli/db-studio.mjs.map +0 -1
  664. package/dist/cli/init.d.cts.map +0 -1
  665. package/dist/cli/init.d.mts.map +0 -1
  666. package/dist/components/dev-view.cjs +0 -309
  667. package/dist/components/dev-view.cjs.map +0 -1
  668. package/dist/components/dev-view.mjs +0 -309
  669. package/dist/components/dev-view.mjs.map +0 -1
  670. package/dist/components/streaming-view.cjs +0 -134
  671. package/dist/components/streaming-view.cjs.map +0 -1
  672. package/dist/components/streaming-view.mjs +0 -132
  673. package/dist/components/streaming-view.mjs.map +0 -1
  674. package/dist/config.d.cts.map +0 -1
  675. package/dist/config.d.mts.map +0 -1
  676. package/dist/contract.d.cts.map +0 -1
  677. package/dist/contract.d.mts.map +0 -1
  678. package/dist/contract.meta.d.cts.map +0 -1
  679. package/dist/contract.meta.d.mts.map +0 -1
  680. package/dist/dag.d.cts.map +0 -1
  681. package/dist/dag.d.mts.map +0 -1
  682. package/dist/db.cjs +0 -81
  683. package/dist/db.cjs.map +0 -1
  684. package/dist/db.d.cts +0 -30
  685. package/dist/db.d.cts.map +0 -1
  686. package/dist/db.d.mts +0 -30
  687. package/dist/db.d.mts.map +0 -1
  688. package/dist/db.mjs +0 -75
  689. package/dist/db.mjs.map +0 -1
  690. package/dist/fastkv.d.cts.map +0 -1
  691. package/dist/fastkv.d.mts.map +0 -1
  692. package/dist/integrity.d.cts.map +0 -1
  693. package/dist/integrity.d.mts.map +0 -1
  694. package/dist/merge.d.cts.map +0 -1
  695. package/dist/merge.d.mts.map +0 -1
  696. package/dist/mf.d.cts.map +0 -1
  697. package/dist/mf.d.mts.map +0 -1
  698. package/dist/plugin.d.cts.map +0 -1
  699. package/dist/plugin.d.mts.map +0 -1
  700. package/dist/service-descriptor.d.cts.map +0 -1
  701. package/dist/service-descriptor.d.mts.map +0 -1
  702. package/dist/types.d.cts.map +0 -1
  703. package/dist/types.d.mts.map +0 -1
  704. package/dist/ui/head.d.cts.map +0 -1
  705. package/dist/ui/head.d.mts.map +0 -1
  706. package/dist/ui/metadata.d.cts.map +0 -1
  707. package/dist/ui/metadata.d.mts.map +0 -1
  708. package/dist/ui/router.d.cts.map +0 -1
  709. package/dist/ui/router.d.mts.map +0 -1
  710. package/dist/ui/runtime.d.cts.map +0 -1
  711. package/dist/ui/runtime.d.mts.map +0 -1
  712. package/dist/ui/types.d.cts.map +0 -1
  713. package/dist/ui/types.d.mts.map +0 -1
package/dist/config.mjs CHANGED
@@ -1,137 +1,200 @@
1
+ import { getProcessEnv } from "./env/process-env.mjs";
1
2
  import { fetchJsonOrNull } from "./http-client.mjs";
2
3
  import { fetchApiPluginManifest } from "./api-contract.mjs";
3
4
  import { manifestPluginsToNodes } from "./dag.mjs";
4
- import { fetchBosConfigFromFastKv } from "./fastkv.mjs";
5
5
  import { BOS_CONFIG_ORDER, bosConfigMerger, isPlainObject, mergeBosConfigWithExtends, rebuildOrderedConfig, resolveExtendsRef } from "./merge.mjs";
6
- import { getNetworkIdForAccount } from "./network.mjs";
7
6
  import { BosConfigSchema } from "./types.mjs";
7
+ import { AppDescriptorSchema } from "./descriptor/schema.mjs";
8
+ import { resolveApp, toConfigInput } from "./descriptor/resolve.mjs";
9
+ import { fetchBosConfigFromFastKv } from "./fastkv.mjs";
10
+ import { getNetworkIdForAccount } from "./network.mjs";
11
+ import { resolveSlotVersion } from "./version-manifest-resolve.mjs";
12
+ import { AsyncLocalStorage } from "node:async_hooks";
8
13
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
14
  import { dirname, isAbsolute, join, resolve } from "node:path";
15
+ import { pathToFileURL } from "node:url";
16
+ import { Effect, Schema } from "effect";
17
+ import { sanitizeContainerName } from "every-plugin/ui/manifest/contract";
10
18
 
11
19
  //#region src/config.ts
20
+ const warnOutsideEffect = (...args) => {
21
+ console.warn(...args);
22
+ };
12
23
  const LOCAL_PREFIX = "local:";
13
24
  const DEFAULT_HOST_PORT = 3e3;
14
25
  const RESOLVED_CONFIG_FILENAME = "bos.resolved-config.json";
15
- let cachedConfig = null;
16
- let projectRoot = null;
17
- let configWarnings = [];
18
- let suppressConfigWarnings = false;
19
- function clearConfigCache() {
20
- cachedConfig = null;
21
- projectRoot = null;
22
- configWarnings = [];
23
- }
24
- function suppressWarnings() {
25
- suppressConfigWarnings = true;
26
- }
27
- function resumeWarnings() {
28
- suppressConfigWarnings = false;
29
- }
30
- function drainConfigWarnings() {
31
- const warnings = [...configWarnings];
32
- configWarnings = [];
33
- return warnings;
26
+ const MISSING_CONFIG_MESSAGE = "No config found (bos.app.ts or bos.config.json)";
27
+ const DEV_OVERLAY_FILENAME = "bos.dev.ts";
28
+ const warningCapture = new AsyncLocalStorage();
29
+ /**
30
+ * @internal — runs `fn` with config warnings captured into `sink` instead of
31
+ * the console. Plumbing for the resolution session; not part of the public
32
+ * config surface.
33
+ */
34
+ function runWithConfigWarningSink(sink, fn) {
35
+ return warningCapture.run({
36
+ sink,
37
+ previous: warningCapture.getStore()
38
+ }, fn);
34
39
  }
35
40
  function emitConfigWarning(message) {
36
- if (suppressConfigWarnings) configWarnings.push(message);
41
+ const capture = warningCapture.getStore();
42
+ if (capture) capture.sink.push(message);
37
43
  else console.warn(message);
38
44
  }
39
45
  const configPathCache = /* @__PURE__ */ new Map();
46
+ /**
47
+ * @internal — clears the findConfigPath memo. Plumbing for tests and the
48
+ * resolution session; not part of the public config surface.
49
+ */
50
+ function resetConfigPathCache() {
51
+ configPathCache.clear();
52
+ }
53
+ /**
54
+ * Reads the local authored config without resolving the extends chain or
55
+ * touching the network — the build-surface factories (generated rsbuild
56
+ * configs) consume it for their APP_NAME/APP_ACCOUNT defines.
57
+ */
58
+ async function readAuthoredConfigInput(cwd) {
59
+ const configPath = findConfigPath(cwd);
60
+ if (!configPath || configPath.startsWith("bos://")) return null;
61
+ return readConfigInput(configPath, dirname(configPath));
62
+ }
63
+ /**
64
+ * The authored config entry inside exactly `dir` — no upward walk. Unlike
65
+ * `findConfigPath` this never escapes the given directory, for write targets
66
+ * and nested-local-path resolution where a parent's config must not be
67
+ * picked up. Prefers the authored `bos.app.ts` descriptor (the canonical
68
+ * form) over a legacy `bos.config.json`.
69
+ */
70
+ function localConfigEntryPath(dir) {
71
+ const appPath = join(dir, "bos.app.ts");
72
+ if (existsSync(appPath)) return appPath;
73
+ const jsonPath = join(dir, "bos.config.json");
74
+ return existsSync(jsonPath) ? jsonPath : null;
75
+ }
76
+ /** `localConfigEntryPath` + the form-aware read (`BosConfigInput`). */
77
+ async function readLocalAuthoredConfigInput(dir) {
78
+ const entry = localConfigEntryPath(dir);
79
+ if (!entry) return null;
80
+ return readConfigInput(entry, dirname(entry));
81
+ }
82
+ /**
83
+ * The authored `bos.app.ts` descriptor is the canonical form — when both
84
+ * forms coexist (e.g. a generated `bos.config.json` write-back beside the
85
+ * authored descriptor), the authored file wins. JSON-form-only children are
86
+ * unaffected: with no `bos.app.ts`, the JSON file is the entry.
87
+ */
40
88
  function findConfigPath(cwd) {
41
- const cacheKey = cwd ?? process.cwd();
89
+ const cacheKey = resolve(cwd ?? process.cwd());
42
90
  const cached = configPathCache.get(cacheKey);
43
91
  if (cached !== void 0) return cached;
44
92
  let dir = cacheKey;
45
- while (dir !== "/") {
46
- const configPath = join(dir, "bos.config.json");
47
- if (existsSync(configPath)) {
48
- configPathCache.set(cacheKey, configPath);
49
- return configPath;
93
+ while (true) {
94
+ const appPath = join(dir, "bos.app.ts");
95
+ if (existsSync(appPath)) {
96
+ configPathCache.set(cacheKey, appPath);
97
+ return appPath;
98
+ }
99
+ const jsonPath = join(dir, "bos.config.json");
100
+ if (existsSync(jsonPath)) {
101
+ configPathCache.set(cacheKey, jsonPath);
102
+ return jsonPath;
50
103
  }
51
- dir = dirname(dir);
104
+ const parent = dirname(dir);
105
+ if (parent === dir) break;
106
+ dir = parent;
52
107
  }
53
108
  configPathCache.set(cacheKey, null);
54
109
  return null;
55
110
  }
56
- function getConfig() {
57
- return cachedConfig;
58
- }
59
- function getProjectRoot() {
60
- if (!projectRoot) throw new Error("Config not loaded. Call loadResolvedConfig() first.");
61
- return projectRoot;
62
- }
63
- async function loadLocalConfig(options) {
64
- const configPath = options?.path ?? findConfigPath(options?.cwd);
65
- if (!configPath) {
66
- projectRoot = options?.cwd ?? process.cwd();
67
- return null;
68
- }
69
- const baseDir = dirname(configPath);
70
- const config = await loadConfigFile(configPath, baseDir);
71
- projectRoot = baseDir;
72
- return {
73
- config,
74
- source: { path: configPath }
75
- };
76
- }
77
- async function loadResolvedConfig(options) {
78
- const configPath = options?.path ?? findConfigPath(options?.cwd);
79
- if (!configPath) {
80
- projectRoot = options?.cwd ?? process.cwd();
81
- return null;
82
- }
83
- const baseDir = dirname(configPath);
84
- const env = options?.env ?? "development";
85
- const runtimeEnv = env === "staging" ? "production" : env;
86
- try {
87
- suppressWarnings();
88
- const extendedChain = [];
89
- const parsed = await resolveConfigWithExtends(configPath, baseDir, /* @__PURE__ */ new Set(), extendedChain, env);
90
- const config = await resolveConfigComposableEntries(BosConfigSchema.parse(parsed), baseDir, runtimeEnv);
91
- cachedConfig = config;
92
- projectRoot = baseDir;
93
- const runtime = await buildRuntimeConfig(config, baseDir, runtimeEnv, { plugins: await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv, options?.remotePlugins) });
94
- const warnings = drainConfigWarnings();
95
- resumeWarnings();
96
- return {
97
- config,
98
- runtime,
99
- source: {
100
- path: configPath,
101
- extended: extendedChain.length > 0 ? extendedChain : void 0,
102
- remote: extendedChain.some((entry) => entry.startsWith("bos://"))
103
- },
104
- warnings: warnings.length > 0 ? warnings : void 0
105
- };
106
- } catch (error) {
107
- resumeWarnings();
108
- if (error instanceof Error) throw new Error(`Failed to load config from ${configPath}: ${error.message}`, { cause: error });
109
- throw new Error(`Failed to load config from ${configPath}: ${String(error)}`);
111
+ function isAppDescriptorPath(configPath) {
112
+ return configPath.endsWith(".app.ts") || configPath.endsWith(".app.js");
113
+ }
114
+ /**
115
+ * Materialize an authored bos.app.ts descriptor into the authoring-shape
116
+ * `BosConfigInput` the config pipeline consumes. Import-extends is honored
117
+ * two ways: the parent descriptor value can be imported directly (an
118
+ * inlined parent, resolved through `resolveApp`), or `extends` can name a
119
+ * published config (`bos://…`) / a local file, which flows into the JSON
120
+ * extends chain unchanged.
121
+ */
122
+ async function loadAppDescriptorConfig(resolvedPath) {
123
+ return parseAppDescriptorModule(await import(
124
+ /* webpackIgnore: true */
125
+ pathToFileURL(resolvedPath).href
126
+ ), resolvedPath);
127
+ }
128
+ /**
129
+ * @internal — parses an already-imported app descriptor module into the
130
+ * authoring-shape `BosConfigInput`. Plumbing for the resolution session's
131
+ * injectable module loader; not part of the public config surface.
132
+ */
133
+ function parseAppDescriptorModule(mod, sourcePath) {
134
+ if (!mod.default) throw new Error(`${sourcePath ?? "App descriptor module"} must default-export an App() descriptor`);
135
+ const descriptor = AppDescriptorSchema.parse(mod.default);
136
+ const registry = {};
137
+ for (const value of Object.values(mod)) {
138
+ const parsed = AppDescriptorSchema.safeParse(value);
139
+ if (parsed.success) registry[parsed.data.name] = parsed.data;
110
140
  }
111
- }
112
- async function loadBosConfig(options) {
113
- const result = await loadResolvedConfig(options);
114
- if (!result) throw new Error("No bos.config.json found");
115
- return result.runtime;
116
- }
117
- async function loadRemoteConfig(bosUrl, env = "production") {
118
- const runtimeEnv = env === "staging" ? "production" : env;
119
- const extendedChain = [];
120
- const parsed = await resolveConfigWithExtends(bosUrl, process.cwd(), /* @__PURE__ */ new Set(), extendedChain, env);
121
- const config = await resolveConfigComposableEntries(BosConfigSchema.parse(parsed), process.cwd(), runtimeEnv);
122
- return {
123
- rawConfig: await loadConfigFile(bosUrl, process.cwd()),
124
- config,
125
- source: bosUrl,
126
- extendsChain: extendedChain
127
- };
141
+ const extendsRef = descriptor.extends;
142
+ if (typeof extendsRef === "string" && registry[extendsRef] !== void 0 || extendsRef !== void 0 && typeof extendsRef !== "string") return resolveApp(descriptor.name, registry);
143
+ const input = toConfigInput(descriptor);
144
+ if (extendsRef !== void 0) input.extends = extendsRef;
145
+ return input;
146
+ }
147
+ /**
148
+ * @internal — validates an already-imported `bos.dev.ts` module as a
149
+ * `Partial<AppDescriptor>` dev overlay. Plumbing for the resolution session's
150
+ * injectable module loader; not part of the public config surface.
151
+ */
152
+ function parseDevOverlayModule(mod, sourcePath) {
153
+ const source = sourcePath ?? "bos.dev.ts";
154
+ if (!mod?.default) throw new DevOverlayError({
155
+ path: source,
156
+ message: `${source} must default-export a dev overlay (Partial<AppDescriptor>)`
157
+ });
158
+ const parsed = AppDescriptorSchema.partial().safeParse(mod.default);
159
+ if (!parsed.success) throw new DevOverlayError({
160
+ path: source,
161
+ message: `${source} is not a valid dev overlay: ${parsed.error.message}`,
162
+ cause: parsed.error
163
+ });
164
+ return parsed.data;
165
+ }
166
+ var ConfigLoadError = class extends Schema.TaggedError()("ConfigLoadError", {
167
+ path: Schema.String,
168
+ message: Schema.String,
169
+ cause: Schema.optional(Schema.Unknown)
170
+ }) {};
171
+ var CircularExtendsError = class extends Schema.TaggedError()("CircularExtendsError", {
172
+ chain: Schema.Array(Schema.String),
173
+ message: Schema.String
174
+ }) {};
175
+ var ConfigNotfoundError = class extends Schema.TaggedError()("ConfigNotfoundError", { message: Schema.String }) {};
176
+ var ConfigExtendsError = class extends Schema.TaggedError()("ConfigExtendsError", {
177
+ message: Schema.String,
178
+ cause: Schema.optional(Schema.Unknown)
179
+ }) {};
180
+ var ConfigVersionManifestError = class extends Schema.TaggedError()("ConfigVersionManifestError", {
181
+ message: Schema.String,
182
+ cause: Schema.optional(Schema.Unknown)
183
+ }) {};
184
+ var DevOverlayError = class extends Schema.TaggedError()("DevOverlayError", {
185
+ path: Schema.String,
186
+ message: Schema.String,
187
+ cause: Schema.optional(Schema.Unknown)
188
+ }) {};
189
+ function defaultConfigEnv() {
190
+ return process.env.NODE_ENV === "production" ? "production" : "development";
128
191
  }
129
192
  function parseRuntimeOverrideTargets(value) {
130
193
  if (!value) return [];
131
194
  return [...new Set(value.split(",").map((entry) => entry.trim()).filter(Boolean))].map((entry) => {
132
195
  if (entry === "ui" || entry === "api" || entry === "plugins") return entry;
133
196
  if (entry.startsWith("plugins.") && entry.length > 8) return entry;
134
- throw new Error(`Invalid runtime override target: ${entry}`);
197
+ throw new ConfigExtendsError({ message: `Invalid runtime override target: ${entry}` });
135
198
  });
136
199
  }
137
200
  function isRuntimeOverrideAllowed(allowedTargets, target) {
@@ -139,16 +202,20 @@ function isRuntimeOverrideAllowed(allowedTargets, target) {
139
202
  if (target.startsWith("plugins.")) return allowedTargets.includes("plugins.*");
140
203
  return false;
141
204
  }
142
- async function buildRuntimePluginsForConfig(config, baseDir, env) {
143
- const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);
205
+ async function buildRuntimePluginsForConfig(config, baseDir, env, remotePlugins) {
206
+ const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env, remotePlugins);
144
207
  return Object.keys(plugins).length > 0 ? plugins : void 0;
145
208
  }
146
209
  function getEntryAssociatedUi(entry) {
147
- if (!isPlainObject(entry.app)) return;
148
- const app = entry.app;
149
- if (!isPlainObject(app.ui)) return;
150
- const ui = app.ui;
151
- if ("shared" in ui) throw new Error("app.ui.shared is no longer supported. Move shared deps to app.api.shared, app.auth.shared, or plugins.*.shared.");
210
+ const flat = isPlainObject(entry.ui) ? entry.ui : void 0;
211
+ const nested = (() => {
212
+ if (!isPlainObject(entry.app)) return void 0;
213
+ const app = entry.app;
214
+ return isPlainObject(app.ui) ? app.ui : void 0;
215
+ })();
216
+ const ui = flat ?? nested;
217
+ if (!ui) return void 0;
218
+ if ("shared" in ui) throw new ConfigExtendsError({ message: "app.ui.shared is no longer supported. Move shared deps to app.api.shared, app.auth.shared, or plugins.*.shared." });
152
219
  return ui;
153
220
  }
154
221
  function mergeAssociatedUi(parentUi, childUi) {
@@ -221,7 +288,7 @@ function resolveBosConfigPath(configDir) {
221
288
  if (existsSync(resolvedPath)) return resolvedPath;
222
289
  return join(configDir, "bos.config.json");
223
290
  }
224
- function readBosConfigForBuild(configDir) {
291
+ async function readBosConfigForBuild(configDir) {
225
292
  const resolvedPath = getResolvedConfigPath(configDir);
226
293
  if (existsSync(resolvedPath)) try {
227
294
  const raw = JSON.parse(readFileSync(resolvedPath, "utf-8"));
@@ -230,11 +297,18 @@ function readBosConfigForBuild(configDir) {
230
297
  return configData;
231
298
  }
232
299
  } catch (e) {
233
- console.warn(`[Config] Failed to parse _resolved.json, falling back to bos.config.json: ${e}`);
300
+ console.warn(`[Config] Failed to parse _resolved.json, falling back to the authored config: ${e}`);
234
301
  }
302
+ const authored = await readLocalAuthoredConfigInput(configDir);
303
+ if (authored) return authored;
235
304
  const bosConfigPath = join(configDir, "bos.config.json");
236
305
  return JSON.parse(readFileSync(bosConfigPath, "utf-8"));
237
306
  }
307
+ /**
308
+ * @internal — splits an extends ref into its config path and optional
309
+ * `#target` suffix. Plumbing for the resolution session; not part of the
310
+ * public config surface.
311
+ */
238
312
  function parseExtendsTarget(ref) {
239
313
  const hashIndex = ref.indexOf("#");
240
314
  if (hashIndex === -1) return { configPath: ref };
@@ -245,6 +319,10 @@ function parseExtendsTarget(ref) {
245
319
  targetPath: targetPath.length > 0 ? targetPath : void 0
246
320
  };
247
321
  }
322
+ /**
323
+ * @internal — resolves the base directory a config path extends from.
324
+ * Plumbing for the resolution session; not part of the public config surface.
325
+ */
248
326
  function getConfigBaseDir(configPath, baseDir) {
249
327
  if (configPath.startsWith("bos://")) return baseDir;
250
328
  return dirname(isAbsolute(configPath) ? configPath : resolve(baseDir, configPath));
@@ -252,7 +330,7 @@ function getConfigBaseDir(configPath, baseDir) {
252
330
  function asComposableEntry(value) {
253
331
  if (value === void 0) return {};
254
332
  if (typeof value === "string") return { extends: value };
255
- if (!isPlainObject(value)) throw new Error(`Expected config entry object, received ${typeof value}`);
333
+ if (!isPlainObject(value)) throw new ConfigExtendsError({ message: `Expected config entry object, received ${typeof value}` });
256
334
  return value;
257
335
  }
258
336
  function getTargetedEntry(config, targetPath) {
@@ -262,19 +340,25 @@ function getTargetedEntry(config, targetPath) {
262
340
  }
263
341
  if (targetPath.startsWith("plugins.")) {
264
342
  const pluginId = targetPath.slice(8);
265
- if (pluginId.length === 0) throw new Error(`Invalid plugin target path: ${targetPath}`);
343
+ if (pluginId.length === 0) throw new ConfigExtendsError({ message: `Invalid plugin target path: ${targetPath}` });
266
344
  return asComposableEntry(config.plugins?.[pluginId]);
267
345
  }
268
- throw new Error(`Unsupported extends target path: ${targetPath}`);
346
+ throw new ConfigExtendsError({ message: `Unsupported extends target path: ${targetPath}` });
269
347
  }
270
348
  function getAssociatedUi(config, _targetPath) {
271
349
  if (!isPlainObject(config.app?.ui)) return;
272
350
  const ui = config.app.ui;
273
- if ("shared" in ui) throw new Error("app.ui.shared is no longer supported. Move shared deps to app.api.shared, app.auth.shared, or plugins.*.shared.");
351
+ if ("shared" in ui) throw new ConfigExtendsError({ message: "app.ui.shared is no longer supported. Move shared deps to app.api.shared, app.auth.shared, or plugins.*.shared." });
274
352
  return ui;
275
353
  }
354
+ function applyNullOverrides(target, source) {
355
+ for (const [key, value] of Object.entries(source)) if (value === null) target[key] = null;
356
+ else if (isPlainObject(value) && isPlainObject(target[key])) applyNullOverrides(target[key], value);
357
+ }
276
358
  function mergeComposableEntries(parent, child) {
277
- return bosConfigMerger({ ...child }, parent);
359
+ const merged = bosConfigMerger({ ...child }, parent);
360
+ applyNullOverrides(merged, child);
361
+ return merged;
278
362
  }
279
363
  function stripUnsafeLocalDevelopment(entry, allowLocalPaths) {
280
364
  if (!entry || allowLocalPaths) return entry;
@@ -293,11 +377,15 @@ async function resolveComposableReference(source, baseDir, env, defaultTargetPat
293
377
  let extendsError;
294
378
  const extendsRef = source.extends ? resolveExtendsRef(source.extends, env) : void 0;
295
379
  if (extendsRef) {
380
+ const { resolveMergedConfigInput } = await import("./resolution/session.mjs");
296
381
  const parsed = parseExtendsTarget(extendsRef);
297
382
  targetPath = parsed.targetPath ?? defaultTargetPath;
298
383
  const extendsBaseDir = getConfigBaseDir(parsed.configPath, baseDir);
299
384
  try {
300
- const extendedConfig = await resolveConfigWithExtends(parsed.configPath, extendsBaseDir, /* @__PURE__ */ new Set(), [], env);
385
+ const extendedConfig = await resolveMergedConfigInput(parsed.configPath, {
386
+ baseDir: extendsBaseDir,
387
+ env
388
+ });
301
389
  resolvedEntry = mergeComposableEntries(resolvedEntry, getTargetedEntry(extendedConfig, targetPath));
302
390
  providerBaseDir = extendsBaseDir;
303
391
  associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(extendedConfig, targetPath));
@@ -309,10 +397,14 @@ async function resolveComposableReference(source, baseDir, env, defaultTargetPat
309
397
  const localDevelopmentPath = localDevelopment ? resolve(baseDir, localDevelopment.slice(6).trim()) : void 0;
310
398
  const hasUsableLocalDevelopment = Boolean(localDevelopmentPath && existsSync(localDevelopmentPath));
311
399
  if (localDevelopmentPath) {
400
+ const { resolveMergedConfigInput } = await import("./resolution/session.mjs");
312
401
  const localPath = localDevelopmentPath;
313
- const localConfigPath = join(localPath, "bos.config.json");
314
- if (existsSync(localConfigPath)) {
315
- const localConfig = await resolveConfigWithExtends(localConfigPath, localPath, /* @__PURE__ */ new Set(), [], env);
402
+ const localConfigPath = localConfigEntryPath(localPath);
403
+ if (localConfigPath) {
404
+ const localConfig = await resolveMergedConfigInput(localConfigPath, {
405
+ baseDir: localPath,
406
+ env
407
+ });
316
408
  resolvedEntry = mergeComposableEntries(resolvedEntry, getTargetedEntry(localConfig, targetPath));
317
409
  providerBaseDir = localPath;
318
410
  associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(localConfig, targetPath));
@@ -328,14 +420,16 @@ async function resolveComposableReference(source, baseDir, env, defaultTargetPat
328
420
  entry: stripUnsafeLocalDevelopment(resolvedEntry, allowLocalPaths || Boolean(localDevelopment)),
329
421
  providerBaseDir,
330
422
  targetPath,
331
- associatedUi: stripUnsafeLocalDevelopment(associatedUi, allowLocalPaths)
423
+ associatedUi: stripUnsafeLocalDevelopment(associatedUi, allowLocalPaths || Boolean(localDevelopment))
332
424
  };
333
425
  }
334
426
  function resolveDevelopmentTarget(development, production, baseDir, forceSource, target, extendsRef) {
335
427
  if (forceSource === "remote") return resolveRuntimeTarget(production, baseDir, "remote");
336
428
  if (!development) {
337
- if (production && target) if (extendsRef) emitConfigWarning(`[Config] Resolving "${target}" from ${extendsRef}`);
338
- else emitConfigWarning(`[Config] No development target for "${target}", using production`);
429
+ if (production && target) {
430
+ if (extendsRef) emitConfigWarning(`[Config] Resolving "${target}" from ${extendsRef}`);
431
+ else emitConfigWarning(`[Config] No development target for "${target}", using production`);
432
+ }
339
433
  return resolveRuntimeTarget(production, baseDir, "remote");
340
434
  }
341
435
  const devTarget = resolveRuntimeTarget(development, baseDir);
@@ -345,7 +439,7 @@ function resolveDevelopmentTarget(development, production, baseDir, forceSource,
345
439
  }
346
440
  return devTarget;
347
441
  }
348
- async function buildRuntimeConfig(config, baseDir, env, options) {
442
+ const buildRuntimeConfigEffect = Effect.fn("buildRuntimeConfig")(function* (config, baseDir, env, options) {
349
443
  const uiConfig = config.app.ui;
350
444
  const apiConfig = config.app.api;
351
445
  const authConfig = config.app.auth;
@@ -355,11 +449,40 @@ async function buildRuntimeConfig(config, baseDir, env, options) {
355
449
  const authRuntime = authConfig ? env === "development" ? resolveDevelopmentTarget(authConfig.development, authConfig.production, baseDir, options?.authSource, "app.auth", authExtendsRef) : resolveRuntimeTarget(authConfig.production, baseDir, "remote") : void 0;
356
450
  const hostConfig = config.app.host;
357
451
  const hostRuntime = env === "development" ? resolveDevelopmentTarget(hostConfig.development, hostConfig.production, baseDir, options?.hostSource, "app.host") : resolveRuntimeTarget(hostConfig.production, baseDir, "remote");
358
- const hostListeningUrl = env === "development" ? resolveDevelopmentHostUrl(hostConfig.development) : `http://localhost:${DEFAULT_HOST_PORT}`;
452
+ const hostListeningUrl = env === "development" ? resolveDevelopmentHostUrl(hostConfig.development) : `http://localhost:${getProcessEnv("PORT") ?? DEFAULT_HOST_PORT}`;
359
453
  const hostIsRemote = hostRuntime.source === "remote";
360
454
  const uiIsRemote = uiRuntime.source === "remote";
361
455
  const apiIsRemote = apiRuntime.source === "remote";
362
456
  const resolvedApiName = resolvePluginRuntimeName(apiConfig.name, apiRuntime.localPath, "api");
457
+ const authEntry = yield* Effect.tryPromise({
458
+ try: async () => {
459
+ if (!authConfig || !authRuntime) return void 0;
460
+ if (!authRuntime.localPath && !authRuntime.url) return void 0;
461
+ let authName = resolvePluginRuntimeName(authConfig.name, authRuntime.localPath, "auth");
462
+ if (authRuntime.source === "remote" && authRuntime.url && !authRuntime.localPath && typeof authConfig.name !== "string") authName = await resolveRemotePluginRuntimeName(authRuntime.url, authName);
463
+ return {
464
+ name: authName,
465
+ extendsRef: authExtendsRef,
466
+ url: authRuntime.url,
467
+ entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : "/mf-manifest.json",
468
+ localPath: authRuntime.localPath,
469
+ port: authRuntime.port,
470
+ source: authRuntime.source,
471
+ proxy: authConfig.proxy,
472
+ variables: authConfig.variables,
473
+ secrets: authConfig.secrets,
474
+ integrity: authRuntime.source === "remote" ? authConfig.integrity : void 0,
475
+ shared: authConfig.shared,
476
+ ui: buildRuntimeUiConfig("auth", env, getEntryAssociatedUi(authConfig), baseDir, authName, options?.authSource)
477
+ };
478
+ },
479
+ catch: (cause) => new ConfigExtendsError({
480
+ message: String(cause),
481
+ cause
482
+ })
483
+ });
484
+ const runtimePlugins = { ...options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : void 0 };
485
+ if (authEntry && !runtimePlugins.auth) runtimePlugins.auth = authEntry;
363
486
  const result = {
364
487
  env,
365
488
  account: config.account,
@@ -373,7 +496,7 @@ async function buildRuntimeConfig(config, baseDir, env, options) {
373
496
  url: hostListeningUrl,
374
497
  entry: `${hostListeningUrl}/mf-manifest.json`,
375
498
  localPath: hostRuntime.localPath,
376
- port: env === "development" ? parsePort(hostListeningUrl) : DEFAULT_HOST_PORT,
499
+ port: env === "development" ? parsePort(hostListeningUrl) : Number(getProcessEnv("PORT")) || DEFAULT_HOST_PORT,
377
500
  secrets: hostConfig.secrets,
378
501
  integrity: hostIsRemote ? hostConfig.integrity : void 0,
379
502
  source: hostRuntime.source,
@@ -383,6 +506,7 @@ async function buildRuntimeConfig(config, baseDir, env, options) {
383
506
  name: resolvePluginRuntimeName(uiConfig.name, uiRuntime.localPath, "ui"),
384
507
  url: uiRuntime.url,
385
508
  entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : "/mf-manifest.json",
509
+ publicUrl: typeof uiConfig.publicUrl === "string" ? uiConfig.publicUrl : void 0,
386
510
  localPath: uiRuntime.localPath,
387
511
  port: uiRuntime.port,
388
512
  ssrUrl: uiIsRemote ? uiConfig.ssr : void 0,
@@ -404,123 +528,190 @@ async function buildRuntimeConfig(config, baseDir, env, options) {
404
528
  shared: apiConfig.shared,
405
529
  dependsOn: apiConfig.dependsOn ? normalizeStringArray(apiConfig.dependsOn) : void 0
406
530
  },
407
- auth: (() => {
408
- if (!authConfig || !authRuntime) return void 0;
409
- if (!authRuntime.localPath && !authRuntime.url) return void 0;
410
- return {
411
- name: resolvePluginRuntimeName(authConfig.name, authRuntime.localPath, "auth"),
412
- extendsRef: authExtendsRef,
413
- url: authRuntime.url,
414
- entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : "/mf-manifest.json",
415
- localPath: authRuntime.localPath,
416
- port: authRuntime.port,
417
- source: authRuntime.source,
418
- proxy: authConfig.proxy,
419
- variables: authConfig.variables,
420
- secrets: authConfig.secrets,
421
- integrity: authRuntime.source === "remote" ? authConfig.integrity : void 0,
422
- shared: authConfig.shared
423
- };
424
- })(),
425
- plugins: options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : void 0
531
+ auth: authEntry,
532
+ plugins: Object.keys(runtimePlugins).length > 0 ? runtimePlugins : void 0
426
533
  };
427
- let manifestNodes = [];
428
- const manifestPluginEntries = [];
429
- if (result.api.source === "remote" && result.api.url) try {
430
- const manifest = await fetchApiPluginManifest(result.api.url);
431
- if (manifest.plugins?.length) {
432
- manifestNodes = manifestPluginsToNodes(manifest.plugins);
433
- for (const node of manifestNodes) if (!result.plugins?.[node.key]) {
434
- manifestPluginEntries.push({
435
- key: node.key,
436
- config: {
437
- name: node.name,
438
- url: node.url,
439
- entry: node.entry,
440
- source: "remote",
441
- dependsOn: node.dependsOn,
442
- secrets: node.secrets,
443
- variables: node.variables
534
+ yield* Effect.tryPromise({
535
+ try: async () => {
536
+ try {
537
+ if (result.api.source !== "remote" || !result.api.url) return;
538
+ const manifest = await fetchApiPluginManifest(result.api.url);
539
+ const manifestPluginEntries = [];
540
+ if (manifest.plugins?.length) {
541
+ for (const node of manifestPluginsToNodes(manifest.plugins)) if (!result.plugins?.[node.key]) {
542
+ manifestPluginEntries.push({
543
+ key: node.key,
544
+ config: {
545
+ name: node.name,
546
+ url: node.url,
547
+ entry: node.entry,
548
+ source: "remote",
549
+ dependsOn: node.dependsOn,
550
+ secrets: node.secrets,
551
+ variables: node.variables
552
+ }
553
+ });
554
+ if (node.secrets) {
555
+ for (const secretName of node.secrets) if (!getProcessEnv(secretName)) warnOutsideEffect(`[Config] Plugin "${node.key}" (discovered from manifest) expects secret "${secretName}" but it is not set in the environment.`);
556
+ }
444
557
  }
445
- });
446
- if (node.secrets) {
447
- for (const secretName of node.secrets) if (!process.env[secretName]) console.warn(`[Config] Plugin "${node.key}" (discovered from manifest) expects secret "${secretName}" but it is not set in the environment.`);
448
558
  }
559
+ if (manifest.dependsOn?.length) {
560
+ const existing = new Set(result.api.dependsOn ?? []);
561
+ for (const dep of manifest.dependsOn) if (!existing.has(dep)) result.api.dependsOn = [...result.api.dependsOn ?? [], dep];
562
+ }
563
+ if (manifestPluginEntries.length > 0) {
564
+ if (!result.plugins) result.plugins = {};
565
+ for (const { key, config: pluginConfig } of manifestPluginEntries) if (!result.plugins[key]) result.plugins[key] = pluginConfig;
566
+ }
567
+ } catch (error) {
568
+ const message = error instanceof Error ? error.message : String(error);
569
+ warnOutsideEffect(`[Config] Failed to fetch API plugin manifest for discovery: ${message}`);
449
570
  }
450
- }
451
- if (manifest.dependsOn?.length) {
452
- const existing = new Set(result.api.dependsOn ?? []);
453
- for (const dep of manifest.dependsOn) if (!existing.has(dep)) result.api.dependsOn = [...result.api.dependsOn ?? [], dep];
454
- }
455
- } catch (error) {
456
- const message = error instanceof Error ? error.message : String(error);
457
- console.warn(`[Config] Failed to fetch API plugin manifest for discovery: ${message}`);
571
+ },
572
+ catch: (cause) => new ConfigExtendsError({
573
+ message: String(cause),
574
+ cause
575
+ })
576
+ });
577
+ yield* Effect.tryPromise({
578
+ try: () => deriveVersionManifestFields(result, config, env),
579
+ catch: (cause) => new ConfigVersionManifestError({
580
+ message: String(cause),
581
+ cause
582
+ })
583
+ });
584
+ return result;
585
+ });
586
+ /**
587
+ * Version-manifest derivation (atomic-deploys 04): for every remote slot,
588
+ * resolve its `pin` (fetch + SRI-verify the pinned manifest, process-cached
589
+ * per pin) and stamp the derived entry-level fields — `entryUrl` (hashed
590
+ * container entry), the browser-manifest `entry`, and entry-level
591
+ * `integrity`/`ssrIntegrity`/`ssrEntryUrl` — so consumers load immutable
592
+ * hashed bytes without knowing the pointer indirection.
593
+ *
594
+ * Hard break: outside development every remote slot MUST pin a version
595
+ * manifest — an unpinned remote slot fails resolution loudly (the deploy
596
+ * train pins every workspace it uploads; a manifest-less slot means a
597
+ * pre-atomic-deploy config).
598
+ */
599
+ async function deriveVersionManifestFields(result, config, env) {
600
+ if (env === "development") return;
601
+ const derive = async (label, slotConfig, slot, apply) => {
602
+ if (!slot || slot.source !== "remote" || !slot.url) return;
603
+ const slotWithProduction = slotConfig;
604
+ if (!slotWithProduction || slotWithProduction.production === void 0) return;
605
+ const rawPin = slotConfig?.pin;
606
+ const pin = rawPin && typeof rawPin.manifest === "string" && rawPin.manifest && typeof rawPin.integrity === "string" && rawPin.integrity ? {
607
+ manifest: rawPin.manifest,
608
+ integrity: rawPin.integrity
609
+ } : void 0;
610
+ if (!pin) throw new Error(`slot "${label}" (${slot.url}) pins no version manifest — remote slots must pin a version manifest outside development (pre-atomic-deploy config; redeploy required)`);
611
+ apply(await resolveSlotVersion({
612
+ base: slot.remoteUrl ?? slot.url,
613
+ pin
614
+ }));
615
+ };
616
+ const applyUi = (ui, r) => {
617
+ if (!ui) return;
618
+ ui.entryUrl = r.entryUrl;
619
+ ui.entry = r.browserManifestUrl ?? ui.entry;
620
+ ui.browserManifestUrl = r.browserManifestUrl;
621
+ ui.integrity = r.entryIntegrity;
622
+ ui.ssrEntryUrl = r.ssrEntryUrl;
623
+ ui.ssrIntegrity = r.ssrIntegrity ?? ui.ssrIntegrity;
624
+ };
625
+ await derive("app.host", config.app.host, result.host, (r) => {
626
+ result.host.entryUrl = r.entryUrl;
627
+ result.host.integrity = r.entryIntegrity;
628
+ });
629
+ await derive("app.ui", config.app.ui, result.ui, (r) => applyUi(result.ui, r));
630
+ await derive("app.api", config.app.api, result.api, (r) => {
631
+ result.api.entryUrl = r.entryUrl;
632
+ result.api.integrity = r.entryIntegrity;
633
+ });
634
+ if (result.auth) {
635
+ await derive("app.auth", config.app.auth, result.auth, (r) => {
636
+ result.auth.entryUrl = r.entryUrl;
637
+ result.auth.integrity = r.entryIntegrity;
638
+ });
639
+ await derive("app.auth.ui", getEntryAssociatedUi(config.app.auth), result.auth.ui, (r) => applyUi(result.auth.ui, r));
458
640
  }
459
- if (manifestPluginEntries.length > 0) {
460
- if (!result.plugins) result.plugins = {};
461
- for (const { key, config } of manifestPluginEntries) if (!result.plugins[key]) result.plugins[key] = config;
641
+ for (const [key, plugin] of Object.entries(result.plugins ?? {})) {
642
+ let pluginConfig = config.plugins?.[key];
643
+ const isAuthMirror = key === "auth" && result.auth && (plugin === result.auth || plugin.url === result.auth.url);
644
+ if ((!pluginConfig || typeof pluginConfig === "string") && isAuthMirror) pluginConfig = config.app.auth;
645
+ if (!pluginConfig || typeof pluginConfig === "string") continue;
646
+ await derive(`plugins.${key}`, pluginConfig, plugin, (r) => {
647
+ plugin.entryUrl = r.entryUrl;
648
+ plugin.integrity = r.entryIntegrity;
649
+ });
650
+ await derive(`plugins.${key}.ui`, getEntryAssociatedUi(pluginConfig), plugin.ui, (r) => applyUi(plugin.ui, r));
462
651
  }
463
- return result;
464
652
  }
465
- async function loadConfigFile(configPath, baseDir) {
653
+ async function buildRuntimeConfig(config, baseDir, env, options) {
654
+ return Effect.runPromise(buildRuntimeConfigEffect(config, baseDir, env, options));
655
+ }
656
+ async function readConfigInput(configPath, baseDir) {
466
657
  if (configPath.startsWith("bos://")) return fetchBosConfigFromFastKv(configPath);
467
658
  const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);
659
+ if (isAppDescriptorPath(resolvedPath)) return loadAppDescriptorConfig(resolvedPath);
468
660
  return JSON.parse(readFileSync(resolvedPath, "utf-8"));
469
661
  }
470
- async function resolveConfigWithExtends(configPath, baseDir, visited, chain, env = "development") {
471
- if (visited.has(configPath)) throw new Error(`Circular extends detected: ${[...visited, configPath].join(" -> ")}`);
472
- const config = await loadConfigFile(configPath, baseDir);
473
- chain.push(configPath);
474
- if (!config.extends) return config;
475
- const extendsRef = resolveExtendsRef(config.extends, env);
476
- if (!extendsRef) return config;
477
- const parsedParentRef = parseExtendsTarget(extendsRef);
478
- const nextVisited = new Set(visited);
479
- nextVisited.add(configPath);
480
- const parentBaseDir = getConfigBaseDir(parsedParentRef.configPath, baseDir);
481
- return mergeBosConfigWithExtends(await resolveConfigWithExtends(parsedParentRef.configPath, parentBaseDir, nextVisited, chain, env), config);
482
- }
483
662
  function normalizePluginEntry(raw) {
484
663
  if (raw === null || raw === false) return raw;
485
664
  if (typeof raw === "string") return { extends: raw };
486
665
  return raw;
487
666
  }
488
- async function resolveRuntimePlugins(plugins, baseDir, env, remotePlugins) {
667
+ const resolveRuntimePluginsEffect = Effect.fn("resolveRuntimePlugins")(function* (plugins, baseDir, env, remotePlugins) {
489
668
  const entries = Object.entries(plugins).map(([pluginId, rawInput]) => ({
490
669
  pluginId,
491
670
  normalized: normalizePluginEntry(rawInput)
492
671
  })).filter((entry) => entry.normalized !== null && entry.normalized !== false);
493
- const resolved = await Promise.all(entries.map(async ({ pluginId, normalized }) => {
494
- const resolvedReference = await resolveComposableReference(normalized, baseDir, env, `plugins.${pluginId}`);
672
+ const resolved = yield* Effect.forEach(entries, ({ pluginId, normalized }) => Effect.gen(function* () {
673
+ const resolvedReference = yield* Effect.tryPromise({
674
+ try: () => resolveComposableReference(normalized, baseDir, env, `plugins.${pluginId}`),
675
+ catch: (cause) => new ConfigExtendsError({
676
+ message: String(cause),
677
+ cause
678
+ })
679
+ });
495
680
  const forceSource = remotePlugins === void 0 ? void 0 : remotePlugins.length === 0 || remotePlugins.includes(pluginId) ? "remote" : void 0;
496
681
  const pluginRuntime = buildRuntimePluginConfig(pluginId, env, resolvedReference, forceSource);
497
682
  if (!pluginRuntime.localPath && !pluginRuntime.url) {
498
683
  if (forceSource === "remote") emitConfigWarning(`[Config] Plugin "${pluginId}" has no production URL in bos.config.json and cannot be resolved as remote. Add a "production" field or remove it from --remote-plugins.`);
499
684
  return null;
500
685
  }
501
- if (pluginRuntime.source === "remote" && pluginRuntime.url && !pluginRuntime.localPath && typeof resolvedReference.entry.name !== "string") pluginRuntime.name = await resolveRemotePluginRuntimeName(pluginRuntime.url, pluginRuntime.name);
686
+ if (pluginRuntime.source === "remote" && pluginRuntime.url && !pluginRuntime.localPath && typeof resolvedReference.entry.name !== "string") pluginRuntime.name = yield* Effect.tryPromise({
687
+ try: () => resolveRemotePluginRuntimeName(pluginRuntime.url, pluginRuntime.name),
688
+ catch: (cause) => new ConfigExtendsError({
689
+ message: String(cause),
690
+ cause
691
+ })
692
+ });
502
693
  return [pluginId, pluginRuntime];
503
- }));
694
+ }), { concurrency: "unbounded" });
504
695
  const out = {};
505
696
  for (const entry of resolved) if (entry) out[entry[0]] = entry[1];
506
697
  return out;
698
+ });
699
+ function resolveRuntimePlugins(plugins, baseDir, env, remotePlugins) {
700
+ return Effect.runPromise(resolveRuntimePluginsEffect(plugins, baseDir, env, remotePlugins));
507
701
  }
508
702
  async function resolveRemotePluginRuntimeName(baseUrl, fallback) {
509
- const manifest = await fetchJsonOrNull(`${baseUrl.replace(/\/$/, "")}/plugin.manifest.json`, { retries: 0 });
703
+ const manifest = await fetchJsonOrNull(`${baseUrl.replace(/\/$/, "")}/plugin.manifest.json`, { retries: 2 });
510
704
  return typeof manifest?.plugin?.name === "string" && manifest.plugin.name.length > 0 ? manifest.plugin.name : fallback;
511
705
  }
512
706
  function buildRuntimePluginConfig(pluginId, env, resolved, forceSource) {
513
707
  const source = resolved.entry;
514
708
  const development = typeof source.development === "string" ? source.development : void 0;
515
709
  const production = typeof source.production === "string" ? source.production : void 0;
516
- if (production?.startsWith("bos://")) throw new Error(`Plugin "${pluginId}" has unsupported production target "${production}". Use extends: "bos://account/domain" for plugin configs or a CDN URL for production.`);
710
+ if (production?.startsWith("bos://")) throw new ConfigExtendsError({ message: `Plugin "${pluginId}" has unsupported production target "${production}". Use extends: "bos://account/domain" for plugin configs or a CDN URL for production.` });
517
711
  const pluginExtendsRef = source.extends ? resolveExtendsRef(source.extends, env) : void 0;
518
712
  const runtimeTarget = env === "development" ? resolveDevelopmentTarget(development, production, resolved.providerBaseDir, forceSource, `plugins.${pluginId}`, pluginExtendsRef) : resolveRuntimeTarget(production, resolved.providerBaseDir, "remote");
519
713
  const apiName = resolvePluginRuntimeName(source.name, runtimeTarget.localPath, pluginId);
520
- const uiConfig = resolved.associatedUi;
521
- const uiDevelopment = typeof uiConfig?.development === "string" ? uiConfig.development : void 0;
522
- const uiProduction = typeof uiConfig?.production === "string" ? uiConfig.production : void 0;
523
- const uiRuntime = uiConfig && (uiDevelopment || uiProduction) ? env === "development" ? resolveDevelopmentTarget(uiDevelopment, uiProduction, resolved.providerBaseDir, forceSource, `plugins.${pluginId}.ui`) : resolveRuntimeTarget(uiProduction, resolved.providerBaseDir, "remote") : void 0;
714
+ const ui = buildRuntimeUiConfig(pluginId, env, resolved.associatedUi, resolved.providerBaseDir, apiName, forceSource);
524
715
  const routes = source.routes;
525
716
  return {
526
717
  name: apiName,
@@ -536,19 +727,55 @@ function buildRuntimePluginConfig(pluginId, env, resolved, forceSource) {
536
727
  shared: source.shared,
537
728
  connectSrc: normalizeStringArray(source.connectSrc),
538
729
  integrity: runtimeTarget.source === "remote" ? source.integrity : void 0,
539
- ui: uiRuntime ? {
540
- name: typeof uiConfig?.name === "string" ? uiConfig.name : `${apiName}-ui`,
541
- url: uiRuntime.url,
542
- entry: uiRuntime.url ? `${uiRuntime.url.replace(/\/$/, "")}/mf-manifest.json` : "/mf-manifest.json",
543
- source: uiRuntime.source,
544
- localPath: uiRuntime.localPath,
545
- port: uiRuntime.port,
546
- integrity: uiRuntime.source === "remote" && typeof uiConfig?.integrity === "string" ? uiConfig.integrity : void 0
547
- } : void 0,
730
+ ui,
548
731
  routes,
549
732
  dependsOn: source.dependsOn ? normalizeStringArray(source.dependsOn) : void 0
550
733
  };
551
734
  }
735
+ /**
736
+ * Resolve a plugin entry's associated ui surface (`plugins.<id>.ui` / legacy
737
+ * `plugins.<id>.app.ui`) into the runtime ui config. Extracted so app-slot
738
+ * entries (app.auth) resolve their ui the same way.
739
+ */
740
+ function buildRuntimeUiConfig(pluginId, env, uiConfig, providerBaseDir, apiName, forceSource) {
741
+ const uiDevelopment = typeof uiConfig?.development === "string" ? uiConfig.development : void 0;
742
+ const uiProduction = typeof uiConfig?.production === "string" ? uiConfig.production : void 0;
743
+ const uiRuntime = uiConfig && (uiDevelopment || uiProduction) ? env === "development" ? resolveDevelopmentTarget(uiDevelopment, uiProduction, providerBaseDir, forceSource, `plugins.${pluginId}.ui`) : resolveRuntimeTarget(uiProduction, providerBaseDir, "remote") : void 0;
744
+ if (!uiRuntime) return void 0;
745
+ if (uiRuntime.source === "remote" && !uiRuntime.url) return void 0;
746
+ return {
747
+ name: resolveUiRuntimeName(uiConfig, uiRuntime.localPath, apiName),
748
+ url: uiRuntime.url,
749
+ entry: uiRuntime.url ? `${uiRuntime.url.replace(/\/$/, "")}/mf-manifest.json` : "/mf-manifest.json",
750
+ source: uiRuntime.source,
751
+ publicUrl: typeof uiConfig?.publicUrl === "string" ? uiConfig.publicUrl : void 0,
752
+ localPath: uiRuntime.localPath,
753
+ port: uiRuntime.port,
754
+ integrity: uiRuntime.source === "remote" && typeof uiConfig?.integrity === "string" ? uiConfig.integrity : void 0,
755
+ ssrUrl: uiRuntime.source === "remote" && typeof uiConfig?.ssr === "string" ? uiConfig.ssr : uiRuntime.source === "local" ? uiRuntime.url : void 0,
756
+ ssrIntegrity: uiRuntime.source === "remote" && typeof uiConfig?.ssrIntegrity === "string" ? uiConfig.ssrIntegrity : void 0
757
+ };
758
+ }
759
+ /**
760
+ * MF container identity must match the build: folder-form plugin ui sources
761
+ * build under the sanitized plugin workspace package name (the generated
762
+ * rsbuild config imports the plugin's package.json), so derive the same
763
+ * value here — an authored `ui.name` is only a fallback, and can never
764
+ * override what the container actually registers under.
765
+ */
766
+ function resolveUiRuntimeName(uiConfig, localPath, apiName) {
767
+ if (localPath) {
768
+ const uiPkgPath = join(localPath, "package.json");
769
+ const pkgPath = existsSync(uiPkgPath) ? uiPkgPath : join(dirname(localPath), "package.json");
770
+ try {
771
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
772
+ if (typeof pkg.name === "string" && pkg.name.length > 0) return sanitizeContainerName(pkg.name);
773
+ } catch (e) {
774
+ console.warn(`[Config] Could not read package.json at ${pkgPath}: ${e}`);
775
+ }
776
+ }
777
+ return typeof uiConfig?.name === "string" ? uiConfig.name : `${apiName}-ui`;
778
+ }
552
779
  function resolvePluginRuntimeName(explicitName, localPath, fallback) {
553
780
  if (explicitName) return explicitName;
554
781
  if (!localPath) return fallback;
@@ -594,7 +821,7 @@ function resolveRuntimeTarget(value, baseDir, defaultSource = "remote") {
594
821
  };
595
822
  if (value.startsWith(LOCAL_PREFIX)) {
596
823
  const localTarget = value?.slice(6).trim();
597
- if (!localTarget) throw new Error(`Invalid local development target: ${value}`);
824
+ if (!localTarget) throw new ConfigExtendsError({ message: `Invalid local development target: ${value}` });
598
825
  const localPath = resolve(baseDir, localTarget);
599
826
  if (!existsSync(localPath)) return {
600
827
  source: "local",
@@ -637,5 +864,5 @@ function parsePort(url) {
637
864
  }
638
865
 
639
866
  //#endregion
640
- export { BOS_CONFIG_ORDER, BosConfigSchema, buildRuntimeConfig, buildRuntimePluginsForConfig, clearConfigCache, drainConfigWarnings, findConfigPath, getConfig, getHostDevelopmentPort, getProjectRoot, getResolvedConfigPath, isLocalDevelopmentTarget, isRuntimeOverrideAllowed, loadBosConfig, loadGeneratedResolvedConfig, loadLocalConfig, loadRemoteConfig, loadResolvedConfig, mergeBosConfigWithExtends, parsePort, parseRuntimeOverrideTargets, readBosConfigForBuild, rebuildOrderedConfig, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resumeWarnings, suppressWarnings, writeResolvedConfig };
867
+ export { BOS_CONFIG_ORDER, BosConfigSchema, CircularExtendsError, ConfigExtendsError, ConfigLoadError, ConfigNotfoundError, ConfigVersionManifestError, DEV_OVERLAY_FILENAME, DevOverlayError, MISSING_CONFIG_MESSAGE, buildRuntimeConfig, buildRuntimeConfigEffect, buildRuntimePluginsForConfig, defaultConfigEnv, findConfigPath, getConfigBaseDir, getHostDevelopmentPort, getResolvedConfigPath, isAppDescriptorPath, isLocalDevelopmentTarget, isRuntimeOverrideAllowed, loadAppDescriptorConfig, loadGeneratedResolvedConfig, localConfigEntryPath, mergeBosConfigWithExtends, parseAppDescriptorModule, parseDevOverlayModule, parseExtendsTarget, parsePort, parseRuntimeOverrideTargets, readAuthoredConfigInput, readBosConfigForBuild, readLocalAuthoredConfigInput, rebuildOrderedConfig, resetConfigPathCache, resolveBosConfigPath, resolveComposableReference, resolveConfigComposableEntries, resolveDevelopmentHostUrl, resolveExtendsRef, resolveLocalDevelopmentPath, resolvePluginRuntimeName, resolveUiRuntimeName, runWithConfigWarningSink, writeResolvedConfig };
641
868
  //# sourceMappingURL=config.mjs.map