@bevel-software/platform-core-backend 0.14.0 → 0.15.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 (385) hide show
  1. package/THIRD-PARTY-NOTICES.md +6 -6
  2. package/dist/core/catalog-cache-invalidation.d.ts +29 -0
  3. package/dist/core/catalog-cache-invalidation.d.ts.map +1 -0
  4. package/dist/core/catalog-cache-invalidation.js +71 -0
  5. package/dist/core/catalog-cache-invalidation.js.map +1 -0
  6. package/dist/core/create-core-server.d.ts.map +1 -1
  7. package/dist/core/create-core-server.js +99 -8
  8. package/dist/core/create-core-server.js.map +1 -1
  9. package/dist/core/create-core-services.d.ts +18 -1
  10. package/dist/core/create-core-services.d.ts.map +1 -1
  11. package/dist/core/create-core-services.js +96 -43
  12. package/dist/core/create-core-services.js.map +1 -1
  13. package/dist/modules/access/access-control.interface.d.ts +18 -6
  14. package/dist/modules/access/access-control.interface.d.ts.map +1 -1
  15. package/dist/modules/access/access-control.service.d.ts +26 -1
  16. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  17. package/dist/modules/access/access-control.service.js +213 -71
  18. package/dist/modules/access/access-control.service.js.map +1 -1
  19. package/dist/modules/access/access.routes.d.ts.map +1 -1
  20. package/dist/modules/access/access.routes.js +59 -7
  21. package/dist/modules/access/access.routes.js.map +1 -1
  22. package/dist/modules/access-model/access-grammar.d.ts +51 -1
  23. package/dist/modules/access-model/access-grammar.d.ts.map +1 -1
  24. package/dist/modules/access-model/access-grammar.js +95 -1
  25. package/dist/modules/access-model/access-grammar.js.map +1 -1
  26. package/dist/modules/access-model/group-files.d.ts.map +1 -1
  27. package/dist/modules/access-model/group-files.js +4 -1
  28. package/dist/modules/access-model/group-files.js.map +1 -1
  29. package/dist/modules/access-model/plugin-principals.d.ts +49 -0
  30. package/dist/modules/access-model/plugin-principals.d.ts.map +1 -0
  31. package/dist/modules/access-model/plugin-principals.js +125 -0
  32. package/dist/modules/access-model/plugin-principals.js.map +1 -0
  33. package/dist/modules/database/core-schema.d.ts +326 -0
  34. package/dist/modules/database/core-schema.d.ts.map +1 -1
  35. package/dist/modules/database/core-schema.js +52 -0
  36. package/dist/modules/database/core-schema.js.map +1 -1
  37. package/dist/modules/kb-sync/index.d.ts +6 -0
  38. package/dist/modules/kb-sync/index.d.ts.map +1 -0
  39. package/dist/modules/kb-sync/index.js +5 -0
  40. package/dist/modules/kb-sync/index.js.map +1 -0
  41. package/dist/modules/kb-sync/kb-sync.interface.d.ts +77 -0
  42. package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -0
  43. package/dist/modules/kb-sync/kb-sync.interface.js +2 -0
  44. package/dist/modules/kb-sync/kb-sync.interface.js.map +1 -0
  45. package/dist/modules/kb-sync/kb-sync.routes.d.ts +70 -0
  46. package/dist/modules/kb-sync/kb-sync.routes.d.ts.map +1 -0
  47. package/dist/modules/kb-sync/kb-sync.routes.js +135 -0
  48. package/dist/modules/kb-sync/kb-sync.routes.js.map +1 -0
  49. package/dist/modules/kb-sync/kb-sync.service.d.ts +45 -0
  50. package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -0
  51. package/dist/modules/kb-sync/kb-sync.service.js +183 -0
  52. package/dist/modules/kb-sync/kb-sync.service.js.map +1 -0
  53. package/dist/modules/kb-sync/sync-auth.d.ts +59 -0
  54. package/dist/modules/kb-sync/sync-auth.d.ts.map +1 -0
  55. package/dist/modules/kb-sync/sync-auth.js +62 -0
  56. package/dist/modules/kb-sync/sync-auth.js.map +1 -0
  57. package/dist/modules/kb-sync/sync-payload.d.ts +32 -0
  58. package/dist/modules/kb-sync/sync-payload.d.ts.map +1 -0
  59. package/dist/modules/kb-sync/sync-payload.js +105 -0
  60. package/dist/modules/kb-sync/sync-payload.js.map +1 -0
  61. package/dist/modules/marketplace/git-http.routes.d.ts +42 -0
  62. package/dist/modules/marketplace/git-http.routes.d.ts.map +1 -0
  63. package/dist/modules/marketplace/git-http.routes.js +190 -0
  64. package/dist/modules/marketplace/git-http.routes.js.map +1 -0
  65. package/dist/modules/marketplace/github-facade/github-facade-admin.routes.d.ts +23 -0
  66. package/dist/modules/marketplace/github-facade/github-facade-admin.routes.d.ts.map +1 -0
  67. package/dist/modules/marketplace/github-facade/github-facade-admin.routes.js +59 -0
  68. package/dist/modules/marketplace/github-facade/github-facade-admin.routes.js.map +1 -0
  69. package/dist/modules/marketplace/github-facade/github-facade-codes.store.d.ts +59 -0
  70. package/dist/modules/marketplace/github-facade/github-facade-codes.store.d.ts.map +1 -0
  71. package/dist/modules/marketplace/github-facade/github-facade-codes.store.js +96 -0
  72. package/dist/modules/marketplace/github-facade/github-facade-codes.store.js.map +1 -0
  73. package/dist/modules/marketplace/github-facade/github-facade-credentials.service.d.ts +99 -0
  74. package/dist/modules/marketplace/github-facade/github-facade-credentials.service.d.ts.map +1 -0
  75. package/dist/modules/marketplace/github-facade/github-facade-credentials.service.js +147 -0
  76. package/dist/modules/marketplace/github-facade/github-facade-credentials.service.js.map +1 -0
  77. package/dist/modules/marketplace/github-facade/github-facade.routes.d.ts +47 -0
  78. package/dist/modules/marketplace/github-facade/github-facade.routes.d.ts.map +1 -0
  79. package/dist/modules/marketplace/github-facade/github-facade.routes.js +228 -0
  80. package/dist/modules/marketplace/github-facade/github-facade.routes.js.map +1 -0
  81. package/dist/modules/marketplace/github-facade/github-facade.service.d.ts +109 -0
  82. package/dist/modules/marketplace/github-facade/github-facade.service.d.ts.map +1 -0
  83. package/dist/modules/marketplace/github-facade/github-facade.service.js +172 -0
  84. package/dist/modules/marketplace/github-facade/github-facade.service.js.map +1 -0
  85. package/dist/modules/marketplace/github-facade/index.d.ts +6 -0
  86. package/dist/modules/marketplace/github-facade/index.d.ts.map +1 -0
  87. package/dist/modules/marketplace/github-facade/index.js +6 -0
  88. package/dist/modules/marketplace/github-facade/index.js.map +1 -0
  89. package/dist/modules/marketplace/index.d.ts +4 -0
  90. package/dist/modules/marketplace/index.d.ts.map +1 -0
  91. package/dist/modules/marketplace/index.js +4 -0
  92. package/dist/modules/marketplace/index.js.map +1 -0
  93. package/dist/modules/marketplace/marketplace-repo.service.d.ts +122 -0
  94. package/dist/modules/marketplace/marketplace-repo.service.d.ts.map +1 -0
  95. package/dist/modules/marketplace/marketplace-repo.service.js +300 -0
  96. package/dist/modules/marketplace/marketplace-repo.service.js.map +1 -0
  97. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
  98. package/dist/modules/mcp/oauth/bevel-oauth-provider.js +4 -0
  99. package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
  100. package/dist/modules/mcp/oauth/oauth-consent.routes.d.ts +14 -8
  101. package/dist/modules/mcp/oauth/oauth-consent.routes.d.ts.map +1 -1
  102. package/dist/modules/mcp/oauth/oauth-consent.routes.js +13 -1
  103. package/dist/modules/mcp/oauth/oauth-consent.routes.js.map +1 -1
  104. package/dist/modules/mcp/oauth/oauth-state.d.ts +13 -2
  105. package/dist/modules/mcp/oauth/oauth-state.d.ts.map +1 -1
  106. package/dist/modules/mcp/oauth/oauth-state.js +3 -1
  107. package/dist/modules/mcp/oauth/oauth-state.js.map +1 -1
  108. package/dist/modules/plugins/compile/compile-marketplace.d.ts +97 -0
  109. package/dist/modules/plugins/compile/compile-marketplace.d.ts.map +1 -0
  110. package/dist/modules/plugins/compile/compile-marketplace.js +240 -0
  111. package/dist/modules/plugins/compile/compile-marketplace.js.map +1 -0
  112. package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts +66 -0
  113. package/dist/modules/plugins/compile/marketplace-compiler.service.d.ts.map +1 -0
  114. package/dist/modules/plugins/compile/marketplace-compiler.service.js +132 -0
  115. package/dist/modules/plugins/compile/marketplace-compiler.service.js.map +1 -0
  116. package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts +37 -0
  117. package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.d.ts.map +1 -0
  118. package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js +135 -0
  119. package/dist/modules/plugins/discovery/bundle-dialect/bundle.source.js.map +1 -0
  120. package/dist/modules/plugins/discovery/bundle-dialect/registry.d.ts +45 -0
  121. package/dist/modules/plugins/discovery/bundle-dialect/registry.d.ts.map +1 -0
  122. package/dist/modules/plugins/discovery/bundle-dialect/registry.js +147 -0
  123. package/dist/modules/plugins/discovery/bundle-dialect/registry.js.map +1 -0
  124. package/dist/modules/plugins/discovery/kb-plugin-source.d.ts +37 -0
  125. package/dist/modules/plugins/discovery/kb-plugin-source.d.ts.map +1 -0
  126. package/dist/modules/plugins/discovery/kb-plugin-source.js +107 -0
  127. package/dist/modules/plugins/discovery/kb-plugin-source.js.map +1 -0
  128. package/dist/modules/plugins/discovery/native.source.d.ts +15 -0
  129. package/dist/modules/plugins/discovery/native.source.d.ts.map +1 -0
  130. package/dist/modules/plugins/discovery/native.source.js +102 -0
  131. package/dist/modules/plugins/discovery/native.source.js.map +1 -0
  132. package/dist/modules/plugins/discovery/plugin-source.d.ts +96 -0
  133. package/dist/modules/plugins/discovery/plugin-source.d.ts.map +1 -0
  134. package/dist/modules/plugins/discovery/plugin-source.js +2 -0
  135. package/dist/modules/plugins/discovery/plugin-source.js.map +1 -0
  136. package/dist/modules/plugins/index.d.ts +10 -1
  137. package/dist/modules/plugins/index.d.ts.map +1 -1
  138. package/dist/modules/plugins/index.js +8 -0
  139. package/dist/modules/plugins/index.js.map +1 -1
  140. package/dist/modules/plugins/plugin-links.d.ts +66 -0
  141. package/dist/modules/plugins/plugin-links.d.ts.map +1 -0
  142. package/dist/modules/plugins/plugin-links.js +160 -0
  143. package/dist/modules/plugins/plugin-links.js.map +1 -0
  144. package/dist/modules/plugins/plugin-links.service.d.ts +114 -0
  145. package/dist/modules/plugins/plugin-links.service.d.ts.map +1 -0
  146. package/dist/modules/plugins/plugin-links.service.js +304 -0
  147. package/dist/modules/plugins/plugin-links.service.js.map +1 -0
  148. package/dist/modules/plugins/plugin-provision.service.d.ts +39 -3
  149. package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
  150. package/dist/modules/plugins/plugin-provision.service.js +152 -52
  151. package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
  152. package/dist/modules/plugins/plugin-rename.service.d.ts +69 -0
  153. package/dist/modules/plugins/plugin-rename.service.d.ts.map +1 -0
  154. package/dist/modules/plugins/plugin-rename.service.js +245 -0
  155. package/dist/modules/plugins/plugin-rename.service.js.map +1 -0
  156. package/dist/modules/plugins/plugins.contract.d.ts +27 -1
  157. package/dist/modules/plugins/plugins.contract.d.ts.map +1 -1
  158. package/dist/modules/plugins/plugins.routes.d.ts +7 -1
  159. package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
  160. package/dist/modules/plugins/plugins.routes.js +120 -12
  161. package/dist/modules/plugins/plugins.routes.js.map +1 -1
  162. package/dist/modules/plugins/plugins.service.d.ts +50 -3
  163. package/dist/modules/plugins/plugins.service.d.ts.map +1 -1
  164. package/dist/modules/plugins/plugins.service.js +108 -47
  165. package/dist/modules/plugins/plugins.service.js.map +1 -1
  166. package/dist/modules/settings/deployment-settings.service.d.ts +9 -0
  167. package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
  168. package/dist/modules/settings/deployment-settings.service.js +82 -2
  169. package/dist/modules/settings/deployment-settings.service.js.map +1 -1
  170. package/dist/modules/settings/setup.routes.d.ts +26 -0
  171. package/dist/modules/settings/setup.routes.d.ts.map +1 -1
  172. package/dist/modules/settings/setup.routes.js +9 -1
  173. package/dist/modules/settings/setup.routes.js.map +1 -1
  174. package/dist/modules/skills/index.d.ts +1 -0
  175. package/dist/modules/skills/index.d.ts.map +1 -1
  176. package/dist/modules/skills/index.js +1 -0
  177. package/dist/modules/skills/index.js.map +1 -1
  178. package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
  179. package/dist/modules/skills/pending-skills.service.js +9 -4
  180. package/dist/modules/skills/pending-skills.service.js.map +1 -1
  181. package/dist/modules/skills/skill-access-requests.routes.d.ts +38 -0
  182. package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -0
  183. package/dist/modules/skills/skill-access-requests.routes.js +168 -0
  184. package/dist/modules/skills/skill-access-requests.routes.js.map +1 -0
  185. package/dist/modules/skills/skills.contract.d.ts +31 -0
  186. package/dist/modules/skills/skills.contract.d.ts.map +1 -1
  187. package/dist/modules/skills/skills.routes.d.ts +28 -3
  188. package/dist/modules/skills/skills.routes.d.ts.map +1 -1
  189. package/dist/modules/skills/skills.routes.js +42 -3
  190. package/dist/modules/skills/skills.routes.js.map +1 -1
  191. package/dist/modules/skills/skills.service.d.ts +4 -0
  192. package/dist/modules/skills/skills.service.d.ts.map +1 -1
  193. package/dist/modules/skills/skills.service.js +83 -22
  194. package/dist/modules/skills/skills.service.js.map +1 -1
  195. package/dist/modules/tool-auth/external-api-key.interface.d.ts +18 -1
  196. package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
  197. package/dist/modules/tool-auth/external-api-key.interface.js +2 -1
  198. package/dist/modules/tool-auth/external-api-key.interface.js.map +1 -1
  199. package/dist/modules/tool-auth/external-api-key.service.d.ts +13 -4
  200. package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
  201. package/dist/modules/tool-auth/external-api-key.service.js +26 -9
  202. package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
  203. package/dist/modules/tool-manuals/mcp-json-discovery.d.ts +36 -0
  204. package/dist/modules/tool-manuals/mcp-json-discovery.d.ts.map +1 -1
  205. package/dist/modules/tool-manuals/mcp-json-discovery.js +130 -92
  206. package/dist/modules/tool-manuals/mcp-json-discovery.js.map +1 -1
  207. package/dist/modules/tool-manuals/tool-manuals.service.d.ts +6 -1
  208. package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
  209. package/dist/modules/tool-manuals/tool-manuals.service.js +18 -25
  210. package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
  211. package/dist/modules/workflow/git/git.service.d.ts +40 -2
  212. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  213. package/dist/modules/workflow/git/git.service.js +227 -54
  214. package/dist/modules/workflow/git/git.service.js.map +1 -1
  215. package/dist/modules/workflow/git/pull-request.service.d.ts +6 -0
  216. package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
  217. package/dist/modules/workflow/git/pull-request.service.js +8 -0
  218. package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
  219. package/dist/modules/workflow/workflow.service.d.ts +52 -1
  220. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  221. package/dist/modules/workflow/workflow.service.js +242 -9
  222. package/dist/modules/workflow/workflow.service.js.map +1 -1
  223. package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts +35 -0
  224. package/dist/modules/workspace/startup/steps/plugin-manifests.step.d.ts.map +1 -0
  225. package/dist/modules/workspace/startup/steps/plugin-manifests.step.js +121 -0
  226. package/dist/modules/workspace/startup/steps/plugin-manifests.step.js.map +1 -0
  227. package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
  228. package/dist/modules/workspace/startup/steps/seed-tree.js +46 -2
  229. package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
  230. package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
  231. package/dist/modules/workspace/startup/steps/template-files.step.js +112 -25
  232. package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
  233. package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
  234. package/dist/modules/workspace/workspace.routes.js +9 -9
  235. package/dist/modules/workspace/workspace.routes.js.map +1 -1
  236. package/dist/modules/workspace/workspace.service.d.ts +33 -0
  237. package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
  238. package/dist/modules/workspace/workspace.service.js +110 -16
  239. package/dist/modules/workspace/workspace.service.js.map +1 -1
  240. package/dist/shared/domain-errors.d.ts +20 -0
  241. package/dist/shared/domain-errors.d.ts.map +1 -1
  242. package/dist/shared/domain-errors.js +29 -0
  243. package/dist/shared/domain-errors.js.map +1 -1
  244. package/dist/shared/fs-errors.d.ts +8 -0
  245. package/dist/shared/fs-errors.d.ts.map +1 -0
  246. package/dist/shared/fs-errors.js +11 -0
  247. package/dist/shared/fs-errors.js.map +1 -0
  248. package/dist/shared/fs-walk.d.ts +20 -6
  249. package/dist/shared/fs-walk.d.ts.map +1 -1
  250. package/dist/shared/fs-walk.js +35 -27
  251. package/dist/shared/fs-walk.js.map +1 -1
  252. package/dist/shared/kb-walk.d.ts +52 -0
  253. package/dist/shared/kb-walk.d.ts.map +1 -0
  254. package/dist/shared/kb-walk.js +76 -0
  255. package/dist/shared/kb-walk.js.map +1 -0
  256. package/dist/shared/path-order.d.ts +18 -0
  257. package/dist/shared/path-order.d.ts.map +1 -0
  258. package/dist/shared/path-order.js +35 -0
  259. package/dist/shared/path-order.js.map +1 -0
  260. package/dist/shared/ttl-cache.d.ts +28 -1
  261. package/dist/shared/ttl-cache.d.ts.map +1 -1
  262. package/dist/shared/ttl-cache.js +33 -1
  263. package/dist/shared/ttl-cache.js.map +1 -1
  264. package/kb-template/.bevelignore +1 -1
  265. package/kb-template/AGENTS.md +95 -30
  266. package/kb-template/Skills/.gitkeep +0 -0
  267. package/migrations/0005_github_facade.sql +25 -0
  268. package/migrations/meta/0005_snapshot.json +1717 -0
  269. package/migrations/meta/_journal.json +7 -0
  270. package/package.json +6 -6
  271. package/src/__tests__/kb-layout-config.test.ts +110 -0
  272. package/src/core/__tests__/catalog-cache-invalidation.test.ts +146 -0
  273. package/src/core/catalog-cache-invalidation.ts +92 -0
  274. package/src/core/create-core-server.ts +123 -7
  275. package/src/core/create-core-services.ts +162 -41
  276. package/src/modules/access/__tests__/access-control.invalidate-race.test.ts +86 -0
  277. package/src/modules/access/__tests__/access-control.service.test.ts +19 -3
  278. package/src/modules/access/__tests__/access-plugin-principals.test.ts +368 -0
  279. package/src/modules/access/__tests__/groups-admin.service.test.ts +8 -0
  280. package/src/modules/access/access-control.interface.ts +20 -9
  281. package/src/modules/access/access-control.service.ts +240 -78
  282. package/src/modules/access/access.routes.ts +96 -14
  283. package/src/modules/access-model/__tests__/access-grammar.test.ts +18 -0
  284. package/src/modules/access-model/__tests__/plugin-token-canonical.test.ts +40 -0
  285. package/src/modules/access-model/access-grammar.ts +114 -2
  286. package/src/modules/access-model/group-files.ts +4 -0
  287. package/src/modules/access-model/plugin-principals.ts +137 -0
  288. package/src/modules/database/core-schema.ts +54 -0
  289. package/src/modules/kb-sync/__tests__/kb-sync.routes.test.ts +297 -0
  290. package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +295 -0
  291. package/src/modules/kb-sync/__tests__/sync-auth.test.ts +118 -0
  292. package/src/modules/kb-sync/__tests__/sync-payload.test.ts +148 -0
  293. package/src/modules/kb-sync/index.ts +19 -0
  294. package/src/modules/kb-sync/kb-sync.interface.ts +79 -0
  295. package/src/modules/kb-sync/kb-sync.routes.ts +197 -0
  296. package/src/modules/kb-sync/kb-sync.service.ts +201 -0
  297. package/src/modules/kb-sync/sync-auth.ts +118 -0
  298. package/src/modules/kb-sync/sync-payload.ts +143 -0
  299. package/src/modules/marketplace/__tests__/github-facade.test.ts +443 -0
  300. package/src/modules/marketplace/__tests__/marketplace-git.test.ts +179 -0
  301. package/src/modules/marketplace/git-http.routes.ts +193 -0
  302. package/src/modules/marketplace/github-facade/github-facade-admin.routes.ts +78 -0
  303. package/src/modules/marketplace/github-facade/github-facade-codes.store.ts +145 -0
  304. package/src/modules/marketplace/github-facade/github-facade-credentials.service.ts +208 -0
  305. package/src/modules/marketplace/github-facade/github-facade.routes.ts +268 -0
  306. package/src/modules/marketplace/github-facade/github-facade.service.ts +221 -0
  307. package/src/modules/marketplace/github-facade/index.ts +25 -0
  308. package/src/modules/marketplace/index.ts +3 -0
  309. package/src/modules/marketplace/marketplace-repo.service.ts +337 -0
  310. package/src/modules/mcp/oauth/bevel-oauth-provider.ts +3 -0
  311. package/src/modules/mcp/oauth/oauth-consent.routes.ts +24 -2
  312. package/src/modules/mcp/oauth/oauth-state.ts +15 -3
  313. package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +163 -0
  314. package/src/modules/plugins/__tests__/compile-marketplace.test.ts +294 -0
  315. package/src/modules/plugins/__tests__/plugin-index.service.test.ts +56 -12
  316. package/src/modules/plugins/__tests__/plugin-links.service.test.ts +287 -0
  317. package/src/modules/plugins/__tests__/plugin-provision.service.test.ts +205 -5
  318. package/src/modules/plugins/__tests__/plugin-rename.service.test.ts +394 -0
  319. package/src/modules/plugins/__tests__/plugins.routes.test.ts +80 -33
  320. package/src/modules/plugins/compile/compile-marketplace.ts +403 -0
  321. package/src/modules/plugins/compile/marketplace-compiler.service.ts +150 -0
  322. package/src/modules/plugins/discovery/__tests__/kb-plugin-source.test.ts +329 -0
  323. package/src/modules/plugins/discovery/bundle-dialect/bundle.source.ts +140 -0
  324. package/src/modules/plugins/discovery/bundle-dialect/registry.ts +175 -0
  325. package/src/modules/plugins/discovery/kb-plugin-source.ts +114 -0
  326. package/src/modules/plugins/discovery/native.source.ts +122 -0
  327. package/src/modules/plugins/discovery/plugin-source.ts +99 -0
  328. package/src/modules/plugins/index.ts +10 -0
  329. package/src/modules/plugins/plugin-links.service.ts +363 -0
  330. package/src/modules/plugins/plugin-links.ts +184 -0
  331. package/src/modules/plugins/plugin-provision.service.ts +160 -54
  332. package/src/modules/plugins/plugin-rename.service.ts +298 -0
  333. package/src/modules/plugins/plugins.contract.ts +28 -1
  334. package/src/modules/plugins/plugins.routes.ts +128 -11
  335. package/src/modules/plugins/plugins.service.ts +106 -53
  336. package/src/modules/settings/__tests__/deployment-settings.service.test.ts +57 -0
  337. package/src/modules/settings/__tests__/setup.routes.sync-status.test.ts +77 -0
  338. package/src/modules/settings/deployment-settings.service.ts +95 -2
  339. package/src/modules/settings/setup.routes.ts +24 -0
  340. package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +128 -0
  341. package/src/modules/skills/__tests__/skills.service.test.ts +85 -0
  342. package/src/modules/skills/index.ts +1 -0
  343. package/src/modules/skills/pending-skills.service.ts +7 -5
  344. package/src/modules/skills/skill-access-requests.routes.ts +199 -0
  345. package/src/modules/skills/skills.contract.ts +32 -0
  346. package/src/modules/skills/skills.routes.ts +59 -3
  347. package/src/modules/skills/skills.service.ts +84 -22
  348. package/src/modules/tool-auth/external-api-key.interface.ts +20 -1
  349. package/src/modules/tool-auth/external-api-key.service.ts +31 -13
  350. package/src/modules/tool-manuals/__tests__/mcp-json-discovery.test.ts +24 -1
  351. package/src/modules/tool-manuals/__tests__/tool-manuals.cli.test.ts +2 -0
  352. package/src/modules/tool-manuals/mcp-json-discovery.ts +154 -88
  353. package/src/modules/tool-manuals/tool-manuals.service.ts +14 -23
  354. package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +1 -1
  355. package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +1 -0
  356. package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +2 -2
  357. package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +119 -2
  358. package/src/modules/workflow/__tests__/workflow.service.sync.test.ts +437 -0
  359. package/src/modules/workflow/git/__tests__/git.service.postMergePull.test.ts +3 -3
  360. package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +47 -4
  361. package/src/modules/workflow/git/__tests__/git.service.syncFromRemote.test.ts +253 -0
  362. package/src/modules/workflow/git/git.service.ts +239 -56
  363. package/src/modules/workflow/git/pull-request.service.ts +9 -0
  364. package/src/modules/workflow/workflow.service.ts +260 -9
  365. package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +6 -7
  366. package/src/modules/workspace/__tests__/workspace.service.list-cloned.test.ts +93 -0
  367. package/src/modules/workspace/__tests__/workspace.service.missing-branch.test.ts +28 -0
  368. package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +42 -12
  369. package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +219 -4
  370. package/src/modules/workspace/startup/steps/plugin-manifests.step.ts +129 -0
  371. package/src/modules/workspace/startup/steps/seed-tree.ts +44 -2
  372. package/src/modules/workspace/startup/steps/template-files.step.ts +131 -27
  373. package/src/modules/workspace/workspace.routes.ts +9 -17
  374. package/src/modules/workspace/workspace.service.ts +107 -16
  375. package/src/shared/__tests__/filename.test.ts +0 -0
  376. package/src/shared/__tests__/fs-walk.test.ts +22 -1
  377. package/src/shared/__tests__/kb-walk.test.ts +107 -0
  378. package/src/shared/__tests__/path-order.test.ts +24 -0
  379. package/src/shared/__tests__/ttl-cache.test.ts +55 -0
  380. package/src/shared/domain-errors.ts +29 -0
  381. package/src/shared/fs-errors.ts +10 -0
  382. package/src/shared/fs-walk.ts +38 -23
  383. package/src/shared/kb-walk.ts +95 -0
  384. package/src/shared/path-order.ts +33 -0
  385. package/src/shared/ttl-cache.ts +33 -1
@@ -0,0 +1,97 @@
1
+ import type { SkillSummary } from '../../skills/skills.contract.js';
2
+ import type { LinkMembership } from '../plugin-links.js';
3
+ import type { DiscoveredPlugin } from '../discovery/plugin-source.js';
4
+ /**
5
+ * The compiler: SOURCE layout in, DISTRIBUTION layout out.
6
+ *
7
+ * Source is what lives in the knowledge base — shared skills under
8
+ * `Skills/`, plugin folders under `Plugins/` whose manifests LINK to them.
9
+ * Distribution is what an agent installs: a marketplace of self-contained
10
+ * plugins, each physically holding its skills (Claude Code refuses paths
11
+ * that escape a plugin's directory, and symlinks are out), in the vendor
12
+ * layouts the clients read today — `.claude-plugin/plugin.json`,
13
+ * `.codex-plugin/plugin.json`, `.mcp.json` — beside the Agent Plugins
14
+ * `plugin.json` and `mcp.json`.
15
+ *
16
+ * What comes out, for one caller:
17
+ *
18
+ * .claude-plugin/marketplace.json Claude Code's catalogue
19
+ * .agents/plugins/marketplace.json Codex's catalogue, every entry
20
+ * INSTALLED_BY_DEFAULT
21
+ * plugins/<slug>/… one per plugin the caller may read
22
+ * anything of: inline + linked skills,
23
+ * the portable half of mcp.json
24
+ * plugins/skills-and-knowledge/… every readable skill no plugin above
25
+ * ships — how a standalone skill, or one
26
+ * only in plugins the caller cannot see,
27
+ * is still one install away — plus the
28
+ * knowledge base's own MCP endpoint
29
+ * plugins/hexis-all/… a bundle whose only content is a
30
+ * dependency on every plugin above —
31
+ * Claude Code installs them all from
32
+ * one `claude plugin install`
33
+ * skills/<name>/… every readable skill once, flat, for
34
+ * `npx skills add <url> --all`
35
+ * README.md names the source commit
36
+ *
37
+ * FAIL CLOSED, per file: a skill is copied only when `readable` says yes for
38
+ * its SKILL.md — the same per-path verdict the catalog filters on — so the
39
+ * compiled tree for a caller holds exactly what that caller may read, and
40
+ * nothing about a skill they may not. Plugins with nothing readable are
41
+ * left out entirely. `access.md` and `.bevelignore` never ship; neither do
42
+ * the hexis-only `.tool` manuals (no other client can run them), nor an
43
+ * `mcp.json` header carrying a `${VAR}` vault reference (the extension block
44
+ * that resolves it is ours, and a header a client would send verbatim must
45
+ * not name a secret it cannot expand).
46
+ *
47
+ * A pure function of its inputs — it reads the KB tree it is pointed at and
48
+ * returns a virtual tree; writing it somewhere (a git namespace, a folder, a
49
+ * remote) is the sink's business.
50
+ */
51
+ export interface MarketplaceOptions {
52
+ /** The marketplace's name — a slug the clients key it on. */
53
+ name: string;
54
+ /** Shown as the marketplace owner. */
55
+ owner: string;
56
+ description?: string;
57
+ /** The default-branch commit the tree was compiled from; also the bundle's version. */
58
+ sourceCommit: string;
59
+ /** The name of the one-install bundle plugin. */
60
+ bundleName?: string;
61
+ /** The name of the leftovers plugin holding skills no other plugin ships. */
62
+ skillsPluginName?: string;
63
+ /**
64
+ * This deployment's hosted MCP endpoint — the knowledge base as a tool.
65
+ * Shipped in the leftovers plugin's `mcp.json` so an agent that installs
66
+ * from the marketplace can read the knowledge its skills refer to. URL only,
67
+ * never a credential: the endpoint challenges with OAuth metadata, and the
68
+ * client signs the person in on first use.
69
+ */
70
+ knowledgeBaseMcp?: {
71
+ name: string;
72
+ url: string;
73
+ };
74
+ }
75
+ export interface CompileInput {
76
+ /** Absolute path of the KB checkout (the folder holding `Plugins/`, `Skills/`, …). */
77
+ kbRoot: string;
78
+ /** The released catalog, UNFILTERED — `readable` does the filtering. */
79
+ skills: SkillSummary[];
80
+ /** The plugins as the configured source discovered them (manifests and servers already parsed). */
81
+ plugins: DiscoveredPlugin[];
82
+ /** Which plugins hold which skills, from the link index. */
83
+ membership: LinkMembership;
84
+ /** The caller's read verdict on a repo-relative path (`<skillFolder>/SKILL.md`). */
85
+ readable: (repoPath: string) => Promise<boolean>;
86
+ options: MarketplaceOptions;
87
+ }
88
+ export interface VirtualTree {
89
+ /** repo-relative POSIX path → file bytes. */
90
+ files: Map<string, Buffer>;
91
+ /** What was left out and why — name clashes, unparsable manifests. */
92
+ warnings: string[];
93
+ /** The plugin slugs the tree carries, in marketplace order. */
94
+ plugins: string[];
95
+ }
96
+ export declare function compileMarketplace(input: CompileInput): Promise<VirtualTree>;
97
+ //# sourceMappingURL=compile-marketplace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-marketplace.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugins/compile/compile-marketplace.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,YAAY,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD;AAED,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,mGAAmG;IACnG,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,4DAA4D;IAC5D,UAAU,EAAE,cAAc,CAAC;IAC3B,oFAAoF;IACpF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAQD,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAmNlF"}
@@ -0,0 +1,240 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { PLUGIN_MANIFEST_FILE, PLUGIN_MCP_FILE, PLUGIN_MANIFEST_SCHEMA, PLUGIN_MCP_SCHEMA, pluginManifestName, } from '@bevel-software/platform-shared';
4
+ import { walkFiles } from '../../../shared/fs-walk.js';
5
+ import { containsVariableReference } from '../../../shared/variable-refs.js';
6
+ import { judgeMcpServerEntry } from '../../tool-manuals/mcp-json-discovery.js';
7
+ const BUNDLE_NAME = 'hexis-all';
8
+ const SKILLS_PLUGIN_NAME = 'skills-and-knowledge';
9
+ /** Slugs the compiler emits itself; a real plugin may not take them. */
10
+ const RESERVED_SLUGS = new Set([BUNDLE_NAME, SKILLS_PLUGIN_NAME]);
11
+ const NEVER_SHIPPED = new Set(['access.md', '.bevelignore']);
12
+ export async function compileMarketplace(input) {
13
+ const { kbRoot, skills, plugins, membership, readable, options } = input;
14
+ const files = new Map();
15
+ const warnings = [];
16
+ const put = (rel, content) => files.set(rel, typeof content === 'string' ? Buffer.from(content, 'utf-8') : content);
17
+ // One verdict per skill, resolved once: every plugin below reads from it. A
18
+ // RETIRED skill (its governance lifecycle) stays in the catalog for its
19
+ // owners but never ships — retiring is how a skill leaves every agent.
20
+ const readableSkills = new Map();
21
+ for (const s of skills) {
22
+ if (s.lifecycle === 'retired')
23
+ continue;
24
+ if (await readable(`${s.path}/SKILL.md`))
25
+ readableSkills.set(s.path, s);
26
+ }
27
+ const out = [];
28
+ // 1. Real plugins: inline skills (in the folder) + linked skills (from the
29
+ // manifest), each only if readable. Personal folders are places, not
30
+ // plugins; a plugin the index does not count as existing is not shipped.
31
+ const byName = new Map(plugins.map((p) => [p.name, p]));
32
+ for (const [name, links] of [...membership.byPlugin.entries()].sort(([a], [b]) => a.localeCompare(b))) {
33
+ const plugin = byName.get(name);
34
+ if (!plugin || plugin.personal || !plugin.exists)
35
+ continue;
36
+ const manifest = plugin.manifest;
37
+ const inline = [...readableSkills.values()].filter((s) => s.path.startsWith(`${plugin.folder}/`));
38
+ const linked = links.linkedSkills
39
+ .map((p) => readableSkills.get(p))
40
+ .filter((s) => s !== undefined);
41
+ const dedup = dedupeByName([...inline, ...linked], (s, other) => warnings.push(`${name}: skill "${s.name}" at ${s.path} shares its name with ${other.path} — the second is left out`));
42
+ const mcp = portableMcp(plugin.mcpServers, (name, reason) => warnings.push(`${plugin.folder}: mcp server "${name}" not shipped — ${reason}`));
43
+ if (dedup.length === 0 && mcp === null)
44
+ continue; // nothing this caller may see
45
+ // The plugin's identity IS the marketplace slug. Folded once more here
46
+ // all the same: it becomes a path segment in the compiled tree, and a
47
+ // checked-in manifest is repository content, not trusted input — the
48
+ // folding (`[a-z0-9.-]`, no runs, no leading dots) leaves nothing that
49
+ // can be a separator or a parent reference.
50
+ const slug = pluginManifestName(name);
51
+ if (RESERVED_SLUGS.has(slug)) {
52
+ warnings.push(`${plugin.folder}: manifest name "${slug}" is reserved by the marketplace and cannot be a plugin — plugin skipped`);
53
+ continue;
54
+ }
55
+ if (out.some((p) => p.slug === slug)) {
56
+ warnings.push(`${plugin.folder}: manifest name "${slug}" is already taken in this marketplace — plugin skipped`);
57
+ continue;
58
+ }
59
+ out.push({
60
+ slug,
61
+ displayName: plugin.displayName,
62
+ description: typeof manifest?.description === 'string' ? manifest.description : undefined,
63
+ version: typeof manifest?.version === 'string' ? manifest.version : undefined,
64
+ skills: dedup,
65
+ folder: plugin.folder,
66
+ mcp: mcp ?? undefined,
67
+ });
68
+ }
69
+ // 2. The leftovers plugin: every readable skill that no plugin above ships.
70
+ // Agents install plugins, not loose skills, so a skill in no plugin — or
71
+ // only in plugins this caller cannot see anything of — still has to be one
72
+ // install away. ONE plugin per caller, not one per scope: there is nothing
73
+ // to choose between (the caller may read all of it) and the bundle installs
74
+ // it regardless, so scope plugins would only add names and duplicate what
75
+ // the real plugins already carry.
76
+ // It also carries the knowledge base's own MCP endpoint (URL only — the
77
+ // client's OAuth flow signs the person in), so an agent installing from
78
+ // the marketplace can read the knowledge its skills point at. With the
79
+ // endpoint configured the plugin exists even for a caller with no
80
+ // leftover skill: the knowledge is the point.
81
+ const covered = new Set(out.flatMap((p) => p.skills.map((s) => s.path)));
82
+ const leftovers = [...readableSkills.values()].filter((s) => !covered.has(s.path));
83
+ const kbMcp = options.knowledgeBaseMcp
84
+ ? { [options.knowledgeBaseMcp.name]: { type: 'streamable-http', url: options.knowledgeBaseMcp.url } }
85
+ : undefined;
86
+ if (leftovers.length > 0 || kbMcp) {
87
+ const slug = pluginManifestName(options.skillsPluginName ?? SKILLS_PLUGIN_NAME);
88
+ if (out.some((p) => p.slug === slug)) {
89
+ warnings.push(`the skills plugin "${slug}" collides with a plugin's manifest name — standalone skills not shipped`);
90
+ }
91
+ else {
92
+ out.push({
93
+ slug,
94
+ displayName: 'Skills and knowledge',
95
+ description: kbMcp
96
+ ? 'Every skill you may read that no other plugin here ships, and the knowledge base as an MCP server'
97
+ : 'Every skill you may read that no other plugin here ships',
98
+ skills: dedupeByName(leftovers, (s, other) => warnings.push(`${slug}: "${s.name}" at ${s.path} shares its name with ${other.path} — left out`)),
99
+ mcp: kbMcp,
100
+ });
101
+ }
102
+ }
103
+ // 3. Materialise every plugin: the three manifests + copied skill folders.
104
+ for (const p of out) {
105
+ const base = `plugins/${p.slug}`;
106
+ const spec = { $schema: PLUGIN_MANIFEST_SCHEMA, name: p.slug };
107
+ if (p.version)
108
+ spec.version = p.version;
109
+ if (p.description)
110
+ spec.description = p.description;
111
+ put(`${base}/${PLUGIN_MANIFEST_FILE}`, `${JSON.stringify(spec, null, 2)}\n`);
112
+ const vendor = { name: p.slug };
113
+ if (p.version)
114
+ vendor.version = p.version;
115
+ vendor.description = p.description ?? p.displayName;
116
+ put(`${base}/.claude-plugin/plugin.json`, `${JSON.stringify(vendor, null, 2)}\n`);
117
+ put(`${base}/.codex-plugin/plugin.json`, `${JSON.stringify(vendor, null, 2)}\n`);
118
+ if (p.mcp) {
119
+ put(`${base}/${PLUGIN_MCP_FILE}`, `${JSON.stringify({ $schema: PLUGIN_MCP_SCHEMA, mcpServers: p.mcp }, null, 2)}\n`);
120
+ put(`${base}/.mcp.json`, `${JSON.stringify({ mcpServers: p.mcp }, null, 2)}\n`);
121
+ }
122
+ for (const s of p.skills) {
123
+ await copySkill(kbRoot, s, `${base}/skills/${s.name}`, put);
124
+ }
125
+ }
126
+ // 4. The one-install bundle: a Claude manifest with nothing but dependencies.
127
+ const bundle = pluginManifestName(options.bundleName ?? BUNDLE_NAME);
128
+ const slugs = out.map((p) => p.slug);
129
+ if (slugs.includes(bundle)) {
130
+ // Only reachable with a non-default bundle name that folds to a real
131
+ // plugin's slug: the default is reserved above. Skipping the bundle
132
+ // beats overwriting that plugin's manifests with a dependency list.
133
+ warnings.push(`the bundle name "${bundle}" collides with a plugin's manifest name — no bundle plugin emitted`);
134
+ }
135
+ if (slugs.length > 0 && !slugs.includes(bundle)) {
136
+ const shortSha = options.sourceCommit.slice(0, 12) || '0';
137
+ const description = `Everything in ${options.owner}'s marketplace you may read — one install.`;
138
+ put(`plugins/${bundle}/.claude-plugin/plugin.json`, `${JSON.stringify({ name: bundle, version: `0.0.0-${shortSha}`, description, dependencies: slugs }, null, 2)}\n`);
139
+ put(`plugins/${bundle}/${PLUGIN_MANIFEST_FILE}`, `${JSON.stringify({ $schema: PLUGIN_MANIFEST_SCHEMA, name: bundle, description }, null, 2)}\n`);
140
+ put(`plugins/${bundle}/.codex-plugin/plugin.json`, `${JSON.stringify({ name: bundle, description }, null, 2)}\n`);
141
+ }
142
+ // 5. The flat root skills/ folder, every readable skill once.
143
+ const flat = dedupeByName([...readableSkills.values()].sort((a, b) => a.path.localeCompare(b.path)), (s, other) => warnings.push(`skills/: "${s.name}" at ${s.path} shares its name with ${other.path} — left out`));
144
+ for (const s of flat)
145
+ await copySkill(kbRoot, s, `skills/${s.name}`, put);
146
+ // 6. The two catalogues + a README naming the source.
147
+ const bundleEmitted = slugs.length > 0 && !slugs.includes(bundle);
148
+ const entries = [...out.map((p) => ({ slug: p.slug, description: p.description ?? p.displayName })), ...(bundleEmitted ? [{ slug: bundle, description: 'Everything you may read, one install' }] : [])];
149
+ put('.claude-plugin/marketplace.json', `${JSON.stringify({
150
+ name: options.name,
151
+ owner: { name: options.owner },
152
+ ...(options.description ? { description: options.description } : {}),
153
+ plugins: entries.map((e) => ({ name: e.slug, source: `./plugins/${e.slug}`, description: e.description })),
154
+ }, null, 2)}\n`);
155
+ put('.agents/plugins/marketplace.json', `${JSON.stringify({
156
+ name: options.name,
157
+ plugins: entries.map((e) => ({
158
+ name: e.slug,
159
+ source: { source: 'local', path: `./plugins/${e.slug}` },
160
+ policy: { installation: 'INSTALLED_BY_DEFAULT' },
161
+ description: e.description,
162
+ })),
163
+ }, null, 2)}\n`);
164
+ put('README.md', [
165
+ `# ${options.name}`,
166
+ '',
167
+ `Compiled from ${options.owner}'s knowledge base at commit \`${options.sourceCommit}\`.`,
168
+ 'This tree is generated: edit the knowledge base, not these files.',
169
+ '',
170
+ `Plugins: ${entries.map((e) => e.slug).join(', ') || 'none'}.`,
171
+ '',
172
+ ].join('\n'));
173
+ return { files, warnings, plugins: entries.map((e) => e.slug) };
174
+ }
175
+ // --- helpers ------------------------------------------------------------------
176
+ /** Copy a skill folder (minus what never ships) under `dest`. */
177
+ async function copySkill(kbRoot, skill, dest, put) {
178
+ const abs = path.join(kbRoot, skill.path);
179
+ for (const rel of await walkFiles(abs, (name) => !NEVER_SHIPPED.has(name))) {
180
+ put(`${dest}/${rel}`, await fs.readFile(path.join(abs, rel)));
181
+ }
182
+ }
183
+ /** First by (name, path) order wins; the loser is reported to `onClash`. */
184
+ function dedupeByName(list, onClash) {
185
+ const sorted = [...list].sort((a, b) => a.name.localeCompare(b.name) || a.path.localeCompare(b.path));
186
+ const seen = new Map();
187
+ const out = [];
188
+ for (const s of sorted) {
189
+ const winner = seen.get(s.name);
190
+ if (winner) {
191
+ if (winner.path !== s.path)
192
+ onClash(s, winner);
193
+ continue;
194
+ }
195
+ seen.set(s.name, s);
196
+ out.push(s);
197
+ }
198
+ return out;
199
+ }
200
+ /**
201
+ * The portable half of a plugin's `mcpServers`: every entry the ONE
202
+ * judgement accepts (a name a client can key on, a transport it speaks, the
203
+ * field that transport needs), normalised, minus what a client cannot use —
204
+ * `${VAR}` vault references in a url or a header. Null when there is no
205
+ * server to ship; each server left out is reported with the judgement's
206
+ * reason, so an omission is diagnosable.
207
+ */
208
+ function portableMcp(servers, leftOut) {
209
+ if (!servers)
210
+ return null;
211
+ const out = {};
212
+ for (const [name, raw] of Object.entries(servers)) {
213
+ const verdict = judgeMcpServerEntry(name, raw);
214
+ if (!verdict.ok) {
215
+ leftOut(name, verdict.reason);
216
+ continue;
217
+ }
218
+ if (verdict.transport === 'stdio') {
219
+ out[name] = { ...verdict.entry };
220
+ continue;
221
+ }
222
+ const entry = { type: verdict.entry.type, url: verdict.entry.url };
223
+ if (containsVariableReference(verdict.entry.url)) {
224
+ leftOut(name, 'its url is expanded from the vault, which a client cannot do');
225
+ continue;
226
+ }
227
+ if (verdict.entry.headers) {
228
+ const headers = {};
229
+ for (const [h, v] of Object.entries(verdict.entry.headers)) {
230
+ if (!containsVariableReference(v))
231
+ headers[h] = v;
232
+ }
233
+ if (Object.keys(headers).length > 0)
234
+ entry.headers = headers;
235
+ }
236
+ out[name] = entry;
237
+ }
238
+ return Object.keys(out).length > 0 ? out : null;
239
+ }
240
+ //# sourceMappingURL=compile-marketplace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-marketplace.js","sourceRoot":"","sources":["../../../../src/modules/plugins/compile/compile-marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAkG/E,MAAM,WAAW,GAAG,WAAW,CAAC;AAChC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAClD,wEAAwE;AACxE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAClE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAmB;IAC1D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,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,CAAC;YACjC,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAA4B,EAAE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAC5F,IAAI,yBAAyB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACjD,OAAO,CAAC,IAAI,EAAE,8DAA8D,CAAC,CAAC;YAC9E,SAAS;QACX,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC1B,MAAM,OAAO,GAA2B,EAAE,CAAC;YAC3C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3D,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC;oBAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACpD,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;gBAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;QAC/D,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC"}
@@ -0,0 +1,66 @@
1
+ import type { WorkspaceService } from '../../workspace/workspace.service.js';
2
+ import type { IAccessControl } from '../../access/access-control.interface.js';
3
+ import type { ISkillService } from '../../skills/skills.contract.js';
4
+ import type { PluginLinkIndex } from '../plugin-links.js';
5
+ import type { PluginSource } from '../discovery/plugin-source.js';
6
+ import { type VirtualTree } from './compile-marketplace.js';
7
+ /** Whose view of the knowledge base to compile. */
8
+ export type CompileAudience = {
9
+ userEmail: string;
10
+ } | {
11
+ everyone: true;
12
+ };
13
+ /**
14
+ * The compiler wired to the live deployment: the default-branch checkout,
15
+ * the released catalog, the link index, and the access resolver as the read
16
+ * verdict. Every sink — the per-user git endpoint, a public mirror, a local
17
+ * export — asks this for a tree and writes it somewhere.
18
+ *
19
+ * Two audiences: a PERSON (their `canRead` per skill, exactly the catalog's
20
+ * filter) or EVERYONE (only what `read: everyone` reaches cleanly — the
21
+ * public subset a shared mirror may carry). Nothing in between: an audience
22
+ * that is "these three people" would need a union of verdicts nobody has
23
+ * asked for yet.
24
+ */
25
+ export declare class MarketplaceCompilerService {
26
+ private readonly workspaceService;
27
+ private readonly accessControl;
28
+ private readonly skillService;
29
+ private readonly links;
30
+ private readonly kbDirName;
31
+ private readonly marketplace;
32
+ private readonly source;
33
+ constructor(workspaceService: WorkspaceService, accessControl: IAccessControl, skillService: ISkillService, links: PluginLinkIndex, kbDirName: string, marketplace: {
34
+ name: string;
35
+ owner: string;
36
+ description?: string;
37
+ /** The hosted MCP endpoint to ship in the skills plugin (URL only). */
38
+ knowledgeBaseMcp?: {
39
+ name: string;
40
+ url: string;
41
+ };
42
+ }, source?: PluginSource);
43
+ /**
44
+ * The default-branch commit the next compile would read. Throws when git
45
+ * cannot say: the repo service keys freshness on this value, and a stable
46
+ * placeholder would make every later compile look unnecessary — source
47
+ * changes and access revocations would never reach that caller again.
48
+ */
49
+ sourceCommit(): Promise<string>;
50
+ compileFor(audience: CompileAudience,
51
+ /** The commit to stamp the tree with, when the caller already read it (the freshness check does). */
52
+ knownCommit?: string): Promise<VirtualTree & {
53
+ sourceCommit: string;
54
+ }>;
55
+ private checkout;
56
+ /**
57
+ * One batch verdict per compile, then a lookup. Fail closed both ways: a
58
+ * path the batch skipped is unreadable, and for the everyone audience a
59
+ * skill is public only when the resolver says `read: everyone` applies
60
+ * cleanly (`restricted: false`).
61
+ */
62
+ private readPredicate;
63
+ }
64
+ /** The default-branch workspace id compiles run against. */
65
+ export declare function compileWorkspaceId(): string;
66
+ //# sourceMappingURL=marketplace-compiler.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketplace-compiler.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/plugins/compile/marketplace-compiler.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIhF,mDAAmD;AACnD,MAAM,MAAM,eAAe,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,qBAAa,0BAA0B;IAEnC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAO5B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAZN,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,cAAc,EAC7B,YAAY,EAAE,aAAa,EAC3B,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,uEAAuE;QACvE,gBAAgB,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KAClD,EACgB,MAAM,GAAE,YAAmC;IAG9D;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAW/B,UAAU,CACd,QAAQ,EAAE,eAAe;IACzB,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,WAAW,GAAG;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;YAwCpC,QAAQ;IAKtB;;;;;OAKG;YACW,aAAa;CAyB5B;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
@@ -0,0 +1,132 @@
1
+ import path from 'node:path';
2
+ import { execFile } from 'node:child_process';
3
+ import { promisify } from 'node:util';
4
+ import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
5
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
6
+ import { KbPluginSource } from '../discovery/kb-plugin-source.js';
7
+ import { compileMarketplace } from './compile-marketplace.js';
8
+ const execFileAsync = promisify(execFile);
9
+ /**
10
+ * The compiler wired to the live deployment: the default-branch checkout,
11
+ * the released catalog, the link index, and the access resolver as the read
12
+ * verdict. Every sink — the per-user git endpoint, a public mirror, a local
13
+ * export — asks this for a tree and writes it somewhere.
14
+ *
15
+ * Two audiences: a PERSON (their `canRead` per skill, exactly the catalog's
16
+ * filter) or EVERYONE (only what `read: everyone` reaches cleanly — the
17
+ * public subset a shared mirror may carry). Nothing in between: an audience
18
+ * that is "these three people" would need a union of verdicts nobody has
19
+ * asked for yet.
20
+ */
21
+ export class MarketplaceCompilerService {
22
+ workspaceService;
23
+ accessControl;
24
+ skillService;
25
+ links;
26
+ kbDirName;
27
+ marketplace;
28
+ source;
29
+ constructor(workspaceService, accessControl, skillService, links, kbDirName, marketplace, source = new KbPluginSource()) {
30
+ this.workspaceService = workspaceService;
31
+ this.accessControl = accessControl;
32
+ this.skillService = skillService;
33
+ this.links = links;
34
+ this.kbDirName = kbDirName;
35
+ this.marketplace = marketplace;
36
+ this.source = source;
37
+ }
38
+ /**
39
+ * The default-branch commit the next compile would read. Throws when git
40
+ * cannot say: the repo service keys freshness on this value, and a stable
41
+ * placeholder would make every later compile look unnecessary — source
42
+ * changes and access revocations would never reach that caller again.
43
+ */
44
+ async sourceCommit() {
45
+ const { kbRoot } = await this.checkout();
46
+ const { stdout } = await execFileAsync('git', ['-C', kbRoot, 'rev-parse', 'HEAD']);
47
+ const sha = stdout.trim();
48
+ // SHA-1 or SHA-256 object format: any hex object id is a commit.
49
+ if (!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(sha)) {
50
+ throw new Error(`could not read the default branch's commit (${sha || 'empty'})`);
51
+ }
52
+ return sha;
53
+ }
54
+ async compileFor(audience,
55
+ /** The commit to stamp the tree with, when the caller already read it (the freshness check does). */
56
+ knownCommit) {
57
+ const { wsId, kbRoot } = await this.checkout();
58
+ // Strictness about the commit belongs to the FRESHNESS check (the repo
59
+ // service calls `sourceCommit()` itself and refuses to serve without
60
+ // one). A compile of a checkout git cannot describe still yields a
61
+ // correct tree; only its README and bundle version lose the sha.
62
+ const sourceCommit = knownCommit ?? (await this.sourceCommit().catch(() => 'unknown'));
63
+ // The tree is stamped with the checkout's commit, so every input must be
64
+ // read from that checkout NOW — not from a catalog scanned before the
65
+ // commit landed. The skill catalog, the link index and the access memo
66
+ // are TTL caches that nothing drops on an ordinary write (an MCP
67
+ // `write_files` moves HEAD and invalidates none of them), and the repo
68
+ // service keys freshness on the stamped commit: a tree compiled from a
69
+ // stale catalog under a fresh sha would be "current" until the NEXT
70
+ // commit, with the caller's marketplace frozen on content the knowledge
71
+ // base no longer has. Compiles run once per moved commit per caller, so
72
+ // the rescan is cheap where it matters.
73
+ this.skillService.invalidate();
74
+ this.links.invalidate();
75
+ this.accessControl.invalidate(wsId);
76
+ const skills = await this.skillService.listSkills(undefined);
77
+ const membership = await this.links.membership();
78
+ const { plugins, warnings: discoveryWarnings } = await this.source.discover(kbRoot);
79
+ const readable = await this.readPredicate(wsId, audience, skills.map((s) => `${s.path}/SKILL.md`));
80
+ const tree = await compileMarketplace({
81
+ kbRoot,
82
+ skills,
83
+ plugins,
84
+ membership,
85
+ readable,
86
+ options: { ...this.marketplace, sourceCommit },
87
+ });
88
+ // Discovery's warnings ride with the compile's: a plugin left out for a
89
+ // malformed manifest or an unresolved MCP profile is otherwise an
90
+ // omission nobody can diagnose from the tree alone.
91
+ return { ...tree, warnings: [...discoveryWarnings, ...tree.warnings], sourceCommit };
92
+ }
93
+ // --- internal --------------------------------------------------------------
94
+ async checkout() {
95
+ const wsId = (await this.workspaceService.getOrCreateForBranch(DEFAULT_BRANCH)).id;
96
+ return { wsId, kbRoot: path.join(await this.workspaceService.getWorkspacePath(wsId), this.kbDirName) };
97
+ }
98
+ /**
99
+ * One batch verdict per compile, then a lookup. Fail closed both ways: a
100
+ * path the batch skipped is unreadable, and for the everyone audience a
101
+ * skill is public only when the resolver says `read: everyone` applies
102
+ * cleanly (`restricted: false`).
103
+ */
104
+ async readPredicate(wsId, audience, docPaths) {
105
+ if ('userEmail' in audience) {
106
+ const verdicts = docPaths.length
107
+ ? await this.accessControl.canReadBatch(wsId, audience.userEmail, docPaths)
108
+ : new Map();
109
+ return async (p) => verdicts.get(p) === true;
110
+ }
111
+ const cache = new Map();
112
+ return async (p) => {
113
+ const hit = cache.get(p);
114
+ if (hit !== undefined)
115
+ return hit;
116
+ let verdict = false;
117
+ try {
118
+ verdict = !(await this.accessControl.eligibleReaders(wsId, p)).restricted;
119
+ }
120
+ catch {
121
+ verdict = false;
122
+ }
123
+ cache.set(p, verdict);
124
+ return verdict;
125
+ };
126
+ }
127
+ }
128
+ /** The default-branch workspace id compiles run against. */
129
+ export function compileWorkspaceId() {
130
+ return workspaceIdForBranch(DEFAULT_BRANCH);
131
+ }
132
+ //# sourceMappingURL=marketplace-compiler.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketplace-compiler.service.js","sourceRoot":"","sources":["../../../../src/modules/plugins/compile/marketplace-compiler.service.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAIjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAoB,MAAM,0BAA0B,CAAC;AAEhF,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAK1C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,0BAA0B;IAElB;IACA;IACA;IACA;IACA;IACA;IAOA;IAbnB,YACmB,gBAAkC,EAClC,aAA6B,EAC7B,YAA2B,EAC3B,KAAsB,EACtB,SAAiB,EACjB,WAMhB,EACgB,SAAuB,IAAI,cAAc,EAAE;QAZ3C,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,kBAAa,GAAb,aAAa,CAAgB;QAC7B,iBAAY,GAAZ,YAAY,CAAe;QAC3B,UAAK,GAAL,KAAK,CAAiB;QACtB,cAAS,GAAT,SAAS,CAAQ;QACjB,gBAAW,GAAX,WAAW,CAM3B;QACgB,WAAM,GAAN,MAAM,CAAqC;IAC3D,CAAC;IAEJ;;;;;OAKG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;QACnF,MAA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,CAAC,KAAK,IAAI,CAAC;QAC/C,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;QACzC,OAAO,KAAK,EAAE,CAAC,EAAE,EAAE;YACjB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,GAAG,KAAK,SAAS;gBAAE,OAAO,GAAG,CAAC;YAClC,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC;gBACH,OAAO,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;YAC5E,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;YACD,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YACtB,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC;CACF;AAED,4DAA4D;AAC5D,MAAM,UAAU,kBAAkB;IAChC,OAAO,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { DiscoveredPlugin } from '../plugin-source.js';
2
+ import { type McpRegistry } from './registry.js';
3
+ /**
4
+ * THE DETACHABLE PART — a customer's plugin file format, read as-is:
5
+ *
6
+ * <pluginsRoot>/<scope…>/<plugin>/plugin.bundle.json
7
+ * {
8
+ * "name": "example-plugin", "version": "1.3.1", "description": "…",
9
+ * "mcpProfile": "global",
10
+ * "interface": { "displayName": "Example Plugin", "category": "…" },
11
+ * "sourceSkillRoots": [ "skills/departments/engineering/shared/<cluster>" ]
12
+ * }
13
+ *
14
+ * A bundle is a LIST OF SKILL PATHS plus a pointer into an MCP registry —
15
+ * which is exactly the native model's "a plugin links skills" with different
16
+ * field names. So the reader maps:
17
+ *
18
+ * sourceSkillRoots → linkedRoots (a root is a skill or a folder of skills)
19
+ * mcpProfile → mcpServers (expanded through the registry)
20
+ * name/version/desc → a synthesised manifest
21
+ * interface.displayName → the plugin's display name
22
+ *
23
+ * The walker (`kb-plugin-source.ts`) calls this for every folder holding a
24
+ * bundle file; this reads the file and decides nothing else. READ-ONLY by
25
+ * construction: nothing in this directory writes. A bundle's links are plain
26
+ * references (`linksAreManaged: false`): no principal grant is written or
27
+ * checked, the skills' own scopes decide readability.
28
+ *
29
+ * Deleting the dialect later = this directory, the one `else if` in the
30
+ * walker that calls it, and the walker's registry load.
31
+ */
32
+ export declare const BUNDLE_FILE = "plugin.bundle.json";
33
+ export declare const DEFAULT_REGISTRY_PATH = "configs/mcp/registry.json";
34
+ /** The registry, when the repository has one; a missing file is null, a broken one warns. */
35
+ export declare function loadRegistry(kbRoot: string, warnings: string[]): Promise<McpRegistry | null>;
36
+ export declare function readBundlePlugin(dir: string, folder: string, relFolder: string, registry: McpRegistry | null, warnings: string[], unreadable: string[]): Promise<DiscoveredPlugin | null>;
37
+ //# sourceMappingURL=bundle.source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.source.d.ts","sourceRoot":"","sources":["../../../../../src/modules/plugins/discovery/bundle-dialect/bundle.source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAgC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE,6FAA6F;AAC7F,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAgBlG;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA0ElC"}