every-plugin 2.10.0 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/bin/every-plugin-serve.mjs +12 -0
  2. package/bin/every-plugin.mjs +59 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +1 -2
  4. package/dist/build/artifact-names.cjs +119 -0
  5. package/dist/build/artifact-names.cjs.map +1 -0
  6. package/dist/build/artifact-names.d.cts +68 -0
  7. package/dist/build/artifact-names.d.cts.map +1 -0
  8. package/dist/build/artifact-names.d.mts +68 -0
  9. package/dist/build/artifact-names.d.mts.map +1 -0
  10. package/dist/build/artifact-names.mjs +102 -0
  11. package/dist/build/artifact-names.mjs.map +1 -0
  12. package/dist/build/contract-types.cjs +89 -0
  13. package/dist/build/contract-types.cjs.map +1 -0
  14. package/dist/build/contract-types.mjs +81 -0
  15. package/dist/build/contract-types.mjs.map +1 -0
  16. package/dist/build/rspack/build-report-plugin.cjs +37 -0
  17. package/dist/build/rspack/build-report-plugin.cjs.map +1 -0
  18. package/dist/build/rspack/build-report-plugin.d.cts +18 -0
  19. package/dist/build/rspack/build-report-plugin.d.cts.map +1 -0
  20. package/dist/build/rspack/build-report-plugin.d.mts +18 -0
  21. package/dist/build/rspack/build-report-plugin.d.mts.map +1 -0
  22. package/dist/build/rspack/build-report-plugin.mjs +37 -0
  23. package/dist/build/rspack/build-report-plugin.mjs.map +1 -0
  24. package/dist/build/rspack/chunk-completeness-plugin.cjs +47 -0
  25. package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
  26. package/dist/build/rspack/chunk-completeness-plugin.mjs +47 -0
  27. package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -0
  28. package/dist/build/rspack/compose.cjs +69 -0
  29. package/dist/build/rspack/compose.cjs.map +1 -0
  30. package/dist/build/rspack/compose.d.cts +20 -0
  31. package/dist/build/rspack/compose.d.cts.map +1 -0
  32. package/dist/build/rspack/compose.d.mts +20 -0
  33. package/dist/build/rspack/compose.d.mts.map +1 -0
  34. package/dist/build/rspack/compose.mjs +65 -0
  35. package/dist/build/rspack/compose.mjs.map +1 -0
  36. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +11 -11
  37. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
  38. package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +2 -0
  39. package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
  40. package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +2 -0
  41. package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
  42. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +11 -10
  43. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
  44. package/dist/build/rspack/generated-config.cjs +35 -0
  45. package/dist/build/rspack/generated-config.cjs.map +1 -0
  46. package/dist/build/rspack/generated-config.mjs +32 -0
  47. package/dist/build/rspack/generated-config.mjs.map +1 -0
  48. package/dist/build/rspack/index.cjs +8 -5
  49. package/dist/build/rspack/index.d.cts +5 -3
  50. package/dist/build/rspack/index.d.mts +5 -3
  51. package/dist/build/rspack/index.mjs +5 -3
  52. package/dist/build/rspack/module-federation.cjs +2 -2
  53. package/dist/build/rspack/module-federation.cjs.map +1 -1
  54. package/dist/build/rspack/module-federation.mjs +1 -1
  55. package/dist/build/rspack/module-federation.mjs.map +1 -1
  56. package/dist/build/rspack/plugin.cjs +44 -69
  57. package/dist/build/rspack/plugin.cjs.map +1 -1
  58. package/dist/build/rspack/plugin.d.cts +4 -13
  59. package/dist/build/rspack/plugin.d.cts.map +1 -1
  60. package/dist/build/rspack/plugin.d.mts +4 -13
  61. package/dist/build/rspack/plugin.d.mts.map +1 -1
  62. package/dist/build/rspack/plugin.mjs +44 -69
  63. package/dist/build/rspack/plugin.mjs.map +1 -1
  64. package/dist/build/rspack/utils.cjs +7 -5
  65. package/dist/build/rspack/utils.cjs.map +1 -1
  66. package/dist/build/rspack/utils.mjs +7 -6
  67. package/dist/build/rspack/utils.mjs.map +1 -1
  68. package/dist/build/ui/factory.cjs +88 -0
  69. package/dist/build/ui/factory.cjs.map +1 -0
  70. package/dist/build/ui/factory.d.cts +11 -0
  71. package/dist/build/ui/factory.d.cts.map +1 -0
  72. package/dist/build/ui/factory.d.mts +11 -0
  73. package/dist/build/ui/factory.d.mts.map +1 -0
  74. package/dist/build/ui/factory.mjs +80 -0
  75. package/dist/build/ui/factory.mjs.map +1 -0
  76. package/dist/build/ui/generated-config.cjs +118 -0
  77. package/dist/build/ui/generated-config.cjs.map +1 -0
  78. package/dist/build/ui/generated-config.d.cts +33 -0
  79. package/dist/build/ui/generated-config.d.cts.map +1 -0
  80. package/dist/build/ui/generated-config.d.mts +33 -0
  81. package/dist/build/ui/generated-config.d.mts.map +1 -0
  82. package/dist/build/ui/generated-config.mjs +111 -0
  83. package/dist/build/ui/generated-config.mjs.map +1 -0
  84. package/dist/build/ui/hash-artifacts-plugin.cjs +61 -0
  85. package/dist/build/ui/hash-artifacts-plugin.cjs.map +1 -0
  86. package/dist/build/ui/hash-artifacts-plugin.d.cts +20 -0
  87. package/dist/build/ui/hash-artifacts-plugin.d.cts.map +1 -0
  88. package/dist/build/ui/hash-artifacts-plugin.d.mts +20 -0
  89. package/dist/build/ui/hash-artifacts-plugin.d.mts.map +1 -0
  90. package/dist/build/ui/hash-artifacts-plugin.mjs +58 -0
  91. package/dist/build/ui/hash-artifacts-plugin.mjs.map +1 -0
  92. package/dist/build/ui/index.cjs +90 -0
  93. package/dist/build/ui/index.cjs.map +1 -0
  94. package/dist/build/ui/index.d.cts +29 -0
  95. package/dist/build/ui/index.d.cts.map +1 -0
  96. package/dist/build/ui/index.d.mts +29 -0
  97. package/dist/build/ui/index.d.mts.map +1 -0
  98. package/dist/build/ui/index.mjs +68 -0
  99. package/dist/build/ui/index.mjs.map +1 -0
  100. package/dist/build/ui/manifest-plugin.cjs +37 -0
  101. package/dist/build/ui/manifest-plugin.cjs.map +1 -0
  102. package/dist/build/ui/manifest-plugin.d.cts +19 -0
  103. package/dist/build/ui/manifest-plugin.d.cts.map +1 -0
  104. package/dist/build/ui/manifest-plugin.d.mts +19 -0
  105. package/dist/build/ui/manifest-plugin.d.mts.map +1 -0
  106. package/dist/build/ui/manifest-plugin.mjs +37 -0
  107. package/dist/build/ui/manifest-plugin.mjs.map +1 -0
  108. package/dist/build/ui/rsbuild-config.cjs +203 -0
  109. package/dist/build/ui/rsbuild-config.cjs.map +1 -0
  110. package/dist/build/ui/rsbuild-config.d.cts +45 -0
  111. package/dist/build/ui/rsbuild-config.d.cts.map +1 -0
  112. package/dist/build/ui/rsbuild-config.d.mts +45 -0
  113. package/dist/build/ui/rsbuild-config.d.mts.map +1 -0
  114. package/dist/build/ui/rsbuild-config.mjs +200 -0
  115. package/dist/build/ui/rsbuild-config.mjs.map +1 -0
  116. package/dist/build/ui/stubs.cjs +107 -0
  117. package/dist/build/ui/stubs.cjs.map +1 -0
  118. package/dist/build/ui/stubs.d.cts +25 -0
  119. package/dist/build/ui/stubs.d.cts.map +1 -0
  120. package/dist/build/ui/stubs.d.mts +25 -0
  121. package/dist/build/ui/stubs.d.mts.map +1 -0
  122. package/dist/build/ui/stubs.mjs +106 -0
  123. package/dist/build/ui/stubs.mjs.map +1 -0
  124. package/dist/cli.cjs +83 -0
  125. package/dist/cli.cjs.map +1 -0
  126. package/dist/cli.d.cts +6 -0
  127. package/dist/cli.d.cts.map +1 -0
  128. package/dist/cli.d.mts +6 -0
  129. package/dist/cli.d.mts.map +1 -0
  130. package/dist/cli.mjs +82 -0
  131. package/dist/cli.mjs.map +1 -0
  132. package/dist/dev/serve.cjs +390 -0
  133. package/dist/dev/serve.cjs.map +1 -0
  134. package/dist/dev/serve.d.cts +23 -0
  135. package/dist/dev/serve.d.cts.map +1 -0
  136. package/dist/dev/serve.d.mts +23 -0
  137. package/dist/dev/serve.d.mts.map +1 -0
  138. package/dist/dev/serve.mjs +384 -0
  139. package/dist/dev/serve.mjs.map +1 -0
  140. package/dist/dev/watch-kill.cjs +39 -0
  141. package/dist/dev/watch-kill.cjs.map +1 -0
  142. package/dist/dev/watch-kill.mjs +38 -0
  143. package/dist/dev/watch-kill.mjs.map +1 -0
  144. package/dist/effect-helpers.cjs +23 -0
  145. package/dist/effect-helpers.cjs.map +1 -0
  146. package/dist/effect-helpers.d.cts +20 -0
  147. package/dist/effect-helpers.d.cts.map +1 -0
  148. package/dist/effect-helpers.d.mts +20 -0
  149. package/dist/effect-helpers.d.mts.map +1 -0
  150. package/dist/effect-helpers.mjs +22 -0
  151. package/dist/effect-helpers.mjs.map +1 -0
  152. package/dist/errors.cjs +49 -69
  153. package/dist/errors.cjs.map +1 -1
  154. package/dist/errors.d.cts +13 -96
  155. package/dist/errors.d.cts.map +1 -1
  156. package/dist/errors.d.mts +13 -96
  157. package/dist/errors.d.mts.map +1 -1
  158. package/dist/errors.mjs +16 -34
  159. package/dist/errors.mjs.map +1 -1
  160. package/dist/identity.cjs +19 -0
  161. package/dist/identity.cjs.map +1 -0
  162. package/dist/identity.d.cts +33 -0
  163. package/dist/identity.d.cts.map +1 -0
  164. package/dist/identity.d.mts +33 -0
  165. package/dist/identity.d.mts.map +1 -0
  166. package/dist/identity.mjs +16 -0
  167. package/dist/identity.mjs.map +1 -0
  168. package/dist/index.cjs +8 -5
  169. package/dist/index.d.cts +8 -6
  170. package/dist/index.d.mts +8 -6
  171. package/dist/index.mjs +6 -4
  172. package/dist/plugin.cjs +12 -26
  173. package/dist/plugin.cjs.map +1 -1
  174. package/dist/plugin.d.cts +44 -25
  175. package/dist/plugin.d.cts.map +1 -1
  176. package/dist/plugin.d.mts +45 -26
  177. package/dist/plugin.d.mts.map +1 -1
  178. package/dist/plugin.mjs +15 -29
  179. package/dist/plugin.mjs.map +1 -1
  180. package/dist/remote-entry.cjs +103 -0
  181. package/dist/remote-entry.cjs.map +1 -0
  182. package/dist/remote-entry.d.cts +53 -0
  183. package/dist/remote-entry.d.cts.map +1 -0
  184. package/dist/remote-entry.d.mts +53 -0
  185. package/dist/remote-entry.d.mts.map +1 -0
  186. package/dist/remote-entry.mjs +98 -0
  187. package/dist/remote-entry.mjs.map +1 -0
  188. package/dist/runtime/errors.cjs +140 -34
  189. package/dist/runtime/errors.cjs.map +1 -1
  190. package/dist/runtime/errors.d.cts +42 -7
  191. package/dist/runtime/errors.d.cts.map +1 -1
  192. package/dist/runtime/errors.d.mts +42 -7
  193. package/dist/runtime/errors.d.mts.map +1 -1
  194. package/dist/runtime/errors.mjs +136 -31
  195. package/dist/runtime/errors.mjs.map +1 -1
  196. package/dist/runtime/index.cjs +95 -23
  197. package/dist/runtime/index.cjs.map +1 -1
  198. package/dist/runtime/index.d.cts +16 -0
  199. package/dist/runtime/index.d.cts.map +1 -1
  200. package/dist/runtime/index.d.mts +16 -0
  201. package/dist/runtime/index.d.mts.map +1 -1
  202. package/dist/runtime/index.mjs +98 -26
  203. package/dist/runtime/index.mjs.map +1 -1
  204. package/dist/runtime/mf-config.cjs +3 -78
  205. package/dist/runtime/mf-config.cjs.map +1 -1
  206. package/dist/runtime/mf-config.d.cts +3 -49
  207. package/dist/runtime/mf-config.d.cts.map +1 -1
  208. package/dist/runtime/mf-config.d.mts +3 -49
  209. package/dist/runtime/mf-config.d.mts.map +1 -1
  210. package/dist/runtime/mf-config.mjs +5 -78
  211. package/dist/runtime/mf-config.mjs.map +1 -1
  212. package/dist/runtime/services/module-federation.service.cjs +63 -12
  213. package/dist/runtime/services/module-federation.service.cjs.map +1 -1
  214. package/dist/runtime/services/module-federation.service.d.cts +4 -13
  215. package/dist/runtime/services/module-federation.service.d.mts +4 -13
  216. package/dist/runtime/services/module-federation.service.mjs +63 -14
  217. package/dist/runtime/services/module-federation.service.mjs.map +1 -1
  218. package/dist/runtime/services/normalize.cjs +2 -22
  219. package/dist/runtime/services/normalize.d.cts +2 -21
  220. package/dist/runtime/services/normalize.d.mts +2 -21
  221. package/dist/runtime/services/normalize.mjs +2 -21
  222. package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
  223. package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
  224. package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
  225. package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
  226. package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
  227. package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
  228. package/dist/runtime/services/plugin-loader.service.cjs +30 -29
  229. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
  230. package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
  231. package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
  232. package/dist/runtime/services/plugin-loader.service.mjs +29 -30
  233. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
  234. package/dist/runtime/services/plugin.service.cjs +10 -12
  235. package/dist/runtime/services/plugin.service.cjs.map +1 -1
  236. package/dist/runtime/services/plugin.service.d.cts +14 -36
  237. package/dist/runtime/services/plugin.service.d.cts.map +1 -1
  238. package/dist/runtime/services/plugin.service.d.mts +14 -36
  239. package/dist/runtime/services/plugin.service.d.mts.map +1 -1
  240. package/dist/runtime/services/plugin.service.mjs +14 -18
  241. package/dist/runtime/services/plugin.service.mjs.map +1 -1
  242. package/dist/runtime/services/secrets.service.cjs +12 -12
  243. package/dist/runtime/services/secrets.service.cjs.map +1 -1
  244. package/dist/runtime/services/secrets.service.d.cts +3 -15
  245. package/dist/runtime/services/secrets.service.d.mts +3 -15
  246. package/dist/runtime/services/secrets.service.mjs +12 -13
  247. package/dist/runtime/services/secrets.service.mjs.map +1 -1
  248. package/dist/runtime/services/shared-identity.cjs +40 -0
  249. package/dist/runtime/services/shared-identity.cjs.map +1 -0
  250. package/dist/runtime/services/shared-identity.mjs +38 -0
  251. package/dist/runtime/services/shared-identity.mjs.map +1 -0
  252. package/dist/runtime/validation.cjs +2 -2
  253. package/dist/runtime/validation.cjs.map +1 -1
  254. package/dist/runtime/validation.mjs +2 -2
  255. package/dist/runtime/validation.mjs.map +1 -1
  256. package/dist/shared-deps-spec.cjs +384 -0
  257. package/dist/shared-deps-spec.cjs.map +1 -0
  258. package/dist/shared-deps-spec.d.cts +182 -0
  259. package/dist/shared-deps-spec.d.cts.map +1 -0
  260. package/dist/shared-deps-spec.d.mts +182 -0
  261. package/dist/shared-deps-spec.d.mts.map +1 -0
  262. package/dist/shared-deps-spec.mjs +368 -0
  263. package/dist/shared-deps-spec.mjs.map +1 -0
  264. package/dist/types.d.cts +22 -41
  265. package/dist/types.d.cts.map +1 -1
  266. package/dist/types.d.mts +22 -41
  267. package/dist/types.d.mts.map +1 -1
  268. package/dist/ui/manifest/construct.cjs +268 -0
  269. package/dist/ui/manifest/construct.cjs.map +1 -0
  270. package/dist/ui/manifest/construct.d.cts +48 -0
  271. package/dist/ui/manifest/construct.d.cts.map +1 -0
  272. package/dist/ui/manifest/construct.d.mts +48 -0
  273. package/dist/ui/manifest/construct.d.mts.map +1 -0
  274. package/dist/ui/manifest/construct.mjs +268 -0
  275. package/dist/ui/manifest/construct.mjs.map +1 -0
  276. package/dist/ui/manifest/contract.cjs +34 -0
  277. package/dist/ui/manifest/contract.cjs.map +1 -0
  278. package/dist/ui/manifest/contract.d.cts +26 -0
  279. package/dist/ui/manifest/contract.d.cts.map +1 -0
  280. package/dist/ui/manifest/contract.d.mts +26 -0
  281. package/dist/ui/manifest/contract.d.mts.map +1 -0
  282. package/dist/ui/manifest/contract.mjs +26 -0
  283. package/dist/ui/manifest/contract.mjs.map +1 -0
  284. package/dist/ui/manifest/descriptor.cjs +64 -0
  285. package/dist/ui/manifest/descriptor.cjs.map +1 -0
  286. package/dist/ui/manifest/descriptor.d.cts +60 -0
  287. package/dist/ui/manifest/descriptor.d.cts.map +1 -0
  288. package/dist/ui/manifest/descriptor.d.mts +60 -0
  289. package/dist/ui/manifest/descriptor.d.mts.map +1 -0
  290. package/dist/ui/manifest/descriptor.mjs +61 -0
  291. package/dist/ui/manifest/descriptor.mjs.map +1 -0
  292. package/dist/ui/manifest/generator.cjs +128 -0
  293. package/dist/ui/manifest/generator.cjs.map +1 -0
  294. package/dist/ui/manifest/generator.d.cts +41 -0
  295. package/dist/ui/manifest/generator.d.cts.map +1 -0
  296. package/dist/ui/manifest/generator.d.mts +41 -0
  297. package/dist/ui/manifest/generator.d.mts.map +1 -0
  298. package/dist/ui/manifest/generator.mjs +125 -0
  299. package/dist/ui/manifest/generator.mjs.map +1 -0
  300. package/dist/ui/manifest/index.cjs +35 -0
  301. package/dist/ui/manifest/index.d.cts +9 -0
  302. package/dist/ui/manifest/index.d.mts +9 -0
  303. package/dist/ui/manifest/index.mjs +9 -0
  304. package/dist/ui/manifest/manifest-schema.cjs +97 -0
  305. package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
  306. package/dist/ui/manifest/manifest-schema.d.cts +132 -0
  307. package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
  308. package/dist/ui/manifest/manifest-schema.d.mts +132 -0
  309. package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
  310. package/dist/ui/manifest/manifest-schema.mjs +90 -0
  311. package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
  312. package/dist/ui/manifest/mount-registry.cjs +52 -0
  313. package/dist/ui/manifest/mount-registry.cjs.map +1 -0
  314. package/dist/ui/manifest/mount-registry.d.cts +61 -0
  315. package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
  316. package/dist/ui/manifest/mount-registry.d.mts +61 -0
  317. package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
  318. package/dist/ui/manifest/mount-registry.mjs +48 -0
  319. package/dist/ui/manifest/mount-registry.mjs.map +1 -0
  320. package/dist/ui/manifest/nav.cjs +13 -0
  321. package/dist/ui/manifest/nav.cjs.map +1 -0
  322. package/dist/ui/manifest/nav.d.cts +34 -0
  323. package/dist/ui/manifest/nav.d.cts.map +1 -0
  324. package/dist/ui/manifest/nav.d.mts +34 -0
  325. package/dist/ui/manifest/nav.d.mts.map +1 -0
  326. package/dist/ui/manifest/nav.mjs +13 -0
  327. package/dist/ui/manifest/nav.mjs.map +1 -0
  328. package/dist/ui/manifest/route-config.cjs +33 -0
  329. package/dist/ui/manifest/route-config.cjs.map +1 -0
  330. package/dist/ui/manifest/route-config.d.cts +40 -0
  331. package/dist/ui/manifest/route-config.d.cts.map +1 -0
  332. package/dist/ui/manifest/route-config.d.mts +40 -0
  333. package/dist/ui/manifest/route-config.d.mts.map +1 -0
  334. package/dist/ui/manifest/route-config.mjs +33 -0
  335. package/dist/ui/manifest/route-config.mjs.map +1 -0
  336. package/dist/version-manifest.cjs +65 -0
  337. package/dist/version-manifest.cjs.map +1 -0
  338. package/dist/version-manifest.d.cts +52 -0
  339. package/dist/version-manifest.d.cts.map +1 -0
  340. package/dist/version-manifest.d.mts +52 -0
  341. package/dist/version-manifest.d.mts.map +1 -0
  342. package/dist/version-manifest.mjs +63 -0
  343. package/dist/version-manifest.mjs.map +1 -0
  344. package/package.json +165 -68
  345. package/skills/plugin-client/SKILL.md +24 -5
  346. package/skills/plugin-development/SKILL.md +79 -47
  347. package/skills/plugin-testing/SKILL.md +41 -12
  348. package/src/build/artifact-names.ts +117 -0
  349. package/src/build/contract-types.ts +101 -0
  350. package/src/build/rspack/build-report-plugin.ts +34 -0
  351. package/src/build/rspack/chunk-completeness-plugin.ts +57 -0
  352. package/src/build/rspack/compose.ts +87 -0
  353. package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
  354. package/src/build/rspack/generated-config.ts +35 -0
  355. package/src/build/rspack/index.ts +10 -5
  356. package/src/build/rspack/module-federation.ts +1 -1
  357. package/src/build/rspack/plugin.ts +103 -105
  358. package/src/build/rspack/utils.ts +8 -2
  359. package/src/build/ui/factory.ts +96 -0
  360. package/src/build/ui/generated-config.ts +133 -0
  361. package/src/build/ui/hash-artifacts-plugin.ts +79 -0
  362. package/src/build/ui/index.ts +98 -0
  363. package/src/build/ui/manifest-plugin.ts +54 -0
  364. package/src/build/ui/rsbuild-config.ts +256 -0
  365. package/src/build/ui/stubs.ts +103 -0
  366. package/src/cli.ts +100 -0
  367. package/src/dev/serve.ts +477 -0
  368. package/src/dev/watch-kill.ts +58 -0
  369. package/src/effect-helpers.ts +25 -0
  370. package/src/errors.ts +16 -18
  371. package/src/identity.ts +36 -0
  372. package/src/index.ts +4 -0
  373. package/src/plugin.ts +70 -92
  374. package/src/remote-entry.ts +171 -0
  375. package/src/runtime/errors.ts +186 -27
  376. package/src/runtime/index.ts +132 -43
  377. package/src/runtime/mf-config.ts +12 -107
  378. package/src/runtime/services/module-federation.service.ts +221 -117
  379. package/src/runtime/services/normalize.ts +1 -18
  380. package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
  381. package/src/runtime/services/plugin-loader.service.ts +239 -212
  382. package/src/runtime/services/plugin.service.ts +61 -43
  383. package/src/runtime/services/secrets.service.ts +20 -15
  384. package/src/runtime/services/shared-identity.ts +68 -0
  385. package/src/runtime/validation.ts +5 -7
  386. package/src/shared-deps-spec.ts +478 -0
  387. package/src/types.ts +22 -48
  388. package/src/ui/manifest/construct.ts +403 -0
  389. package/src/ui/manifest/contract.ts +33 -0
  390. package/src/ui/manifest/descriptor.ts +96 -0
  391. package/src/ui/manifest/generator.ts +238 -0
  392. package/src/ui/manifest/index.ts +55 -0
  393. package/src/ui/manifest/manifest-schema.ts +107 -0
  394. package/src/ui/manifest/mount-registry.ts +50 -0
  395. package/src/ui/manifest/nav.ts +43 -0
  396. package/src/ui/manifest/route-config.ts +82 -0
  397. package/src/version-manifest.ts +88 -0
  398. package/dist/build/rspack/dev-server-middleware.cjs +0 -194
  399. package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
  400. package/dist/build/rspack/dev-server-middleware.mjs +0 -193
  401. package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
  402. package/dist/build/shared-deps.cjs +0 -83
  403. package/dist/build/shared-deps.cjs.map +0 -1
  404. package/dist/build/shared-deps.d.cts +0 -67
  405. package/dist/build/shared-deps.d.cts.map +0 -1
  406. package/dist/build/shared-deps.d.mts +0 -67
  407. package/dist/build/shared-deps.d.mts.map +0 -1
  408. package/dist/build/shared-deps.mjs +0 -79
  409. package/dist/build/shared-deps.mjs.map +0 -1
  410. package/dist/effect.cjs +0 -9
  411. package/dist/effect.d.cts +0 -1
  412. package/dist/effect.d.mts +0 -1
  413. package/dist/effect.mjs +0 -3
  414. package/dist/orpc-openapi.cjs +0 -17
  415. package/dist/orpc-openapi.d.cts +0 -2
  416. package/dist/orpc-openapi.d.mts +0 -2
  417. package/dist/orpc-openapi.mjs +0 -5
  418. package/dist/orpc.cjs +0 -46
  419. package/dist/orpc.d.cts +0 -7
  420. package/dist/orpc.d.mts +0 -7
  421. package/dist/orpc.mjs +0 -11
  422. package/dist/package.cjs +0 -23
  423. package/dist/package.cjs.map +0 -1
  424. package/dist/package.mjs +0 -17
  425. package/dist/package.mjs.map +0 -1
  426. package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
  427. package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
  428. package/dist/runtime/services/normalize.cjs.map +0 -1
  429. package/dist/runtime/services/normalize.d.cts.map +0 -1
  430. package/dist/runtime/services/normalize.d.mts.map +0 -1
  431. package/dist/runtime/services/normalize.mjs.map +0 -1
  432. package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
  433. package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
  434. package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
  435. package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
  436. package/dist/runtime/services/secrets.service.d.cts.map +0 -1
  437. package/dist/runtime/services/secrets.service.d.mts.map +0 -1
  438. package/dist/testing/index.cjs +0 -57
  439. package/dist/testing/index.cjs.map +0 -1
  440. package/dist/testing/index.d.cts +0 -54
  441. package/dist/testing/index.d.cts.map +0 -1
  442. package/dist/testing/index.d.mts +0 -54
  443. package/dist/testing/index.d.mts.map +0 -1
  444. package/dist/testing/index.mjs +0 -55
  445. package/dist/testing/index.mjs.map +0 -1
  446. package/dist/zod-core.cjs +0 -9
  447. package/dist/zod-core.d.cts +0 -1
  448. package/dist/zod-core.d.mts +0 -1
  449. package/dist/zod-core.mjs +0 -3
  450. package/dist/zod.cjs +0 -11
  451. package/dist/zod.d.cts +0 -2
  452. package/dist/zod.d.mts +0 -2
  453. package/dist/zod.mjs +0 -3
  454. package/src/build/rspack/dev-server-middleware.ts +0 -250
  455. package/src/build/shared-deps.ts +0 -102
  456. package/src/effect.ts +0 -1
  457. package/src/orpc-openapi.ts +0 -2
  458. package/src/orpc.ts +0 -9
  459. package/src/testing/index.ts +0 -87
  460. package/src/testing/mocks/module-federation.service.ts +0 -41
  461. package/src/zod-core.ts +0 -1
  462. package/src/zod.ts +0 -3
@@ -1,4 +1,4 @@
1
- import { ORPCError } from "@orpc/contract";
1
+ import { ORPCError } from "@orpc/server";
2
2
  import { Cause, Data } from "effect";
3
3
  import type { z } from "zod";
4
4
 
@@ -7,8 +7,11 @@ export class PluginRuntimeError extends Data.TaggedError("PluginRuntimeError")<{
7
7
  readonly operation?: string;
8
8
  readonly procedureName?: string;
9
9
  readonly cause?: Error;
10
- readonly retryable: boolean;
11
- }> {}
10
+ }> {
11
+ override get message() {
12
+ return this.cause?.message ?? "Plugin operation failed";
13
+ }
14
+ }
12
15
 
13
16
  export class ModuleFederationError extends Data.TaggedError("ModuleFederationError")<{
14
17
  readonly pluginId: string;
@@ -22,6 +25,22 @@ export class ValidationError extends Data.TaggedError("ValidationError")<{
22
25
  readonly zodError: z.ZodError;
23
26
  }> {}
24
27
 
28
+ const stringifyUnknown = (value: unknown): string => {
29
+ if (value === null) return "null";
30
+ if (value === undefined) return "undefined";
31
+ if (value instanceof Error) return value.message;
32
+ if (typeof value === "string") return value;
33
+ if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") {
34
+ return `${value}`;
35
+ }
36
+ if (typeof value === "symbol") return value.description ?? "";
37
+ try {
38
+ return JSON.stringify(value) ?? "[Unserializable value]";
39
+ } catch {
40
+ return "[Unserializable value]";
41
+ }
42
+ };
43
+
25
44
  const extractErrorMessage = (error: unknown): string => {
26
45
  if (!error) return "Unknown error";
27
46
 
@@ -40,7 +59,26 @@ const extractErrorMessage = (error: unknown): string => {
40
59
  return String((error as any).message);
41
60
  }
42
61
 
43
- return String(error);
62
+ return stringifyUnknown(error);
63
+ };
64
+
65
+ /**
66
+ * The deepest Error along the cause chain — the original throw site. Wrapper
67
+ * errors (PluginRuntimeError, ModuleFederationError) carry their own stacks
68
+ * (the wrapping frames); diagnosis needs the cause's stack (the actual
69
+ * failing module inside the evaluated remote entry).
70
+ */
71
+ export const deepestErrorStack = (error: unknown): string | undefined => {
72
+ let current = error;
73
+ let deepest: string | undefined;
74
+ let hops = 0;
75
+ while (current instanceof Error && hops < 8) {
76
+ if (current.stack) deepest = current.stack;
77
+ current = (current as { cause?: unknown }).cause as unknown;
78
+ hops += 1;
79
+ }
80
+ if (current instanceof Error && current.stack) deepest = current.stack;
81
+ return deepest;
44
82
  };
45
83
 
46
84
  const formatValidationIssue = (issue: any, index: number, maxDisplay: number): string => {
@@ -73,7 +111,7 @@ const formatDataPreview = (data: unknown, maxLength = 100): string => {
73
111
 
74
112
  return `${str.slice(0, maxLength)}...`;
75
113
  } catch {
76
- return String(data).slice(0, maxLength);
114
+ return stringifyUnknown(data).slice(0, maxLength);
77
115
  }
78
116
  };
79
117
 
@@ -116,9 +154,31 @@ const formatORPCValidationError = (error: any): string[] | null => {
116
154
  return lines;
117
155
  };
118
156
 
157
+ const formatUnknownError = (error: any): string | null => {
158
+ if (!error) return null;
159
+ const message = extractErrorMessage(error);
160
+ const lines: string[] = [];
161
+ lines.push(`\n╭─ Unhandled error ${"─".repeat(37)}`);
162
+ for (const line of message.split("\n")) {
163
+ lines.push(`│ ${line}`);
164
+ }
165
+ const stack = error instanceof Error ? error.stack?.split("\n").slice(1, 6) : undefined;
166
+ if (stack && stack.length > 0) {
167
+ lines.push(`│`);
168
+ for (const line of stack) {
169
+ lines.push(`│ ${line.trim()}`);
170
+ }
171
+ }
172
+ lines.push(`╰${"─".repeat(50)}\n`);
173
+ return lines.join("\n");
174
+ };
175
+
119
176
  export const formatORPCError = (error: any): string | null => {
120
177
  if (!(error instanceof ORPCError)) {
121
- return null;
178
+ // Unknown errors used to return null, leaving internal failures (e.g. a
179
+ // storage backend throw) invisible in host logs while oRPC serialized
180
+ // them client-side as a bare INTERNAL_SERVER_ERROR.
181
+ return formatUnknownError(error);
122
182
  }
123
183
 
124
184
  const validationLines = formatORPCValidationError(error);
@@ -128,7 +188,6 @@ export const formatORPCError = (error: any): string | null => {
128
188
 
129
189
  const lines: string[] = [];
130
190
  const code = error.code || "UNKNOWN";
131
- const status = error.status || 500;
132
191
  const message = error.message || "An error occurred";
133
192
 
134
193
  lines.push(`\n╭─ oRPC Error ${"─".repeat(40)}`);
@@ -136,7 +195,7 @@ export const formatORPCError = (error: any): string | null => {
136
195
  for (const line of messageLines) {
137
196
  lines.push(`│ ${line}`);
138
197
  }
139
- lines.push(`│ Code: ${code} (${status})`);
198
+ lines.push(`│ Code: ${code}`);
140
199
  lines.push(`│`);
141
200
 
142
201
  if (error.data) {
@@ -187,23 +246,126 @@ export const formatORPCError = (error: any): string | null => {
187
246
  return lines.join("\n");
188
247
  };
189
248
 
190
- const isRetryableError = (message: string): boolean => {
191
- const retryablePatterns = ["ETIMEDOUT", "ECONNRESET", "timeout", "503", "429"];
192
- return retryablePatterns.some((p) => message.toLowerCase().includes(p.toLowerCase()));
193
- };
249
+ export type PluginFailureKind =
250
+ | "mf"
251
+ | "integrity"
252
+ | "config"
253
+ | "validation"
254
+ | "network"
255
+ | "unknown";
256
+
257
+ export interface PluginFailureClassification {
258
+ kind: PluginFailureKind;
259
+ retryable: boolean;
260
+ message: string;
261
+ suggestion?: string;
262
+ }
194
263
 
195
- // Helper to determine if an oRPC error code is retryable
196
- export const isRetryableORPCCode = (code: string): boolean => {
197
- switch (code) {
198
- case "TOO_MANY_REQUESTS":
199
- case "SERVICE_UNAVAILABLE":
200
- case "BAD_GATEWAY":
201
- case "GATEWAY_TIMEOUT":
202
- case "TIMEOUT":
203
- return true;
204
- default:
205
- return false;
264
+ /**
265
+ * Structured report of one plugin-load failure, built by a loader (the host's
266
+ * plugin boot, the dev server) from a `PluginFailureClassification` plus
267
+ * loader context. This is the shape health endpoints and dashboards consume —
268
+ * keep it serializable.
269
+ */
270
+ export interface PluginLoadFailureInfo {
271
+ /** loader-side key (host entry key, dev plugin id) */
272
+ pluginKey: string;
273
+ pluginUrl?: string;
274
+ /** failing runtime stage when the cause is stage-attributed */
275
+ operation?: string;
276
+ kind: string;
277
+ retryable: boolean;
278
+ message: string;
279
+ suggestion?: string;
280
+ /** loader context: which env secret the plugin's DB binding expects */
281
+ dbSecret?: string;
282
+ dbUrlMasked?: string;
283
+ }
284
+
285
+ const NETWORK_RETRYABLE_PATTERNS = ["ETIMEDOUT", "ECONNRESET", "timeout", "503", "429"] as const;
286
+ const NETWORK_DEAD_PATTERNS = ["ECONNREFUSED", "ENOTFOUND", "EHOSTUNREACH"] as const;
287
+ const RETRYABLE_ORPC_CODES = new Set([
288
+ "TOO_MANY_REQUESTS",
289
+ "SERVICE_UNAVAILABLE",
290
+ "BAD_GATEWAY",
291
+ "GATEWAY_TIMEOUT",
292
+ "TIMEOUT",
293
+ ]);
294
+
295
+ /**
296
+ * One classification for plugin lifecycle failures across MF / validation /
297
+ * network sources. This is the recovery policy — nothing in the runtime
298
+ * retries on it today by design (the host degrades and runs without a failed
299
+ * plugin); consumers (host bootstrap messages, the dev server retry loop)
300
+ * read kind / retryable / suggestion to decide what to tell the author.
301
+ */
302
+ export const classifyPluginFailure = (error: unknown): PluginFailureClassification => {
303
+ let current: unknown = extractFromFiberFailure(error);
304
+ let hops = 0;
305
+ while (current && typeof current === "object" && hops < 8) {
306
+ if (current instanceof ModuleFederationError) {
307
+ return {
308
+ kind: "mf",
309
+ retryable: false,
310
+ message: extractErrorMessage(current),
311
+ suggestion:
312
+ "Run bos mf check — the deployed plugin bundle is likely stale (sharedDep / pluginVersion skew), then redeploy the plugin and bos publish --deploy --packages local",
313
+ };
314
+ }
315
+ if (current instanceof ValidationError) {
316
+ return {
317
+ kind: "validation",
318
+ retryable: false,
319
+ message: `${current.stage}: ${extractErrorMessage(current.zodError)}`,
320
+ suggestion: `Fix the plugin's ${current.stage} schema at plugins/${current.pluginId}`,
321
+ };
322
+ }
323
+ if (current instanceof ORPCError) {
324
+ const retryableByCode = RETRYABLE_ORPC_CODES.has(current.code);
325
+ return {
326
+ kind: "network",
327
+ retryable: retryableByCode,
328
+ message: current.message,
329
+ suggestion: retryableByCode
330
+ ? "The plugin procedure failed transiently — retry the call"
331
+ : undefined,
332
+ };
333
+ }
334
+ current = (current as { cause?: unknown }).cause;
335
+ hops += 1;
206
336
  }
337
+
338
+ const message = extractErrorMessage(error);
339
+ const lower = message.toLowerCase();
340
+
341
+ if (NETWORK_RETRYABLE_PATTERNS.some((p) => lower.includes(p.toLowerCase()))) {
342
+ return {
343
+ kind: "network",
344
+ retryable: true,
345
+ message,
346
+ suggestion: "The remote may be temporarily unavailable — retry after redeploying the plugin",
347
+ };
348
+ }
349
+ if (NETWORK_DEAD_PATTERNS.some((p) => lower.includes(p.toLowerCase()))) {
350
+ return {
351
+ kind: "network",
352
+ retryable: false,
353
+ message,
354
+ suggestion:
355
+ "The plugin host is unreachable — check plugins.<id> entry URLs in bos.config.json",
356
+ };
357
+ }
358
+ if (lower.includes("integrity") || lower.includes("sri")) {
359
+ return {
360
+ kind: "integrity",
361
+ retryable: true,
362
+ message,
363
+ suggestion:
364
+ "The deployed bundle content does not match its recorded integrity — redeploy the plugin so bos.config.json is republished with a fresh hash",
365
+ };
366
+ }
367
+
368
+ return { kind: "unknown", retryable: false, message };
207
369
  };
208
370
 
209
371
  // Convert ORPC errors from plugin procedures to PluginRuntimeError
@@ -217,7 +379,6 @@ export const wrapORPCError = (
217
379
  pluginId,
218
380
  operation,
219
381
  procedureName,
220
- retryable: isRetryableORPCCode(orpcError.code),
221
382
  cause: orpcError as Error,
222
383
  });
223
384
  };
@@ -235,7 +396,7 @@ export const extractFromFiberFailure = (error: unknown): unknown => {
235
396
 
236
397
  if (cause && typeof cause === "object" && "_tag" in cause) {
237
398
  try {
238
- const squashed = Cause.squash(cause as Cause.Cause<unknown>);
399
+ const squashed = Cause.squash(cause as unknown as Cause.Cause<unknown>);
239
400
  if (squashed instanceof ORPCError) {
240
401
  return squashed;
241
402
  }
@@ -259,7 +420,6 @@ export const toPluginRuntimeError = (
259
420
  pluginId?: string,
260
421
  procedureName?: string,
261
422
  operation?: string,
262
- defaultRetryable = false,
263
423
  ): PluginRuntimeError => {
264
424
  if (error instanceof ORPCError) {
265
425
  return wrapORPCError(error, pluginId, procedureName, operation);
@@ -273,7 +433,6 @@ export const toPluginRuntimeError = (
273
433
  pluginId,
274
434
  operation,
275
435
  procedureName,
276
- retryable: defaultRetryable || isRetryableError(extractErrorMessage(error)),
277
436
  cause: error instanceof Error ? error : new Error(extractErrorMessage(error)),
278
437
  });
279
438
  };
@@ -1,5 +1,9 @@
1
+ import "@orpc/experimental-effect/extensions/effect";
2
+ import "@orpc/openapi/extensions/route";
3
+
1
4
  import { createRouterClient } from "@orpc/server";
2
- import { Cause, Effect, Exit, Hash, ManagedRuntime, Option } from "effect";
5
+ import { Cause, Effect, Exit, ManagedRuntime, Option } from "effect";
6
+ import { DEV_ENTRY_FILENAME } from "../build/artifact-names";
3
7
  import type {
4
8
  AnyPlugin,
5
9
  AnyPluginConstructor,
@@ -16,25 +20,94 @@ import type {
16
20
  RegisteredPlugins,
17
21
  UsePluginResult,
18
22
  } from "../types";
19
- import { PluginRuntimeError } from "./errors";
20
- import { PluginService } from "./services/plugin.service";
23
+ import { PluginRuntimeError, toPluginRuntimeError } from "./errors";
24
+ import { PluginService, PluginServiceLive } from "./services/plugin.service";
25
+
26
+ const MAX_CACHE_KEY_DEPTH = 32;
21
27
 
22
28
  export class PluginRuntime<R = RegisteredPlugins> {
23
29
  readonly __registryType?: R;
24
30
 
25
- private pluginCache = new Map<
26
- string,
27
- Effect.Effect<InitializedPlugin<AnyPlugin>, PluginRuntimeError>
28
- >();
31
+ private pluginCache = new Map<string, Promise<InitializedPlugin<AnyPlugin>>>();
32
+ private routerCache = new Map<string, PluginRouterType<any>>();
33
+ private cacheLeafIds = new WeakMap<object, number>();
34
+ private nextCacheLeafId = 0;
29
35
 
30
36
  constructor(
31
37
  private runtime: ManagedRuntime.ManagedRuntime<PluginService, never>,
32
38
  private registry: PluginRegistry,
33
39
  ) {}
34
40
 
41
+ /**
42
+ * Cache key for plugin instances: JSON-equal configs share one plugin
43
+ * instance (variables and secrets originate from bos.config.json, so they
44
+ * are JSON values). Values outside the JSON domain follow Effect's Hash
45
+ * semantics — symbols key by description, functions and class instances by
46
+ * reference identity — and the host creates its pluginsClient map once per
47
+ * boot, making identity the correct equivalence for function-bearing
48
+ * configs.
49
+ */
35
50
  private generateCacheKey(pluginId: string, config: unknown): string {
36
- const configHash = Hash.structure(config as object).toString();
37
- return `${pluginId}:${configHash}`;
51
+ return `${pluginId}:${this.canonicalizeConfig(config, 0, new Set())}`;
52
+ }
53
+
54
+ private canonicalizeConfig(value: unknown, depth: number, ancestors: Set<object>): string {
55
+ switch (typeof value) {
56
+ case "undefined":
57
+ return "undefined";
58
+ case "string":
59
+ return `string:${JSON.stringify(value)}`;
60
+ case "number":
61
+ return `number:${Object.is(value, -0) ? "-0" : String(value)}`;
62
+ case "bigint":
63
+ return `bigint:${value.toString()}`;
64
+ case "boolean":
65
+ return `boolean:${value}`;
66
+ case "symbol":
67
+ return `symbol:${String(value)}`;
68
+ case "function":
69
+ return `ref:${this.getCacheLeafId(value)}`;
70
+ case "object": {
71
+ if (value === null) return "null";
72
+ if (ancestors.has(value) || depth >= MAX_CACHE_KEY_DEPTH) {
73
+ return `ref:${this.getCacheLeafId(value)}`;
74
+ }
75
+
76
+ if (Array.isArray(value)) {
77
+ ancestors.add(value);
78
+ const serialized = `[${value
79
+ .map((item) => this.canonicalizeConfig(item, depth + 1, ancestors))
80
+ .join(",")}]`;
81
+ ancestors.delete(value);
82
+ return serialized;
83
+ }
84
+
85
+ const prototype = Object.getPrototypeOf(value);
86
+ if (prototype !== Object.prototype && prototype !== null) {
87
+ return `ref:${this.getCacheLeafId(value)}`;
88
+ }
89
+
90
+ const record = value as Record<string, unknown>;
91
+ ancestors.add(value);
92
+ const serialized = `{${Object.keys(record)
93
+ .sort()
94
+ .map(
95
+ (key) =>
96
+ `${JSON.stringify(key)}:${this.canonicalizeConfig(record[key], depth + 1, ancestors)}`,
97
+ )
98
+ .join(",")}}`;
99
+ ancestors.delete(value);
100
+ return serialized;
101
+ }
102
+ }
103
+ }
104
+
105
+ private getCacheLeafId(value: object): number {
106
+ const existing = this.cacheLeafIds.get(value);
107
+ if (existing !== undefined) return existing;
108
+ const id = this.nextCacheLeafId++;
109
+ this.cacheLeafIds.set(value, id);
110
+ return id;
38
111
  }
39
112
 
40
113
  private validatePluginId(pluginId: string): Effect.Effect<string, PluginRuntimeError> {
@@ -44,7 +117,6 @@ export class PluginRuntime<R = RegisteredPlugins> {
44
117
  pluginId: String(pluginId),
45
118
  operation: "validate-plugin-id",
46
119
  cause: new Error(`Plugin ID '${String(pluginId)}' not found in registry.`),
47
- retryable: false,
48
120
  }),
49
121
  );
50
122
  }
@@ -55,7 +127,7 @@ export class PluginRuntime<R = RegisteredPlugins> {
55
127
  const exit = await this.runtime.runPromiseExit(effect);
56
128
 
57
129
  if (Exit.isFailure(exit)) {
58
- const error = Cause.failureOption(exit.cause);
130
+ const error = Cause.findErrorOption(exit.cause);
59
131
  if (Option.isSome(error)) {
60
132
  throw error.value;
61
133
  }
@@ -74,7 +146,7 @@ export class PluginRuntime<R = RegisteredPlugins> {
74
146
 
75
147
  let cachedPlugin = this.pluginCache.get(cacheKey);
76
148
  if (!cachedPlugin) {
77
- const operation = Effect.gen(this, function* () {
149
+ const operation = Effect.gen({ self: this }, function* () {
78
150
  const pluginService = yield* PluginService;
79
151
  const validatedId = yield* this.validatePluginId(pluginId);
80
152
 
@@ -85,27 +157,45 @@ export class PluginRuntime<R = RegisteredPlugins> {
85
157
  yield* pluginService.registerPlugin(initialized);
86
158
 
87
159
  return initialized;
88
- }).pipe(Effect.annotateLogs({ plugin: pluginId }), Effect.provide(this.runtime));
160
+ });
89
161
 
90
- cachedPlugin = Effect.cached(operation).pipe(Effect.flatten);
162
+ cachedPlugin = this.runPromise(operation);
91
163
  this.pluginCache.set(cacheKey, cachedPlugin);
92
164
  }
93
165
 
94
166
  let initialized: InitializedPlugin<AnyPlugin>;
95
167
  try {
96
- initialized = await this.runPromise(cachedPlugin);
168
+ initialized = await cachedPlugin;
97
169
  } catch (error) {
98
- // Evict failed initializations so the next call retries instead
99
- // of returning the permanently-cached failure from Effect.cached.
100
- this.pluginCache.delete(cacheKey);
170
+ if (this.pluginCache.get(cacheKey) === cachedPlugin) {
171
+ this.pluginCache.delete(cacheKey);
172
+ this.routerCache.delete(cacheKey);
173
+ }
101
174
  throw error;
102
175
  }
103
176
 
104
177
  // Construct the router once per plugin instance, not per client/request.
105
- const router = initialized.plugin.createRouter(initialized.context) as PluginRouterType<R[K]>;
178
+ let router = this.routerCache.get(cacheKey);
179
+ if (!router) {
180
+ try {
181
+ router = initialized.plugin.createRouter(plugins ?? {}) as PluginRouterType<R[K]>;
182
+ this.routerCache.set(cacheKey, router);
183
+ } catch (error) {
184
+ await this.evictPlugin(pluginId, config, plugins);
185
+ throw error;
186
+ }
187
+ }
106
188
 
107
- // Create client factory that accepts request context
108
- const createClient = (context?: any) => createRouterClient(router, { context: context ?? {} });
189
+ // Create client factory that accepts request context. The plugin's
190
+ // Effect context is injected so `.effect()` handlers resolve services
191
+ // on in-process (server-side / SSR) calls.
192
+ const createClient = (context?: any) =>
193
+ createRouterClient(router, {
194
+ context: {
195
+ ...context,
196
+ "effect/context": initialized.effectContext,
197
+ },
198
+ });
109
199
 
110
200
  return {
111
201
  createClient: createClient as any,
@@ -121,7 +211,7 @@ export class PluginRuntime<R = RegisteredPlugins> {
121
211
  const effect = Effect.gen(function* () {
122
212
  const pluginService = yield* PluginService;
123
213
  return yield* pluginService.loadPlugin(pluginId);
124
- }).pipe(Effect.annotateLogs({ plugin: pluginId }));
214
+ });
125
215
  return this.runPromise(effect) as Promise<LoadedPlugin<RegisteredPlugin<K, R>>>;
126
216
  }
127
217
 
@@ -132,7 +222,7 @@ export class PluginRuntime<R = RegisteredPlugins> {
132
222
  const effect = Effect.gen(function* () {
133
223
  const pluginService = yield* PluginService;
134
224
  return yield* pluginService.instantiatePlugin(pluginId, loadedPlugin);
135
- }).pipe(Effect.annotateLogs({ plugin: pluginId }));
225
+ });
136
226
  return this.runPromise(effect) as Promise<PluginInstance<RegisteredPlugin<K, R>>>;
137
227
  }
138
228
 
@@ -146,17 +236,22 @@ export class PluginRuntime<R = RegisteredPlugins> {
146
236
  const initialized = yield* pluginService.initializePlugin(instance, config, plugins);
147
237
  yield* pluginService.registerPlugin(initialized);
148
238
  return initialized;
149
- }).pipe(Effect.annotateLogs({ plugin: instance.plugin.id }));
239
+ });
150
240
  return this.runPromise(effect);
151
241
  }
152
242
 
153
243
  async shutdown(): Promise<void> {
154
244
  const effect = Effect.gen(function* () {
155
245
  const pluginService = yield* PluginService;
156
- yield* pluginService.cleanup();
246
+ yield* pluginService.cleanup;
157
247
  });
158
- await this.runPromise(effect);
159
- await this.runtime.dispose();
248
+ try {
249
+ await this.runPromise(effect);
250
+ } finally {
251
+ this.pluginCache.clear();
252
+ this.routerCache.clear();
253
+ await this.runtime.dispose();
254
+ }
160
255
  }
161
256
 
162
257
  async evictPlugin<K extends keyof R & string>(
@@ -166,30 +261,24 @@ export class PluginRuntime<R = RegisteredPlugins> {
166
261
  ): Promise<void> {
167
262
  const cacheKey = this.generateCacheKey(pluginId, { ...config, __plugins: plugins ?? {} });
168
263
 
169
- const effect = Effect.gen(this, function* () {
264
+ const effect = Effect.gen({ self: this }, function* () {
170
265
  const pluginService = yield* PluginService;
171
266
  const cachedPlugin = this.pluginCache.get(cacheKey);
172
267
 
173
268
  if (cachedPlugin) {
174
269
  this.pluginCache.delete(cacheKey);
270
+ this.routerCache.delete(cacheKey);
175
271
 
176
- const pluginResult = yield* cachedPlugin.pipe(Effect.catchAll(() => Effect.succeed(null)));
272
+ const pluginResult = yield* Effect.tryPromise({
273
+ try: () => cachedPlugin,
274
+ catch: (error) => toPluginRuntimeError(error, pluginId, undefined, "evict-plugin"),
275
+ }).pipe(Effect.orElseSucceed(() => null));
177
276
 
178
277
  if (pluginResult) {
179
- yield* pluginService
180
- .shutdownPlugin(pluginResult)
181
- .pipe(
182
- Effect.catchAll((error) =>
183
- Effect.logWarning(`Failed to shutdown evicted plugin ${pluginId}`, error),
184
- ),
185
- );
278
+ yield* pluginService.shutdownPlugin(pluginResult);
186
279
  }
187
280
  }
188
- }).pipe(
189
- Effect.catchAll((error) =>
190
- Effect.logWarning(`Plugin eviction failed for ${pluginId}`, error),
191
- ),
192
- );
281
+ });
193
282
 
194
283
  return this.runPromise(effect);
195
284
  }
@@ -202,7 +291,7 @@ export class PluginRuntime<R = RegisteredPlugins> {
202
291
  function normalizeRemoteUrl(url: string): string {
203
292
  if (!url) return url;
204
293
  if (url.endsWith(".js") || url.endsWith(".json")) return url;
205
- return `${url.endsWith("/") ? url.slice(0, -1) : url}/remoteEntry.js`;
294
+ return `${url.endsWith("/") ? url.slice(0, -1) : url}/${DEV_ENTRY_FILENAME}`;
206
295
  }
207
296
 
208
297
  /**
@@ -270,7 +359,7 @@ export function createPluginRuntime<TRegistry extends Record<string, PluginRegis
270
359
  const normalizedRegistry = normalizeRegistry(config.registry);
271
360
  const pluginMap = extractPluginMap(config.registry);
272
361
 
273
- const layer = PluginService.Live(normalizedRegistry, secrets, pluginMap);
362
+ const layer = PluginServiceLive(normalizedRegistry, secrets, pluginMap);
274
363
  const runtime = ManagedRuntime.make(layer);
275
364
 
276
365
  return new PluginRuntime(runtime, normalizedRegistry) as PluginRuntime<