@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,304 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { DEFAULT_BRANCH, PLUGIN_MANIFEST_FILE, linkedSkillRoots, normalizeSkillRoot, pluginManifestName, renderPluginManifest, skillUnderRoot, withLinkedSkillRoots, } from '@bevel-software/platform-shared';
4
+ import { AccessMutationService, accessMdPathForFolder } from '../access/access-mutation.service.js';
5
+ import { pluginPrincipalKey } from '../access-model/access-grammar.js';
6
+ import { WorkspaceMutex } from '../kb-fs/mutex.js';
7
+ import { linksWorkspaceId } from './plugin-links.js';
8
+ /** A refusal the route passes through: message + HTTP status + a machine-readable kind. */
9
+ export class PluginLinkError extends Error {
10
+ status;
11
+ payload;
12
+ constructor(message, status, payload = {}) {
13
+ super(message);
14
+ this.status = status;
15
+ this.payload = payload;
16
+ this.name = 'PluginLinkError';
17
+ }
18
+ }
19
+ /**
20
+ * Linking shared skills into plugins — the writer behind "add an existing
21
+ * skill to this plugin".
22
+ *
23
+ * A link is TWO edits that only make sense together:
24
+ *
25
+ * 1. the skill's root goes into the plugin manifest's
26
+ * `extensions["software.bevel.hexis"].skills` list (see
27
+ * `HEXIS_LINKED_SKILLS_KEY`), which is what the catalog, the plugin page
28
+ * and the compiled distribution read;
29
+ * 2. the skill folder's own `access.md` grants `read` to
30
+ * `plugin/<Name>/read` and `write` to `plugin/<Name>/write`, which is
31
+ * what lets the plugin's members actually read it — ownership decides,
32
+ * the plugin is a view (see `plugin-principals.ts`).
33
+ *
34
+ * Which is why linking needs write on BOTH sides: on the plugin folder (to
35
+ * edit its manifest) and on the skill's root (to edit its access rules). A
36
+ * manager who lacks the second gets a 409 the UI turns into "request write
37
+ * access", not a link that silently shares nothing.
38
+ *
39
+ * Unlinking removes the manifest entry, and revokes the two tokens only when
40
+ * the actor may edit the skill's rules — otherwise the grant stays, and the
41
+ * skill page says so, for a skill editor to remove.
42
+ *
43
+ * Repair re-grants the tokens for a link that exists but whose grant was
44
+ * hand-removed: the amber dot's one action.
45
+ *
46
+ * Every operation is serialised on BOTH sides it writes — the plugin's
47
+ * manifest slug (the same key provisioning locks on) and the skill root whose
48
+ * access.md carries the grant — and lands as ordinary default-branch commits
49
+ * through the pending-commit driver, so the write gate and the per-user push
50
+ * gate apply exactly as they do to any edit.
51
+ */
52
+ export class PluginLinksService {
53
+ workspaceService;
54
+ commits;
55
+ accessControl;
56
+ skillService;
57
+ links;
58
+ kbDirName;
59
+ events;
60
+ onChanged;
61
+ locks = new WorkspaceMutex();
62
+ mutation;
63
+ constructor(workspaceService, commits, accessControl, skillService, links, kbDirName, events, onChanged) {
64
+ this.workspaceService = workspaceService;
65
+ this.commits = commits;
66
+ this.accessControl = accessControl;
67
+ this.skillService = skillService;
68
+ this.links = links;
69
+ this.kbDirName = kbDirName;
70
+ this.events = events;
71
+ this.onChanged = onChanged;
72
+ this.mutation = new AccessMutationService(workspaceService, accessControl, kbDirName);
73
+ }
74
+ async link(user, plugin, rawRoot) {
75
+ const folder = await this.pluginFolder(plugin);
76
+ const root = this.rootOrThrow(rawRoot);
77
+ const wsId = linksWorkspaceId();
78
+ await this.requirePluginWrite(wsId, user, folder);
79
+ const skills = await this.resolvedSkills(root);
80
+ if (skills.length === 0) {
81
+ throw new PluginLinkError(`"${root}" holds no released skill. Link a skill folder, or a folder that contains skills.`, 422, { kind: 'no-skills', root });
82
+ }
83
+ if (!(await this.accessControl.canWrite(wsId, user.email, accessMdPathForFolder(root)))) {
84
+ // The manager may edit the plugin but not the skill's rules — the link
85
+ // would share nothing. The UI offers the request path on this shape.
86
+ throw new PluginLinkError(`You can't change who may read "${root}". Ask its editors for write access first.`, 409, { kind: 'needs-skill-write', root });
87
+ }
88
+ return this.locks.runAll(this.lockKeys(folder, root), async () => {
89
+ const { manifest, manifestRel } = await this.readManifest(wsId, folder);
90
+ const roots = linkedSkillRoots(manifest);
91
+ // Manifest FIRST, grant second — two commits, deliberately in this
92
+ // order. The two files live in different folders and the commit
93
+ // pipeline is path-scoped, so there is no single commit to be had; what
94
+ // can be chosen is which half-state a failure leaves. Listed-but-not-
95
+ // shared is the visible one: the link index reports the missing grant,
96
+ // the card wears the amber dot, and Repair finishes the job. The other
97
+ // order would leave shared-but-not-listed — an over-share nothing
98
+ // surfaces.
99
+ if (!roots.includes(root)) {
100
+ await this.workspaceService.writeFile(wsId, manifestRel, `${JSON.stringify(withLinkedSkillRoots(manifest, [...roots, root]), null, 2)}\n`);
101
+ await this.commits.runPendingCommit(wsId, DEFAULT_BRANCH, manifestRel, user);
102
+ }
103
+ await this.grantTokens(wsId, user, folder, root);
104
+ this.changed(wsId);
105
+ return { root, skills };
106
+ });
107
+ }
108
+ async unlink(user, plugin, rawRoot) {
109
+ const folder = await this.pluginFolder(plugin);
110
+ const root = this.rootOrThrow(rawRoot);
111
+ const wsId = linksWorkspaceId();
112
+ await this.requirePluginWrite(wsId, user, folder);
113
+ return this.locks.runAll(this.lockKeys(folder, root), async () => {
114
+ const { manifest, manifestRel } = await this.readManifest(wsId, folder);
115
+ const roots = linkedSkillRoots(manifest);
116
+ if (!roots.includes(root)) {
117
+ throw new PluginLinkError(`"${root}" is not linked into ${folder}.`, 404, { kind: 'not-linked', root });
118
+ }
119
+ // Revoke FIRST, manifest second — the mirror of `link`'s ordering and
120
+ // for the same reason: a failure between the two must leave the
121
+ // visible half-state (listed, no grant → amber dot, Repair), never the
122
+ // silent one (unlisted, still shared). Revoke only where the actor may
123
+ // edit the skill's rules; otherwise the grant stays for a skill editor
124
+ // to remove — never a silent no-op that pretends it happened.
125
+ let revoked = false;
126
+ if (await this.accessControl.canWrite(wsId, user.email, accessMdPathForFolder(root))) {
127
+ let changed = false;
128
+ for (const principal of this.tokens(folder)) {
129
+ const r = await this.mutation.revoke(wsId, 'folder', root, principal, user.email, undefined, {
130
+ tokenMatch: 'exact',
131
+ });
132
+ changed ||= r.changed;
133
+ }
134
+ if (changed) {
135
+ await this.commits.runPendingCommit(wsId, DEFAULT_BRANCH, `${this.kbDirName}/${accessMdPathForFolder(root)}`, user);
136
+ }
137
+ revoked = true;
138
+ }
139
+ await this.workspaceService.writeFile(wsId, manifestRel, `${JSON.stringify(withLinkedSkillRoots(manifest, roots.filter((r) => r !== root)), null, 2)}\n`);
140
+ await this.commits.runPendingCommit(wsId, DEFAULT_BRANCH, manifestRel, user);
141
+ this.changed(wsId);
142
+ return { root, revoked };
143
+ });
144
+ }
145
+ async repair(user, plugin, rawRoot) {
146
+ const folder = await this.pluginFolder(plugin);
147
+ const root = this.rootOrThrow(rawRoot);
148
+ const wsId = linksWorkspaceId();
149
+ // Everything under the lock, the manifest read included: a repair that
150
+ // checked the link and then waited on an unlink would re-grant a root the
151
+ // manifest no longer names.
152
+ return this.locks.runAll(this.lockKeys(folder, root), async () => {
153
+ const { manifest } = await this.readManifest(wsId, folder);
154
+ if (!linkedSkillRoots(manifest).includes(root)) {
155
+ throw new PluginLinkError(`"${root}" is not linked into ${folder}.`, 404, { kind: 'not-linked', root });
156
+ }
157
+ if (!(await this.accessControl.canWrite(wsId, user.email, accessMdPathForFolder(root)))) {
158
+ throw new PluginLinkError(`You can't change who may read "${root}".`, 403, {
159
+ kind: 'needs-skill-write',
160
+ root,
161
+ });
162
+ }
163
+ // The same retired-skill rule as `link`: a repair re-grants on the root.
164
+ await this.resolvedSkills(root);
165
+ await this.grantTokens(wsId, user, folder, root);
166
+ this.changed(wsId);
167
+ return { root };
168
+ });
169
+ }
170
+ // --- internal --------------------------------------------------------------
171
+ /**
172
+ * ONE reservation for both sides of a link: the plugin's manifest AND the
173
+ * skill root's access.md. Two plugins linking the same root write the same
174
+ * file, and serialising on the plugin alone let them interleave, one splice
175
+ * overwriting the other's grant. `runAll` takes both keys atomically, so
176
+ * nothing nests and no ordering discipline is needed.
177
+ */
178
+ lockKeys(folder, root) {
179
+ return [`plugin:${pluginManifestName(folder)}`, `root:${root}`];
180
+ }
181
+ /**
182
+ * The two grants a link carries: members read, managers write — written as
183
+ * the CANONICAL keys (slugged name), the spelling every comparison uses, so
184
+ * a repeated link finds its grant and an unlink finds what to revoke
185
+ * whatever the folder is called.
186
+ */
187
+ tokens(folder) {
188
+ const slug = pluginManifestName(folder);
189
+ return [
190
+ { kind: 'role', role: pluginPrincipalKey(slug, 'read') },
191
+ { kind: 'role', role: pluginPrincipalKey(slug, 'write') },
192
+ ];
193
+ }
194
+ async grantTokens(wsId, user, folder, root) {
195
+ const [read, write] = this.tokens(folder);
196
+ const a = await this.mutation.grant(wsId, 'folder', root, 'read', read);
197
+ const b = await this.mutation.grant(wsId, 'folder', root, 'write', write);
198
+ if (a.changed || b.changed) {
199
+ await this.commits.runPendingCommit(wsId, DEFAULT_BRANCH, `${this.kbDirName}/${a.editPath}`, user);
200
+ }
201
+ }
202
+ rootOrThrow(raw) {
203
+ const root = normalizeSkillRoot(raw);
204
+ if (root === null) {
205
+ throw new PluginLinkError('A skill path must be a repo-relative folder path.', 422, { kind: 'bad-root' });
206
+ }
207
+ return root;
208
+ }
209
+ /**
210
+ * Released skills under the root — the catalog's answer, not the file
211
+ * system's. A RETIRED skill is kept for its owners and never shared onward:
212
+ * the grant lands on the ROOT folder, so a root that holds a retired skill
213
+ * anywhere beneath it cannot be linked at all — the grant would reach the
214
+ * retired one too. The refusal names them so the manager can link the
215
+ * active skills individually instead.
216
+ */
217
+ async resolvedSkills(root) {
218
+ const under = (await this.skillService.listSkills(undefined)).filter((s) => skillUnderRoot(s.path, root));
219
+ const retired = under.filter((s) => s.lifecycle === 'retired').map((s) => s.path);
220
+ if (retired.length > 0) {
221
+ throw new PluginLinkError(`"${root}" holds retired skills (${retired.join(', ')}); a retired skill is never shared onward. Link the active skills one by one.`, 422, { kind: 'retired-skills', root, retired });
222
+ }
223
+ return under.map((s) => s.path);
224
+ }
225
+ /**
226
+ * The exact on-disk plugin folder for `name`, or 404. Personal folders are
227
+ * not plugins, but that is the MEMBERSHIP's verdict (discovery marks the
228
+ * `personal-*` prefix personal only directly under the root), not a rule
229
+ * on the name — a nested plugin may be called anything.
230
+ */
231
+ async pluginFolder(name) {
232
+ const trimmed = name.trim();
233
+ if (!trimmed || trimmed.includes('/') || trimmed.includes('\\')) {
234
+ throw new PluginLinkError('Unknown plugin', 404, { kind: 'unknown-plugin' });
235
+ }
236
+ const membership = await this.links.membership();
237
+ const links = membership.byPlugin.get(trimmed);
238
+ if (!links) {
239
+ throw new PluginLinkError('Unknown plugin', 404, { kind: 'unknown-plugin' });
240
+ }
241
+ if (!links.linksAreManaged) {
242
+ // A dialect plugin's links live in a file this platform does not write.
243
+ throw new PluginLinkError(`${trimmed} is read from an external plugin format; edit its links in that repository.`, 409, { kind: 'read-only-links' });
244
+ }
245
+ return trimmed;
246
+ }
247
+ /** The repo-relative folder of a known plugin (any depth). */
248
+ async folderOf(plugin) {
249
+ const links = (await this.links.membership()).byPlugin.get(plugin);
250
+ if (!links)
251
+ throw new PluginLinkError('Unknown plugin', 404, { kind: 'unknown-plugin' });
252
+ return links.folder;
253
+ }
254
+ async requirePluginWrite(wsId, user, plugin) {
255
+ if (!(await this.accessControl.canWrite(wsId, user.email, await this.folderOf(plugin)))) {
256
+ // Same answer as an unknown plugin, so probing confirms nothing.
257
+ throw new PluginLinkError('Unknown plugin', 404, { kind: 'unknown-plugin' });
258
+ }
259
+ }
260
+ async readManifest(wsId, plugin) {
261
+ const folder = await this.folderOf(plugin);
262
+ const manifestRel = `${this.kbDirName}/${folder}/${PLUGIN_MANIFEST_FILE}`;
263
+ const abs = path.join(await this.workspaceService.getWorkspacePath(wsId), manifestRel);
264
+ let manifest = null;
265
+ let text = null;
266
+ try {
267
+ text = await fs.readFile(abs, 'utf-8');
268
+ }
269
+ catch (err) {
270
+ // Only a PROVEN absence gets the fresh minimal manifest a pre-manifest
271
+ // folder deserves. Any other failure must surface: the caller writes the
272
+ // manifest back, and a skeleton over a real one would erase its
273
+ // version, description and MCP extension block.
274
+ const code = err?.code;
275
+ if (code !== 'ENOENT' && code !== 'ENOTDIR')
276
+ throw err;
277
+ }
278
+ if (text !== null) {
279
+ try {
280
+ const parsed = JSON.parse(text);
281
+ if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
282
+ manifest = parsed;
283
+ }
284
+ }
285
+ catch {
286
+ /* unparsable */
287
+ }
288
+ if (manifest === null) {
289
+ throw new PluginLinkError(`${manifestRel} is not a JSON object; fix the manifest before changing its links.`, 422, { kind: 'bad-manifest' });
290
+ }
291
+ }
292
+ return {
293
+ manifest: manifest ?? JSON.parse(renderPluginManifest(path.posix.basename(folder))),
294
+ manifestRel,
295
+ };
296
+ }
297
+ changed(wsId) {
298
+ this.links.invalidate();
299
+ this.accessControl.invalidate(wsId);
300
+ this.onChanged?.();
301
+ this.events?.emit({ kind: 'fs-tree-changed', workspaceId: wsId, branch: DEFAULT_BRANCH });
302
+ }
303
+ }
304
+ //# sourceMappingURL=plugin-links.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-links.service.js","sourceRoot":"","sources":["../../../src/modules/plugins/plugin-links.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,E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@@
30
30
  * body names its owner. Created lazily (ensure semantics) on the first
31
31
  * personal skill.
32
32
  */
33
+ import type { PluginSource } from './discovery/plugin-source.js';
33
34
  import { type AuthUser } from '@bevel-software/platform-shared';
34
35
  import type { WorkspaceService } from '../workspace/workspace.service.js';
35
36
  import type { IAccessControl } from '../access/access-control.interface.js';
@@ -42,6 +43,8 @@ export interface ProvisionCommitDriver {
42
43
  export interface ProvisionedPlugin {
43
44
  /** The folder name under `Plugins/` (not the full path). */
44
45
  folder: string;
46
+ /** The plugin's identity — the manifest name written for it. */
47
+ name: string;
45
48
  /** False when an ensure found the folder already there. */
46
49
  created: boolean;
47
50
  }
@@ -56,6 +59,8 @@ export declare class PluginProvisionService {
56
59
  private readonly accessControl;
57
60
  private readonly kbDirName;
58
61
  private readonly events?;
62
+ /** Which names are TAKEN is discovery's answer — the same one every catalog gets. */
63
+ private readonly source;
59
64
  /**
60
65
  * Serialises creations and deletions by MANIFEST SLUG
61
66
  * (`pluginManifestName(name)`). The wx write arbitrates same-path races,
@@ -71,7 +76,9 @@ export declare class PluginProvisionService {
71
76
  workspaceId: string;
72
77
  branch: string;
73
78
  }): void;
74
- } | undefined);
79
+ } | undefined,
80
+ /** Which names are TAKEN is discovery's answer — the same one every catalog gets. */
81
+ source?: PluginSource);
75
82
  /**
76
83
  * Create `Plugins/<name>/` for `user`. Throws `PluginProvisionError` 422 on a
77
84
  * name the filesystem or the model cannot carry, 409 when the name is taken
@@ -103,10 +110,39 @@ export declare class PluginProvisionService {
103
110
  * never interleave with a re-creation of the same name (the key derives
104
111
  * from the name, so both spell it identically).
105
112
  */
106
- deletePlugin(user: AuthUser, rawName: string): Promise<void>;
113
+ deletePlugin(user: AuthUser, rawFolder: string): Promise<void>;
114
+ /**
115
+ * Whether `segments` names a directory below `root` with every component
116
+ * spelled exactly as on disk — by listing each level, which is the one
117
+ * question a case-insensitive filesystem answers honestly.
118
+ */
119
+ private exactFolderExists;
107
120
  /** The taken name (in its on-disk casing) colliding with `name`, or null. */
108
121
  private existingFolder;
109
- /** An existing PLUGIN FOLDER whose derived manifest name equals `name`'s, or null. */
122
+ /**
123
+ * The identity discovery gives the plugin at `folder`, or the folder's own
124
+ * slug when it lists none there. ONE rule for every write provisioning
125
+ * makes — create, delete — as for the rename: no write over a discovery
126
+ * with a hole in it, whether or not the hole is where this plugin lives.
127
+ * An operation that parks and commits against an identity set it could
128
+ * not fully see is the class of mistake the rule exists to make impossible.
129
+ */
130
+ private discoveredIdentity;
131
+ /** One discovery over the knowledge base checkout. */
132
+ private discovered;
133
+ /**
134
+ * An existing plugin — at ANY depth, in either file shape — whose identity
135
+ * folds to the same slug as `name`'s, as its repo-relative folder; or null.
136
+ * Discovery's answer, so creation and every catalog agree on what is taken:
137
+ * a nested plugin claims its identity as fully as a top-level one, and a
138
+ * parked delete (dot-prefixed, invisible to the walk) claims nothing.
139
+ * Personal folders count — they publish a plugin.json like any plugin
140
+ * (though the reservation above means a named plugin never reaches this
141
+ * check with a personal slug). A loose file at the root is not a plugin.
142
+ *
143
+ * Refuses on a HOLE: a listing that could not see part of the tree cannot
144
+ * prove a name free.
145
+ */
110
146
  private manifestNameTwin;
111
147
  private provision;
112
148
  private readyWorkspaceId;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-provision.service.d.ts","sourceRoot":"","sources":["../../../src/modules/plugins/plugin-provision.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,EASL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAK5E,sFAAsF;AACtF,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,QAAQ,EACd,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AAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDlE,6EAA6E;YAC/D,cAAc;IAa5B,sFAAsF;YACxE,gBAAgB;YA0BhB,SAAS;YA4DT,gBAAgB;CAI/B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE/E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEjF"}
1
+ {"version":3,"file":"plugin-provision.service.d.ts","sourceRoot":"","sources":["../../../src/modules/plugins/plugin-provision.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAMH,OAAO,KAAK,EAAa,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5E,OAAO,EAUL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAK5E,sFAAsF;AACtF,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CACd,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,QAAQ,EACd,IAAI,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,GACpC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AA+BD,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,mEAAmE;AACn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